diff --git a/README.md b/README.md index 4b7ef87..ab0bdea 100644 --- a/README.md +++ b/README.md @@ -1,43 +1,65 @@ -# OpenTelemetry Metrics Exporter for GitHub Actions +# OpenTelemetry Exporter for GitHub Actions -A GitHub Action that collects workflow step metrics (duration, status) and exports them to Google Cloud Monitoring via OpenTelemetry. +A GitHub Action that collects workflow step metrics, traces, and logs, and exports them to Google Cloud Observability (Monitoring, Trace, and Logging). ## Features -- 📊 Collects job and step-level metrics from GitHub Actions workflows -- âąī¸ Records duration histograms for performance tracking -- ✅ Tracks success/failure rates with counters -- đŸˇī¸ Rich metric labels (workflow, job, repository, run info) -- 🔒 Minimal permissions (Monitoring Metric Writer only) +- 📊 **Metrics**: Duration histograms and success/failure counters for jobs and steps +- 🔍 **Traces**: Distributed traces showing job and step execution timeline with parent-child relationships +- 📝 **Logs**: Complete workflow output (stdout/stderr) with **original timestamps** from when each line was emitted +- âąī¸ Accurate timing - all data (metrics, traces, logs) uses actual execution timestamps, not post-action time +- ✅ Automatic error detection (failed steps marked as errors in traces/logs) +- đŸˇī¸ Rich attributes and labels (workflow, job, repository, run info, step attribution) +- 🔒 Minimal permissions (only metric writer, trace agent, log writer) - 🔄 Always runs (even when steps fail) ## Setup ### 1. Create a Google Cloud Service Account -Create a service account with only the permission to write metrics: +Create a service account with minimal permissions to write metrics and traces: ```bash # Set your GCP project ID PROJECT_ID="your-project-id" # Create the service account -gcloud iam service-accounts create github-actions-metrics \ - --display-name="GitHub Actions OpenTelemetry Metrics" \ - --description="Service account for GitHub Actions to write OpenTelemetry metrics to Cloud Monitoring" \ +gcloud iam service-accounts create github-actions-otel \ + --display-name="GitHub Actions OpenTelemetry" \ + --description="Service account for GitHub Actions to export OpenTelemetry metrics and traces" \ --project="${PROJECT_ID}" -# Grant the Monitoring Metric Writer role +# Grant required roles +SA_EMAIL="github-actions-otel@${PROJECT_ID}.iam.gserviceaccount.com" + +# For metrics gcloud projects add-iam-policy-binding "${PROJECT_ID}" \ - --member="serviceAccount:github-actions-metrics@${PROJECT_ID}.iam.gserviceaccount.com" \ + --member="serviceAccount:${SA_EMAIL}" \ --role="roles/monitoring.metricWriter" \ --condition=None +# For traces +gcloud projects add-iam-policy-binding "${PROJECT_ID}" \ + --member="serviceAccount:${SA_EMAIL}" \ + --role="roles/cloudtrace.agent" \ + --condition=None + +# For logs +gcloud projects add-iam-policy-binding "${PROJECT_ID}" \ + --member="serviceAccount:${SA_EMAIL}" \ + --role="roles/logging.logWriter" \ + --condition=None + # Create and download a JSON key -gcloud iam service-accounts keys create github-actions-metrics-key.json \ - --iam-account="github-actions-metrics@${PROJECT_ID}.iam.gserviceaccount.com" +gcloud iam service-accounts keys create github-actions-otel-key.json \ + --iam-account="${SA_EMAIL}" ``` +**Roles explained:** +- `roles/monitoring.metricWriter` - Write custom metrics to Cloud Monitoring +- `roles/cloudtrace.agent` - Write traces to Cloud Trace +- `roles/logging.logWriter` - Write logs to Cloud Logging + ### 2. Add Service Account Key to GitHub You have two options: @@ -211,9 +233,11 @@ steps: metric-prefix: 'ci.metrics' ``` -## Metrics Collected +## Data Collected -### Job Duration +### Metrics + +#### Job Duration - **Metric:** `github.actions.job.duration` - **Type:** Histogram - **Unit:** milliseconds @@ -229,7 +253,7 @@ steps: - `run.number` - Workflow run number - `run.attempt` - Run attempt number -### Step Duration +#### Step Duration - **Metric:** `github.actions.step.duration` - **Type:** Histogram - **Unit:** milliseconds @@ -239,12 +263,37 @@ steps: - `step.status` - Status (completed, in_progress, etc.) - `step.conclusion` - Conclusion (success, failure, skipped, etc.) -### Step Count +#### Step Count - **Metric:** `github.actions.step.total` - **Type:** Counter - **Labels:** Same as step duration -## Viewing Metrics +### Traces + +The action creates distributed traces showing the execution timeline of your workflow: + +- **Job Span**: Root span covering the entire job execution + - Span name: `Job: {job-name}` + - Includes all job attributes (workflow, repository, run info, job status/conclusion) + - Marked as error if job fails + +- **Step Spans**: Child spans for each workflow step + - Span name: `Step: {step-name}` + - Parent: Job span (creates hierarchical trace) + - Includes all step attributes (name, number, status, conclusion) + - Marked as error if step fails + - Accurate start/end times from GitHub API + +**Benefits:** +- Visualize workflow execution in Cloud Trace timeline view +- Identify slow steps at a glance +- See step dependencies and parallelization +- Correlate failures across steps +- Track execution patterns over time + +## Viewing Data + +### Viewing Metrics Metrics will appear in Google Cloud Monitoring under custom metrics: @@ -272,6 +321,81 @@ custom.googleapis.com/github.actions/step.total | rate(1m) ``` +### Viewing Traces + +Traces will appear in Google Cloud Trace: + +1. Go to **Cloud Console → Trace → Trace Explorer** +2. You'll see traces for each workflow job execution +3. Click on a trace to see the timeline: + - Job span showing total execution time + - Step spans showing individual step durations + - Failed steps highlighted in red + - Hover over spans to see attributes (workflow name, repository, etc.) + +**Trace URL format:** +``` +https://console.cloud.google.com/traces/list?project=your-project-id +``` + +**Benefits of the trace view:** +- See all steps in a single timeline +- Identify bottlenecks visually +- Understand step execution order +- Correlate metrics with traces for deeper insights + +### Logs + +The action captures and writes **detailed workflow logs** to Google Cloud Logging: + +**What gets logged:** +- Every line of output from your workflow job (stdout/stderr) +- Each log line includes its **original timestamp** from when it was emitted +- Automatic severity detection (ERROR, WARNING, DEBUG, INFO) +- Step attribution (which step generated each log line) + +**Log entries include:** +- **Timestamp**: Original time when the log line was emitted during the job (not post-action time!) +- **Message**: The actual log output from the step +- **Severity**: Auto-detected from log content (::error::, ::warning::, ERROR, WARNING) +- **Labels**: workflow, repository, run info, job name, step name +- **Resource type**: `generic_task` + +**Fallback:** If detailed logs cannot be fetched, writes summary entries for each job and step. + +**Log name:** `github-actions` + +**Viewing logs:** +1. Go to **Cloud Console → Logging → Logs Explorer** +2. Query: `logName="projects/your-project-id/logs/github-actions"` +3. Filter by repository, workflow, job, or step using labels + +**Example queries:** + +View all logs from a specific run: +``` +logName="projects/your-project-id/logs/github-actions" +labels.run_number="42" +``` + +Find errors during the workflow: +``` +logName="projects/your-project-id/logs/github-actions" +severity=ERROR +``` + +View logs for a specific step: +``` +logName="projects/your-project-id/logs/github-actions" +labels.step="npm test" +``` + +**Benefits:** +- Complete workflow output preserved with accurate timestamps +- Search and filter logs by step, workflow, repository +- Correlate log errors with trace spans and metrics +- Historical log retention in Cloud Logging (not just GitHub's 90 days) + ## Alternative: Using Workload Identity Federation (Recommended) Instead of service account keys, you can use Workload Identity Federation (WIF). This is the **recommended** approach for production as it doesn't require managing service account key files. diff --git a/action.yml b/action.yml index 32854de..ab11f1a 100644 --- a/action.yml +++ b/action.yml @@ -1,5 +1,5 @@ -name: 'OpenTelemetry Metrics Exporter' -description: 'Collects GitHub Actions workflow step metrics and exports them to Google Cloud Monitoring via OpenTelemetry' +name: 'OpenTelemetry Exporter' +description: 'Collects GitHub Actions workflow metrics, traces, and logs, and exports them to Google Cloud Observability' author: 'Jason' branding: icon: 'activity' diff --git a/dist/index.js b/dist/index.js index 9a080fa..3c2a391 100644 --- a/dist/index.js +++ b/dist/index.js @@ -77,7 +77,11 @@ async function checkServiceAccountPermissions(projectId, serviceAccountEmail, cr core.info(`Service account has ${serviceAccountRoles.length} role(s): ${serviceAccountRoles.join(', ')}`); // Check for excessive permissions - const allowedRoles = ['roles/monitoring.metricWriter']; + const allowedRoles = [ + 'roles/monitoring.metricWriter', + 'roles/cloudtrace.agent', + 'roles/logging.logWriter', + ]; const excessiveRoles = serviceAccountRoles.filter(role => !allowedRoles.includes(role)); if (excessiveRoles.length > 0) { @@ -92,7 +96,9 @@ async function checkServiceAccountPermissions(projectId, serviceAccountEmail, cr excessiveRoles.forEach(role => core.error(` - ${role}`)); core.error(''); core.error('This service account should ONLY have:'); - core.error(' - roles/monitoring.metricWriter'); + core.error(' - roles/monitoring.metricWriter (for metrics)'); + core.error(' - roles/cloudtrace.agent (for traces)'); + core.error(' - roles/logging.logWriter (for logs)'); core.error(''); core.error('To fix, remove excessive roles:'); excessiveRoles.forEach(role => { @@ -117,7 +123,10 @@ async function checkServiceAccountPermissions(projectId, serviceAccountEmail, cr // Don't fail on API errors (service account likely doesn't have permission to check IAM) core.info('â„šī¸ Could not verify service account permissions via IAM API'); core.info(' This is expected when the service account has minimal permissions'); - core.info(' Ensure the service account ONLY has: roles/monitoring.metricWriter'); + core.info(' Ensure the service account has ONLY:'); + core.info(' - roles/monitoring.metricWriter (for metrics)'); + core.info(' - roles/cloudtrace.agent (for traces)'); + core.info(' - roles/logging.logWriter (for logs)'); core.debug(`Permission check error: ${error.message}`); } } diff --git a/dist/post/index.js b/dist/post/index.js index ed57664..ea27d4d 100644 --- a/dist/post/index.js +++ b/dist/post/index.js @@ -100,7 +100,74 @@ async function collectMetrics(octokit, context) { } } -module.exports = { collectMetrics }; +/** + * Collects job logs from GitHub Actions workflow + * @param {Object} octokit - Authenticated Octokit instance + * @param {Object} context - GitHub context + * @param {number} jobId - Job ID + * @returns {Promise} Parsed log entries with timestamps + */ +async function collectLogs(octokit, context, jobId) { + const { owner, repo } = context.repo; + + core.info(`Collecting logs for job ${jobId}`); + + try { + // Download job logs + const response = await octokit.rest.actions.downloadJobLogsForWorkflowRun({ + owner, + repo, + job_id: jobId, + }); + + // The response is a redirect URL or direct log content + const logText = response.data; + + if (!logText || typeof logText !== 'string') { + core.warning('No logs available or unexpected log format'); + return []; + } + + // Parse logs - GitHub Actions logs have format: + // 2025-11-05T15:49:00.1234567Z log message here + const logLines = logText.split('\n'); + const parsedLogs = []; + + let currentStep = 'unknown'; + + for (const line of logLines) { + // Extract timestamp from log line (ISO 8601 format) + const timestampMatch = line.match(/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d+Z)\s+(.*)$/); + + if (timestampMatch) { + const [, timestamp, message] = timestampMatch; + + // Detect step boundaries (GitHub Actions marks these) + if (message.includes('##[group]Run ')) { + const stepMatch = message.match(/##\[group\]Run (.+)/); + if (stepMatch) { + currentStep = stepMatch[1]; + } + } + + parsedLogs.push({ + timestamp: new Date(timestamp), + message: message, + step: currentStep, + }); + } + } + + core.info(`Parsed ${parsedLogs.length} log lines`); + return parsedLogs; + + } catch (error) { + core.warning(`Failed to collect logs: ${error.message}`); + return []; + } +} + +module.exports = { collectMetrics, collectLogs }; /***/ }), @@ -181,7 +248,11 @@ async function checkServiceAccountPermissions(projectId, serviceAccountEmail, cr core.info(`Service account has ${serviceAccountRoles.length} role(s): ${serviceAccountRoles.join(', ')}`); // Check for excessive permissions - const allowedRoles = ['roles/monitoring.metricWriter']; + const allowedRoles = [ + 'roles/monitoring.metricWriter', + 'roles/cloudtrace.agent', + 'roles/logging.logWriter', + ]; const excessiveRoles = serviceAccountRoles.filter(role => !allowedRoles.includes(role)); if (excessiveRoles.length > 0) { @@ -196,7 +267,9 @@ async function checkServiceAccountPermissions(projectId, serviceAccountEmail, cr excessiveRoles.forEach(role => core.error(` - ${role}`)); core.error(''); core.error('This service account should ONLY have:'); - core.error(' - roles/monitoring.metricWriter'); + core.error(' - roles/monitoring.metricWriter (for metrics)'); + core.error(' - roles/cloudtrace.agent (for traces)'); + core.error(' - roles/logging.logWriter (for logs)'); core.error(''); core.error('To fix, remove excessive roles:'); excessiveRoles.forEach(role => { @@ -221,7 +294,10 @@ async function checkServiceAccountPermissions(projectId, serviceAccountEmail, cr // Don't fail on API errors (service account likely doesn't have permission to check IAM) core.info('â„šī¸ Could not verify service account permissions via IAM API'); core.info(' This is expected when the service account has minimal permissions'); - core.info(' Ensure the service account ONLY has: roles/monitoring.metricWriter'); + core.info(' Ensure the service account has ONLY:'); + core.info(' - roles/monitoring.metricWriter (for metrics)'); + core.info(' - roles/cloudtrace.agent (for traces)'); + core.info(' - roles/logging.logWriter (for logs)'); core.debug(`Permission check error: ${error.message}`); } } @@ -349,8 +425,11 @@ module.exports = { getConfig }; const core = __nccwpck_require__(37484); const { MeterProvider, PeriodicExportingMetricReader } = __nccwpck_require__(89174); const { MetricExporter } = __nccwpck_require__(80076); +const { TraceExporter } = __nccwpck_require__(93837); +const { BasicTracerProvider, BatchSpanProcessor } = __nccwpck_require__(94952); const { Resource } = __nccwpck_require__(75647); const { ATTR_SERVICE_NAME, ATTR_SERVICE_NAMESPACE, ATTR_SERVICE_INSTANCE_ID } = __nccwpck_require__(13695); +const { Logging } = __nccwpck_require__(44391); /** * Creates and configures an OpenTelemetry MeterProvider with GCP exporter @@ -502,7 +581,307 @@ async function shutdown(meterProvider) { } } -module.exports = { createMeterProvider, recordMetrics, shutdown }; +/** + * Creates and configures an OpenTelemetry TracerProvider with GCP exporter + * @param {Object} config - Configuration object + * @returns {Object} TracerProvider and tracer + */ +function createTracerProvider(config) { + core.info('Initializing OpenTelemetry TracerProvider with Google Cloud Trace exporter'); + + const resource = new Resource({ + [ATTR_SERVICE_NAME]: config.serviceName, + [ATTR_SERVICE_NAMESPACE]: config.serviceNamespace, + [ATTR_SERVICE_INSTANCE_ID]: process.env.GITHUB_RUN_ID || 'unknown', + }); + + const exporterOptions = { + projectId: config.gcpProjectId, + }; + + if (config.gcpServiceAccountKey) { + try { + const credentials = JSON.parse(config.gcpServiceAccountKey); + exporterOptions.credentials = credentials; + } catch (error) { + core.error(`Failed to parse service account key for traces: ${error.message}`); + throw new Error('Invalid service account key JSON'); + } + } + + const exporter = new TraceExporter(exporterOptions); + const spanProcessor = new BatchSpanProcessor(exporter); + + const tracerProvider = new BasicTracerProvider({ + resource, + }); + + tracerProvider.addSpanProcessor(spanProcessor); + + const tracer = tracerProvider.getTracer(config.metricPrefix); + + return { tracerProvider, tracer }; +} + +/** + * Records traces for collected workflow data + * @param {Object} tracer - OpenTelemetry tracer + * @param {Object} metrics - Collected metrics from GitHub + * @returns {Object} Root span for the job + */ +function recordTraces(tracer, metrics) { + core.info('Recording traces to OpenTelemetry'); + + const baseAttributes = { + 'workflow.name': metrics.workflow, + 'repository.owner': metrics.repository.owner, + 'repository.name': metrics.repository.repo, + 'repository.full_name': metrics.repository.fullName, + 'run.id': metrics.run.id.toString(), + 'run.number': metrics.run.number.toString(), + 'run.attempt': metrics.run.attempt, + }; + + // Create a span for the entire job + const jobSpan = tracer.startSpan(`Job: ${metrics.job.name}`, { + startTime: metrics.job.startedAt, + attributes: { + ...baseAttributes, + 'job.name': metrics.job.name, + 'job.id': metrics.job.id.toString(), + 'job.status': metrics.job.status, + 'job.conclusion': metrics.job.conclusion || 'unknown', + }, + }); + + // Create child spans for each step + for (const step of metrics.steps) { + if (step.startedAt && step.completedAt) { + const stepSpan = tracer.startSpan(`Step: ${step.name}`, { + startTime: step.startedAt, + attributes: { + ...baseAttributes, + 'job.name': metrics.job.name, + 'step.name': step.name, + 'step.number': step.number.toString(), + 'step.status': step.status, + 'step.conclusion': step.conclusion || 'unknown', + }, + }, { + parent: jobSpan, + }); + + // Mark span as error if step failed + if (step.conclusion === 'failure') { + stepSpan.setStatus({ code: 2, message: 'Step failed' }); // SpanStatusCode.ERROR = 2 + stepSpan.recordException(new Error(`Step "${step.name}" failed`)); + } + + stepSpan.end(step.completedAt); + core.debug(`Created span for step: ${step.name}`); + } + } + + // End the job span + if (metrics.job.completedAt) { + if (metrics.job.conclusion === 'failure') { + jobSpan.setStatus({ code: 2, message: 'Job failed' }); + } + jobSpan.end(metrics.job.completedAt); + } + + core.info(`Recorded traces for job and ${metrics.steps.length} steps`); + return jobSpan; +} + +/** + * Shuts down tracer provider + * @param {Object} tracerProvider - TracerProvider instance + * @returns {Promise} + */ +async function shutdownTracer(tracerProvider) { + core.info('Exporting traces and shutting down TracerProvider'); + try { + core.info('Triggering trace export...'); + await tracerProvider.forceFlush(); + core.info('Traces exported successfully'); + + core.info('Shutting down TracerProvider...'); + await tracerProvider.shutdown(); + core.info('TracerProvider shut down successfully'); + } catch (error) { + core.error(`Error during trace export/shutdown: ${error.message}`); + core.error(`Stack trace: ${error.stack}`); + throw error; + } +} + +/** + * Creates Google Cloud Logging client + * @param {Object} config - Configuration object + * @returns {Object} Logging client and log instance + */ +function createLogger(config) { + core.info('Initializing Google Cloud Logging client'); + + const loggingOptions = { + projectId: config.gcpProjectId, + }; + + if (config.gcpServiceAccountKey) { + try { + const credentials = JSON.parse(config.gcpServiceAccountKey); + loggingOptions.credentials = credentials; + } catch (error) { + core.error(`Failed to parse service account key for logging: ${error.message}`); + throw new Error('Invalid service account key JSON'); + } + } + + const logging = new Logging(loggingOptions); + const log = logging.log('github-actions'); + + return { logging, log }; +} + +/** + * Writes logs for collected workflow data + * @param {Object} log - Cloud Logging instance + * @param {Object} metrics - Collected metrics from GitHub + * @param {Array} logLines - Parsed log lines from job execution (optional) + * @returns {Promise} + */ +async function recordLogs(log, metrics, logLines = []) { + core.info('Writing logs to Google Cloud Logging'); + + const baseMetadata = { + resource: { + type: 'generic_task', + labels: { + project_id: metrics.repository.owner, + location: 'global', + namespace: metrics.repository.repo, + job: metrics.job.name, + task_id: metrics.run.id.toString(), + }, + }, + labels: { + workflow: metrics.workflow, + repository: metrics.repository.fullName, + run_number: metrics.run.number.toString(), + run_attempt: metrics.run.attempt, + job_name: metrics.job.name, + }, + }; + + const entries = []; + + // If we have detailed log lines, write them with accurate timestamps + if (logLines && logLines.length > 0) { + core.info(`Writing ${logLines.length} detailed log lines`); + + for (const logLine of logLines) { + // Determine severity from log content + let severity = 'INFO'; + if (logLine.message.includes('::error::') || logLine.message.includes('ERROR')) { + severity = 'ERROR'; + } else if (logLine.message.includes('::warning::') || logLine.message.includes('WARNING')) { + severity = 'WARNING'; + } else if (logLine.message.includes('::debug::')) { + severity = 'DEBUG'; + } + + entries.push(log.entry( + { + ...baseMetadata, + severity, + timestamp: logLine.timestamp, + labels: { + ...baseMetadata.labels, + step: logLine.step || 'unknown', + }, + }, + { + message: logLine.message, + step: logLine.step, + } + )); + } + } else { + // Fallback: Write summary entries if detailed logs not available + core.info('Writing summary log entries (detailed logs not available)'); + + // Log job-level entry + entries.push(log.entry( + { + ...baseMetadata, + severity: metrics.job.conclusion === 'success' ? 'INFO' : 'ERROR', + timestamp: metrics.job.completedAt || new Date(), + }, + { + message: `Job ${metrics.job.name} ${metrics.job.conclusion}`, + job: { + name: metrics.job.name, + id: metrics.job.id, + status: metrics.job.status, + conclusion: metrics.job.conclusion, + duration_ms: metrics.job.durationMs, + }, + } + )); + + // Log step-level entries + for (const step of metrics.steps) { + entries.push(log.entry( + { + ...baseMetadata, + severity: step.conclusion === 'success' ? 'INFO' : step.conclusion === 'failure' ? 'ERROR' : 'WARNING', + timestamp: step.completedAt || new Date(), + labels: { + ...baseMetadata.labels, + step_name: step.name, + step_number: step.number.toString(), + }, + }, + { + message: `Step "${step.name}" ${step.conclusion}`, + step: { + name: step.name, + number: step.number, + conclusion: step.conclusion, + duration_ms: step.durationMs, + }, + } + )); + } + } + + // Write all log entries in batches (Cloud Logging has limits) + const batchSize = 100; + for (let i = 0; i < entries.length; i += batchSize) { + const batch = entries.slice(i, i + batchSize); + try { + await log.write(batch); + core.debug(`Wrote batch of ${batch.length} log entries`); + } catch (error) { + core.error(`Failed to write log batch: ${error.message}`); + throw error; + } + } + + core.info(`✓ Wrote ${entries.length} log entries to Cloud Logging`); +} + +module.exports = { + createMeterProvider, + recordMetrics, + shutdown, + createTracerProvider, + recordTraces, + shutdownTracer, + createLogger, + recordLogs, +}; /***/ }), @@ -3955,6 +4334,60813 @@ function copyFile(srcFile, destFile, force) { /***/ }), +/***/ 85543: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.util = exports.ApiError = exports.ServiceObject = exports.Service = exports.Operation = void 0; +/** + * @type {module:common/operation} + * @private + */ +var operation_1 = __nccwpck_require__(8838); +Object.defineProperty(exports, "Operation", ({ enumerable: true, get: function () { return operation_1.Operation; } })); +/** + * @type {module:common/service} + * @private + */ +var service_1 = __nccwpck_require__(37260); +Object.defineProperty(exports, "Service", ({ enumerable: true, get: function () { return service_1.Service; } })); +/** + * @type {module:common/serviceObject} + * @private + */ +var service_object_1 = __nccwpck_require__(68398); +Object.defineProperty(exports, "ServiceObject", ({ enumerable: true, get: function () { return service_object_1.ServiceObject; } })); +/** + * @type {module:common/util} + * @private + */ +var util_1 = __nccwpck_require__(39463); +Object.defineProperty(exports, "ApiError", ({ enumerable: true, get: function () { return util_1.ApiError; } })); +Object.defineProperty(exports, "util", ({ enumerable: true, get: function () { return util_1.util; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 8838: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright 2016 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Operation = void 0; +/*! + * @module common/operation + */ +const service_object_1 = __nccwpck_require__(68398); +const util_1 = __nccwpck_require__(39023); +// eslint-disable-next-line @typescript-eslint/no-explicit-any +class Operation extends service_object_1.ServiceObject { + /** + * An Operation object allows you to interact with APIs that take longer to + * process things. + * + * @constructor + * @alias module:common/operation + * + * @param {object} config - Configuration object. + * @param {module:common/service|module:common/serviceObject|module:common/grpcService|module:common/grpcServiceObject} config.parent - The parent object. + */ + constructor(config) { + const methods = { + /** + * Checks to see if an operation exists. + */ + exists: true, + /** + * Retrieves the operation. + */ + get: true, + /** + * Retrieves metadata for the operation. + */ + getMetadata: { + reqOpts: { + name: config.id, + }, + }, + }; + config = Object.assign({ + baseUrl: '', + }, config); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + config.methods = (config.methods || methods); + super(config); + this.completeListeners = 0; + this.hasActiveListeners = false; + this.listenForEvents_(); + } + /** + * Wraps the `complete` and `error` events in a Promise. + * + * @return {Promise} + */ + promise() { + return new Promise((resolve, reject) => { + this.on('error', reject).on('complete', (metadata) => { + resolve([metadata]); + }); + }); + } + /** + * Begin listening for events on the operation. This method keeps track of how + * many "complete" listeners are registered and removed, making sure polling + * is handled automatically. + * + * As long as there is one active "complete" listener, the connection is open. + * When there are no more listeners, the polling stops. + * + * @private + */ + listenForEvents_() { + this.on('newListener', (event) => { + if (event === 'complete') { + this.completeListeners++; + if (!this.hasActiveListeners) { + this.hasActiveListeners = true; + this.startPolling_(); + } + } + }); + this.on('removeListener', (event) => { + if (event === 'complete' && --this.completeListeners === 0) { + this.hasActiveListeners = false; + } + }); + } + /** + * Poll for a status update. Returns null for an incomplete + * status, and metadata for a complete status. + * + * @private + */ + poll_(callback) { + this.getMetadata((err, body) => { + if (err || body.error) { + callback(err || body.error); + return; + } + if (!body.done) { + callback(null); + return; + } + callback(null, body); + }); + } + /** + * Poll `getMetadata` to check the operation's status. This runs a loop to + * ping the API on an interval. + * + * Note: This method is automatically called once a "complete" event handler + * is registered on the operation. + * + * @private + */ + async startPolling_() { + if (!this.hasActiveListeners) { + return; + } + try { + const metadata = await (0, util_1.promisify)(this.poll_.bind(this))(); + if (!metadata) { + setTimeout(this.startPolling_.bind(this), this.pollIntervalMs || 500); + return; + } + this.emit('complete', metadata); + } + catch (err) { + this.emit('error', err); + } + } +} +exports.Operation = Operation; +//# sourceMappingURL=operation.js.map + +/***/ }), + +/***/ 68398: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright 2015 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ServiceObject = void 0; +/*! + * @module common/service-object + */ +const promisify_1 = __nccwpck_require__(60206); +const arrify = __nccwpck_require__(26251); +const events_1 = __nccwpck_require__(24434); +const extend = __nccwpck_require__(23860); +const util_1 = __nccwpck_require__(39463); +/** + * ServiceObject is a base class, meant to be inherited from by a "service + * object," like a BigQuery dataset or Storage bucket. + * + * Most of the time, these objects share common functionality; they can be + * created or deleted, and you can get or set their metadata. + * + * By inheriting from this class, a service object will be extended with these + * shared behaviors. Note that any method can be overridden when the service + * object requires specific behavior. + */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +class ServiceObject extends events_1.EventEmitter { + /* + * @constructor + * @alias module:common/service-object + * + * @private + * + * @param {object} config - Configuration object. + * @param {string} config.baseUrl - The base URL to make API requests to. + * @param {string} config.createMethod - The method which creates this object. + * @param {string=} config.id - The identifier of the object. For example, the + * name of a Storage bucket or Pub/Sub topic. + * @param {object=} config.methods - A map of each method name that should be inherited. + * @param {object} config.methods[].reqOpts - Default request options for this + * particular method. A common use case is when `setMetadata` requires a + * `PUT` method to override the default `PATCH`. + * @param {object} config.parent - The parent service instance. For example, an + * instance of Storage if the object is Bucket. + */ + constructor(config) { + super(); + this.metadata = {}; + this.baseUrl = config.baseUrl; + this.parent = config.parent; // Parent class. + this.id = config.id; // Name or ID (e.g. dataset ID, bucket name, etc). + this.createMethod = config.createMethod; + this.methods = config.methods || {}; + this.interceptors = []; + this.pollIntervalMs = config.pollIntervalMs; + this.projectId = config.projectId; + if (config.methods) { + // This filters the ServiceObject instance (e.g. a "File") to only have + // the configured methods. We make a couple of exceptions for core- + // functionality ("request()" and "getRequestInterceptors()") + Object.getOwnPropertyNames(ServiceObject.prototype) + .filter(methodName => { + return ( + // All ServiceObjects need `request` and `getRequestInterceptors`. + // clang-format off + !/^request/.test(methodName) && + !/^getRequestInterceptors/.test(methodName) && + // clang-format on + // The ServiceObject didn't redefine the method. + // eslint-disable-next-line @typescript-eslint/no-explicit-any + this[methodName] === + // eslint-disable-next-line @typescript-eslint/no-explicit-any + ServiceObject.prototype[methodName] && + // This method isn't wanted. + !config.methods[methodName]); + }) + .forEach(methodName => { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + this[methodName] = undefined; + }); + } + } + create(optionsOrCallback, callback) { + // eslint-disable-next-line @typescript-eslint/no-this-alias + const self = this; + const args = [this.id]; + if (typeof optionsOrCallback === 'function') { + callback = optionsOrCallback; + } + if (typeof optionsOrCallback === 'object') { + args.push(optionsOrCallback); + } + // Wrap the callback to return *this* instance of the object, not the + // newly-created one. + // tslint: disable-next-line no-any + function onCreate(...args) { + const [err, instance] = args; + if (!err) { + self.metadata = instance.metadata; + args[1] = self; // replace the created `instance` with this one. + } + callback(...args); + } + args.push(onCreate); + // eslint-disable-next-line prefer-spread + this.createMethod.apply(null, args); + } + delete(optionsOrCallback, cb) { + const [options, callback] = util_1.util.maybeOptionsOrCallback(optionsOrCallback, cb); + const ignoreNotFound = options.ignoreNotFound; + delete options.ignoreNotFound; + const methodConfig = (typeof this.methods.delete === 'object' && this.methods.delete) || {}; + const reqOpts = extend(true, { + method: 'DELETE', + uri: '', + }, methodConfig.reqOpts, { + qs: options, + }); + // The `request` method may have been overridden to hold any special + // behavior. Ensure we call the original `request` method. + ServiceObject.prototype.request.call(this, reqOpts, (err, ...args) => { + if (err) { + if (err.code === 404 && ignoreNotFound) { + err = null; + } + } + callback(err, ...args); + }); + } + exists(optionsOrCallback, cb) { + const [options, callback] = util_1.util.maybeOptionsOrCallback(optionsOrCallback, cb); + this.get(options, err => { + if (err) { + if (err.code === 404) { + callback(null, false); + } + else { + callback(err); + } + return; + } + callback(null, true); + }); + } + get(optionsOrCallback, cb) { + // eslint-disable-next-line @typescript-eslint/no-this-alias + const self = this; + const [opts, callback] = util_1.util.maybeOptionsOrCallback(optionsOrCallback, cb); + const options = Object.assign({}, opts); + const autoCreate = options.autoCreate && typeof this.create === 'function'; + delete options.autoCreate; + function onCreate(err, instance, apiResponse) { + if (err) { + if (err.code === 409) { + self.get(options, callback); + return; + } + callback(err, null, apiResponse); + return; + } + callback(null, instance, apiResponse); + } + this.getMetadata(options, (err, metadata) => { + if (err) { + if (err.code === 404 && autoCreate) { + const args = []; + if (Object.keys(options).length > 0) { + args.push(options); + } + args.push(onCreate); + self.create(...args); + return; + } + callback(err, null, metadata); + return; + } + callback(null, self, metadata); + }); + } + getMetadata(optionsOrCallback, cb) { + const [options, callback] = util_1.util.maybeOptionsOrCallback(optionsOrCallback, cb); + const methodConfig = (typeof this.methods.getMetadata === 'object' && + this.methods.getMetadata) || + {}; + const reqOpts = extend(true, { + uri: '', + }, methodConfig.reqOpts, { + qs: options, + }); + // The `request` method may have been overridden to hold any special + // behavior. Ensure we call the original `request` method. + ServiceObject.prototype.request.call(this, reqOpts, (err, body, res) => { + this.metadata = body; + callback(err, this.metadata, res); + }); + } + /** + * Return the user's custom request interceptors. + */ + getRequestInterceptors() { + // Interceptors should be returned in the order they were assigned. + const localInterceptors = this.interceptors + .filter(interceptor => typeof interceptor.request === 'function') + .map(interceptor => interceptor.request); + return this.parent.getRequestInterceptors().concat(localInterceptors); + } + setMetadata(metadata, optionsOrCallback, cb) { + const [options, callback] = util_1.util.maybeOptionsOrCallback(optionsOrCallback, cb); + const methodConfig = (typeof this.methods.setMetadata === 'object' && + this.methods.setMetadata) || + {}; + const reqOpts = extend(true, {}, { + method: 'PATCH', + uri: '', + }, methodConfig.reqOpts, { + json: metadata, + qs: options, + }); + // The `request` method may have been overridden to hold any special + // behavior. Ensure we call the original `request` method. + ServiceObject.prototype.request.call(this, reqOpts, (err, body, res) => { + this.metadata = body; + callback(err, this.metadata, res); + }); + } + request_(reqOpts, callback) { + reqOpts = extend(true, {}, reqOpts); + if (this.projectId) { + reqOpts.projectId = this.projectId; + } + const isAbsoluteUrl = reqOpts.uri.indexOf('http') === 0; + const uriComponents = [this.baseUrl, this.id || '', reqOpts.uri]; + if (isAbsoluteUrl) { + uriComponents.splice(0, uriComponents.indexOf(reqOpts.uri)); + } + reqOpts.uri = uriComponents + .filter(x => x.trim()) // Limit to non-empty strings. + .map(uriComponent => { + const trimSlashesRegex = /^\/*|\/*$/g; + return uriComponent.replace(trimSlashesRegex, ''); + }) + .join('/'); + const childInterceptors = arrify(reqOpts.interceptors_); + const localInterceptors = [].slice.call(this.interceptors); + reqOpts.interceptors_ = childInterceptors.concat(localInterceptors); + if (reqOpts.shouldReturnStream) { + return this.parent.requestStream(reqOpts); + } + this.parent.request(reqOpts, callback); + } + request(reqOpts, callback) { + this.request_(reqOpts, callback); + } + /** + * Make an authenticated API request. + * + * @param {object} reqOpts - Request options that are passed to `request`. + * @param {string} reqOpts.uri - A URI relative to the baseUrl. + */ + requestStream(reqOpts) { + const opts = extend(true, reqOpts, { shouldReturnStream: true }); + return this.request_(opts); + } +} +exports.ServiceObject = ServiceObject; +(0, promisify_1.promisifyAll)(ServiceObject, { exclude: ['getRequestInterceptors'] }); +//# sourceMappingURL=service-object.js.map + +/***/ }), + +/***/ 37260: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright 2015 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Service = exports.DEFAULT_PROJECT_ID_TOKEN = void 0; +/*! + * @module common/service + */ +const arrify = __nccwpck_require__(26251); +const extend = __nccwpck_require__(23860); +const util_1 = __nccwpck_require__(39463); +exports.DEFAULT_PROJECT_ID_TOKEN = '{{projectId}}'; +class Service { + /** + * Service is a base class, meant to be inherited from by a "service," like + * BigQuery or Storage. + * + * This handles making authenticated requests by exposing a `makeReq_` + * function. + * + * @constructor + * @alias module:common/service + * + * @param {object} config - Configuration object. + * @param {string} config.baseUrl - The base URL to make API requests to. + * @param {string[]} config.scopes - The scopes required for the request. + * @param {object=} options - [Configuration object](#/docs). + */ + constructor(config, options = {}) { + this.baseUrl = config.baseUrl; + this.apiEndpoint = config.apiEndpoint; + this.timeout = options.timeout; + this.globalInterceptors = arrify(options.interceptors_); + this.interceptors = []; + this.packageJson = config.packageJson; + this.projectId = options.projectId || exports.DEFAULT_PROJECT_ID_TOKEN; + this.projectIdRequired = config.projectIdRequired !== false; + this.providedUserAgent = options.userAgent; + const reqCfg = extend({}, config, { + projectIdRequired: this.projectIdRequired, + projectId: this.projectId, + authClient: options.authClient, + credentials: options.credentials, + keyFile: options.keyFilename, + email: options.email, + token: options.token, + }); + this.makeAuthenticatedRequest = + util_1.util.makeAuthenticatedRequestFactory(reqCfg); + this.authClient = this.makeAuthenticatedRequest.authClient; + this.getCredentials = this.makeAuthenticatedRequest.getCredentials; + const isCloudFunctionEnv = !!process.env.FUNCTION_NAME; + if (isCloudFunctionEnv) { + this.interceptors.push({ + request(reqOpts) { + reqOpts.forever = false; + return reqOpts; + }, + }); + } + } + /** + * Return the user's custom request interceptors. + */ + getRequestInterceptors() { + // Interceptors should be returned in the order they were assigned. + return [].slice + .call(this.globalInterceptors) + .concat(this.interceptors) + .filter(interceptor => typeof interceptor.request === 'function') + .map(interceptor => interceptor.request); + } + getProjectId(callback) { + if (!callback) { + return this.getProjectIdAsync(); + } + this.getProjectIdAsync().then(p => callback(null, p), callback); + } + async getProjectIdAsync() { + const projectId = await this.authClient.getProjectId(); + if (this.projectId === exports.DEFAULT_PROJECT_ID_TOKEN && projectId) { + this.projectId = projectId; + } + return this.projectId; + } + request_(reqOpts, callback) { + reqOpts = extend(true, {}, reqOpts, { timeout: this.timeout }); + const isAbsoluteUrl = reqOpts.uri.indexOf('http') === 0; + const uriComponents = [this.baseUrl]; + if (this.projectIdRequired) { + if (reqOpts.projectId) { + uriComponents.push('projects'); + uriComponents.push(reqOpts.projectId); + } + else { + uriComponents.push('projects'); + uriComponents.push(this.projectId); + } + } + uriComponents.push(reqOpts.uri); + if (isAbsoluteUrl) { + uriComponents.splice(0, uriComponents.indexOf(reqOpts.uri)); + } + reqOpts.uri = uriComponents + .map(uriComponent => { + const trimSlashesRegex = /^\/*|\/*$/g; + return uriComponent.replace(trimSlashesRegex, ''); + }) + .join('/') + // Some URIs have colon separators. + // Bad: https://.../projects/:list + // Good: https://.../projects:list + .replace(/\/:/g, ':'); + const requestInterceptors = this.getRequestInterceptors(); + arrify(reqOpts.interceptors_).forEach(interceptor => { + if (typeof interceptor.request === 'function') { + requestInterceptors.push(interceptor.request); + } + }); + requestInterceptors.forEach(requestInterceptor => { + reqOpts = requestInterceptor(reqOpts); + }); + delete reqOpts.interceptors_; + const pkg = this.packageJson; + let userAgent = util_1.util.getUserAgentFromPackageJson(pkg); + if (this.providedUserAgent) { + userAgent = `${this.providedUserAgent} ${userAgent}`; + } + reqOpts.headers = extend({}, reqOpts.headers, { + 'User-Agent': userAgent, + 'x-goog-api-client': `gl-node/${process.versions.node} gccl/${pkg.version}`, + }); + if (reqOpts.shouldReturnStream) { + return this.makeAuthenticatedRequest(reqOpts); + } + else { + this.makeAuthenticatedRequest(reqOpts, callback); + } + } + /** + * Make an authenticated API request. + * + * @param {object} reqOpts - Request options that are passed to `request`. + * @param {string} reqOpts.uri - A URI relative to the baseUrl. + * @param {function} callback - The callback function passed to `request`. + */ + request(reqOpts, callback) { + Service.prototype.request_.call(this, reqOpts, callback); + } + /** + * Make an authenticated API request. + * + * @param {object} reqOpts - Request options that are passed to `request`. + * @param {string} reqOpts.uri - A URI relative to the baseUrl. + */ + requestStream(reqOpts) { + const opts = extend(true, reqOpts, { shouldReturnStream: true }); + return Service.prototype.request_.call(this, opts); + } +} +exports.Service = Service; +//# sourceMappingURL=service.js.map + +/***/ }), + +/***/ 39463: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright 2014 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.util = exports.Util = exports.PartialFailureError = exports.ApiError = void 0; +/*! + * @module common/util + */ +const projectify_1 = __nccwpck_require__(87635); +const htmlEntities = __nccwpck_require__(13660); +const extend = __nccwpck_require__(23860); +const google_auth_library_1 = __nccwpck_require__(492); +const retryRequest = __nccwpck_require__(67842); +const stream_1 = __nccwpck_require__(2203); +const teeny_request_1 = __nccwpck_require__(80321); +const service_1 = __nccwpck_require__(37260); +// eslint-disable-next-line @typescript-eslint/no-var-requires +const duplexify = __nccwpck_require__(29112); +const requestDefaults = { + timeout: 60000, + gzip: true, + forever: true, + pool: { + maxSockets: Infinity, + }, +}; +/** + * Default behavior: Automatically retry retriable server errors. + * + * @const {boolean} + * @private + */ +const AUTO_RETRY_DEFAULT = true; +/** + * Default behavior: Only attempt to retry retriable errors 3 times. + * + * @const {number} + * @private + */ +const MAX_RETRY_DEFAULT = 3; +/** + * Custom error type for API errors. + * + * @param {object} errorBody - Error object. + */ +class ApiError extends Error { + constructor(errorBodyOrMessage) { + super(); + if (typeof errorBodyOrMessage !== 'object') { + this.message = errorBodyOrMessage || ''; + return; + } + const errorBody = errorBodyOrMessage; + this.code = errorBody.code; + this.errors = errorBody.errors; + this.response = errorBody.response; + try { + this.errors = JSON.parse(this.response.body).error.errors; + } + catch (e) { + this.errors = errorBody.errors; + } + this.message = ApiError.createMultiErrorMessage(errorBody, this.errors); + Error.captureStackTrace(this); + } + /** + * Pieces together an error message by combining all unique error messages + * returned from a single GoogleError + * + * @private + * + * @param {GoogleErrorBody} err The original error. + * @param {GoogleInnerError[]} [errors] Inner errors, if any. + * @returns {string} + */ + static createMultiErrorMessage(err, errors) { + const messages = new Set(); + if (err.message) { + messages.add(err.message); + } + if (errors && errors.length) { + errors.forEach(({ message }) => messages.add(message)); + } + else if (err.response && err.response.body) { + messages.add(htmlEntities.decode(err.response.body.toString())); + } + else if (!err.message) { + messages.add('A failure occurred during this request.'); + } + let messageArr = Array.from(messages); + if (messageArr.length > 1) { + messageArr = messageArr.map((message, i) => ` ${i + 1}. ${message}`); + messageArr.unshift('Multiple errors occurred during the request. Please see the `errors` array for complete details.\n'); + messageArr.push('\n'); + } + return messageArr.join('\n'); + } +} +exports.ApiError = ApiError; +/** + * Custom error type for partial errors returned from the API. + * + * @param {object} b - Error object. + */ +class PartialFailureError extends Error { + constructor(b) { + super(); + const errorObject = b; + this.errors = errorObject.errors; + this.name = 'PartialFailureError'; + this.response = errorObject.response; + this.message = ApiError.createMultiErrorMessage(errorObject, this.errors); + } +} +exports.PartialFailureError = PartialFailureError; +class Util { + constructor() { + this.ApiError = ApiError; + this.PartialFailureError = PartialFailureError; + } + /** + * No op. + * + * @example + * function doSomething(callback) { + * callback = callback || noop; + * } + */ + noop() { } + /** + * Uniformly process an API response. + * + * @param {*} err - Error value. + * @param {*} resp - Response value. + * @param {*} body - Body value. + * @param {function} callback - The callback function. + */ + handleResp(err, resp, body, callback) { + callback = callback || util.noop; + const parsedResp = extend(true, { err: err || null }, resp && util.parseHttpRespMessage(resp), body && util.parseHttpRespBody(body)); + // Assign the parsed body to resp.body, even if { json: false } was passed + // as a request option. + // We assume that nobody uses the previously unparsed value of resp.body. + if (!parsedResp.err && resp && typeof parsedResp.body === 'object') { + parsedResp.resp.body = parsedResp.body; + } + if (parsedResp.err && resp) { + parsedResp.err.response = resp; + } + callback(parsedResp.err, parsedResp.body, parsedResp.resp); + } + /** + * Sniff an incoming HTTP response message for errors. + * + * @param {object} httpRespMessage - An incoming HTTP response message from `request`. + * @return {object} parsedHttpRespMessage - The parsed response. + * @param {?error} parsedHttpRespMessage.err - An error detected. + * @param {object} parsedHttpRespMessage.resp - The original response object. + */ + parseHttpRespMessage(httpRespMessage) { + const parsedHttpRespMessage = { + resp: httpRespMessage, + }; + if (httpRespMessage.statusCode < 200 || httpRespMessage.statusCode > 299) { + // Unknown error. Format according to ApiError standard. + parsedHttpRespMessage.err = new ApiError({ + errors: new Array(), + code: httpRespMessage.statusCode, + message: httpRespMessage.statusMessage, + response: httpRespMessage, + }); + } + return parsedHttpRespMessage; + } + /** + * Parse the response body from an HTTP request. + * + * @param {object} body - The response body. + * @return {object} parsedHttpRespMessage - The parsed response. + * @param {?error} parsedHttpRespMessage.err - An error detected. + * @param {object} parsedHttpRespMessage.body - The original body value provided + * will try to be JSON.parse'd. If it's successful, the parsed value will + * be returned here, otherwise the original value and an error will be returned. + */ + parseHttpRespBody(body) { + const parsedHttpRespBody = { + body, + }; + if (typeof body === 'string') { + try { + parsedHttpRespBody.body = JSON.parse(body); + } + catch (err) { + parsedHttpRespBody.body = body; + } + } + if (parsedHttpRespBody.body && parsedHttpRespBody.body.error) { + // Error from JSON API. + parsedHttpRespBody.err = new ApiError(parsedHttpRespBody.body.error); + } + return parsedHttpRespBody; + } + /** + * Take a Duplexify stream, fetch an authenticated connection header, and + * create an outgoing writable stream. + * + * @param {Duplexify} dup - Duplexify stream. + * @param {object} options - Configuration object. + * @param {module:common/connection} options.connection - A connection instance used to get a token with and send the request through. + * @param {object} options.metadata - Metadata to send at the head of the request. + * @param {object} options.request - Request object, in the format of a standard Node.js http.request() object. + * @param {string=} options.request.method - Default: "POST". + * @param {string=} options.request.qs.uploadType - Default: "multipart". + * @param {string=} options.streamContentType - Default: "application/octet-stream". + * @param {function} onComplete - Callback, executed after the writable Request stream has completed. + */ + makeWritableStream(dup, options, onComplete) { + onComplete = onComplete || util.noop; + const writeStream = new ProgressStream(); + writeStream.on('progress', evt => dup.emit('progress', evt)); + dup.setWritable(writeStream); + const defaultReqOpts = { + method: 'POST', + qs: { + uploadType: 'multipart', + }, + timeout: 0, + maxRetries: 0, + }; + const metadata = options.metadata || {}; + const reqOpts = extend(true, defaultReqOpts, options.request, { + multipart: [ + { + 'Content-Type': 'application/json', + body: JSON.stringify(metadata), + }, + { + 'Content-Type': metadata.contentType || 'application/octet-stream', + body: writeStream, + }, + ], + }); + options.makeAuthenticatedRequest(reqOpts, { + onAuthenticated(err, authenticatedReqOpts) { + if (err) { + dup.destroy(err); + return; + } + const request = teeny_request_1.teenyRequest.defaults(requestDefaults); + request(authenticatedReqOpts, (err, resp, body) => { + util.handleResp(err, resp, body, (err, data) => { + if (err) { + dup.destroy(err); + return; + } + dup.emit('response', resp); + onComplete(data); + }); + }); + }, + }); + } + /** + * Returns true if the API request should be retried, given the error that was + * given the first time the request was attempted. This is used for rate limit + * related errors as well as intermittent server errors. + * + * @param {error} err - The API error to check if it is appropriate to retry. + * @return {boolean} True if the API request should be retried, false otherwise. + */ + shouldRetryRequest(err) { + if (err) { + if ([408, 429, 500, 502, 503, 504].indexOf(err.code) !== -1) { + return true; + } + if (err.errors) { + for (const e of err.errors) { + const reason = e.reason; + if (reason === 'rateLimitExceeded') { + return true; + } + if (reason === 'userRateLimitExceeded') { + return true; + } + if (reason && reason.includes('EAI_AGAIN')) { + return true; + } + } + } + } + return false; + } + /** + * Get a function for making authenticated requests. + * + * @param {object} config - Configuration object. + * @param {boolean=} config.autoRetry - Automatically retry requests if the + * response is related to rate limits or certain intermittent server + * errors. We will exponentially backoff subsequent requests by default. + * (default: true) + * @param {object=} config.credentials - Credentials object. + * @param {boolean=} config.customEndpoint - If true, just return the provided request options. Default: false. + * @param {boolean=} config.useAuthWithCustomEndpoint - If true, will authenticate when using a custom endpoint. Default: false. + * @param {string=} config.email - Account email address, required for PEM/P12 usage. + * @param {number=} config.maxRetries - Maximum number of automatic retries attempted before returning the error. (default: 3) + * @param {string=} config.keyFile - Path to a .json, .pem, or .p12 keyfile. + * @param {array} config.scopes - Array of scopes required for the API. + */ + makeAuthenticatedRequestFactory(config) { + const googleAutoAuthConfig = extend({}, config); + if (googleAutoAuthConfig.projectId === service_1.DEFAULT_PROJECT_ID_TOKEN) { + delete googleAutoAuthConfig.projectId; + } + let authClient; + if (googleAutoAuthConfig.authClient instanceof google_auth_library_1.GoogleAuth) { + // Use an existing `GoogleAuth` + authClient = googleAutoAuthConfig.authClient; + } + else { + // Pass an `AuthClient` to `GoogleAuth`, if available + const config = { + ...googleAutoAuthConfig, + authClient: googleAutoAuthConfig.authClient, + }; + authClient = new google_auth_library_1.GoogleAuth(config); + } + function makeAuthenticatedRequest(reqOpts, optionsOrCallback) { + let stream; + let projectId; + const reqConfig = extend({}, config); + let activeRequest_; + if (!optionsOrCallback) { + stream = duplexify(); + reqConfig.stream = stream; + } + const options = typeof optionsOrCallback === 'object' ? optionsOrCallback : undefined; + const callback = typeof optionsOrCallback === 'function' ? optionsOrCallback : undefined; + async function setProjectId() { + projectId = await authClient.getProjectId(); + } + const onAuthenticated = async (err, authenticatedReqOpts) => { + const authLibraryError = err; + const autoAuthFailed = err && + err.message.indexOf('Could not load the default credentials') > -1; + if (autoAuthFailed) { + // Even though authentication failed, the API might not actually + // care. + authenticatedReqOpts = reqOpts; + } + if (!err || autoAuthFailed) { + try { + // Try with existing `projectId` value + authenticatedReqOpts = util.decorateRequest(authenticatedReqOpts, projectId); + err = null; + } + catch (e) { + if (e instanceof projectify_1.MissingProjectIdError) { + // A `projectId` was required, but we don't have one. + try { + // Attempt to get the `projectId` + await setProjectId(); + authenticatedReqOpts = util.decorateRequest(authenticatedReqOpts, projectId); + err = null; + } + catch (e) { + // Re-use the "Could not load the default credentials error" if + // auto auth failed. + err = err || e; + } + } + else { + // Some other error unrelated to missing `projectId` + err = err || e; + } + } + } + if (err) { + if (stream) { + stream.destroy(err); + } + else { + const fn = options && options.onAuthenticated + ? options.onAuthenticated + : callback; + fn(err); + } + return; + } + if (options && options.onAuthenticated) { + options.onAuthenticated(null, authenticatedReqOpts); + } + else { + activeRequest_ = util.makeRequest(authenticatedReqOpts, reqConfig, (apiResponseError, ...params) => { + if (apiResponseError && + apiResponseError.code === 401 && + authLibraryError) { + // Re-use the "Could not load the default credentials error" if + // the API request failed due to missing credentials. + apiResponseError = authLibraryError; + } + callback(apiResponseError, ...params); + }); + } + }; + const prepareRequest = async () => { + try { + const getProjectId = async () => { + if (config.projectId && + config.projectId !== service_1.DEFAULT_PROJECT_ID_TOKEN) { + // The user provided a project ID. We don't need to check with the + // auth client, it could be incorrect. + return config.projectId; + } + if (config.projectIdRequired === false) { + // A projectId is not required. Return the default. + return service_1.DEFAULT_PROJECT_ID_TOKEN; + } + return setProjectId(); + }; + const authorizeRequest = async () => { + if (reqConfig.customEndpoint && + !reqConfig.useAuthWithCustomEndpoint) { + // Using a custom API override. Do not use `google-auth-library` for + // authentication. (ex: connecting to a local Datastore server) + return reqOpts; + } + else { + return authClient.authorizeRequest(reqOpts); + } + }; + const [_projectId, authorizedReqOpts] = await Promise.all([ + getProjectId(), + authorizeRequest(), + ]); + if (_projectId) { + projectId = _projectId; + } + return onAuthenticated(null, authorizedReqOpts); + } + catch (e) { + return onAuthenticated(e); + } + }; + prepareRequest(); + if (stream) { + return stream; + } + return { + abort() { + setImmediate(() => { + if (activeRequest_) { + activeRequest_.abort(); + activeRequest_ = null; + } + }); + }, + }; + } + const mar = makeAuthenticatedRequest; + mar.getCredentials = authClient.getCredentials.bind(authClient); + mar.authClient = authClient; + return mar; + } + /** + * Make a request through the `retryRequest` module with built-in error + * handling and exponential back off. + * + * @param {object} reqOpts - Request options in the format `request` expects. + * @param {object=} config - Configuration object. + * @param {boolean=} config.autoRetry - Automatically retry requests if the + * response is related to rate limits or certain intermittent server + * errors. We will exponentially backoff subsequent requests by default. + * (default: true) + * @param {number=} config.maxRetries - Maximum number of automatic retries + * attempted before returning the error. (default: 3) + * @param {object=} config.request - HTTP module for request calls. + * @param {function} callback - The callback function. + */ + makeRequest(reqOpts, config, callback) { + var _a, _b, _c, _d, _e, _f, _g; + let autoRetryValue = AUTO_RETRY_DEFAULT; + if (config.autoRetry !== undefined && + ((_a = config.retryOptions) === null || _a === void 0 ? void 0 : _a.autoRetry) !== undefined) { + throw new ApiError('autoRetry is deprecated. Use retryOptions.autoRetry instead.'); + } + else if (config.autoRetry !== undefined) { + autoRetryValue = config.autoRetry; + } + else if (((_b = config.retryOptions) === null || _b === void 0 ? void 0 : _b.autoRetry) !== undefined) { + autoRetryValue = config.retryOptions.autoRetry; + } + let maxRetryValue = MAX_RETRY_DEFAULT; + if (config.maxRetries && ((_c = config.retryOptions) === null || _c === void 0 ? void 0 : _c.maxRetries)) { + throw new ApiError('maxRetries is deprecated. Use retryOptions.maxRetries instead.'); + } + else if (config.maxRetries) { + maxRetryValue = config.maxRetries; + } + else if ((_d = config.retryOptions) === null || _d === void 0 ? void 0 : _d.maxRetries) { + maxRetryValue = config.retryOptions.maxRetries; + } + const options = { + request: teeny_request_1.teenyRequest.defaults(requestDefaults), + retries: autoRetryValue !== false ? maxRetryValue : 0, + noResponseRetries: autoRetryValue !== false ? maxRetryValue : 0, + shouldRetryFn(httpRespMessage) { + var _a, _b; + const err = util.parseHttpRespMessage(httpRespMessage).err; + if ((_a = config.retryOptions) === null || _a === void 0 ? void 0 : _a.retryableErrorFn) { + return err && ((_b = config.retryOptions) === null || _b === void 0 ? void 0 : _b.retryableErrorFn(err)); + } + return err && util.shouldRetryRequest(err); + }, + maxRetryDelay: (_e = config.retryOptions) === null || _e === void 0 ? void 0 : _e.maxRetryDelay, + retryDelayMultiplier: (_f = config.retryOptions) === null || _f === void 0 ? void 0 : _f.retryDelayMultiplier, + totalTimeout: (_g = config.retryOptions) === null || _g === void 0 ? void 0 : _g.totalTimeout, + }; + if (typeof reqOpts.maxRetries === 'number') { + options.retries = reqOpts.maxRetries; + } + if (!config.stream) { + return retryRequest(reqOpts, options, (err, response, body) => { + util.handleResp(err, response, body, callback); + }); + } + const dup = config.stream; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + let requestStream; + const isGetRequest = (reqOpts.method || 'GET').toUpperCase() === 'GET'; + if (isGetRequest) { + requestStream = retryRequest(reqOpts, options); + dup.setReadable(requestStream); + } + else { + // Streaming writable HTTP requests cannot be retried. + requestStream = options.request(reqOpts); + dup.setWritable(requestStream); + } + // Replay the Request events back to the stream. + requestStream + .on('error', dup.destroy.bind(dup)) + .on('response', dup.emit.bind(dup, 'response')) + .on('complete', dup.emit.bind(dup, 'complete')); + dup.abort = requestStream.abort; + return dup; + } + /** + * Decorate the options about to be made in a request. + * + * @param {object} reqOpts - The options to be passed to `request`. + * @param {string} projectId - The project ID. + * @return {object} reqOpts - The decorated reqOpts. + */ + decorateRequest(reqOpts, projectId) { + delete reqOpts.autoPaginate; + delete reqOpts.autoPaginateVal; + delete reqOpts.objectMode; + if (reqOpts.qs !== null && typeof reqOpts.qs === 'object') { + delete reqOpts.qs.autoPaginate; + delete reqOpts.qs.autoPaginateVal; + reqOpts.qs = (0, projectify_1.replaceProjectIdToken)(reqOpts.qs, projectId); + } + if (Array.isArray(reqOpts.multipart)) { + reqOpts.multipart = reqOpts.multipart.map(part => { + return (0, projectify_1.replaceProjectIdToken)(part, projectId); + }); + } + if (reqOpts.json !== null && typeof reqOpts.json === 'object') { + delete reqOpts.json.autoPaginate; + delete reqOpts.json.autoPaginateVal; + reqOpts.json = (0, projectify_1.replaceProjectIdToken)(reqOpts.json, projectId); + } + reqOpts.uri = (0, projectify_1.replaceProjectIdToken)(reqOpts.uri, projectId); + return reqOpts; + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any + isCustomType(unknown, module) { + function getConstructorName(obj) { + return obj.constructor && obj.constructor.name.toLowerCase(); + } + const moduleNameParts = module.split('/'); + const parentModuleName = moduleNameParts[0] && moduleNameParts[0].toLowerCase(); + const subModuleName = moduleNameParts[1] && moduleNameParts[1].toLowerCase(); + if (subModuleName && getConstructorName(unknown) !== subModuleName) { + return false; + } + let walkingModule = unknown; + // eslint-disable-next-line no-constant-condition + while (true) { + if (getConstructorName(walkingModule) === parentModuleName) { + return true; + } + walkingModule = walkingModule.parent; + if (!walkingModule) { + return false; + } + } + } + /** + * Create a properly-formatted User-Agent string from a package.json file. + * + * @param {object} packageJson - A module's package.json file. + * @return {string} userAgent - The formatted User-Agent string. + */ + getUserAgentFromPackageJson(packageJson) { + const hyphenatedPackageName = packageJson.name + .replace('@google-cloud', 'gcloud-node') // For legacy purposes. + .replace('/', '-'); // For UA spec-compliance purposes. + return hyphenatedPackageName + '/' + packageJson.version; + } + /** + * Given two parameters, figure out if this is either: + * - Just a callback function + * - An options object, and then a callback function + * @param optionsOrCallback An options object or callback. + * @param cb A potentially undefined callback. + */ + maybeOptionsOrCallback(optionsOrCallback, cb) { + return typeof optionsOrCallback === 'function' + ? [{}, optionsOrCallback] + : [optionsOrCallback, cb]; + } +} +exports.Util = Util; +/** + * Basic Passthrough Stream that records the number of bytes read + * every time the cursor is moved. + */ +class ProgressStream extends stream_1.Transform { + constructor() { + super(...arguments); + this.bytesRead = 0; + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any + _transform(chunk, encoding, callback) { + this.bytesRead += chunk.length; + this.emit('progress', { bytesWritten: this.bytesRead, contentLength: '*' }); + this.push(chunk); + callback(); + } +} +const util = new Util(); +exports.util = util; +//# sourceMappingURL=util.js.map + +/***/ }), + +/***/ 12865: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + +/* module decorator */ module = __nccwpck_require__.nmd(module); +// Copyright 2025 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/ +(function(global, factory) { /* global define, require, module */ + + /* AMD */ if (typeof define === 'function' && define.amd) + define(["protobufjs/minimal"], factory); + + /* CommonJS */ else if ( true && module && module.exports) + module.exports = factory((__nccwpck_require__(71529).protobufMinimal)); + +})(this, function($protobuf) { + "use strict"; + + // Common aliases + var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util; + + // Exported root namespace + var $root = $protobuf.roots._google_cloud_logging_protos || ($protobuf.roots._google_cloud_logging_protos = {}); + + $root.google = (function() { + + /** + * Namespace google. + * @exports google + * @namespace + */ + var google = {}; + + google.protobuf = (function() { + + /** + * Namespace protobuf. + * @memberof google + * @namespace + */ + var protobuf = {}; + + protobuf.Duration = (function() { + + /** + * Properties of a Duration. + * @memberof google.protobuf + * @interface IDuration + * @property {number|Long|null} [seconds] Duration seconds + * @property {number|null} [nanos] Duration nanos + */ + + /** + * Constructs a new Duration. + * @memberof google.protobuf + * @classdesc Represents a Duration. + * @implements IDuration + * @constructor + * @param {google.protobuf.IDuration=} [properties] Properties to set + */ + function Duration(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Duration seconds. + * @member {number|Long} seconds + * @memberof google.protobuf.Duration + * @instance + */ + Duration.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Duration nanos. + * @member {number} nanos + * @memberof google.protobuf.Duration + * @instance + */ + Duration.prototype.nanos = 0; + + /** + * Creates a new Duration instance using the specified properties. + * @function create + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.IDuration=} [properties] Properties to set + * @returns {google.protobuf.Duration} Duration instance + */ + Duration.create = function create(properties) { + return new Duration(properties); + }; + + /** + * Encodes the specified Duration message. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.IDuration} message Duration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Duration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); + if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); + return writer; + }; + + /** + * Encodes the specified Duration message, length delimited. Does not implicitly {@link google.protobuf.Duration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.IDuration} message Duration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Duration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Duration message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Duration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Duration} Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Duration.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Duration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.seconds = reader.int64(); + break; + } + case 2: { + message.nanos = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Duration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Duration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Duration} Duration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Duration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Duration message. + * @function verify + * @memberof google.protobuf.Duration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Duration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) + return "seconds: integer|Long expected"; + if (message.nanos != null && message.hasOwnProperty("nanos")) + if (!$util.isInteger(message.nanos)) + return "nanos: integer expected"; + return null; + }; + + /** + * Creates a Duration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Duration + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Duration} Duration + */ + Duration.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Duration) + return object; + var message = new $root.google.protobuf.Duration(); + if (object.seconds != null) + if ($util.Long) + (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; + else if (typeof object.seconds === "string") + message.seconds = parseInt(object.seconds, 10); + else if (typeof object.seconds === "number") + message.seconds = object.seconds; + else if (typeof object.seconds === "object") + message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); + if (object.nanos != null) + message.nanos = object.nanos | 0; + return message; + }; + + /** + * Creates a plain object from a Duration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Duration + * @static + * @param {google.protobuf.Duration} message Duration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Duration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.seconds = options.longs === String ? "0" : 0; + object.nanos = 0; + } + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (typeof message.seconds === "number") + object.seconds = options.longs === String ? String(message.seconds) : message.seconds; + else + object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; + if (message.nanos != null && message.hasOwnProperty("nanos")) + object.nanos = message.nanos; + return object; + }; + + /** + * Converts this Duration to JSON. + * @function toJSON + * @memberof google.protobuf.Duration + * @instance + * @returns {Object.} JSON object + */ + Duration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Duration + * @function getTypeUrl + * @memberof google.protobuf.Duration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Duration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Duration"; + }; + + return Duration; + })(); + + protobuf.FileDescriptorSet = (function() { + + /** + * Properties of a FileDescriptorSet. + * @memberof google.protobuf + * @interface IFileDescriptorSet + * @property {Array.|null} [file] FileDescriptorSet file + */ + + /** + * Constructs a new FileDescriptorSet. + * @memberof google.protobuf + * @classdesc Represents a FileDescriptorSet. + * @implements IFileDescriptorSet + * @constructor + * @param {google.protobuf.IFileDescriptorSet=} [properties] Properties to set + */ + function FileDescriptorSet(properties) { + this.file = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FileDescriptorSet file. + * @member {Array.} file + * @memberof google.protobuf.FileDescriptorSet + * @instance + */ + FileDescriptorSet.prototype.file = $util.emptyArray; + + /** + * Creates a new FileDescriptorSet instance using the specified properties. + * @function create + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.IFileDescriptorSet=} [properties] Properties to set + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet instance + */ + FileDescriptorSet.create = function create(properties) { + return new FileDescriptorSet(properties); + }; + + /** + * Encodes the specified FileDescriptorSet message. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.IFileDescriptorSet} message FileDescriptorSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorSet.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.file != null && message.file.length) + for (var i = 0; i < message.file.length; ++i) + $root.google.protobuf.FileDescriptorProto.encode(message.file[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FileDescriptorSet message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorSet.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.IFileDescriptorSet} message FileDescriptorSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorSet.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorSet.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileDescriptorSet(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.file && message.file.length)) + message.file = []; + message.file.push($root.google.protobuf.FileDescriptorProto.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FileDescriptorSet message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorSet.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FileDescriptorSet message. + * @function verify + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FileDescriptorSet.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.file != null && message.hasOwnProperty("file")) { + if (!Array.isArray(message.file)) + return "file: array expected"; + for (var i = 0; i < message.file.length; ++i) { + var error = $root.google.protobuf.FileDescriptorProto.verify(message.file[i]); + if (error) + return "file." + error; + } + } + return null; + }; + + /** + * Creates a FileDescriptorSet message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FileDescriptorSet} FileDescriptorSet + */ + FileDescriptorSet.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FileDescriptorSet) + return object; + var message = new $root.google.protobuf.FileDescriptorSet(); + if (object.file) { + if (!Array.isArray(object.file)) + throw TypeError(".google.protobuf.FileDescriptorSet.file: array expected"); + message.file = []; + for (var i = 0; i < object.file.length; ++i) { + if (typeof object.file[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorSet.file: object expected"); + message.file[i] = $root.google.protobuf.FileDescriptorProto.fromObject(object.file[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a FileDescriptorSet message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {google.protobuf.FileDescriptorSet} message FileDescriptorSet + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FileDescriptorSet.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.file = []; + if (message.file && message.file.length) { + object.file = []; + for (var j = 0; j < message.file.length; ++j) + object.file[j] = $root.google.protobuf.FileDescriptorProto.toObject(message.file[j], options); + } + return object; + }; + + /** + * Converts this FileDescriptorSet to JSON. + * @function toJSON + * @memberof google.protobuf.FileDescriptorSet + * @instance + * @returns {Object.} JSON object + */ + FileDescriptorSet.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FileDescriptorSet + * @function getTypeUrl + * @memberof google.protobuf.FileDescriptorSet + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FileDescriptorSet.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FileDescriptorSet"; + }; + + return FileDescriptorSet; + })(); + + /** + * Edition enum. + * @name google.protobuf.Edition + * @enum {number} + * @property {number} EDITION_UNKNOWN=0 EDITION_UNKNOWN value + * @property {number} EDITION_PROTO2=998 EDITION_PROTO2 value + * @property {number} EDITION_PROTO3=999 EDITION_PROTO3 value + * @property {number} EDITION_2023=1000 EDITION_2023 value + * @property {number} EDITION_2024=1001 EDITION_2024 value + * @property {number} EDITION_1_TEST_ONLY=1 EDITION_1_TEST_ONLY value + * @property {number} EDITION_2_TEST_ONLY=2 EDITION_2_TEST_ONLY value + * @property {number} EDITION_99997_TEST_ONLY=99997 EDITION_99997_TEST_ONLY value + * @property {number} EDITION_99998_TEST_ONLY=99998 EDITION_99998_TEST_ONLY value + * @property {number} EDITION_99999_TEST_ONLY=99999 EDITION_99999_TEST_ONLY value + * @property {number} EDITION_MAX=2147483647 EDITION_MAX value + */ + protobuf.Edition = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "EDITION_UNKNOWN"] = 0; + values[valuesById[998] = "EDITION_PROTO2"] = 998; + values[valuesById[999] = "EDITION_PROTO3"] = 999; + values[valuesById[1000] = "EDITION_2023"] = 1000; + values[valuesById[1001] = "EDITION_2024"] = 1001; + values[valuesById[1] = "EDITION_1_TEST_ONLY"] = 1; + values[valuesById[2] = "EDITION_2_TEST_ONLY"] = 2; + values[valuesById[99997] = "EDITION_99997_TEST_ONLY"] = 99997; + values[valuesById[99998] = "EDITION_99998_TEST_ONLY"] = 99998; + values[valuesById[99999] = "EDITION_99999_TEST_ONLY"] = 99999; + values[valuesById[2147483647] = "EDITION_MAX"] = 2147483647; + return values; + })(); + + protobuf.FileDescriptorProto = (function() { + + /** + * Properties of a FileDescriptorProto. + * @memberof google.protobuf + * @interface IFileDescriptorProto + * @property {string|null} [name] FileDescriptorProto name + * @property {string|null} ["package"] FileDescriptorProto package + * @property {Array.|null} [dependency] FileDescriptorProto dependency + * @property {Array.|null} [publicDependency] FileDescriptorProto publicDependency + * @property {Array.|null} [weakDependency] FileDescriptorProto weakDependency + * @property {Array.|null} [messageType] FileDescriptorProto messageType + * @property {Array.|null} [enumType] FileDescriptorProto enumType + * @property {Array.|null} [service] FileDescriptorProto service + * @property {Array.|null} [extension] FileDescriptorProto extension + * @property {google.protobuf.IFileOptions|null} [options] FileDescriptorProto options + * @property {google.protobuf.ISourceCodeInfo|null} [sourceCodeInfo] FileDescriptorProto sourceCodeInfo + * @property {string|null} [syntax] FileDescriptorProto syntax + * @property {google.protobuf.Edition|null} [edition] FileDescriptorProto edition + */ + + /** + * Constructs a new FileDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a FileDescriptorProto. + * @implements IFileDescriptorProto + * @constructor + * @param {google.protobuf.IFileDescriptorProto=} [properties] Properties to set + */ + function FileDescriptorProto(properties) { + this.dependency = []; + this.publicDependency = []; + this.weakDependency = []; + this.messageType = []; + this.enumType = []; + this.service = []; + this.extension = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FileDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.name = ""; + + /** + * FileDescriptorProto package. + * @member {string} package + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype["package"] = ""; + + /** + * FileDescriptorProto dependency. + * @member {Array.} dependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.dependency = $util.emptyArray; + + /** + * FileDescriptorProto publicDependency. + * @member {Array.} publicDependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.publicDependency = $util.emptyArray; + + /** + * FileDescriptorProto weakDependency. + * @member {Array.} weakDependency + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.weakDependency = $util.emptyArray; + + /** + * FileDescriptorProto messageType. + * @member {Array.} messageType + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.messageType = $util.emptyArray; + + /** + * FileDescriptorProto enumType. + * @member {Array.} enumType + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.enumType = $util.emptyArray; + + /** + * FileDescriptorProto service. + * @member {Array.} service + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.service = $util.emptyArray; + + /** + * FileDescriptorProto extension. + * @member {Array.} extension + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.extension = $util.emptyArray; + + /** + * FileDescriptorProto options. + * @member {google.protobuf.IFileOptions|null|undefined} options + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.options = null; + + /** + * FileDescriptorProto sourceCodeInfo. + * @member {google.protobuf.ISourceCodeInfo|null|undefined} sourceCodeInfo + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.sourceCodeInfo = null; + + /** + * FileDescriptorProto syntax. + * @member {string} syntax + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.syntax = ""; + + /** + * FileDescriptorProto edition. + * @member {google.protobuf.Edition} edition + * @memberof google.protobuf.FileDescriptorProto + * @instance + */ + FileDescriptorProto.prototype.edition = 0; + + /** + * Creates a new FileDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.IFileDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto instance + */ + FileDescriptorProto.create = function create(properties) { + return new FileDescriptorProto(properties); + }; + + /** + * Encodes the specified FileDescriptorProto message. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.IFileDescriptorProto} message FileDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message["package"] != null && Object.hasOwnProperty.call(message, "package")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message["package"]); + if (message.dependency != null && message.dependency.length) + for (var i = 0; i < message.dependency.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.dependency[i]); + if (message.messageType != null && message.messageType.length) + for (var i = 0; i < message.messageType.length; ++i) + $root.google.protobuf.DescriptorProto.encode(message.messageType[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.enumType != null && message.enumType.length) + for (var i = 0; i < message.enumType.length; ++i) + $root.google.protobuf.EnumDescriptorProto.encode(message.enumType[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.service != null && message.service.length) + for (var i = 0; i < message.service.length; ++i) + $root.google.protobuf.ServiceDescriptorProto.encode(message.service[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.extension != null && message.extension.length) + for (var i = 0; i < message.extension.length; ++i) + $root.google.protobuf.FieldDescriptorProto.encode(message.extension[i], writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.FileOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.sourceCodeInfo != null && Object.hasOwnProperty.call(message, "sourceCodeInfo")) + $root.google.protobuf.SourceCodeInfo.encode(message.sourceCodeInfo, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.publicDependency != null && message.publicDependency.length) + for (var i = 0; i < message.publicDependency.length; ++i) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.publicDependency[i]); + if (message.weakDependency != null && message.weakDependency.length) + for (var i = 0; i < message.weakDependency.length; ++i) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.weakDependency[i]); + if (message.syntax != null && Object.hasOwnProperty.call(message, "syntax")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.syntax); + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) + writer.uint32(/* id 14, wireType 0 =*/112).int32(message.edition); + return writer; + }; + + /** + * Encodes the specified FileDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FileDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.IFileDescriptorProto} message FileDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorProto.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message["package"] = reader.string(); + break; + } + case 3: { + if (!(message.dependency && message.dependency.length)) + message.dependency = []; + message.dependency.push(reader.string()); + break; + } + case 10: { + if (!(message.publicDependency && message.publicDependency.length)) + message.publicDependency = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.publicDependency.push(reader.int32()); + } else + message.publicDependency.push(reader.int32()); + break; + } + case 11: { + if (!(message.weakDependency && message.weakDependency.length)) + message.weakDependency = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.weakDependency.push(reader.int32()); + } else + message.weakDependency.push(reader.int32()); + break; + } + case 4: { + if (!(message.messageType && message.messageType.length)) + message.messageType = []; + message.messageType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); + break; + } + case 5: { + if (!(message.enumType && message.enumType.length)) + message.enumType = []; + message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 6: { + if (!(message.service && message.service.length)) + message.service = []; + message.service.push($root.google.protobuf.ServiceDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 7: { + if (!(message.extension && message.extension.length)) + message.extension = []; + message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 8: { + message.options = $root.google.protobuf.FileOptions.decode(reader, reader.uint32()); + break; + } + case 9: { + message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.decode(reader, reader.uint32()); + break; + } + case 12: { + message.syntax = reader.string(); + break; + } + case 14: { + message.edition = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FileDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FileDescriptorProto message. + * @function verify + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FileDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message["package"] != null && message.hasOwnProperty("package")) + if (!$util.isString(message["package"])) + return "package: string expected"; + if (message.dependency != null && message.hasOwnProperty("dependency")) { + if (!Array.isArray(message.dependency)) + return "dependency: array expected"; + for (var i = 0; i < message.dependency.length; ++i) + if (!$util.isString(message.dependency[i])) + return "dependency: string[] expected"; + } + if (message.publicDependency != null && message.hasOwnProperty("publicDependency")) { + if (!Array.isArray(message.publicDependency)) + return "publicDependency: array expected"; + for (var i = 0; i < message.publicDependency.length; ++i) + if (!$util.isInteger(message.publicDependency[i])) + return "publicDependency: integer[] expected"; + } + if (message.weakDependency != null && message.hasOwnProperty("weakDependency")) { + if (!Array.isArray(message.weakDependency)) + return "weakDependency: array expected"; + for (var i = 0; i < message.weakDependency.length; ++i) + if (!$util.isInteger(message.weakDependency[i])) + return "weakDependency: integer[] expected"; + } + if (message.messageType != null && message.hasOwnProperty("messageType")) { + if (!Array.isArray(message.messageType)) + return "messageType: array expected"; + for (var i = 0; i < message.messageType.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.verify(message.messageType[i]); + if (error) + return "messageType." + error; + } + } + if (message.enumType != null && message.hasOwnProperty("enumType")) { + if (!Array.isArray(message.enumType)) + return "enumType: array expected"; + for (var i = 0; i < message.enumType.length; ++i) { + var error = $root.google.protobuf.EnumDescriptorProto.verify(message.enumType[i]); + if (error) + return "enumType." + error; + } + } + if (message.service != null && message.hasOwnProperty("service")) { + if (!Array.isArray(message.service)) + return "service: array expected"; + for (var i = 0; i < message.service.length; ++i) { + var error = $root.google.protobuf.ServiceDescriptorProto.verify(message.service[i]); + if (error) + return "service." + error; + } + } + if (message.extension != null && message.hasOwnProperty("extension")) { + if (!Array.isArray(message.extension)) + return "extension: array expected"; + for (var i = 0; i < message.extension.length; ++i) { + var error = $root.google.protobuf.FieldDescriptorProto.verify(message.extension[i]); + if (error) + return "extension." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.FileOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.sourceCodeInfo != null && message.hasOwnProperty("sourceCodeInfo")) { + var error = $root.google.protobuf.SourceCodeInfo.verify(message.sourceCodeInfo); + if (error) + return "sourceCodeInfo." + error; + } + if (message.syntax != null && message.hasOwnProperty("syntax")) + if (!$util.isString(message.syntax)) + return "syntax: string expected"; + if (message.edition != null && message.hasOwnProperty("edition")) + switch (message.edition) { + default: + return "edition: enum value expected"; + case 0: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + return null; + }; + + /** + * Creates a FileDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FileDescriptorProto} FileDescriptorProto + */ + FileDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FileDescriptorProto) + return object; + var message = new $root.google.protobuf.FileDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object["package"] != null) + message["package"] = String(object["package"]); + if (object.dependency) { + if (!Array.isArray(object.dependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.dependency: array expected"); + message.dependency = []; + for (var i = 0; i < object.dependency.length; ++i) + message.dependency[i] = String(object.dependency[i]); + } + if (object.publicDependency) { + if (!Array.isArray(object.publicDependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.publicDependency: array expected"); + message.publicDependency = []; + for (var i = 0; i < object.publicDependency.length; ++i) + message.publicDependency[i] = object.publicDependency[i] | 0; + } + if (object.weakDependency) { + if (!Array.isArray(object.weakDependency)) + throw TypeError(".google.protobuf.FileDescriptorProto.weakDependency: array expected"); + message.weakDependency = []; + for (var i = 0; i < object.weakDependency.length; ++i) + message.weakDependency[i] = object.weakDependency[i] | 0; + } + if (object.messageType) { + if (!Array.isArray(object.messageType)) + throw TypeError(".google.protobuf.FileDescriptorProto.messageType: array expected"); + message.messageType = []; + for (var i = 0; i < object.messageType.length; ++i) { + if (typeof object.messageType[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.messageType: object expected"); + message.messageType[i] = $root.google.protobuf.DescriptorProto.fromObject(object.messageType[i]); + } + } + if (object.enumType) { + if (!Array.isArray(object.enumType)) + throw TypeError(".google.protobuf.FileDescriptorProto.enumType: array expected"); + message.enumType = []; + for (var i = 0; i < object.enumType.length; ++i) { + if (typeof object.enumType[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.enumType: object expected"); + message.enumType[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enumType[i]); + } + } + if (object.service) { + if (!Array.isArray(object.service)) + throw TypeError(".google.protobuf.FileDescriptorProto.service: array expected"); + message.service = []; + for (var i = 0; i < object.service.length; ++i) { + if (typeof object.service[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.service: object expected"); + message.service[i] = $root.google.protobuf.ServiceDescriptorProto.fromObject(object.service[i]); + } + } + if (object.extension) { + if (!Array.isArray(object.extension)) + throw TypeError(".google.protobuf.FileDescriptorProto.extension: array expected"); + message.extension = []; + for (var i = 0; i < object.extension.length; ++i) { + if (typeof object.extension[i] !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.extension: object expected"); + message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.FileOptions.fromObject(object.options); + } + if (object.sourceCodeInfo != null) { + if (typeof object.sourceCodeInfo !== "object") + throw TypeError(".google.protobuf.FileDescriptorProto.sourceCodeInfo: object expected"); + message.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.fromObject(object.sourceCodeInfo); + } + if (object.syntax != null) + message.syntax = String(object.syntax); + switch (object.edition) { + default: + if (typeof object.edition === "number") { + message.edition = object.edition; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.edition = 0; + break; + case "EDITION_PROTO2": + case 998: + message.edition = 998; + break; + case "EDITION_PROTO3": + case 999: + message.edition = 999; + break; + case "EDITION_2023": + case 1000: + message.edition = 1000; + break; + case "EDITION_2024": + case 1001: + message.edition = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.edition = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.edition = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.edition = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.edition = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.edition = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.edition = 2147483647; + break; + } + return message; + }; + + /** + * Creates a plain object from a FileDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {google.protobuf.FileDescriptorProto} message FileDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FileDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.dependency = []; + object.messageType = []; + object.enumType = []; + object.service = []; + object.extension = []; + object.publicDependency = []; + object.weakDependency = []; + } + if (options.defaults) { + object.name = ""; + object["package"] = ""; + object.options = null; + object.sourceCodeInfo = null; + object.syntax = ""; + object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message["package"] != null && message.hasOwnProperty("package")) + object["package"] = message["package"]; + if (message.dependency && message.dependency.length) { + object.dependency = []; + for (var j = 0; j < message.dependency.length; ++j) + object.dependency[j] = message.dependency[j]; + } + if (message.messageType && message.messageType.length) { + object.messageType = []; + for (var j = 0; j < message.messageType.length; ++j) + object.messageType[j] = $root.google.protobuf.DescriptorProto.toObject(message.messageType[j], options); + } + if (message.enumType && message.enumType.length) { + object.enumType = []; + for (var j = 0; j < message.enumType.length; ++j) + object.enumType[j] = $root.google.protobuf.EnumDescriptorProto.toObject(message.enumType[j], options); + } + if (message.service && message.service.length) { + object.service = []; + for (var j = 0; j < message.service.length; ++j) + object.service[j] = $root.google.protobuf.ServiceDescriptorProto.toObject(message.service[j], options); + } + if (message.extension && message.extension.length) { + object.extension = []; + for (var j = 0; j < message.extension.length; ++j) + object.extension[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.extension[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.FileOptions.toObject(message.options, options); + if (message.sourceCodeInfo != null && message.hasOwnProperty("sourceCodeInfo")) + object.sourceCodeInfo = $root.google.protobuf.SourceCodeInfo.toObject(message.sourceCodeInfo, options); + if (message.publicDependency && message.publicDependency.length) { + object.publicDependency = []; + for (var j = 0; j < message.publicDependency.length; ++j) + object.publicDependency[j] = message.publicDependency[j]; + } + if (message.weakDependency && message.weakDependency.length) { + object.weakDependency = []; + for (var j = 0; j < message.weakDependency.length; ++j) + object.weakDependency[j] = message.weakDependency[j]; + } + if (message.syntax != null && message.hasOwnProperty("syntax")) + object.syntax = message.syntax; + if (message.edition != null && message.hasOwnProperty("edition")) + object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + return object; + }; + + /** + * Converts this FileDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.FileDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + FileDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FileDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.FileDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FileDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FileDescriptorProto"; + }; + + return FileDescriptorProto; + })(); + + protobuf.DescriptorProto = (function() { + + /** + * Properties of a DescriptorProto. + * @memberof google.protobuf + * @interface IDescriptorProto + * @property {string|null} [name] DescriptorProto name + * @property {Array.|null} [field] DescriptorProto field + * @property {Array.|null} [extension] DescriptorProto extension + * @property {Array.|null} [nestedType] DescriptorProto nestedType + * @property {Array.|null} [enumType] DescriptorProto enumType + * @property {Array.|null} [extensionRange] DescriptorProto extensionRange + * @property {Array.|null} [oneofDecl] DescriptorProto oneofDecl + * @property {google.protobuf.IMessageOptions|null} [options] DescriptorProto options + * @property {Array.|null} [reservedRange] DescriptorProto reservedRange + * @property {Array.|null} [reservedName] DescriptorProto reservedName + */ + + /** + * Constructs a new DescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a DescriptorProto. + * @implements IDescriptorProto + * @constructor + * @param {google.protobuf.IDescriptorProto=} [properties] Properties to set + */ + function DescriptorProto(properties) { + this.field = []; + this.extension = []; + this.nestedType = []; + this.enumType = []; + this.extensionRange = []; + this.oneofDecl = []; + this.reservedRange = []; + this.reservedName = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DescriptorProto name. + * @member {string} name + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.name = ""; + + /** + * DescriptorProto field. + * @member {Array.} field + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.field = $util.emptyArray; + + /** + * DescriptorProto extension. + * @member {Array.} extension + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.extension = $util.emptyArray; + + /** + * DescriptorProto nestedType. + * @member {Array.} nestedType + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.nestedType = $util.emptyArray; + + /** + * DescriptorProto enumType. + * @member {Array.} enumType + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.enumType = $util.emptyArray; + + /** + * DescriptorProto extensionRange. + * @member {Array.} extensionRange + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.extensionRange = $util.emptyArray; + + /** + * DescriptorProto oneofDecl. + * @member {Array.} oneofDecl + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.oneofDecl = $util.emptyArray; + + /** + * DescriptorProto options. + * @member {google.protobuf.IMessageOptions|null|undefined} options + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.options = null; + + /** + * DescriptorProto reservedRange. + * @member {Array.} reservedRange + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.reservedRange = $util.emptyArray; + + /** + * DescriptorProto reservedName. + * @member {Array.} reservedName + * @memberof google.protobuf.DescriptorProto + * @instance + */ + DescriptorProto.prototype.reservedName = $util.emptyArray; + + /** + * Creates a new DescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.IDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.DescriptorProto} DescriptorProto instance + */ + DescriptorProto.create = function create(properties) { + return new DescriptorProto(properties); + }; + + /** + * Encodes the specified DescriptorProto message. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.field != null && message.field.length) + for (var i = 0; i < message.field.length; ++i) + $root.google.protobuf.FieldDescriptorProto.encode(message.field[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.nestedType != null && message.nestedType.length) + for (var i = 0; i < message.nestedType.length; ++i) + $root.google.protobuf.DescriptorProto.encode(message.nestedType[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.enumType != null && message.enumType.length) + for (var i = 0; i < message.enumType.length; ++i) + $root.google.protobuf.EnumDescriptorProto.encode(message.enumType[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.extensionRange != null && message.extensionRange.length) + for (var i = 0; i < message.extensionRange.length; ++i) + $root.google.protobuf.DescriptorProto.ExtensionRange.encode(message.extensionRange[i], writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.extension != null && message.extension.length) + for (var i = 0; i < message.extension.length; ++i) + $root.google.protobuf.FieldDescriptorProto.encode(message.extension[i], writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.MessageOptions.encode(message.options, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.oneofDecl != null && message.oneofDecl.length) + for (var i = 0; i < message.oneofDecl.length; ++i) + $root.google.protobuf.OneofDescriptorProto.encode(message.oneofDecl[i], writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.reservedRange != null && message.reservedRange.length) + for (var i = 0; i < message.reservedRange.length; ++i) + $root.google.protobuf.DescriptorProto.ReservedRange.encode(message.reservedRange[i], writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.reservedName != null && message.reservedName.length) + for (var i = 0; i < message.reservedName.length; ++i) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.reservedName[i]); + return writer; + }; + + /** + * Encodes the specified DescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.IDescriptorProto} message DescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto} DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DescriptorProto.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.field && message.field.length)) + message.field = []; + message.field.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 6: { + if (!(message.extension && message.extension.length)) + message.extension = []; + message.extension.push($root.google.protobuf.FieldDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 3: { + if (!(message.nestedType && message.nestedType.length)) + message.nestedType = []; + message.nestedType.push($root.google.protobuf.DescriptorProto.decode(reader, reader.uint32())); + break; + } + case 4: { + if (!(message.enumType && message.enumType.length)) + message.enumType = []; + message.enumType.push($root.google.protobuf.EnumDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 5: { + if (!(message.extensionRange && message.extensionRange.length)) + message.extensionRange = []; + message.extensionRange.push($root.google.protobuf.DescriptorProto.ExtensionRange.decode(reader, reader.uint32())); + break; + } + case 8: { + if (!(message.oneofDecl && message.oneofDecl.length)) + message.oneofDecl = []; + message.oneofDecl.push($root.google.protobuf.OneofDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 7: { + message.options = $root.google.protobuf.MessageOptions.decode(reader, reader.uint32()); + break; + } + case 9: { + if (!(message.reservedRange && message.reservedRange.length)) + message.reservedRange = []; + message.reservedRange.push($root.google.protobuf.DescriptorProto.ReservedRange.decode(reader, reader.uint32())); + break; + } + case 10: { + if (!(message.reservedName && message.reservedName.length)) + message.reservedName = []; + message.reservedName.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto} DescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DescriptorProto message. + * @function verify + * @memberof google.protobuf.DescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.field != null && message.hasOwnProperty("field")) { + if (!Array.isArray(message.field)) + return "field: array expected"; + for (var i = 0; i < message.field.length; ++i) { + var error = $root.google.protobuf.FieldDescriptorProto.verify(message.field[i]); + if (error) + return "field." + error; + } + } + if (message.extension != null && message.hasOwnProperty("extension")) { + if (!Array.isArray(message.extension)) + return "extension: array expected"; + for (var i = 0; i < message.extension.length; ++i) { + var error = $root.google.protobuf.FieldDescriptorProto.verify(message.extension[i]); + if (error) + return "extension." + error; + } + } + if (message.nestedType != null && message.hasOwnProperty("nestedType")) { + if (!Array.isArray(message.nestedType)) + return "nestedType: array expected"; + for (var i = 0; i < message.nestedType.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.verify(message.nestedType[i]); + if (error) + return "nestedType." + error; + } + } + if (message.enumType != null && message.hasOwnProperty("enumType")) { + if (!Array.isArray(message.enumType)) + return "enumType: array expected"; + for (var i = 0; i < message.enumType.length; ++i) { + var error = $root.google.protobuf.EnumDescriptorProto.verify(message.enumType[i]); + if (error) + return "enumType." + error; + } + } + if (message.extensionRange != null && message.hasOwnProperty("extensionRange")) { + if (!Array.isArray(message.extensionRange)) + return "extensionRange: array expected"; + for (var i = 0; i < message.extensionRange.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.ExtensionRange.verify(message.extensionRange[i]); + if (error) + return "extensionRange." + error; + } + } + if (message.oneofDecl != null && message.hasOwnProperty("oneofDecl")) { + if (!Array.isArray(message.oneofDecl)) + return "oneofDecl: array expected"; + for (var i = 0; i < message.oneofDecl.length; ++i) { + var error = $root.google.protobuf.OneofDescriptorProto.verify(message.oneofDecl[i]); + if (error) + return "oneofDecl." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.MessageOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.reservedRange != null && message.hasOwnProperty("reservedRange")) { + if (!Array.isArray(message.reservedRange)) + return "reservedRange: array expected"; + for (var i = 0; i < message.reservedRange.length; ++i) { + var error = $root.google.protobuf.DescriptorProto.ReservedRange.verify(message.reservedRange[i]); + if (error) + return "reservedRange." + error; + } + } + if (message.reservedName != null && message.hasOwnProperty("reservedName")) { + if (!Array.isArray(message.reservedName)) + return "reservedName: array expected"; + for (var i = 0; i < message.reservedName.length; ++i) + if (!$util.isString(message.reservedName[i])) + return "reservedName: string[] expected"; + } + return null; + }; + + /** + * Creates a DescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto} DescriptorProto + */ + DescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DescriptorProto) + return object; + var message = new $root.google.protobuf.DescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.field) { + if (!Array.isArray(object.field)) + throw TypeError(".google.protobuf.DescriptorProto.field: array expected"); + message.field = []; + for (var i = 0; i < object.field.length; ++i) { + if (typeof object.field[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.field: object expected"); + message.field[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.field[i]); + } + } + if (object.extension) { + if (!Array.isArray(object.extension)) + throw TypeError(".google.protobuf.DescriptorProto.extension: array expected"); + message.extension = []; + for (var i = 0; i < object.extension.length; ++i) { + if (typeof object.extension[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.extension: object expected"); + message.extension[i] = $root.google.protobuf.FieldDescriptorProto.fromObject(object.extension[i]); + } + } + if (object.nestedType) { + if (!Array.isArray(object.nestedType)) + throw TypeError(".google.protobuf.DescriptorProto.nestedType: array expected"); + message.nestedType = []; + for (var i = 0; i < object.nestedType.length; ++i) { + if (typeof object.nestedType[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.nestedType: object expected"); + message.nestedType[i] = $root.google.protobuf.DescriptorProto.fromObject(object.nestedType[i]); + } + } + if (object.enumType) { + if (!Array.isArray(object.enumType)) + throw TypeError(".google.protobuf.DescriptorProto.enumType: array expected"); + message.enumType = []; + for (var i = 0; i < object.enumType.length; ++i) { + if (typeof object.enumType[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.enumType: object expected"); + message.enumType[i] = $root.google.protobuf.EnumDescriptorProto.fromObject(object.enumType[i]); + } + } + if (object.extensionRange) { + if (!Array.isArray(object.extensionRange)) + throw TypeError(".google.protobuf.DescriptorProto.extensionRange: array expected"); + message.extensionRange = []; + for (var i = 0; i < object.extensionRange.length; ++i) { + if (typeof object.extensionRange[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.extensionRange: object expected"); + message.extensionRange[i] = $root.google.protobuf.DescriptorProto.ExtensionRange.fromObject(object.extensionRange[i]); + } + } + if (object.oneofDecl) { + if (!Array.isArray(object.oneofDecl)) + throw TypeError(".google.protobuf.DescriptorProto.oneofDecl: array expected"); + message.oneofDecl = []; + for (var i = 0; i < object.oneofDecl.length; ++i) { + if (typeof object.oneofDecl[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.oneofDecl: object expected"); + message.oneofDecl[i] = $root.google.protobuf.OneofDescriptorProto.fromObject(object.oneofDecl[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.DescriptorProto.options: object expected"); + message.options = $root.google.protobuf.MessageOptions.fromObject(object.options); + } + if (object.reservedRange) { + if (!Array.isArray(object.reservedRange)) + throw TypeError(".google.protobuf.DescriptorProto.reservedRange: array expected"); + message.reservedRange = []; + for (var i = 0; i < object.reservedRange.length; ++i) { + if (typeof object.reservedRange[i] !== "object") + throw TypeError(".google.protobuf.DescriptorProto.reservedRange: object expected"); + message.reservedRange[i] = $root.google.protobuf.DescriptorProto.ReservedRange.fromObject(object.reservedRange[i]); + } + } + if (object.reservedName) { + if (!Array.isArray(object.reservedName)) + throw TypeError(".google.protobuf.DescriptorProto.reservedName: array expected"); + message.reservedName = []; + for (var i = 0; i < object.reservedName.length; ++i) + message.reservedName[i] = String(object.reservedName[i]); + } + return message; + }; + + /** + * Creates a plain object from a DescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto + * @static + * @param {google.protobuf.DescriptorProto} message DescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.field = []; + object.nestedType = []; + object.enumType = []; + object.extensionRange = []; + object.extension = []; + object.oneofDecl = []; + object.reservedRange = []; + object.reservedName = []; + } + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.field && message.field.length) { + object.field = []; + for (var j = 0; j < message.field.length; ++j) + object.field[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.field[j], options); + } + if (message.nestedType && message.nestedType.length) { + object.nestedType = []; + for (var j = 0; j < message.nestedType.length; ++j) + object.nestedType[j] = $root.google.protobuf.DescriptorProto.toObject(message.nestedType[j], options); + } + if (message.enumType && message.enumType.length) { + object.enumType = []; + for (var j = 0; j < message.enumType.length; ++j) + object.enumType[j] = $root.google.protobuf.EnumDescriptorProto.toObject(message.enumType[j], options); + } + if (message.extensionRange && message.extensionRange.length) { + object.extensionRange = []; + for (var j = 0; j < message.extensionRange.length; ++j) + object.extensionRange[j] = $root.google.protobuf.DescriptorProto.ExtensionRange.toObject(message.extensionRange[j], options); + } + if (message.extension && message.extension.length) { + object.extension = []; + for (var j = 0; j < message.extension.length; ++j) + object.extension[j] = $root.google.protobuf.FieldDescriptorProto.toObject(message.extension[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.MessageOptions.toObject(message.options, options); + if (message.oneofDecl && message.oneofDecl.length) { + object.oneofDecl = []; + for (var j = 0; j < message.oneofDecl.length; ++j) + object.oneofDecl[j] = $root.google.protobuf.OneofDescriptorProto.toObject(message.oneofDecl[j], options); + } + if (message.reservedRange && message.reservedRange.length) { + object.reservedRange = []; + for (var j = 0; j < message.reservedRange.length; ++j) + object.reservedRange[j] = $root.google.protobuf.DescriptorProto.ReservedRange.toObject(message.reservedRange[j], options); + } + if (message.reservedName && message.reservedName.length) { + object.reservedName = []; + for (var j = 0; j < message.reservedName.length; ++j) + object.reservedName[j] = message.reservedName[j]; + } + return object; + }; + + /** + * Converts this DescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto + * @instance + * @returns {Object.} JSON object + */ + DescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.DescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.DescriptorProto"; + }; + + DescriptorProto.ExtensionRange = (function() { + + /** + * Properties of an ExtensionRange. + * @memberof google.protobuf.DescriptorProto + * @interface IExtensionRange + * @property {number|null} [start] ExtensionRange start + * @property {number|null} [end] ExtensionRange end + * @property {google.protobuf.IExtensionRangeOptions|null} [options] ExtensionRange options + */ + + /** + * Constructs a new ExtensionRange. + * @memberof google.protobuf.DescriptorProto + * @classdesc Represents an ExtensionRange. + * @implements IExtensionRange + * @constructor + * @param {google.protobuf.DescriptorProto.IExtensionRange=} [properties] Properties to set + */ + function ExtensionRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExtensionRange start. + * @member {number} start + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + */ + ExtensionRange.prototype.start = 0; + + /** + * ExtensionRange end. + * @member {number} end + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + */ + ExtensionRange.prototype.end = 0; + + /** + * ExtensionRange options. + * @member {google.protobuf.IExtensionRangeOptions|null|undefined} options + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + */ + ExtensionRange.prototype.options = null; + + /** + * Creates a new ExtensionRange instance using the specified properties. + * @function create + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.IExtensionRange=} [properties] Properties to set + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange instance + */ + ExtensionRange.create = function create(properties) { + return new ExtensionRange(properties); + }; + + /** + * Encodes the specified ExtensionRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.IExtensionRange} message ExtensionRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.start != null && Object.hasOwnProperty.call(message, "start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.ExtensionRangeOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExtensionRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ExtensionRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.IExtensionRange} message ExtensionRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRange.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto.ExtensionRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.start = reader.int32(); + break; + } + case 2: { + message.end = reader.int32(); + break; + } + case 3: { + message.options = $root.google.protobuf.ExtensionRangeOptions.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExtensionRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExtensionRange message. + * @function verify + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExtensionRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.start != null && message.hasOwnProperty("start")) + if (!$util.isInteger(message.start)) + return "start: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.ExtensionRangeOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an ExtensionRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto.ExtensionRange} ExtensionRange + */ + ExtensionRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DescriptorProto.ExtensionRange) + return object; + var message = new $root.google.protobuf.DescriptorProto.ExtensionRange(); + if (object.start != null) + message.start = object.start | 0; + if (object.end != null) + message.end = object.end | 0; + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.DescriptorProto.ExtensionRange.options: object expected"); + message.options = $root.google.protobuf.ExtensionRangeOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from an ExtensionRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {google.protobuf.DescriptorProto.ExtensionRange} message ExtensionRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExtensionRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.start = 0; + object.end = 0; + object.options = null; + } + if (message.start != null && message.hasOwnProperty("start")) + object.start = message.start; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.ExtensionRangeOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this ExtensionRange to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @instance + * @returns {Object.} JSON object + */ + ExtensionRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExtensionRange + * @function getTypeUrl + * @memberof google.protobuf.DescriptorProto.ExtensionRange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExtensionRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.DescriptorProto.ExtensionRange"; + }; + + return ExtensionRange; + })(); + + DescriptorProto.ReservedRange = (function() { + + /** + * Properties of a ReservedRange. + * @memberof google.protobuf.DescriptorProto + * @interface IReservedRange + * @property {number|null} [start] ReservedRange start + * @property {number|null} [end] ReservedRange end + */ + + /** + * Constructs a new ReservedRange. + * @memberof google.protobuf.DescriptorProto + * @classdesc Represents a ReservedRange. + * @implements IReservedRange + * @constructor + * @param {google.protobuf.DescriptorProto.IReservedRange=} [properties] Properties to set + */ + function ReservedRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ReservedRange start. + * @member {number} start + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + */ + ReservedRange.prototype.start = 0; + + /** + * ReservedRange end. + * @member {number} end + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + */ + ReservedRange.prototype.end = 0; + + /** + * Creates a new ReservedRange instance using the specified properties. + * @function create + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.IReservedRange=} [properties] Properties to set + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange instance + */ + ReservedRange.create = function create(properties) { + return new ReservedRange(properties); + }; + + /** + * Encodes the specified ReservedRange message. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @function encode + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.IReservedRange} message ReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReservedRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.start != null && Object.hasOwnProperty.call(message, "start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + return writer; + }; + + /** + * Encodes the specified ReservedRange message, length delimited. Does not implicitly {@link google.protobuf.DescriptorProto.ReservedRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.IReservedRange} message ReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ReservedRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ReservedRange message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReservedRange.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.DescriptorProto.ReservedRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.start = reader.int32(); + break; + } + case 2: { + message.end = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ReservedRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ReservedRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ReservedRange message. + * @function verify + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ReservedRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.start != null && message.hasOwnProperty("start")) + if (!$util.isInteger(message.start)) + return "start: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + return null; + }; + + /** + * Creates a ReservedRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.DescriptorProto.ReservedRange} ReservedRange + */ + ReservedRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.DescriptorProto.ReservedRange) + return object; + var message = new $root.google.protobuf.DescriptorProto.ReservedRange(); + if (object.start != null) + message.start = object.start | 0; + if (object.end != null) + message.end = object.end | 0; + return message; + }; + + /** + * Creates a plain object from a ReservedRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {google.protobuf.DescriptorProto.ReservedRange} message ReservedRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ReservedRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.start = 0; + object.end = 0; + } + if (message.start != null && message.hasOwnProperty("start")) + object.start = message.start; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + return object; + }; + + /** + * Converts this ReservedRange to JSON. + * @function toJSON + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @instance + * @returns {Object.} JSON object + */ + ReservedRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ReservedRange + * @function getTypeUrl + * @memberof google.protobuf.DescriptorProto.ReservedRange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ReservedRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.DescriptorProto.ReservedRange"; + }; + + return ReservedRange; + })(); + + return DescriptorProto; + })(); + + protobuf.ExtensionRangeOptions = (function() { + + /** + * Properties of an ExtensionRangeOptions. + * @memberof google.protobuf + * @interface IExtensionRangeOptions + * @property {Array.|null} [uninterpretedOption] ExtensionRangeOptions uninterpretedOption + * @property {Array.|null} [declaration] ExtensionRangeOptions declaration + * @property {google.protobuf.IFeatureSet|null} [features] ExtensionRangeOptions features + * @property {google.protobuf.ExtensionRangeOptions.VerificationState|null} [verification] ExtensionRangeOptions verification + */ + + /** + * Constructs a new ExtensionRangeOptions. + * @memberof google.protobuf + * @classdesc Represents an ExtensionRangeOptions. + * @implements IExtensionRangeOptions + * @constructor + * @param {google.protobuf.IExtensionRangeOptions=} [properties] Properties to set + */ + function ExtensionRangeOptions(properties) { + this.uninterpretedOption = []; + this.declaration = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ExtensionRangeOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.ExtensionRangeOptions + * @instance + */ + ExtensionRangeOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * ExtensionRangeOptions declaration. + * @member {Array.} declaration + * @memberof google.protobuf.ExtensionRangeOptions + * @instance + */ + ExtensionRangeOptions.prototype.declaration = $util.emptyArray; + + /** + * ExtensionRangeOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.ExtensionRangeOptions + * @instance + */ + ExtensionRangeOptions.prototype.features = null; + + /** + * ExtensionRangeOptions verification. + * @member {google.protobuf.ExtensionRangeOptions.VerificationState} verification + * @memberof google.protobuf.ExtensionRangeOptions + * @instance + */ + ExtensionRangeOptions.prototype.verification = 1; + + /** + * Creates a new ExtensionRangeOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.IExtensionRangeOptions=} [properties] Properties to set + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions instance + */ + ExtensionRangeOptions.create = function create(properties) { + return new ExtensionRangeOptions(properties); + }; + + /** + * Encodes the specified ExtensionRangeOptions message. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.IExtensionRangeOptions} message ExtensionRangeOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRangeOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.declaration != null && message.declaration.length) + for (var i = 0; i < message.declaration.length; ++i) + $root.google.protobuf.ExtensionRangeOptions.Declaration.encode(message.declaration[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.verification != null && Object.hasOwnProperty.call(message, "verification")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.verification); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 50, wireType 2 =*/402).fork()).ldelim(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ExtensionRangeOptions message, length delimited. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.IExtensionRangeOptions} message ExtensionRangeOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ExtensionRangeOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an ExtensionRangeOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRangeOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ExtensionRangeOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 2: { + if (!(message.declaration && message.declaration.length)) + message.declaration = []; + message.declaration.push($root.google.protobuf.ExtensionRangeOptions.Declaration.decode(reader, reader.uint32())); + break; + } + case 50: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 3: { + message.verification = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an ExtensionRangeOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ExtensionRangeOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an ExtensionRangeOptions message. + * @function verify + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ExtensionRangeOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message.declaration != null && message.hasOwnProperty("declaration")) { + if (!Array.isArray(message.declaration)) + return "declaration: array expected"; + for (var i = 0; i < message.declaration.length; ++i) { + var error = $root.google.protobuf.ExtensionRangeOptions.Declaration.verify(message.declaration[i]); + if (error) + return "declaration." + error; + } + } + if (message.features != null && message.hasOwnProperty("features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (error) + return "features." + error; + } + if (message.verification != null && message.hasOwnProperty("verification")) + switch (message.verification) { + default: + return "verification: enum value expected"; + case 0: + case 1: + break; + } + return null; + }; + + /** + * Creates an ExtensionRangeOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ExtensionRangeOptions} ExtensionRangeOptions + */ + ExtensionRangeOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ExtensionRangeOptions) + return object; + var message = new $root.google.protobuf.ExtensionRangeOptions(); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.ExtensionRangeOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.ExtensionRangeOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object.declaration) { + if (!Array.isArray(object.declaration)) + throw TypeError(".google.protobuf.ExtensionRangeOptions.declaration: array expected"); + message.declaration = []; + for (var i = 0; i < object.declaration.length; ++i) { + if (typeof object.declaration[i] !== "object") + throw TypeError(".google.protobuf.ExtensionRangeOptions.declaration: object expected"); + message.declaration[i] = $root.google.protobuf.ExtensionRangeOptions.Declaration.fromObject(object.declaration[i]); + } + } + if (object.features != null) { + if (typeof object.features !== "object") + throw TypeError(".google.protobuf.ExtensionRangeOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + } + switch (object.verification) { + case "DECLARATION": + case 0: + message.verification = 0; + break; + default: + if (typeof object.verification === "number") { + message.verification = object.verification; + break; + } + break; + case "UNVERIFIED": + case 1: + message.verification = 1; + break; + } + return message; + }; + + /** + * Creates a plain object from an ExtensionRangeOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {google.protobuf.ExtensionRangeOptions} message ExtensionRangeOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ExtensionRangeOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.declaration = []; + object.uninterpretedOption = []; + } + if (options.defaults) { + object.verification = options.enums === String ? "UNVERIFIED" : 1; + object.features = null; + } + if (message.declaration && message.declaration.length) { + object.declaration = []; + for (var j = 0; j < message.declaration.length; ++j) + object.declaration[j] = $root.google.protobuf.ExtensionRangeOptions.Declaration.toObject(message.declaration[j], options); + } + if (message.verification != null && message.hasOwnProperty("verification")) + object.verification = options.enums === String ? $root.google.protobuf.ExtensionRangeOptions.VerificationState[message.verification] === undefined ? message.verification : $root.google.protobuf.ExtensionRangeOptions.VerificationState[message.verification] : message.verification; + if (message.features != null && message.hasOwnProperty("features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this ExtensionRangeOptions to JSON. + * @function toJSON + * @memberof google.protobuf.ExtensionRangeOptions + * @instance + * @returns {Object.} JSON object + */ + ExtensionRangeOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ExtensionRangeOptions + * @function getTypeUrl + * @memberof google.protobuf.ExtensionRangeOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ExtensionRangeOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.ExtensionRangeOptions"; + }; + + ExtensionRangeOptions.Declaration = (function() { + + /** + * Properties of a Declaration. + * @memberof google.protobuf.ExtensionRangeOptions + * @interface IDeclaration + * @property {number|null} [number] Declaration number + * @property {string|null} [fullName] Declaration fullName + * @property {string|null} [type] Declaration type + * @property {boolean|null} [reserved] Declaration reserved + * @property {boolean|null} [repeated] Declaration repeated + */ + + /** + * Constructs a new Declaration. + * @memberof google.protobuf.ExtensionRangeOptions + * @classdesc Represents a Declaration. + * @implements IDeclaration + * @constructor + * @param {google.protobuf.ExtensionRangeOptions.IDeclaration=} [properties] Properties to set + */ + function Declaration(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Declaration number. + * @member {number} number + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @instance + */ + Declaration.prototype.number = 0; + + /** + * Declaration fullName. + * @member {string} fullName + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @instance + */ + Declaration.prototype.fullName = ""; + + /** + * Declaration type. + * @member {string} type + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @instance + */ + Declaration.prototype.type = ""; + + /** + * Declaration reserved. + * @member {boolean} reserved + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @instance + */ + Declaration.prototype.reserved = false; + + /** + * Declaration repeated. + * @member {boolean} repeated + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @instance + */ + Declaration.prototype.repeated = false; + + /** + * Creates a new Declaration instance using the specified properties. + * @function create + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {google.protobuf.ExtensionRangeOptions.IDeclaration=} [properties] Properties to set + * @returns {google.protobuf.ExtensionRangeOptions.Declaration} Declaration instance + */ + Declaration.create = function create(properties) { + return new Declaration(properties); + }; + + /** + * Encodes the specified Declaration message. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.Declaration.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {google.protobuf.ExtensionRangeOptions.IDeclaration} message Declaration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Declaration.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.number != null && Object.hasOwnProperty.call(message, "number")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.number); + if (message.fullName != null && Object.hasOwnProperty.call(message, "fullName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.fullName); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.type); + if (message.reserved != null && Object.hasOwnProperty.call(message, "reserved")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.reserved); + if (message.repeated != null && Object.hasOwnProperty.call(message, "repeated")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.repeated); + return writer; + }; + + /** + * Encodes the specified Declaration message, length delimited. Does not implicitly {@link google.protobuf.ExtensionRangeOptions.Declaration.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {google.protobuf.ExtensionRangeOptions.IDeclaration} message Declaration message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Declaration.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Declaration message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ExtensionRangeOptions.Declaration} Declaration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Declaration.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ExtensionRangeOptions.Declaration(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.number = reader.int32(); + break; + } + case 2: { + message.fullName = reader.string(); + break; + } + case 3: { + message.type = reader.string(); + break; + } + case 5: { + message.reserved = reader.bool(); + break; + } + case 6: { + message.repeated = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Declaration message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ExtensionRangeOptions.Declaration} Declaration + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Declaration.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Declaration message. + * @function verify + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Declaration.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.number != null && message.hasOwnProperty("number")) + if (!$util.isInteger(message.number)) + return "number: integer expected"; + if (message.fullName != null && message.hasOwnProperty("fullName")) + if (!$util.isString(message.fullName)) + return "fullName: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.reserved != null && message.hasOwnProperty("reserved")) + if (typeof message.reserved !== "boolean") + return "reserved: boolean expected"; + if (message.repeated != null && message.hasOwnProperty("repeated")) + if (typeof message.repeated !== "boolean") + return "repeated: boolean expected"; + return null; + }; + + /** + * Creates a Declaration message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ExtensionRangeOptions.Declaration} Declaration + */ + Declaration.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ExtensionRangeOptions.Declaration) + return object; + var message = new $root.google.protobuf.ExtensionRangeOptions.Declaration(); + if (object.number != null) + message.number = object.number | 0; + if (object.fullName != null) + message.fullName = String(object.fullName); + if (object.type != null) + message.type = String(object.type); + if (object.reserved != null) + message.reserved = Boolean(object.reserved); + if (object.repeated != null) + message.repeated = Boolean(object.repeated); + return message; + }; + + /** + * Creates a plain object from a Declaration message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {google.protobuf.ExtensionRangeOptions.Declaration} message Declaration + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Declaration.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.number = 0; + object.fullName = ""; + object.type = ""; + object.reserved = false; + object.repeated = false; + } + if (message.number != null && message.hasOwnProperty("number")) + object.number = message.number; + if (message.fullName != null && message.hasOwnProperty("fullName")) + object.fullName = message.fullName; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.reserved != null && message.hasOwnProperty("reserved")) + object.reserved = message.reserved; + if (message.repeated != null && message.hasOwnProperty("repeated")) + object.repeated = message.repeated; + return object; + }; + + /** + * Converts this Declaration to JSON. + * @function toJSON + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @instance + * @returns {Object.} JSON object + */ + Declaration.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Declaration + * @function getTypeUrl + * @memberof google.protobuf.ExtensionRangeOptions.Declaration + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Declaration.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.ExtensionRangeOptions.Declaration"; + }; + + return Declaration; + })(); + + /** + * VerificationState enum. + * @name google.protobuf.ExtensionRangeOptions.VerificationState + * @enum {number} + * @property {number} DECLARATION=0 DECLARATION value + * @property {number} UNVERIFIED=1 UNVERIFIED value + */ + ExtensionRangeOptions.VerificationState = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DECLARATION"] = 0; + values[valuesById[1] = "UNVERIFIED"] = 1; + return values; + })(); + + return ExtensionRangeOptions; + })(); + + protobuf.FieldDescriptorProto = (function() { + + /** + * Properties of a FieldDescriptorProto. + * @memberof google.protobuf + * @interface IFieldDescriptorProto + * @property {string|null} [name] FieldDescriptorProto name + * @property {number|null} [number] FieldDescriptorProto number + * @property {google.protobuf.FieldDescriptorProto.Label|null} [label] FieldDescriptorProto label + * @property {google.protobuf.FieldDescriptorProto.Type|null} [type] FieldDescriptorProto type + * @property {string|null} [typeName] FieldDescriptorProto typeName + * @property {string|null} [extendee] FieldDescriptorProto extendee + * @property {string|null} [defaultValue] FieldDescriptorProto defaultValue + * @property {number|null} [oneofIndex] FieldDescriptorProto oneofIndex + * @property {string|null} [jsonName] FieldDescriptorProto jsonName + * @property {google.protobuf.IFieldOptions|null} [options] FieldDescriptorProto options + * @property {boolean|null} [proto3Optional] FieldDescriptorProto proto3Optional + */ + + /** + * Constructs a new FieldDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a FieldDescriptorProto. + * @implements IFieldDescriptorProto + * @constructor + * @param {google.protobuf.IFieldDescriptorProto=} [properties] Properties to set + */ + function FieldDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.name = ""; + + /** + * FieldDescriptorProto number. + * @member {number} number + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.number = 0; + + /** + * FieldDescriptorProto label. + * @member {google.protobuf.FieldDescriptorProto.Label} label + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.label = 1; + + /** + * FieldDescriptorProto type. + * @member {google.protobuf.FieldDescriptorProto.Type} type + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.type = 1; + + /** + * FieldDescriptorProto typeName. + * @member {string} typeName + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.typeName = ""; + + /** + * FieldDescriptorProto extendee. + * @member {string} extendee + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.extendee = ""; + + /** + * FieldDescriptorProto defaultValue. + * @member {string} defaultValue + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.defaultValue = ""; + + /** + * FieldDescriptorProto oneofIndex. + * @member {number} oneofIndex + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.oneofIndex = 0; + + /** + * FieldDescriptorProto jsonName. + * @member {string} jsonName + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.jsonName = ""; + + /** + * FieldDescriptorProto options. + * @member {google.protobuf.IFieldOptions|null|undefined} options + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.options = null; + + /** + * FieldDescriptorProto proto3Optional. + * @member {boolean} proto3Optional + * @memberof google.protobuf.FieldDescriptorProto + * @instance + */ + FieldDescriptorProto.prototype.proto3Optional = false; + + /** + * Creates a new FieldDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.IFieldDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto instance + */ + FieldDescriptorProto.create = function create(properties) { + return new FieldDescriptorProto(properties); + }; + + /** + * Encodes the specified FieldDescriptorProto message. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.IFieldDescriptorProto} message FieldDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.extendee != null && Object.hasOwnProperty.call(message, "extendee")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.extendee); + if (message.number != null && Object.hasOwnProperty.call(message, "number")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.number); + if (message.label != null && Object.hasOwnProperty.call(message, "label")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.label); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.type); + if (message.typeName != null && Object.hasOwnProperty.call(message, "typeName")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.typeName); + if (message.defaultValue != null && Object.hasOwnProperty.call(message, "defaultValue")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.defaultValue); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.FieldOptions.encode(message.options, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.oneofIndex != null && Object.hasOwnProperty.call(message, "oneofIndex")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.oneofIndex); + if (message.jsonName != null && Object.hasOwnProperty.call(message, "jsonName")) + writer.uint32(/* id 10, wireType 2 =*/82).string(message.jsonName); + if (message.proto3Optional != null && Object.hasOwnProperty.call(message, "proto3Optional")) + writer.uint32(/* id 17, wireType 0 =*/136).bool(message.proto3Optional); + return writer; + }; + + /** + * Encodes the specified FieldDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.FieldDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.IFieldDescriptorProto} message FieldDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldDescriptorProto.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 3: { + message.number = reader.int32(); + break; + } + case 4: { + message.label = reader.int32(); + break; + } + case 5: { + message.type = reader.int32(); + break; + } + case 6: { + message.typeName = reader.string(); + break; + } + case 2: { + message.extendee = reader.string(); + break; + } + case 7: { + message.defaultValue = reader.string(); + break; + } + case 9: { + message.oneofIndex = reader.int32(); + break; + } + case 10: { + message.jsonName = reader.string(); + break; + } + case 8: { + message.options = $root.google.protobuf.FieldOptions.decode(reader, reader.uint32()); + break; + } + case 17: { + message.proto3Optional = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FieldDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldDescriptorProto message. + * @function verify + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.number != null && message.hasOwnProperty("number")) + if (!$util.isInteger(message.number)) + return "number: integer expected"; + if (message.label != null && message.hasOwnProperty("label")) + switch (message.label) { + default: + return "label: enum value expected"; + case 1: + case 3: + case 2: + break; + } + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + break; + } + if (message.typeName != null && message.hasOwnProperty("typeName")) + if (!$util.isString(message.typeName)) + return "typeName: string expected"; + if (message.extendee != null && message.hasOwnProperty("extendee")) + if (!$util.isString(message.extendee)) + return "extendee: string expected"; + if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) + if (!$util.isString(message.defaultValue)) + return "defaultValue: string expected"; + if (message.oneofIndex != null && message.hasOwnProperty("oneofIndex")) + if (!$util.isInteger(message.oneofIndex)) + return "oneofIndex: integer expected"; + if (message.jsonName != null && message.hasOwnProperty("jsonName")) + if (!$util.isString(message.jsonName)) + return "jsonName: string expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.FieldOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.proto3Optional != null && message.hasOwnProperty("proto3Optional")) + if (typeof message.proto3Optional !== "boolean") + return "proto3Optional: boolean expected"; + return null; + }; + + /** + * Creates a FieldDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldDescriptorProto} FieldDescriptorProto + */ + FieldDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldDescriptorProto) + return object; + var message = new $root.google.protobuf.FieldDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.number != null) + message.number = object.number | 0; + switch (object.label) { + default: + if (typeof object.label === "number") { + message.label = object.label; + break; + } + break; + case "LABEL_OPTIONAL": + case 1: + message.label = 1; + break; + case "LABEL_REPEATED": + case 3: + message.label = 3; + break; + case "LABEL_REQUIRED": + case 2: + message.label = 2; + break; + } + switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + case "TYPE_DOUBLE": + case 1: + message.type = 1; + break; + case "TYPE_FLOAT": + case 2: + message.type = 2; + break; + case "TYPE_INT64": + case 3: + message.type = 3; + break; + case "TYPE_UINT64": + case 4: + message.type = 4; + break; + case "TYPE_INT32": + case 5: + message.type = 5; + break; + case "TYPE_FIXED64": + case 6: + message.type = 6; + break; + case "TYPE_FIXED32": + case 7: + message.type = 7; + break; + case "TYPE_BOOL": + case 8: + message.type = 8; + break; + case "TYPE_STRING": + case 9: + message.type = 9; + break; + case "TYPE_GROUP": + case 10: + message.type = 10; + break; + case "TYPE_MESSAGE": + case 11: + message.type = 11; + break; + case "TYPE_BYTES": + case 12: + message.type = 12; + break; + case "TYPE_UINT32": + case 13: + message.type = 13; + break; + case "TYPE_ENUM": + case 14: + message.type = 14; + break; + case "TYPE_SFIXED32": + case 15: + message.type = 15; + break; + case "TYPE_SFIXED64": + case 16: + message.type = 16; + break; + case "TYPE_SINT32": + case 17: + message.type = 17; + break; + case "TYPE_SINT64": + case 18: + message.type = 18; + break; + } + if (object.typeName != null) + message.typeName = String(object.typeName); + if (object.extendee != null) + message.extendee = String(object.extendee); + if (object.defaultValue != null) + message.defaultValue = String(object.defaultValue); + if (object.oneofIndex != null) + message.oneofIndex = object.oneofIndex | 0; + if (object.jsonName != null) + message.jsonName = String(object.jsonName); + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.FieldDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.FieldOptions.fromObject(object.options); + } + if (object.proto3Optional != null) + message.proto3Optional = Boolean(object.proto3Optional); + return message; + }; + + /** + * Creates a plain object from a FieldDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {google.protobuf.FieldDescriptorProto} message FieldDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.extendee = ""; + object.number = 0; + object.label = options.enums === String ? "LABEL_OPTIONAL" : 1; + object.type = options.enums === String ? "TYPE_DOUBLE" : 1; + object.typeName = ""; + object.defaultValue = ""; + object.options = null; + object.oneofIndex = 0; + object.jsonName = ""; + object.proto3Optional = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.extendee != null && message.hasOwnProperty("extendee")) + object.extendee = message.extendee; + if (message.number != null && message.hasOwnProperty("number")) + object.number = message.number; + if (message.label != null && message.hasOwnProperty("label")) + object.label = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Label[message.label] === undefined ? message.label : $root.google.protobuf.FieldDescriptorProto.Label[message.label] : message.label; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.protobuf.FieldDescriptorProto.Type[message.type] === undefined ? message.type : $root.google.protobuf.FieldDescriptorProto.Type[message.type] : message.type; + if (message.typeName != null && message.hasOwnProperty("typeName")) + object.typeName = message.typeName; + if (message.defaultValue != null && message.hasOwnProperty("defaultValue")) + object.defaultValue = message.defaultValue; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.FieldOptions.toObject(message.options, options); + if (message.oneofIndex != null && message.hasOwnProperty("oneofIndex")) + object.oneofIndex = message.oneofIndex; + if (message.jsonName != null && message.hasOwnProperty("jsonName")) + object.jsonName = message.jsonName; + if (message.proto3Optional != null && message.hasOwnProperty("proto3Optional")) + object.proto3Optional = message.proto3Optional; + return object; + }; + + /** + * Converts this FieldDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.FieldDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + FieldDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FieldDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.FieldDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FieldDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldDescriptorProto"; + }; + + /** + * Type enum. + * @name google.protobuf.FieldDescriptorProto.Type + * @enum {number} + * @property {number} TYPE_DOUBLE=1 TYPE_DOUBLE value + * @property {number} TYPE_FLOAT=2 TYPE_FLOAT value + * @property {number} TYPE_INT64=3 TYPE_INT64 value + * @property {number} TYPE_UINT64=4 TYPE_UINT64 value + * @property {number} TYPE_INT32=5 TYPE_INT32 value + * @property {number} TYPE_FIXED64=6 TYPE_FIXED64 value + * @property {number} TYPE_FIXED32=7 TYPE_FIXED32 value + * @property {number} TYPE_BOOL=8 TYPE_BOOL value + * @property {number} TYPE_STRING=9 TYPE_STRING value + * @property {number} TYPE_GROUP=10 TYPE_GROUP value + * @property {number} TYPE_MESSAGE=11 TYPE_MESSAGE value + * @property {number} TYPE_BYTES=12 TYPE_BYTES value + * @property {number} TYPE_UINT32=13 TYPE_UINT32 value + * @property {number} TYPE_ENUM=14 TYPE_ENUM value + * @property {number} TYPE_SFIXED32=15 TYPE_SFIXED32 value + * @property {number} TYPE_SFIXED64=16 TYPE_SFIXED64 value + * @property {number} TYPE_SINT32=17 TYPE_SINT32 value + * @property {number} TYPE_SINT64=18 TYPE_SINT64 value + */ + FieldDescriptorProto.Type = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "TYPE_DOUBLE"] = 1; + values[valuesById[2] = "TYPE_FLOAT"] = 2; + values[valuesById[3] = "TYPE_INT64"] = 3; + values[valuesById[4] = "TYPE_UINT64"] = 4; + values[valuesById[5] = "TYPE_INT32"] = 5; + values[valuesById[6] = "TYPE_FIXED64"] = 6; + values[valuesById[7] = "TYPE_FIXED32"] = 7; + values[valuesById[8] = "TYPE_BOOL"] = 8; + values[valuesById[9] = "TYPE_STRING"] = 9; + values[valuesById[10] = "TYPE_GROUP"] = 10; + values[valuesById[11] = "TYPE_MESSAGE"] = 11; + values[valuesById[12] = "TYPE_BYTES"] = 12; + values[valuesById[13] = "TYPE_UINT32"] = 13; + values[valuesById[14] = "TYPE_ENUM"] = 14; + values[valuesById[15] = "TYPE_SFIXED32"] = 15; + values[valuesById[16] = "TYPE_SFIXED64"] = 16; + values[valuesById[17] = "TYPE_SINT32"] = 17; + values[valuesById[18] = "TYPE_SINT64"] = 18; + return values; + })(); + + /** + * Label enum. + * @name google.protobuf.FieldDescriptorProto.Label + * @enum {number} + * @property {number} LABEL_OPTIONAL=1 LABEL_OPTIONAL value + * @property {number} LABEL_REPEATED=3 LABEL_REPEATED value + * @property {number} LABEL_REQUIRED=2 LABEL_REQUIRED value + */ + FieldDescriptorProto.Label = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "LABEL_OPTIONAL"] = 1; + values[valuesById[3] = "LABEL_REPEATED"] = 3; + values[valuesById[2] = "LABEL_REQUIRED"] = 2; + return values; + })(); + + return FieldDescriptorProto; + })(); + + protobuf.OneofDescriptorProto = (function() { + + /** + * Properties of an OneofDescriptorProto. + * @memberof google.protobuf + * @interface IOneofDescriptorProto + * @property {string|null} [name] OneofDescriptorProto name + * @property {google.protobuf.IOneofOptions|null} [options] OneofDescriptorProto options + */ + + /** + * Constructs a new OneofDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents an OneofDescriptorProto. + * @implements IOneofDescriptorProto + * @constructor + * @param {google.protobuf.IOneofDescriptorProto=} [properties] Properties to set + */ + function OneofDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OneofDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.OneofDescriptorProto + * @instance + */ + OneofDescriptorProto.prototype.name = ""; + + /** + * OneofDescriptorProto options. + * @member {google.protobuf.IOneofOptions|null|undefined} options + * @memberof google.protobuf.OneofDescriptorProto + * @instance + */ + OneofDescriptorProto.prototype.options = null; + + /** + * Creates a new OneofDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.IOneofDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto instance + */ + OneofDescriptorProto.create = function create(properties) { + return new OneofDescriptorProto(properties); + }; + + /** + * Encodes the specified OneofDescriptorProto message. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.IOneofDescriptorProto} message OneofDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.OneofOptions.encode(message.options, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OneofDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.OneofDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.IOneofDescriptorProto} message OneofDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofDescriptorProto.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.OneofDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.options = $root.google.protobuf.OneofOptions.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OneofDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OneofDescriptorProto message. + * @function verify + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OneofDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.OneofOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an OneofDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.OneofDescriptorProto} OneofDescriptorProto + */ + OneofDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.OneofDescriptorProto) + return object; + var message = new $root.google.protobuf.OneofDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.OneofDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.OneofOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from an OneofDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {google.protobuf.OneofDescriptorProto} message OneofDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OneofDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.OneofOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this OneofDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.OneofDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + OneofDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OneofDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.OneofDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OneofDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.OneofDescriptorProto"; + }; + + return OneofDescriptorProto; + })(); + + protobuf.EnumDescriptorProto = (function() { + + /** + * Properties of an EnumDescriptorProto. + * @memberof google.protobuf + * @interface IEnumDescriptorProto + * @property {string|null} [name] EnumDescriptorProto name + * @property {Array.|null} [value] EnumDescriptorProto value + * @property {google.protobuf.IEnumOptions|null} [options] EnumDescriptorProto options + * @property {Array.|null} [reservedRange] EnumDescriptorProto reservedRange + * @property {Array.|null} [reservedName] EnumDescriptorProto reservedName + */ + + /** + * Constructs a new EnumDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents an EnumDescriptorProto. + * @implements IEnumDescriptorProto + * @constructor + * @param {google.protobuf.IEnumDescriptorProto=} [properties] Properties to set + */ + function EnumDescriptorProto(properties) { + this.value = []; + this.reservedRange = []; + this.reservedName = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.name = ""; + + /** + * EnumDescriptorProto value. + * @member {Array.} value + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.value = $util.emptyArray; + + /** + * EnumDescriptorProto options. + * @member {google.protobuf.IEnumOptions|null|undefined} options + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.options = null; + + /** + * EnumDescriptorProto reservedRange. + * @member {Array.} reservedRange + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.reservedRange = $util.emptyArray; + + /** + * EnumDescriptorProto reservedName. + * @member {Array.} reservedName + * @memberof google.protobuf.EnumDescriptorProto + * @instance + */ + EnumDescriptorProto.prototype.reservedName = $util.emptyArray; + + /** + * Creates a new EnumDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.IEnumDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto instance + */ + EnumDescriptorProto.create = function create(properties) { + return new EnumDescriptorProto(properties); + }; + + /** + * Encodes the specified EnumDescriptorProto message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.IEnumDescriptorProto} message EnumDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.value != null && message.value.length) + for (var i = 0; i < message.value.length; ++i) + $root.google.protobuf.EnumValueDescriptorProto.encode(message.value[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.EnumOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.reservedRange != null && message.reservedRange.length) + for (var i = 0; i < message.reservedRange.length; ++i) + $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.encode(message.reservedRange[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.reservedName != null && message.reservedName.length) + for (var i = 0; i < message.reservedName.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.reservedName[i]); + return writer; + }; + + /** + * Encodes the specified EnumDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.IEnumDescriptorProto} message EnumDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumDescriptorProto.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.value && message.value.length)) + message.value = []; + message.value.push($root.google.protobuf.EnumValueDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 3: { + message.options = $root.google.protobuf.EnumOptions.decode(reader, reader.uint32()); + break; + } + case 4: { + if (!(message.reservedRange && message.reservedRange.length)) + message.reservedRange = []; + message.reservedRange.push($root.google.protobuf.EnumDescriptorProto.EnumReservedRange.decode(reader, reader.uint32())); + break; + } + case 5: { + if (!(message.reservedName && message.reservedName.length)) + message.reservedName = []; + message.reservedName.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumDescriptorProto message. + * @function verify + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.value != null && message.hasOwnProperty("value")) { + if (!Array.isArray(message.value)) + return "value: array expected"; + for (var i = 0; i < message.value.length; ++i) { + var error = $root.google.protobuf.EnumValueDescriptorProto.verify(message.value[i]); + if (error) + return "value." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.EnumOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.reservedRange != null && message.hasOwnProperty("reservedRange")) { + if (!Array.isArray(message.reservedRange)) + return "reservedRange: array expected"; + for (var i = 0; i < message.reservedRange.length; ++i) { + var error = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.verify(message.reservedRange[i]); + if (error) + return "reservedRange." + error; + } + } + if (message.reservedName != null && message.hasOwnProperty("reservedName")) { + if (!Array.isArray(message.reservedName)) + return "reservedName: array expected"; + for (var i = 0; i < message.reservedName.length; ++i) + if (!$util.isString(message.reservedName[i])) + return "reservedName: string[] expected"; + } + return null; + }; + + /** + * Creates an EnumDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumDescriptorProto} EnumDescriptorProto + */ + EnumDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumDescriptorProto) + return object; + var message = new $root.google.protobuf.EnumDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.value) { + if (!Array.isArray(object.value)) + throw TypeError(".google.protobuf.EnumDescriptorProto.value: array expected"); + message.value = []; + for (var i = 0; i < object.value.length; ++i) { + if (typeof object.value[i] !== "object") + throw TypeError(".google.protobuf.EnumDescriptorProto.value: object expected"); + message.value[i] = $root.google.protobuf.EnumValueDescriptorProto.fromObject(object.value[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.EnumDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.EnumOptions.fromObject(object.options); + } + if (object.reservedRange) { + if (!Array.isArray(object.reservedRange)) + throw TypeError(".google.protobuf.EnumDescriptorProto.reservedRange: array expected"); + message.reservedRange = []; + for (var i = 0; i < object.reservedRange.length; ++i) { + if (typeof object.reservedRange[i] !== "object") + throw TypeError(".google.protobuf.EnumDescriptorProto.reservedRange: object expected"); + message.reservedRange[i] = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.fromObject(object.reservedRange[i]); + } + } + if (object.reservedName) { + if (!Array.isArray(object.reservedName)) + throw TypeError(".google.protobuf.EnumDescriptorProto.reservedName: array expected"); + message.reservedName = []; + for (var i = 0; i < object.reservedName.length; ++i) + message.reservedName[i] = String(object.reservedName[i]); + } + return message; + }; + + /** + * Creates a plain object from an EnumDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {google.protobuf.EnumDescriptorProto} message EnumDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.value = []; + object.reservedRange = []; + object.reservedName = []; + } + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.value && message.value.length) { + object.value = []; + for (var j = 0; j < message.value.length; ++j) + object.value[j] = $root.google.protobuf.EnumValueDescriptorProto.toObject(message.value[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.EnumOptions.toObject(message.options, options); + if (message.reservedRange && message.reservedRange.length) { + object.reservedRange = []; + for (var j = 0; j < message.reservedRange.length; ++j) + object.reservedRange[j] = $root.google.protobuf.EnumDescriptorProto.EnumReservedRange.toObject(message.reservedRange[j], options); + } + if (message.reservedName && message.reservedName.length) { + object.reservedName = []; + for (var j = 0; j < message.reservedName.length; ++j) + object.reservedName[j] = message.reservedName[j]; + } + return object; + }; + + /** + * Converts this EnumDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.EnumDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + EnumDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EnumDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.EnumDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumDescriptorProto"; + }; + + EnumDescriptorProto.EnumReservedRange = (function() { + + /** + * Properties of an EnumReservedRange. + * @memberof google.protobuf.EnumDescriptorProto + * @interface IEnumReservedRange + * @property {number|null} [start] EnumReservedRange start + * @property {number|null} [end] EnumReservedRange end + */ + + /** + * Constructs a new EnumReservedRange. + * @memberof google.protobuf.EnumDescriptorProto + * @classdesc Represents an EnumReservedRange. + * @implements IEnumReservedRange + * @constructor + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange=} [properties] Properties to set + */ + function EnumReservedRange(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumReservedRange start. + * @member {number} start + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @instance + */ + EnumReservedRange.prototype.start = 0; + + /** + * EnumReservedRange end. + * @member {number} end + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @instance + */ + EnumReservedRange.prototype.end = 0; + + /** + * Creates a new EnumReservedRange instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange=} [properties] Properties to set + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange instance + */ + EnumReservedRange.create = function create(properties) { + return new EnumReservedRange(properties); + }; + + /** + * Encodes the specified EnumReservedRange message. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange} message EnumReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumReservedRange.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.start != null && Object.hasOwnProperty.call(message, "start")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.start); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.end); + return writer; + }; + + /** + * Encodes the specified EnumReservedRange message, length delimited. Does not implicitly {@link google.protobuf.EnumDescriptorProto.EnumReservedRange.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.IEnumReservedRange} message EnumReservedRange message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumReservedRange.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumReservedRange message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumReservedRange.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumDescriptorProto.EnumReservedRange(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.start = reader.int32(); + break; + } + case 2: { + message.end = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumReservedRange message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumReservedRange.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumReservedRange message. + * @function verify + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumReservedRange.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.start != null && message.hasOwnProperty("start")) + if (!$util.isInteger(message.start)) + return "start: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + return null; + }; + + /** + * Creates an EnumReservedRange message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumDescriptorProto.EnumReservedRange} EnumReservedRange + */ + EnumReservedRange.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumDescriptorProto.EnumReservedRange) + return object; + var message = new $root.google.protobuf.EnumDescriptorProto.EnumReservedRange(); + if (object.start != null) + message.start = object.start | 0; + if (object.end != null) + message.end = object.end | 0; + return message; + }; + + /** + * Creates a plain object from an EnumReservedRange message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {google.protobuf.EnumDescriptorProto.EnumReservedRange} message EnumReservedRange + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumReservedRange.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.start = 0; + object.end = 0; + } + if (message.start != null && message.hasOwnProperty("start")) + object.start = message.start; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + return object; + }; + + /** + * Converts this EnumReservedRange to JSON. + * @function toJSON + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @instance + * @returns {Object.} JSON object + */ + EnumReservedRange.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EnumReservedRange + * @function getTypeUrl + * @memberof google.protobuf.EnumDescriptorProto.EnumReservedRange + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumReservedRange.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumDescriptorProto.EnumReservedRange"; + }; + + return EnumReservedRange; + })(); + + return EnumDescriptorProto; + })(); + + protobuf.EnumValueDescriptorProto = (function() { + + /** + * Properties of an EnumValueDescriptorProto. + * @memberof google.protobuf + * @interface IEnumValueDescriptorProto + * @property {string|null} [name] EnumValueDescriptorProto name + * @property {number|null} [number] EnumValueDescriptorProto number + * @property {google.protobuf.IEnumValueOptions|null} [options] EnumValueDescriptorProto options + */ + + /** + * Constructs a new EnumValueDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents an EnumValueDescriptorProto. + * @implements IEnumValueDescriptorProto + * @constructor + * @param {google.protobuf.IEnumValueDescriptorProto=} [properties] Properties to set + */ + function EnumValueDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumValueDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.name = ""; + + /** + * EnumValueDescriptorProto number. + * @member {number} number + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.number = 0; + + /** + * EnumValueDescriptorProto options. + * @member {google.protobuf.IEnumValueOptions|null|undefined} options + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + */ + EnumValueDescriptorProto.prototype.options = null; + + /** + * Creates a new EnumValueDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.IEnumValueDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto instance + */ + EnumValueDescriptorProto.create = function create(properties) { + return new EnumValueDescriptorProto(properties); + }; + + /** + * Encodes the specified EnumValueDescriptorProto message. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.number != null && Object.hasOwnProperty.call(message, "number")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.number); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.EnumValueOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnumValueDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.EnumValueDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.IEnumValueDescriptorProto} message EnumValueDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueDescriptorProto.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumValueDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.number = reader.int32(); + break; + } + case 3: { + message.options = $root.google.protobuf.EnumValueOptions.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumValueDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumValueDescriptorProto message. + * @function verify + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumValueDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.number != null && message.hasOwnProperty("number")) + if (!$util.isInteger(message.number)) + return "number: integer expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.EnumValueOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates an EnumValueDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumValueDescriptorProto} EnumValueDescriptorProto + */ + EnumValueDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumValueDescriptorProto) + return object; + var message = new $root.google.protobuf.EnumValueDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.number != null) + message.number = object.number | 0; + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.EnumValueDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.EnumValueOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from an EnumValueDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {google.protobuf.EnumValueDescriptorProto} message EnumValueDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumValueDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.number = 0; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.number != null && message.hasOwnProperty("number")) + object.number = message.number; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.EnumValueOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this EnumValueDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.EnumValueDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + EnumValueDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EnumValueDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.EnumValueDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumValueDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumValueDescriptorProto"; + }; + + return EnumValueDescriptorProto; + })(); + + protobuf.ServiceDescriptorProto = (function() { + + /** + * Properties of a ServiceDescriptorProto. + * @memberof google.protobuf + * @interface IServiceDescriptorProto + * @property {string|null} [name] ServiceDescriptorProto name + * @property {Array.|null} [method] ServiceDescriptorProto method + * @property {google.protobuf.IServiceOptions|null} [options] ServiceDescriptorProto options + */ + + /** + * Constructs a new ServiceDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a ServiceDescriptorProto. + * @implements IServiceDescriptorProto + * @constructor + * @param {google.protobuf.IServiceDescriptorProto=} [properties] Properties to set + */ + function ServiceDescriptorProto(properties) { + this.method = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ServiceDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.name = ""; + + /** + * ServiceDescriptorProto method. + * @member {Array.} method + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.method = $util.emptyArray; + + /** + * ServiceDescriptorProto options. + * @member {google.protobuf.IServiceOptions|null|undefined} options + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + */ + ServiceDescriptorProto.prototype.options = null; + + /** + * Creates a new ServiceDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.IServiceDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto instance + */ + ServiceDescriptorProto.create = function create(properties) { + return new ServiceDescriptorProto(properties); + }; + + /** + * Encodes the specified ServiceDescriptorProto message. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.method != null && message.method.length) + for (var i = 0; i < message.method.length; ++i) + $root.google.protobuf.MethodDescriptorProto.encode(message.method[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.ServiceOptions.encode(message.options, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ServiceDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.ServiceDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.IServiceDescriptorProto} message ServiceDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceDescriptorProto.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ServiceDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + if (!(message.method && message.method.length)) + message.method = []; + message.method.push($root.google.protobuf.MethodDescriptorProto.decode(reader, reader.uint32())); + break; + } + case 3: { + message.options = $root.google.protobuf.ServiceOptions.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServiceDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServiceDescriptorProto message. + * @function verify + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServiceDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.method != null && message.hasOwnProperty("method")) { + if (!Array.isArray(message.method)) + return "method: array expected"; + for (var i = 0; i < message.method.length; ++i) { + var error = $root.google.protobuf.MethodDescriptorProto.verify(message.method[i]); + if (error) + return "method." + error; + } + } + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.ServiceOptions.verify(message.options); + if (error) + return "options." + error; + } + return null; + }; + + /** + * Creates a ServiceDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ServiceDescriptorProto} ServiceDescriptorProto + */ + ServiceDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ServiceDescriptorProto) + return object; + var message = new $root.google.protobuf.ServiceDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.method) { + if (!Array.isArray(object.method)) + throw TypeError(".google.protobuf.ServiceDescriptorProto.method: array expected"); + message.method = []; + for (var i = 0; i < object.method.length; ++i) { + if (typeof object.method[i] !== "object") + throw TypeError(".google.protobuf.ServiceDescriptorProto.method: object expected"); + message.method[i] = $root.google.protobuf.MethodDescriptorProto.fromObject(object.method[i]); + } + } + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.ServiceDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.ServiceOptions.fromObject(object.options); + } + return message; + }; + + /** + * Creates a plain object from a ServiceDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {google.protobuf.ServiceDescriptorProto} message ServiceDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServiceDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.method = []; + if (options.defaults) { + object.name = ""; + object.options = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.method && message.method.length) { + object.method = []; + for (var j = 0; j < message.method.length; ++j) + object.method[j] = $root.google.protobuf.MethodDescriptorProto.toObject(message.method[j], options); + } + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.ServiceOptions.toObject(message.options, options); + return object; + }; + + /** + * Converts this ServiceDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.ServiceDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + ServiceDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ServiceDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.ServiceDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ServiceDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.ServiceDescriptorProto"; + }; + + return ServiceDescriptorProto; + })(); + + protobuf.MethodDescriptorProto = (function() { + + /** + * Properties of a MethodDescriptorProto. + * @memberof google.protobuf + * @interface IMethodDescriptorProto + * @property {string|null} [name] MethodDescriptorProto name + * @property {string|null} [inputType] MethodDescriptorProto inputType + * @property {string|null} [outputType] MethodDescriptorProto outputType + * @property {google.protobuf.IMethodOptions|null} [options] MethodDescriptorProto options + * @property {boolean|null} [clientStreaming] MethodDescriptorProto clientStreaming + * @property {boolean|null} [serverStreaming] MethodDescriptorProto serverStreaming + */ + + /** + * Constructs a new MethodDescriptorProto. + * @memberof google.protobuf + * @classdesc Represents a MethodDescriptorProto. + * @implements IMethodDescriptorProto + * @constructor + * @param {google.protobuf.IMethodDescriptorProto=} [properties] Properties to set + */ + function MethodDescriptorProto(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MethodDescriptorProto name. + * @member {string} name + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.name = ""; + + /** + * MethodDescriptorProto inputType. + * @member {string} inputType + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.inputType = ""; + + /** + * MethodDescriptorProto outputType. + * @member {string} outputType + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.outputType = ""; + + /** + * MethodDescriptorProto options. + * @member {google.protobuf.IMethodOptions|null|undefined} options + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.options = null; + + /** + * MethodDescriptorProto clientStreaming. + * @member {boolean} clientStreaming + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.clientStreaming = false; + + /** + * MethodDescriptorProto serverStreaming. + * @member {boolean} serverStreaming + * @memberof google.protobuf.MethodDescriptorProto + * @instance + */ + MethodDescriptorProto.prototype.serverStreaming = false; + + /** + * Creates a new MethodDescriptorProto instance using the specified properties. + * @function create + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.IMethodDescriptorProto=} [properties] Properties to set + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto instance + */ + MethodDescriptorProto.create = function create(properties) { + return new MethodDescriptorProto(properties); + }; + + /** + * Encodes the specified MethodDescriptorProto message. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @function encode + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodDescriptorProto.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.inputType != null && Object.hasOwnProperty.call(message, "inputType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.inputType); + if (message.outputType != null && Object.hasOwnProperty.call(message, "outputType")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.outputType); + if (message.options != null && Object.hasOwnProperty.call(message, "options")) + $root.google.protobuf.MethodOptions.encode(message.options, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.clientStreaming != null && Object.hasOwnProperty.call(message, "clientStreaming")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.clientStreaming); + if (message.serverStreaming != null && Object.hasOwnProperty.call(message, "serverStreaming")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.serverStreaming); + return writer; + }; + + /** + * Encodes the specified MethodDescriptorProto message, length delimited. Does not implicitly {@link google.protobuf.MethodDescriptorProto.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.IMethodDescriptorProto} message MethodDescriptorProto message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodDescriptorProto.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodDescriptorProto.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MethodDescriptorProto(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.inputType = reader.string(); + break; + } + case 3: { + message.outputType = reader.string(); + break; + } + case 4: { + message.options = $root.google.protobuf.MethodOptions.decode(reader, reader.uint32()); + break; + } + case 5: { + message.clientStreaming = reader.bool(); + break; + } + case 6: { + message.serverStreaming = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MethodDescriptorProto message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodDescriptorProto.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MethodDescriptorProto message. + * @function verify + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MethodDescriptorProto.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.inputType != null && message.hasOwnProperty("inputType")) + if (!$util.isString(message.inputType)) + return "inputType: string expected"; + if (message.outputType != null && message.hasOwnProperty("outputType")) + if (!$util.isString(message.outputType)) + return "outputType: string expected"; + if (message.options != null && message.hasOwnProperty("options")) { + var error = $root.google.protobuf.MethodOptions.verify(message.options); + if (error) + return "options." + error; + } + if (message.clientStreaming != null && message.hasOwnProperty("clientStreaming")) + if (typeof message.clientStreaming !== "boolean") + return "clientStreaming: boolean expected"; + if (message.serverStreaming != null && message.hasOwnProperty("serverStreaming")) + if (typeof message.serverStreaming !== "boolean") + return "serverStreaming: boolean expected"; + return null; + }; + + /** + * Creates a MethodDescriptorProto message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.MethodDescriptorProto} MethodDescriptorProto + */ + MethodDescriptorProto.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.MethodDescriptorProto) + return object; + var message = new $root.google.protobuf.MethodDescriptorProto(); + if (object.name != null) + message.name = String(object.name); + if (object.inputType != null) + message.inputType = String(object.inputType); + if (object.outputType != null) + message.outputType = String(object.outputType); + if (object.options != null) { + if (typeof object.options !== "object") + throw TypeError(".google.protobuf.MethodDescriptorProto.options: object expected"); + message.options = $root.google.protobuf.MethodOptions.fromObject(object.options); + } + if (object.clientStreaming != null) + message.clientStreaming = Boolean(object.clientStreaming); + if (object.serverStreaming != null) + message.serverStreaming = Boolean(object.serverStreaming); + return message; + }; + + /** + * Creates a plain object from a MethodDescriptorProto message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {google.protobuf.MethodDescriptorProto} message MethodDescriptorProto + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MethodDescriptorProto.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.inputType = ""; + object.outputType = ""; + object.options = null; + object.clientStreaming = false; + object.serverStreaming = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.inputType != null && message.hasOwnProperty("inputType")) + object.inputType = message.inputType; + if (message.outputType != null && message.hasOwnProperty("outputType")) + object.outputType = message.outputType; + if (message.options != null && message.hasOwnProperty("options")) + object.options = $root.google.protobuf.MethodOptions.toObject(message.options, options); + if (message.clientStreaming != null && message.hasOwnProperty("clientStreaming")) + object.clientStreaming = message.clientStreaming; + if (message.serverStreaming != null && message.hasOwnProperty("serverStreaming")) + object.serverStreaming = message.serverStreaming; + return object; + }; + + /** + * Converts this MethodDescriptorProto to JSON. + * @function toJSON + * @memberof google.protobuf.MethodDescriptorProto + * @instance + * @returns {Object.} JSON object + */ + MethodDescriptorProto.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MethodDescriptorProto + * @function getTypeUrl + * @memberof google.protobuf.MethodDescriptorProto + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MethodDescriptorProto.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.MethodDescriptorProto"; + }; + + return MethodDescriptorProto; + })(); + + protobuf.FileOptions = (function() { + + /** + * Properties of a FileOptions. + * @memberof google.protobuf + * @interface IFileOptions + * @property {string|null} [javaPackage] FileOptions javaPackage + * @property {string|null} [javaOuterClassname] FileOptions javaOuterClassname + * @property {boolean|null} [javaMultipleFiles] FileOptions javaMultipleFiles + * @property {boolean|null} [javaGenerateEqualsAndHash] FileOptions javaGenerateEqualsAndHash + * @property {boolean|null} [javaStringCheckUtf8] FileOptions javaStringCheckUtf8 + * @property {google.protobuf.FileOptions.OptimizeMode|null} [optimizeFor] FileOptions optimizeFor + * @property {string|null} [goPackage] FileOptions goPackage + * @property {boolean|null} [ccGenericServices] FileOptions ccGenericServices + * @property {boolean|null} [javaGenericServices] FileOptions javaGenericServices + * @property {boolean|null} [pyGenericServices] FileOptions pyGenericServices + * @property {boolean|null} [deprecated] FileOptions deprecated + * @property {boolean|null} [ccEnableArenas] FileOptions ccEnableArenas + * @property {string|null} [objcClassPrefix] FileOptions objcClassPrefix + * @property {string|null} [csharpNamespace] FileOptions csharpNamespace + * @property {string|null} [swiftPrefix] FileOptions swiftPrefix + * @property {string|null} [phpClassPrefix] FileOptions phpClassPrefix + * @property {string|null} [phpNamespace] FileOptions phpNamespace + * @property {string|null} [phpMetadataNamespace] FileOptions phpMetadataNamespace + * @property {string|null} [rubyPackage] FileOptions rubyPackage + * @property {google.protobuf.IFeatureSet|null} [features] FileOptions features + * @property {Array.|null} [uninterpretedOption] FileOptions uninterpretedOption + * @property {Array.|null} [".google.api.resourceDefinition"] FileOptions .google.api.resourceDefinition + */ + + /** + * Constructs a new FileOptions. + * @memberof google.protobuf + * @classdesc Represents a FileOptions. + * @implements IFileOptions + * @constructor + * @param {google.protobuf.IFileOptions=} [properties] Properties to set + */ + function FileOptions(properties) { + this.uninterpretedOption = []; + this[".google.api.resourceDefinition"] = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FileOptions javaPackage. + * @member {string} javaPackage + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaPackage = ""; + + /** + * FileOptions javaOuterClassname. + * @member {string} javaOuterClassname + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaOuterClassname = ""; + + /** + * FileOptions javaMultipleFiles. + * @member {boolean} javaMultipleFiles + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaMultipleFiles = false; + + /** + * FileOptions javaGenerateEqualsAndHash. + * @member {boolean} javaGenerateEqualsAndHash + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaGenerateEqualsAndHash = false; + + /** + * FileOptions javaStringCheckUtf8. + * @member {boolean} javaStringCheckUtf8 + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaStringCheckUtf8 = false; + + /** + * FileOptions optimizeFor. + * @member {google.protobuf.FileOptions.OptimizeMode} optimizeFor + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.optimizeFor = 1; + + /** + * FileOptions goPackage. + * @member {string} goPackage + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.goPackage = ""; + + /** + * FileOptions ccGenericServices. + * @member {boolean} ccGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.ccGenericServices = false; + + /** + * FileOptions javaGenericServices. + * @member {boolean} javaGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.javaGenericServices = false; + + /** + * FileOptions pyGenericServices. + * @member {boolean} pyGenericServices + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.pyGenericServices = false; + + /** + * FileOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.deprecated = false; + + /** + * FileOptions ccEnableArenas. + * @member {boolean} ccEnableArenas + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.ccEnableArenas = true; + + /** + * FileOptions objcClassPrefix. + * @member {string} objcClassPrefix + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.objcClassPrefix = ""; + + /** + * FileOptions csharpNamespace. + * @member {string} csharpNamespace + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.csharpNamespace = ""; + + /** + * FileOptions swiftPrefix. + * @member {string} swiftPrefix + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.swiftPrefix = ""; + + /** + * FileOptions phpClassPrefix. + * @member {string} phpClassPrefix + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.phpClassPrefix = ""; + + /** + * FileOptions phpNamespace. + * @member {string} phpNamespace + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.phpNamespace = ""; + + /** + * FileOptions phpMetadataNamespace. + * @member {string} phpMetadataNamespace + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.phpMetadataNamespace = ""; + + /** + * FileOptions rubyPackage. + * @member {string} rubyPackage + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.rubyPackage = ""; + + /** + * FileOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.features = null; + + /** + * FileOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * FileOptions .google.api.resourceDefinition. + * @member {Array.} .google.api.resourceDefinition + * @memberof google.protobuf.FileOptions + * @instance + */ + FileOptions.prototype[".google.api.resourceDefinition"] = $util.emptyArray; + + /** + * Creates a new FileOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.IFileOptions=} [properties] Properties to set + * @returns {google.protobuf.FileOptions} FileOptions instance + */ + FileOptions.create = function create(properties) { + return new FileOptions(properties); + }; + + /** + * Encodes the specified FileOptions message. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.IFileOptions} message FileOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.javaPackage != null && Object.hasOwnProperty.call(message, "javaPackage")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.javaPackage); + if (message.javaOuterClassname != null && Object.hasOwnProperty.call(message, "javaOuterClassname")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.javaOuterClassname); + if (message.optimizeFor != null && Object.hasOwnProperty.call(message, "optimizeFor")) + writer.uint32(/* id 9, wireType 0 =*/72).int32(message.optimizeFor); + if (message.javaMultipleFiles != null && Object.hasOwnProperty.call(message, "javaMultipleFiles")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.javaMultipleFiles); + if (message.goPackage != null && Object.hasOwnProperty.call(message, "goPackage")) + writer.uint32(/* id 11, wireType 2 =*/90).string(message.goPackage); + if (message.ccGenericServices != null && Object.hasOwnProperty.call(message, "ccGenericServices")) + writer.uint32(/* id 16, wireType 0 =*/128).bool(message.ccGenericServices); + if (message.javaGenericServices != null && Object.hasOwnProperty.call(message, "javaGenericServices")) + writer.uint32(/* id 17, wireType 0 =*/136).bool(message.javaGenericServices); + if (message.pyGenericServices != null && Object.hasOwnProperty.call(message, "pyGenericServices")) + writer.uint32(/* id 18, wireType 0 =*/144).bool(message.pyGenericServices); + if (message.javaGenerateEqualsAndHash != null && Object.hasOwnProperty.call(message, "javaGenerateEqualsAndHash")) + writer.uint32(/* id 20, wireType 0 =*/160).bool(message.javaGenerateEqualsAndHash); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 23, wireType 0 =*/184).bool(message.deprecated); + if (message.javaStringCheckUtf8 != null && Object.hasOwnProperty.call(message, "javaStringCheckUtf8")) + writer.uint32(/* id 27, wireType 0 =*/216).bool(message.javaStringCheckUtf8); + if (message.ccEnableArenas != null && Object.hasOwnProperty.call(message, "ccEnableArenas")) + writer.uint32(/* id 31, wireType 0 =*/248).bool(message.ccEnableArenas); + if (message.objcClassPrefix != null && Object.hasOwnProperty.call(message, "objcClassPrefix")) + writer.uint32(/* id 36, wireType 2 =*/290).string(message.objcClassPrefix); + if (message.csharpNamespace != null && Object.hasOwnProperty.call(message, "csharpNamespace")) + writer.uint32(/* id 37, wireType 2 =*/298).string(message.csharpNamespace); + if (message.swiftPrefix != null && Object.hasOwnProperty.call(message, "swiftPrefix")) + writer.uint32(/* id 39, wireType 2 =*/314).string(message.swiftPrefix); + if (message.phpClassPrefix != null && Object.hasOwnProperty.call(message, "phpClassPrefix")) + writer.uint32(/* id 40, wireType 2 =*/322).string(message.phpClassPrefix); + if (message.phpNamespace != null && Object.hasOwnProperty.call(message, "phpNamespace")) + writer.uint32(/* id 41, wireType 2 =*/330).string(message.phpNamespace); + if (message.phpMetadataNamespace != null && Object.hasOwnProperty.call(message, "phpMetadataNamespace")) + writer.uint32(/* id 44, wireType 2 =*/354).string(message.phpMetadataNamespace); + if (message.rubyPackage != null && Object.hasOwnProperty.call(message, "rubyPackage")) + writer.uint32(/* id 45, wireType 2 =*/362).string(message.rubyPackage); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 50, wireType 2 =*/402).fork()).ldelim(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.resourceDefinition"] != null && message[".google.api.resourceDefinition"].length) + for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i) + $root.google.api.ResourceDescriptor.encode(message[".google.api.resourceDefinition"][i], writer.uint32(/* id 1053, wireType 2 =*/8426).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FileOptions message, length delimited. Does not implicitly {@link google.protobuf.FileOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.IFileOptions} message FileOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FileOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FileOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FileOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FileOptions} FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FileOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.javaPackage = reader.string(); + break; + } + case 8: { + message.javaOuterClassname = reader.string(); + break; + } + case 10: { + message.javaMultipleFiles = reader.bool(); + break; + } + case 20: { + message.javaGenerateEqualsAndHash = reader.bool(); + break; + } + case 27: { + message.javaStringCheckUtf8 = reader.bool(); + break; + } + case 9: { + message.optimizeFor = reader.int32(); + break; + } + case 11: { + message.goPackage = reader.string(); + break; + } + case 16: { + message.ccGenericServices = reader.bool(); + break; + } + case 17: { + message.javaGenericServices = reader.bool(); + break; + } + case 18: { + message.pyGenericServices = reader.bool(); + break; + } + case 23: { + message.deprecated = reader.bool(); + break; + } + case 31: { + message.ccEnableArenas = reader.bool(); + break; + } + case 36: { + message.objcClassPrefix = reader.string(); + break; + } + case 37: { + message.csharpNamespace = reader.string(); + break; + } + case 39: { + message.swiftPrefix = reader.string(); + break; + } + case 40: { + message.phpClassPrefix = reader.string(); + break; + } + case 41: { + message.phpNamespace = reader.string(); + break; + } + case 44: { + message.phpMetadataNamespace = reader.string(); + break; + } + case 45: { + message.rubyPackage = reader.string(); + break; + } + case 50: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 1053: { + if (!(message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length)) + message[".google.api.resourceDefinition"] = []; + message[".google.api.resourceDefinition"].push($root.google.api.ResourceDescriptor.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FileOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FileOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FileOptions} FileOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FileOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FileOptions message. + * @function verify + * @memberof google.protobuf.FileOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FileOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.javaPackage != null && message.hasOwnProperty("javaPackage")) + if (!$util.isString(message.javaPackage)) + return "javaPackage: string expected"; + if (message.javaOuterClassname != null && message.hasOwnProperty("javaOuterClassname")) + if (!$util.isString(message.javaOuterClassname)) + return "javaOuterClassname: string expected"; + if (message.javaMultipleFiles != null && message.hasOwnProperty("javaMultipleFiles")) + if (typeof message.javaMultipleFiles !== "boolean") + return "javaMultipleFiles: boolean expected"; + if (message.javaGenerateEqualsAndHash != null && message.hasOwnProperty("javaGenerateEqualsAndHash")) + if (typeof message.javaGenerateEqualsAndHash !== "boolean") + return "javaGenerateEqualsAndHash: boolean expected"; + if (message.javaStringCheckUtf8 != null && message.hasOwnProperty("javaStringCheckUtf8")) + if (typeof message.javaStringCheckUtf8 !== "boolean") + return "javaStringCheckUtf8: boolean expected"; + if (message.optimizeFor != null && message.hasOwnProperty("optimizeFor")) + switch (message.optimizeFor) { + default: + return "optimizeFor: enum value expected"; + case 1: + case 2: + case 3: + break; + } + if (message.goPackage != null && message.hasOwnProperty("goPackage")) + if (!$util.isString(message.goPackage)) + return "goPackage: string expected"; + if (message.ccGenericServices != null && message.hasOwnProperty("ccGenericServices")) + if (typeof message.ccGenericServices !== "boolean") + return "ccGenericServices: boolean expected"; + if (message.javaGenericServices != null && message.hasOwnProperty("javaGenericServices")) + if (typeof message.javaGenericServices !== "boolean") + return "javaGenericServices: boolean expected"; + if (message.pyGenericServices != null && message.hasOwnProperty("pyGenericServices")) + if (typeof message.pyGenericServices !== "boolean") + return "pyGenericServices: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.ccEnableArenas != null && message.hasOwnProperty("ccEnableArenas")) + if (typeof message.ccEnableArenas !== "boolean") + return "ccEnableArenas: boolean expected"; + if (message.objcClassPrefix != null && message.hasOwnProperty("objcClassPrefix")) + if (!$util.isString(message.objcClassPrefix)) + return "objcClassPrefix: string expected"; + if (message.csharpNamespace != null && message.hasOwnProperty("csharpNamespace")) + if (!$util.isString(message.csharpNamespace)) + return "csharpNamespace: string expected"; + if (message.swiftPrefix != null && message.hasOwnProperty("swiftPrefix")) + if (!$util.isString(message.swiftPrefix)) + return "swiftPrefix: string expected"; + if (message.phpClassPrefix != null && message.hasOwnProperty("phpClassPrefix")) + if (!$util.isString(message.phpClassPrefix)) + return "phpClassPrefix: string expected"; + if (message.phpNamespace != null && message.hasOwnProperty("phpNamespace")) + if (!$util.isString(message.phpNamespace)) + return "phpNamespace: string expected"; + if (message.phpMetadataNamespace != null && message.hasOwnProperty("phpMetadataNamespace")) + if (!$util.isString(message.phpMetadataNamespace)) + return "phpMetadataNamespace: string expected"; + if (message.rubyPackage != null && message.hasOwnProperty("rubyPackage")) + if (!$util.isString(message.rubyPackage)) + return "rubyPackage: string expected"; + if (message.features != null && message.hasOwnProperty("features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (error) + return "features." + error; + } + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.resourceDefinition"] != null && message.hasOwnProperty(".google.api.resourceDefinition")) { + if (!Array.isArray(message[".google.api.resourceDefinition"])) + return ".google.api.resourceDefinition: array expected"; + for (var i = 0; i < message[".google.api.resourceDefinition"].length; ++i) { + var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resourceDefinition"][i]); + if (error) + return ".google.api.resourceDefinition." + error; + } + } + return null; + }; + + /** + * Creates a FileOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FileOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FileOptions} FileOptions + */ + FileOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FileOptions) + return object; + var message = new $root.google.protobuf.FileOptions(); + if (object.javaPackage != null) + message.javaPackage = String(object.javaPackage); + if (object.javaOuterClassname != null) + message.javaOuterClassname = String(object.javaOuterClassname); + if (object.javaMultipleFiles != null) + message.javaMultipleFiles = Boolean(object.javaMultipleFiles); + if (object.javaGenerateEqualsAndHash != null) + message.javaGenerateEqualsAndHash = Boolean(object.javaGenerateEqualsAndHash); + if (object.javaStringCheckUtf8 != null) + message.javaStringCheckUtf8 = Boolean(object.javaStringCheckUtf8); + switch (object.optimizeFor) { + default: + if (typeof object.optimizeFor === "number") { + message.optimizeFor = object.optimizeFor; + break; + } + break; + case "SPEED": + case 1: + message.optimizeFor = 1; + break; + case "CODE_SIZE": + case 2: + message.optimizeFor = 2; + break; + case "LITE_RUNTIME": + case 3: + message.optimizeFor = 3; + break; + } + if (object.goPackage != null) + message.goPackage = String(object.goPackage); + if (object.ccGenericServices != null) + message.ccGenericServices = Boolean(object.ccGenericServices); + if (object.javaGenericServices != null) + message.javaGenericServices = Boolean(object.javaGenericServices); + if (object.pyGenericServices != null) + message.pyGenericServices = Boolean(object.pyGenericServices); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.ccEnableArenas != null) + message.ccEnableArenas = Boolean(object.ccEnableArenas); + if (object.objcClassPrefix != null) + message.objcClassPrefix = String(object.objcClassPrefix); + if (object.csharpNamespace != null) + message.csharpNamespace = String(object.csharpNamespace); + if (object.swiftPrefix != null) + message.swiftPrefix = String(object.swiftPrefix); + if (object.phpClassPrefix != null) + message.phpClassPrefix = String(object.phpClassPrefix); + if (object.phpNamespace != null) + message.phpNamespace = String(object.phpNamespace); + if (object.phpMetadataNamespace != null) + message.phpMetadataNamespace = String(object.phpMetadataNamespace); + if (object.rubyPackage != null) + message.rubyPackage = String(object.rubyPackage); + if (object.features != null) { + if (typeof object.features !== "object") + throw TypeError(".google.protobuf.FileOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + } + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.FileOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.FileOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.resourceDefinition"]) { + if (!Array.isArray(object[".google.api.resourceDefinition"])) + throw TypeError(".google.protobuf.FileOptions..google.api.resourceDefinition: array expected"); + message[".google.api.resourceDefinition"] = []; + for (var i = 0; i < object[".google.api.resourceDefinition"].length; ++i) { + if (typeof object[".google.api.resourceDefinition"][i] !== "object") + throw TypeError(".google.protobuf.FileOptions..google.api.resourceDefinition: object expected"); + message[".google.api.resourceDefinition"][i] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resourceDefinition"][i]); + } + } + return message; + }; + + /** + * Creates a plain object from a FileOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FileOptions + * @static + * @param {google.protobuf.FileOptions} message FileOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FileOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.uninterpretedOption = []; + object[".google.api.resourceDefinition"] = []; + } + if (options.defaults) { + object.javaPackage = ""; + object.javaOuterClassname = ""; + object.optimizeFor = options.enums === String ? "SPEED" : 1; + object.javaMultipleFiles = false; + object.goPackage = ""; + object.ccGenericServices = false; + object.javaGenericServices = false; + object.pyGenericServices = false; + object.javaGenerateEqualsAndHash = false; + object.deprecated = false; + object.javaStringCheckUtf8 = false; + object.ccEnableArenas = true; + object.objcClassPrefix = ""; + object.csharpNamespace = ""; + object.swiftPrefix = ""; + object.phpClassPrefix = ""; + object.phpNamespace = ""; + object.phpMetadataNamespace = ""; + object.rubyPackage = ""; + object.features = null; + } + if (message.javaPackage != null && message.hasOwnProperty("javaPackage")) + object.javaPackage = message.javaPackage; + if (message.javaOuterClassname != null && message.hasOwnProperty("javaOuterClassname")) + object.javaOuterClassname = message.javaOuterClassname; + if (message.optimizeFor != null && message.hasOwnProperty("optimizeFor")) + object.optimizeFor = options.enums === String ? $root.google.protobuf.FileOptions.OptimizeMode[message.optimizeFor] === undefined ? message.optimizeFor : $root.google.protobuf.FileOptions.OptimizeMode[message.optimizeFor] : message.optimizeFor; + if (message.javaMultipleFiles != null && message.hasOwnProperty("javaMultipleFiles")) + object.javaMultipleFiles = message.javaMultipleFiles; + if (message.goPackage != null && message.hasOwnProperty("goPackage")) + object.goPackage = message.goPackage; + if (message.ccGenericServices != null && message.hasOwnProperty("ccGenericServices")) + object.ccGenericServices = message.ccGenericServices; + if (message.javaGenericServices != null && message.hasOwnProperty("javaGenericServices")) + object.javaGenericServices = message.javaGenericServices; + if (message.pyGenericServices != null && message.hasOwnProperty("pyGenericServices")) + object.pyGenericServices = message.pyGenericServices; + if (message.javaGenerateEqualsAndHash != null && message.hasOwnProperty("javaGenerateEqualsAndHash")) + object.javaGenerateEqualsAndHash = message.javaGenerateEqualsAndHash; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.javaStringCheckUtf8 != null && message.hasOwnProperty("javaStringCheckUtf8")) + object.javaStringCheckUtf8 = message.javaStringCheckUtf8; + if (message.ccEnableArenas != null && message.hasOwnProperty("ccEnableArenas")) + object.ccEnableArenas = message.ccEnableArenas; + if (message.objcClassPrefix != null && message.hasOwnProperty("objcClassPrefix")) + object.objcClassPrefix = message.objcClassPrefix; + if (message.csharpNamespace != null && message.hasOwnProperty("csharpNamespace")) + object.csharpNamespace = message.csharpNamespace; + if (message.swiftPrefix != null && message.hasOwnProperty("swiftPrefix")) + object.swiftPrefix = message.swiftPrefix; + if (message.phpClassPrefix != null && message.hasOwnProperty("phpClassPrefix")) + object.phpClassPrefix = message.phpClassPrefix; + if (message.phpNamespace != null && message.hasOwnProperty("phpNamespace")) + object.phpNamespace = message.phpNamespace; + if (message.phpMetadataNamespace != null && message.hasOwnProperty("phpMetadataNamespace")) + object.phpMetadataNamespace = message.phpMetadataNamespace; + if (message.rubyPackage != null && message.hasOwnProperty("rubyPackage")) + object.rubyPackage = message.rubyPackage; + if (message.features != null && message.hasOwnProperty("features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.resourceDefinition"] && message[".google.api.resourceDefinition"].length) { + object[".google.api.resourceDefinition"] = []; + for (var j = 0; j < message[".google.api.resourceDefinition"].length; ++j) + object[".google.api.resourceDefinition"][j] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resourceDefinition"][j], options); + } + return object; + }; + + /** + * Converts this FileOptions to JSON. + * @function toJSON + * @memberof google.protobuf.FileOptions + * @instance + * @returns {Object.} JSON object + */ + FileOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FileOptions + * @function getTypeUrl + * @memberof google.protobuf.FileOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FileOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FileOptions"; + }; + + /** + * OptimizeMode enum. + * @name google.protobuf.FileOptions.OptimizeMode + * @enum {number} + * @property {number} SPEED=1 SPEED value + * @property {number} CODE_SIZE=2 CODE_SIZE value + * @property {number} LITE_RUNTIME=3 LITE_RUNTIME value + */ + FileOptions.OptimizeMode = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[1] = "SPEED"] = 1; + values[valuesById[2] = "CODE_SIZE"] = 2; + values[valuesById[3] = "LITE_RUNTIME"] = 3; + return values; + })(); + + return FileOptions; + })(); + + protobuf.MessageOptions = (function() { + + /** + * Properties of a MessageOptions. + * @memberof google.protobuf + * @interface IMessageOptions + * @property {boolean|null} [messageSetWireFormat] MessageOptions messageSetWireFormat + * @property {boolean|null} [noStandardDescriptorAccessor] MessageOptions noStandardDescriptorAccessor + * @property {boolean|null} [deprecated] MessageOptions deprecated + * @property {boolean|null} [mapEntry] MessageOptions mapEntry + * @property {boolean|null} [deprecatedLegacyJsonFieldConflicts] MessageOptions deprecatedLegacyJsonFieldConflicts + * @property {google.protobuf.IFeatureSet|null} [features] MessageOptions features + * @property {Array.|null} [uninterpretedOption] MessageOptions uninterpretedOption + * @property {google.api.IResourceDescriptor|null} [".google.api.resource"] MessageOptions .google.api.resource + */ + + /** + * Constructs a new MessageOptions. + * @memberof google.protobuf + * @classdesc Represents a MessageOptions. + * @implements IMessageOptions + * @constructor + * @param {google.protobuf.IMessageOptions=} [properties] Properties to set + */ + function MessageOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MessageOptions messageSetWireFormat. + * @member {boolean} messageSetWireFormat + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.messageSetWireFormat = false; + + /** + * MessageOptions noStandardDescriptorAccessor. + * @member {boolean} noStandardDescriptorAccessor + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.noStandardDescriptorAccessor = false; + + /** + * MessageOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.deprecated = false; + + /** + * MessageOptions mapEntry. + * @member {boolean} mapEntry + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.mapEntry = false; + + /** + * MessageOptions deprecatedLegacyJsonFieldConflicts. + * @member {boolean} deprecatedLegacyJsonFieldConflicts + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.deprecatedLegacyJsonFieldConflicts = false; + + /** + * MessageOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.features = null; + + /** + * MessageOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * MessageOptions .google.api.resource. + * @member {google.api.IResourceDescriptor|null|undefined} .google.api.resource + * @memberof google.protobuf.MessageOptions + * @instance + */ + MessageOptions.prototype[".google.api.resource"] = null; + + /** + * Creates a new MessageOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.IMessageOptions=} [properties] Properties to set + * @returns {google.protobuf.MessageOptions} MessageOptions instance + */ + MessageOptions.create = function create(properties) { + return new MessageOptions(properties); + }; + + /** + * Encodes the specified MessageOptions message. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.IMessageOptions} message MessageOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.messageSetWireFormat != null && Object.hasOwnProperty.call(message, "messageSetWireFormat")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.messageSetWireFormat); + if (message.noStandardDescriptorAccessor != null && Object.hasOwnProperty.call(message, "noStandardDescriptorAccessor")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.noStandardDescriptorAccessor); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.mapEntry != null && Object.hasOwnProperty.call(message, "mapEntry")) + writer.uint32(/* id 7, wireType 0 =*/56).bool(message.mapEntry); + if (message.deprecatedLegacyJsonFieldConflicts != null && Object.hasOwnProperty.call(message, "deprecatedLegacyJsonFieldConflicts")) + writer.uint32(/* id 11, wireType 0 =*/88).bool(message.deprecatedLegacyJsonFieldConflicts); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.resource"] != null && Object.hasOwnProperty.call(message, ".google.api.resource")) + $root.google.api.ResourceDescriptor.encode(message[".google.api.resource"], writer.uint32(/* id 1053, wireType 2 =*/8426).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MessageOptions message, length delimited. Does not implicitly {@link google.protobuf.MessageOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.IMessageOptions} message MessageOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MessageOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MessageOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.MessageOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.MessageOptions} MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MessageOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.messageSetWireFormat = reader.bool(); + break; + } + case 2: { + message.noStandardDescriptorAccessor = reader.bool(); + break; + } + case 3: { + message.deprecated = reader.bool(); + break; + } + case 7: { + message.mapEntry = reader.bool(); + break; + } + case 11: { + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + break; + } + case 12: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 1053: { + message[".google.api.resource"] = $root.google.api.ResourceDescriptor.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MessageOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.MessageOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.MessageOptions} MessageOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MessageOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MessageOptions message. + * @function verify + * @memberof google.protobuf.MessageOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MessageOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.messageSetWireFormat != null && message.hasOwnProperty("messageSetWireFormat")) + if (typeof message.messageSetWireFormat !== "boolean") + return "messageSetWireFormat: boolean expected"; + if (message.noStandardDescriptorAccessor != null && message.hasOwnProperty("noStandardDescriptorAccessor")) + if (typeof message.noStandardDescriptorAccessor !== "boolean") + return "noStandardDescriptorAccessor: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.mapEntry != null && message.hasOwnProperty("mapEntry")) + if (typeof message.mapEntry !== "boolean") + return "mapEntry: boolean expected"; + if (message.deprecatedLegacyJsonFieldConflicts != null && message.hasOwnProperty("deprecatedLegacyJsonFieldConflicts")) + if (typeof message.deprecatedLegacyJsonFieldConflicts !== "boolean") + return "deprecatedLegacyJsonFieldConflicts: boolean expected"; + if (message.features != null && message.hasOwnProperty("features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (error) + return "features." + error; + } + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.resource"] != null && message.hasOwnProperty(".google.api.resource")) { + var error = $root.google.api.ResourceDescriptor.verify(message[".google.api.resource"]); + if (error) + return ".google.api.resource." + error; + } + return null; + }; + + /** + * Creates a MessageOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.MessageOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.MessageOptions} MessageOptions + */ + MessageOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.MessageOptions) + return object; + var message = new $root.google.protobuf.MessageOptions(); + if (object.messageSetWireFormat != null) + message.messageSetWireFormat = Boolean(object.messageSetWireFormat); + if (object.noStandardDescriptorAccessor != null) + message.noStandardDescriptorAccessor = Boolean(object.noStandardDescriptorAccessor); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.mapEntry != null) + message.mapEntry = Boolean(object.mapEntry); + if (object.deprecatedLegacyJsonFieldConflicts != null) + message.deprecatedLegacyJsonFieldConflicts = Boolean(object.deprecatedLegacyJsonFieldConflicts); + if (object.features != null) { + if (typeof object.features !== "object") + throw TypeError(".google.protobuf.MessageOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + } + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.MessageOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.MessageOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.resource"] != null) { + if (typeof object[".google.api.resource"] !== "object") + throw TypeError(".google.protobuf.MessageOptions..google.api.resource: object expected"); + message[".google.api.resource"] = $root.google.api.ResourceDescriptor.fromObject(object[".google.api.resource"]); + } + return message; + }; + + /** + * Creates a plain object from a MessageOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.MessageOptions + * @static + * @param {google.protobuf.MessageOptions} message MessageOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MessageOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) { + object.messageSetWireFormat = false; + object.noStandardDescriptorAccessor = false; + object.deprecated = false; + object.mapEntry = false; + object.deprecatedLegacyJsonFieldConflicts = false; + object.features = null; + object[".google.api.resource"] = null; + } + if (message.messageSetWireFormat != null && message.hasOwnProperty("messageSetWireFormat")) + object.messageSetWireFormat = message.messageSetWireFormat; + if (message.noStandardDescriptorAccessor != null && message.hasOwnProperty("noStandardDescriptorAccessor")) + object.noStandardDescriptorAccessor = message.noStandardDescriptorAccessor; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.mapEntry != null && message.hasOwnProperty("mapEntry")) + object.mapEntry = message.mapEntry; + if (message.deprecatedLegacyJsonFieldConflicts != null && message.hasOwnProperty("deprecatedLegacyJsonFieldConflicts")) + object.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + if (message.features != null && message.hasOwnProperty("features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.resource"] != null && message.hasOwnProperty(".google.api.resource")) + object[".google.api.resource"] = $root.google.api.ResourceDescriptor.toObject(message[".google.api.resource"], options); + return object; + }; + + /** + * Converts this MessageOptions to JSON. + * @function toJSON + * @memberof google.protobuf.MessageOptions + * @instance + * @returns {Object.} JSON object + */ + MessageOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MessageOptions + * @function getTypeUrl + * @memberof google.protobuf.MessageOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MessageOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.MessageOptions"; + }; + + return MessageOptions; + })(); + + protobuf.FieldOptions = (function() { + + /** + * Properties of a FieldOptions. + * @memberof google.protobuf + * @interface IFieldOptions + * @property {google.protobuf.FieldOptions.CType|null} [ctype] FieldOptions ctype + * @property {boolean|null} [packed] FieldOptions packed + * @property {google.protobuf.FieldOptions.JSType|null} [jstype] FieldOptions jstype + * @property {boolean|null} [lazy] FieldOptions lazy + * @property {boolean|null} [unverifiedLazy] FieldOptions unverifiedLazy + * @property {boolean|null} [deprecated] FieldOptions deprecated + * @property {boolean|null} [weak] FieldOptions weak + * @property {boolean|null} [debugRedact] FieldOptions debugRedact + * @property {google.protobuf.FieldOptions.OptionRetention|null} [retention] FieldOptions retention + * @property {Array.|null} [targets] FieldOptions targets + * @property {Array.|null} [editionDefaults] FieldOptions editionDefaults + * @property {google.protobuf.IFeatureSet|null} [features] FieldOptions features + * @property {Array.|null} [uninterpretedOption] FieldOptions uninterpretedOption + * @property {Array.|null} [".google.api.fieldBehavior"] FieldOptions .google.api.fieldBehavior + * @property {google.api.IResourceReference|null} [".google.api.resourceReference"] FieldOptions .google.api.resourceReference + */ + + /** + * Constructs a new FieldOptions. + * @memberof google.protobuf + * @classdesc Represents a FieldOptions. + * @implements IFieldOptions + * @constructor + * @param {google.protobuf.IFieldOptions=} [properties] Properties to set + */ + function FieldOptions(properties) { + this.targets = []; + this.editionDefaults = []; + this.uninterpretedOption = []; + this[".google.api.fieldBehavior"] = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldOptions ctype. + * @member {google.protobuf.FieldOptions.CType} ctype + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.ctype = 0; + + /** + * FieldOptions packed. + * @member {boolean} packed + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.packed = false; + + /** + * FieldOptions jstype. + * @member {google.protobuf.FieldOptions.JSType} jstype + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.jstype = 0; + + /** + * FieldOptions lazy. + * @member {boolean} lazy + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.lazy = false; + + /** + * FieldOptions unverifiedLazy. + * @member {boolean} unverifiedLazy + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.unverifiedLazy = false; + + /** + * FieldOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.deprecated = false; + + /** + * FieldOptions weak. + * @member {boolean} weak + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.weak = false; + + /** + * FieldOptions debugRedact. + * @member {boolean} debugRedact + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.debugRedact = false; + + /** + * FieldOptions retention. + * @member {google.protobuf.FieldOptions.OptionRetention} retention + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.retention = 0; + + /** + * FieldOptions targets. + * @member {Array.} targets + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.targets = $util.emptyArray; + + /** + * FieldOptions editionDefaults. + * @member {Array.} editionDefaults + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.editionDefaults = $util.emptyArray; + + /** + * FieldOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.features = null; + + /** + * FieldOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * FieldOptions .google.api.fieldBehavior. + * @member {Array.} .google.api.fieldBehavior + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".google.api.fieldBehavior"] = $util.emptyArray; + + /** + * FieldOptions .google.api.resourceReference. + * @member {google.api.IResourceReference|null|undefined} .google.api.resourceReference + * @memberof google.protobuf.FieldOptions + * @instance + */ + FieldOptions.prototype[".google.api.resourceReference"] = null; + + /** + * Creates a new FieldOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.IFieldOptions=} [properties] Properties to set + * @returns {google.protobuf.FieldOptions} FieldOptions instance + */ + FieldOptions.create = function create(properties) { + return new FieldOptions(properties); + }; + + /** + * Encodes the specified FieldOptions message. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.ctype != null && Object.hasOwnProperty.call(message, "ctype")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.ctype); + if (message.packed != null && Object.hasOwnProperty.call(message, "packed")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.packed); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.lazy != null && Object.hasOwnProperty.call(message, "lazy")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.lazy); + if (message.jstype != null && Object.hasOwnProperty.call(message, "jstype")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jstype); + if (message.weak != null && Object.hasOwnProperty.call(message, "weak")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.weak); + if (message.unverifiedLazy != null && Object.hasOwnProperty.call(message, "unverifiedLazy")) + writer.uint32(/* id 15, wireType 0 =*/120).bool(message.unverifiedLazy); + if (message.debugRedact != null && Object.hasOwnProperty.call(message, "debugRedact")) + writer.uint32(/* id 16, wireType 0 =*/128).bool(message.debugRedact); + if (message.retention != null && Object.hasOwnProperty.call(message, "retention")) + writer.uint32(/* id 17, wireType 0 =*/136).int32(message.retention); + if (message.targets != null && message.targets.length) + for (var i = 0; i < message.targets.length; ++i) + writer.uint32(/* id 19, wireType 0 =*/152).int32(message.targets[i]); + if (message.editionDefaults != null && message.editionDefaults.length) + for (var i = 0; i < message.editionDefaults.length; ++i) + $root.google.protobuf.FieldOptions.EditionDefault.encode(message.editionDefaults[i], writer.uint32(/* id 20, wireType 2 =*/162).fork()).ldelim(); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.fieldBehavior"] != null && message[".google.api.fieldBehavior"].length) + for (var i = 0; i < message[".google.api.fieldBehavior"].length; ++i) + writer.uint32(/* id 1052, wireType 0 =*/8416).int32(message[".google.api.fieldBehavior"][i]); + if (message[".google.api.resourceReference"] != null && Object.hasOwnProperty.call(message, ".google.api.resourceReference")) + $root.google.api.ResourceReference.encode(message[".google.api.resourceReference"], writer.uint32(/* id 1055, wireType 2 =*/8442).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified FieldOptions message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.IFieldOptions} message FieldOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldOptions} FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.ctype = reader.int32(); + break; + } + case 2: { + message.packed = reader.bool(); + break; + } + case 6: { + message.jstype = reader.int32(); + break; + } + case 5: { + message.lazy = reader.bool(); + break; + } + case 15: { + message.unverifiedLazy = reader.bool(); + break; + } + case 3: { + message.deprecated = reader.bool(); + break; + } + case 10: { + message.weak = reader.bool(); + break; + } + case 16: { + message.debugRedact = reader.bool(); + break; + } + case 17: { + message.retention = reader.int32(); + break; + } + case 19: { + if (!(message.targets && message.targets.length)) + message.targets = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.targets.push(reader.int32()); + } else + message.targets.push(reader.int32()); + break; + } + case 20: { + if (!(message.editionDefaults && message.editionDefaults.length)) + message.editionDefaults = []; + message.editionDefaults.push($root.google.protobuf.FieldOptions.EditionDefault.decode(reader, reader.uint32())); + break; + } + case 21: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 1052: { + if (!(message[".google.api.fieldBehavior"] && message[".google.api.fieldBehavior"].length)) + message[".google.api.fieldBehavior"] = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message[".google.api.fieldBehavior"].push(reader.int32()); + } else + message[".google.api.fieldBehavior"].push(reader.int32()); + break; + } + case 1055: { + message[".google.api.resourceReference"] = $root.google.api.ResourceReference.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FieldOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldOptions} FieldOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldOptions message. + * @function verify + * @memberof google.protobuf.FieldOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.ctype != null && message.hasOwnProperty("ctype")) + switch (message.ctype) { + default: + return "ctype: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.packed != null && message.hasOwnProperty("packed")) + if (typeof message.packed !== "boolean") + return "packed: boolean expected"; + if (message.jstype != null && message.hasOwnProperty("jstype")) + switch (message.jstype) { + default: + return "jstype: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.lazy != null && message.hasOwnProperty("lazy")) + if (typeof message.lazy !== "boolean") + return "lazy: boolean expected"; + if (message.unverifiedLazy != null && message.hasOwnProperty("unverifiedLazy")) + if (typeof message.unverifiedLazy !== "boolean") + return "unverifiedLazy: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.weak != null && message.hasOwnProperty("weak")) + if (typeof message.weak !== "boolean") + return "weak: boolean expected"; + if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) + if (typeof message.debugRedact !== "boolean") + return "debugRedact: boolean expected"; + if (message.retention != null && message.hasOwnProperty("retention")) + switch (message.retention) { + default: + return "retention: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.targets != null && message.hasOwnProperty("targets")) { + if (!Array.isArray(message.targets)) + return "targets: array expected"; + for (var i = 0; i < message.targets.length; ++i) + switch (message.targets[i]) { + default: + return "targets: enum value[] expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + break; + } + } + if (message.editionDefaults != null && message.hasOwnProperty("editionDefaults")) { + if (!Array.isArray(message.editionDefaults)) + return "editionDefaults: array expected"; + for (var i = 0; i < message.editionDefaults.length; ++i) { + var error = $root.google.protobuf.FieldOptions.EditionDefault.verify(message.editionDefaults[i]); + if (error) + return "editionDefaults." + error; + } + } + if (message.features != null && message.hasOwnProperty("features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (error) + return "features." + error; + } + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.fieldBehavior"] != null && message.hasOwnProperty(".google.api.fieldBehavior")) { + if (!Array.isArray(message[".google.api.fieldBehavior"])) + return ".google.api.fieldBehavior: array expected"; + for (var i = 0; i < message[".google.api.fieldBehavior"].length; ++i) + switch (message[".google.api.fieldBehavior"][i]) { + default: + return ".google.api.fieldBehavior: enum value[] expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + break; + } + } + if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) { + var error = $root.google.api.ResourceReference.verify(message[".google.api.resourceReference"]); + if (error) + return ".google.api.resourceReference." + error; + } + return null; + }; + + /** + * Creates a FieldOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldOptions} FieldOptions + */ + FieldOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldOptions) + return object; + var message = new $root.google.protobuf.FieldOptions(); + switch (object.ctype) { + default: + if (typeof object.ctype === "number") { + message.ctype = object.ctype; + break; + } + break; + case "STRING": + case 0: + message.ctype = 0; + break; + case "CORD": + case 1: + message.ctype = 1; + break; + case "STRING_PIECE": + case 2: + message.ctype = 2; + break; + } + if (object.packed != null) + message.packed = Boolean(object.packed); + switch (object.jstype) { + default: + if (typeof object.jstype === "number") { + message.jstype = object.jstype; + break; + } + break; + case "JS_NORMAL": + case 0: + message.jstype = 0; + break; + case "JS_STRING": + case 1: + message.jstype = 1; + break; + case "JS_NUMBER": + case 2: + message.jstype = 2; + break; + } + if (object.lazy != null) + message.lazy = Boolean(object.lazy); + if (object.unverifiedLazy != null) + message.unverifiedLazy = Boolean(object.unverifiedLazy); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.weak != null) + message.weak = Boolean(object.weak); + if (object.debugRedact != null) + message.debugRedact = Boolean(object.debugRedact); + switch (object.retention) { + default: + if (typeof object.retention === "number") { + message.retention = object.retention; + break; + } + break; + case "RETENTION_UNKNOWN": + case 0: + message.retention = 0; + break; + case "RETENTION_RUNTIME": + case 1: + message.retention = 1; + break; + case "RETENTION_SOURCE": + case 2: + message.retention = 2; + break; + } + if (object.targets) { + if (!Array.isArray(object.targets)) + throw TypeError(".google.protobuf.FieldOptions.targets: array expected"); + message.targets = []; + for (var i = 0; i < object.targets.length; ++i) + switch (object.targets[i]) { + default: + if (typeof object.targets[i] === "number") { + message.targets[i] = object.targets[i]; + break; + } + case "TARGET_TYPE_UNKNOWN": + case 0: + message.targets[i] = 0; + break; + case "TARGET_TYPE_FILE": + case 1: + message.targets[i] = 1; + break; + case "TARGET_TYPE_EXTENSION_RANGE": + case 2: + message.targets[i] = 2; + break; + case "TARGET_TYPE_MESSAGE": + case 3: + message.targets[i] = 3; + break; + case "TARGET_TYPE_FIELD": + case 4: + message.targets[i] = 4; + break; + case "TARGET_TYPE_ONEOF": + case 5: + message.targets[i] = 5; + break; + case "TARGET_TYPE_ENUM": + case 6: + message.targets[i] = 6; + break; + case "TARGET_TYPE_ENUM_ENTRY": + case 7: + message.targets[i] = 7; + break; + case "TARGET_TYPE_SERVICE": + case 8: + message.targets[i] = 8; + break; + case "TARGET_TYPE_METHOD": + case 9: + message.targets[i] = 9; + break; + } + } + if (object.editionDefaults) { + if (!Array.isArray(object.editionDefaults)) + throw TypeError(".google.protobuf.FieldOptions.editionDefaults: array expected"); + message.editionDefaults = []; + for (var i = 0; i < object.editionDefaults.length; ++i) { + if (typeof object.editionDefaults[i] !== "object") + throw TypeError(".google.protobuf.FieldOptions.editionDefaults: object expected"); + message.editionDefaults[i] = $root.google.protobuf.FieldOptions.EditionDefault.fromObject(object.editionDefaults[i]); + } + } + if (object.features != null) { + if (typeof object.features !== "object") + throw TypeError(".google.protobuf.FieldOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + } + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.FieldOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.fieldBehavior"]) { + if (!Array.isArray(object[".google.api.fieldBehavior"])) + throw TypeError(".google.protobuf.FieldOptions..google.api.fieldBehavior: array expected"); + message[".google.api.fieldBehavior"] = []; + for (var i = 0; i < object[".google.api.fieldBehavior"].length; ++i) + switch (object[".google.api.fieldBehavior"][i]) { + default: + if (typeof object[".google.api.fieldBehavior"][i] === "number") { + message[".google.api.fieldBehavior"][i] = object[".google.api.fieldBehavior"][i]; + break; + } + case "FIELD_BEHAVIOR_UNSPECIFIED": + case 0: + message[".google.api.fieldBehavior"][i] = 0; + break; + case "OPTIONAL": + case 1: + message[".google.api.fieldBehavior"][i] = 1; + break; + case "REQUIRED": + case 2: + message[".google.api.fieldBehavior"][i] = 2; + break; + case "OUTPUT_ONLY": + case 3: + message[".google.api.fieldBehavior"][i] = 3; + break; + case "INPUT_ONLY": + case 4: + message[".google.api.fieldBehavior"][i] = 4; + break; + case "IMMUTABLE": + case 5: + message[".google.api.fieldBehavior"][i] = 5; + break; + case "UNORDERED_LIST": + case 6: + message[".google.api.fieldBehavior"][i] = 6; + break; + case "NON_EMPTY_DEFAULT": + case 7: + message[".google.api.fieldBehavior"][i] = 7; + break; + case "IDENTIFIER": + case 8: + message[".google.api.fieldBehavior"][i] = 8; + break; + } + } + if (object[".google.api.resourceReference"] != null) { + if (typeof object[".google.api.resourceReference"] !== "object") + throw TypeError(".google.protobuf.FieldOptions..google.api.resourceReference: object expected"); + message[".google.api.resourceReference"] = $root.google.api.ResourceReference.fromObject(object[".google.api.resourceReference"]); + } + return message; + }; + + /** + * Creates a plain object from a FieldOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldOptions + * @static + * @param {google.protobuf.FieldOptions} message FieldOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.targets = []; + object.editionDefaults = []; + object.uninterpretedOption = []; + object[".google.api.fieldBehavior"] = []; + } + if (options.defaults) { + object.ctype = options.enums === String ? "STRING" : 0; + object.packed = false; + object.deprecated = false; + object.lazy = false; + object.jstype = options.enums === String ? "JS_NORMAL" : 0; + object.weak = false; + object.unverifiedLazy = false; + object.debugRedact = false; + object.retention = options.enums === String ? "RETENTION_UNKNOWN" : 0; + object.features = null; + object[".google.api.resourceReference"] = null; + } + if (message.ctype != null && message.hasOwnProperty("ctype")) + object.ctype = options.enums === String ? $root.google.protobuf.FieldOptions.CType[message.ctype] === undefined ? message.ctype : $root.google.protobuf.FieldOptions.CType[message.ctype] : message.ctype; + if (message.packed != null && message.hasOwnProperty("packed")) + object.packed = message.packed; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.lazy != null && message.hasOwnProperty("lazy")) + object.lazy = message.lazy; + if (message.jstype != null && message.hasOwnProperty("jstype")) + object.jstype = options.enums === String ? $root.google.protobuf.FieldOptions.JSType[message.jstype] === undefined ? message.jstype : $root.google.protobuf.FieldOptions.JSType[message.jstype] : message.jstype; + if (message.weak != null && message.hasOwnProperty("weak")) + object.weak = message.weak; + if (message.unverifiedLazy != null && message.hasOwnProperty("unverifiedLazy")) + object.unverifiedLazy = message.unverifiedLazy; + if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) + object.debugRedact = message.debugRedact; + if (message.retention != null && message.hasOwnProperty("retention")) + object.retention = options.enums === String ? $root.google.protobuf.FieldOptions.OptionRetention[message.retention] === undefined ? message.retention : $root.google.protobuf.FieldOptions.OptionRetention[message.retention] : message.retention; + if (message.targets && message.targets.length) { + object.targets = []; + for (var j = 0; j < message.targets.length; ++j) + object.targets[j] = options.enums === String ? $root.google.protobuf.FieldOptions.OptionTargetType[message.targets[j]] === undefined ? message.targets[j] : $root.google.protobuf.FieldOptions.OptionTargetType[message.targets[j]] : message.targets[j]; + } + if (message.editionDefaults && message.editionDefaults.length) { + object.editionDefaults = []; + for (var j = 0; j < message.editionDefaults.length; ++j) + object.editionDefaults[j] = $root.google.protobuf.FieldOptions.EditionDefault.toObject(message.editionDefaults[j], options); + } + if (message.features != null && message.hasOwnProperty("features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.fieldBehavior"] && message[".google.api.fieldBehavior"].length) { + object[".google.api.fieldBehavior"] = []; + for (var j = 0; j < message[".google.api.fieldBehavior"].length; ++j) + object[".google.api.fieldBehavior"][j] = options.enums === String ? $root.google.api.FieldBehavior[message[".google.api.fieldBehavior"][j]] === undefined ? message[".google.api.fieldBehavior"][j] : $root.google.api.FieldBehavior[message[".google.api.fieldBehavior"][j]] : message[".google.api.fieldBehavior"][j]; + } + if (message[".google.api.resourceReference"] != null && message.hasOwnProperty(".google.api.resourceReference")) + object[".google.api.resourceReference"] = $root.google.api.ResourceReference.toObject(message[".google.api.resourceReference"], options); + return object; + }; + + /** + * Converts this FieldOptions to JSON. + * @function toJSON + * @memberof google.protobuf.FieldOptions + * @instance + * @returns {Object.} JSON object + */ + FieldOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FieldOptions + * @function getTypeUrl + * @memberof google.protobuf.FieldOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FieldOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldOptions"; + }; + + /** + * CType enum. + * @name google.protobuf.FieldOptions.CType + * @enum {number} + * @property {number} STRING=0 STRING value + * @property {number} CORD=1 CORD value + * @property {number} STRING_PIECE=2 STRING_PIECE value + */ + FieldOptions.CType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STRING"] = 0; + values[valuesById[1] = "CORD"] = 1; + values[valuesById[2] = "STRING_PIECE"] = 2; + return values; + })(); + + /** + * JSType enum. + * @name google.protobuf.FieldOptions.JSType + * @enum {number} + * @property {number} JS_NORMAL=0 JS_NORMAL value + * @property {number} JS_STRING=1 JS_STRING value + * @property {number} JS_NUMBER=2 JS_NUMBER value + */ + FieldOptions.JSType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "JS_NORMAL"] = 0; + values[valuesById[1] = "JS_STRING"] = 1; + values[valuesById[2] = "JS_NUMBER"] = 2; + return values; + })(); + + /** + * OptionRetention enum. + * @name google.protobuf.FieldOptions.OptionRetention + * @enum {number} + * @property {number} RETENTION_UNKNOWN=0 RETENTION_UNKNOWN value + * @property {number} RETENTION_RUNTIME=1 RETENTION_RUNTIME value + * @property {number} RETENTION_SOURCE=2 RETENTION_SOURCE value + */ + FieldOptions.OptionRetention = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "RETENTION_UNKNOWN"] = 0; + values[valuesById[1] = "RETENTION_RUNTIME"] = 1; + values[valuesById[2] = "RETENTION_SOURCE"] = 2; + return values; + })(); + + /** + * OptionTargetType enum. + * @name google.protobuf.FieldOptions.OptionTargetType + * @enum {number} + * @property {number} TARGET_TYPE_UNKNOWN=0 TARGET_TYPE_UNKNOWN value + * @property {number} TARGET_TYPE_FILE=1 TARGET_TYPE_FILE value + * @property {number} TARGET_TYPE_EXTENSION_RANGE=2 TARGET_TYPE_EXTENSION_RANGE value + * @property {number} TARGET_TYPE_MESSAGE=3 TARGET_TYPE_MESSAGE value + * @property {number} TARGET_TYPE_FIELD=4 TARGET_TYPE_FIELD value + * @property {number} TARGET_TYPE_ONEOF=5 TARGET_TYPE_ONEOF value + * @property {number} TARGET_TYPE_ENUM=6 TARGET_TYPE_ENUM value + * @property {number} TARGET_TYPE_ENUM_ENTRY=7 TARGET_TYPE_ENUM_ENTRY value + * @property {number} TARGET_TYPE_SERVICE=8 TARGET_TYPE_SERVICE value + * @property {number} TARGET_TYPE_METHOD=9 TARGET_TYPE_METHOD value + */ + FieldOptions.OptionTargetType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "TARGET_TYPE_UNKNOWN"] = 0; + values[valuesById[1] = "TARGET_TYPE_FILE"] = 1; + values[valuesById[2] = "TARGET_TYPE_EXTENSION_RANGE"] = 2; + values[valuesById[3] = "TARGET_TYPE_MESSAGE"] = 3; + values[valuesById[4] = "TARGET_TYPE_FIELD"] = 4; + values[valuesById[5] = "TARGET_TYPE_ONEOF"] = 5; + values[valuesById[6] = "TARGET_TYPE_ENUM"] = 6; + values[valuesById[7] = "TARGET_TYPE_ENUM_ENTRY"] = 7; + values[valuesById[8] = "TARGET_TYPE_SERVICE"] = 8; + values[valuesById[9] = "TARGET_TYPE_METHOD"] = 9; + return values; + })(); + + FieldOptions.EditionDefault = (function() { + + /** + * Properties of an EditionDefault. + * @memberof google.protobuf.FieldOptions + * @interface IEditionDefault + * @property {google.protobuf.Edition|null} [edition] EditionDefault edition + * @property {string|null} [value] EditionDefault value + */ + + /** + * Constructs a new EditionDefault. + * @memberof google.protobuf.FieldOptions + * @classdesc Represents an EditionDefault. + * @implements IEditionDefault + * @constructor + * @param {google.protobuf.FieldOptions.IEditionDefault=} [properties] Properties to set + */ + function EditionDefault(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EditionDefault edition. + * @member {google.protobuf.Edition} edition + * @memberof google.protobuf.FieldOptions.EditionDefault + * @instance + */ + EditionDefault.prototype.edition = 0; + + /** + * EditionDefault value. + * @member {string} value + * @memberof google.protobuf.FieldOptions.EditionDefault + * @instance + */ + EditionDefault.prototype.value = ""; + + /** + * Creates a new EditionDefault instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {google.protobuf.FieldOptions.IEditionDefault=} [properties] Properties to set + * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault instance + */ + EditionDefault.create = function create(properties) { + return new EditionDefault(properties); + }; + + /** + * Encodes the specified EditionDefault message. Does not implicitly {@link google.protobuf.FieldOptions.EditionDefault.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {google.protobuf.FieldOptions.IEditionDefault} message EditionDefault message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EditionDefault.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.value); + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.edition); + return writer; + }; + + /** + * Encodes the specified EditionDefault message, length delimited. Does not implicitly {@link google.protobuf.FieldOptions.EditionDefault.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {google.protobuf.FieldOptions.IEditionDefault} message EditionDefault message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EditionDefault.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EditionDefault message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EditionDefault.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldOptions.EditionDefault(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 3: { + message.edition = reader.int32(); + break; + } + case 2: { + message.value = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EditionDefault message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EditionDefault.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EditionDefault message. + * @function verify + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EditionDefault.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.edition != null && message.hasOwnProperty("edition")) + switch (message.edition) { + default: + return "edition: enum value expected"; + case 0: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.value != null && message.hasOwnProperty("value")) + if (!$util.isString(message.value)) + return "value: string expected"; + return null; + }; + + /** + * Creates an EditionDefault message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldOptions.EditionDefault} EditionDefault + */ + EditionDefault.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldOptions.EditionDefault) + return object; + var message = new $root.google.protobuf.FieldOptions.EditionDefault(); + switch (object.edition) { + default: + if (typeof object.edition === "number") { + message.edition = object.edition; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.edition = 0; + break; + case "EDITION_PROTO2": + case 998: + message.edition = 998; + break; + case "EDITION_PROTO3": + case 999: + message.edition = 999; + break; + case "EDITION_2023": + case 1000: + message.edition = 1000; + break; + case "EDITION_2024": + case 1001: + message.edition = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.edition = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.edition = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.edition = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.edition = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.edition = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.edition = 2147483647; + break; + } + if (object.value != null) + message.value = String(object.value); + return message; + }; + + /** + * Creates a plain object from an EditionDefault message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {google.protobuf.FieldOptions.EditionDefault} message EditionDefault + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EditionDefault.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.value = ""; + object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; + } + if (message.value != null && message.hasOwnProperty("value")) + object.value = message.value; + if (message.edition != null && message.hasOwnProperty("edition")) + object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + return object; + }; + + /** + * Converts this EditionDefault to JSON. + * @function toJSON + * @memberof google.protobuf.FieldOptions.EditionDefault + * @instance + * @returns {Object.} JSON object + */ + EditionDefault.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EditionDefault + * @function getTypeUrl + * @memberof google.protobuf.FieldOptions.EditionDefault + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EditionDefault.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldOptions.EditionDefault"; + }; + + return EditionDefault; + })(); + + return FieldOptions; + })(); + + protobuf.OneofOptions = (function() { + + /** + * Properties of an OneofOptions. + * @memberof google.protobuf + * @interface IOneofOptions + * @property {google.protobuf.IFeatureSet|null} [features] OneofOptions features + * @property {Array.|null} [uninterpretedOption] OneofOptions uninterpretedOption + */ + + /** + * Constructs a new OneofOptions. + * @memberof google.protobuf + * @classdesc Represents an OneofOptions. + * @implements IOneofOptions + * @constructor + * @param {google.protobuf.IOneofOptions=} [properties] Properties to set + */ + function OneofOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OneofOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.OneofOptions + * @instance + */ + OneofOptions.prototype.features = null; + + /** + * OneofOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.OneofOptions + * @instance + */ + OneofOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new OneofOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.IOneofOptions=} [properties] Properties to set + * @returns {google.protobuf.OneofOptions} OneofOptions instance + */ + OneofOptions.create = function create(properties) { + return new OneofOptions(properties); + }; + + /** + * Encodes the specified OneofOptions message. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.IOneofOptions} message OneofOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified OneofOptions message, length delimited. Does not implicitly {@link google.protobuf.OneofOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.IOneofOptions} message OneofOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OneofOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OneofOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.OneofOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.OneofOptions} OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.OneofOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OneofOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.OneofOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.OneofOptions} OneofOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OneofOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OneofOptions message. + * @function verify + * @memberof google.protobuf.OneofOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OneofOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.features != null && message.hasOwnProperty("features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (error) + return "features." + error; + } + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an OneofOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.OneofOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.OneofOptions} OneofOptions + */ + OneofOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.OneofOptions) + return object; + var message = new $root.google.protobuf.OneofOptions(); + if (object.features != null) { + if (typeof object.features !== "object") + throw TypeError(".google.protobuf.OneofOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + } + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.OneofOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.OneofOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an OneofOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.OneofOptions + * @static + * @param {google.protobuf.OneofOptions} message OneofOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OneofOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) + object.features = null; + if (message.features != null && message.hasOwnProperty("features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this OneofOptions to JSON. + * @function toJSON + * @memberof google.protobuf.OneofOptions + * @instance + * @returns {Object.} JSON object + */ + OneofOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OneofOptions + * @function getTypeUrl + * @memberof google.protobuf.OneofOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OneofOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.OneofOptions"; + }; + + return OneofOptions; + })(); + + protobuf.EnumOptions = (function() { + + /** + * Properties of an EnumOptions. + * @memberof google.protobuf + * @interface IEnumOptions + * @property {boolean|null} [allowAlias] EnumOptions allowAlias + * @property {boolean|null} [deprecated] EnumOptions deprecated + * @property {boolean|null} [deprecatedLegacyJsonFieldConflicts] EnumOptions deprecatedLegacyJsonFieldConflicts + * @property {google.protobuf.IFeatureSet|null} [features] EnumOptions features + * @property {Array.|null} [uninterpretedOption] EnumOptions uninterpretedOption + */ + + /** + * Constructs a new EnumOptions. + * @memberof google.protobuf + * @classdesc Represents an EnumOptions. + * @implements IEnumOptions + * @constructor + * @param {google.protobuf.IEnumOptions=} [properties] Properties to set + */ + function EnumOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumOptions allowAlias. + * @member {boolean} allowAlias + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.allowAlias = false; + + /** + * EnumOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.deprecated = false; + + /** + * EnumOptions deprecatedLegacyJsonFieldConflicts. + * @member {boolean} deprecatedLegacyJsonFieldConflicts + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.deprecatedLegacyJsonFieldConflicts = false; + + /** + * EnumOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.features = null; + + /** + * EnumOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.EnumOptions + * @instance + */ + EnumOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new EnumOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.IEnumOptions=} [properties] Properties to set + * @returns {google.protobuf.EnumOptions} EnumOptions instance + */ + EnumOptions.create = function create(properties) { + return new EnumOptions(properties); + }; + + /** + * Encodes the specified EnumOptions message. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.allowAlias != null && Object.hasOwnProperty.call(message, "allowAlias")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.allowAlias); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.deprecated); + if (message.deprecatedLegacyJsonFieldConflicts != null && Object.hasOwnProperty.call(message, "deprecatedLegacyJsonFieldConflicts")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.deprecatedLegacyJsonFieldConflicts); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnumOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.IEnumOptions} message EnumOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumOptions} EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 2: { + message.allowAlias = reader.bool(); + break; + } + case 3: { + message.deprecated = reader.bool(); + break; + } + case 6: { + message.deprecatedLegacyJsonFieldConflicts = reader.bool(); + break; + } + case 7: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumOptions} EnumOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumOptions message. + * @function verify + * @memberof google.protobuf.EnumOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.allowAlias != null && message.hasOwnProperty("allowAlias")) + if (typeof message.allowAlias !== "boolean") + return "allowAlias: boolean expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.deprecatedLegacyJsonFieldConflicts != null && message.hasOwnProperty("deprecatedLegacyJsonFieldConflicts")) + if (typeof message.deprecatedLegacyJsonFieldConflicts !== "boolean") + return "deprecatedLegacyJsonFieldConflicts: boolean expected"; + if (message.features != null && message.hasOwnProperty("features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (error) + return "features." + error; + } + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an EnumOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumOptions} EnumOptions + */ + EnumOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumOptions) + return object; + var message = new $root.google.protobuf.EnumOptions(); + if (object.allowAlias != null) + message.allowAlias = Boolean(object.allowAlias); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.deprecatedLegacyJsonFieldConflicts != null) + message.deprecatedLegacyJsonFieldConflicts = Boolean(object.deprecatedLegacyJsonFieldConflicts); + if (object.features != null) { + if (typeof object.features !== "object") + throw TypeError(".google.protobuf.EnumOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + } + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.EnumOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.EnumOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an EnumOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumOptions + * @static + * @param {google.protobuf.EnumOptions} message EnumOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) { + object.allowAlias = false; + object.deprecated = false; + object.deprecatedLegacyJsonFieldConflicts = false; + object.features = null; + } + if (message.allowAlias != null && message.hasOwnProperty("allowAlias")) + object.allowAlias = message.allowAlias; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.deprecatedLegacyJsonFieldConflicts != null && message.hasOwnProperty("deprecatedLegacyJsonFieldConflicts")) + object.deprecatedLegacyJsonFieldConflicts = message.deprecatedLegacyJsonFieldConflicts; + if (message.features != null && message.hasOwnProperty("features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this EnumOptions to JSON. + * @function toJSON + * @memberof google.protobuf.EnumOptions + * @instance + * @returns {Object.} JSON object + */ + EnumOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EnumOptions + * @function getTypeUrl + * @memberof google.protobuf.EnumOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumOptions"; + }; + + return EnumOptions; + })(); + + protobuf.EnumValueOptions = (function() { + + /** + * Properties of an EnumValueOptions. + * @memberof google.protobuf + * @interface IEnumValueOptions + * @property {boolean|null} [deprecated] EnumValueOptions deprecated + * @property {google.protobuf.IFeatureSet|null} [features] EnumValueOptions features + * @property {boolean|null} [debugRedact] EnumValueOptions debugRedact + * @property {Array.|null} [uninterpretedOption] EnumValueOptions uninterpretedOption + */ + + /** + * Constructs a new EnumValueOptions. + * @memberof google.protobuf + * @classdesc Represents an EnumValueOptions. + * @implements IEnumValueOptions + * @constructor + * @param {google.protobuf.IEnumValueOptions=} [properties] Properties to set + */ + function EnumValueOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * EnumValueOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.deprecated = false; + + /** + * EnumValueOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.features = null; + + /** + * EnumValueOptions debugRedact. + * @member {boolean} debugRedact + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.debugRedact = false; + + /** + * EnumValueOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.EnumValueOptions + * @instance + */ + EnumValueOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * Creates a new EnumValueOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.IEnumValueOptions=} [properties] Properties to set + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions instance + */ + EnumValueOptions.create = function create(properties) { + return new EnumValueOptions(properties); + }; + + /** + * Encodes the specified EnumValueOptions message. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.IEnumValueOptions} message EnumValueOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.deprecated); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.debugRedact != null && Object.hasOwnProperty.call(message, "debugRedact")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.debugRedact); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified EnumValueOptions message, length delimited. Does not implicitly {@link google.protobuf.EnumValueOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.IEnumValueOptions} message EnumValueOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + EnumValueOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.EnumValueOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.deprecated = reader.bool(); + break; + } + case 2: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 3: { + message.debugRedact = reader.bool(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an EnumValueOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + EnumValueOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an EnumValueOptions message. + * @function verify + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + EnumValueOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.features != null && message.hasOwnProperty("features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (error) + return "features." + error; + } + if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) + if (typeof message.debugRedact !== "boolean") + return "debugRedact: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + return null; + }; + + /** + * Creates an EnumValueOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.EnumValueOptions} EnumValueOptions + */ + EnumValueOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.EnumValueOptions) + return object; + var message = new $root.google.protobuf.EnumValueOptions(); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.features != null) { + if (typeof object.features !== "object") + throw TypeError(".google.protobuf.EnumValueOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + } + if (object.debugRedact != null) + message.debugRedact = Boolean(object.debugRedact); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.EnumValueOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an EnumValueOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {google.protobuf.EnumValueOptions} message EnumValueOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + EnumValueOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) { + object.deprecated = false; + object.features = null; + object.debugRedact = false; + } + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.features != null && message.hasOwnProperty("features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.debugRedact != null && message.hasOwnProperty("debugRedact")) + object.debugRedact = message.debugRedact; + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + return object; + }; + + /** + * Converts this EnumValueOptions to JSON. + * @function toJSON + * @memberof google.protobuf.EnumValueOptions + * @instance + * @returns {Object.} JSON object + */ + EnumValueOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for EnumValueOptions + * @function getTypeUrl + * @memberof google.protobuf.EnumValueOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + EnumValueOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.EnumValueOptions"; + }; + + return EnumValueOptions; + })(); + + protobuf.ServiceOptions = (function() { + + /** + * Properties of a ServiceOptions. + * @memberof google.protobuf + * @interface IServiceOptions + * @property {google.protobuf.IFeatureSet|null} [features] ServiceOptions features + * @property {boolean|null} [deprecated] ServiceOptions deprecated + * @property {Array.|null} [uninterpretedOption] ServiceOptions uninterpretedOption + * @property {string|null} [".google.api.defaultHost"] ServiceOptions .google.api.defaultHost + * @property {string|null} [".google.api.oauthScopes"] ServiceOptions .google.api.oauthScopes + * @property {string|null} [".google.api.apiVersion"] ServiceOptions .google.api.apiVersion + */ + + /** + * Constructs a new ServiceOptions. + * @memberof google.protobuf + * @classdesc Represents a ServiceOptions. + * @implements IServiceOptions + * @constructor + * @param {google.protobuf.IServiceOptions=} [properties] Properties to set + */ + function ServiceOptions(properties) { + this.uninterpretedOption = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ServiceOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype.features = null; + + /** + * ServiceOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype.deprecated = false; + + /** + * ServiceOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * ServiceOptions .google.api.defaultHost. + * @member {string} .google.api.defaultHost + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype[".google.api.defaultHost"] = ""; + + /** + * ServiceOptions .google.api.oauthScopes. + * @member {string} .google.api.oauthScopes + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype[".google.api.oauthScopes"] = ""; + + /** + * ServiceOptions .google.api.apiVersion. + * @member {string} .google.api.apiVersion + * @memberof google.protobuf.ServiceOptions + * @instance + */ + ServiceOptions.prototype[".google.api.apiVersion"] = ""; + + /** + * Creates a new ServiceOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.IServiceOptions=} [properties] Properties to set + * @returns {google.protobuf.ServiceOptions} ServiceOptions instance + */ + ServiceOptions.create = function create(properties) { + return new ServiceOptions(properties); + }; + + /** + * Encodes the specified ServiceOptions message. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 33, wireType 0 =*/264).bool(message.deprecated); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 34, wireType 2 =*/274).fork()).ldelim(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.api.defaultHost"] != null && Object.hasOwnProperty.call(message, ".google.api.defaultHost")) + writer.uint32(/* id 1049, wireType 2 =*/8394).string(message[".google.api.defaultHost"]); + if (message[".google.api.oauthScopes"] != null && Object.hasOwnProperty.call(message, ".google.api.oauthScopes")) + writer.uint32(/* id 1050, wireType 2 =*/8402).string(message[".google.api.oauthScopes"]); + if (message[".google.api.apiVersion"] != null && Object.hasOwnProperty.call(message, ".google.api.apiVersion")) + writer.uint32(/* id 525000001, wireType 2 =*/4200000010).string(message[".google.api.apiVersion"]); + return writer; + }; + + /** + * Encodes the specified ServiceOptions message, length delimited. Does not implicitly {@link google.protobuf.ServiceOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.IServiceOptions} message ServiceOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ServiceOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ServiceOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ServiceOptions} ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ServiceOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 34: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 33: { + message.deprecated = reader.bool(); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 1049: { + message[".google.api.defaultHost"] = reader.string(); + break; + } + case 1050: { + message[".google.api.oauthScopes"] = reader.string(); + break; + } + case 525000001: { + message[".google.api.apiVersion"] = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ServiceOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ServiceOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ServiceOptions} ServiceOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ServiceOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ServiceOptions message. + * @function verify + * @memberof google.protobuf.ServiceOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ServiceOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.features != null && message.hasOwnProperty("features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (error) + return "features." + error; + } + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.defaultHost"] != null && message.hasOwnProperty(".google.api.defaultHost")) + if (!$util.isString(message[".google.api.defaultHost"])) + return ".google.api.defaultHost: string expected"; + if (message[".google.api.oauthScopes"] != null && message.hasOwnProperty(".google.api.oauthScopes")) + if (!$util.isString(message[".google.api.oauthScopes"])) + return ".google.api.oauthScopes: string expected"; + if (message[".google.api.apiVersion"] != null && message.hasOwnProperty(".google.api.apiVersion")) + if (!$util.isString(message[".google.api.apiVersion"])) + return ".google.api.apiVersion: string expected"; + return null; + }; + + /** + * Creates a ServiceOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ServiceOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ServiceOptions} ServiceOptions + */ + ServiceOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ServiceOptions) + return object; + var message = new $root.google.protobuf.ServiceOptions(); + if (object.features != null) { + if (typeof object.features !== "object") + throw TypeError(".google.protobuf.ServiceOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + } + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.ServiceOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.ServiceOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.defaultHost"] != null) + message[".google.api.defaultHost"] = String(object[".google.api.defaultHost"]); + if (object[".google.api.oauthScopes"] != null) + message[".google.api.oauthScopes"] = String(object[".google.api.oauthScopes"]); + if (object[".google.api.apiVersion"] != null) + message[".google.api.apiVersion"] = String(object[".google.api.apiVersion"]); + return message; + }; + + /** + * Creates a plain object from a ServiceOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ServiceOptions + * @static + * @param {google.protobuf.ServiceOptions} message ServiceOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ServiceOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.uninterpretedOption = []; + if (options.defaults) { + object.deprecated = false; + object.features = null; + object[".google.api.defaultHost"] = ""; + object[".google.api.oauthScopes"] = ""; + object[".google.api.apiVersion"] = ""; + } + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.features != null && message.hasOwnProperty("features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.api.defaultHost"] != null && message.hasOwnProperty(".google.api.defaultHost")) + object[".google.api.defaultHost"] = message[".google.api.defaultHost"]; + if (message[".google.api.oauthScopes"] != null && message.hasOwnProperty(".google.api.oauthScopes")) + object[".google.api.oauthScopes"] = message[".google.api.oauthScopes"]; + if (message[".google.api.apiVersion"] != null && message.hasOwnProperty(".google.api.apiVersion")) + object[".google.api.apiVersion"] = message[".google.api.apiVersion"]; + return object; + }; + + /** + * Converts this ServiceOptions to JSON. + * @function toJSON + * @memberof google.protobuf.ServiceOptions + * @instance + * @returns {Object.} JSON object + */ + ServiceOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ServiceOptions + * @function getTypeUrl + * @memberof google.protobuf.ServiceOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ServiceOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.ServiceOptions"; + }; + + return ServiceOptions; + })(); + + protobuf.MethodOptions = (function() { + + /** + * Properties of a MethodOptions. + * @memberof google.protobuf + * @interface IMethodOptions + * @property {boolean|null} [deprecated] MethodOptions deprecated + * @property {google.protobuf.MethodOptions.IdempotencyLevel|null} [idempotencyLevel] MethodOptions idempotencyLevel + * @property {google.protobuf.IFeatureSet|null} [features] MethodOptions features + * @property {Array.|null} [uninterpretedOption] MethodOptions uninterpretedOption + * @property {google.api.IHttpRule|null} [".google.api.http"] MethodOptions .google.api.http + * @property {Array.|null} [".google.api.methodSignature"] MethodOptions .google.api.methodSignature + * @property {google.longrunning.IOperationInfo|null} [".google.longrunning.operationInfo"] MethodOptions .google.longrunning.operationInfo + */ + + /** + * Constructs a new MethodOptions. + * @memberof google.protobuf + * @classdesc Represents a MethodOptions. + * @implements IMethodOptions + * @constructor + * @param {google.protobuf.IMethodOptions=} [properties] Properties to set + */ + function MethodOptions(properties) { + this.uninterpretedOption = []; + this[".google.api.methodSignature"] = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MethodOptions deprecated. + * @member {boolean} deprecated + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype.deprecated = false; + + /** + * MethodOptions idempotencyLevel. + * @member {google.protobuf.MethodOptions.IdempotencyLevel} idempotencyLevel + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype.idempotencyLevel = 0; + + /** + * MethodOptions features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype.features = null; + + /** + * MethodOptions uninterpretedOption. + * @member {Array.} uninterpretedOption + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype.uninterpretedOption = $util.emptyArray; + + /** + * MethodOptions .google.api.http. + * @member {google.api.IHttpRule|null|undefined} .google.api.http + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype[".google.api.http"] = null; + + /** + * MethodOptions .google.api.methodSignature. + * @member {Array.} .google.api.methodSignature + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype[".google.api.methodSignature"] = $util.emptyArray; + + /** + * MethodOptions .google.longrunning.operationInfo. + * @member {google.longrunning.IOperationInfo|null|undefined} .google.longrunning.operationInfo + * @memberof google.protobuf.MethodOptions + * @instance + */ + MethodOptions.prototype[".google.longrunning.operationInfo"] = null; + + /** + * Creates a new MethodOptions instance using the specified properties. + * @function create + * @memberof google.protobuf.MethodOptions + * @static + * @param {google.protobuf.IMethodOptions=} [properties] Properties to set + * @returns {google.protobuf.MethodOptions} MethodOptions instance + */ + MethodOptions.create = function create(properties) { + return new MethodOptions(properties); + }; + + /** + * Encodes the specified MethodOptions message. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * @function encode + * @memberof google.protobuf.MethodOptions + * @static + * @param {google.protobuf.IMethodOptions} message MethodOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.deprecated != null && Object.hasOwnProperty.call(message, "deprecated")) + writer.uint32(/* id 33, wireType 0 =*/264).bool(message.deprecated); + if (message.idempotencyLevel != null && Object.hasOwnProperty.call(message, "idempotencyLevel")) + writer.uint32(/* id 34, wireType 0 =*/272).int32(message.idempotencyLevel); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 35, wireType 2 =*/282).fork()).ldelim(); + if (message.uninterpretedOption != null && message.uninterpretedOption.length) + for (var i = 0; i < message.uninterpretedOption.length; ++i) + $root.google.protobuf.UninterpretedOption.encode(message.uninterpretedOption[i], writer.uint32(/* id 999, wireType 2 =*/7994).fork()).ldelim(); + if (message[".google.longrunning.operationInfo"] != null && Object.hasOwnProperty.call(message, ".google.longrunning.operationInfo")) + $root.google.longrunning.OperationInfo.encode(message[".google.longrunning.operationInfo"], writer.uint32(/* id 1049, wireType 2 =*/8394).fork()).ldelim(); + if (message[".google.api.methodSignature"] != null && message[".google.api.methodSignature"].length) + for (var i = 0; i < message[".google.api.methodSignature"].length; ++i) + writer.uint32(/* id 1051, wireType 2 =*/8410).string(message[".google.api.methodSignature"][i]); + if (message[".google.api.http"] != null && Object.hasOwnProperty.call(message, ".google.api.http")) + $root.google.api.HttpRule.encode(message[".google.api.http"], writer.uint32(/* id 72295728, wireType 2 =*/578365826).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MethodOptions message, length delimited. Does not implicitly {@link google.protobuf.MethodOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.MethodOptions + * @static + * @param {google.protobuf.IMethodOptions} message MethodOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MethodOptions message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.MethodOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.MethodOptions} MethodOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.MethodOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 33: { + message.deprecated = reader.bool(); + break; + } + case 34: { + message.idempotencyLevel = reader.int32(); + break; + } + case 35: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + case 999: { + if (!(message.uninterpretedOption && message.uninterpretedOption.length)) + message.uninterpretedOption = []; + message.uninterpretedOption.push($root.google.protobuf.UninterpretedOption.decode(reader, reader.uint32())); + break; + } + case 72295728: { + message[".google.api.http"] = $root.google.api.HttpRule.decode(reader, reader.uint32()); + break; + } + case 1051: { + if (!(message[".google.api.methodSignature"] && message[".google.api.methodSignature"].length)) + message[".google.api.methodSignature"] = []; + message[".google.api.methodSignature"].push(reader.string()); + break; + } + case 1049: { + message[".google.longrunning.operationInfo"] = $root.google.longrunning.OperationInfo.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MethodOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.MethodOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.MethodOptions} MethodOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MethodOptions message. + * @function verify + * @memberof google.protobuf.MethodOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MethodOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + if (typeof message.deprecated !== "boolean") + return "deprecated: boolean expected"; + if (message.idempotencyLevel != null && message.hasOwnProperty("idempotencyLevel")) + switch (message.idempotencyLevel) { + default: + return "idempotencyLevel: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.features != null && message.hasOwnProperty("features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (error) + return "features." + error; + } + if (message.uninterpretedOption != null && message.hasOwnProperty("uninterpretedOption")) { + if (!Array.isArray(message.uninterpretedOption)) + return "uninterpretedOption: array expected"; + for (var i = 0; i < message.uninterpretedOption.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.verify(message.uninterpretedOption[i]); + if (error) + return "uninterpretedOption." + error; + } + } + if (message[".google.api.http"] != null && message.hasOwnProperty(".google.api.http")) { + var error = $root.google.api.HttpRule.verify(message[".google.api.http"]); + if (error) + return ".google.api.http." + error; + } + if (message[".google.api.methodSignature"] != null && message.hasOwnProperty(".google.api.methodSignature")) { + if (!Array.isArray(message[".google.api.methodSignature"])) + return ".google.api.methodSignature: array expected"; + for (var i = 0; i < message[".google.api.methodSignature"].length; ++i) + if (!$util.isString(message[".google.api.methodSignature"][i])) + return ".google.api.methodSignature: string[] expected"; + } + if (message[".google.longrunning.operationInfo"] != null && message.hasOwnProperty(".google.longrunning.operationInfo")) { + var error = $root.google.longrunning.OperationInfo.verify(message[".google.longrunning.operationInfo"]); + if (error) + return ".google.longrunning.operationInfo." + error; + } + return null; + }; + + /** + * Creates a MethodOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.MethodOptions + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.MethodOptions} MethodOptions + */ + MethodOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.MethodOptions) + return object; + var message = new $root.google.protobuf.MethodOptions(); + if (object.deprecated != null) + message.deprecated = Boolean(object.deprecated); + switch (object.idempotencyLevel) { + default: + if (typeof object.idempotencyLevel === "number") { + message.idempotencyLevel = object.idempotencyLevel; + break; + } + break; + case "IDEMPOTENCY_UNKNOWN": + case 0: + message.idempotencyLevel = 0; + break; + case "NO_SIDE_EFFECTS": + case 1: + message.idempotencyLevel = 1; + break; + case "IDEMPOTENT": + case 2: + message.idempotencyLevel = 2; + break; + } + if (object.features != null) { + if (typeof object.features !== "object") + throw TypeError(".google.protobuf.MethodOptions.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + } + if (object.uninterpretedOption) { + if (!Array.isArray(object.uninterpretedOption)) + throw TypeError(".google.protobuf.MethodOptions.uninterpretedOption: array expected"); + message.uninterpretedOption = []; + for (var i = 0; i < object.uninterpretedOption.length; ++i) { + if (typeof object.uninterpretedOption[i] !== "object") + throw TypeError(".google.protobuf.MethodOptions.uninterpretedOption: object expected"); + message.uninterpretedOption[i] = $root.google.protobuf.UninterpretedOption.fromObject(object.uninterpretedOption[i]); + } + } + if (object[".google.api.http"] != null) { + if (typeof object[".google.api.http"] !== "object") + throw TypeError(".google.protobuf.MethodOptions..google.api.http: object expected"); + message[".google.api.http"] = $root.google.api.HttpRule.fromObject(object[".google.api.http"]); + } + if (object[".google.api.methodSignature"]) { + if (!Array.isArray(object[".google.api.methodSignature"])) + throw TypeError(".google.protobuf.MethodOptions..google.api.methodSignature: array expected"); + message[".google.api.methodSignature"] = []; + for (var i = 0; i < object[".google.api.methodSignature"].length; ++i) + message[".google.api.methodSignature"][i] = String(object[".google.api.methodSignature"][i]); + } + if (object[".google.longrunning.operationInfo"] != null) { + if (typeof object[".google.longrunning.operationInfo"] !== "object") + throw TypeError(".google.protobuf.MethodOptions..google.longrunning.operationInfo: object expected"); + message[".google.longrunning.operationInfo"] = $root.google.longrunning.OperationInfo.fromObject(object[".google.longrunning.operationInfo"]); + } + return message; + }; + + /** + * Creates a plain object from a MethodOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.MethodOptions + * @static + * @param {google.protobuf.MethodOptions} message MethodOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MethodOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.uninterpretedOption = []; + object[".google.api.methodSignature"] = []; + } + if (options.defaults) { + object.deprecated = false; + object.idempotencyLevel = options.enums === String ? "IDEMPOTENCY_UNKNOWN" : 0; + object.features = null; + object[".google.longrunning.operationInfo"] = null; + object[".google.api.http"] = null; + } + if (message.deprecated != null && message.hasOwnProperty("deprecated")) + object.deprecated = message.deprecated; + if (message.idempotencyLevel != null && message.hasOwnProperty("idempotencyLevel")) + object.idempotencyLevel = options.enums === String ? $root.google.protobuf.MethodOptions.IdempotencyLevel[message.idempotencyLevel] === undefined ? message.idempotencyLevel : $root.google.protobuf.MethodOptions.IdempotencyLevel[message.idempotencyLevel] : message.idempotencyLevel; + if (message.features != null && message.hasOwnProperty("features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.uninterpretedOption && message.uninterpretedOption.length) { + object.uninterpretedOption = []; + for (var j = 0; j < message.uninterpretedOption.length; ++j) + object.uninterpretedOption[j] = $root.google.protobuf.UninterpretedOption.toObject(message.uninterpretedOption[j], options); + } + if (message[".google.longrunning.operationInfo"] != null && message.hasOwnProperty(".google.longrunning.operationInfo")) + object[".google.longrunning.operationInfo"] = $root.google.longrunning.OperationInfo.toObject(message[".google.longrunning.operationInfo"], options); + if (message[".google.api.methodSignature"] && message[".google.api.methodSignature"].length) { + object[".google.api.methodSignature"] = []; + for (var j = 0; j < message[".google.api.methodSignature"].length; ++j) + object[".google.api.methodSignature"][j] = message[".google.api.methodSignature"][j]; + } + if (message[".google.api.http"] != null && message.hasOwnProperty(".google.api.http")) + object[".google.api.http"] = $root.google.api.HttpRule.toObject(message[".google.api.http"], options); + return object; + }; + + /** + * Converts this MethodOptions to JSON. + * @function toJSON + * @memberof google.protobuf.MethodOptions + * @instance + * @returns {Object.} JSON object + */ + MethodOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MethodOptions + * @function getTypeUrl + * @memberof google.protobuf.MethodOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MethodOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.MethodOptions"; + }; + + /** + * IdempotencyLevel enum. + * @name google.protobuf.MethodOptions.IdempotencyLevel + * @enum {number} + * @property {number} IDEMPOTENCY_UNKNOWN=0 IDEMPOTENCY_UNKNOWN value + * @property {number} NO_SIDE_EFFECTS=1 NO_SIDE_EFFECTS value + * @property {number} IDEMPOTENT=2 IDEMPOTENT value + */ + MethodOptions.IdempotencyLevel = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "IDEMPOTENCY_UNKNOWN"] = 0; + values[valuesById[1] = "NO_SIDE_EFFECTS"] = 1; + values[valuesById[2] = "IDEMPOTENT"] = 2; + return values; + })(); + + return MethodOptions; + })(); + + protobuf.UninterpretedOption = (function() { + + /** + * Properties of an UninterpretedOption. + * @memberof google.protobuf + * @interface IUninterpretedOption + * @property {Array.|null} [name] UninterpretedOption name + * @property {string|null} [identifierValue] UninterpretedOption identifierValue + * @property {number|Long|null} [positiveIntValue] UninterpretedOption positiveIntValue + * @property {number|Long|null} [negativeIntValue] UninterpretedOption negativeIntValue + * @property {number|null} [doubleValue] UninterpretedOption doubleValue + * @property {Uint8Array|null} [stringValue] UninterpretedOption stringValue + * @property {string|null} [aggregateValue] UninterpretedOption aggregateValue + */ + + /** + * Constructs a new UninterpretedOption. + * @memberof google.protobuf + * @classdesc Represents an UninterpretedOption. + * @implements IUninterpretedOption + * @constructor + * @param {google.protobuf.IUninterpretedOption=} [properties] Properties to set + */ + function UninterpretedOption(properties) { + this.name = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UninterpretedOption name. + * @member {Array.} name + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.name = $util.emptyArray; + + /** + * UninterpretedOption identifierValue. + * @member {string} identifierValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.identifierValue = ""; + + /** + * UninterpretedOption positiveIntValue. + * @member {number|Long} positiveIntValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.positiveIntValue = $util.Long ? $util.Long.fromBits(0,0,true) : 0; + + /** + * UninterpretedOption negativeIntValue. + * @member {number|Long} negativeIntValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.negativeIntValue = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * UninterpretedOption doubleValue. + * @member {number} doubleValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.doubleValue = 0; + + /** + * UninterpretedOption stringValue. + * @member {Uint8Array} stringValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.stringValue = $util.newBuffer([]); + + /** + * UninterpretedOption aggregateValue. + * @member {string} aggregateValue + * @memberof google.protobuf.UninterpretedOption + * @instance + */ + UninterpretedOption.prototype.aggregateValue = ""; + + /** + * Creates a new UninterpretedOption instance using the specified properties. + * @function create + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.IUninterpretedOption=} [properties] Properties to set + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption instance + */ + UninterpretedOption.create = function create(properties) { + return new UninterpretedOption(properties); + }; + + /** + * Encodes the specified UninterpretedOption message. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @function encode + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.IUninterpretedOption} message UninterpretedOption message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UninterpretedOption.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && message.name.length) + for (var i = 0; i < message.name.length; ++i) + $root.google.protobuf.UninterpretedOption.NamePart.encode(message.name[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.identifierValue != null && Object.hasOwnProperty.call(message, "identifierValue")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.identifierValue); + if (message.positiveIntValue != null && Object.hasOwnProperty.call(message, "positiveIntValue")) + writer.uint32(/* id 4, wireType 0 =*/32).uint64(message.positiveIntValue); + if (message.negativeIntValue != null && Object.hasOwnProperty.call(message, "negativeIntValue")) + writer.uint32(/* id 5, wireType 0 =*/40).int64(message.negativeIntValue); + if (message.doubleValue != null && Object.hasOwnProperty.call(message, "doubleValue")) + writer.uint32(/* id 6, wireType 1 =*/49).double(message.doubleValue); + if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue")) + writer.uint32(/* id 7, wireType 2 =*/58).bytes(message.stringValue); + if (message.aggregateValue != null && Object.hasOwnProperty.call(message, "aggregateValue")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.aggregateValue); + return writer; + }; + + /** + * Encodes the specified UninterpretedOption message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.IUninterpretedOption} message UninterpretedOption message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UninterpretedOption.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UninterpretedOption.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UninterpretedOption(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 2: { + if (!(message.name && message.name.length)) + message.name = []; + message.name.push($root.google.protobuf.UninterpretedOption.NamePart.decode(reader, reader.uint32())); + break; + } + case 3: { + message.identifierValue = reader.string(); + break; + } + case 4: { + message.positiveIntValue = reader.uint64(); + break; + } + case 5: { + message.negativeIntValue = reader.int64(); + break; + } + case 6: { + message.doubleValue = reader.double(); + break; + } + case 7: { + message.stringValue = reader.bytes(); + break; + } + case 8: { + message.aggregateValue = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UninterpretedOption message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UninterpretedOption.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UninterpretedOption message. + * @function verify + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UninterpretedOption.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) { + if (!Array.isArray(message.name)) + return "name: array expected"; + for (var i = 0; i < message.name.length; ++i) { + var error = $root.google.protobuf.UninterpretedOption.NamePart.verify(message.name[i]); + if (error) + return "name." + error; + } + } + if (message.identifierValue != null && message.hasOwnProperty("identifierValue")) + if (!$util.isString(message.identifierValue)) + return "identifierValue: string expected"; + if (message.positiveIntValue != null && message.hasOwnProperty("positiveIntValue")) + if (!$util.isInteger(message.positiveIntValue) && !(message.positiveIntValue && $util.isInteger(message.positiveIntValue.low) && $util.isInteger(message.positiveIntValue.high))) + return "positiveIntValue: integer|Long expected"; + if (message.negativeIntValue != null && message.hasOwnProperty("negativeIntValue")) + if (!$util.isInteger(message.negativeIntValue) && !(message.negativeIntValue && $util.isInteger(message.negativeIntValue.low) && $util.isInteger(message.negativeIntValue.high))) + return "negativeIntValue: integer|Long expected"; + if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) + if (typeof message.doubleValue !== "number") + return "doubleValue: number expected"; + if (message.stringValue != null && message.hasOwnProperty("stringValue")) + if (!(message.stringValue && typeof message.stringValue.length === "number" || $util.isString(message.stringValue))) + return "stringValue: buffer expected"; + if (message.aggregateValue != null && message.hasOwnProperty("aggregateValue")) + if (!$util.isString(message.aggregateValue)) + return "aggregateValue: string expected"; + return null; + }; + + /** + * Creates an UninterpretedOption message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.UninterpretedOption} UninterpretedOption + */ + UninterpretedOption.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.UninterpretedOption) + return object; + var message = new $root.google.protobuf.UninterpretedOption(); + if (object.name) { + if (!Array.isArray(object.name)) + throw TypeError(".google.protobuf.UninterpretedOption.name: array expected"); + message.name = []; + for (var i = 0; i < object.name.length; ++i) { + if (typeof object.name[i] !== "object") + throw TypeError(".google.protobuf.UninterpretedOption.name: object expected"); + message.name[i] = $root.google.protobuf.UninterpretedOption.NamePart.fromObject(object.name[i]); + } + } + if (object.identifierValue != null) + message.identifierValue = String(object.identifierValue); + if (object.positiveIntValue != null) + if ($util.Long) + (message.positiveIntValue = $util.Long.fromValue(object.positiveIntValue)).unsigned = true; + else if (typeof object.positiveIntValue === "string") + message.positiveIntValue = parseInt(object.positiveIntValue, 10); + else if (typeof object.positiveIntValue === "number") + message.positiveIntValue = object.positiveIntValue; + else if (typeof object.positiveIntValue === "object") + message.positiveIntValue = new $util.LongBits(object.positiveIntValue.low >>> 0, object.positiveIntValue.high >>> 0).toNumber(true); + if (object.negativeIntValue != null) + if ($util.Long) + (message.negativeIntValue = $util.Long.fromValue(object.negativeIntValue)).unsigned = false; + else if (typeof object.negativeIntValue === "string") + message.negativeIntValue = parseInt(object.negativeIntValue, 10); + else if (typeof object.negativeIntValue === "number") + message.negativeIntValue = object.negativeIntValue; + else if (typeof object.negativeIntValue === "object") + message.negativeIntValue = new $util.LongBits(object.negativeIntValue.low >>> 0, object.negativeIntValue.high >>> 0).toNumber(); + if (object.doubleValue != null) + message.doubleValue = Number(object.doubleValue); + if (object.stringValue != null) + if (typeof object.stringValue === "string") + $util.base64.decode(object.stringValue, message.stringValue = $util.newBuffer($util.base64.length(object.stringValue)), 0); + else if (object.stringValue.length >= 0) + message.stringValue = object.stringValue; + if (object.aggregateValue != null) + message.aggregateValue = String(object.aggregateValue); + return message; + }; + + /** + * Creates a plain object from an UninterpretedOption message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {google.protobuf.UninterpretedOption} message UninterpretedOption + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UninterpretedOption.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.name = []; + if (options.defaults) { + object.identifierValue = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, true); + object.positiveIntValue = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.positiveIntValue = options.longs === String ? "0" : 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.negativeIntValue = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.negativeIntValue = options.longs === String ? "0" : 0; + object.doubleValue = 0; + if (options.bytes === String) + object.stringValue = ""; + else { + object.stringValue = []; + if (options.bytes !== Array) + object.stringValue = $util.newBuffer(object.stringValue); + } + object.aggregateValue = ""; + } + if (message.name && message.name.length) { + object.name = []; + for (var j = 0; j < message.name.length; ++j) + object.name[j] = $root.google.protobuf.UninterpretedOption.NamePart.toObject(message.name[j], options); + } + if (message.identifierValue != null && message.hasOwnProperty("identifierValue")) + object.identifierValue = message.identifierValue; + if (message.positiveIntValue != null && message.hasOwnProperty("positiveIntValue")) + if (typeof message.positiveIntValue === "number") + object.positiveIntValue = options.longs === String ? String(message.positiveIntValue) : message.positiveIntValue; + else + object.positiveIntValue = options.longs === String ? $util.Long.prototype.toString.call(message.positiveIntValue) : options.longs === Number ? new $util.LongBits(message.positiveIntValue.low >>> 0, message.positiveIntValue.high >>> 0).toNumber(true) : message.positiveIntValue; + if (message.negativeIntValue != null && message.hasOwnProperty("negativeIntValue")) + if (typeof message.negativeIntValue === "number") + object.negativeIntValue = options.longs === String ? String(message.negativeIntValue) : message.negativeIntValue; + else + object.negativeIntValue = options.longs === String ? $util.Long.prototype.toString.call(message.negativeIntValue) : options.longs === Number ? new $util.LongBits(message.negativeIntValue.low >>> 0, message.negativeIntValue.high >>> 0).toNumber() : message.negativeIntValue; + if (message.doubleValue != null && message.hasOwnProperty("doubleValue")) + object.doubleValue = options.json && !isFinite(message.doubleValue) ? String(message.doubleValue) : message.doubleValue; + if (message.stringValue != null && message.hasOwnProperty("stringValue")) + object.stringValue = options.bytes === String ? $util.base64.encode(message.stringValue, 0, message.stringValue.length) : options.bytes === Array ? Array.prototype.slice.call(message.stringValue) : message.stringValue; + if (message.aggregateValue != null && message.hasOwnProperty("aggregateValue")) + object.aggregateValue = message.aggregateValue; + return object; + }; + + /** + * Converts this UninterpretedOption to JSON. + * @function toJSON + * @memberof google.protobuf.UninterpretedOption + * @instance + * @returns {Object.} JSON object + */ + UninterpretedOption.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UninterpretedOption + * @function getTypeUrl + * @memberof google.protobuf.UninterpretedOption + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UninterpretedOption.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.UninterpretedOption"; + }; + + UninterpretedOption.NamePart = (function() { + + /** + * Properties of a NamePart. + * @memberof google.protobuf.UninterpretedOption + * @interface INamePart + * @property {string} namePart NamePart namePart + * @property {boolean} isExtension NamePart isExtension + */ + + /** + * Constructs a new NamePart. + * @memberof google.protobuf.UninterpretedOption + * @classdesc Represents a NamePart. + * @implements INamePart + * @constructor + * @param {google.protobuf.UninterpretedOption.INamePart=} [properties] Properties to set + */ + function NamePart(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * NamePart namePart. + * @member {string} namePart + * @memberof google.protobuf.UninterpretedOption.NamePart + * @instance + */ + NamePart.prototype.namePart = ""; + + /** + * NamePart isExtension. + * @member {boolean} isExtension + * @memberof google.protobuf.UninterpretedOption.NamePart + * @instance + */ + NamePart.prototype.isExtension = false; + + /** + * Creates a new NamePart instance using the specified properties. + * @function create + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.INamePart=} [properties] Properties to set + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart instance + */ + NamePart.create = function create(properties) { + return new NamePart(properties); + }; + + /** + * Encodes the specified NamePart message. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @function encode + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.INamePart} message NamePart message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NamePart.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + writer.uint32(/* id 1, wireType 2 =*/10).string(message.namePart); + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.isExtension); + return writer; + }; + + /** + * Encodes the specified NamePart message, length delimited. Does not implicitly {@link google.protobuf.UninterpretedOption.NamePart.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.INamePart} message NamePart message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NamePart.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NamePart message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NamePart.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.UninterpretedOption.NamePart(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.namePart = reader.string(); + break; + } + case 2: { + message.isExtension = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + if (!message.hasOwnProperty("namePart")) + throw $util.ProtocolError("missing required 'namePart'", { instance: message }); + if (!message.hasOwnProperty("isExtension")) + throw $util.ProtocolError("missing required 'isExtension'", { instance: message }); + return message; + }; + + /** + * Decodes a NamePart message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NamePart.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NamePart message. + * @function verify + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NamePart.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (!$util.isString(message.namePart)) + return "namePart: string expected"; + if (typeof message.isExtension !== "boolean") + return "isExtension: boolean expected"; + return null; + }; + + /** + * Creates a NamePart message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.UninterpretedOption.NamePart} NamePart + */ + NamePart.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.UninterpretedOption.NamePart) + return object; + var message = new $root.google.protobuf.UninterpretedOption.NamePart(); + if (object.namePart != null) + message.namePart = String(object.namePart); + if (object.isExtension != null) + message.isExtension = Boolean(object.isExtension); + return message; + }; + + /** + * Creates a plain object from a NamePart message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {google.protobuf.UninterpretedOption.NamePart} message NamePart + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NamePart.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.namePart = ""; + object.isExtension = false; + } + if (message.namePart != null && message.hasOwnProperty("namePart")) + object.namePart = message.namePart; + if (message.isExtension != null && message.hasOwnProperty("isExtension")) + object.isExtension = message.isExtension; + return object; + }; + + /** + * Converts this NamePart to JSON. + * @function toJSON + * @memberof google.protobuf.UninterpretedOption.NamePart + * @instance + * @returns {Object.} JSON object + */ + NamePart.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for NamePart + * @function getTypeUrl + * @memberof google.protobuf.UninterpretedOption.NamePart + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + NamePart.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.UninterpretedOption.NamePart"; + }; + + return NamePart; + })(); + + return UninterpretedOption; + })(); + + protobuf.FeatureSet = (function() { + + /** + * Properties of a FeatureSet. + * @memberof google.protobuf + * @interface IFeatureSet + * @property {google.protobuf.FeatureSet.FieldPresence|null} [fieldPresence] FeatureSet fieldPresence + * @property {google.protobuf.FeatureSet.EnumType|null} [enumType] FeatureSet enumType + * @property {google.protobuf.FeatureSet.RepeatedFieldEncoding|null} [repeatedFieldEncoding] FeatureSet repeatedFieldEncoding + * @property {google.protobuf.FeatureSet.Utf8Validation|null} [utf8Validation] FeatureSet utf8Validation + * @property {google.protobuf.FeatureSet.MessageEncoding|null} [messageEncoding] FeatureSet messageEncoding + * @property {google.protobuf.FeatureSet.JsonFormat|null} [jsonFormat] FeatureSet jsonFormat + */ + + /** + * Constructs a new FeatureSet. + * @memberof google.protobuf + * @classdesc Represents a FeatureSet. + * @implements IFeatureSet + * @constructor + * @param {google.protobuf.IFeatureSet=} [properties] Properties to set + */ + function FeatureSet(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FeatureSet fieldPresence. + * @member {google.protobuf.FeatureSet.FieldPresence} fieldPresence + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.fieldPresence = 0; + + /** + * FeatureSet enumType. + * @member {google.protobuf.FeatureSet.EnumType} enumType + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.enumType = 0; + + /** + * FeatureSet repeatedFieldEncoding. + * @member {google.protobuf.FeatureSet.RepeatedFieldEncoding} repeatedFieldEncoding + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.repeatedFieldEncoding = 0; + + /** + * FeatureSet utf8Validation. + * @member {google.protobuf.FeatureSet.Utf8Validation} utf8Validation + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.utf8Validation = 0; + + /** + * FeatureSet messageEncoding. + * @member {google.protobuf.FeatureSet.MessageEncoding} messageEncoding + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.messageEncoding = 0; + + /** + * FeatureSet jsonFormat. + * @member {google.protobuf.FeatureSet.JsonFormat} jsonFormat + * @memberof google.protobuf.FeatureSet + * @instance + */ + FeatureSet.prototype.jsonFormat = 0; + + /** + * Creates a new FeatureSet instance using the specified properties. + * @function create + * @memberof google.protobuf.FeatureSet + * @static + * @param {google.protobuf.IFeatureSet=} [properties] Properties to set + * @returns {google.protobuf.FeatureSet} FeatureSet instance + */ + FeatureSet.create = function create(properties) { + return new FeatureSet(properties); + }; + + /** + * Encodes the specified FeatureSet message. Does not implicitly {@link google.protobuf.FeatureSet.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FeatureSet + * @static + * @param {google.protobuf.IFeatureSet} message FeatureSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSet.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.fieldPresence != null && Object.hasOwnProperty.call(message, "fieldPresence")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.fieldPresence); + if (message.enumType != null && Object.hasOwnProperty.call(message, "enumType")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.enumType); + if (message.repeatedFieldEncoding != null && Object.hasOwnProperty.call(message, "repeatedFieldEncoding")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.repeatedFieldEncoding); + if (message.utf8Validation != null && Object.hasOwnProperty.call(message, "utf8Validation")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.utf8Validation); + if (message.messageEncoding != null && Object.hasOwnProperty.call(message, "messageEncoding")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.messageEncoding); + if (message.jsonFormat != null && Object.hasOwnProperty.call(message, "jsonFormat")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.jsonFormat); + return writer; + }; + + /** + * Encodes the specified FeatureSet message, length delimited. Does not implicitly {@link google.protobuf.FeatureSet.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FeatureSet + * @static + * @param {google.protobuf.IFeatureSet} message FeatureSet message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSet.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FeatureSet message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FeatureSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FeatureSet} FeatureSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSet.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSet(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.fieldPresence = reader.int32(); + break; + } + case 2: { + message.enumType = reader.int32(); + break; + } + case 3: { + message.repeatedFieldEncoding = reader.int32(); + break; + } + case 4: { + message.utf8Validation = reader.int32(); + break; + } + case 5: { + message.messageEncoding = reader.int32(); + break; + } + case 6: { + message.jsonFormat = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FeatureSet message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FeatureSet + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FeatureSet} FeatureSet + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSet.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FeatureSet message. + * @function verify + * @memberof google.protobuf.FeatureSet + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FeatureSet.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.fieldPresence != null && message.hasOwnProperty("fieldPresence")) + switch (message.fieldPresence) { + default: + return "fieldPresence: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.enumType != null && message.hasOwnProperty("enumType")) + switch (message.enumType) { + default: + return "enumType: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.repeatedFieldEncoding != null && message.hasOwnProperty("repeatedFieldEncoding")) + switch (message.repeatedFieldEncoding) { + default: + return "repeatedFieldEncoding: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.utf8Validation != null && message.hasOwnProperty("utf8Validation")) + switch (message.utf8Validation) { + default: + return "utf8Validation: enum value expected"; + case 0: + case 2: + case 3: + break; + } + if (message.messageEncoding != null && message.hasOwnProperty("messageEncoding")) + switch (message.messageEncoding) { + default: + return "messageEncoding: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.jsonFormat != null && message.hasOwnProperty("jsonFormat")) + switch (message.jsonFormat) { + default: + return "jsonFormat: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates a FeatureSet message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FeatureSet + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FeatureSet} FeatureSet + */ + FeatureSet.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FeatureSet) + return object; + var message = new $root.google.protobuf.FeatureSet(); + switch (object.fieldPresence) { + default: + if (typeof object.fieldPresence === "number") { + message.fieldPresence = object.fieldPresence; + break; + } + break; + case "FIELD_PRESENCE_UNKNOWN": + case 0: + message.fieldPresence = 0; + break; + case "EXPLICIT": + case 1: + message.fieldPresence = 1; + break; + case "IMPLICIT": + case 2: + message.fieldPresence = 2; + break; + case "LEGACY_REQUIRED": + case 3: + message.fieldPresence = 3; + break; + } + switch (object.enumType) { + default: + if (typeof object.enumType === "number") { + message.enumType = object.enumType; + break; + } + break; + case "ENUM_TYPE_UNKNOWN": + case 0: + message.enumType = 0; + break; + case "OPEN": + case 1: + message.enumType = 1; + break; + case "CLOSED": + case 2: + message.enumType = 2; + break; + } + switch (object.repeatedFieldEncoding) { + default: + if (typeof object.repeatedFieldEncoding === "number") { + message.repeatedFieldEncoding = object.repeatedFieldEncoding; + break; + } + break; + case "REPEATED_FIELD_ENCODING_UNKNOWN": + case 0: + message.repeatedFieldEncoding = 0; + break; + case "PACKED": + case 1: + message.repeatedFieldEncoding = 1; + break; + case "EXPANDED": + case 2: + message.repeatedFieldEncoding = 2; + break; + } + switch (object.utf8Validation) { + default: + if (typeof object.utf8Validation === "number") { + message.utf8Validation = object.utf8Validation; + break; + } + break; + case "UTF8_VALIDATION_UNKNOWN": + case 0: + message.utf8Validation = 0; + break; + case "VERIFY": + case 2: + message.utf8Validation = 2; + break; + case "NONE": + case 3: + message.utf8Validation = 3; + break; + } + switch (object.messageEncoding) { + default: + if (typeof object.messageEncoding === "number") { + message.messageEncoding = object.messageEncoding; + break; + } + break; + case "MESSAGE_ENCODING_UNKNOWN": + case 0: + message.messageEncoding = 0; + break; + case "LENGTH_PREFIXED": + case 1: + message.messageEncoding = 1; + break; + case "DELIMITED": + case 2: + message.messageEncoding = 2; + break; + } + switch (object.jsonFormat) { + default: + if (typeof object.jsonFormat === "number") { + message.jsonFormat = object.jsonFormat; + break; + } + break; + case "JSON_FORMAT_UNKNOWN": + case 0: + message.jsonFormat = 0; + break; + case "ALLOW": + case 1: + message.jsonFormat = 1; + break; + case "LEGACY_BEST_EFFORT": + case 2: + message.jsonFormat = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from a FeatureSet message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FeatureSet + * @static + * @param {google.protobuf.FeatureSet} message FeatureSet + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FeatureSet.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.fieldPresence = options.enums === String ? "FIELD_PRESENCE_UNKNOWN" : 0; + object.enumType = options.enums === String ? "ENUM_TYPE_UNKNOWN" : 0; + object.repeatedFieldEncoding = options.enums === String ? "REPEATED_FIELD_ENCODING_UNKNOWN" : 0; + object.utf8Validation = options.enums === String ? "UTF8_VALIDATION_UNKNOWN" : 0; + object.messageEncoding = options.enums === String ? "MESSAGE_ENCODING_UNKNOWN" : 0; + object.jsonFormat = options.enums === String ? "JSON_FORMAT_UNKNOWN" : 0; + } + if (message.fieldPresence != null && message.hasOwnProperty("fieldPresence")) + object.fieldPresence = options.enums === String ? $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] === undefined ? message.fieldPresence : $root.google.protobuf.FeatureSet.FieldPresence[message.fieldPresence] : message.fieldPresence; + if (message.enumType != null && message.hasOwnProperty("enumType")) + object.enumType = options.enums === String ? $root.google.protobuf.FeatureSet.EnumType[message.enumType] === undefined ? message.enumType : $root.google.protobuf.FeatureSet.EnumType[message.enumType] : message.enumType; + if (message.repeatedFieldEncoding != null && message.hasOwnProperty("repeatedFieldEncoding")) + object.repeatedFieldEncoding = options.enums === String ? $root.google.protobuf.FeatureSet.RepeatedFieldEncoding[message.repeatedFieldEncoding] === undefined ? message.repeatedFieldEncoding : $root.google.protobuf.FeatureSet.RepeatedFieldEncoding[message.repeatedFieldEncoding] : message.repeatedFieldEncoding; + if (message.utf8Validation != null && message.hasOwnProperty("utf8Validation")) + object.utf8Validation = options.enums === String ? $root.google.protobuf.FeatureSet.Utf8Validation[message.utf8Validation] === undefined ? message.utf8Validation : $root.google.protobuf.FeatureSet.Utf8Validation[message.utf8Validation] : message.utf8Validation; + if (message.messageEncoding != null && message.hasOwnProperty("messageEncoding")) + object.messageEncoding = options.enums === String ? $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] === undefined ? message.messageEncoding : $root.google.protobuf.FeatureSet.MessageEncoding[message.messageEncoding] : message.messageEncoding; + if (message.jsonFormat != null && message.hasOwnProperty("jsonFormat")) + object.jsonFormat = options.enums === String ? $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] === undefined ? message.jsonFormat : $root.google.protobuf.FeatureSet.JsonFormat[message.jsonFormat] : message.jsonFormat; + return object; + }; + + /** + * Converts this FeatureSet to JSON. + * @function toJSON + * @memberof google.protobuf.FeatureSet + * @instance + * @returns {Object.} JSON object + */ + FeatureSet.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FeatureSet + * @function getTypeUrl + * @memberof google.protobuf.FeatureSet + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FeatureSet.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FeatureSet"; + }; + + /** + * FieldPresence enum. + * @name google.protobuf.FeatureSet.FieldPresence + * @enum {number} + * @property {number} FIELD_PRESENCE_UNKNOWN=0 FIELD_PRESENCE_UNKNOWN value + * @property {number} EXPLICIT=1 EXPLICIT value + * @property {number} IMPLICIT=2 IMPLICIT value + * @property {number} LEGACY_REQUIRED=3 LEGACY_REQUIRED value + */ + FeatureSet.FieldPresence = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "FIELD_PRESENCE_UNKNOWN"] = 0; + values[valuesById[1] = "EXPLICIT"] = 1; + values[valuesById[2] = "IMPLICIT"] = 2; + values[valuesById[3] = "LEGACY_REQUIRED"] = 3; + return values; + })(); + + /** + * EnumType enum. + * @name google.protobuf.FeatureSet.EnumType + * @enum {number} + * @property {number} ENUM_TYPE_UNKNOWN=0 ENUM_TYPE_UNKNOWN value + * @property {number} OPEN=1 OPEN value + * @property {number} CLOSED=2 CLOSED value + */ + FeatureSet.EnumType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "ENUM_TYPE_UNKNOWN"] = 0; + values[valuesById[1] = "OPEN"] = 1; + values[valuesById[2] = "CLOSED"] = 2; + return values; + })(); + + /** + * RepeatedFieldEncoding enum. + * @name google.protobuf.FeatureSet.RepeatedFieldEncoding + * @enum {number} + * @property {number} REPEATED_FIELD_ENCODING_UNKNOWN=0 REPEATED_FIELD_ENCODING_UNKNOWN value + * @property {number} PACKED=1 PACKED value + * @property {number} EXPANDED=2 EXPANDED value + */ + FeatureSet.RepeatedFieldEncoding = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "REPEATED_FIELD_ENCODING_UNKNOWN"] = 0; + values[valuesById[1] = "PACKED"] = 1; + values[valuesById[2] = "EXPANDED"] = 2; + return values; + })(); + + /** + * Utf8Validation enum. + * @name google.protobuf.FeatureSet.Utf8Validation + * @enum {number} + * @property {number} UTF8_VALIDATION_UNKNOWN=0 UTF8_VALIDATION_UNKNOWN value + * @property {number} VERIFY=2 VERIFY value + * @property {number} NONE=3 NONE value + */ + FeatureSet.Utf8Validation = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "UTF8_VALIDATION_UNKNOWN"] = 0; + values[valuesById[2] = "VERIFY"] = 2; + values[valuesById[3] = "NONE"] = 3; + return values; + })(); + + /** + * MessageEncoding enum. + * @name google.protobuf.FeatureSet.MessageEncoding + * @enum {number} + * @property {number} MESSAGE_ENCODING_UNKNOWN=0 MESSAGE_ENCODING_UNKNOWN value + * @property {number} LENGTH_PREFIXED=1 LENGTH_PREFIXED value + * @property {number} DELIMITED=2 DELIMITED value + */ + FeatureSet.MessageEncoding = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "MESSAGE_ENCODING_UNKNOWN"] = 0; + values[valuesById[1] = "LENGTH_PREFIXED"] = 1; + values[valuesById[2] = "DELIMITED"] = 2; + return values; + })(); + + /** + * JsonFormat enum. + * @name google.protobuf.FeatureSet.JsonFormat + * @enum {number} + * @property {number} JSON_FORMAT_UNKNOWN=0 JSON_FORMAT_UNKNOWN value + * @property {number} ALLOW=1 ALLOW value + * @property {number} LEGACY_BEST_EFFORT=2 LEGACY_BEST_EFFORT value + */ + FeatureSet.JsonFormat = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "JSON_FORMAT_UNKNOWN"] = 0; + values[valuesById[1] = "ALLOW"] = 1; + values[valuesById[2] = "LEGACY_BEST_EFFORT"] = 2; + return values; + })(); + + return FeatureSet; + })(); + + protobuf.FeatureSetDefaults = (function() { + + /** + * Properties of a FeatureSetDefaults. + * @memberof google.protobuf + * @interface IFeatureSetDefaults + * @property {Array.|null} [defaults] FeatureSetDefaults defaults + * @property {google.protobuf.Edition|null} [minimumEdition] FeatureSetDefaults minimumEdition + * @property {google.protobuf.Edition|null} [maximumEdition] FeatureSetDefaults maximumEdition + */ + + /** + * Constructs a new FeatureSetDefaults. + * @memberof google.protobuf + * @classdesc Represents a FeatureSetDefaults. + * @implements IFeatureSetDefaults + * @constructor + * @param {google.protobuf.IFeatureSetDefaults=} [properties] Properties to set + */ + function FeatureSetDefaults(properties) { + this.defaults = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FeatureSetDefaults defaults. + * @member {Array.} defaults + * @memberof google.protobuf.FeatureSetDefaults + * @instance + */ + FeatureSetDefaults.prototype.defaults = $util.emptyArray; + + /** + * FeatureSetDefaults minimumEdition. + * @member {google.protobuf.Edition} minimumEdition + * @memberof google.protobuf.FeatureSetDefaults + * @instance + */ + FeatureSetDefaults.prototype.minimumEdition = 0; + + /** + * FeatureSetDefaults maximumEdition. + * @member {google.protobuf.Edition} maximumEdition + * @memberof google.protobuf.FeatureSetDefaults + * @instance + */ + FeatureSetDefaults.prototype.maximumEdition = 0; + + /** + * Creates a new FeatureSetDefaults instance using the specified properties. + * @function create + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {google.protobuf.IFeatureSetDefaults=} [properties] Properties to set + * @returns {google.protobuf.FeatureSetDefaults} FeatureSetDefaults instance + */ + FeatureSetDefaults.create = function create(properties) { + return new FeatureSetDefaults(properties); + }; + + /** + * Encodes the specified FeatureSetDefaults message. Does not implicitly {@link google.protobuf.FeatureSetDefaults.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {google.protobuf.IFeatureSetDefaults} message FeatureSetDefaults message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSetDefaults.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.defaults != null && message.defaults.length) + for (var i = 0; i < message.defaults.length; ++i) + $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.encode(message.defaults[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.minimumEdition != null && Object.hasOwnProperty.call(message, "minimumEdition")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.minimumEdition); + if (message.maximumEdition != null && Object.hasOwnProperty.call(message, "maximumEdition")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.maximumEdition); + return writer; + }; + + /** + * Encodes the specified FeatureSetDefaults message, length delimited. Does not implicitly {@link google.protobuf.FeatureSetDefaults.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {google.protobuf.IFeatureSetDefaults} message FeatureSetDefaults message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSetDefaults.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FeatureSetDefaults message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FeatureSetDefaults} FeatureSetDefaults + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSetDefaults.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSetDefaults(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.defaults && message.defaults.length)) + message.defaults = []; + message.defaults.push($root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.decode(reader, reader.uint32())); + break; + } + case 4: { + message.minimumEdition = reader.int32(); + break; + } + case 5: { + message.maximumEdition = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FeatureSetDefaults message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FeatureSetDefaults} FeatureSetDefaults + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSetDefaults.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FeatureSetDefaults message. + * @function verify + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FeatureSetDefaults.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.defaults != null && message.hasOwnProperty("defaults")) { + if (!Array.isArray(message.defaults)) + return "defaults: array expected"; + for (var i = 0; i < message.defaults.length; ++i) { + var error = $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.verify(message.defaults[i]); + if (error) + return "defaults." + error; + } + } + if (message.minimumEdition != null && message.hasOwnProperty("minimumEdition")) + switch (message.minimumEdition) { + default: + return "minimumEdition: enum value expected"; + case 0: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.maximumEdition != null && message.hasOwnProperty("maximumEdition")) + switch (message.maximumEdition) { + default: + return "maximumEdition: enum value expected"; + case 0: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + return null; + }; + + /** + * Creates a FeatureSetDefaults message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FeatureSetDefaults} FeatureSetDefaults + */ + FeatureSetDefaults.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FeatureSetDefaults) + return object; + var message = new $root.google.protobuf.FeatureSetDefaults(); + if (object.defaults) { + if (!Array.isArray(object.defaults)) + throw TypeError(".google.protobuf.FeatureSetDefaults.defaults: array expected"); + message.defaults = []; + for (var i = 0; i < object.defaults.length; ++i) { + if (typeof object.defaults[i] !== "object") + throw TypeError(".google.protobuf.FeatureSetDefaults.defaults: object expected"); + message.defaults[i] = $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.fromObject(object.defaults[i]); + } + } + switch (object.minimumEdition) { + default: + if (typeof object.minimumEdition === "number") { + message.minimumEdition = object.minimumEdition; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.minimumEdition = 0; + break; + case "EDITION_PROTO2": + case 998: + message.minimumEdition = 998; + break; + case "EDITION_PROTO3": + case 999: + message.minimumEdition = 999; + break; + case "EDITION_2023": + case 1000: + message.minimumEdition = 1000; + break; + case "EDITION_2024": + case 1001: + message.minimumEdition = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.minimumEdition = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.minimumEdition = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.minimumEdition = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.minimumEdition = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.minimumEdition = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.minimumEdition = 2147483647; + break; + } + switch (object.maximumEdition) { + default: + if (typeof object.maximumEdition === "number") { + message.maximumEdition = object.maximumEdition; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.maximumEdition = 0; + break; + case "EDITION_PROTO2": + case 998: + message.maximumEdition = 998; + break; + case "EDITION_PROTO3": + case 999: + message.maximumEdition = 999; + break; + case "EDITION_2023": + case 1000: + message.maximumEdition = 1000; + break; + case "EDITION_2024": + case 1001: + message.maximumEdition = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.maximumEdition = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.maximumEdition = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.maximumEdition = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.maximumEdition = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.maximumEdition = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.maximumEdition = 2147483647; + break; + } + return message; + }; + + /** + * Creates a plain object from a FeatureSetDefaults message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {google.protobuf.FeatureSetDefaults} message FeatureSetDefaults + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FeatureSetDefaults.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.defaults = []; + if (options.defaults) { + object.minimumEdition = options.enums === String ? "EDITION_UNKNOWN" : 0; + object.maximumEdition = options.enums === String ? "EDITION_UNKNOWN" : 0; + } + if (message.defaults && message.defaults.length) { + object.defaults = []; + for (var j = 0; j < message.defaults.length; ++j) + object.defaults[j] = $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.toObject(message.defaults[j], options); + } + if (message.minimumEdition != null && message.hasOwnProperty("minimumEdition")) + object.minimumEdition = options.enums === String ? $root.google.protobuf.Edition[message.minimumEdition] === undefined ? message.minimumEdition : $root.google.protobuf.Edition[message.minimumEdition] : message.minimumEdition; + if (message.maximumEdition != null && message.hasOwnProperty("maximumEdition")) + object.maximumEdition = options.enums === String ? $root.google.protobuf.Edition[message.maximumEdition] === undefined ? message.maximumEdition : $root.google.protobuf.Edition[message.maximumEdition] : message.maximumEdition; + return object; + }; + + /** + * Converts this FeatureSetDefaults to JSON. + * @function toJSON + * @memberof google.protobuf.FeatureSetDefaults + * @instance + * @returns {Object.} JSON object + */ + FeatureSetDefaults.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FeatureSetDefaults + * @function getTypeUrl + * @memberof google.protobuf.FeatureSetDefaults + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FeatureSetDefaults.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FeatureSetDefaults"; + }; + + FeatureSetDefaults.FeatureSetEditionDefault = (function() { + + /** + * Properties of a FeatureSetEditionDefault. + * @memberof google.protobuf.FeatureSetDefaults + * @interface IFeatureSetEditionDefault + * @property {google.protobuf.Edition|null} [edition] FeatureSetEditionDefault edition + * @property {google.protobuf.IFeatureSet|null} [features] FeatureSetEditionDefault features + */ + + /** + * Constructs a new FeatureSetEditionDefault. + * @memberof google.protobuf.FeatureSetDefaults + * @classdesc Represents a FeatureSetEditionDefault. + * @implements IFeatureSetEditionDefault + * @constructor + * @param {google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault=} [properties] Properties to set + */ + function FeatureSetEditionDefault(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FeatureSetEditionDefault edition. + * @member {google.protobuf.Edition} edition + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @instance + */ + FeatureSetEditionDefault.prototype.edition = 0; + + /** + * FeatureSetEditionDefault features. + * @member {google.protobuf.IFeatureSet|null|undefined} features + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @instance + */ + FeatureSetEditionDefault.prototype.features = null; + + /** + * Creates a new FeatureSetEditionDefault instance using the specified properties. + * @function create + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault=} [properties] Properties to set + * @returns {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} FeatureSetEditionDefault instance + */ + FeatureSetEditionDefault.create = function create(properties) { + return new FeatureSetEditionDefault(properties); + }; + + /** + * Encodes the specified FeatureSetEditionDefault message. Does not implicitly {@link google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault} message FeatureSetEditionDefault message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSetEditionDefault.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.features != null && Object.hasOwnProperty.call(message, "features")) + $root.google.protobuf.FeatureSet.encode(message.features, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.edition != null && Object.hasOwnProperty.call(message, "edition")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.edition); + return writer; + }; + + /** + * Encodes the specified FeatureSetEditionDefault message, length delimited. Does not implicitly {@link google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {google.protobuf.FeatureSetDefaults.IFeatureSetEditionDefault} message FeatureSetEditionDefault message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FeatureSetEditionDefault.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FeatureSetEditionDefault message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} FeatureSetEditionDefault + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSetEditionDefault.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 3: { + message.edition = reader.int32(); + break; + } + case 2: { + message.features = $root.google.protobuf.FeatureSet.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FeatureSetEditionDefault message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} FeatureSetEditionDefault + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FeatureSetEditionDefault.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FeatureSetEditionDefault message. + * @function verify + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FeatureSetEditionDefault.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.edition != null && message.hasOwnProperty("edition")) + switch (message.edition) { + default: + return "edition: enum value expected"; + case 0: + case 998: + case 999: + case 1000: + case 1001: + case 1: + case 2: + case 99997: + case 99998: + case 99999: + case 2147483647: + break; + } + if (message.features != null && message.hasOwnProperty("features")) { + var error = $root.google.protobuf.FeatureSet.verify(message.features); + if (error) + return "features." + error; + } + return null; + }; + + /** + * Creates a FeatureSetEditionDefault message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} FeatureSetEditionDefault + */ + FeatureSetEditionDefault.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault) + return object; + var message = new $root.google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault(); + switch (object.edition) { + default: + if (typeof object.edition === "number") { + message.edition = object.edition; + break; + } + break; + case "EDITION_UNKNOWN": + case 0: + message.edition = 0; + break; + case "EDITION_PROTO2": + case 998: + message.edition = 998; + break; + case "EDITION_PROTO3": + case 999: + message.edition = 999; + break; + case "EDITION_2023": + case 1000: + message.edition = 1000; + break; + case "EDITION_2024": + case 1001: + message.edition = 1001; + break; + case "EDITION_1_TEST_ONLY": + case 1: + message.edition = 1; + break; + case "EDITION_2_TEST_ONLY": + case 2: + message.edition = 2; + break; + case "EDITION_99997_TEST_ONLY": + case 99997: + message.edition = 99997; + break; + case "EDITION_99998_TEST_ONLY": + case 99998: + message.edition = 99998; + break; + case "EDITION_99999_TEST_ONLY": + case 99999: + message.edition = 99999; + break; + case "EDITION_MAX": + case 2147483647: + message.edition = 2147483647; + break; + } + if (object.features != null) { + if (typeof object.features !== "object") + throw TypeError(".google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault.features: object expected"); + message.features = $root.google.protobuf.FeatureSet.fromObject(object.features); + } + return message; + }; + + /** + * Creates a plain object from a FeatureSetEditionDefault message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault} message FeatureSetEditionDefault + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FeatureSetEditionDefault.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.features = null; + object.edition = options.enums === String ? "EDITION_UNKNOWN" : 0; + } + if (message.features != null && message.hasOwnProperty("features")) + object.features = $root.google.protobuf.FeatureSet.toObject(message.features, options); + if (message.edition != null && message.hasOwnProperty("edition")) + object.edition = options.enums === String ? $root.google.protobuf.Edition[message.edition] === undefined ? message.edition : $root.google.protobuf.Edition[message.edition] : message.edition; + return object; + }; + + /** + * Converts this FeatureSetEditionDefault to JSON. + * @function toJSON + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @instance + * @returns {Object.} JSON object + */ + FeatureSetEditionDefault.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FeatureSetEditionDefault + * @function getTypeUrl + * @memberof google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FeatureSetEditionDefault.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FeatureSetDefaults.FeatureSetEditionDefault"; + }; + + return FeatureSetEditionDefault; + })(); + + return FeatureSetDefaults; + })(); + + protobuf.SourceCodeInfo = (function() { + + /** + * Properties of a SourceCodeInfo. + * @memberof google.protobuf + * @interface ISourceCodeInfo + * @property {Array.|null} [location] SourceCodeInfo location + */ + + /** + * Constructs a new SourceCodeInfo. + * @memberof google.protobuf + * @classdesc Represents a SourceCodeInfo. + * @implements ISourceCodeInfo + * @constructor + * @param {google.protobuf.ISourceCodeInfo=} [properties] Properties to set + */ + function SourceCodeInfo(properties) { + this.location = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SourceCodeInfo location. + * @member {Array.} location + * @memberof google.protobuf.SourceCodeInfo + * @instance + */ + SourceCodeInfo.prototype.location = $util.emptyArray; + + /** + * Creates a new SourceCodeInfo instance using the specified properties. + * @function create + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {google.protobuf.ISourceCodeInfo=} [properties] Properties to set + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo instance + */ + SourceCodeInfo.create = function create(properties) { + return new SourceCodeInfo(properties); + }; + + /** + * Encodes the specified SourceCodeInfo message. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * @function encode + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {google.protobuf.ISourceCodeInfo} message SourceCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SourceCodeInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.location != null && message.location.length) + for (var i = 0; i < message.location.length; ++i) + $root.google.protobuf.SourceCodeInfo.Location.encode(message.location[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified SourceCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {google.protobuf.ISourceCodeInfo} message SourceCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SourceCodeInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SourceCodeInfo message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SourceCodeInfo.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.SourceCodeInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.location && message.location.length)) + message.location = []; + message.location.push($root.google.protobuf.SourceCodeInfo.Location.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SourceCodeInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SourceCodeInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SourceCodeInfo message. + * @function verify + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SourceCodeInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.location != null && message.hasOwnProperty("location")) { + if (!Array.isArray(message.location)) + return "location: array expected"; + for (var i = 0; i < message.location.length; ++i) { + var error = $root.google.protobuf.SourceCodeInfo.Location.verify(message.location[i]); + if (error) + return "location." + error; + } + } + return null; + }; + + /** + * Creates a SourceCodeInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.SourceCodeInfo} SourceCodeInfo + */ + SourceCodeInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.SourceCodeInfo) + return object; + var message = new $root.google.protobuf.SourceCodeInfo(); + if (object.location) { + if (!Array.isArray(object.location)) + throw TypeError(".google.protobuf.SourceCodeInfo.location: array expected"); + message.location = []; + for (var i = 0; i < object.location.length; ++i) { + if (typeof object.location[i] !== "object") + throw TypeError(".google.protobuf.SourceCodeInfo.location: object expected"); + message.location[i] = $root.google.protobuf.SourceCodeInfo.Location.fromObject(object.location[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a SourceCodeInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {google.protobuf.SourceCodeInfo} message SourceCodeInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SourceCodeInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.location = []; + if (message.location && message.location.length) { + object.location = []; + for (var j = 0; j < message.location.length; ++j) + object.location[j] = $root.google.protobuf.SourceCodeInfo.Location.toObject(message.location[j], options); + } + return object; + }; + + /** + * Converts this SourceCodeInfo to JSON. + * @function toJSON + * @memberof google.protobuf.SourceCodeInfo + * @instance + * @returns {Object.} JSON object + */ + SourceCodeInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SourceCodeInfo + * @function getTypeUrl + * @memberof google.protobuf.SourceCodeInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SourceCodeInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.SourceCodeInfo"; + }; + + SourceCodeInfo.Location = (function() { + + /** + * Properties of a Location. + * @memberof google.protobuf.SourceCodeInfo + * @interface ILocation + * @property {Array.|null} [path] Location path + * @property {Array.|null} [span] Location span + * @property {string|null} [leadingComments] Location leadingComments + * @property {string|null} [trailingComments] Location trailingComments + * @property {Array.|null} [leadingDetachedComments] Location leadingDetachedComments + */ + + /** + * Constructs a new Location. + * @memberof google.protobuf.SourceCodeInfo + * @classdesc Represents a Location. + * @implements ILocation + * @constructor + * @param {google.protobuf.SourceCodeInfo.ILocation=} [properties] Properties to set + */ + function Location(properties) { + this.path = []; + this.span = []; + this.leadingDetachedComments = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Location path. + * @member {Array.} path + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.path = $util.emptyArray; + + /** + * Location span. + * @member {Array.} span + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.span = $util.emptyArray; + + /** + * Location leadingComments. + * @member {string} leadingComments + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.leadingComments = ""; + + /** + * Location trailingComments. + * @member {string} trailingComments + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.trailingComments = ""; + + /** + * Location leadingDetachedComments. + * @member {Array.} leadingDetachedComments + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + */ + Location.prototype.leadingDetachedComments = $util.emptyArray; + + /** + * Creates a new Location instance using the specified properties. + * @function create + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.ILocation=} [properties] Properties to set + * @returns {google.protobuf.SourceCodeInfo.Location} Location instance + */ + Location.create = function create(properties) { + return new Location(properties); + }; + + /** + * Encodes the specified Location message. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @function encode + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.ILocation} message Location message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Location.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.path != null && message.path.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.path.length; ++i) + writer.int32(message.path[i]); + writer.ldelim(); + } + if (message.span != null && message.span.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.span.length; ++i) + writer.int32(message.span[i]); + writer.ldelim(); + } + if (message.leadingComments != null && Object.hasOwnProperty.call(message, "leadingComments")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.leadingComments); + if (message.trailingComments != null && Object.hasOwnProperty.call(message, "trailingComments")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.trailingComments); + if (message.leadingDetachedComments != null && message.leadingDetachedComments.length) + for (var i = 0; i < message.leadingDetachedComments.length; ++i) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.leadingDetachedComments[i]); + return writer; + }; + + /** + * Encodes the specified Location message, length delimited. Does not implicitly {@link google.protobuf.SourceCodeInfo.Location.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.ILocation} message Location message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Location.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Location message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.SourceCodeInfo.Location} Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Location.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.SourceCodeInfo.Location(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.path && message.path.length)) + message.path = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.path.push(reader.int32()); + } else + message.path.push(reader.int32()); + break; + } + case 2: { + if (!(message.span && message.span.length)) + message.span = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.span.push(reader.int32()); + } else + message.span.push(reader.int32()); + break; + } + case 3: { + message.leadingComments = reader.string(); + break; + } + case 4: { + message.trailingComments = reader.string(); + break; + } + case 6: { + if (!(message.leadingDetachedComments && message.leadingDetachedComments.length)) + message.leadingDetachedComments = []; + message.leadingDetachedComments.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Location message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.SourceCodeInfo.Location} Location + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Location.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Location message. + * @function verify + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Location.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.path != null && message.hasOwnProperty("path")) { + if (!Array.isArray(message.path)) + return "path: array expected"; + for (var i = 0; i < message.path.length; ++i) + if (!$util.isInteger(message.path[i])) + return "path: integer[] expected"; + } + if (message.span != null && message.hasOwnProperty("span")) { + if (!Array.isArray(message.span)) + return "span: array expected"; + for (var i = 0; i < message.span.length; ++i) + if (!$util.isInteger(message.span[i])) + return "span: integer[] expected"; + } + if (message.leadingComments != null && message.hasOwnProperty("leadingComments")) + if (!$util.isString(message.leadingComments)) + return "leadingComments: string expected"; + if (message.trailingComments != null && message.hasOwnProperty("trailingComments")) + if (!$util.isString(message.trailingComments)) + return "trailingComments: string expected"; + if (message.leadingDetachedComments != null && message.hasOwnProperty("leadingDetachedComments")) { + if (!Array.isArray(message.leadingDetachedComments)) + return "leadingDetachedComments: array expected"; + for (var i = 0; i < message.leadingDetachedComments.length; ++i) + if (!$util.isString(message.leadingDetachedComments[i])) + return "leadingDetachedComments: string[] expected"; + } + return null; + }; + + /** + * Creates a Location message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.SourceCodeInfo.Location} Location + */ + Location.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.SourceCodeInfo.Location) + return object; + var message = new $root.google.protobuf.SourceCodeInfo.Location(); + if (object.path) { + if (!Array.isArray(object.path)) + throw TypeError(".google.protobuf.SourceCodeInfo.Location.path: array expected"); + message.path = []; + for (var i = 0; i < object.path.length; ++i) + message.path[i] = object.path[i] | 0; + } + if (object.span) { + if (!Array.isArray(object.span)) + throw TypeError(".google.protobuf.SourceCodeInfo.Location.span: array expected"); + message.span = []; + for (var i = 0; i < object.span.length; ++i) + message.span[i] = object.span[i] | 0; + } + if (object.leadingComments != null) + message.leadingComments = String(object.leadingComments); + if (object.trailingComments != null) + message.trailingComments = String(object.trailingComments); + if (object.leadingDetachedComments) { + if (!Array.isArray(object.leadingDetachedComments)) + throw TypeError(".google.protobuf.SourceCodeInfo.Location.leadingDetachedComments: array expected"); + message.leadingDetachedComments = []; + for (var i = 0; i < object.leadingDetachedComments.length; ++i) + message.leadingDetachedComments[i] = String(object.leadingDetachedComments[i]); + } + return message; + }; + + /** + * Creates a plain object from a Location message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {google.protobuf.SourceCodeInfo.Location} message Location + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Location.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.path = []; + object.span = []; + object.leadingDetachedComments = []; + } + if (options.defaults) { + object.leadingComments = ""; + object.trailingComments = ""; + } + if (message.path && message.path.length) { + object.path = []; + for (var j = 0; j < message.path.length; ++j) + object.path[j] = message.path[j]; + } + if (message.span && message.span.length) { + object.span = []; + for (var j = 0; j < message.span.length; ++j) + object.span[j] = message.span[j]; + } + if (message.leadingComments != null && message.hasOwnProperty("leadingComments")) + object.leadingComments = message.leadingComments; + if (message.trailingComments != null && message.hasOwnProperty("trailingComments")) + object.trailingComments = message.trailingComments; + if (message.leadingDetachedComments && message.leadingDetachedComments.length) { + object.leadingDetachedComments = []; + for (var j = 0; j < message.leadingDetachedComments.length; ++j) + object.leadingDetachedComments[j] = message.leadingDetachedComments[j]; + } + return object; + }; + + /** + * Converts this Location to JSON. + * @function toJSON + * @memberof google.protobuf.SourceCodeInfo.Location + * @instance + * @returns {Object.} JSON object + */ + Location.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Location + * @function getTypeUrl + * @memberof google.protobuf.SourceCodeInfo.Location + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Location.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.SourceCodeInfo.Location"; + }; + + return Location; + })(); + + return SourceCodeInfo; + })(); + + protobuf.GeneratedCodeInfo = (function() { + + /** + * Properties of a GeneratedCodeInfo. + * @memberof google.protobuf + * @interface IGeneratedCodeInfo + * @property {Array.|null} [annotation] GeneratedCodeInfo annotation + */ + + /** + * Constructs a new GeneratedCodeInfo. + * @memberof google.protobuf + * @classdesc Represents a GeneratedCodeInfo. + * @implements IGeneratedCodeInfo + * @constructor + * @param {google.protobuf.IGeneratedCodeInfo=} [properties] Properties to set + */ + function GeneratedCodeInfo(properties) { + this.annotation = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GeneratedCodeInfo annotation. + * @member {Array.} annotation + * @memberof google.protobuf.GeneratedCodeInfo + * @instance + */ + GeneratedCodeInfo.prototype.annotation = $util.emptyArray; + + /** + * Creates a new GeneratedCodeInfo instance using the specified properties. + * @function create + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {google.protobuf.IGeneratedCodeInfo=} [properties] Properties to set + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo instance + */ + GeneratedCodeInfo.create = function create(properties) { + return new GeneratedCodeInfo(properties); + }; + + /** + * Encodes the specified GeneratedCodeInfo message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * @function encode + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {google.protobuf.IGeneratedCodeInfo} message GeneratedCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GeneratedCodeInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.annotation != null && message.annotation.length) + for (var i = 0; i < message.annotation.length; ++i) + $root.google.protobuf.GeneratedCodeInfo.Annotation.encode(message.annotation[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GeneratedCodeInfo message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {google.protobuf.IGeneratedCodeInfo} message GeneratedCodeInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GeneratedCodeInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GeneratedCodeInfo message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GeneratedCodeInfo.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.GeneratedCodeInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.annotation && message.annotation.length)) + message.annotation = []; + message.annotation.push($root.google.protobuf.GeneratedCodeInfo.Annotation.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GeneratedCodeInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GeneratedCodeInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GeneratedCodeInfo message. + * @function verify + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GeneratedCodeInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.annotation != null && message.hasOwnProperty("annotation")) { + if (!Array.isArray(message.annotation)) + return "annotation: array expected"; + for (var i = 0; i < message.annotation.length; ++i) { + var error = $root.google.protobuf.GeneratedCodeInfo.Annotation.verify(message.annotation[i]); + if (error) + return "annotation." + error; + } + } + return null; + }; + + /** + * Creates a GeneratedCodeInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.GeneratedCodeInfo} GeneratedCodeInfo + */ + GeneratedCodeInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.GeneratedCodeInfo) + return object; + var message = new $root.google.protobuf.GeneratedCodeInfo(); + if (object.annotation) { + if (!Array.isArray(object.annotation)) + throw TypeError(".google.protobuf.GeneratedCodeInfo.annotation: array expected"); + message.annotation = []; + for (var i = 0; i < object.annotation.length; ++i) { + if (typeof object.annotation[i] !== "object") + throw TypeError(".google.protobuf.GeneratedCodeInfo.annotation: object expected"); + message.annotation[i] = $root.google.protobuf.GeneratedCodeInfo.Annotation.fromObject(object.annotation[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a GeneratedCodeInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {google.protobuf.GeneratedCodeInfo} message GeneratedCodeInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GeneratedCodeInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.annotation = []; + if (message.annotation && message.annotation.length) { + object.annotation = []; + for (var j = 0; j < message.annotation.length; ++j) + object.annotation[j] = $root.google.protobuf.GeneratedCodeInfo.Annotation.toObject(message.annotation[j], options); + } + return object; + }; + + /** + * Converts this GeneratedCodeInfo to JSON. + * @function toJSON + * @memberof google.protobuf.GeneratedCodeInfo + * @instance + * @returns {Object.} JSON object + */ + GeneratedCodeInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GeneratedCodeInfo + * @function getTypeUrl + * @memberof google.protobuf.GeneratedCodeInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GeneratedCodeInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.GeneratedCodeInfo"; + }; + + GeneratedCodeInfo.Annotation = (function() { + + /** + * Properties of an Annotation. + * @memberof google.protobuf.GeneratedCodeInfo + * @interface IAnnotation + * @property {Array.|null} [path] Annotation path + * @property {string|null} [sourceFile] Annotation sourceFile + * @property {number|null} [begin] Annotation begin + * @property {number|null} [end] Annotation end + * @property {google.protobuf.GeneratedCodeInfo.Annotation.Semantic|null} [semantic] Annotation semantic + */ + + /** + * Constructs a new Annotation. + * @memberof google.protobuf.GeneratedCodeInfo + * @classdesc Represents an Annotation. + * @implements IAnnotation + * @constructor + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation=} [properties] Properties to set + */ + function Annotation(properties) { + this.path = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Annotation path. + * @member {Array.} path + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.path = $util.emptyArray; + + /** + * Annotation sourceFile. + * @member {string} sourceFile + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.sourceFile = ""; + + /** + * Annotation begin. + * @member {number} begin + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.begin = 0; + + /** + * Annotation end. + * @member {number} end + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.end = 0; + + /** + * Annotation semantic. + * @member {google.protobuf.GeneratedCodeInfo.Annotation.Semantic} semantic + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + */ + Annotation.prototype.semantic = 0; + + /** + * Creates a new Annotation instance using the specified properties. + * @function create + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation=} [properties] Properties to set + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation instance + */ + Annotation.create = function create(properties) { + return new Annotation(properties); + }; + + /** + * Encodes the specified Annotation message. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @function encode + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation} message Annotation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Annotation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.path != null && message.path.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.path.length; ++i) + writer.int32(message.path[i]); + writer.ldelim(); + } + if (message.sourceFile != null && Object.hasOwnProperty.call(message, "sourceFile")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.sourceFile); + if (message.begin != null && Object.hasOwnProperty.call(message, "begin")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.begin); + if (message.end != null && Object.hasOwnProperty.call(message, "end")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.end); + if (message.semantic != null && Object.hasOwnProperty.call(message, "semantic")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.semantic); + return writer; + }; + + /** + * Encodes the specified Annotation message, length delimited. Does not implicitly {@link google.protobuf.GeneratedCodeInfo.Annotation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.IAnnotation} message Annotation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Annotation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Annotation message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Annotation.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.GeneratedCodeInfo.Annotation(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.path && message.path.length)) + message.path = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.path.push(reader.int32()); + } else + message.path.push(reader.int32()); + break; + } + case 2: { + message.sourceFile = reader.string(); + break; + } + case 3: { + message.begin = reader.int32(); + break; + } + case 4: { + message.end = reader.int32(); + break; + } + case 5: { + message.semantic = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Annotation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Annotation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Annotation message. + * @function verify + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Annotation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.path != null && message.hasOwnProperty("path")) { + if (!Array.isArray(message.path)) + return "path: array expected"; + for (var i = 0; i < message.path.length; ++i) + if (!$util.isInteger(message.path[i])) + return "path: integer[] expected"; + } + if (message.sourceFile != null && message.hasOwnProperty("sourceFile")) + if (!$util.isString(message.sourceFile)) + return "sourceFile: string expected"; + if (message.begin != null && message.hasOwnProperty("begin")) + if (!$util.isInteger(message.begin)) + return "begin: integer expected"; + if (message.end != null && message.hasOwnProperty("end")) + if (!$util.isInteger(message.end)) + return "end: integer expected"; + if (message.semantic != null && message.hasOwnProperty("semantic")) + switch (message.semantic) { + default: + return "semantic: enum value expected"; + case 0: + case 1: + case 2: + break; + } + return null; + }; + + /** + * Creates an Annotation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.GeneratedCodeInfo.Annotation} Annotation + */ + Annotation.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.GeneratedCodeInfo.Annotation) + return object; + var message = new $root.google.protobuf.GeneratedCodeInfo.Annotation(); + if (object.path) { + if (!Array.isArray(object.path)) + throw TypeError(".google.protobuf.GeneratedCodeInfo.Annotation.path: array expected"); + message.path = []; + for (var i = 0; i < object.path.length; ++i) + message.path[i] = object.path[i] | 0; + } + if (object.sourceFile != null) + message.sourceFile = String(object.sourceFile); + if (object.begin != null) + message.begin = object.begin | 0; + if (object.end != null) + message.end = object.end | 0; + switch (object.semantic) { + default: + if (typeof object.semantic === "number") { + message.semantic = object.semantic; + break; + } + break; + case "NONE": + case 0: + message.semantic = 0; + break; + case "SET": + case 1: + message.semantic = 1; + break; + case "ALIAS": + case 2: + message.semantic = 2; + break; + } + return message; + }; + + /** + * Creates a plain object from an Annotation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {google.protobuf.GeneratedCodeInfo.Annotation} message Annotation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Annotation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.path = []; + if (options.defaults) { + object.sourceFile = ""; + object.begin = 0; + object.end = 0; + object.semantic = options.enums === String ? "NONE" : 0; + } + if (message.path && message.path.length) { + object.path = []; + for (var j = 0; j < message.path.length; ++j) + object.path[j] = message.path[j]; + } + if (message.sourceFile != null && message.hasOwnProperty("sourceFile")) + object.sourceFile = message.sourceFile; + if (message.begin != null && message.hasOwnProperty("begin")) + object.begin = message.begin; + if (message.end != null && message.hasOwnProperty("end")) + object.end = message.end; + if (message.semantic != null && message.hasOwnProperty("semantic")) + object.semantic = options.enums === String ? $root.google.protobuf.GeneratedCodeInfo.Annotation.Semantic[message.semantic] === undefined ? message.semantic : $root.google.protobuf.GeneratedCodeInfo.Annotation.Semantic[message.semantic] : message.semantic; + return object; + }; + + /** + * Converts this Annotation to JSON. + * @function toJSON + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @instance + * @returns {Object.} JSON object + */ + Annotation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Annotation + * @function getTypeUrl + * @memberof google.protobuf.GeneratedCodeInfo.Annotation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Annotation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.GeneratedCodeInfo.Annotation"; + }; + + /** + * Semantic enum. + * @name google.protobuf.GeneratedCodeInfo.Annotation.Semantic + * @enum {number} + * @property {number} NONE=0 NONE value + * @property {number} SET=1 SET value + * @property {number} ALIAS=2 ALIAS value + */ + Annotation.Semantic = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "NONE"] = 0; + values[valuesById[1] = "SET"] = 1; + values[valuesById[2] = "ALIAS"] = 2; + return values; + })(); + + return Annotation; + })(); + + return GeneratedCodeInfo; + })(); + + protobuf.Struct = (function() { + + /** + * Properties of a Struct. + * @memberof google.protobuf + * @interface IStruct + * @property {Object.|null} [fields] Struct fields + */ + + /** + * Constructs a new Struct. + * @memberof google.protobuf + * @classdesc Represents a Struct. + * @implements IStruct + * @constructor + * @param {google.protobuf.IStruct=} [properties] Properties to set + */ + function Struct(properties) { + this.fields = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Struct fields. + * @member {Object.} fields + * @memberof google.protobuf.Struct + * @instance + */ + Struct.prototype.fields = $util.emptyObject; + + /** + * Creates a new Struct instance using the specified properties. + * @function create + * @memberof google.protobuf.Struct + * @static + * @param {google.protobuf.IStruct=} [properties] Properties to set + * @returns {google.protobuf.Struct} Struct instance + */ + Struct.create = function create(properties) { + return new Struct(properties); + }; + + /** + * Encodes the specified Struct message. Does not implicitly {@link google.protobuf.Struct.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Struct + * @static + * @param {google.protobuf.IStruct} message Struct message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Struct.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.fields != null && Object.hasOwnProperty.call(message, "fields")) + for (var keys = Object.keys(message.fields), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 1, wireType 2 =*/10).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]); + $root.google.protobuf.Value.encode(message.fields[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified Struct message, length delimited. Does not implicitly {@link google.protobuf.Struct.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Struct + * @static + * @param {google.protobuf.IStruct} message Struct message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Struct.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Struct message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Struct + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Struct} Struct + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Struct.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Struct(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (message.fields === $util.emptyObject) + message.fields = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = $root.google.protobuf.Value.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.fields[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Struct message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Struct + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Struct} Struct + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Struct.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Struct message. + * @function verify + * @memberof google.protobuf.Struct + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Struct.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.fields != null && message.hasOwnProperty("fields")) { + if (!$util.isObject(message.fields)) + return "fields: object expected"; + var key = Object.keys(message.fields); + for (var i = 0; i < key.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.fields[key[i]]); + if (error) + return "fields." + error; + } + } + return null; + }; + + /** + * Creates a Struct message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Struct + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Struct} Struct + */ + Struct.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Struct) + return object; + var message = new $root.google.protobuf.Struct(); + if (object.fields) { + if (typeof object.fields !== "object") + throw TypeError(".google.protobuf.Struct.fields: object expected"); + message.fields = {}; + for (var keys = Object.keys(object.fields), i = 0; i < keys.length; ++i) { + if (typeof object.fields[keys[i]] !== "object") + throw TypeError(".google.protobuf.Struct.fields: object expected"); + message.fields[keys[i]] = $root.google.protobuf.Value.fromObject(object.fields[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a Struct message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Struct + * @static + * @param {google.protobuf.Struct} message Struct + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Struct.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.fields = {}; + var keys2; + if (message.fields && (keys2 = Object.keys(message.fields)).length) { + object.fields = {}; + for (var j = 0; j < keys2.length; ++j) + object.fields[keys2[j]] = $root.google.protobuf.Value.toObject(message.fields[keys2[j]], options); + } + return object; + }; + + /** + * Converts this Struct to JSON. + * @function toJSON + * @memberof google.protobuf.Struct + * @instance + * @returns {Object.} JSON object + */ + Struct.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Struct + * @function getTypeUrl + * @memberof google.protobuf.Struct + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Struct.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Struct"; + }; + + return Struct; + })(); + + protobuf.Value = (function() { + + /** + * Properties of a Value. + * @memberof google.protobuf + * @interface IValue + * @property {google.protobuf.NullValue|null} [nullValue] Value nullValue + * @property {number|null} [numberValue] Value numberValue + * @property {string|null} [stringValue] Value stringValue + * @property {boolean|null} [boolValue] Value boolValue + * @property {google.protobuf.IStruct|null} [structValue] Value structValue + * @property {google.protobuf.IListValue|null} [listValue] Value listValue + */ + + /** + * Constructs a new Value. + * @memberof google.protobuf + * @classdesc Represents a Value. + * @implements IValue + * @constructor + * @param {google.protobuf.IValue=} [properties] Properties to set + */ + function Value(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Value nullValue. + * @member {google.protobuf.NullValue|null|undefined} nullValue + * @memberof google.protobuf.Value + * @instance + */ + Value.prototype.nullValue = null; + + /** + * Value numberValue. + * @member {number|null|undefined} numberValue + * @memberof google.protobuf.Value + * @instance + */ + Value.prototype.numberValue = null; + + /** + * Value stringValue. + * @member {string|null|undefined} stringValue + * @memberof google.protobuf.Value + * @instance + */ + Value.prototype.stringValue = null; + + /** + * Value boolValue. + * @member {boolean|null|undefined} boolValue + * @memberof google.protobuf.Value + * @instance + */ + Value.prototype.boolValue = null; + + /** + * Value structValue. + * @member {google.protobuf.IStruct|null|undefined} structValue + * @memberof google.protobuf.Value + * @instance + */ + Value.prototype.structValue = null; + + /** + * Value listValue. + * @member {google.protobuf.IListValue|null|undefined} listValue + * @memberof google.protobuf.Value + * @instance + */ + Value.prototype.listValue = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Value kind. + * @member {"nullValue"|"numberValue"|"stringValue"|"boolValue"|"structValue"|"listValue"|undefined} kind + * @memberof google.protobuf.Value + * @instance + */ + Object.defineProperty(Value.prototype, "kind", { + get: $util.oneOfGetter($oneOfFields = ["nullValue", "numberValue", "stringValue", "boolValue", "structValue", "listValue"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Value instance using the specified properties. + * @function create + * @memberof google.protobuf.Value + * @static + * @param {google.protobuf.IValue=} [properties] Properties to set + * @returns {google.protobuf.Value} Value instance + */ + Value.create = function create(properties) { + return new Value(properties); + }; + + /** + * Encodes the specified Value message. Does not implicitly {@link google.protobuf.Value.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Value + * @static + * @param {google.protobuf.IValue} message Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Value.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.nullValue != null && Object.hasOwnProperty.call(message, "nullValue")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.nullValue); + if (message.numberValue != null && Object.hasOwnProperty.call(message, "numberValue")) + writer.uint32(/* id 2, wireType 1 =*/17).double(message.numberValue); + if (message.stringValue != null && Object.hasOwnProperty.call(message, "stringValue")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.stringValue); + if (message.boolValue != null && Object.hasOwnProperty.call(message, "boolValue")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.boolValue); + if (message.structValue != null && Object.hasOwnProperty.call(message, "structValue")) + $root.google.protobuf.Struct.encode(message.structValue, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.listValue != null && Object.hasOwnProperty.call(message, "listValue")) + $root.google.protobuf.ListValue.encode(message.listValue, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Value message, length delimited. Does not implicitly {@link google.protobuf.Value.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Value + * @static + * @param {google.protobuf.IValue} message Value message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Value.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Value message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Value} Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Value.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Value(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.nullValue = reader.int32(); + break; + } + case 2: { + message.numberValue = reader.double(); + break; + } + case 3: { + message.stringValue = reader.string(); + break; + } + case 4: { + message.boolValue = reader.bool(); + break; + } + case 5: { + message.structValue = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + case 6: { + message.listValue = $root.google.protobuf.ListValue.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Value message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Value + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Value} Value + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Value.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Value message. + * @function verify + * @memberof google.protobuf.Value + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Value.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.nullValue != null && message.hasOwnProperty("nullValue")) { + properties.kind = 1; + switch (message.nullValue) { + default: + return "nullValue: enum value expected"; + case 0: + break; + } + } + if (message.numberValue != null && message.hasOwnProperty("numberValue")) { + if (properties.kind === 1) + return "kind: multiple values"; + properties.kind = 1; + if (typeof message.numberValue !== "number") + return "numberValue: number expected"; + } + if (message.stringValue != null && message.hasOwnProperty("stringValue")) { + if (properties.kind === 1) + return "kind: multiple values"; + properties.kind = 1; + if (!$util.isString(message.stringValue)) + return "stringValue: string expected"; + } + if (message.boolValue != null && message.hasOwnProperty("boolValue")) { + if (properties.kind === 1) + return "kind: multiple values"; + properties.kind = 1; + if (typeof message.boolValue !== "boolean") + return "boolValue: boolean expected"; + } + if (message.structValue != null && message.hasOwnProperty("structValue")) { + if (properties.kind === 1) + return "kind: multiple values"; + properties.kind = 1; + { + var error = $root.google.protobuf.Struct.verify(message.structValue); + if (error) + return "structValue." + error; + } + } + if (message.listValue != null && message.hasOwnProperty("listValue")) { + if (properties.kind === 1) + return "kind: multiple values"; + properties.kind = 1; + { + var error = $root.google.protobuf.ListValue.verify(message.listValue); + if (error) + return "listValue." + error; + } + } + return null; + }; + + /** + * Creates a Value message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Value + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Value} Value + */ + Value.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Value) + return object; + var message = new $root.google.protobuf.Value(); + switch (object.nullValue) { + default: + if (typeof object.nullValue === "number") { + message.nullValue = object.nullValue; + break; + } + break; + case "NULL_VALUE": + case 0: + message.nullValue = 0; + break; + } + if (object.numberValue != null) + message.numberValue = Number(object.numberValue); + if (object.stringValue != null) + message.stringValue = String(object.stringValue); + if (object.boolValue != null) + message.boolValue = Boolean(object.boolValue); + if (object.structValue != null) { + if (typeof object.structValue !== "object") + throw TypeError(".google.protobuf.Value.structValue: object expected"); + message.structValue = $root.google.protobuf.Struct.fromObject(object.structValue); + } + if (object.listValue != null) { + if (typeof object.listValue !== "object") + throw TypeError(".google.protobuf.Value.listValue: object expected"); + message.listValue = $root.google.protobuf.ListValue.fromObject(object.listValue); + } + return message; + }; + + /** + * Creates a plain object from a Value message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Value + * @static + * @param {google.protobuf.Value} message Value + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Value.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.nullValue != null && message.hasOwnProperty("nullValue")) { + object.nullValue = options.enums === String ? $root.google.protobuf.NullValue[message.nullValue] === undefined ? message.nullValue : $root.google.protobuf.NullValue[message.nullValue] : message.nullValue; + if (options.oneofs) + object.kind = "nullValue"; + } + if (message.numberValue != null && message.hasOwnProperty("numberValue")) { + object.numberValue = options.json && !isFinite(message.numberValue) ? String(message.numberValue) : message.numberValue; + if (options.oneofs) + object.kind = "numberValue"; + } + if (message.stringValue != null && message.hasOwnProperty("stringValue")) { + object.stringValue = message.stringValue; + if (options.oneofs) + object.kind = "stringValue"; + } + if (message.boolValue != null && message.hasOwnProperty("boolValue")) { + object.boolValue = message.boolValue; + if (options.oneofs) + object.kind = "boolValue"; + } + if (message.structValue != null && message.hasOwnProperty("structValue")) { + object.structValue = $root.google.protobuf.Struct.toObject(message.structValue, options); + if (options.oneofs) + object.kind = "structValue"; + } + if (message.listValue != null && message.hasOwnProperty("listValue")) { + object.listValue = $root.google.protobuf.ListValue.toObject(message.listValue, options); + if (options.oneofs) + object.kind = "listValue"; + } + return object; + }; + + /** + * Converts this Value to JSON. + * @function toJSON + * @memberof google.protobuf.Value + * @instance + * @returns {Object.} JSON object + */ + Value.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Value + * @function getTypeUrl + * @memberof google.protobuf.Value + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Value.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Value"; + }; + + return Value; + })(); + + /** + * NullValue enum. + * @name google.protobuf.NullValue + * @enum {number} + * @property {number} NULL_VALUE=0 NULL_VALUE value + */ + protobuf.NullValue = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "NULL_VALUE"] = 0; + return values; + })(); + + protobuf.ListValue = (function() { + + /** + * Properties of a ListValue. + * @memberof google.protobuf + * @interface IListValue + * @property {Array.|null} [values] ListValue values + */ + + /** + * Constructs a new ListValue. + * @memberof google.protobuf + * @classdesc Represents a ListValue. + * @implements IListValue + * @constructor + * @param {google.protobuf.IListValue=} [properties] Properties to set + */ + function ListValue(properties) { + this.values = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListValue values. + * @member {Array.} values + * @memberof google.protobuf.ListValue + * @instance + */ + ListValue.prototype.values = $util.emptyArray; + + /** + * Creates a new ListValue instance using the specified properties. + * @function create + * @memberof google.protobuf.ListValue + * @static + * @param {google.protobuf.IListValue=} [properties] Properties to set + * @returns {google.protobuf.ListValue} ListValue instance + */ + ListValue.create = function create(properties) { + return new ListValue(properties); + }; + + /** + * Encodes the specified ListValue message. Does not implicitly {@link google.protobuf.ListValue.verify|verify} messages. + * @function encode + * @memberof google.protobuf.ListValue + * @static + * @param {google.protobuf.IListValue} message ListValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListValue.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.values != null && message.values.length) + for (var i = 0; i < message.values.length; ++i) + $root.google.protobuf.Value.encode(message.values[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ListValue message, length delimited. Does not implicitly {@link google.protobuf.ListValue.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.ListValue + * @static + * @param {google.protobuf.IListValue} message ListValue message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListValue.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListValue message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.ListValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.ListValue} ListValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListValue.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.ListValue(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.values && message.values.length)) + message.values = []; + message.values.push($root.google.protobuf.Value.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListValue message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.ListValue + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.ListValue} ListValue + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListValue.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListValue message. + * @function verify + * @memberof google.protobuf.ListValue + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListValue.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.values != null && message.hasOwnProperty("values")) { + if (!Array.isArray(message.values)) + return "values: array expected"; + for (var i = 0; i < message.values.length; ++i) { + var error = $root.google.protobuf.Value.verify(message.values[i]); + if (error) + return "values." + error; + } + } + return null; + }; + + /** + * Creates a ListValue message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.ListValue + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.ListValue} ListValue + */ + ListValue.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.ListValue) + return object; + var message = new $root.google.protobuf.ListValue(); + if (object.values) { + if (!Array.isArray(object.values)) + throw TypeError(".google.protobuf.ListValue.values: array expected"); + message.values = []; + for (var i = 0; i < object.values.length; ++i) { + if (typeof object.values[i] !== "object") + throw TypeError(".google.protobuf.ListValue.values: object expected"); + message.values[i] = $root.google.protobuf.Value.fromObject(object.values[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a ListValue message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.ListValue + * @static + * @param {google.protobuf.ListValue} message ListValue + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListValue.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.values = []; + if (message.values && message.values.length) { + object.values = []; + for (var j = 0; j < message.values.length; ++j) + object.values[j] = $root.google.protobuf.Value.toObject(message.values[j], options); + } + return object; + }; + + /** + * Converts this ListValue to JSON. + * @function toJSON + * @memberof google.protobuf.ListValue + * @instance + * @returns {Object.} JSON object + */ + ListValue.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListValue + * @function getTypeUrl + * @memberof google.protobuf.ListValue + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListValue.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.ListValue"; + }; + + return ListValue; + })(); + + protobuf.Any = (function() { + + /** + * Properties of an Any. + * @memberof google.protobuf + * @interface IAny + * @property {string|null} [type_url] Any type_url + * @property {Uint8Array|null} [value] Any value + */ + + /** + * Constructs a new Any. + * @memberof google.protobuf + * @classdesc Represents an Any. + * @implements IAny + * @constructor + * @param {google.protobuf.IAny=} [properties] Properties to set + */ + function Any(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Any type_url. + * @member {string} type_url + * @memberof google.protobuf.Any + * @instance + */ + Any.prototype.type_url = ""; + + /** + * Any value. + * @member {Uint8Array} value + * @memberof google.protobuf.Any + * @instance + */ + Any.prototype.value = $util.newBuffer([]); + + /** + * Creates a new Any instance using the specified properties. + * @function create + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.IAny=} [properties] Properties to set + * @returns {google.protobuf.Any} Any instance + */ + Any.create = function create(properties) { + return new Any(properties); + }; + + /** + * Encodes the specified Any message. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.IAny} message Any message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Any.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type_url != null && Object.hasOwnProperty.call(message, "type_url")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type_url); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 2, wireType 2 =*/18).bytes(message.value); + return writer; + }; + + /** + * Encodes the specified Any message, length delimited. Does not implicitly {@link google.protobuf.Any.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.IAny} message Any message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Any.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Any message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Any + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Any} Any + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Any.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Any(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.type_url = reader.string(); + break; + } + case 2: { + message.value = reader.bytes(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Any message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Any + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Any} Any + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Any.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Any message. + * @function verify + * @memberof google.protobuf.Any + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Any.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type_url != null && message.hasOwnProperty("type_url")) + if (!$util.isString(message.type_url)) + return "type_url: string expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (!(message.value && typeof message.value.length === "number" || $util.isString(message.value))) + return "value: buffer expected"; + return null; + }; + + /** + * Creates an Any message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Any + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Any} Any + */ + Any.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Any) + return object; + var message = new $root.google.protobuf.Any(); + if (object.type_url != null) + message.type_url = String(object.type_url); + if (object.value != null) + if (typeof object.value === "string") + $util.base64.decode(object.value, message.value = $util.newBuffer($util.base64.length(object.value)), 0); + else if (object.value.length >= 0) + message.value = object.value; + return message; + }; + + /** + * Creates a plain object from an Any message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Any + * @static + * @param {google.protobuf.Any} message Any + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Any.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.type_url = ""; + if (options.bytes === String) + object.value = ""; + else { + object.value = []; + if (options.bytes !== Array) + object.value = $util.newBuffer(object.value); + } + } + if (message.type_url != null && message.hasOwnProperty("type_url")) + object.type_url = message.type_url; + if (message.value != null && message.hasOwnProperty("value")) + object.value = options.bytes === String ? $util.base64.encode(message.value, 0, message.value.length) : options.bytes === Array ? Array.prototype.slice.call(message.value) : message.value; + return object; + }; + + /** + * Converts this Any to JSON. + * @function toJSON + * @memberof google.protobuf.Any + * @instance + * @returns {Object.} JSON object + */ + Any.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Any + * @function getTypeUrl + * @memberof google.protobuf.Any + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Any.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Any"; + }; + + return Any; + })(); + + protobuf.Timestamp = (function() { + + /** + * Properties of a Timestamp. + * @memberof google.protobuf + * @interface ITimestamp + * @property {number|Long|null} [seconds] Timestamp seconds + * @property {number|null} [nanos] Timestamp nanos + */ + + /** + * Constructs a new Timestamp. + * @memberof google.protobuf + * @classdesc Represents a Timestamp. + * @implements ITimestamp + * @constructor + * @param {google.protobuf.ITimestamp=} [properties] Properties to set + */ + function Timestamp(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Timestamp seconds. + * @member {number|Long} seconds + * @memberof google.protobuf.Timestamp + * @instance + */ + Timestamp.prototype.seconds = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Timestamp nanos. + * @member {number} nanos + * @memberof google.protobuf.Timestamp + * @instance + */ + Timestamp.prototype.nanos = 0; + + /** + * Creates a new Timestamp instance using the specified properties. + * @function create + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.ITimestamp=} [properties] Properties to set + * @returns {google.protobuf.Timestamp} Timestamp instance + */ + Timestamp.create = function create(properties) { + return new Timestamp(properties); + }; + + /** + * Encodes the specified Timestamp message. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Timestamp.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.seconds != null && Object.hasOwnProperty.call(message, "seconds")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.seconds); + if (message.nanos != null && Object.hasOwnProperty.call(message, "nanos")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.nanos); + return writer; + }; + + /** + * Encodes the specified Timestamp message, length delimited. Does not implicitly {@link google.protobuf.Timestamp.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.ITimestamp} message Timestamp message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Timestamp.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Timestamp message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Timestamp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Timestamp} Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Timestamp.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Timestamp(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.seconds = reader.int64(); + break; + } + case 2: { + message.nanos = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Timestamp message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Timestamp + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Timestamp} Timestamp + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Timestamp.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Timestamp message. + * @function verify + * @memberof google.protobuf.Timestamp + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Timestamp.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (!$util.isInteger(message.seconds) && !(message.seconds && $util.isInteger(message.seconds.low) && $util.isInteger(message.seconds.high))) + return "seconds: integer|Long expected"; + if (message.nanos != null && message.hasOwnProperty("nanos")) + if (!$util.isInteger(message.nanos)) + return "nanos: integer expected"; + return null; + }; + + /** + * Creates a Timestamp message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Timestamp + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Timestamp} Timestamp + */ + Timestamp.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Timestamp) + return object; + var message = new $root.google.protobuf.Timestamp(); + if (object.seconds != null) + if ($util.Long) + (message.seconds = $util.Long.fromValue(object.seconds)).unsigned = false; + else if (typeof object.seconds === "string") + message.seconds = parseInt(object.seconds, 10); + else if (typeof object.seconds === "number") + message.seconds = object.seconds; + else if (typeof object.seconds === "object") + message.seconds = new $util.LongBits(object.seconds.low >>> 0, object.seconds.high >>> 0).toNumber(); + if (object.nanos != null) + message.nanos = object.nanos | 0; + return message; + }; + + /** + * Creates a plain object from a Timestamp message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Timestamp + * @static + * @param {google.protobuf.Timestamp} message Timestamp + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Timestamp.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.seconds = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.seconds = options.longs === String ? "0" : 0; + object.nanos = 0; + } + if (message.seconds != null && message.hasOwnProperty("seconds")) + if (typeof message.seconds === "number") + object.seconds = options.longs === String ? String(message.seconds) : message.seconds; + else + object.seconds = options.longs === String ? $util.Long.prototype.toString.call(message.seconds) : options.longs === Number ? new $util.LongBits(message.seconds.low >>> 0, message.seconds.high >>> 0).toNumber() : message.seconds; + if (message.nanos != null && message.hasOwnProperty("nanos")) + object.nanos = message.nanos; + return object; + }; + + /** + * Converts this Timestamp to JSON. + * @function toJSON + * @memberof google.protobuf.Timestamp + * @instance + * @returns {Object.} JSON object + */ + Timestamp.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Timestamp + * @function getTypeUrl + * @memberof google.protobuf.Timestamp + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Timestamp.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Timestamp"; + }; + + return Timestamp; + })(); + + protobuf.Empty = (function() { + + /** + * Properties of an Empty. + * @memberof google.protobuf + * @interface IEmpty + */ + + /** + * Constructs a new Empty. + * @memberof google.protobuf + * @classdesc Represents an Empty. + * @implements IEmpty + * @constructor + * @param {google.protobuf.IEmpty=} [properties] Properties to set + */ + function Empty(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new Empty instance using the specified properties. + * @function create + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty=} [properties] Properties to set + * @returns {google.protobuf.Empty} Empty instance + */ + Empty.create = function create(properties) { + return new Empty(properties); + }; + + /** + * Encodes the specified Empty message. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @function encode + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty} message Empty message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Empty.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified Empty message, length delimited. Does not implicitly {@link google.protobuf.Empty.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.IEmpty} message Empty message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Empty.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Empty message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.Empty + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.Empty} Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Empty.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.Empty(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Empty message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.Empty + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.Empty} Empty + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Empty.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Empty message. + * @function verify + * @memberof google.protobuf.Empty + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Empty.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates an Empty message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.Empty + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.Empty} Empty + */ + Empty.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.Empty) + return object; + return new $root.google.protobuf.Empty(); + }; + + /** + * Creates a plain object from an Empty message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.Empty + * @static + * @param {google.protobuf.Empty} message Empty + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Empty.toObject = function toObject() { + return {}; + }; + + /** + * Converts this Empty to JSON. + * @function toJSON + * @memberof google.protobuf.Empty + * @instance + * @returns {Object.} JSON object + */ + Empty.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Empty + * @function getTypeUrl + * @memberof google.protobuf.Empty + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Empty.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.Empty"; + }; + + return Empty; + })(); + + protobuf.FieldMask = (function() { + + /** + * Properties of a FieldMask. + * @memberof google.protobuf + * @interface IFieldMask + * @property {Array.|null} [paths] FieldMask paths + */ + + /** + * Constructs a new FieldMask. + * @memberof google.protobuf + * @classdesc Represents a FieldMask. + * @implements IFieldMask + * @constructor + * @param {google.protobuf.IFieldMask=} [properties] Properties to set + */ + function FieldMask(properties) { + this.paths = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * FieldMask paths. + * @member {Array.} paths + * @memberof google.protobuf.FieldMask + * @instance + */ + FieldMask.prototype.paths = $util.emptyArray; + + /** + * Creates a new FieldMask instance using the specified properties. + * @function create + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask=} [properties] Properties to set + * @returns {google.protobuf.FieldMask} FieldMask instance + */ + FieldMask.create = function create(properties) { + return new FieldMask(properties); + }; + + /** + * Encodes the specified FieldMask message. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @function encode + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldMask.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.paths != null && message.paths.length) + for (var i = 0; i < message.paths.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.paths[i]); + return writer; + }; + + /** + * Encodes the specified FieldMask message, length delimited. Does not implicitly {@link google.protobuf.FieldMask.verify|verify} messages. + * @function encodeDelimited + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.IFieldMask} message FieldMask message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + FieldMask.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a FieldMask message from the specified reader or buffer. + * @function decode + * @memberof google.protobuf.FieldMask + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.protobuf.FieldMask} FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldMask.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.protobuf.FieldMask(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.paths && message.paths.length)) + message.paths = []; + message.paths.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a FieldMask message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.protobuf.FieldMask + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.protobuf.FieldMask} FieldMask + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + FieldMask.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a FieldMask message. + * @function verify + * @memberof google.protobuf.FieldMask + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + FieldMask.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.paths != null && message.hasOwnProperty("paths")) { + if (!Array.isArray(message.paths)) + return "paths: array expected"; + for (var i = 0; i < message.paths.length; ++i) + if (!$util.isString(message.paths[i])) + return "paths: string[] expected"; + } + return null; + }; + + /** + * Creates a FieldMask message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.protobuf.FieldMask + * @static + * @param {Object.} object Plain object + * @returns {google.protobuf.FieldMask} FieldMask + */ + FieldMask.fromObject = function fromObject(object) { + if (object instanceof $root.google.protobuf.FieldMask) + return object; + var message = new $root.google.protobuf.FieldMask(); + if (object.paths) { + if (!Array.isArray(object.paths)) + throw TypeError(".google.protobuf.FieldMask.paths: array expected"); + message.paths = []; + for (var i = 0; i < object.paths.length; ++i) + message.paths[i] = String(object.paths[i]); + } + return message; + }; + + /** + * Creates a plain object from a FieldMask message. Also converts values to other types if specified. + * @function toObject + * @memberof google.protobuf.FieldMask + * @static + * @param {google.protobuf.FieldMask} message FieldMask + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + FieldMask.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.paths = []; + if (message.paths && message.paths.length) { + object.paths = []; + for (var j = 0; j < message.paths.length; ++j) + object.paths[j] = message.paths[j]; + } + return object; + }; + + /** + * Converts this FieldMask to JSON. + * @function toJSON + * @memberof google.protobuf.FieldMask + * @instance + * @returns {Object.} JSON object + */ + FieldMask.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for FieldMask + * @function getTypeUrl + * @memberof google.protobuf.FieldMask + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + FieldMask.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.protobuf.FieldMask"; + }; + + return FieldMask; + })(); + + return protobuf; + })(); + + google.logging = (function() { + + /** + * Namespace logging. + * @memberof google + * @namespace + */ + var logging = {}; + + logging.type = (function() { + + /** + * Namespace type. + * @memberof google.logging + * @namespace + */ + var type = {}; + + type.HttpRequest = (function() { + + /** + * Properties of a HttpRequest. + * @memberof google.logging.type + * @interface IHttpRequest + * @property {string|null} [requestMethod] HttpRequest requestMethod + * @property {string|null} [requestUrl] HttpRequest requestUrl + * @property {number|Long|null} [requestSize] HttpRequest requestSize + * @property {number|null} [status] HttpRequest status + * @property {number|Long|null} [responseSize] HttpRequest responseSize + * @property {string|null} [userAgent] HttpRequest userAgent + * @property {string|null} [remoteIp] HttpRequest remoteIp + * @property {string|null} [serverIp] HttpRequest serverIp + * @property {string|null} [referer] HttpRequest referer + * @property {google.protobuf.IDuration|null} [latency] HttpRequest latency + * @property {boolean|null} [cacheLookup] HttpRequest cacheLookup + * @property {boolean|null} [cacheHit] HttpRequest cacheHit + * @property {boolean|null} [cacheValidatedWithOriginServer] HttpRequest cacheValidatedWithOriginServer + * @property {number|Long|null} [cacheFillBytes] HttpRequest cacheFillBytes + * @property {string|null} [protocol] HttpRequest protocol + */ + + /** + * Constructs a new HttpRequest. + * @memberof google.logging.type + * @classdesc Represents a HttpRequest. + * @implements IHttpRequest + * @constructor + * @param {google.logging.type.IHttpRequest=} [properties] Properties to set + */ + function HttpRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HttpRequest requestMethod. + * @member {string} requestMethod + * @memberof google.logging.type.HttpRequest + * @instance + */ + HttpRequest.prototype.requestMethod = ""; + + /** + * HttpRequest requestUrl. + * @member {string} requestUrl + * @memberof google.logging.type.HttpRequest + * @instance + */ + HttpRequest.prototype.requestUrl = ""; + + /** + * HttpRequest requestSize. + * @member {number|Long} requestSize + * @memberof google.logging.type.HttpRequest + * @instance + */ + HttpRequest.prototype.requestSize = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * HttpRequest status. + * @member {number} status + * @memberof google.logging.type.HttpRequest + * @instance + */ + HttpRequest.prototype.status = 0; + + /** + * HttpRequest responseSize. + * @member {number|Long} responseSize + * @memberof google.logging.type.HttpRequest + * @instance + */ + HttpRequest.prototype.responseSize = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * HttpRequest userAgent. + * @member {string} userAgent + * @memberof google.logging.type.HttpRequest + * @instance + */ + HttpRequest.prototype.userAgent = ""; + + /** + * HttpRequest remoteIp. + * @member {string} remoteIp + * @memberof google.logging.type.HttpRequest + * @instance + */ + HttpRequest.prototype.remoteIp = ""; + + /** + * HttpRequest serverIp. + * @member {string} serverIp + * @memberof google.logging.type.HttpRequest + * @instance + */ + HttpRequest.prototype.serverIp = ""; + + /** + * HttpRequest referer. + * @member {string} referer + * @memberof google.logging.type.HttpRequest + * @instance + */ + HttpRequest.prototype.referer = ""; + + /** + * HttpRequest latency. + * @member {google.protobuf.IDuration|null|undefined} latency + * @memberof google.logging.type.HttpRequest + * @instance + */ + HttpRequest.prototype.latency = null; + + /** + * HttpRequest cacheLookup. + * @member {boolean} cacheLookup + * @memberof google.logging.type.HttpRequest + * @instance + */ + HttpRequest.prototype.cacheLookup = false; + + /** + * HttpRequest cacheHit. + * @member {boolean} cacheHit + * @memberof google.logging.type.HttpRequest + * @instance + */ + HttpRequest.prototype.cacheHit = false; + + /** + * HttpRequest cacheValidatedWithOriginServer. + * @member {boolean} cacheValidatedWithOriginServer + * @memberof google.logging.type.HttpRequest + * @instance + */ + HttpRequest.prototype.cacheValidatedWithOriginServer = false; + + /** + * HttpRequest cacheFillBytes. + * @member {number|Long} cacheFillBytes + * @memberof google.logging.type.HttpRequest + * @instance + */ + HttpRequest.prototype.cacheFillBytes = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * HttpRequest protocol. + * @member {string} protocol + * @memberof google.logging.type.HttpRequest + * @instance + */ + HttpRequest.prototype.protocol = ""; + + /** + * Creates a new HttpRequest instance using the specified properties. + * @function create + * @memberof google.logging.type.HttpRequest + * @static + * @param {google.logging.type.IHttpRequest=} [properties] Properties to set + * @returns {google.logging.type.HttpRequest} HttpRequest instance + */ + HttpRequest.create = function create(properties) { + return new HttpRequest(properties); + }; + + /** + * Encodes the specified HttpRequest message. Does not implicitly {@link google.logging.type.HttpRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.type.HttpRequest + * @static + * @param {google.logging.type.IHttpRequest} message HttpRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HttpRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.requestMethod != null && Object.hasOwnProperty.call(message, "requestMethod")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.requestMethod); + if (message.requestUrl != null && Object.hasOwnProperty.call(message, "requestUrl")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.requestUrl); + if (message.requestSize != null && Object.hasOwnProperty.call(message, "requestSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int64(message.requestSize); + if (message.status != null && Object.hasOwnProperty.call(message, "status")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.status); + if (message.responseSize != null && Object.hasOwnProperty.call(message, "responseSize")) + writer.uint32(/* id 5, wireType 0 =*/40).int64(message.responseSize); + if (message.userAgent != null && Object.hasOwnProperty.call(message, "userAgent")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.userAgent); + if (message.remoteIp != null && Object.hasOwnProperty.call(message, "remoteIp")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.remoteIp); + if (message.referer != null && Object.hasOwnProperty.call(message, "referer")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.referer); + if (message.cacheHit != null && Object.hasOwnProperty.call(message, "cacheHit")) + writer.uint32(/* id 9, wireType 0 =*/72).bool(message.cacheHit); + if (message.cacheValidatedWithOriginServer != null && Object.hasOwnProperty.call(message, "cacheValidatedWithOriginServer")) + writer.uint32(/* id 10, wireType 0 =*/80).bool(message.cacheValidatedWithOriginServer); + if (message.cacheLookup != null && Object.hasOwnProperty.call(message, "cacheLookup")) + writer.uint32(/* id 11, wireType 0 =*/88).bool(message.cacheLookup); + if (message.cacheFillBytes != null && Object.hasOwnProperty.call(message, "cacheFillBytes")) + writer.uint32(/* id 12, wireType 0 =*/96).int64(message.cacheFillBytes); + if (message.serverIp != null && Object.hasOwnProperty.call(message, "serverIp")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.serverIp); + if (message.latency != null && Object.hasOwnProperty.call(message, "latency")) + $root.google.protobuf.Duration.encode(message.latency, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.protocol != null && Object.hasOwnProperty.call(message, "protocol")) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.protocol); + return writer; + }; + + /** + * Encodes the specified HttpRequest message, length delimited. Does not implicitly {@link google.logging.type.HttpRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.type.HttpRequest + * @static + * @param {google.logging.type.IHttpRequest} message HttpRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HttpRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HttpRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.type.HttpRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.type.HttpRequest} HttpRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HttpRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.type.HttpRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.requestMethod = reader.string(); + break; + } + case 2: { + message.requestUrl = reader.string(); + break; + } + case 3: { + message.requestSize = reader.int64(); + break; + } + case 4: { + message.status = reader.int32(); + break; + } + case 5: { + message.responseSize = reader.int64(); + break; + } + case 6: { + message.userAgent = reader.string(); + break; + } + case 7: { + message.remoteIp = reader.string(); + break; + } + case 13: { + message.serverIp = reader.string(); + break; + } + case 8: { + message.referer = reader.string(); + break; + } + case 14: { + message.latency = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 11: { + message.cacheLookup = reader.bool(); + break; + } + case 9: { + message.cacheHit = reader.bool(); + break; + } + case 10: { + message.cacheValidatedWithOriginServer = reader.bool(); + break; + } + case 12: { + message.cacheFillBytes = reader.int64(); + break; + } + case 15: { + message.protocol = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HttpRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.type.HttpRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.type.HttpRequest} HttpRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HttpRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HttpRequest message. + * @function verify + * @memberof google.logging.type.HttpRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HttpRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.requestMethod != null && message.hasOwnProperty("requestMethod")) + if (!$util.isString(message.requestMethod)) + return "requestMethod: string expected"; + if (message.requestUrl != null && message.hasOwnProperty("requestUrl")) + if (!$util.isString(message.requestUrl)) + return "requestUrl: string expected"; + if (message.requestSize != null && message.hasOwnProperty("requestSize")) + if (!$util.isInteger(message.requestSize) && !(message.requestSize && $util.isInteger(message.requestSize.low) && $util.isInteger(message.requestSize.high))) + return "requestSize: integer|Long expected"; + if (message.status != null && message.hasOwnProperty("status")) + if (!$util.isInteger(message.status)) + return "status: integer expected"; + if (message.responseSize != null && message.hasOwnProperty("responseSize")) + if (!$util.isInteger(message.responseSize) && !(message.responseSize && $util.isInteger(message.responseSize.low) && $util.isInteger(message.responseSize.high))) + return "responseSize: integer|Long expected"; + if (message.userAgent != null && message.hasOwnProperty("userAgent")) + if (!$util.isString(message.userAgent)) + return "userAgent: string expected"; + if (message.remoteIp != null && message.hasOwnProperty("remoteIp")) + if (!$util.isString(message.remoteIp)) + return "remoteIp: string expected"; + if (message.serverIp != null && message.hasOwnProperty("serverIp")) + if (!$util.isString(message.serverIp)) + return "serverIp: string expected"; + if (message.referer != null && message.hasOwnProperty("referer")) + if (!$util.isString(message.referer)) + return "referer: string expected"; + if (message.latency != null && message.hasOwnProperty("latency")) { + var error = $root.google.protobuf.Duration.verify(message.latency); + if (error) + return "latency." + error; + } + if (message.cacheLookup != null && message.hasOwnProperty("cacheLookup")) + if (typeof message.cacheLookup !== "boolean") + return "cacheLookup: boolean expected"; + if (message.cacheHit != null && message.hasOwnProperty("cacheHit")) + if (typeof message.cacheHit !== "boolean") + return "cacheHit: boolean expected"; + if (message.cacheValidatedWithOriginServer != null && message.hasOwnProperty("cacheValidatedWithOriginServer")) + if (typeof message.cacheValidatedWithOriginServer !== "boolean") + return "cacheValidatedWithOriginServer: boolean expected"; + if (message.cacheFillBytes != null && message.hasOwnProperty("cacheFillBytes")) + if (!$util.isInteger(message.cacheFillBytes) && !(message.cacheFillBytes && $util.isInteger(message.cacheFillBytes.low) && $util.isInteger(message.cacheFillBytes.high))) + return "cacheFillBytes: integer|Long expected"; + if (message.protocol != null && message.hasOwnProperty("protocol")) + if (!$util.isString(message.protocol)) + return "protocol: string expected"; + return null; + }; + + /** + * Creates a HttpRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.type.HttpRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.type.HttpRequest} HttpRequest + */ + HttpRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.type.HttpRequest) + return object; + var message = new $root.google.logging.type.HttpRequest(); + if (object.requestMethod != null) + message.requestMethod = String(object.requestMethod); + if (object.requestUrl != null) + message.requestUrl = String(object.requestUrl); + if (object.requestSize != null) + if ($util.Long) + (message.requestSize = $util.Long.fromValue(object.requestSize)).unsigned = false; + else if (typeof object.requestSize === "string") + message.requestSize = parseInt(object.requestSize, 10); + else if (typeof object.requestSize === "number") + message.requestSize = object.requestSize; + else if (typeof object.requestSize === "object") + message.requestSize = new $util.LongBits(object.requestSize.low >>> 0, object.requestSize.high >>> 0).toNumber(); + if (object.status != null) + message.status = object.status | 0; + if (object.responseSize != null) + if ($util.Long) + (message.responseSize = $util.Long.fromValue(object.responseSize)).unsigned = false; + else if (typeof object.responseSize === "string") + message.responseSize = parseInt(object.responseSize, 10); + else if (typeof object.responseSize === "number") + message.responseSize = object.responseSize; + else if (typeof object.responseSize === "object") + message.responseSize = new $util.LongBits(object.responseSize.low >>> 0, object.responseSize.high >>> 0).toNumber(); + if (object.userAgent != null) + message.userAgent = String(object.userAgent); + if (object.remoteIp != null) + message.remoteIp = String(object.remoteIp); + if (object.serverIp != null) + message.serverIp = String(object.serverIp); + if (object.referer != null) + message.referer = String(object.referer); + if (object.latency != null) { + if (typeof object.latency !== "object") + throw TypeError(".google.logging.type.HttpRequest.latency: object expected"); + message.latency = $root.google.protobuf.Duration.fromObject(object.latency); + } + if (object.cacheLookup != null) + message.cacheLookup = Boolean(object.cacheLookup); + if (object.cacheHit != null) + message.cacheHit = Boolean(object.cacheHit); + if (object.cacheValidatedWithOriginServer != null) + message.cacheValidatedWithOriginServer = Boolean(object.cacheValidatedWithOriginServer); + if (object.cacheFillBytes != null) + if ($util.Long) + (message.cacheFillBytes = $util.Long.fromValue(object.cacheFillBytes)).unsigned = false; + else if (typeof object.cacheFillBytes === "string") + message.cacheFillBytes = parseInt(object.cacheFillBytes, 10); + else if (typeof object.cacheFillBytes === "number") + message.cacheFillBytes = object.cacheFillBytes; + else if (typeof object.cacheFillBytes === "object") + message.cacheFillBytes = new $util.LongBits(object.cacheFillBytes.low >>> 0, object.cacheFillBytes.high >>> 0).toNumber(); + if (object.protocol != null) + message.protocol = String(object.protocol); + return message; + }; + + /** + * Creates a plain object from a HttpRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.type.HttpRequest + * @static + * @param {google.logging.type.HttpRequest} message HttpRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HttpRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.requestMethod = ""; + object.requestUrl = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.requestSize = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.requestSize = options.longs === String ? "0" : 0; + object.status = 0; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.responseSize = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.responseSize = options.longs === String ? "0" : 0; + object.userAgent = ""; + object.remoteIp = ""; + object.referer = ""; + object.cacheHit = false; + object.cacheValidatedWithOriginServer = false; + object.cacheLookup = false; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.cacheFillBytes = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.cacheFillBytes = options.longs === String ? "0" : 0; + object.serverIp = ""; + object.latency = null; + object.protocol = ""; + } + if (message.requestMethod != null && message.hasOwnProperty("requestMethod")) + object.requestMethod = message.requestMethod; + if (message.requestUrl != null && message.hasOwnProperty("requestUrl")) + object.requestUrl = message.requestUrl; + if (message.requestSize != null && message.hasOwnProperty("requestSize")) + if (typeof message.requestSize === "number") + object.requestSize = options.longs === String ? String(message.requestSize) : message.requestSize; + else + object.requestSize = options.longs === String ? $util.Long.prototype.toString.call(message.requestSize) : options.longs === Number ? new $util.LongBits(message.requestSize.low >>> 0, message.requestSize.high >>> 0).toNumber() : message.requestSize; + if (message.status != null && message.hasOwnProperty("status")) + object.status = message.status; + if (message.responseSize != null && message.hasOwnProperty("responseSize")) + if (typeof message.responseSize === "number") + object.responseSize = options.longs === String ? String(message.responseSize) : message.responseSize; + else + object.responseSize = options.longs === String ? $util.Long.prototype.toString.call(message.responseSize) : options.longs === Number ? new $util.LongBits(message.responseSize.low >>> 0, message.responseSize.high >>> 0).toNumber() : message.responseSize; + if (message.userAgent != null && message.hasOwnProperty("userAgent")) + object.userAgent = message.userAgent; + if (message.remoteIp != null && message.hasOwnProperty("remoteIp")) + object.remoteIp = message.remoteIp; + if (message.referer != null && message.hasOwnProperty("referer")) + object.referer = message.referer; + if (message.cacheHit != null && message.hasOwnProperty("cacheHit")) + object.cacheHit = message.cacheHit; + if (message.cacheValidatedWithOriginServer != null && message.hasOwnProperty("cacheValidatedWithOriginServer")) + object.cacheValidatedWithOriginServer = message.cacheValidatedWithOriginServer; + if (message.cacheLookup != null && message.hasOwnProperty("cacheLookup")) + object.cacheLookup = message.cacheLookup; + if (message.cacheFillBytes != null && message.hasOwnProperty("cacheFillBytes")) + if (typeof message.cacheFillBytes === "number") + object.cacheFillBytes = options.longs === String ? String(message.cacheFillBytes) : message.cacheFillBytes; + else + object.cacheFillBytes = options.longs === String ? $util.Long.prototype.toString.call(message.cacheFillBytes) : options.longs === Number ? new $util.LongBits(message.cacheFillBytes.low >>> 0, message.cacheFillBytes.high >>> 0).toNumber() : message.cacheFillBytes; + if (message.serverIp != null && message.hasOwnProperty("serverIp")) + object.serverIp = message.serverIp; + if (message.latency != null && message.hasOwnProperty("latency")) + object.latency = $root.google.protobuf.Duration.toObject(message.latency, options); + if (message.protocol != null && message.hasOwnProperty("protocol")) + object.protocol = message.protocol; + return object; + }; + + /** + * Converts this HttpRequest to JSON. + * @function toJSON + * @memberof google.logging.type.HttpRequest + * @instance + * @returns {Object.} JSON object + */ + HttpRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for HttpRequest + * @function getTypeUrl + * @memberof google.logging.type.HttpRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + HttpRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.type.HttpRequest"; + }; + + return HttpRequest; + })(); + + /** + * LogSeverity enum. + * @name google.logging.type.LogSeverity + * @enum {number} + * @property {number} DEFAULT=0 DEFAULT value + * @property {number} DEBUG=100 DEBUG value + * @property {number} INFO=200 INFO value + * @property {number} NOTICE=300 NOTICE value + * @property {number} WARNING=400 WARNING value + * @property {number} ERROR=500 ERROR value + * @property {number} CRITICAL=600 CRITICAL value + * @property {number} ALERT=700 ALERT value + * @property {number} EMERGENCY=800 EMERGENCY value + */ + type.LogSeverity = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "DEFAULT"] = 0; + values[valuesById[100] = "DEBUG"] = 100; + values[valuesById[200] = "INFO"] = 200; + values[valuesById[300] = "NOTICE"] = 300; + values[valuesById[400] = "WARNING"] = 400; + values[valuesById[500] = "ERROR"] = 500; + values[valuesById[600] = "CRITICAL"] = 600; + values[valuesById[700] = "ALERT"] = 700; + values[valuesById[800] = "EMERGENCY"] = 800; + return values; + })(); + + return type; + })(); + + logging.v2 = (function() { + + /** + * Namespace v2. + * @memberof google.logging + * @namespace + */ + var v2 = {}; + + v2.LogEntry = (function() { + + /** + * Properties of a LogEntry. + * @memberof google.logging.v2 + * @interface ILogEntry + * @property {string|null} [logName] LogEntry logName + * @property {google.api.IMonitoredResource|null} [resource] LogEntry resource + * @property {google.protobuf.IAny|null} [protoPayload] LogEntry protoPayload + * @property {string|null} [textPayload] LogEntry textPayload + * @property {google.protobuf.IStruct|null} [jsonPayload] LogEntry jsonPayload + * @property {google.protobuf.ITimestamp|null} [timestamp] LogEntry timestamp + * @property {google.protobuf.ITimestamp|null} [receiveTimestamp] LogEntry receiveTimestamp + * @property {google.logging.type.LogSeverity|null} [severity] LogEntry severity + * @property {string|null} [insertId] LogEntry insertId + * @property {google.logging.type.IHttpRequest|null} [httpRequest] LogEntry httpRequest + * @property {Object.|null} [labels] LogEntry labels + * @property {google.logging.v2.ILogEntryOperation|null} [operation] LogEntry operation + * @property {string|null} [trace] LogEntry trace + * @property {string|null} [spanId] LogEntry spanId + * @property {boolean|null} [traceSampled] LogEntry traceSampled + * @property {google.logging.v2.ILogEntrySourceLocation|null} [sourceLocation] LogEntry sourceLocation + * @property {google.logging.v2.ILogSplit|null} [split] LogEntry split + */ + + /** + * Constructs a new LogEntry. + * @memberof google.logging.v2 + * @classdesc Represents a LogEntry. + * @implements ILogEntry + * @constructor + * @param {google.logging.v2.ILogEntry=} [properties] Properties to set + */ + function LogEntry(properties) { + this.labels = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LogEntry logName. + * @member {string} logName + * @memberof google.logging.v2.LogEntry + * @instance + */ + LogEntry.prototype.logName = ""; + + /** + * LogEntry resource. + * @member {google.api.IMonitoredResource|null|undefined} resource + * @memberof google.logging.v2.LogEntry + * @instance + */ + LogEntry.prototype.resource = null; + + /** + * LogEntry protoPayload. + * @member {google.protobuf.IAny|null|undefined} protoPayload + * @memberof google.logging.v2.LogEntry + * @instance + */ + LogEntry.prototype.protoPayload = null; + + /** + * LogEntry textPayload. + * @member {string|null|undefined} textPayload + * @memberof google.logging.v2.LogEntry + * @instance + */ + LogEntry.prototype.textPayload = null; + + /** + * LogEntry jsonPayload. + * @member {google.protobuf.IStruct|null|undefined} jsonPayload + * @memberof google.logging.v2.LogEntry + * @instance + */ + LogEntry.prototype.jsonPayload = null; + + /** + * LogEntry timestamp. + * @member {google.protobuf.ITimestamp|null|undefined} timestamp + * @memberof google.logging.v2.LogEntry + * @instance + */ + LogEntry.prototype.timestamp = null; + + /** + * LogEntry receiveTimestamp. + * @member {google.protobuf.ITimestamp|null|undefined} receiveTimestamp + * @memberof google.logging.v2.LogEntry + * @instance + */ + LogEntry.prototype.receiveTimestamp = null; + + /** + * LogEntry severity. + * @member {google.logging.type.LogSeverity} severity + * @memberof google.logging.v2.LogEntry + * @instance + */ + LogEntry.prototype.severity = 0; + + /** + * LogEntry insertId. + * @member {string} insertId + * @memberof google.logging.v2.LogEntry + * @instance + */ + LogEntry.prototype.insertId = ""; + + /** + * LogEntry httpRequest. + * @member {google.logging.type.IHttpRequest|null|undefined} httpRequest + * @memberof google.logging.v2.LogEntry + * @instance + */ + LogEntry.prototype.httpRequest = null; + + /** + * LogEntry labels. + * @member {Object.} labels + * @memberof google.logging.v2.LogEntry + * @instance + */ + LogEntry.prototype.labels = $util.emptyObject; + + /** + * LogEntry operation. + * @member {google.logging.v2.ILogEntryOperation|null|undefined} operation + * @memberof google.logging.v2.LogEntry + * @instance + */ + LogEntry.prototype.operation = null; + + /** + * LogEntry trace. + * @member {string} trace + * @memberof google.logging.v2.LogEntry + * @instance + */ + LogEntry.prototype.trace = ""; + + /** + * LogEntry spanId. + * @member {string} spanId + * @memberof google.logging.v2.LogEntry + * @instance + */ + LogEntry.prototype.spanId = ""; + + /** + * LogEntry traceSampled. + * @member {boolean} traceSampled + * @memberof google.logging.v2.LogEntry + * @instance + */ + LogEntry.prototype.traceSampled = false; + + /** + * LogEntry sourceLocation. + * @member {google.logging.v2.ILogEntrySourceLocation|null|undefined} sourceLocation + * @memberof google.logging.v2.LogEntry + * @instance + */ + LogEntry.prototype.sourceLocation = null; + + /** + * LogEntry split. + * @member {google.logging.v2.ILogSplit|null|undefined} split + * @memberof google.logging.v2.LogEntry + * @instance + */ + LogEntry.prototype.split = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * LogEntry payload. + * @member {"protoPayload"|"textPayload"|"jsonPayload"|undefined} payload + * @memberof google.logging.v2.LogEntry + * @instance + */ + Object.defineProperty(LogEntry.prototype, "payload", { + get: $util.oneOfGetter($oneOfFields = ["protoPayload", "textPayload", "jsonPayload"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new LogEntry instance using the specified properties. + * @function create + * @memberof google.logging.v2.LogEntry + * @static + * @param {google.logging.v2.ILogEntry=} [properties] Properties to set + * @returns {google.logging.v2.LogEntry} LogEntry instance + */ + LogEntry.create = function create(properties) { + return new LogEntry(properties); + }; + + /** + * Encodes the specified LogEntry message. Does not implicitly {@link google.logging.v2.LogEntry.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.LogEntry + * @static + * @param {google.logging.v2.ILogEntry} message LogEntry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LogEntry.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.protoPayload != null && Object.hasOwnProperty.call(message, "protoPayload")) + $root.google.protobuf.Any.encode(message.protoPayload, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.textPayload != null && Object.hasOwnProperty.call(message, "textPayload")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.textPayload); + if (message.insertId != null && Object.hasOwnProperty.call(message, "insertId")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.insertId); + if (message.jsonPayload != null && Object.hasOwnProperty.call(message, "jsonPayload")) + $root.google.protobuf.Struct.encode(message.jsonPayload, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.httpRequest != null && Object.hasOwnProperty.call(message, "httpRequest")) + $root.google.logging.type.HttpRequest.encode(message.httpRequest, writer.uint32(/* id 7, wireType 2 =*/58).fork()).ldelim(); + if (message.resource != null && Object.hasOwnProperty.call(message, "resource")) + $root.google.api.MonitoredResource.encode(message.resource, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) + $root.google.protobuf.Timestamp.encode(message.timestamp, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.severity != null && Object.hasOwnProperty.call(message, "severity")) + writer.uint32(/* id 10, wireType 0 =*/80).int32(message.severity); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 11, wireType 2 =*/90).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + if (message.logName != null && Object.hasOwnProperty.call(message, "logName")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.logName); + if (message.operation != null && Object.hasOwnProperty.call(message, "operation")) + $root.google.logging.v2.LogEntryOperation.encode(message.operation, writer.uint32(/* id 15, wireType 2 =*/122).fork()).ldelim(); + if (message.trace != null && Object.hasOwnProperty.call(message, "trace")) + writer.uint32(/* id 22, wireType 2 =*/178).string(message.trace); + if (message.sourceLocation != null && Object.hasOwnProperty.call(message, "sourceLocation")) + $root.google.logging.v2.LogEntrySourceLocation.encode(message.sourceLocation, writer.uint32(/* id 23, wireType 2 =*/186).fork()).ldelim(); + if (message.receiveTimestamp != null && Object.hasOwnProperty.call(message, "receiveTimestamp")) + $root.google.protobuf.Timestamp.encode(message.receiveTimestamp, writer.uint32(/* id 24, wireType 2 =*/194).fork()).ldelim(); + if (message.spanId != null && Object.hasOwnProperty.call(message, "spanId")) + writer.uint32(/* id 27, wireType 2 =*/218).string(message.spanId); + if (message.traceSampled != null && Object.hasOwnProperty.call(message, "traceSampled")) + writer.uint32(/* id 30, wireType 0 =*/240).bool(message.traceSampled); + if (message.split != null && Object.hasOwnProperty.call(message, "split")) + $root.google.logging.v2.LogSplit.encode(message.split, writer.uint32(/* id 35, wireType 2 =*/282).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified LogEntry message, length delimited. Does not implicitly {@link google.logging.v2.LogEntry.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.LogEntry + * @static + * @param {google.logging.v2.ILogEntry} message LogEntry message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LogEntry.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LogEntry message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.LogEntry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.LogEntry} LogEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LogEntry.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.LogEntry(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 12: { + message.logName = reader.string(); + break; + } + case 8: { + message.resource = $root.google.api.MonitoredResource.decode(reader, reader.uint32()); + break; + } + case 2: { + message.protoPayload = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + } + case 3: { + message.textPayload = reader.string(); + break; + } + case 6: { + message.jsonPayload = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + case 9: { + message.timestamp = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 24: { + message.receiveTimestamp = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 10: { + message.severity = reader.int32(); + break; + } + case 4: { + message.insertId = reader.string(); + break; + } + case 7: { + message.httpRequest = $root.google.logging.type.HttpRequest.decode(reader, reader.uint32()); + break; + } + case 11: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + } + case 15: { + message.operation = $root.google.logging.v2.LogEntryOperation.decode(reader, reader.uint32()); + break; + } + case 22: { + message.trace = reader.string(); + break; + } + case 27: { + message.spanId = reader.string(); + break; + } + case 30: { + message.traceSampled = reader.bool(); + break; + } + case 23: { + message.sourceLocation = $root.google.logging.v2.LogEntrySourceLocation.decode(reader, reader.uint32()); + break; + } + case 35: { + message.split = $root.google.logging.v2.LogSplit.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LogEntry message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.LogEntry + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.LogEntry} LogEntry + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LogEntry.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LogEntry message. + * @function verify + * @memberof google.logging.v2.LogEntry + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LogEntry.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.logName != null && message.hasOwnProperty("logName")) + if (!$util.isString(message.logName)) + return "logName: string expected"; + if (message.resource != null && message.hasOwnProperty("resource")) { + var error = $root.google.api.MonitoredResource.verify(message.resource); + if (error) + return "resource." + error; + } + if (message.protoPayload != null && message.hasOwnProperty("protoPayload")) { + properties.payload = 1; + { + var error = $root.google.protobuf.Any.verify(message.protoPayload); + if (error) + return "protoPayload." + error; + } + } + if (message.textPayload != null && message.hasOwnProperty("textPayload")) { + if (properties.payload === 1) + return "payload: multiple values"; + properties.payload = 1; + if (!$util.isString(message.textPayload)) + return "textPayload: string expected"; + } + if (message.jsonPayload != null && message.hasOwnProperty("jsonPayload")) { + if (properties.payload === 1) + return "payload: multiple values"; + properties.payload = 1; + { + var error = $root.google.protobuf.Struct.verify(message.jsonPayload); + if (error) + return "jsonPayload." + error; + } + } + if (message.timestamp != null && message.hasOwnProperty("timestamp")) { + var error = $root.google.protobuf.Timestamp.verify(message.timestamp); + if (error) + return "timestamp." + error; + } + if (message.receiveTimestamp != null && message.hasOwnProperty("receiveTimestamp")) { + var error = $root.google.protobuf.Timestamp.verify(message.receiveTimestamp); + if (error) + return "receiveTimestamp." + error; + } + if (message.severity != null && message.hasOwnProperty("severity")) + switch (message.severity) { + default: + return "severity: enum value expected"; + case 0: + case 100: + case 200: + case 300: + case 400: + case 500: + case 600: + case 700: + case 800: + break; + } + if (message.insertId != null && message.hasOwnProperty("insertId")) + if (!$util.isString(message.insertId)) + return "insertId: string expected"; + if (message.httpRequest != null && message.hasOwnProperty("httpRequest")) { + var error = $root.google.logging.type.HttpRequest.verify(message.httpRequest); + if (error) + return "httpRequest." + error; + } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + if (message.operation != null && message.hasOwnProperty("operation")) { + var error = $root.google.logging.v2.LogEntryOperation.verify(message.operation); + if (error) + return "operation." + error; + } + if (message.trace != null && message.hasOwnProperty("trace")) + if (!$util.isString(message.trace)) + return "trace: string expected"; + if (message.spanId != null && message.hasOwnProperty("spanId")) + if (!$util.isString(message.spanId)) + return "spanId: string expected"; + if (message.traceSampled != null && message.hasOwnProperty("traceSampled")) + if (typeof message.traceSampled !== "boolean") + return "traceSampled: boolean expected"; + if (message.sourceLocation != null && message.hasOwnProperty("sourceLocation")) { + var error = $root.google.logging.v2.LogEntrySourceLocation.verify(message.sourceLocation); + if (error) + return "sourceLocation." + error; + } + if (message.split != null && message.hasOwnProperty("split")) { + var error = $root.google.logging.v2.LogSplit.verify(message.split); + if (error) + return "split." + error; + } + return null; + }; + + /** + * Creates a LogEntry message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.LogEntry + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.LogEntry} LogEntry + */ + LogEntry.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.LogEntry) + return object; + var message = new $root.google.logging.v2.LogEntry(); + if (object.logName != null) + message.logName = String(object.logName); + if (object.resource != null) { + if (typeof object.resource !== "object") + throw TypeError(".google.logging.v2.LogEntry.resource: object expected"); + message.resource = $root.google.api.MonitoredResource.fromObject(object.resource); + } + if (object.protoPayload != null) { + if (typeof object.protoPayload !== "object") + throw TypeError(".google.logging.v2.LogEntry.protoPayload: object expected"); + message.protoPayload = $root.google.protobuf.Any.fromObject(object.protoPayload); + } + if (object.textPayload != null) + message.textPayload = String(object.textPayload); + if (object.jsonPayload != null) { + if (typeof object.jsonPayload !== "object") + throw TypeError(".google.logging.v2.LogEntry.jsonPayload: object expected"); + message.jsonPayload = $root.google.protobuf.Struct.fromObject(object.jsonPayload); + } + if (object.timestamp != null) { + if (typeof object.timestamp !== "object") + throw TypeError(".google.logging.v2.LogEntry.timestamp: object expected"); + message.timestamp = $root.google.protobuf.Timestamp.fromObject(object.timestamp); + } + if (object.receiveTimestamp != null) { + if (typeof object.receiveTimestamp !== "object") + throw TypeError(".google.logging.v2.LogEntry.receiveTimestamp: object expected"); + message.receiveTimestamp = $root.google.protobuf.Timestamp.fromObject(object.receiveTimestamp); + } + switch (object.severity) { + default: + if (typeof object.severity === "number") { + message.severity = object.severity; + break; + } + break; + case "DEFAULT": + case 0: + message.severity = 0; + break; + case "DEBUG": + case 100: + message.severity = 100; + break; + case "INFO": + case 200: + message.severity = 200; + break; + case "NOTICE": + case 300: + message.severity = 300; + break; + case "WARNING": + case 400: + message.severity = 400; + break; + case "ERROR": + case 500: + message.severity = 500; + break; + case "CRITICAL": + case 600: + message.severity = 600; + break; + case "ALERT": + case 700: + message.severity = 700; + break; + case "EMERGENCY": + case 800: + message.severity = 800; + break; + } + if (object.insertId != null) + message.insertId = String(object.insertId); + if (object.httpRequest != null) { + if (typeof object.httpRequest !== "object") + throw TypeError(".google.logging.v2.LogEntry.httpRequest: object expected"); + message.httpRequest = $root.google.logging.type.HttpRequest.fromObject(object.httpRequest); + } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.logging.v2.LogEntry.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + if (object.operation != null) { + if (typeof object.operation !== "object") + throw TypeError(".google.logging.v2.LogEntry.operation: object expected"); + message.operation = $root.google.logging.v2.LogEntryOperation.fromObject(object.operation); + } + if (object.trace != null) + message.trace = String(object.trace); + if (object.spanId != null) + message.spanId = String(object.spanId); + if (object.traceSampled != null) + message.traceSampled = Boolean(object.traceSampled); + if (object.sourceLocation != null) { + if (typeof object.sourceLocation !== "object") + throw TypeError(".google.logging.v2.LogEntry.sourceLocation: object expected"); + message.sourceLocation = $root.google.logging.v2.LogEntrySourceLocation.fromObject(object.sourceLocation); + } + if (object.split != null) { + if (typeof object.split !== "object") + throw TypeError(".google.logging.v2.LogEntry.split: object expected"); + message.split = $root.google.logging.v2.LogSplit.fromObject(object.split); + } + return message; + }; + + /** + * Creates a plain object from a LogEntry message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.LogEntry + * @static + * @param {google.logging.v2.LogEntry} message LogEntry + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LogEntry.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) { + object.insertId = ""; + object.httpRequest = null; + object.resource = null; + object.timestamp = null; + object.severity = options.enums === String ? "DEFAULT" : 0; + object.logName = ""; + object.operation = null; + object.trace = ""; + object.sourceLocation = null; + object.receiveTimestamp = null; + object.spanId = ""; + object.traceSampled = false; + object.split = null; + } + if (message.protoPayload != null && message.hasOwnProperty("protoPayload")) { + object.protoPayload = $root.google.protobuf.Any.toObject(message.protoPayload, options); + if (options.oneofs) + object.payload = "protoPayload"; + } + if (message.textPayload != null && message.hasOwnProperty("textPayload")) { + object.textPayload = message.textPayload; + if (options.oneofs) + object.payload = "textPayload"; + } + if (message.insertId != null && message.hasOwnProperty("insertId")) + object.insertId = message.insertId; + if (message.jsonPayload != null && message.hasOwnProperty("jsonPayload")) { + object.jsonPayload = $root.google.protobuf.Struct.toObject(message.jsonPayload, options); + if (options.oneofs) + object.payload = "jsonPayload"; + } + if (message.httpRequest != null && message.hasOwnProperty("httpRequest")) + object.httpRequest = $root.google.logging.type.HttpRequest.toObject(message.httpRequest, options); + if (message.resource != null && message.hasOwnProperty("resource")) + object.resource = $root.google.api.MonitoredResource.toObject(message.resource, options); + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + object.timestamp = $root.google.protobuf.Timestamp.toObject(message.timestamp, options); + if (message.severity != null && message.hasOwnProperty("severity")) + object.severity = options.enums === String ? $root.google.logging.type.LogSeverity[message.severity] === undefined ? message.severity : $root.google.logging.type.LogSeverity[message.severity] : message.severity; + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + if (message.logName != null && message.hasOwnProperty("logName")) + object.logName = message.logName; + if (message.operation != null && message.hasOwnProperty("operation")) + object.operation = $root.google.logging.v2.LogEntryOperation.toObject(message.operation, options); + if (message.trace != null && message.hasOwnProperty("trace")) + object.trace = message.trace; + if (message.sourceLocation != null && message.hasOwnProperty("sourceLocation")) + object.sourceLocation = $root.google.logging.v2.LogEntrySourceLocation.toObject(message.sourceLocation, options); + if (message.receiveTimestamp != null && message.hasOwnProperty("receiveTimestamp")) + object.receiveTimestamp = $root.google.protobuf.Timestamp.toObject(message.receiveTimestamp, options); + if (message.spanId != null && message.hasOwnProperty("spanId")) + object.spanId = message.spanId; + if (message.traceSampled != null && message.hasOwnProperty("traceSampled")) + object.traceSampled = message.traceSampled; + if (message.split != null && message.hasOwnProperty("split")) + object.split = $root.google.logging.v2.LogSplit.toObject(message.split, options); + return object; + }; + + /** + * Converts this LogEntry to JSON. + * @function toJSON + * @memberof google.logging.v2.LogEntry + * @instance + * @returns {Object.} JSON object + */ + LogEntry.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LogEntry + * @function getTypeUrl + * @memberof google.logging.v2.LogEntry + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LogEntry.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.LogEntry"; + }; + + return LogEntry; + })(); + + v2.LogEntryOperation = (function() { + + /** + * Properties of a LogEntryOperation. + * @memberof google.logging.v2 + * @interface ILogEntryOperation + * @property {string|null} [id] LogEntryOperation id + * @property {string|null} [producer] LogEntryOperation producer + * @property {boolean|null} [first] LogEntryOperation first + * @property {boolean|null} [last] LogEntryOperation last + */ + + /** + * Constructs a new LogEntryOperation. + * @memberof google.logging.v2 + * @classdesc Represents a LogEntryOperation. + * @implements ILogEntryOperation + * @constructor + * @param {google.logging.v2.ILogEntryOperation=} [properties] Properties to set + */ + function LogEntryOperation(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LogEntryOperation id. + * @member {string} id + * @memberof google.logging.v2.LogEntryOperation + * @instance + */ + LogEntryOperation.prototype.id = ""; + + /** + * LogEntryOperation producer. + * @member {string} producer + * @memberof google.logging.v2.LogEntryOperation + * @instance + */ + LogEntryOperation.prototype.producer = ""; + + /** + * LogEntryOperation first. + * @member {boolean} first + * @memberof google.logging.v2.LogEntryOperation + * @instance + */ + LogEntryOperation.prototype.first = false; + + /** + * LogEntryOperation last. + * @member {boolean} last + * @memberof google.logging.v2.LogEntryOperation + * @instance + */ + LogEntryOperation.prototype.last = false; + + /** + * Creates a new LogEntryOperation instance using the specified properties. + * @function create + * @memberof google.logging.v2.LogEntryOperation + * @static + * @param {google.logging.v2.ILogEntryOperation=} [properties] Properties to set + * @returns {google.logging.v2.LogEntryOperation} LogEntryOperation instance + */ + LogEntryOperation.create = function create(properties) { + return new LogEntryOperation(properties); + }; + + /** + * Encodes the specified LogEntryOperation message. Does not implicitly {@link google.logging.v2.LogEntryOperation.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.LogEntryOperation + * @static + * @param {google.logging.v2.ILogEntryOperation} message LogEntryOperation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LogEntryOperation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.id != null && Object.hasOwnProperty.call(message, "id")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.id); + if (message.producer != null && Object.hasOwnProperty.call(message, "producer")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.producer); + if (message.first != null && Object.hasOwnProperty.call(message, "first")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.first); + if (message.last != null && Object.hasOwnProperty.call(message, "last")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.last); + return writer; + }; + + /** + * Encodes the specified LogEntryOperation message, length delimited. Does not implicitly {@link google.logging.v2.LogEntryOperation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.LogEntryOperation + * @static + * @param {google.logging.v2.ILogEntryOperation} message LogEntryOperation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LogEntryOperation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LogEntryOperation message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.LogEntryOperation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.LogEntryOperation} LogEntryOperation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LogEntryOperation.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.LogEntryOperation(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.id = reader.string(); + break; + } + case 2: { + message.producer = reader.string(); + break; + } + case 3: { + message.first = reader.bool(); + break; + } + case 4: { + message.last = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LogEntryOperation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.LogEntryOperation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.LogEntryOperation} LogEntryOperation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LogEntryOperation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LogEntryOperation message. + * @function verify + * @memberof google.logging.v2.LogEntryOperation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LogEntryOperation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.id != null && message.hasOwnProperty("id")) + if (!$util.isString(message.id)) + return "id: string expected"; + if (message.producer != null && message.hasOwnProperty("producer")) + if (!$util.isString(message.producer)) + return "producer: string expected"; + if (message.first != null && message.hasOwnProperty("first")) + if (typeof message.first !== "boolean") + return "first: boolean expected"; + if (message.last != null && message.hasOwnProperty("last")) + if (typeof message.last !== "boolean") + return "last: boolean expected"; + return null; + }; + + /** + * Creates a LogEntryOperation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.LogEntryOperation + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.LogEntryOperation} LogEntryOperation + */ + LogEntryOperation.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.LogEntryOperation) + return object; + var message = new $root.google.logging.v2.LogEntryOperation(); + if (object.id != null) + message.id = String(object.id); + if (object.producer != null) + message.producer = String(object.producer); + if (object.first != null) + message.first = Boolean(object.first); + if (object.last != null) + message.last = Boolean(object.last); + return message; + }; + + /** + * Creates a plain object from a LogEntryOperation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.LogEntryOperation + * @static + * @param {google.logging.v2.LogEntryOperation} message LogEntryOperation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LogEntryOperation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.id = ""; + object.producer = ""; + object.first = false; + object.last = false; + } + if (message.id != null && message.hasOwnProperty("id")) + object.id = message.id; + if (message.producer != null && message.hasOwnProperty("producer")) + object.producer = message.producer; + if (message.first != null && message.hasOwnProperty("first")) + object.first = message.first; + if (message.last != null && message.hasOwnProperty("last")) + object.last = message.last; + return object; + }; + + /** + * Converts this LogEntryOperation to JSON. + * @function toJSON + * @memberof google.logging.v2.LogEntryOperation + * @instance + * @returns {Object.} JSON object + */ + LogEntryOperation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LogEntryOperation + * @function getTypeUrl + * @memberof google.logging.v2.LogEntryOperation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LogEntryOperation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.LogEntryOperation"; + }; + + return LogEntryOperation; + })(); + + v2.LogEntrySourceLocation = (function() { + + /** + * Properties of a LogEntrySourceLocation. + * @memberof google.logging.v2 + * @interface ILogEntrySourceLocation + * @property {string|null} [file] LogEntrySourceLocation file + * @property {number|Long|null} [line] LogEntrySourceLocation line + * @property {string|null} ["function"] LogEntrySourceLocation function + */ + + /** + * Constructs a new LogEntrySourceLocation. + * @memberof google.logging.v2 + * @classdesc Represents a LogEntrySourceLocation. + * @implements ILogEntrySourceLocation + * @constructor + * @param {google.logging.v2.ILogEntrySourceLocation=} [properties] Properties to set + */ + function LogEntrySourceLocation(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LogEntrySourceLocation file. + * @member {string} file + * @memberof google.logging.v2.LogEntrySourceLocation + * @instance + */ + LogEntrySourceLocation.prototype.file = ""; + + /** + * LogEntrySourceLocation line. + * @member {number|Long} line + * @memberof google.logging.v2.LogEntrySourceLocation + * @instance + */ + LogEntrySourceLocation.prototype.line = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * LogEntrySourceLocation function. + * @member {string} function + * @memberof google.logging.v2.LogEntrySourceLocation + * @instance + */ + LogEntrySourceLocation.prototype["function"] = ""; + + /** + * Creates a new LogEntrySourceLocation instance using the specified properties. + * @function create + * @memberof google.logging.v2.LogEntrySourceLocation + * @static + * @param {google.logging.v2.ILogEntrySourceLocation=} [properties] Properties to set + * @returns {google.logging.v2.LogEntrySourceLocation} LogEntrySourceLocation instance + */ + LogEntrySourceLocation.create = function create(properties) { + return new LogEntrySourceLocation(properties); + }; + + /** + * Encodes the specified LogEntrySourceLocation message. Does not implicitly {@link google.logging.v2.LogEntrySourceLocation.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.LogEntrySourceLocation + * @static + * @param {google.logging.v2.ILogEntrySourceLocation} message LogEntrySourceLocation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LogEntrySourceLocation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.file != null && Object.hasOwnProperty.call(message, "file")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.file); + if (message.line != null && Object.hasOwnProperty.call(message, "line")) + writer.uint32(/* id 2, wireType 0 =*/16).int64(message.line); + if (message["function"] != null && Object.hasOwnProperty.call(message, "function")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message["function"]); + return writer; + }; + + /** + * Encodes the specified LogEntrySourceLocation message, length delimited. Does not implicitly {@link google.logging.v2.LogEntrySourceLocation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.LogEntrySourceLocation + * @static + * @param {google.logging.v2.ILogEntrySourceLocation} message LogEntrySourceLocation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LogEntrySourceLocation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LogEntrySourceLocation message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.LogEntrySourceLocation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.LogEntrySourceLocation} LogEntrySourceLocation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LogEntrySourceLocation.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.LogEntrySourceLocation(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.file = reader.string(); + break; + } + case 2: { + message.line = reader.int64(); + break; + } + case 3: { + message["function"] = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LogEntrySourceLocation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.LogEntrySourceLocation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.LogEntrySourceLocation} LogEntrySourceLocation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LogEntrySourceLocation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LogEntrySourceLocation message. + * @function verify + * @memberof google.logging.v2.LogEntrySourceLocation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LogEntrySourceLocation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.file != null && message.hasOwnProperty("file")) + if (!$util.isString(message.file)) + return "file: string expected"; + if (message.line != null && message.hasOwnProperty("line")) + if (!$util.isInteger(message.line) && !(message.line && $util.isInteger(message.line.low) && $util.isInteger(message.line.high))) + return "line: integer|Long expected"; + if (message["function"] != null && message.hasOwnProperty("function")) + if (!$util.isString(message["function"])) + return "function: string expected"; + return null; + }; + + /** + * Creates a LogEntrySourceLocation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.LogEntrySourceLocation + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.LogEntrySourceLocation} LogEntrySourceLocation + */ + LogEntrySourceLocation.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.LogEntrySourceLocation) + return object; + var message = new $root.google.logging.v2.LogEntrySourceLocation(); + if (object.file != null) + message.file = String(object.file); + if (object.line != null) + if ($util.Long) + (message.line = $util.Long.fromValue(object.line)).unsigned = false; + else if (typeof object.line === "string") + message.line = parseInt(object.line, 10); + else if (typeof object.line === "number") + message.line = object.line; + else if (typeof object.line === "object") + message.line = new $util.LongBits(object.line.low >>> 0, object.line.high >>> 0).toNumber(); + if (object["function"] != null) + message["function"] = String(object["function"]); + return message; + }; + + /** + * Creates a plain object from a LogEntrySourceLocation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.LogEntrySourceLocation + * @static + * @param {google.logging.v2.LogEntrySourceLocation} message LogEntrySourceLocation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LogEntrySourceLocation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.file = ""; + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.line = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.line = options.longs === String ? "0" : 0; + object["function"] = ""; + } + if (message.file != null && message.hasOwnProperty("file")) + object.file = message.file; + if (message.line != null && message.hasOwnProperty("line")) + if (typeof message.line === "number") + object.line = options.longs === String ? String(message.line) : message.line; + else + object.line = options.longs === String ? $util.Long.prototype.toString.call(message.line) : options.longs === Number ? new $util.LongBits(message.line.low >>> 0, message.line.high >>> 0).toNumber() : message.line; + if (message["function"] != null && message.hasOwnProperty("function")) + object["function"] = message["function"]; + return object; + }; + + /** + * Converts this LogEntrySourceLocation to JSON. + * @function toJSON + * @memberof google.logging.v2.LogEntrySourceLocation + * @instance + * @returns {Object.} JSON object + */ + LogEntrySourceLocation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LogEntrySourceLocation + * @function getTypeUrl + * @memberof google.logging.v2.LogEntrySourceLocation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LogEntrySourceLocation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.LogEntrySourceLocation"; + }; + + return LogEntrySourceLocation; + })(); + + v2.LogSplit = (function() { + + /** + * Properties of a LogSplit. + * @memberof google.logging.v2 + * @interface ILogSplit + * @property {string|null} [uid] LogSplit uid + * @property {number|null} [index] LogSplit index + * @property {number|null} [totalSplits] LogSplit totalSplits + */ + + /** + * Constructs a new LogSplit. + * @memberof google.logging.v2 + * @classdesc Represents a LogSplit. + * @implements ILogSplit + * @constructor + * @param {google.logging.v2.ILogSplit=} [properties] Properties to set + */ + function LogSplit(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LogSplit uid. + * @member {string} uid + * @memberof google.logging.v2.LogSplit + * @instance + */ + LogSplit.prototype.uid = ""; + + /** + * LogSplit index. + * @member {number} index + * @memberof google.logging.v2.LogSplit + * @instance + */ + LogSplit.prototype.index = 0; + + /** + * LogSplit totalSplits. + * @member {number} totalSplits + * @memberof google.logging.v2.LogSplit + * @instance + */ + LogSplit.prototype.totalSplits = 0; + + /** + * Creates a new LogSplit instance using the specified properties. + * @function create + * @memberof google.logging.v2.LogSplit + * @static + * @param {google.logging.v2.ILogSplit=} [properties] Properties to set + * @returns {google.logging.v2.LogSplit} LogSplit instance + */ + LogSplit.create = function create(properties) { + return new LogSplit(properties); + }; + + /** + * Encodes the specified LogSplit message. Does not implicitly {@link google.logging.v2.LogSplit.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.LogSplit + * @static + * @param {google.logging.v2.ILogSplit} message LogSplit message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LogSplit.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.uid != null && Object.hasOwnProperty.call(message, "uid")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.uid); + if (message.index != null && Object.hasOwnProperty.call(message, "index")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.index); + if (message.totalSplits != null && Object.hasOwnProperty.call(message, "totalSplits")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.totalSplits); + return writer; + }; + + /** + * Encodes the specified LogSplit message, length delimited. Does not implicitly {@link google.logging.v2.LogSplit.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.LogSplit + * @static + * @param {google.logging.v2.ILogSplit} message LogSplit message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LogSplit.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LogSplit message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.LogSplit + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.LogSplit} LogSplit + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LogSplit.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.LogSplit(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.uid = reader.string(); + break; + } + case 2: { + message.index = reader.int32(); + break; + } + case 3: { + message.totalSplits = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LogSplit message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.LogSplit + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.LogSplit} LogSplit + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LogSplit.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LogSplit message. + * @function verify + * @memberof google.logging.v2.LogSplit + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LogSplit.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.uid != null && message.hasOwnProperty("uid")) + if (!$util.isString(message.uid)) + return "uid: string expected"; + if (message.index != null && message.hasOwnProperty("index")) + if (!$util.isInteger(message.index)) + return "index: integer expected"; + if (message.totalSplits != null && message.hasOwnProperty("totalSplits")) + if (!$util.isInteger(message.totalSplits)) + return "totalSplits: integer expected"; + return null; + }; + + /** + * Creates a LogSplit message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.LogSplit + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.LogSplit} LogSplit + */ + LogSplit.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.LogSplit) + return object; + var message = new $root.google.logging.v2.LogSplit(); + if (object.uid != null) + message.uid = String(object.uid); + if (object.index != null) + message.index = object.index | 0; + if (object.totalSplits != null) + message.totalSplits = object.totalSplits | 0; + return message; + }; + + /** + * Creates a plain object from a LogSplit message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.LogSplit + * @static + * @param {google.logging.v2.LogSplit} message LogSplit + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LogSplit.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.uid = ""; + object.index = 0; + object.totalSplits = 0; + } + if (message.uid != null && message.hasOwnProperty("uid")) + object.uid = message.uid; + if (message.index != null && message.hasOwnProperty("index")) + object.index = message.index; + if (message.totalSplits != null && message.hasOwnProperty("totalSplits")) + object.totalSplits = message.totalSplits; + return object; + }; + + /** + * Converts this LogSplit to JSON. + * @function toJSON + * @memberof google.logging.v2.LogSplit + * @instance + * @returns {Object.} JSON object + */ + LogSplit.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LogSplit + * @function getTypeUrl + * @memberof google.logging.v2.LogSplit + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LogSplit.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.LogSplit"; + }; + + return LogSplit; + })(); + + v2.LoggingServiceV2 = (function() { + + /** + * Constructs a new LoggingServiceV2 service. + * @memberof google.logging.v2 + * @classdesc Represents a LoggingServiceV2 + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function LoggingServiceV2(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (LoggingServiceV2.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = LoggingServiceV2; + + /** + * Creates new LoggingServiceV2 service using the specified rpc implementation. + * @function create + * @memberof google.logging.v2.LoggingServiceV2 + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {LoggingServiceV2} RPC service. Useful where requests and/or responses are streamed. + */ + LoggingServiceV2.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.logging.v2.LoggingServiceV2|deleteLog}. + * @memberof google.logging.v2.LoggingServiceV2 + * @typedef DeleteLogCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteLog. + * @function deleteLog + * @memberof google.logging.v2.LoggingServiceV2 + * @instance + * @param {google.logging.v2.IDeleteLogRequest} request DeleteLogRequest message or plain object + * @param {google.logging.v2.LoggingServiceV2.DeleteLogCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(LoggingServiceV2.prototype.deleteLog = function deleteLog(request, callback) { + return this.rpcCall(deleteLog, $root.google.logging.v2.DeleteLogRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteLog" }); + + /** + * Calls DeleteLog. + * @function deleteLog + * @memberof google.logging.v2.LoggingServiceV2 + * @instance + * @param {google.logging.v2.IDeleteLogRequest} request DeleteLogRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.LoggingServiceV2|writeLogEntries}. + * @memberof google.logging.v2.LoggingServiceV2 + * @typedef WriteLogEntriesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.logging.v2.WriteLogEntriesResponse} [response] WriteLogEntriesResponse + */ + + /** + * Calls WriteLogEntries. + * @function writeLogEntries + * @memberof google.logging.v2.LoggingServiceV2 + * @instance + * @param {google.logging.v2.IWriteLogEntriesRequest} request WriteLogEntriesRequest message or plain object + * @param {google.logging.v2.LoggingServiceV2.WriteLogEntriesCallback} callback Node-style callback called with the error, if any, and WriteLogEntriesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(LoggingServiceV2.prototype.writeLogEntries = function writeLogEntries(request, callback) { + return this.rpcCall(writeLogEntries, $root.google.logging.v2.WriteLogEntriesRequest, $root.google.logging.v2.WriteLogEntriesResponse, request, callback); + }, "name", { value: "WriteLogEntries" }); + + /** + * Calls WriteLogEntries. + * @function writeLogEntries + * @memberof google.logging.v2.LoggingServiceV2 + * @instance + * @param {google.logging.v2.IWriteLogEntriesRequest} request WriteLogEntriesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.LoggingServiceV2|listLogEntries}. + * @memberof google.logging.v2.LoggingServiceV2 + * @typedef ListLogEntriesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.logging.v2.ListLogEntriesResponse} [response] ListLogEntriesResponse + */ + + /** + * Calls ListLogEntries. + * @function listLogEntries + * @memberof google.logging.v2.LoggingServiceV2 + * @instance + * @param {google.logging.v2.IListLogEntriesRequest} request ListLogEntriesRequest message or plain object + * @param {google.logging.v2.LoggingServiceV2.ListLogEntriesCallback} callback Node-style callback called with the error, if any, and ListLogEntriesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(LoggingServiceV2.prototype.listLogEntries = function listLogEntries(request, callback) { + return this.rpcCall(listLogEntries, $root.google.logging.v2.ListLogEntriesRequest, $root.google.logging.v2.ListLogEntriesResponse, request, callback); + }, "name", { value: "ListLogEntries" }); + + /** + * Calls ListLogEntries. + * @function listLogEntries + * @memberof google.logging.v2.LoggingServiceV2 + * @instance + * @param {google.logging.v2.IListLogEntriesRequest} request ListLogEntriesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.LoggingServiceV2|listMonitoredResourceDescriptors}. + * @memberof google.logging.v2.LoggingServiceV2 + * @typedef ListMonitoredResourceDescriptorsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.logging.v2.ListMonitoredResourceDescriptorsResponse} [response] ListMonitoredResourceDescriptorsResponse + */ + + /** + * Calls ListMonitoredResourceDescriptors. + * @function listMonitoredResourceDescriptors + * @memberof google.logging.v2.LoggingServiceV2 + * @instance + * @param {google.logging.v2.IListMonitoredResourceDescriptorsRequest} request ListMonitoredResourceDescriptorsRequest message or plain object + * @param {google.logging.v2.LoggingServiceV2.ListMonitoredResourceDescriptorsCallback} callback Node-style callback called with the error, if any, and ListMonitoredResourceDescriptorsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(LoggingServiceV2.prototype.listMonitoredResourceDescriptors = function listMonitoredResourceDescriptors(request, callback) { + return this.rpcCall(listMonitoredResourceDescriptors, $root.google.logging.v2.ListMonitoredResourceDescriptorsRequest, $root.google.logging.v2.ListMonitoredResourceDescriptorsResponse, request, callback); + }, "name", { value: "ListMonitoredResourceDescriptors" }); + + /** + * Calls ListMonitoredResourceDescriptors. + * @function listMonitoredResourceDescriptors + * @memberof google.logging.v2.LoggingServiceV2 + * @instance + * @param {google.logging.v2.IListMonitoredResourceDescriptorsRequest} request ListMonitoredResourceDescriptorsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.LoggingServiceV2|listLogs}. + * @memberof google.logging.v2.LoggingServiceV2 + * @typedef ListLogsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.logging.v2.ListLogsResponse} [response] ListLogsResponse + */ + + /** + * Calls ListLogs. + * @function listLogs + * @memberof google.logging.v2.LoggingServiceV2 + * @instance + * @param {google.logging.v2.IListLogsRequest} request ListLogsRequest message or plain object + * @param {google.logging.v2.LoggingServiceV2.ListLogsCallback} callback Node-style callback called with the error, if any, and ListLogsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(LoggingServiceV2.prototype.listLogs = function listLogs(request, callback) { + return this.rpcCall(listLogs, $root.google.logging.v2.ListLogsRequest, $root.google.logging.v2.ListLogsResponse, request, callback); + }, "name", { value: "ListLogs" }); + + /** + * Calls ListLogs. + * @function listLogs + * @memberof google.logging.v2.LoggingServiceV2 + * @instance + * @param {google.logging.v2.IListLogsRequest} request ListLogsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.LoggingServiceV2|tailLogEntries}. + * @memberof google.logging.v2.LoggingServiceV2 + * @typedef TailLogEntriesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.logging.v2.TailLogEntriesResponse} [response] TailLogEntriesResponse + */ + + /** + * Calls TailLogEntries. + * @function tailLogEntries + * @memberof google.logging.v2.LoggingServiceV2 + * @instance + * @param {google.logging.v2.ITailLogEntriesRequest} request TailLogEntriesRequest message or plain object + * @param {google.logging.v2.LoggingServiceV2.TailLogEntriesCallback} callback Node-style callback called with the error, if any, and TailLogEntriesResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(LoggingServiceV2.prototype.tailLogEntries = function tailLogEntries(request, callback) { + return this.rpcCall(tailLogEntries, $root.google.logging.v2.TailLogEntriesRequest, $root.google.logging.v2.TailLogEntriesResponse, request, callback); + }, "name", { value: "TailLogEntries" }); + + /** + * Calls TailLogEntries. + * @function tailLogEntries + * @memberof google.logging.v2.LoggingServiceV2 + * @instance + * @param {google.logging.v2.ITailLogEntriesRequest} request TailLogEntriesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return LoggingServiceV2; + })(); + + v2.DeleteLogRequest = (function() { + + /** + * Properties of a DeleteLogRequest. + * @memberof google.logging.v2 + * @interface IDeleteLogRequest + * @property {string|null} [logName] DeleteLogRequest logName + */ + + /** + * Constructs a new DeleteLogRequest. + * @memberof google.logging.v2 + * @classdesc Represents a DeleteLogRequest. + * @implements IDeleteLogRequest + * @constructor + * @param {google.logging.v2.IDeleteLogRequest=} [properties] Properties to set + */ + function DeleteLogRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteLogRequest logName. + * @member {string} logName + * @memberof google.logging.v2.DeleteLogRequest + * @instance + */ + DeleteLogRequest.prototype.logName = ""; + + /** + * Creates a new DeleteLogRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.DeleteLogRequest + * @static + * @param {google.logging.v2.IDeleteLogRequest=} [properties] Properties to set + * @returns {google.logging.v2.DeleteLogRequest} DeleteLogRequest instance + */ + DeleteLogRequest.create = function create(properties) { + return new DeleteLogRequest(properties); + }; + + /** + * Encodes the specified DeleteLogRequest message. Does not implicitly {@link google.logging.v2.DeleteLogRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.DeleteLogRequest + * @static + * @param {google.logging.v2.IDeleteLogRequest} message DeleteLogRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteLogRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.logName != null && Object.hasOwnProperty.call(message, "logName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.logName); + return writer; + }; + + /** + * Encodes the specified DeleteLogRequest message, length delimited. Does not implicitly {@link google.logging.v2.DeleteLogRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.DeleteLogRequest + * @static + * @param {google.logging.v2.IDeleteLogRequest} message DeleteLogRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteLogRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteLogRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.DeleteLogRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.DeleteLogRequest} DeleteLogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteLogRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.DeleteLogRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.logName = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteLogRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.DeleteLogRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.DeleteLogRequest} DeleteLogRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteLogRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteLogRequest message. + * @function verify + * @memberof google.logging.v2.DeleteLogRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteLogRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.logName != null && message.hasOwnProperty("logName")) + if (!$util.isString(message.logName)) + return "logName: string expected"; + return null; + }; + + /** + * Creates a DeleteLogRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.DeleteLogRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.DeleteLogRequest} DeleteLogRequest + */ + DeleteLogRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.DeleteLogRequest) + return object; + var message = new $root.google.logging.v2.DeleteLogRequest(); + if (object.logName != null) + message.logName = String(object.logName); + return message; + }; + + /** + * Creates a plain object from a DeleteLogRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.DeleteLogRequest + * @static + * @param {google.logging.v2.DeleteLogRequest} message DeleteLogRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteLogRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.logName = ""; + if (message.logName != null && message.hasOwnProperty("logName")) + object.logName = message.logName; + return object; + }; + + /** + * Converts this DeleteLogRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.DeleteLogRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteLogRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteLogRequest + * @function getTypeUrl + * @memberof google.logging.v2.DeleteLogRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteLogRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.DeleteLogRequest"; + }; + + return DeleteLogRequest; + })(); + + v2.WriteLogEntriesRequest = (function() { + + /** + * Properties of a WriteLogEntriesRequest. + * @memberof google.logging.v2 + * @interface IWriteLogEntriesRequest + * @property {string|null} [logName] WriteLogEntriesRequest logName + * @property {google.api.IMonitoredResource|null} [resource] WriteLogEntriesRequest resource + * @property {Object.|null} [labels] WriteLogEntriesRequest labels + * @property {Array.|null} [entries] WriteLogEntriesRequest entries + * @property {boolean|null} [partialSuccess] WriteLogEntriesRequest partialSuccess + * @property {boolean|null} [dryRun] WriteLogEntriesRequest dryRun + */ + + /** + * Constructs a new WriteLogEntriesRequest. + * @memberof google.logging.v2 + * @classdesc Represents a WriteLogEntriesRequest. + * @implements IWriteLogEntriesRequest + * @constructor + * @param {google.logging.v2.IWriteLogEntriesRequest=} [properties] Properties to set + */ + function WriteLogEntriesRequest(properties) { + this.labels = {}; + this.entries = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * WriteLogEntriesRequest logName. + * @member {string} logName + * @memberof google.logging.v2.WriteLogEntriesRequest + * @instance + */ + WriteLogEntriesRequest.prototype.logName = ""; + + /** + * WriteLogEntriesRequest resource. + * @member {google.api.IMonitoredResource|null|undefined} resource + * @memberof google.logging.v2.WriteLogEntriesRequest + * @instance + */ + WriteLogEntriesRequest.prototype.resource = null; + + /** + * WriteLogEntriesRequest labels. + * @member {Object.} labels + * @memberof google.logging.v2.WriteLogEntriesRequest + * @instance + */ + WriteLogEntriesRequest.prototype.labels = $util.emptyObject; + + /** + * WriteLogEntriesRequest entries. + * @member {Array.} entries + * @memberof google.logging.v2.WriteLogEntriesRequest + * @instance + */ + WriteLogEntriesRequest.prototype.entries = $util.emptyArray; + + /** + * WriteLogEntriesRequest partialSuccess. + * @member {boolean} partialSuccess + * @memberof google.logging.v2.WriteLogEntriesRequest + * @instance + */ + WriteLogEntriesRequest.prototype.partialSuccess = false; + + /** + * WriteLogEntriesRequest dryRun. + * @member {boolean} dryRun + * @memberof google.logging.v2.WriteLogEntriesRequest + * @instance + */ + WriteLogEntriesRequest.prototype.dryRun = false; + + /** + * Creates a new WriteLogEntriesRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.WriteLogEntriesRequest + * @static + * @param {google.logging.v2.IWriteLogEntriesRequest=} [properties] Properties to set + * @returns {google.logging.v2.WriteLogEntriesRequest} WriteLogEntriesRequest instance + */ + WriteLogEntriesRequest.create = function create(properties) { + return new WriteLogEntriesRequest(properties); + }; + + /** + * Encodes the specified WriteLogEntriesRequest message. Does not implicitly {@link google.logging.v2.WriteLogEntriesRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.WriteLogEntriesRequest + * @static + * @param {google.logging.v2.IWriteLogEntriesRequest} message WriteLogEntriesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WriteLogEntriesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.logName != null && Object.hasOwnProperty.call(message, "logName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.logName); + if (message.resource != null && Object.hasOwnProperty.call(message, "resource")) + $root.google.api.MonitoredResource.encode(message.resource, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + if (message.entries != null && message.entries.length) + for (var i = 0; i < message.entries.length; ++i) + $root.google.logging.v2.LogEntry.encode(message.entries[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.partialSuccess != null && Object.hasOwnProperty.call(message, "partialSuccess")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.partialSuccess); + if (message.dryRun != null && Object.hasOwnProperty.call(message, "dryRun")) + writer.uint32(/* id 6, wireType 0 =*/48).bool(message.dryRun); + return writer; + }; + + /** + * Encodes the specified WriteLogEntriesRequest message, length delimited. Does not implicitly {@link google.logging.v2.WriteLogEntriesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.WriteLogEntriesRequest + * @static + * @param {google.logging.v2.IWriteLogEntriesRequest} message WriteLogEntriesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WriteLogEntriesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WriteLogEntriesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.WriteLogEntriesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.WriteLogEntriesRequest} WriteLogEntriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WriteLogEntriesRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.WriteLogEntriesRequest(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.logName = reader.string(); + break; + } + case 2: { + message.resource = $root.google.api.MonitoredResource.decode(reader, reader.uint32()); + break; + } + case 3: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + } + case 4: { + if (!(message.entries && message.entries.length)) + message.entries = []; + message.entries.push($root.google.logging.v2.LogEntry.decode(reader, reader.uint32())); + break; + } + case 5: { + message.partialSuccess = reader.bool(); + break; + } + case 6: { + message.dryRun = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WriteLogEntriesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.WriteLogEntriesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.WriteLogEntriesRequest} WriteLogEntriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WriteLogEntriesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WriteLogEntriesRequest message. + * @function verify + * @memberof google.logging.v2.WriteLogEntriesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WriteLogEntriesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.logName != null && message.hasOwnProperty("logName")) + if (!$util.isString(message.logName)) + return "logName: string expected"; + if (message.resource != null && message.hasOwnProperty("resource")) { + var error = $root.google.api.MonitoredResource.verify(message.resource); + if (error) + return "resource." + error; + } + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + if (message.entries != null && message.hasOwnProperty("entries")) { + if (!Array.isArray(message.entries)) + return "entries: array expected"; + for (var i = 0; i < message.entries.length; ++i) { + var error = $root.google.logging.v2.LogEntry.verify(message.entries[i]); + if (error) + return "entries." + error; + } + } + if (message.partialSuccess != null && message.hasOwnProperty("partialSuccess")) + if (typeof message.partialSuccess !== "boolean") + return "partialSuccess: boolean expected"; + if (message.dryRun != null && message.hasOwnProperty("dryRun")) + if (typeof message.dryRun !== "boolean") + return "dryRun: boolean expected"; + return null; + }; + + /** + * Creates a WriteLogEntriesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.WriteLogEntriesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.WriteLogEntriesRequest} WriteLogEntriesRequest + */ + WriteLogEntriesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.WriteLogEntriesRequest) + return object; + var message = new $root.google.logging.v2.WriteLogEntriesRequest(); + if (object.logName != null) + message.logName = String(object.logName); + if (object.resource != null) { + if (typeof object.resource !== "object") + throw TypeError(".google.logging.v2.WriteLogEntriesRequest.resource: object expected"); + message.resource = $root.google.api.MonitoredResource.fromObject(object.resource); + } + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.logging.v2.WriteLogEntriesRequest.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + if (object.entries) { + if (!Array.isArray(object.entries)) + throw TypeError(".google.logging.v2.WriteLogEntriesRequest.entries: array expected"); + message.entries = []; + for (var i = 0; i < object.entries.length; ++i) { + if (typeof object.entries[i] !== "object") + throw TypeError(".google.logging.v2.WriteLogEntriesRequest.entries: object expected"); + message.entries[i] = $root.google.logging.v2.LogEntry.fromObject(object.entries[i]); + } + } + if (object.partialSuccess != null) + message.partialSuccess = Boolean(object.partialSuccess); + if (object.dryRun != null) + message.dryRun = Boolean(object.dryRun); + return message; + }; + + /** + * Creates a plain object from a WriteLogEntriesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.WriteLogEntriesRequest + * @static + * @param {google.logging.v2.WriteLogEntriesRequest} message WriteLogEntriesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WriteLogEntriesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.entries = []; + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) { + object.logName = ""; + object.resource = null; + object.partialSuccess = false; + object.dryRun = false; + } + if (message.logName != null && message.hasOwnProperty("logName")) + object.logName = message.logName; + if (message.resource != null && message.hasOwnProperty("resource")) + object.resource = $root.google.api.MonitoredResource.toObject(message.resource, options); + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + if (message.entries && message.entries.length) { + object.entries = []; + for (var j = 0; j < message.entries.length; ++j) + object.entries[j] = $root.google.logging.v2.LogEntry.toObject(message.entries[j], options); + } + if (message.partialSuccess != null && message.hasOwnProperty("partialSuccess")) + object.partialSuccess = message.partialSuccess; + if (message.dryRun != null && message.hasOwnProperty("dryRun")) + object.dryRun = message.dryRun; + return object; + }; + + /** + * Converts this WriteLogEntriesRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.WriteLogEntriesRequest + * @instance + * @returns {Object.} JSON object + */ + WriteLogEntriesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for WriteLogEntriesRequest + * @function getTypeUrl + * @memberof google.logging.v2.WriteLogEntriesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + WriteLogEntriesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.WriteLogEntriesRequest"; + }; + + return WriteLogEntriesRequest; + })(); + + v2.WriteLogEntriesResponse = (function() { + + /** + * Properties of a WriteLogEntriesResponse. + * @memberof google.logging.v2 + * @interface IWriteLogEntriesResponse + */ + + /** + * Constructs a new WriteLogEntriesResponse. + * @memberof google.logging.v2 + * @classdesc Represents a WriteLogEntriesResponse. + * @implements IWriteLogEntriesResponse + * @constructor + * @param {google.logging.v2.IWriteLogEntriesResponse=} [properties] Properties to set + */ + function WriteLogEntriesResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Creates a new WriteLogEntriesResponse instance using the specified properties. + * @function create + * @memberof google.logging.v2.WriteLogEntriesResponse + * @static + * @param {google.logging.v2.IWriteLogEntriesResponse=} [properties] Properties to set + * @returns {google.logging.v2.WriteLogEntriesResponse} WriteLogEntriesResponse instance + */ + WriteLogEntriesResponse.create = function create(properties) { + return new WriteLogEntriesResponse(properties); + }; + + /** + * Encodes the specified WriteLogEntriesResponse message. Does not implicitly {@link google.logging.v2.WriteLogEntriesResponse.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.WriteLogEntriesResponse + * @static + * @param {google.logging.v2.IWriteLogEntriesResponse} message WriteLogEntriesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WriteLogEntriesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + return writer; + }; + + /** + * Encodes the specified WriteLogEntriesResponse message, length delimited. Does not implicitly {@link google.logging.v2.WriteLogEntriesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.WriteLogEntriesResponse + * @static + * @param {google.logging.v2.IWriteLogEntriesResponse} message WriteLogEntriesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WriteLogEntriesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WriteLogEntriesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.WriteLogEntriesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.WriteLogEntriesResponse} WriteLogEntriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WriteLogEntriesResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.WriteLogEntriesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WriteLogEntriesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.WriteLogEntriesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.WriteLogEntriesResponse} WriteLogEntriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WriteLogEntriesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WriteLogEntriesResponse message. + * @function verify + * @memberof google.logging.v2.WriteLogEntriesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WriteLogEntriesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + return null; + }; + + /** + * Creates a WriteLogEntriesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.WriteLogEntriesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.WriteLogEntriesResponse} WriteLogEntriesResponse + */ + WriteLogEntriesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.WriteLogEntriesResponse) + return object; + return new $root.google.logging.v2.WriteLogEntriesResponse(); + }; + + /** + * Creates a plain object from a WriteLogEntriesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.WriteLogEntriesResponse + * @static + * @param {google.logging.v2.WriteLogEntriesResponse} message WriteLogEntriesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WriteLogEntriesResponse.toObject = function toObject() { + return {}; + }; + + /** + * Converts this WriteLogEntriesResponse to JSON. + * @function toJSON + * @memberof google.logging.v2.WriteLogEntriesResponse + * @instance + * @returns {Object.} JSON object + */ + WriteLogEntriesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for WriteLogEntriesResponse + * @function getTypeUrl + * @memberof google.logging.v2.WriteLogEntriesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + WriteLogEntriesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.WriteLogEntriesResponse"; + }; + + return WriteLogEntriesResponse; + })(); + + v2.WriteLogEntriesPartialErrors = (function() { + + /** + * Properties of a WriteLogEntriesPartialErrors. + * @memberof google.logging.v2 + * @interface IWriteLogEntriesPartialErrors + * @property {Object.|null} [logEntryErrors] WriteLogEntriesPartialErrors logEntryErrors + */ + + /** + * Constructs a new WriteLogEntriesPartialErrors. + * @memberof google.logging.v2 + * @classdesc Represents a WriteLogEntriesPartialErrors. + * @implements IWriteLogEntriesPartialErrors + * @constructor + * @param {google.logging.v2.IWriteLogEntriesPartialErrors=} [properties] Properties to set + */ + function WriteLogEntriesPartialErrors(properties) { + this.logEntryErrors = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * WriteLogEntriesPartialErrors logEntryErrors. + * @member {Object.} logEntryErrors + * @memberof google.logging.v2.WriteLogEntriesPartialErrors + * @instance + */ + WriteLogEntriesPartialErrors.prototype.logEntryErrors = $util.emptyObject; + + /** + * Creates a new WriteLogEntriesPartialErrors instance using the specified properties. + * @function create + * @memberof google.logging.v2.WriteLogEntriesPartialErrors + * @static + * @param {google.logging.v2.IWriteLogEntriesPartialErrors=} [properties] Properties to set + * @returns {google.logging.v2.WriteLogEntriesPartialErrors} WriteLogEntriesPartialErrors instance + */ + WriteLogEntriesPartialErrors.create = function create(properties) { + return new WriteLogEntriesPartialErrors(properties); + }; + + /** + * Encodes the specified WriteLogEntriesPartialErrors message. Does not implicitly {@link google.logging.v2.WriteLogEntriesPartialErrors.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.WriteLogEntriesPartialErrors + * @static + * @param {google.logging.v2.IWriteLogEntriesPartialErrors} message WriteLogEntriesPartialErrors message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WriteLogEntriesPartialErrors.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.logEntryErrors != null && Object.hasOwnProperty.call(message, "logEntryErrors")) + for (var keys = Object.keys(message.logEntryErrors), i = 0; i < keys.length; ++i) { + writer.uint32(/* id 1, wireType 2 =*/10).fork().uint32(/* id 1, wireType 0 =*/8).int32(keys[i]); + $root.google.rpc.Status.encode(message.logEntryErrors[keys[i]], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim().ldelim(); + } + return writer; + }; + + /** + * Encodes the specified WriteLogEntriesPartialErrors message, length delimited. Does not implicitly {@link google.logging.v2.WriteLogEntriesPartialErrors.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.WriteLogEntriesPartialErrors + * @static + * @param {google.logging.v2.IWriteLogEntriesPartialErrors} message WriteLogEntriesPartialErrors message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WriteLogEntriesPartialErrors.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WriteLogEntriesPartialErrors message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.WriteLogEntriesPartialErrors + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.WriteLogEntriesPartialErrors} WriteLogEntriesPartialErrors + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WriteLogEntriesPartialErrors.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.WriteLogEntriesPartialErrors(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (message.logEntryErrors === $util.emptyObject) + message.logEntryErrors = {}; + var end2 = reader.uint32() + reader.pos; + key = 0; + value = null; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.int32(); + break; + case 2: + value = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.logEntryErrors[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WriteLogEntriesPartialErrors message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.WriteLogEntriesPartialErrors + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.WriteLogEntriesPartialErrors} WriteLogEntriesPartialErrors + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WriteLogEntriesPartialErrors.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WriteLogEntriesPartialErrors message. + * @function verify + * @memberof google.logging.v2.WriteLogEntriesPartialErrors + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WriteLogEntriesPartialErrors.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.logEntryErrors != null && message.hasOwnProperty("logEntryErrors")) { + if (!$util.isObject(message.logEntryErrors)) + return "logEntryErrors: object expected"; + var key = Object.keys(message.logEntryErrors); + for (var i = 0; i < key.length; ++i) { + if (!$util.key32Re.test(key[i])) + return "logEntryErrors: integer key{k:int32} expected"; + { + var error = $root.google.rpc.Status.verify(message.logEntryErrors[key[i]]); + if (error) + return "logEntryErrors." + error; + } + } + } + return null; + }; + + /** + * Creates a WriteLogEntriesPartialErrors message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.WriteLogEntriesPartialErrors + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.WriteLogEntriesPartialErrors} WriteLogEntriesPartialErrors + */ + WriteLogEntriesPartialErrors.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.WriteLogEntriesPartialErrors) + return object; + var message = new $root.google.logging.v2.WriteLogEntriesPartialErrors(); + if (object.logEntryErrors) { + if (typeof object.logEntryErrors !== "object") + throw TypeError(".google.logging.v2.WriteLogEntriesPartialErrors.logEntryErrors: object expected"); + message.logEntryErrors = {}; + for (var keys = Object.keys(object.logEntryErrors), i = 0; i < keys.length; ++i) { + if (typeof object.logEntryErrors[keys[i]] !== "object") + throw TypeError(".google.logging.v2.WriteLogEntriesPartialErrors.logEntryErrors: object expected"); + message.logEntryErrors[keys[i]] = $root.google.rpc.Status.fromObject(object.logEntryErrors[keys[i]]); + } + } + return message; + }; + + /** + * Creates a plain object from a WriteLogEntriesPartialErrors message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.WriteLogEntriesPartialErrors + * @static + * @param {google.logging.v2.WriteLogEntriesPartialErrors} message WriteLogEntriesPartialErrors + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WriteLogEntriesPartialErrors.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.logEntryErrors = {}; + var keys2; + if (message.logEntryErrors && (keys2 = Object.keys(message.logEntryErrors)).length) { + object.logEntryErrors = {}; + for (var j = 0; j < keys2.length; ++j) + object.logEntryErrors[keys2[j]] = $root.google.rpc.Status.toObject(message.logEntryErrors[keys2[j]], options); + } + return object; + }; + + /** + * Converts this WriteLogEntriesPartialErrors to JSON. + * @function toJSON + * @memberof google.logging.v2.WriteLogEntriesPartialErrors + * @instance + * @returns {Object.} JSON object + */ + WriteLogEntriesPartialErrors.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for WriteLogEntriesPartialErrors + * @function getTypeUrl + * @memberof google.logging.v2.WriteLogEntriesPartialErrors + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + WriteLogEntriesPartialErrors.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.WriteLogEntriesPartialErrors"; + }; + + return WriteLogEntriesPartialErrors; + })(); + + v2.ListLogEntriesRequest = (function() { + + /** + * Properties of a ListLogEntriesRequest. + * @memberof google.logging.v2 + * @interface IListLogEntriesRequest + * @property {Array.|null} [resourceNames] ListLogEntriesRequest resourceNames + * @property {string|null} [filter] ListLogEntriesRequest filter + * @property {string|null} [orderBy] ListLogEntriesRequest orderBy + * @property {number|null} [pageSize] ListLogEntriesRequest pageSize + * @property {string|null} [pageToken] ListLogEntriesRequest pageToken + */ + + /** + * Constructs a new ListLogEntriesRequest. + * @memberof google.logging.v2 + * @classdesc Represents a ListLogEntriesRequest. + * @implements IListLogEntriesRequest + * @constructor + * @param {google.logging.v2.IListLogEntriesRequest=} [properties] Properties to set + */ + function ListLogEntriesRequest(properties) { + this.resourceNames = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListLogEntriesRequest resourceNames. + * @member {Array.} resourceNames + * @memberof google.logging.v2.ListLogEntriesRequest + * @instance + */ + ListLogEntriesRequest.prototype.resourceNames = $util.emptyArray; + + /** + * ListLogEntriesRequest filter. + * @member {string} filter + * @memberof google.logging.v2.ListLogEntriesRequest + * @instance + */ + ListLogEntriesRequest.prototype.filter = ""; + + /** + * ListLogEntriesRequest orderBy. + * @member {string} orderBy + * @memberof google.logging.v2.ListLogEntriesRequest + * @instance + */ + ListLogEntriesRequest.prototype.orderBy = ""; + + /** + * ListLogEntriesRequest pageSize. + * @member {number} pageSize + * @memberof google.logging.v2.ListLogEntriesRequest + * @instance + */ + ListLogEntriesRequest.prototype.pageSize = 0; + + /** + * ListLogEntriesRequest pageToken. + * @member {string} pageToken + * @memberof google.logging.v2.ListLogEntriesRequest + * @instance + */ + ListLogEntriesRequest.prototype.pageToken = ""; + + /** + * Creates a new ListLogEntriesRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.ListLogEntriesRequest + * @static + * @param {google.logging.v2.IListLogEntriesRequest=} [properties] Properties to set + * @returns {google.logging.v2.ListLogEntriesRequest} ListLogEntriesRequest instance + */ + ListLogEntriesRequest.create = function create(properties) { + return new ListLogEntriesRequest(properties); + }; + + /** + * Encodes the specified ListLogEntriesRequest message. Does not implicitly {@link google.logging.v2.ListLogEntriesRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.ListLogEntriesRequest + * @static + * @param {google.logging.v2.IListLogEntriesRequest} message ListLogEntriesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListLogEntriesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); + if (message.orderBy != null && Object.hasOwnProperty.call(message, "orderBy")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.orderBy); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.pageToken); + if (message.resourceNames != null && message.resourceNames.length) + for (var i = 0; i < message.resourceNames.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.resourceNames[i]); + return writer; + }; + + /** + * Encodes the specified ListLogEntriesRequest message, length delimited. Does not implicitly {@link google.logging.v2.ListLogEntriesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.ListLogEntriesRequest + * @static + * @param {google.logging.v2.IListLogEntriesRequest} message ListLogEntriesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListLogEntriesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListLogEntriesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.ListLogEntriesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.ListLogEntriesRequest} ListLogEntriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListLogEntriesRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.ListLogEntriesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 8: { + if (!(message.resourceNames && message.resourceNames.length)) + message.resourceNames = []; + message.resourceNames.push(reader.string()); + break; + } + case 2: { + message.filter = reader.string(); + break; + } + case 3: { + message.orderBy = reader.string(); + break; + } + case 4: { + message.pageSize = reader.int32(); + break; + } + case 5: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListLogEntriesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.ListLogEntriesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.ListLogEntriesRequest} ListLogEntriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListLogEntriesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListLogEntriesRequest message. + * @function verify + * @memberof google.logging.v2.ListLogEntriesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListLogEntriesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.resourceNames != null && message.hasOwnProperty("resourceNames")) { + if (!Array.isArray(message.resourceNames)) + return "resourceNames: array expected"; + for (var i = 0; i < message.resourceNames.length; ++i) + if (!$util.isString(message.resourceNames[i])) + return "resourceNames: string[] expected"; + } + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + if (!$util.isString(message.orderBy)) + return "orderBy: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListLogEntriesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.ListLogEntriesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.ListLogEntriesRequest} ListLogEntriesRequest + */ + ListLogEntriesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.ListLogEntriesRequest) + return object; + var message = new $root.google.logging.v2.ListLogEntriesRequest(); + if (object.resourceNames) { + if (!Array.isArray(object.resourceNames)) + throw TypeError(".google.logging.v2.ListLogEntriesRequest.resourceNames: array expected"); + message.resourceNames = []; + for (var i = 0; i < object.resourceNames.length; ++i) + message.resourceNames[i] = String(object.resourceNames[i]); + } + if (object.filter != null) + message.filter = String(object.filter); + if (object.orderBy != null) + message.orderBy = String(object.orderBy); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListLogEntriesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.ListLogEntriesRequest + * @static + * @param {google.logging.v2.ListLogEntriesRequest} message ListLogEntriesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListLogEntriesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.resourceNames = []; + if (options.defaults) { + object.filter = ""; + object.orderBy = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.orderBy != null && message.hasOwnProperty("orderBy")) + object.orderBy = message.orderBy; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.resourceNames && message.resourceNames.length) { + object.resourceNames = []; + for (var j = 0; j < message.resourceNames.length; ++j) + object.resourceNames[j] = message.resourceNames[j]; + } + return object; + }; + + /** + * Converts this ListLogEntriesRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.ListLogEntriesRequest + * @instance + * @returns {Object.} JSON object + */ + ListLogEntriesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListLogEntriesRequest + * @function getTypeUrl + * @memberof google.logging.v2.ListLogEntriesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListLogEntriesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.ListLogEntriesRequest"; + }; + + return ListLogEntriesRequest; + })(); + + v2.ListLogEntriesResponse = (function() { + + /** + * Properties of a ListLogEntriesResponse. + * @memberof google.logging.v2 + * @interface IListLogEntriesResponse + * @property {Array.|null} [entries] ListLogEntriesResponse entries + * @property {string|null} [nextPageToken] ListLogEntriesResponse nextPageToken + */ + + /** + * Constructs a new ListLogEntriesResponse. + * @memberof google.logging.v2 + * @classdesc Represents a ListLogEntriesResponse. + * @implements IListLogEntriesResponse + * @constructor + * @param {google.logging.v2.IListLogEntriesResponse=} [properties] Properties to set + */ + function ListLogEntriesResponse(properties) { + this.entries = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListLogEntriesResponse entries. + * @member {Array.} entries + * @memberof google.logging.v2.ListLogEntriesResponse + * @instance + */ + ListLogEntriesResponse.prototype.entries = $util.emptyArray; + + /** + * ListLogEntriesResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.logging.v2.ListLogEntriesResponse + * @instance + */ + ListLogEntriesResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListLogEntriesResponse instance using the specified properties. + * @function create + * @memberof google.logging.v2.ListLogEntriesResponse + * @static + * @param {google.logging.v2.IListLogEntriesResponse=} [properties] Properties to set + * @returns {google.logging.v2.ListLogEntriesResponse} ListLogEntriesResponse instance + */ + ListLogEntriesResponse.create = function create(properties) { + return new ListLogEntriesResponse(properties); + }; + + /** + * Encodes the specified ListLogEntriesResponse message. Does not implicitly {@link google.logging.v2.ListLogEntriesResponse.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.ListLogEntriesResponse + * @static + * @param {google.logging.v2.IListLogEntriesResponse} message ListLogEntriesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListLogEntriesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.entries != null && message.entries.length) + for (var i = 0; i < message.entries.length; ++i) + $root.google.logging.v2.LogEntry.encode(message.entries[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListLogEntriesResponse message, length delimited. Does not implicitly {@link google.logging.v2.ListLogEntriesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.ListLogEntriesResponse + * @static + * @param {google.logging.v2.IListLogEntriesResponse} message ListLogEntriesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListLogEntriesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListLogEntriesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.ListLogEntriesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.ListLogEntriesResponse} ListLogEntriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListLogEntriesResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.ListLogEntriesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.entries && message.entries.length)) + message.entries = []; + message.entries.push($root.google.logging.v2.LogEntry.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListLogEntriesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.ListLogEntriesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.ListLogEntriesResponse} ListLogEntriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListLogEntriesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListLogEntriesResponse message. + * @function verify + * @memberof google.logging.v2.ListLogEntriesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListLogEntriesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.entries != null && message.hasOwnProperty("entries")) { + if (!Array.isArray(message.entries)) + return "entries: array expected"; + for (var i = 0; i < message.entries.length; ++i) { + var error = $root.google.logging.v2.LogEntry.verify(message.entries[i]); + if (error) + return "entries." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListLogEntriesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.ListLogEntriesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.ListLogEntriesResponse} ListLogEntriesResponse + */ + ListLogEntriesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.ListLogEntriesResponse) + return object; + var message = new $root.google.logging.v2.ListLogEntriesResponse(); + if (object.entries) { + if (!Array.isArray(object.entries)) + throw TypeError(".google.logging.v2.ListLogEntriesResponse.entries: array expected"); + message.entries = []; + for (var i = 0; i < object.entries.length; ++i) { + if (typeof object.entries[i] !== "object") + throw TypeError(".google.logging.v2.ListLogEntriesResponse.entries: object expected"); + message.entries[i] = $root.google.logging.v2.LogEntry.fromObject(object.entries[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListLogEntriesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.ListLogEntriesResponse + * @static + * @param {google.logging.v2.ListLogEntriesResponse} message ListLogEntriesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListLogEntriesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.entries = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.entries && message.entries.length) { + object.entries = []; + for (var j = 0; j < message.entries.length; ++j) + object.entries[j] = $root.google.logging.v2.LogEntry.toObject(message.entries[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListLogEntriesResponse to JSON. + * @function toJSON + * @memberof google.logging.v2.ListLogEntriesResponse + * @instance + * @returns {Object.} JSON object + */ + ListLogEntriesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListLogEntriesResponse + * @function getTypeUrl + * @memberof google.logging.v2.ListLogEntriesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListLogEntriesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.ListLogEntriesResponse"; + }; + + return ListLogEntriesResponse; + })(); + + v2.ListMonitoredResourceDescriptorsRequest = (function() { + + /** + * Properties of a ListMonitoredResourceDescriptorsRequest. + * @memberof google.logging.v2 + * @interface IListMonitoredResourceDescriptorsRequest + * @property {number|null} [pageSize] ListMonitoredResourceDescriptorsRequest pageSize + * @property {string|null} [pageToken] ListMonitoredResourceDescriptorsRequest pageToken + */ + + /** + * Constructs a new ListMonitoredResourceDescriptorsRequest. + * @memberof google.logging.v2 + * @classdesc Represents a ListMonitoredResourceDescriptorsRequest. + * @implements IListMonitoredResourceDescriptorsRequest + * @constructor + * @param {google.logging.v2.IListMonitoredResourceDescriptorsRequest=} [properties] Properties to set + */ + function ListMonitoredResourceDescriptorsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListMonitoredResourceDescriptorsRequest pageSize. + * @member {number} pageSize + * @memberof google.logging.v2.ListMonitoredResourceDescriptorsRequest + * @instance + */ + ListMonitoredResourceDescriptorsRequest.prototype.pageSize = 0; + + /** + * ListMonitoredResourceDescriptorsRequest pageToken. + * @member {string} pageToken + * @memberof google.logging.v2.ListMonitoredResourceDescriptorsRequest + * @instance + */ + ListMonitoredResourceDescriptorsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListMonitoredResourceDescriptorsRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.ListMonitoredResourceDescriptorsRequest + * @static + * @param {google.logging.v2.IListMonitoredResourceDescriptorsRequest=} [properties] Properties to set + * @returns {google.logging.v2.ListMonitoredResourceDescriptorsRequest} ListMonitoredResourceDescriptorsRequest instance + */ + ListMonitoredResourceDescriptorsRequest.create = function create(properties) { + return new ListMonitoredResourceDescriptorsRequest(properties); + }; + + /** + * Encodes the specified ListMonitoredResourceDescriptorsRequest message. Does not implicitly {@link google.logging.v2.ListMonitoredResourceDescriptorsRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.ListMonitoredResourceDescriptorsRequest + * @static + * @param {google.logging.v2.IListMonitoredResourceDescriptorsRequest} message ListMonitoredResourceDescriptorsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListMonitoredResourceDescriptorsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.pageToken); + return writer; + }; + + /** + * Encodes the specified ListMonitoredResourceDescriptorsRequest message, length delimited. Does not implicitly {@link google.logging.v2.ListMonitoredResourceDescriptorsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.ListMonitoredResourceDescriptorsRequest + * @static + * @param {google.logging.v2.IListMonitoredResourceDescriptorsRequest} message ListMonitoredResourceDescriptorsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListMonitoredResourceDescriptorsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListMonitoredResourceDescriptorsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.ListMonitoredResourceDescriptorsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.ListMonitoredResourceDescriptorsRequest} ListMonitoredResourceDescriptorsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListMonitoredResourceDescriptorsRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.ListMonitoredResourceDescriptorsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.pageSize = reader.int32(); + break; + } + case 2: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListMonitoredResourceDescriptorsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.ListMonitoredResourceDescriptorsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.ListMonitoredResourceDescriptorsRequest} ListMonitoredResourceDescriptorsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListMonitoredResourceDescriptorsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListMonitoredResourceDescriptorsRequest message. + * @function verify + * @memberof google.logging.v2.ListMonitoredResourceDescriptorsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListMonitoredResourceDescriptorsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListMonitoredResourceDescriptorsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.ListMonitoredResourceDescriptorsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.ListMonitoredResourceDescriptorsRequest} ListMonitoredResourceDescriptorsRequest + */ + ListMonitoredResourceDescriptorsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.ListMonitoredResourceDescriptorsRequest) + return object; + var message = new $root.google.logging.v2.ListMonitoredResourceDescriptorsRequest(); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListMonitoredResourceDescriptorsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.ListMonitoredResourceDescriptorsRequest + * @static + * @param {google.logging.v2.ListMonitoredResourceDescriptorsRequest} message ListMonitoredResourceDescriptorsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListMonitoredResourceDescriptorsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.pageSize = 0; + object.pageToken = ""; + } + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + return object; + }; + + /** + * Converts this ListMonitoredResourceDescriptorsRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.ListMonitoredResourceDescriptorsRequest + * @instance + * @returns {Object.} JSON object + */ + ListMonitoredResourceDescriptorsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListMonitoredResourceDescriptorsRequest + * @function getTypeUrl + * @memberof google.logging.v2.ListMonitoredResourceDescriptorsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListMonitoredResourceDescriptorsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.ListMonitoredResourceDescriptorsRequest"; + }; + + return ListMonitoredResourceDescriptorsRequest; + })(); + + v2.ListMonitoredResourceDescriptorsResponse = (function() { + + /** + * Properties of a ListMonitoredResourceDescriptorsResponse. + * @memberof google.logging.v2 + * @interface IListMonitoredResourceDescriptorsResponse + * @property {Array.|null} [resourceDescriptors] ListMonitoredResourceDescriptorsResponse resourceDescriptors + * @property {string|null} [nextPageToken] ListMonitoredResourceDescriptorsResponse nextPageToken + */ + + /** + * Constructs a new ListMonitoredResourceDescriptorsResponse. + * @memberof google.logging.v2 + * @classdesc Represents a ListMonitoredResourceDescriptorsResponse. + * @implements IListMonitoredResourceDescriptorsResponse + * @constructor + * @param {google.logging.v2.IListMonitoredResourceDescriptorsResponse=} [properties] Properties to set + */ + function ListMonitoredResourceDescriptorsResponse(properties) { + this.resourceDescriptors = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListMonitoredResourceDescriptorsResponse resourceDescriptors. + * @member {Array.} resourceDescriptors + * @memberof google.logging.v2.ListMonitoredResourceDescriptorsResponse + * @instance + */ + ListMonitoredResourceDescriptorsResponse.prototype.resourceDescriptors = $util.emptyArray; + + /** + * ListMonitoredResourceDescriptorsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.logging.v2.ListMonitoredResourceDescriptorsResponse + * @instance + */ + ListMonitoredResourceDescriptorsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListMonitoredResourceDescriptorsResponse instance using the specified properties. + * @function create + * @memberof google.logging.v2.ListMonitoredResourceDescriptorsResponse + * @static + * @param {google.logging.v2.IListMonitoredResourceDescriptorsResponse=} [properties] Properties to set + * @returns {google.logging.v2.ListMonitoredResourceDescriptorsResponse} ListMonitoredResourceDescriptorsResponse instance + */ + ListMonitoredResourceDescriptorsResponse.create = function create(properties) { + return new ListMonitoredResourceDescriptorsResponse(properties); + }; + + /** + * Encodes the specified ListMonitoredResourceDescriptorsResponse message. Does not implicitly {@link google.logging.v2.ListMonitoredResourceDescriptorsResponse.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.ListMonitoredResourceDescriptorsResponse + * @static + * @param {google.logging.v2.IListMonitoredResourceDescriptorsResponse} message ListMonitoredResourceDescriptorsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListMonitoredResourceDescriptorsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.resourceDescriptors != null && message.resourceDescriptors.length) + for (var i = 0; i < message.resourceDescriptors.length; ++i) + $root.google.api.MonitoredResourceDescriptor.encode(message.resourceDescriptors[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListMonitoredResourceDescriptorsResponse message, length delimited. Does not implicitly {@link google.logging.v2.ListMonitoredResourceDescriptorsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.ListMonitoredResourceDescriptorsResponse + * @static + * @param {google.logging.v2.IListMonitoredResourceDescriptorsResponse} message ListMonitoredResourceDescriptorsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListMonitoredResourceDescriptorsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListMonitoredResourceDescriptorsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.ListMonitoredResourceDescriptorsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.ListMonitoredResourceDescriptorsResponse} ListMonitoredResourceDescriptorsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListMonitoredResourceDescriptorsResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.ListMonitoredResourceDescriptorsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.resourceDescriptors && message.resourceDescriptors.length)) + message.resourceDescriptors = []; + message.resourceDescriptors.push($root.google.api.MonitoredResourceDescriptor.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListMonitoredResourceDescriptorsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.ListMonitoredResourceDescriptorsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.ListMonitoredResourceDescriptorsResponse} ListMonitoredResourceDescriptorsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListMonitoredResourceDescriptorsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListMonitoredResourceDescriptorsResponse message. + * @function verify + * @memberof google.logging.v2.ListMonitoredResourceDescriptorsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListMonitoredResourceDescriptorsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.resourceDescriptors != null && message.hasOwnProperty("resourceDescriptors")) { + if (!Array.isArray(message.resourceDescriptors)) + return "resourceDescriptors: array expected"; + for (var i = 0; i < message.resourceDescriptors.length; ++i) { + var error = $root.google.api.MonitoredResourceDescriptor.verify(message.resourceDescriptors[i]); + if (error) + return "resourceDescriptors." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListMonitoredResourceDescriptorsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.ListMonitoredResourceDescriptorsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.ListMonitoredResourceDescriptorsResponse} ListMonitoredResourceDescriptorsResponse + */ + ListMonitoredResourceDescriptorsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.ListMonitoredResourceDescriptorsResponse) + return object; + var message = new $root.google.logging.v2.ListMonitoredResourceDescriptorsResponse(); + if (object.resourceDescriptors) { + if (!Array.isArray(object.resourceDescriptors)) + throw TypeError(".google.logging.v2.ListMonitoredResourceDescriptorsResponse.resourceDescriptors: array expected"); + message.resourceDescriptors = []; + for (var i = 0; i < object.resourceDescriptors.length; ++i) { + if (typeof object.resourceDescriptors[i] !== "object") + throw TypeError(".google.logging.v2.ListMonitoredResourceDescriptorsResponse.resourceDescriptors: object expected"); + message.resourceDescriptors[i] = $root.google.api.MonitoredResourceDescriptor.fromObject(object.resourceDescriptors[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListMonitoredResourceDescriptorsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.ListMonitoredResourceDescriptorsResponse + * @static + * @param {google.logging.v2.ListMonitoredResourceDescriptorsResponse} message ListMonitoredResourceDescriptorsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListMonitoredResourceDescriptorsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.resourceDescriptors = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.resourceDescriptors && message.resourceDescriptors.length) { + object.resourceDescriptors = []; + for (var j = 0; j < message.resourceDescriptors.length; ++j) + object.resourceDescriptors[j] = $root.google.api.MonitoredResourceDescriptor.toObject(message.resourceDescriptors[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListMonitoredResourceDescriptorsResponse to JSON. + * @function toJSON + * @memberof google.logging.v2.ListMonitoredResourceDescriptorsResponse + * @instance + * @returns {Object.} JSON object + */ + ListMonitoredResourceDescriptorsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListMonitoredResourceDescriptorsResponse + * @function getTypeUrl + * @memberof google.logging.v2.ListMonitoredResourceDescriptorsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListMonitoredResourceDescriptorsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.ListMonitoredResourceDescriptorsResponse"; + }; + + return ListMonitoredResourceDescriptorsResponse; + })(); + + v2.ListLogsRequest = (function() { + + /** + * Properties of a ListLogsRequest. + * @memberof google.logging.v2 + * @interface IListLogsRequest + * @property {string|null} [parent] ListLogsRequest parent + * @property {Array.|null} [resourceNames] ListLogsRequest resourceNames + * @property {number|null} [pageSize] ListLogsRequest pageSize + * @property {string|null} [pageToken] ListLogsRequest pageToken + */ + + /** + * Constructs a new ListLogsRequest. + * @memberof google.logging.v2 + * @classdesc Represents a ListLogsRequest. + * @implements IListLogsRequest + * @constructor + * @param {google.logging.v2.IListLogsRequest=} [properties] Properties to set + */ + function ListLogsRequest(properties) { + this.resourceNames = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListLogsRequest parent. + * @member {string} parent + * @memberof google.logging.v2.ListLogsRequest + * @instance + */ + ListLogsRequest.prototype.parent = ""; + + /** + * ListLogsRequest resourceNames. + * @member {Array.} resourceNames + * @memberof google.logging.v2.ListLogsRequest + * @instance + */ + ListLogsRequest.prototype.resourceNames = $util.emptyArray; + + /** + * ListLogsRequest pageSize. + * @member {number} pageSize + * @memberof google.logging.v2.ListLogsRequest + * @instance + */ + ListLogsRequest.prototype.pageSize = 0; + + /** + * ListLogsRequest pageToken. + * @member {string} pageToken + * @memberof google.logging.v2.ListLogsRequest + * @instance + */ + ListLogsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListLogsRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.ListLogsRequest + * @static + * @param {google.logging.v2.IListLogsRequest=} [properties] Properties to set + * @returns {google.logging.v2.ListLogsRequest} ListLogsRequest instance + */ + ListLogsRequest.create = function create(properties) { + return new ListLogsRequest(properties); + }; + + /** + * Encodes the specified ListLogsRequest message. Does not implicitly {@link google.logging.v2.ListLogsRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.ListLogsRequest + * @static + * @param {google.logging.v2.IListLogsRequest} message ListLogsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListLogsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.resourceNames != null && message.resourceNames.length) + for (var i = 0; i < message.resourceNames.length; ++i) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.resourceNames[i]); + return writer; + }; + + /** + * Encodes the specified ListLogsRequest message, length delimited. Does not implicitly {@link google.logging.v2.ListLogsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.ListLogsRequest + * @static + * @param {google.logging.v2.IListLogsRequest} message ListLogsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListLogsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListLogsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.ListLogsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.ListLogsRequest} ListLogsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListLogsRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.ListLogsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 8: { + if (!(message.resourceNames && message.resourceNames.length)) + message.resourceNames = []; + message.resourceNames.push(reader.string()); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListLogsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.ListLogsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.ListLogsRequest} ListLogsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListLogsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListLogsRequest message. + * @function verify + * @memberof google.logging.v2.ListLogsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListLogsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.resourceNames != null && message.hasOwnProperty("resourceNames")) { + if (!Array.isArray(message.resourceNames)) + return "resourceNames: array expected"; + for (var i = 0; i < message.resourceNames.length; ++i) + if (!$util.isString(message.resourceNames[i])) + return "resourceNames: string[] expected"; + } + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListLogsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.ListLogsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.ListLogsRequest} ListLogsRequest + */ + ListLogsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.ListLogsRequest) + return object; + var message = new $root.google.logging.v2.ListLogsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.resourceNames) { + if (!Array.isArray(object.resourceNames)) + throw TypeError(".google.logging.v2.ListLogsRequest.resourceNames: array expected"); + message.resourceNames = []; + for (var i = 0; i < object.resourceNames.length; ++i) + message.resourceNames[i] = String(object.resourceNames[i]); + } + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListLogsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.ListLogsRequest + * @static + * @param {google.logging.v2.ListLogsRequest} message ListLogsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListLogsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.resourceNames = []; + if (options.defaults) { + object.parent = ""; + object.pageSize = 0; + object.pageToken = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.resourceNames && message.resourceNames.length) { + object.resourceNames = []; + for (var j = 0; j < message.resourceNames.length; ++j) + object.resourceNames[j] = message.resourceNames[j]; + } + return object; + }; + + /** + * Converts this ListLogsRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.ListLogsRequest + * @instance + * @returns {Object.} JSON object + */ + ListLogsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListLogsRequest + * @function getTypeUrl + * @memberof google.logging.v2.ListLogsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListLogsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.ListLogsRequest"; + }; + + return ListLogsRequest; + })(); + + v2.ListLogsResponse = (function() { + + /** + * Properties of a ListLogsResponse. + * @memberof google.logging.v2 + * @interface IListLogsResponse + * @property {Array.|null} [logNames] ListLogsResponse logNames + * @property {string|null} [nextPageToken] ListLogsResponse nextPageToken + */ + + /** + * Constructs a new ListLogsResponse. + * @memberof google.logging.v2 + * @classdesc Represents a ListLogsResponse. + * @implements IListLogsResponse + * @constructor + * @param {google.logging.v2.IListLogsResponse=} [properties] Properties to set + */ + function ListLogsResponse(properties) { + this.logNames = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListLogsResponse logNames. + * @member {Array.} logNames + * @memberof google.logging.v2.ListLogsResponse + * @instance + */ + ListLogsResponse.prototype.logNames = $util.emptyArray; + + /** + * ListLogsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.logging.v2.ListLogsResponse + * @instance + */ + ListLogsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListLogsResponse instance using the specified properties. + * @function create + * @memberof google.logging.v2.ListLogsResponse + * @static + * @param {google.logging.v2.IListLogsResponse=} [properties] Properties to set + * @returns {google.logging.v2.ListLogsResponse} ListLogsResponse instance + */ + ListLogsResponse.create = function create(properties) { + return new ListLogsResponse(properties); + }; + + /** + * Encodes the specified ListLogsResponse message. Does not implicitly {@link google.logging.v2.ListLogsResponse.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.ListLogsResponse + * @static + * @param {google.logging.v2.IListLogsResponse} message ListLogsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListLogsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + if (message.logNames != null && message.logNames.length) + for (var i = 0; i < message.logNames.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.logNames[i]); + return writer; + }; + + /** + * Encodes the specified ListLogsResponse message, length delimited. Does not implicitly {@link google.logging.v2.ListLogsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.ListLogsResponse + * @static + * @param {google.logging.v2.IListLogsResponse} message ListLogsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListLogsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListLogsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.ListLogsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.ListLogsResponse} ListLogsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListLogsResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.ListLogsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 3: { + if (!(message.logNames && message.logNames.length)) + message.logNames = []; + message.logNames.push(reader.string()); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListLogsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.ListLogsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.ListLogsResponse} ListLogsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListLogsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListLogsResponse message. + * @function verify + * @memberof google.logging.v2.ListLogsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListLogsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.logNames != null && message.hasOwnProperty("logNames")) { + if (!Array.isArray(message.logNames)) + return "logNames: array expected"; + for (var i = 0; i < message.logNames.length; ++i) + if (!$util.isString(message.logNames[i])) + return "logNames: string[] expected"; + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListLogsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.ListLogsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.ListLogsResponse} ListLogsResponse + */ + ListLogsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.ListLogsResponse) + return object; + var message = new $root.google.logging.v2.ListLogsResponse(); + if (object.logNames) { + if (!Array.isArray(object.logNames)) + throw TypeError(".google.logging.v2.ListLogsResponse.logNames: array expected"); + message.logNames = []; + for (var i = 0; i < object.logNames.length; ++i) + message.logNames[i] = String(object.logNames[i]); + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListLogsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.ListLogsResponse + * @static + * @param {google.logging.v2.ListLogsResponse} message ListLogsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListLogsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.logNames = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + if (message.logNames && message.logNames.length) { + object.logNames = []; + for (var j = 0; j < message.logNames.length; ++j) + object.logNames[j] = message.logNames[j]; + } + return object; + }; + + /** + * Converts this ListLogsResponse to JSON. + * @function toJSON + * @memberof google.logging.v2.ListLogsResponse + * @instance + * @returns {Object.} JSON object + */ + ListLogsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListLogsResponse + * @function getTypeUrl + * @memberof google.logging.v2.ListLogsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListLogsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.ListLogsResponse"; + }; + + return ListLogsResponse; + })(); + + v2.TailLogEntriesRequest = (function() { + + /** + * Properties of a TailLogEntriesRequest. + * @memberof google.logging.v2 + * @interface ITailLogEntriesRequest + * @property {Array.|null} [resourceNames] TailLogEntriesRequest resourceNames + * @property {string|null} [filter] TailLogEntriesRequest filter + * @property {google.protobuf.IDuration|null} [bufferWindow] TailLogEntriesRequest bufferWindow + */ + + /** + * Constructs a new TailLogEntriesRequest. + * @memberof google.logging.v2 + * @classdesc Represents a TailLogEntriesRequest. + * @implements ITailLogEntriesRequest + * @constructor + * @param {google.logging.v2.ITailLogEntriesRequest=} [properties] Properties to set + */ + function TailLogEntriesRequest(properties) { + this.resourceNames = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TailLogEntriesRequest resourceNames. + * @member {Array.} resourceNames + * @memberof google.logging.v2.TailLogEntriesRequest + * @instance + */ + TailLogEntriesRequest.prototype.resourceNames = $util.emptyArray; + + /** + * TailLogEntriesRequest filter. + * @member {string} filter + * @memberof google.logging.v2.TailLogEntriesRequest + * @instance + */ + TailLogEntriesRequest.prototype.filter = ""; + + /** + * TailLogEntriesRequest bufferWindow. + * @member {google.protobuf.IDuration|null|undefined} bufferWindow + * @memberof google.logging.v2.TailLogEntriesRequest + * @instance + */ + TailLogEntriesRequest.prototype.bufferWindow = null; + + /** + * Creates a new TailLogEntriesRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.TailLogEntriesRequest + * @static + * @param {google.logging.v2.ITailLogEntriesRequest=} [properties] Properties to set + * @returns {google.logging.v2.TailLogEntriesRequest} TailLogEntriesRequest instance + */ + TailLogEntriesRequest.create = function create(properties) { + return new TailLogEntriesRequest(properties); + }; + + /** + * Encodes the specified TailLogEntriesRequest message. Does not implicitly {@link google.logging.v2.TailLogEntriesRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.TailLogEntriesRequest + * @static + * @param {google.logging.v2.ITailLogEntriesRequest} message TailLogEntriesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TailLogEntriesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.resourceNames != null && message.resourceNames.length) + for (var i = 0; i < message.resourceNames.length; ++i) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.resourceNames[i]); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.filter); + if (message.bufferWindow != null && Object.hasOwnProperty.call(message, "bufferWindow")) + $root.google.protobuf.Duration.encode(message.bufferWindow, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TailLogEntriesRequest message, length delimited. Does not implicitly {@link google.logging.v2.TailLogEntriesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.TailLogEntriesRequest + * @static + * @param {google.logging.v2.ITailLogEntriesRequest} message TailLogEntriesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TailLogEntriesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TailLogEntriesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.TailLogEntriesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.TailLogEntriesRequest} TailLogEntriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TailLogEntriesRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.TailLogEntriesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.resourceNames && message.resourceNames.length)) + message.resourceNames = []; + message.resourceNames.push(reader.string()); + break; + } + case 2: { + message.filter = reader.string(); + break; + } + case 3: { + message.bufferWindow = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TailLogEntriesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.TailLogEntriesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.TailLogEntriesRequest} TailLogEntriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TailLogEntriesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TailLogEntriesRequest message. + * @function verify + * @memberof google.logging.v2.TailLogEntriesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TailLogEntriesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.resourceNames != null && message.hasOwnProperty("resourceNames")) { + if (!Array.isArray(message.resourceNames)) + return "resourceNames: array expected"; + for (var i = 0; i < message.resourceNames.length; ++i) + if (!$util.isString(message.resourceNames[i])) + return "resourceNames: string[] expected"; + } + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.bufferWindow != null && message.hasOwnProperty("bufferWindow")) { + var error = $root.google.protobuf.Duration.verify(message.bufferWindow); + if (error) + return "bufferWindow." + error; + } + return null; + }; + + /** + * Creates a TailLogEntriesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.TailLogEntriesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.TailLogEntriesRequest} TailLogEntriesRequest + */ + TailLogEntriesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.TailLogEntriesRequest) + return object; + var message = new $root.google.logging.v2.TailLogEntriesRequest(); + if (object.resourceNames) { + if (!Array.isArray(object.resourceNames)) + throw TypeError(".google.logging.v2.TailLogEntriesRequest.resourceNames: array expected"); + message.resourceNames = []; + for (var i = 0; i < object.resourceNames.length; ++i) + message.resourceNames[i] = String(object.resourceNames[i]); + } + if (object.filter != null) + message.filter = String(object.filter); + if (object.bufferWindow != null) { + if (typeof object.bufferWindow !== "object") + throw TypeError(".google.logging.v2.TailLogEntriesRequest.bufferWindow: object expected"); + message.bufferWindow = $root.google.protobuf.Duration.fromObject(object.bufferWindow); + } + return message; + }; + + /** + * Creates a plain object from a TailLogEntriesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.TailLogEntriesRequest + * @static + * @param {google.logging.v2.TailLogEntriesRequest} message TailLogEntriesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TailLogEntriesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.resourceNames = []; + if (options.defaults) { + object.filter = ""; + object.bufferWindow = null; + } + if (message.resourceNames && message.resourceNames.length) { + object.resourceNames = []; + for (var j = 0; j < message.resourceNames.length; ++j) + object.resourceNames[j] = message.resourceNames[j]; + } + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.bufferWindow != null && message.hasOwnProperty("bufferWindow")) + object.bufferWindow = $root.google.protobuf.Duration.toObject(message.bufferWindow, options); + return object; + }; + + /** + * Converts this TailLogEntriesRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.TailLogEntriesRequest + * @instance + * @returns {Object.} JSON object + */ + TailLogEntriesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TailLogEntriesRequest + * @function getTypeUrl + * @memberof google.logging.v2.TailLogEntriesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TailLogEntriesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.TailLogEntriesRequest"; + }; + + return TailLogEntriesRequest; + })(); + + v2.TailLogEntriesResponse = (function() { + + /** + * Properties of a TailLogEntriesResponse. + * @memberof google.logging.v2 + * @interface ITailLogEntriesResponse + * @property {Array.|null} [entries] TailLogEntriesResponse entries + * @property {Array.|null} [suppressionInfo] TailLogEntriesResponse suppressionInfo + */ + + /** + * Constructs a new TailLogEntriesResponse. + * @memberof google.logging.v2 + * @classdesc Represents a TailLogEntriesResponse. + * @implements ITailLogEntriesResponse + * @constructor + * @param {google.logging.v2.ITailLogEntriesResponse=} [properties] Properties to set + */ + function TailLogEntriesResponse(properties) { + this.entries = []; + this.suppressionInfo = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * TailLogEntriesResponse entries. + * @member {Array.} entries + * @memberof google.logging.v2.TailLogEntriesResponse + * @instance + */ + TailLogEntriesResponse.prototype.entries = $util.emptyArray; + + /** + * TailLogEntriesResponse suppressionInfo. + * @member {Array.} suppressionInfo + * @memberof google.logging.v2.TailLogEntriesResponse + * @instance + */ + TailLogEntriesResponse.prototype.suppressionInfo = $util.emptyArray; + + /** + * Creates a new TailLogEntriesResponse instance using the specified properties. + * @function create + * @memberof google.logging.v2.TailLogEntriesResponse + * @static + * @param {google.logging.v2.ITailLogEntriesResponse=} [properties] Properties to set + * @returns {google.logging.v2.TailLogEntriesResponse} TailLogEntriesResponse instance + */ + TailLogEntriesResponse.create = function create(properties) { + return new TailLogEntriesResponse(properties); + }; + + /** + * Encodes the specified TailLogEntriesResponse message. Does not implicitly {@link google.logging.v2.TailLogEntriesResponse.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.TailLogEntriesResponse + * @static + * @param {google.logging.v2.ITailLogEntriesResponse} message TailLogEntriesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TailLogEntriesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.entries != null && message.entries.length) + for (var i = 0; i < message.entries.length; ++i) + $root.google.logging.v2.LogEntry.encode(message.entries[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.suppressionInfo != null && message.suppressionInfo.length) + for (var i = 0; i < message.suppressionInfo.length; ++i) + $root.google.logging.v2.TailLogEntriesResponse.SuppressionInfo.encode(message.suppressionInfo[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified TailLogEntriesResponse message, length delimited. Does not implicitly {@link google.logging.v2.TailLogEntriesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.TailLogEntriesResponse + * @static + * @param {google.logging.v2.ITailLogEntriesResponse} message TailLogEntriesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + TailLogEntriesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a TailLogEntriesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.TailLogEntriesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.TailLogEntriesResponse} TailLogEntriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TailLogEntriesResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.TailLogEntriesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.entries && message.entries.length)) + message.entries = []; + message.entries.push($root.google.logging.v2.LogEntry.decode(reader, reader.uint32())); + break; + } + case 2: { + if (!(message.suppressionInfo && message.suppressionInfo.length)) + message.suppressionInfo = []; + message.suppressionInfo.push($root.google.logging.v2.TailLogEntriesResponse.SuppressionInfo.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a TailLogEntriesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.TailLogEntriesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.TailLogEntriesResponse} TailLogEntriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + TailLogEntriesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a TailLogEntriesResponse message. + * @function verify + * @memberof google.logging.v2.TailLogEntriesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + TailLogEntriesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.entries != null && message.hasOwnProperty("entries")) { + if (!Array.isArray(message.entries)) + return "entries: array expected"; + for (var i = 0; i < message.entries.length; ++i) { + var error = $root.google.logging.v2.LogEntry.verify(message.entries[i]); + if (error) + return "entries." + error; + } + } + if (message.suppressionInfo != null && message.hasOwnProperty("suppressionInfo")) { + if (!Array.isArray(message.suppressionInfo)) + return "suppressionInfo: array expected"; + for (var i = 0; i < message.suppressionInfo.length; ++i) { + var error = $root.google.logging.v2.TailLogEntriesResponse.SuppressionInfo.verify(message.suppressionInfo[i]); + if (error) + return "suppressionInfo." + error; + } + } + return null; + }; + + /** + * Creates a TailLogEntriesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.TailLogEntriesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.TailLogEntriesResponse} TailLogEntriesResponse + */ + TailLogEntriesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.TailLogEntriesResponse) + return object; + var message = new $root.google.logging.v2.TailLogEntriesResponse(); + if (object.entries) { + if (!Array.isArray(object.entries)) + throw TypeError(".google.logging.v2.TailLogEntriesResponse.entries: array expected"); + message.entries = []; + for (var i = 0; i < object.entries.length; ++i) { + if (typeof object.entries[i] !== "object") + throw TypeError(".google.logging.v2.TailLogEntriesResponse.entries: object expected"); + message.entries[i] = $root.google.logging.v2.LogEntry.fromObject(object.entries[i]); + } + } + if (object.suppressionInfo) { + if (!Array.isArray(object.suppressionInfo)) + throw TypeError(".google.logging.v2.TailLogEntriesResponse.suppressionInfo: array expected"); + message.suppressionInfo = []; + for (var i = 0; i < object.suppressionInfo.length; ++i) { + if (typeof object.suppressionInfo[i] !== "object") + throw TypeError(".google.logging.v2.TailLogEntriesResponse.suppressionInfo: object expected"); + message.suppressionInfo[i] = $root.google.logging.v2.TailLogEntriesResponse.SuppressionInfo.fromObject(object.suppressionInfo[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a TailLogEntriesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.TailLogEntriesResponse + * @static + * @param {google.logging.v2.TailLogEntriesResponse} message TailLogEntriesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + TailLogEntriesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.entries = []; + object.suppressionInfo = []; + } + if (message.entries && message.entries.length) { + object.entries = []; + for (var j = 0; j < message.entries.length; ++j) + object.entries[j] = $root.google.logging.v2.LogEntry.toObject(message.entries[j], options); + } + if (message.suppressionInfo && message.suppressionInfo.length) { + object.suppressionInfo = []; + for (var j = 0; j < message.suppressionInfo.length; ++j) + object.suppressionInfo[j] = $root.google.logging.v2.TailLogEntriesResponse.SuppressionInfo.toObject(message.suppressionInfo[j], options); + } + return object; + }; + + /** + * Converts this TailLogEntriesResponse to JSON. + * @function toJSON + * @memberof google.logging.v2.TailLogEntriesResponse + * @instance + * @returns {Object.} JSON object + */ + TailLogEntriesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for TailLogEntriesResponse + * @function getTypeUrl + * @memberof google.logging.v2.TailLogEntriesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + TailLogEntriesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.TailLogEntriesResponse"; + }; + + TailLogEntriesResponse.SuppressionInfo = (function() { + + /** + * Properties of a SuppressionInfo. + * @memberof google.logging.v2.TailLogEntriesResponse + * @interface ISuppressionInfo + * @property {google.logging.v2.TailLogEntriesResponse.SuppressionInfo.Reason|null} [reason] SuppressionInfo reason + * @property {number|null} [suppressedCount] SuppressionInfo suppressedCount + */ + + /** + * Constructs a new SuppressionInfo. + * @memberof google.logging.v2.TailLogEntriesResponse + * @classdesc Represents a SuppressionInfo. + * @implements ISuppressionInfo + * @constructor + * @param {google.logging.v2.TailLogEntriesResponse.ISuppressionInfo=} [properties] Properties to set + */ + function SuppressionInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * SuppressionInfo reason. + * @member {google.logging.v2.TailLogEntriesResponse.SuppressionInfo.Reason} reason + * @memberof google.logging.v2.TailLogEntriesResponse.SuppressionInfo + * @instance + */ + SuppressionInfo.prototype.reason = 0; + + /** + * SuppressionInfo suppressedCount. + * @member {number} suppressedCount + * @memberof google.logging.v2.TailLogEntriesResponse.SuppressionInfo + * @instance + */ + SuppressionInfo.prototype.suppressedCount = 0; + + /** + * Creates a new SuppressionInfo instance using the specified properties. + * @function create + * @memberof google.logging.v2.TailLogEntriesResponse.SuppressionInfo + * @static + * @param {google.logging.v2.TailLogEntriesResponse.ISuppressionInfo=} [properties] Properties to set + * @returns {google.logging.v2.TailLogEntriesResponse.SuppressionInfo} SuppressionInfo instance + */ + SuppressionInfo.create = function create(properties) { + return new SuppressionInfo(properties); + }; + + /** + * Encodes the specified SuppressionInfo message. Does not implicitly {@link google.logging.v2.TailLogEntriesResponse.SuppressionInfo.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.TailLogEntriesResponse.SuppressionInfo + * @static + * @param {google.logging.v2.TailLogEntriesResponse.ISuppressionInfo} message SuppressionInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuppressionInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.reason != null && Object.hasOwnProperty.call(message, "reason")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.reason); + if (message.suppressedCount != null && Object.hasOwnProperty.call(message, "suppressedCount")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.suppressedCount); + return writer; + }; + + /** + * Encodes the specified SuppressionInfo message, length delimited. Does not implicitly {@link google.logging.v2.TailLogEntriesResponse.SuppressionInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.TailLogEntriesResponse.SuppressionInfo + * @static + * @param {google.logging.v2.TailLogEntriesResponse.ISuppressionInfo} message SuppressionInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + SuppressionInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a SuppressionInfo message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.TailLogEntriesResponse.SuppressionInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.TailLogEntriesResponse.SuppressionInfo} SuppressionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuppressionInfo.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.TailLogEntriesResponse.SuppressionInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.reason = reader.int32(); + break; + } + case 2: { + message.suppressedCount = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a SuppressionInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.TailLogEntriesResponse.SuppressionInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.TailLogEntriesResponse.SuppressionInfo} SuppressionInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + SuppressionInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a SuppressionInfo message. + * @function verify + * @memberof google.logging.v2.TailLogEntriesResponse.SuppressionInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + SuppressionInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.reason != null && message.hasOwnProperty("reason")) + switch (message.reason) { + default: + return "reason: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.suppressedCount != null && message.hasOwnProperty("suppressedCount")) + if (!$util.isInteger(message.suppressedCount)) + return "suppressedCount: integer expected"; + return null; + }; + + /** + * Creates a SuppressionInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.TailLogEntriesResponse.SuppressionInfo + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.TailLogEntriesResponse.SuppressionInfo} SuppressionInfo + */ + SuppressionInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.TailLogEntriesResponse.SuppressionInfo) + return object; + var message = new $root.google.logging.v2.TailLogEntriesResponse.SuppressionInfo(); + switch (object.reason) { + default: + if (typeof object.reason === "number") { + message.reason = object.reason; + break; + } + break; + case "REASON_UNSPECIFIED": + case 0: + message.reason = 0; + break; + case "RATE_LIMIT": + case 1: + message.reason = 1; + break; + case "NOT_CONSUMED": + case 2: + message.reason = 2; + break; + } + if (object.suppressedCount != null) + message.suppressedCount = object.suppressedCount | 0; + return message; + }; + + /** + * Creates a plain object from a SuppressionInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.TailLogEntriesResponse.SuppressionInfo + * @static + * @param {google.logging.v2.TailLogEntriesResponse.SuppressionInfo} message SuppressionInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + SuppressionInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.reason = options.enums === String ? "REASON_UNSPECIFIED" : 0; + object.suppressedCount = 0; + } + if (message.reason != null && message.hasOwnProperty("reason")) + object.reason = options.enums === String ? $root.google.logging.v2.TailLogEntriesResponse.SuppressionInfo.Reason[message.reason] === undefined ? message.reason : $root.google.logging.v2.TailLogEntriesResponse.SuppressionInfo.Reason[message.reason] : message.reason; + if (message.suppressedCount != null && message.hasOwnProperty("suppressedCount")) + object.suppressedCount = message.suppressedCount; + return object; + }; + + /** + * Converts this SuppressionInfo to JSON. + * @function toJSON + * @memberof google.logging.v2.TailLogEntriesResponse.SuppressionInfo + * @instance + * @returns {Object.} JSON object + */ + SuppressionInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for SuppressionInfo + * @function getTypeUrl + * @memberof google.logging.v2.TailLogEntriesResponse.SuppressionInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + SuppressionInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.TailLogEntriesResponse.SuppressionInfo"; + }; + + /** + * Reason enum. + * @name google.logging.v2.TailLogEntriesResponse.SuppressionInfo.Reason + * @enum {number} + * @property {number} REASON_UNSPECIFIED=0 REASON_UNSPECIFIED value + * @property {number} RATE_LIMIT=1 RATE_LIMIT value + * @property {number} NOT_CONSUMED=2 NOT_CONSUMED value + */ + SuppressionInfo.Reason = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "REASON_UNSPECIFIED"] = 0; + values[valuesById[1] = "RATE_LIMIT"] = 1; + values[valuesById[2] = "NOT_CONSUMED"] = 2; + return values; + })(); + + return SuppressionInfo; + })(); + + return TailLogEntriesResponse; + })(); + + v2.ConfigServiceV2 = (function() { + + /** + * Constructs a new ConfigServiceV2 service. + * @memberof google.logging.v2 + * @classdesc Represents a ConfigServiceV2 + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function ConfigServiceV2(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (ConfigServiceV2.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = ConfigServiceV2; + + /** + * Creates new ConfigServiceV2 service using the specified rpc implementation. + * @function create + * @memberof google.logging.v2.ConfigServiceV2 + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {ConfigServiceV2} RPC service. Useful where requests and/or responses are streamed. + */ + ConfigServiceV2.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.logging.v2.ConfigServiceV2|listBuckets}. + * @memberof google.logging.v2.ConfigServiceV2 + * @typedef ListBucketsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.logging.v2.ListBucketsResponse} [response] ListBucketsResponse + */ + + /** + * Calls ListBuckets. + * @function listBuckets + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IListBucketsRequest} request ListBucketsRequest message or plain object + * @param {google.logging.v2.ConfigServiceV2.ListBucketsCallback} callback Node-style callback called with the error, if any, and ListBucketsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConfigServiceV2.prototype.listBuckets = function listBuckets(request, callback) { + return this.rpcCall(listBuckets, $root.google.logging.v2.ListBucketsRequest, $root.google.logging.v2.ListBucketsResponse, request, callback); + }, "name", { value: "ListBuckets" }); + + /** + * Calls ListBuckets. + * @function listBuckets + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IListBucketsRequest} request ListBucketsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.ConfigServiceV2|getBucket}. + * @memberof google.logging.v2.ConfigServiceV2 + * @typedef GetBucketCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.logging.v2.LogBucket} [response] LogBucket + */ + + /** + * Calls GetBucket. + * @function getBucket + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IGetBucketRequest} request GetBucketRequest message or plain object + * @param {google.logging.v2.ConfigServiceV2.GetBucketCallback} callback Node-style callback called with the error, if any, and LogBucket + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConfigServiceV2.prototype.getBucket = function getBucket(request, callback) { + return this.rpcCall(getBucket, $root.google.logging.v2.GetBucketRequest, $root.google.logging.v2.LogBucket, request, callback); + }, "name", { value: "GetBucket" }); + + /** + * Calls GetBucket. + * @function getBucket + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IGetBucketRequest} request GetBucketRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.ConfigServiceV2|createBucketAsync}. + * @memberof google.logging.v2.ConfigServiceV2 + * @typedef CreateBucketAsyncCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateBucketAsync. + * @function createBucketAsync + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.ICreateBucketRequest} request CreateBucketRequest message or plain object + * @param {google.logging.v2.ConfigServiceV2.CreateBucketAsyncCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConfigServiceV2.prototype.createBucketAsync = function createBucketAsync(request, callback) { + return this.rpcCall(createBucketAsync, $root.google.logging.v2.CreateBucketRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateBucketAsync" }); + + /** + * Calls CreateBucketAsync. + * @function createBucketAsync + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.ICreateBucketRequest} request CreateBucketRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.ConfigServiceV2|updateBucketAsync}. + * @memberof google.logging.v2.ConfigServiceV2 + * @typedef UpdateBucketAsyncCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls UpdateBucketAsync. + * @function updateBucketAsync + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IUpdateBucketRequest} request UpdateBucketRequest message or plain object + * @param {google.logging.v2.ConfigServiceV2.UpdateBucketAsyncCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConfigServiceV2.prototype.updateBucketAsync = function updateBucketAsync(request, callback) { + return this.rpcCall(updateBucketAsync, $root.google.logging.v2.UpdateBucketRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "UpdateBucketAsync" }); + + /** + * Calls UpdateBucketAsync. + * @function updateBucketAsync + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IUpdateBucketRequest} request UpdateBucketRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.ConfigServiceV2|createBucket}. + * @memberof google.logging.v2.ConfigServiceV2 + * @typedef CreateBucketCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.logging.v2.LogBucket} [response] LogBucket + */ + + /** + * Calls CreateBucket. + * @function createBucket + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.ICreateBucketRequest} request CreateBucketRequest message or plain object + * @param {google.logging.v2.ConfigServiceV2.CreateBucketCallback} callback Node-style callback called with the error, if any, and LogBucket + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConfigServiceV2.prototype.createBucket = function createBucket(request, callback) { + return this.rpcCall(createBucket, $root.google.logging.v2.CreateBucketRequest, $root.google.logging.v2.LogBucket, request, callback); + }, "name", { value: "CreateBucket" }); + + /** + * Calls CreateBucket. + * @function createBucket + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.ICreateBucketRequest} request CreateBucketRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.ConfigServiceV2|updateBucket}. + * @memberof google.logging.v2.ConfigServiceV2 + * @typedef UpdateBucketCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.logging.v2.LogBucket} [response] LogBucket + */ + + /** + * Calls UpdateBucket. + * @function updateBucket + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IUpdateBucketRequest} request UpdateBucketRequest message or plain object + * @param {google.logging.v2.ConfigServiceV2.UpdateBucketCallback} callback Node-style callback called with the error, if any, and LogBucket + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConfigServiceV2.prototype.updateBucket = function updateBucket(request, callback) { + return this.rpcCall(updateBucket, $root.google.logging.v2.UpdateBucketRequest, $root.google.logging.v2.LogBucket, request, callback); + }, "name", { value: "UpdateBucket" }); + + /** + * Calls UpdateBucket. + * @function updateBucket + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IUpdateBucketRequest} request UpdateBucketRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.ConfigServiceV2|deleteBucket}. + * @memberof google.logging.v2.ConfigServiceV2 + * @typedef DeleteBucketCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteBucket. + * @function deleteBucket + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IDeleteBucketRequest} request DeleteBucketRequest message or plain object + * @param {google.logging.v2.ConfigServiceV2.DeleteBucketCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConfigServiceV2.prototype.deleteBucket = function deleteBucket(request, callback) { + return this.rpcCall(deleteBucket, $root.google.logging.v2.DeleteBucketRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteBucket" }); + + /** + * Calls DeleteBucket. + * @function deleteBucket + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IDeleteBucketRequest} request DeleteBucketRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.ConfigServiceV2|undeleteBucket}. + * @memberof google.logging.v2.ConfigServiceV2 + * @typedef UndeleteBucketCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls UndeleteBucket. + * @function undeleteBucket + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IUndeleteBucketRequest} request UndeleteBucketRequest message or plain object + * @param {google.logging.v2.ConfigServiceV2.UndeleteBucketCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConfigServiceV2.prototype.undeleteBucket = function undeleteBucket(request, callback) { + return this.rpcCall(undeleteBucket, $root.google.logging.v2.UndeleteBucketRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "UndeleteBucket" }); + + /** + * Calls UndeleteBucket. + * @function undeleteBucket + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IUndeleteBucketRequest} request UndeleteBucketRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.ConfigServiceV2|listViews}. + * @memberof google.logging.v2.ConfigServiceV2 + * @typedef ListViewsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.logging.v2.ListViewsResponse} [response] ListViewsResponse + */ + + /** + * Calls ListViews. + * @function listViews + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IListViewsRequest} request ListViewsRequest message or plain object + * @param {google.logging.v2.ConfigServiceV2.ListViewsCallback} callback Node-style callback called with the error, if any, and ListViewsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConfigServiceV2.prototype.listViews = function listViews(request, callback) { + return this.rpcCall(listViews, $root.google.logging.v2.ListViewsRequest, $root.google.logging.v2.ListViewsResponse, request, callback); + }, "name", { value: "ListViews" }); + + /** + * Calls ListViews. + * @function listViews + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IListViewsRequest} request ListViewsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.ConfigServiceV2|getView}. + * @memberof google.logging.v2.ConfigServiceV2 + * @typedef GetViewCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.logging.v2.LogView} [response] LogView + */ + + /** + * Calls GetView. + * @function getView + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IGetViewRequest} request GetViewRequest message or plain object + * @param {google.logging.v2.ConfigServiceV2.GetViewCallback} callback Node-style callback called with the error, if any, and LogView + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConfigServiceV2.prototype.getView = function getView(request, callback) { + return this.rpcCall(getView, $root.google.logging.v2.GetViewRequest, $root.google.logging.v2.LogView, request, callback); + }, "name", { value: "GetView" }); + + /** + * Calls GetView. + * @function getView + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IGetViewRequest} request GetViewRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.ConfigServiceV2|createView}. + * @memberof google.logging.v2.ConfigServiceV2 + * @typedef CreateViewCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.logging.v2.LogView} [response] LogView + */ + + /** + * Calls CreateView. + * @function createView + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.ICreateViewRequest} request CreateViewRequest message or plain object + * @param {google.logging.v2.ConfigServiceV2.CreateViewCallback} callback Node-style callback called with the error, if any, and LogView + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConfigServiceV2.prototype.createView = function createView(request, callback) { + return this.rpcCall(createView, $root.google.logging.v2.CreateViewRequest, $root.google.logging.v2.LogView, request, callback); + }, "name", { value: "CreateView" }); + + /** + * Calls CreateView. + * @function createView + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.ICreateViewRequest} request CreateViewRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.ConfigServiceV2|updateView}. + * @memberof google.logging.v2.ConfigServiceV2 + * @typedef UpdateViewCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.logging.v2.LogView} [response] LogView + */ + + /** + * Calls UpdateView. + * @function updateView + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IUpdateViewRequest} request UpdateViewRequest message or plain object + * @param {google.logging.v2.ConfigServiceV2.UpdateViewCallback} callback Node-style callback called with the error, if any, and LogView + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConfigServiceV2.prototype.updateView = function updateView(request, callback) { + return this.rpcCall(updateView, $root.google.logging.v2.UpdateViewRequest, $root.google.logging.v2.LogView, request, callback); + }, "name", { value: "UpdateView" }); + + /** + * Calls UpdateView. + * @function updateView + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IUpdateViewRequest} request UpdateViewRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.ConfigServiceV2|deleteView}. + * @memberof google.logging.v2.ConfigServiceV2 + * @typedef DeleteViewCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteView. + * @function deleteView + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IDeleteViewRequest} request DeleteViewRequest message or plain object + * @param {google.logging.v2.ConfigServiceV2.DeleteViewCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConfigServiceV2.prototype.deleteView = function deleteView(request, callback) { + return this.rpcCall(deleteView, $root.google.logging.v2.DeleteViewRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteView" }); + + /** + * Calls DeleteView. + * @function deleteView + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IDeleteViewRequest} request DeleteViewRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.ConfigServiceV2|listSinks}. + * @memberof google.logging.v2.ConfigServiceV2 + * @typedef ListSinksCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.logging.v2.ListSinksResponse} [response] ListSinksResponse + */ + + /** + * Calls ListSinks. + * @function listSinks + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IListSinksRequest} request ListSinksRequest message or plain object + * @param {google.logging.v2.ConfigServiceV2.ListSinksCallback} callback Node-style callback called with the error, if any, and ListSinksResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConfigServiceV2.prototype.listSinks = function listSinks(request, callback) { + return this.rpcCall(listSinks, $root.google.logging.v2.ListSinksRequest, $root.google.logging.v2.ListSinksResponse, request, callback); + }, "name", { value: "ListSinks" }); + + /** + * Calls ListSinks. + * @function listSinks + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IListSinksRequest} request ListSinksRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.ConfigServiceV2|getSink}. + * @memberof google.logging.v2.ConfigServiceV2 + * @typedef GetSinkCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.logging.v2.LogSink} [response] LogSink + */ + + /** + * Calls GetSink. + * @function getSink + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IGetSinkRequest} request GetSinkRequest message or plain object + * @param {google.logging.v2.ConfigServiceV2.GetSinkCallback} callback Node-style callback called with the error, if any, and LogSink + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConfigServiceV2.prototype.getSink = function getSink(request, callback) { + return this.rpcCall(getSink, $root.google.logging.v2.GetSinkRequest, $root.google.logging.v2.LogSink, request, callback); + }, "name", { value: "GetSink" }); + + /** + * Calls GetSink. + * @function getSink + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IGetSinkRequest} request GetSinkRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.ConfigServiceV2|createSink}. + * @memberof google.logging.v2.ConfigServiceV2 + * @typedef CreateSinkCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.logging.v2.LogSink} [response] LogSink + */ + + /** + * Calls CreateSink. + * @function createSink + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.ICreateSinkRequest} request CreateSinkRequest message or plain object + * @param {google.logging.v2.ConfigServiceV2.CreateSinkCallback} callback Node-style callback called with the error, if any, and LogSink + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConfigServiceV2.prototype.createSink = function createSink(request, callback) { + return this.rpcCall(createSink, $root.google.logging.v2.CreateSinkRequest, $root.google.logging.v2.LogSink, request, callback); + }, "name", { value: "CreateSink" }); + + /** + * Calls CreateSink. + * @function createSink + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.ICreateSinkRequest} request CreateSinkRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.ConfigServiceV2|updateSink}. + * @memberof google.logging.v2.ConfigServiceV2 + * @typedef UpdateSinkCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.logging.v2.LogSink} [response] LogSink + */ + + /** + * Calls UpdateSink. + * @function updateSink + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IUpdateSinkRequest} request UpdateSinkRequest message or plain object + * @param {google.logging.v2.ConfigServiceV2.UpdateSinkCallback} callback Node-style callback called with the error, if any, and LogSink + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConfigServiceV2.prototype.updateSink = function updateSink(request, callback) { + return this.rpcCall(updateSink, $root.google.logging.v2.UpdateSinkRequest, $root.google.logging.v2.LogSink, request, callback); + }, "name", { value: "UpdateSink" }); + + /** + * Calls UpdateSink. + * @function updateSink + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IUpdateSinkRequest} request UpdateSinkRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.ConfigServiceV2|deleteSink}. + * @memberof google.logging.v2.ConfigServiceV2 + * @typedef DeleteSinkCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteSink. + * @function deleteSink + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IDeleteSinkRequest} request DeleteSinkRequest message or plain object + * @param {google.logging.v2.ConfigServiceV2.DeleteSinkCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConfigServiceV2.prototype.deleteSink = function deleteSink(request, callback) { + return this.rpcCall(deleteSink, $root.google.logging.v2.DeleteSinkRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteSink" }); + + /** + * Calls DeleteSink. + * @function deleteSink + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IDeleteSinkRequest} request DeleteSinkRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.ConfigServiceV2|createLink}. + * @memberof google.logging.v2.ConfigServiceV2 + * @typedef CreateLinkCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CreateLink. + * @function createLink + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.ICreateLinkRequest} request CreateLinkRequest message or plain object + * @param {google.logging.v2.ConfigServiceV2.CreateLinkCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConfigServiceV2.prototype.createLink = function createLink(request, callback) { + return this.rpcCall(createLink, $root.google.logging.v2.CreateLinkRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CreateLink" }); + + /** + * Calls CreateLink. + * @function createLink + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.ICreateLinkRequest} request CreateLinkRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.ConfigServiceV2|deleteLink}. + * @memberof google.logging.v2.ConfigServiceV2 + * @typedef DeleteLinkCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls DeleteLink. + * @function deleteLink + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IDeleteLinkRequest} request DeleteLinkRequest message or plain object + * @param {google.logging.v2.ConfigServiceV2.DeleteLinkCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConfigServiceV2.prototype.deleteLink = function deleteLink(request, callback) { + return this.rpcCall(deleteLink, $root.google.logging.v2.DeleteLinkRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "DeleteLink" }); + + /** + * Calls DeleteLink. + * @function deleteLink + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IDeleteLinkRequest} request DeleteLinkRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.ConfigServiceV2|listLinks}. + * @memberof google.logging.v2.ConfigServiceV2 + * @typedef ListLinksCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.logging.v2.ListLinksResponse} [response] ListLinksResponse + */ + + /** + * Calls ListLinks. + * @function listLinks + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IListLinksRequest} request ListLinksRequest message or plain object + * @param {google.logging.v2.ConfigServiceV2.ListLinksCallback} callback Node-style callback called with the error, if any, and ListLinksResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConfigServiceV2.prototype.listLinks = function listLinks(request, callback) { + return this.rpcCall(listLinks, $root.google.logging.v2.ListLinksRequest, $root.google.logging.v2.ListLinksResponse, request, callback); + }, "name", { value: "ListLinks" }); + + /** + * Calls ListLinks. + * @function listLinks + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IListLinksRequest} request ListLinksRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.ConfigServiceV2|getLink}. + * @memberof google.logging.v2.ConfigServiceV2 + * @typedef GetLinkCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.logging.v2.Link} [response] Link + */ + + /** + * Calls GetLink. + * @function getLink + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IGetLinkRequest} request GetLinkRequest message or plain object + * @param {google.logging.v2.ConfigServiceV2.GetLinkCallback} callback Node-style callback called with the error, if any, and Link + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConfigServiceV2.prototype.getLink = function getLink(request, callback) { + return this.rpcCall(getLink, $root.google.logging.v2.GetLinkRequest, $root.google.logging.v2.Link, request, callback); + }, "name", { value: "GetLink" }); + + /** + * Calls GetLink. + * @function getLink + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IGetLinkRequest} request GetLinkRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.ConfigServiceV2|listExclusions}. + * @memberof google.logging.v2.ConfigServiceV2 + * @typedef ListExclusionsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.logging.v2.ListExclusionsResponse} [response] ListExclusionsResponse + */ + + /** + * Calls ListExclusions. + * @function listExclusions + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IListExclusionsRequest} request ListExclusionsRequest message or plain object + * @param {google.logging.v2.ConfigServiceV2.ListExclusionsCallback} callback Node-style callback called with the error, if any, and ListExclusionsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConfigServiceV2.prototype.listExclusions = function listExclusions(request, callback) { + return this.rpcCall(listExclusions, $root.google.logging.v2.ListExclusionsRequest, $root.google.logging.v2.ListExclusionsResponse, request, callback); + }, "name", { value: "ListExclusions" }); + + /** + * Calls ListExclusions. + * @function listExclusions + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IListExclusionsRequest} request ListExclusionsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.ConfigServiceV2|getExclusion}. + * @memberof google.logging.v2.ConfigServiceV2 + * @typedef GetExclusionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.logging.v2.LogExclusion} [response] LogExclusion + */ + + /** + * Calls GetExclusion. + * @function getExclusion + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IGetExclusionRequest} request GetExclusionRequest message or plain object + * @param {google.logging.v2.ConfigServiceV2.GetExclusionCallback} callback Node-style callback called with the error, if any, and LogExclusion + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConfigServiceV2.prototype.getExclusion = function getExclusion(request, callback) { + return this.rpcCall(getExclusion, $root.google.logging.v2.GetExclusionRequest, $root.google.logging.v2.LogExclusion, request, callback); + }, "name", { value: "GetExclusion" }); + + /** + * Calls GetExclusion. + * @function getExclusion + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IGetExclusionRequest} request GetExclusionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.ConfigServiceV2|createExclusion}. + * @memberof google.logging.v2.ConfigServiceV2 + * @typedef CreateExclusionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.logging.v2.LogExclusion} [response] LogExclusion + */ + + /** + * Calls CreateExclusion. + * @function createExclusion + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.ICreateExclusionRequest} request CreateExclusionRequest message or plain object + * @param {google.logging.v2.ConfigServiceV2.CreateExclusionCallback} callback Node-style callback called with the error, if any, and LogExclusion + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConfigServiceV2.prototype.createExclusion = function createExclusion(request, callback) { + return this.rpcCall(createExclusion, $root.google.logging.v2.CreateExclusionRequest, $root.google.logging.v2.LogExclusion, request, callback); + }, "name", { value: "CreateExclusion" }); + + /** + * Calls CreateExclusion. + * @function createExclusion + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.ICreateExclusionRequest} request CreateExclusionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.ConfigServiceV2|updateExclusion}. + * @memberof google.logging.v2.ConfigServiceV2 + * @typedef UpdateExclusionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.logging.v2.LogExclusion} [response] LogExclusion + */ + + /** + * Calls UpdateExclusion. + * @function updateExclusion + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IUpdateExclusionRequest} request UpdateExclusionRequest message or plain object + * @param {google.logging.v2.ConfigServiceV2.UpdateExclusionCallback} callback Node-style callback called with the error, if any, and LogExclusion + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConfigServiceV2.prototype.updateExclusion = function updateExclusion(request, callback) { + return this.rpcCall(updateExclusion, $root.google.logging.v2.UpdateExclusionRequest, $root.google.logging.v2.LogExclusion, request, callback); + }, "name", { value: "UpdateExclusion" }); + + /** + * Calls UpdateExclusion. + * @function updateExclusion + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IUpdateExclusionRequest} request UpdateExclusionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.ConfigServiceV2|deleteExclusion}. + * @memberof google.logging.v2.ConfigServiceV2 + * @typedef DeleteExclusionCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteExclusion. + * @function deleteExclusion + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IDeleteExclusionRequest} request DeleteExclusionRequest message or plain object + * @param {google.logging.v2.ConfigServiceV2.DeleteExclusionCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConfigServiceV2.prototype.deleteExclusion = function deleteExclusion(request, callback) { + return this.rpcCall(deleteExclusion, $root.google.logging.v2.DeleteExclusionRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteExclusion" }); + + /** + * Calls DeleteExclusion. + * @function deleteExclusion + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IDeleteExclusionRequest} request DeleteExclusionRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.ConfigServiceV2|getCmekSettings}. + * @memberof google.logging.v2.ConfigServiceV2 + * @typedef GetCmekSettingsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.logging.v2.CmekSettings} [response] CmekSettings + */ + + /** + * Calls GetCmekSettings. + * @function getCmekSettings + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IGetCmekSettingsRequest} request GetCmekSettingsRequest message or plain object + * @param {google.logging.v2.ConfigServiceV2.GetCmekSettingsCallback} callback Node-style callback called with the error, if any, and CmekSettings + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConfigServiceV2.prototype.getCmekSettings = function getCmekSettings(request, callback) { + return this.rpcCall(getCmekSettings, $root.google.logging.v2.GetCmekSettingsRequest, $root.google.logging.v2.CmekSettings, request, callback); + }, "name", { value: "GetCmekSettings" }); + + /** + * Calls GetCmekSettings. + * @function getCmekSettings + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IGetCmekSettingsRequest} request GetCmekSettingsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.ConfigServiceV2|updateCmekSettings}. + * @memberof google.logging.v2.ConfigServiceV2 + * @typedef UpdateCmekSettingsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.logging.v2.CmekSettings} [response] CmekSettings + */ + + /** + * Calls UpdateCmekSettings. + * @function updateCmekSettings + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IUpdateCmekSettingsRequest} request UpdateCmekSettingsRequest message or plain object + * @param {google.logging.v2.ConfigServiceV2.UpdateCmekSettingsCallback} callback Node-style callback called with the error, if any, and CmekSettings + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConfigServiceV2.prototype.updateCmekSettings = function updateCmekSettings(request, callback) { + return this.rpcCall(updateCmekSettings, $root.google.logging.v2.UpdateCmekSettingsRequest, $root.google.logging.v2.CmekSettings, request, callback); + }, "name", { value: "UpdateCmekSettings" }); + + /** + * Calls UpdateCmekSettings. + * @function updateCmekSettings + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IUpdateCmekSettingsRequest} request UpdateCmekSettingsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.ConfigServiceV2|getSettings}. + * @memberof google.logging.v2.ConfigServiceV2 + * @typedef GetSettingsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.logging.v2.Settings} [response] Settings + */ + + /** + * Calls GetSettings. + * @function getSettings + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IGetSettingsRequest} request GetSettingsRequest message or plain object + * @param {google.logging.v2.ConfigServiceV2.GetSettingsCallback} callback Node-style callback called with the error, if any, and Settings + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConfigServiceV2.prototype.getSettings = function getSettings(request, callback) { + return this.rpcCall(getSettings, $root.google.logging.v2.GetSettingsRequest, $root.google.logging.v2.Settings, request, callback); + }, "name", { value: "GetSettings" }); + + /** + * Calls GetSettings. + * @function getSettings + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IGetSettingsRequest} request GetSettingsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.ConfigServiceV2|updateSettings}. + * @memberof google.logging.v2.ConfigServiceV2 + * @typedef UpdateSettingsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.logging.v2.Settings} [response] Settings + */ + + /** + * Calls UpdateSettings. + * @function updateSettings + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IUpdateSettingsRequest} request UpdateSettingsRequest message or plain object + * @param {google.logging.v2.ConfigServiceV2.UpdateSettingsCallback} callback Node-style callback called with the error, if any, and Settings + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConfigServiceV2.prototype.updateSettings = function updateSettings(request, callback) { + return this.rpcCall(updateSettings, $root.google.logging.v2.UpdateSettingsRequest, $root.google.logging.v2.Settings, request, callback); + }, "name", { value: "UpdateSettings" }); + + /** + * Calls UpdateSettings. + * @function updateSettings + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.IUpdateSettingsRequest} request UpdateSettingsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.ConfigServiceV2|copyLogEntries}. + * @memberof google.logging.v2.ConfigServiceV2 + * @typedef CopyLogEntriesCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls CopyLogEntries. + * @function copyLogEntries + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.ICopyLogEntriesRequest} request CopyLogEntriesRequest message or plain object + * @param {google.logging.v2.ConfigServiceV2.CopyLogEntriesCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(ConfigServiceV2.prototype.copyLogEntries = function copyLogEntries(request, callback) { + return this.rpcCall(copyLogEntries, $root.google.logging.v2.CopyLogEntriesRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "CopyLogEntries" }); + + /** + * Calls CopyLogEntries. + * @function copyLogEntries + * @memberof google.logging.v2.ConfigServiceV2 + * @instance + * @param {google.logging.v2.ICopyLogEntriesRequest} request CopyLogEntriesRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return ConfigServiceV2; + })(); + + v2.IndexConfig = (function() { + + /** + * Properties of an IndexConfig. + * @memberof google.logging.v2 + * @interface IIndexConfig + * @property {string|null} [fieldPath] IndexConfig fieldPath + * @property {google.logging.v2.IndexType|null} [type] IndexConfig type + * @property {google.protobuf.ITimestamp|null} [createTime] IndexConfig createTime + */ + + /** + * Constructs a new IndexConfig. + * @memberof google.logging.v2 + * @classdesc Represents an IndexConfig. + * @implements IIndexConfig + * @constructor + * @param {google.logging.v2.IIndexConfig=} [properties] Properties to set + */ + function IndexConfig(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * IndexConfig fieldPath. + * @member {string} fieldPath + * @memberof google.logging.v2.IndexConfig + * @instance + */ + IndexConfig.prototype.fieldPath = ""; + + /** + * IndexConfig type. + * @member {google.logging.v2.IndexType} type + * @memberof google.logging.v2.IndexConfig + * @instance + */ + IndexConfig.prototype.type = 0; + + /** + * IndexConfig createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.logging.v2.IndexConfig + * @instance + */ + IndexConfig.prototype.createTime = null; + + /** + * Creates a new IndexConfig instance using the specified properties. + * @function create + * @memberof google.logging.v2.IndexConfig + * @static + * @param {google.logging.v2.IIndexConfig=} [properties] Properties to set + * @returns {google.logging.v2.IndexConfig} IndexConfig instance + */ + IndexConfig.create = function create(properties) { + return new IndexConfig(properties); + }; + + /** + * Encodes the specified IndexConfig message. Does not implicitly {@link google.logging.v2.IndexConfig.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.IndexConfig + * @static + * @param {google.logging.v2.IIndexConfig} message IndexConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IndexConfig.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.fieldPath != null && Object.hasOwnProperty.call(message, "fieldPath")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.fieldPath); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.type); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified IndexConfig message, length delimited. Does not implicitly {@link google.logging.v2.IndexConfig.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.IndexConfig + * @static + * @param {google.logging.v2.IIndexConfig} message IndexConfig message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + IndexConfig.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an IndexConfig message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.IndexConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.IndexConfig} IndexConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IndexConfig.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.IndexConfig(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.fieldPath = reader.string(); + break; + } + case 2: { + message.type = reader.int32(); + break; + } + case 3: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an IndexConfig message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.IndexConfig + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.IndexConfig} IndexConfig + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + IndexConfig.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an IndexConfig message. + * @function verify + * @memberof google.logging.v2.IndexConfig + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + IndexConfig.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.fieldPath != null && message.hasOwnProperty("fieldPath")) + if (!$util.isString(message.fieldPath)) + return "fieldPath: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + switch (message.type) { + default: + return "type: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + return null; + }; + + /** + * Creates an IndexConfig message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.IndexConfig + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.IndexConfig} IndexConfig + */ + IndexConfig.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.IndexConfig) + return object; + var message = new $root.google.logging.v2.IndexConfig(); + if (object.fieldPath != null) + message.fieldPath = String(object.fieldPath); + switch (object.type) { + default: + if (typeof object.type === "number") { + message.type = object.type; + break; + } + break; + case "INDEX_TYPE_UNSPECIFIED": + case 0: + message.type = 0; + break; + case "INDEX_TYPE_STRING": + case 1: + message.type = 1; + break; + case "INDEX_TYPE_INTEGER": + case 2: + message.type = 2; + break; + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.logging.v2.IndexConfig.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + return message; + }; + + /** + * Creates a plain object from an IndexConfig message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.IndexConfig + * @static + * @param {google.logging.v2.IndexConfig} message IndexConfig + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + IndexConfig.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.fieldPath = ""; + object.type = options.enums === String ? "INDEX_TYPE_UNSPECIFIED" : 0; + object.createTime = null; + } + if (message.fieldPath != null && message.hasOwnProperty("fieldPath")) + object.fieldPath = message.fieldPath; + if (message.type != null && message.hasOwnProperty("type")) + object.type = options.enums === String ? $root.google.logging.v2.IndexType[message.type] === undefined ? message.type : $root.google.logging.v2.IndexType[message.type] : message.type; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + return object; + }; + + /** + * Converts this IndexConfig to JSON. + * @function toJSON + * @memberof google.logging.v2.IndexConfig + * @instance + * @returns {Object.} JSON object + */ + IndexConfig.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for IndexConfig + * @function getTypeUrl + * @memberof google.logging.v2.IndexConfig + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + IndexConfig.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.IndexConfig"; + }; + + return IndexConfig; + })(); + + v2.LogBucket = (function() { + + /** + * Properties of a LogBucket. + * @memberof google.logging.v2 + * @interface ILogBucket + * @property {string|null} [name] LogBucket name + * @property {string|null} [description] LogBucket description + * @property {google.protobuf.ITimestamp|null} [createTime] LogBucket createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] LogBucket updateTime + * @property {number|null} [retentionDays] LogBucket retentionDays + * @property {boolean|null} [locked] LogBucket locked + * @property {google.logging.v2.LifecycleState|null} [lifecycleState] LogBucket lifecycleState + * @property {boolean|null} [analyticsEnabled] LogBucket analyticsEnabled + * @property {Array.|null} [restrictedFields] LogBucket restrictedFields + * @property {Array.|null} [indexConfigs] LogBucket indexConfigs + * @property {google.logging.v2.ICmekSettings|null} [cmekSettings] LogBucket cmekSettings + */ + + /** + * Constructs a new LogBucket. + * @memberof google.logging.v2 + * @classdesc Represents a LogBucket. + * @implements ILogBucket + * @constructor + * @param {google.logging.v2.ILogBucket=} [properties] Properties to set + */ + function LogBucket(properties) { + this.restrictedFields = []; + this.indexConfigs = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LogBucket name. + * @member {string} name + * @memberof google.logging.v2.LogBucket + * @instance + */ + LogBucket.prototype.name = ""; + + /** + * LogBucket description. + * @member {string} description + * @memberof google.logging.v2.LogBucket + * @instance + */ + LogBucket.prototype.description = ""; + + /** + * LogBucket createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.logging.v2.LogBucket + * @instance + */ + LogBucket.prototype.createTime = null; + + /** + * LogBucket updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.logging.v2.LogBucket + * @instance + */ + LogBucket.prototype.updateTime = null; + + /** + * LogBucket retentionDays. + * @member {number} retentionDays + * @memberof google.logging.v2.LogBucket + * @instance + */ + LogBucket.prototype.retentionDays = 0; + + /** + * LogBucket locked. + * @member {boolean} locked + * @memberof google.logging.v2.LogBucket + * @instance + */ + LogBucket.prototype.locked = false; + + /** + * LogBucket lifecycleState. + * @member {google.logging.v2.LifecycleState} lifecycleState + * @memberof google.logging.v2.LogBucket + * @instance + */ + LogBucket.prototype.lifecycleState = 0; + + /** + * LogBucket analyticsEnabled. + * @member {boolean} analyticsEnabled + * @memberof google.logging.v2.LogBucket + * @instance + */ + LogBucket.prototype.analyticsEnabled = false; + + /** + * LogBucket restrictedFields. + * @member {Array.} restrictedFields + * @memberof google.logging.v2.LogBucket + * @instance + */ + LogBucket.prototype.restrictedFields = $util.emptyArray; + + /** + * LogBucket indexConfigs. + * @member {Array.} indexConfigs + * @memberof google.logging.v2.LogBucket + * @instance + */ + LogBucket.prototype.indexConfigs = $util.emptyArray; + + /** + * LogBucket cmekSettings. + * @member {google.logging.v2.ICmekSettings|null|undefined} cmekSettings + * @memberof google.logging.v2.LogBucket + * @instance + */ + LogBucket.prototype.cmekSettings = null; + + /** + * Creates a new LogBucket instance using the specified properties. + * @function create + * @memberof google.logging.v2.LogBucket + * @static + * @param {google.logging.v2.ILogBucket=} [properties] Properties to set + * @returns {google.logging.v2.LogBucket} LogBucket instance + */ + LogBucket.create = function create(properties) { + return new LogBucket(properties); + }; + + /** + * Encodes the specified LogBucket message. Does not implicitly {@link google.logging.v2.LogBucket.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.LogBucket + * @static + * @param {google.logging.v2.ILogBucket} message LogBucket message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LogBucket.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.locked != null && Object.hasOwnProperty.call(message, "locked")) + writer.uint32(/* id 9, wireType 0 =*/72).bool(message.locked); + if (message.retentionDays != null && Object.hasOwnProperty.call(message, "retentionDays")) + writer.uint32(/* id 11, wireType 0 =*/88).int32(message.retentionDays); + if (message.lifecycleState != null && Object.hasOwnProperty.call(message, "lifecycleState")) + writer.uint32(/* id 12, wireType 0 =*/96).int32(message.lifecycleState); + if (message.analyticsEnabled != null && Object.hasOwnProperty.call(message, "analyticsEnabled")) + writer.uint32(/* id 14, wireType 0 =*/112).bool(message.analyticsEnabled); + if (message.restrictedFields != null && message.restrictedFields.length) + for (var i = 0; i < message.restrictedFields.length; ++i) + writer.uint32(/* id 15, wireType 2 =*/122).string(message.restrictedFields[i]); + if (message.indexConfigs != null && message.indexConfigs.length) + for (var i = 0; i < message.indexConfigs.length; ++i) + $root.google.logging.v2.IndexConfig.encode(message.indexConfigs[i], writer.uint32(/* id 17, wireType 2 =*/138).fork()).ldelim(); + if (message.cmekSettings != null && Object.hasOwnProperty.call(message, "cmekSettings")) + $root.google.logging.v2.CmekSettings.encode(message.cmekSettings, writer.uint32(/* id 19, wireType 2 =*/154).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified LogBucket message, length delimited. Does not implicitly {@link google.logging.v2.LogBucket.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.LogBucket + * @static + * @param {google.logging.v2.ILogBucket} message LogBucket message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LogBucket.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LogBucket message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.LogBucket + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.LogBucket} LogBucket + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LogBucket.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.LogBucket(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 3: { + message.description = reader.string(); + break; + } + case 4: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 5: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 11: { + message.retentionDays = reader.int32(); + break; + } + case 9: { + message.locked = reader.bool(); + break; + } + case 12: { + message.lifecycleState = reader.int32(); + break; + } + case 14: { + message.analyticsEnabled = reader.bool(); + break; + } + case 15: { + if (!(message.restrictedFields && message.restrictedFields.length)) + message.restrictedFields = []; + message.restrictedFields.push(reader.string()); + break; + } + case 17: { + if (!(message.indexConfigs && message.indexConfigs.length)) + message.indexConfigs = []; + message.indexConfigs.push($root.google.logging.v2.IndexConfig.decode(reader, reader.uint32())); + break; + } + case 19: { + message.cmekSettings = $root.google.logging.v2.CmekSettings.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LogBucket message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.LogBucket + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.LogBucket} LogBucket + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LogBucket.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LogBucket message. + * @function verify + * @memberof google.logging.v2.LogBucket + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LogBucket.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } + if (message.retentionDays != null && message.hasOwnProperty("retentionDays")) + if (!$util.isInteger(message.retentionDays)) + return "retentionDays: integer expected"; + if (message.locked != null && message.hasOwnProperty("locked")) + if (typeof message.locked !== "boolean") + return "locked: boolean expected"; + if (message.lifecycleState != null && message.hasOwnProperty("lifecycleState")) + switch (message.lifecycleState) { + default: + return "lifecycleState: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.analyticsEnabled != null && message.hasOwnProperty("analyticsEnabled")) + if (typeof message.analyticsEnabled !== "boolean") + return "analyticsEnabled: boolean expected"; + if (message.restrictedFields != null && message.hasOwnProperty("restrictedFields")) { + if (!Array.isArray(message.restrictedFields)) + return "restrictedFields: array expected"; + for (var i = 0; i < message.restrictedFields.length; ++i) + if (!$util.isString(message.restrictedFields[i])) + return "restrictedFields: string[] expected"; + } + if (message.indexConfigs != null && message.hasOwnProperty("indexConfigs")) { + if (!Array.isArray(message.indexConfigs)) + return "indexConfigs: array expected"; + for (var i = 0; i < message.indexConfigs.length; ++i) { + var error = $root.google.logging.v2.IndexConfig.verify(message.indexConfigs[i]); + if (error) + return "indexConfigs." + error; + } + } + if (message.cmekSettings != null && message.hasOwnProperty("cmekSettings")) { + var error = $root.google.logging.v2.CmekSettings.verify(message.cmekSettings); + if (error) + return "cmekSettings." + error; + } + return null; + }; + + /** + * Creates a LogBucket message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.LogBucket + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.LogBucket} LogBucket + */ + LogBucket.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.LogBucket) + return object; + var message = new $root.google.logging.v2.LogBucket(); + if (object.name != null) + message.name = String(object.name); + if (object.description != null) + message.description = String(object.description); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.logging.v2.LogBucket.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.logging.v2.LogBucket.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.retentionDays != null) + message.retentionDays = object.retentionDays | 0; + if (object.locked != null) + message.locked = Boolean(object.locked); + switch (object.lifecycleState) { + default: + if (typeof object.lifecycleState === "number") { + message.lifecycleState = object.lifecycleState; + break; + } + break; + case "LIFECYCLE_STATE_UNSPECIFIED": + case 0: + message.lifecycleState = 0; + break; + case "ACTIVE": + case 1: + message.lifecycleState = 1; + break; + case "DELETE_REQUESTED": + case 2: + message.lifecycleState = 2; + break; + case "UPDATING": + case 3: + message.lifecycleState = 3; + break; + case "CREATING": + case 4: + message.lifecycleState = 4; + break; + case "FAILED": + case 5: + message.lifecycleState = 5; + break; + } + if (object.analyticsEnabled != null) + message.analyticsEnabled = Boolean(object.analyticsEnabled); + if (object.restrictedFields) { + if (!Array.isArray(object.restrictedFields)) + throw TypeError(".google.logging.v2.LogBucket.restrictedFields: array expected"); + message.restrictedFields = []; + for (var i = 0; i < object.restrictedFields.length; ++i) + message.restrictedFields[i] = String(object.restrictedFields[i]); + } + if (object.indexConfigs) { + if (!Array.isArray(object.indexConfigs)) + throw TypeError(".google.logging.v2.LogBucket.indexConfigs: array expected"); + message.indexConfigs = []; + for (var i = 0; i < object.indexConfigs.length; ++i) { + if (typeof object.indexConfigs[i] !== "object") + throw TypeError(".google.logging.v2.LogBucket.indexConfigs: object expected"); + message.indexConfigs[i] = $root.google.logging.v2.IndexConfig.fromObject(object.indexConfigs[i]); + } + } + if (object.cmekSettings != null) { + if (typeof object.cmekSettings !== "object") + throw TypeError(".google.logging.v2.LogBucket.cmekSettings: object expected"); + message.cmekSettings = $root.google.logging.v2.CmekSettings.fromObject(object.cmekSettings); + } + return message; + }; + + /** + * Creates a plain object from a LogBucket message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.LogBucket + * @static + * @param {google.logging.v2.LogBucket} message LogBucket + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LogBucket.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.restrictedFields = []; + object.indexConfigs = []; + } + if (options.defaults) { + object.name = ""; + object.description = ""; + object.createTime = null; + object.updateTime = null; + object.locked = false; + object.retentionDays = 0; + object.lifecycleState = options.enums === String ? "LIFECYCLE_STATE_UNSPECIFIED" : 0; + object.analyticsEnabled = false; + object.cmekSettings = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (message.locked != null && message.hasOwnProperty("locked")) + object.locked = message.locked; + if (message.retentionDays != null && message.hasOwnProperty("retentionDays")) + object.retentionDays = message.retentionDays; + if (message.lifecycleState != null && message.hasOwnProperty("lifecycleState")) + object.lifecycleState = options.enums === String ? $root.google.logging.v2.LifecycleState[message.lifecycleState] === undefined ? message.lifecycleState : $root.google.logging.v2.LifecycleState[message.lifecycleState] : message.lifecycleState; + if (message.analyticsEnabled != null && message.hasOwnProperty("analyticsEnabled")) + object.analyticsEnabled = message.analyticsEnabled; + if (message.restrictedFields && message.restrictedFields.length) { + object.restrictedFields = []; + for (var j = 0; j < message.restrictedFields.length; ++j) + object.restrictedFields[j] = message.restrictedFields[j]; + } + if (message.indexConfigs && message.indexConfigs.length) { + object.indexConfigs = []; + for (var j = 0; j < message.indexConfigs.length; ++j) + object.indexConfigs[j] = $root.google.logging.v2.IndexConfig.toObject(message.indexConfigs[j], options); + } + if (message.cmekSettings != null && message.hasOwnProperty("cmekSettings")) + object.cmekSettings = $root.google.logging.v2.CmekSettings.toObject(message.cmekSettings, options); + return object; + }; + + /** + * Converts this LogBucket to JSON. + * @function toJSON + * @memberof google.logging.v2.LogBucket + * @instance + * @returns {Object.} JSON object + */ + LogBucket.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LogBucket + * @function getTypeUrl + * @memberof google.logging.v2.LogBucket + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LogBucket.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.LogBucket"; + }; + + return LogBucket; + })(); + + v2.LogView = (function() { + + /** + * Properties of a LogView. + * @memberof google.logging.v2 + * @interface ILogView + * @property {string|null} [name] LogView name + * @property {string|null} [description] LogView description + * @property {google.protobuf.ITimestamp|null} [createTime] LogView createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] LogView updateTime + * @property {string|null} [filter] LogView filter + */ + + /** + * Constructs a new LogView. + * @memberof google.logging.v2 + * @classdesc Represents a LogView. + * @implements ILogView + * @constructor + * @param {google.logging.v2.ILogView=} [properties] Properties to set + */ + function LogView(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LogView name. + * @member {string} name + * @memberof google.logging.v2.LogView + * @instance + */ + LogView.prototype.name = ""; + + /** + * LogView description. + * @member {string} description + * @memberof google.logging.v2.LogView + * @instance + */ + LogView.prototype.description = ""; + + /** + * LogView createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.logging.v2.LogView + * @instance + */ + LogView.prototype.createTime = null; + + /** + * LogView updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.logging.v2.LogView + * @instance + */ + LogView.prototype.updateTime = null; + + /** + * LogView filter. + * @member {string} filter + * @memberof google.logging.v2.LogView + * @instance + */ + LogView.prototype.filter = ""; + + /** + * Creates a new LogView instance using the specified properties. + * @function create + * @memberof google.logging.v2.LogView + * @static + * @param {google.logging.v2.ILogView=} [properties] Properties to set + * @returns {google.logging.v2.LogView} LogView instance + */ + LogView.create = function create(properties) { + return new LogView(properties); + }; + + /** + * Encodes the specified LogView message. Does not implicitly {@link google.logging.v2.LogView.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.LogView + * @static + * @param {google.logging.v2.ILogView} message LogView message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LogView.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.filter); + return writer; + }; + + /** + * Encodes the specified LogView message, length delimited. Does not implicitly {@link google.logging.v2.LogView.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.LogView + * @static + * @param {google.logging.v2.ILogView} message LogView message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LogView.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LogView message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.LogView + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.LogView} LogView + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LogView.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.LogView(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 3: { + message.description = reader.string(); + break; + } + case 4: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 5: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 7: { + message.filter = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LogView message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.LogView + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.LogView} LogView + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LogView.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LogView message. + * @function verify + * @memberof google.logging.v2.LogView + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LogView.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + return null; + }; + + /** + * Creates a LogView message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.LogView + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.LogView} LogView + */ + LogView.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.LogView) + return object; + var message = new $root.google.logging.v2.LogView(); + if (object.name != null) + message.name = String(object.name); + if (object.description != null) + message.description = String(object.description); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.logging.v2.LogView.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.logging.v2.LogView.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + if (object.filter != null) + message.filter = String(object.filter); + return message; + }; + + /** + * Creates a plain object from a LogView message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.LogView + * @static + * @param {google.logging.v2.LogView} message LogView + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LogView.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.description = ""; + object.createTime = null; + object.updateTime = null; + object.filter = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + return object; + }; + + /** + * Converts this LogView to JSON. + * @function toJSON + * @memberof google.logging.v2.LogView + * @instance + * @returns {Object.} JSON object + */ + LogView.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LogView + * @function getTypeUrl + * @memberof google.logging.v2.LogView + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LogView.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.LogView"; + }; + + return LogView; + })(); + + v2.LogSink = (function() { + + /** + * Properties of a LogSink. + * @memberof google.logging.v2 + * @interface ILogSink + * @property {string|null} [name] LogSink name + * @property {string|null} [destination] LogSink destination + * @property {string|null} [filter] LogSink filter + * @property {string|null} [description] LogSink description + * @property {boolean|null} [disabled] LogSink disabled + * @property {Array.|null} [exclusions] LogSink exclusions + * @property {google.logging.v2.LogSink.VersionFormat|null} [outputVersionFormat] LogSink outputVersionFormat + * @property {string|null} [writerIdentity] LogSink writerIdentity + * @property {boolean|null} [includeChildren] LogSink includeChildren + * @property {google.logging.v2.IBigQueryOptions|null} [bigqueryOptions] LogSink bigqueryOptions + * @property {google.protobuf.ITimestamp|null} [createTime] LogSink createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] LogSink updateTime + */ + + /** + * Constructs a new LogSink. + * @memberof google.logging.v2 + * @classdesc Represents a LogSink. + * @implements ILogSink + * @constructor + * @param {google.logging.v2.ILogSink=} [properties] Properties to set + */ + function LogSink(properties) { + this.exclusions = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LogSink name. + * @member {string} name + * @memberof google.logging.v2.LogSink + * @instance + */ + LogSink.prototype.name = ""; + + /** + * LogSink destination. + * @member {string} destination + * @memberof google.logging.v2.LogSink + * @instance + */ + LogSink.prototype.destination = ""; + + /** + * LogSink filter. + * @member {string} filter + * @memberof google.logging.v2.LogSink + * @instance + */ + LogSink.prototype.filter = ""; + + /** + * LogSink description. + * @member {string} description + * @memberof google.logging.v2.LogSink + * @instance + */ + LogSink.prototype.description = ""; + + /** + * LogSink disabled. + * @member {boolean} disabled + * @memberof google.logging.v2.LogSink + * @instance + */ + LogSink.prototype.disabled = false; + + /** + * LogSink exclusions. + * @member {Array.} exclusions + * @memberof google.logging.v2.LogSink + * @instance + */ + LogSink.prototype.exclusions = $util.emptyArray; + + /** + * LogSink outputVersionFormat. + * @member {google.logging.v2.LogSink.VersionFormat} outputVersionFormat + * @memberof google.logging.v2.LogSink + * @instance + */ + LogSink.prototype.outputVersionFormat = 0; + + /** + * LogSink writerIdentity. + * @member {string} writerIdentity + * @memberof google.logging.v2.LogSink + * @instance + */ + LogSink.prototype.writerIdentity = ""; + + /** + * LogSink includeChildren. + * @member {boolean} includeChildren + * @memberof google.logging.v2.LogSink + * @instance + */ + LogSink.prototype.includeChildren = false; + + /** + * LogSink bigqueryOptions. + * @member {google.logging.v2.IBigQueryOptions|null|undefined} bigqueryOptions + * @memberof google.logging.v2.LogSink + * @instance + */ + LogSink.prototype.bigqueryOptions = null; + + /** + * LogSink createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.logging.v2.LogSink + * @instance + */ + LogSink.prototype.createTime = null; + + /** + * LogSink updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.logging.v2.LogSink + * @instance + */ + LogSink.prototype.updateTime = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * LogSink options. + * @member {"bigqueryOptions"|undefined} options + * @memberof google.logging.v2.LogSink + * @instance + */ + Object.defineProperty(LogSink.prototype, "options", { + get: $util.oneOfGetter($oneOfFields = ["bigqueryOptions"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new LogSink instance using the specified properties. + * @function create + * @memberof google.logging.v2.LogSink + * @static + * @param {google.logging.v2.ILogSink=} [properties] Properties to set + * @returns {google.logging.v2.LogSink} LogSink instance + */ + LogSink.create = function create(properties) { + return new LogSink(properties); + }; + + /** + * Encodes the specified LogSink message. Does not implicitly {@link google.logging.v2.LogSink.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.LogSink + * @static + * @param {google.logging.v2.ILogSink} message LogSink message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LogSink.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.destination != null && Object.hasOwnProperty.call(message, "destination")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.destination); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.filter); + if (message.outputVersionFormat != null && Object.hasOwnProperty.call(message, "outputVersionFormat")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.outputVersionFormat); + if (message.writerIdentity != null && Object.hasOwnProperty.call(message, "writerIdentity")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.writerIdentity); + if (message.includeChildren != null && Object.hasOwnProperty.call(message, "includeChildren")) + writer.uint32(/* id 9, wireType 0 =*/72).bool(message.includeChildren); + if (message.bigqueryOptions != null && Object.hasOwnProperty.call(message, "bigqueryOptions")) + $root.google.logging.v2.BigQueryOptions.encode(message.bigqueryOptions, writer.uint32(/* id 12, wireType 2 =*/98).fork()).ldelim(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 13, wireType 2 =*/106).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 14, wireType 2 =*/114).fork()).ldelim(); + if (message.exclusions != null && message.exclusions.length) + for (var i = 0; i < message.exclusions.length; ++i) + $root.google.logging.v2.LogExclusion.encode(message.exclusions[i], writer.uint32(/* id 16, wireType 2 =*/130).fork()).ldelim(); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 18, wireType 2 =*/146).string(message.description); + if (message.disabled != null && Object.hasOwnProperty.call(message, "disabled")) + writer.uint32(/* id 19, wireType 0 =*/152).bool(message.disabled); + return writer; + }; + + /** + * Encodes the specified LogSink message, length delimited. Does not implicitly {@link google.logging.v2.LogSink.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.LogSink + * @static + * @param {google.logging.v2.ILogSink} message LogSink message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LogSink.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LogSink message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.LogSink + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.LogSink} LogSink + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LogSink.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.LogSink(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 3: { + message.destination = reader.string(); + break; + } + case 5: { + message.filter = reader.string(); + break; + } + case 18: { + message.description = reader.string(); + break; + } + case 19: { + message.disabled = reader.bool(); + break; + } + case 16: { + if (!(message.exclusions && message.exclusions.length)) + message.exclusions = []; + message.exclusions.push($root.google.logging.v2.LogExclusion.decode(reader, reader.uint32())); + break; + } + case 6: { + message.outputVersionFormat = reader.int32(); + break; + } + case 8: { + message.writerIdentity = reader.string(); + break; + } + case 9: { + message.includeChildren = reader.bool(); + break; + } + case 12: { + message.bigqueryOptions = $root.google.logging.v2.BigQueryOptions.decode(reader, reader.uint32()); + break; + } + case 13: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 14: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LogSink message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.LogSink + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.LogSink} LogSink + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LogSink.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LogSink message. + * @function verify + * @memberof google.logging.v2.LogSink + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LogSink.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.destination != null && message.hasOwnProperty("destination")) + if (!$util.isString(message.destination)) + return "destination: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.disabled != null && message.hasOwnProperty("disabled")) + if (typeof message.disabled !== "boolean") + return "disabled: boolean expected"; + if (message.exclusions != null && message.hasOwnProperty("exclusions")) { + if (!Array.isArray(message.exclusions)) + return "exclusions: array expected"; + for (var i = 0; i < message.exclusions.length; ++i) { + var error = $root.google.logging.v2.LogExclusion.verify(message.exclusions[i]); + if (error) + return "exclusions." + error; + } + } + if (message.outputVersionFormat != null && message.hasOwnProperty("outputVersionFormat")) + switch (message.outputVersionFormat) { + default: + return "outputVersionFormat: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.writerIdentity != null && message.hasOwnProperty("writerIdentity")) + if (!$util.isString(message.writerIdentity)) + return "writerIdentity: string expected"; + if (message.includeChildren != null && message.hasOwnProperty("includeChildren")) + if (typeof message.includeChildren !== "boolean") + return "includeChildren: boolean expected"; + if (message.bigqueryOptions != null && message.hasOwnProperty("bigqueryOptions")) { + properties.options = 1; + { + var error = $root.google.logging.v2.BigQueryOptions.verify(message.bigqueryOptions); + if (error) + return "bigqueryOptions." + error; + } + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } + return null; + }; + + /** + * Creates a LogSink message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.LogSink + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.LogSink} LogSink + */ + LogSink.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.LogSink) + return object; + var message = new $root.google.logging.v2.LogSink(); + if (object.name != null) + message.name = String(object.name); + if (object.destination != null) + message.destination = String(object.destination); + if (object.filter != null) + message.filter = String(object.filter); + if (object.description != null) + message.description = String(object.description); + if (object.disabled != null) + message.disabled = Boolean(object.disabled); + if (object.exclusions) { + if (!Array.isArray(object.exclusions)) + throw TypeError(".google.logging.v2.LogSink.exclusions: array expected"); + message.exclusions = []; + for (var i = 0; i < object.exclusions.length; ++i) { + if (typeof object.exclusions[i] !== "object") + throw TypeError(".google.logging.v2.LogSink.exclusions: object expected"); + message.exclusions[i] = $root.google.logging.v2.LogExclusion.fromObject(object.exclusions[i]); + } + } + switch (object.outputVersionFormat) { + default: + if (typeof object.outputVersionFormat === "number") { + message.outputVersionFormat = object.outputVersionFormat; + break; + } + break; + case "VERSION_FORMAT_UNSPECIFIED": + case 0: + message.outputVersionFormat = 0; + break; + case "V2": + case 1: + message.outputVersionFormat = 1; + break; + case "V1": + case 2: + message.outputVersionFormat = 2; + break; + } + if (object.writerIdentity != null) + message.writerIdentity = String(object.writerIdentity); + if (object.includeChildren != null) + message.includeChildren = Boolean(object.includeChildren); + if (object.bigqueryOptions != null) { + if (typeof object.bigqueryOptions !== "object") + throw TypeError(".google.logging.v2.LogSink.bigqueryOptions: object expected"); + message.bigqueryOptions = $root.google.logging.v2.BigQueryOptions.fromObject(object.bigqueryOptions); + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.logging.v2.LogSink.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.logging.v2.LogSink.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + return message; + }; + + /** + * Creates a plain object from a LogSink message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.LogSink + * @static + * @param {google.logging.v2.LogSink} message LogSink + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LogSink.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.exclusions = []; + if (options.defaults) { + object.name = ""; + object.destination = ""; + object.filter = ""; + object.outputVersionFormat = options.enums === String ? "VERSION_FORMAT_UNSPECIFIED" : 0; + object.writerIdentity = ""; + object.includeChildren = false; + object.createTime = null; + object.updateTime = null; + object.description = ""; + object.disabled = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.destination != null && message.hasOwnProperty("destination")) + object.destination = message.destination; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.outputVersionFormat != null && message.hasOwnProperty("outputVersionFormat")) + object.outputVersionFormat = options.enums === String ? $root.google.logging.v2.LogSink.VersionFormat[message.outputVersionFormat] === undefined ? message.outputVersionFormat : $root.google.logging.v2.LogSink.VersionFormat[message.outputVersionFormat] : message.outputVersionFormat; + if (message.writerIdentity != null && message.hasOwnProperty("writerIdentity")) + object.writerIdentity = message.writerIdentity; + if (message.includeChildren != null && message.hasOwnProperty("includeChildren")) + object.includeChildren = message.includeChildren; + if (message.bigqueryOptions != null && message.hasOwnProperty("bigqueryOptions")) { + object.bigqueryOptions = $root.google.logging.v2.BigQueryOptions.toObject(message.bigqueryOptions, options); + if (options.oneofs) + object.options = "bigqueryOptions"; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (message.exclusions && message.exclusions.length) { + object.exclusions = []; + for (var j = 0; j < message.exclusions.length; ++j) + object.exclusions[j] = $root.google.logging.v2.LogExclusion.toObject(message.exclusions[j], options); + } + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.disabled != null && message.hasOwnProperty("disabled")) + object.disabled = message.disabled; + return object; + }; + + /** + * Converts this LogSink to JSON. + * @function toJSON + * @memberof google.logging.v2.LogSink + * @instance + * @returns {Object.} JSON object + */ + LogSink.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LogSink + * @function getTypeUrl + * @memberof google.logging.v2.LogSink + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LogSink.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.LogSink"; + }; + + /** + * VersionFormat enum. + * @name google.logging.v2.LogSink.VersionFormat + * @enum {number} + * @property {number} VERSION_FORMAT_UNSPECIFIED=0 VERSION_FORMAT_UNSPECIFIED value + * @property {number} V2=1 V2 value + * @property {number} V1=2 V1 value + */ + LogSink.VersionFormat = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "VERSION_FORMAT_UNSPECIFIED"] = 0; + values[valuesById[1] = "V2"] = 1; + values[valuesById[2] = "V1"] = 2; + return values; + })(); + + return LogSink; + })(); + + v2.BigQueryDataset = (function() { + + /** + * Properties of a BigQueryDataset. + * @memberof google.logging.v2 + * @interface IBigQueryDataset + * @property {string|null} [datasetId] BigQueryDataset datasetId + */ + + /** + * Constructs a new BigQueryDataset. + * @memberof google.logging.v2 + * @classdesc Represents a BigQueryDataset. + * @implements IBigQueryDataset + * @constructor + * @param {google.logging.v2.IBigQueryDataset=} [properties] Properties to set + */ + function BigQueryDataset(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BigQueryDataset datasetId. + * @member {string} datasetId + * @memberof google.logging.v2.BigQueryDataset + * @instance + */ + BigQueryDataset.prototype.datasetId = ""; + + /** + * Creates a new BigQueryDataset instance using the specified properties. + * @function create + * @memberof google.logging.v2.BigQueryDataset + * @static + * @param {google.logging.v2.IBigQueryDataset=} [properties] Properties to set + * @returns {google.logging.v2.BigQueryDataset} BigQueryDataset instance + */ + BigQueryDataset.create = function create(properties) { + return new BigQueryDataset(properties); + }; + + /** + * Encodes the specified BigQueryDataset message. Does not implicitly {@link google.logging.v2.BigQueryDataset.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.BigQueryDataset + * @static + * @param {google.logging.v2.IBigQueryDataset} message BigQueryDataset message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BigQueryDataset.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.datasetId != null && Object.hasOwnProperty.call(message, "datasetId")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.datasetId); + return writer; + }; + + /** + * Encodes the specified BigQueryDataset message, length delimited. Does not implicitly {@link google.logging.v2.BigQueryDataset.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.BigQueryDataset + * @static + * @param {google.logging.v2.IBigQueryDataset} message BigQueryDataset message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BigQueryDataset.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BigQueryDataset message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.BigQueryDataset + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.BigQueryDataset} BigQueryDataset + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BigQueryDataset.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.BigQueryDataset(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.datasetId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BigQueryDataset message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.BigQueryDataset + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.BigQueryDataset} BigQueryDataset + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BigQueryDataset.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BigQueryDataset message. + * @function verify + * @memberof google.logging.v2.BigQueryDataset + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BigQueryDataset.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.datasetId != null && message.hasOwnProperty("datasetId")) + if (!$util.isString(message.datasetId)) + return "datasetId: string expected"; + return null; + }; + + /** + * Creates a BigQueryDataset message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.BigQueryDataset + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.BigQueryDataset} BigQueryDataset + */ + BigQueryDataset.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.BigQueryDataset) + return object; + var message = new $root.google.logging.v2.BigQueryDataset(); + if (object.datasetId != null) + message.datasetId = String(object.datasetId); + return message; + }; + + /** + * Creates a plain object from a BigQueryDataset message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.BigQueryDataset + * @static + * @param {google.logging.v2.BigQueryDataset} message BigQueryDataset + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BigQueryDataset.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.datasetId = ""; + if (message.datasetId != null && message.hasOwnProperty("datasetId")) + object.datasetId = message.datasetId; + return object; + }; + + /** + * Converts this BigQueryDataset to JSON. + * @function toJSON + * @memberof google.logging.v2.BigQueryDataset + * @instance + * @returns {Object.} JSON object + */ + BigQueryDataset.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BigQueryDataset + * @function getTypeUrl + * @memberof google.logging.v2.BigQueryDataset + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BigQueryDataset.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.BigQueryDataset"; + }; + + return BigQueryDataset; + })(); + + v2.Link = (function() { + + /** + * Properties of a Link. + * @memberof google.logging.v2 + * @interface ILink + * @property {string|null} [name] Link name + * @property {string|null} [description] Link description + * @property {google.protobuf.ITimestamp|null} [createTime] Link createTime + * @property {google.logging.v2.LifecycleState|null} [lifecycleState] Link lifecycleState + * @property {google.logging.v2.IBigQueryDataset|null} [bigqueryDataset] Link bigqueryDataset + */ + + /** + * Constructs a new Link. + * @memberof google.logging.v2 + * @classdesc Represents a Link. + * @implements ILink + * @constructor + * @param {google.logging.v2.ILink=} [properties] Properties to set + */ + function Link(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Link name. + * @member {string} name + * @memberof google.logging.v2.Link + * @instance + */ + Link.prototype.name = ""; + + /** + * Link description. + * @member {string} description + * @memberof google.logging.v2.Link + * @instance + */ + Link.prototype.description = ""; + + /** + * Link createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.logging.v2.Link + * @instance + */ + Link.prototype.createTime = null; + + /** + * Link lifecycleState. + * @member {google.logging.v2.LifecycleState} lifecycleState + * @memberof google.logging.v2.Link + * @instance + */ + Link.prototype.lifecycleState = 0; + + /** + * Link bigqueryDataset. + * @member {google.logging.v2.IBigQueryDataset|null|undefined} bigqueryDataset + * @memberof google.logging.v2.Link + * @instance + */ + Link.prototype.bigqueryDataset = null; + + /** + * Creates a new Link instance using the specified properties. + * @function create + * @memberof google.logging.v2.Link + * @static + * @param {google.logging.v2.ILink=} [properties] Properties to set + * @returns {google.logging.v2.Link} Link instance + */ + Link.create = function create(properties) { + return new Link(properties); + }; + + /** + * Encodes the specified Link message. Does not implicitly {@link google.logging.v2.Link.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.Link + * @static + * @param {google.logging.v2.ILink} message Link message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Link.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.lifecycleState != null && Object.hasOwnProperty.call(message, "lifecycleState")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.lifecycleState); + if (message.bigqueryDataset != null && Object.hasOwnProperty.call(message, "bigqueryDataset")) + $root.google.logging.v2.BigQueryDataset.encode(message.bigqueryDataset, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Link message, length delimited. Does not implicitly {@link google.logging.v2.Link.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.Link + * @static + * @param {google.logging.v2.ILink} message Link message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Link.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Link message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.Link + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.Link} Link + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Link.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.Link(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.description = reader.string(); + break; + } + case 3: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 4: { + message.lifecycleState = reader.int32(); + break; + } + case 5: { + message.bigqueryDataset = $root.google.logging.v2.BigQueryDataset.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Link message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.Link + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.Link} Link + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Link.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Link message. + * @function verify + * @memberof google.logging.v2.Link + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Link.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.lifecycleState != null && message.hasOwnProperty("lifecycleState")) + switch (message.lifecycleState) { + default: + return "lifecycleState: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.bigqueryDataset != null && message.hasOwnProperty("bigqueryDataset")) { + var error = $root.google.logging.v2.BigQueryDataset.verify(message.bigqueryDataset); + if (error) + return "bigqueryDataset." + error; + } + return null; + }; + + /** + * Creates a Link message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.Link + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.Link} Link + */ + Link.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.Link) + return object; + var message = new $root.google.logging.v2.Link(); + if (object.name != null) + message.name = String(object.name); + if (object.description != null) + message.description = String(object.description); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.logging.v2.Link.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + switch (object.lifecycleState) { + default: + if (typeof object.lifecycleState === "number") { + message.lifecycleState = object.lifecycleState; + break; + } + break; + case "LIFECYCLE_STATE_UNSPECIFIED": + case 0: + message.lifecycleState = 0; + break; + case "ACTIVE": + case 1: + message.lifecycleState = 1; + break; + case "DELETE_REQUESTED": + case 2: + message.lifecycleState = 2; + break; + case "UPDATING": + case 3: + message.lifecycleState = 3; + break; + case "CREATING": + case 4: + message.lifecycleState = 4; + break; + case "FAILED": + case 5: + message.lifecycleState = 5; + break; + } + if (object.bigqueryDataset != null) { + if (typeof object.bigqueryDataset !== "object") + throw TypeError(".google.logging.v2.Link.bigqueryDataset: object expected"); + message.bigqueryDataset = $root.google.logging.v2.BigQueryDataset.fromObject(object.bigqueryDataset); + } + return message; + }; + + /** + * Creates a plain object from a Link message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.Link + * @static + * @param {google.logging.v2.Link} message Link + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Link.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.description = ""; + object.createTime = null; + object.lifecycleState = options.enums === String ? "LIFECYCLE_STATE_UNSPECIFIED" : 0; + object.bigqueryDataset = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.lifecycleState != null && message.hasOwnProperty("lifecycleState")) + object.lifecycleState = options.enums === String ? $root.google.logging.v2.LifecycleState[message.lifecycleState] === undefined ? message.lifecycleState : $root.google.logging.v2.LifecycleState[message.lifecycleState] : message.lifecycleState; + if (message.bigqueryDataset != null && message.hasOwnProperty("bigqueryDataset")) + object.bigqueryDataset = $root.google.logging.v2.BigQueryDataset.toObject(message.bigqueryDataset, options); + return object; + }; + + /** + * Converts this Link to JSON. + * @function toJSON + * @memberof google.logging.v2.Link + * @instance + * @returns {Object.} JSON object + */ + Link.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Link + * @function getTypeUrl + * @memberof google.logging.v2.Link + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Link.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.Link"; + }; + + return Link; + })(); + + v2.BigQueryOptions = (function() { + + /** + * Properties of a BigQueryOptions. + * @memberof google.logging.v2 + * @interface IBigQueryOptions + * @property {boolean|null} [usePartitionedTables] BigQueryOptions usePartitionedTables + * @property {boolean|null} [usesTimestampColumnPartitioning] BigQueryOptions usesTimestampColumnPartitioning + */ + + /** + * Constructs a new BigQueryOptions. + * @memberof google.logging.v2 + * @classdesc Represents a BigQueryOptions. + * @implements IBigQueryOptions + * @constructor + * @param {google.logging.v2.IBigQueryOptions=} [properties] Properties to set + */ + function BigQueryOptions(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BigQueryOptions usePartitionedTables. + * @member {boolean} usePartitionedTables + * @memberof google.logging.v2.BigQueryOptions + * @instance + */ + BigQueryOptions.prototype.usePartitionedTables = false; + + /** + * BigQueryOptions usesTimestampColumnPartitioning. + * @member {boolean} usesTimestampColumnPartitioning + * @memberof google.logging.v2.BigQueryOptions + * @instance + */ + BigQueryOptions.prototype.usesTimestampColumnPartitioning = false; + + /** + * Creates a new BigQueryOptions instance using the specified properties. + * @function create + * @memberof google.logging.v2.BigQueryOptions + * @static + * @param {google.logging.v2.IBigQueryOptions=} [properties] Properties to set + * @returns {google.logging.v2.BigQueryOptions} BigQueryOptions instance + */ + BigQueryOptions.create = function create(properties) { + return new BigQueryOptions(properties); + }; + + /** + * Encodes the specified BigQueryOptions message. Does not implicitly {@link google.logging.v2.BigQueryOptions.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.BigQueryOptions + * @static + * @param {google.logging.v2.IBigQueryOptions} message BigQueryOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BigQueryOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.usePartitionedTables != null && Object.hasOwnProperty.call(message, "usePartitionedTables")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.usePartitionedTables); + if (message.usesTimestampColumnPartitioning != null && Object.hasOwnProperty.call(message, "usesTimestampColumnPartitioning")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.usesTimestampColumnPartitioning); + return writer; + }; + + /** + * Encodes the specified BigQueryOptions message, length delimited. Does not implicitly {@link google.logging.v2.BigQueryOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.BigQueryOptions + * @static + * @param {google.logging.v2.IBigQueryOptions} message BigQueryOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BigQueryOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BigQueryOptions message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.BigQueryOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.BigQueryOptions} BigQueryOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BigQueryOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.BigQueryOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.usePartitionedTables = reader.bool(); + break; + } + case 3: { + message.usesTimestampColumnPartitioning = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BigQueryOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.BigQueryOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.BigQueryOptions} BigQueryOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BigQueryOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BigQueryOptions message. + * @function verify + * @memberof google.logging.v2.BigQueryOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BigQueryOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.usePartitionedTables != null && message.hasOwnProperty("usePartitionedTables")) + if (typeof message.usePartitionedTables !== "boolean") + return "usePartitionedTables: boolean expected"; + if (message.usesTimestampColumnPartitioning != null && message.hasOwnProperty("usesTimestampColumnPartitioning")) + if (typeof message.usesTimestampColumnPartitioning !== "boolean") + return "usesTimestampColumnPartitioning: boolean expected"; + return null; + }; + + /** + * Creates a BigQueryOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.BigQueryOptions + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.BigQueryOptions} BigQueryOptions + */ + BigQueryOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.BigQueryOptions) + return object; + var message = new $root.google.logging.v2.BigQueryOptions(); + if (object.usePartitionedTables != null) + message.usePartitionedTables = Boolean(object.usePartitionedTables); + if (object.usesTimestampColumnPartitioning != null) + message.usesTimestampColumnPartitioning = Boolean(object.usesTimestampColumnPartitioning); + return message; + }; + + /** + * Creates a plain object from a BigQueryOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.BigQueryOptions + * @static + * @param {google.logging.v2.BigQueryOptions} message BigQueryOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BigQueryOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.usePartitionedTables = false; + object.usesTimestampColumnPartitioning = false; + } + if (message.usePartitionedTables != null && message.hasOwnProperty("usePartitionedTables")) + object.usePartitionedTables = message.usePartitionedTables; + if (message.usesTimestampColumnPartitioning != null && message.hasOwnProperty("usesTimestampColumnPartitioning")) + object.usesTimestampColumnPartitioning = message.usesTimestampColumnPartitioning; + return object; + }; + + /** + * Converts this BigQueryOptions to JSON. + * @function toJSON + * @memberof google.logging.v2.BigQueryOptions + * @instance + * @returns {Object.} JSON object + */ + BigQueryOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BigQueryOptions + * @function getTypeUrl + * @memberof google.logging.v2.BigQueryOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BigQueryOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.BigQueryOptions"; + }; + + return BigQueryOptions; + })(); + + v2.ListBucketsRequest = (function() { + + /** + * Properties of a ListBucketsRequest. + * @memberof google.logging.v2 + * @interface IListBucketsRequest + * @property {string|null} [parent] ListBucketsRequest parent + * @property {string|null} [pageToken] ListBucketsRequest pageToken + * @property {number|null} [pageSize] ListBucketsRequest pageSize + */ + + /** + * Constructs a new ListBucketsRequest. + * @memberof google.logging.v2 + * @classdesc Represents a ListBucketsRequest. + * @implements IListBucketsRequest + * @constructor + * @param {google.logging.v2.IListBucketsRequest=} [properties] Properties to set + */ + function ListBucketsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListBucketsRequest parent. + * @member {string} parent + * @memberof google.logging.v2.ListBucketsRequest + * @instance + */ + ListBucketsRequest.prototype.parent = ""; + + /** + * ListBucketsRequest pageToken. + * @member {string} pageToken + * @memberof google.logging.v2.ListBucketsRequest + * @instance + */ + ListBucketsRequest.prototype.pageToken = ""; + + /** + * ListBucketsRequest pageSize. + * @member {number} pageSize + * @memberof google.logging.v2.ListBucketsRequest + * @instance + */ + ListBucketsRequest.prototype.pageSize = 0; + + /** + * Creates a new ListBucketsRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.ListBucketsRequest + * @static + * @param {google.logging.v2.IListBucketsRequest=} [properties] Properties to set + * @returns {google.logging.v2.ListBucketsRequest} ListBucketsRequest instance + */ + ListBucketsRequest.create = function create(properties) { + return new ListBucketsRequest(properties); + }; + + /** + * Encodes the specified ListBucketsRequest message. Does not implicitly {@link google.logging.v2.ListBucketsRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.ListBucketsRequest + * @static + * @param {google.logging.v2.IListBucketsRequest} message ListBucketsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListBucketsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.pageToken); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + return writer; + }; + + /** + * Encodes the specified ListBucketsRequest message, length delimited. Does not implicitly {@link google.logging.v2.ListBucketsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.ListBucketsRequest + * @static + * @param {google.logging.v2.IListBucketsRequest} message ListBucketsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListBucketsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListBucketsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.ListBucketsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.ListBucketsRequest} ListBucketsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListBucketsRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.ListBucketsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageToken = reader.string(); + break; + } + case 3: { + message.pageSize = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListBucketsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.ListBucketsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.ListBucketsRequest} ListBucketsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListBucketsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListBucketsRequest message. + * @function verify + * @memberof google.logging.v2.ListBucketsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListBucketsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + return null; + }; + + /** + * Creates a ListBucketsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.ListBucketsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.ListBucketsRequest} ListBucketsRequest + */ + ListBucketsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.ListBucketsRequest) + return object; + var message = new $root.google.logging.v2.ListBucketsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + return message; + }; + + /** + * Creates a plain object from a ListBucketsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.ListBucketsRequest + * @static + * @param {google.logging.v2.ListBucketsRequest} message ListBucketsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListBucketsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageToken = ""; + object.pageSize = 0; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + return object; + }; + + /** + * Converts this ListBucketsRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.ListBucketsRequest + * @instance + * @returns {Object.} JSON object + */ + ListBucketsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListBucketsRequest + * @function getTypeUrl + * @memberof google.logging.v2.ListBucketsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListBucketsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.ListBucketsRequest"; + }; + + return ListBucketsRequest; + })(); + + v2.ListBucketsResponse = (function() { + + /** + * Properties of a ListBucketsResponse. + * @memberof google.logging.v2 + * @interface IListBucketsResponse + * @property {Array.|null} [buckets] ListBucketsResponse buckets + * @property {string|null} [nextPageToken] ListBucketsResponse nextPageToken + */ + + /** + * Constructs a new ListBucketsResponse. + * @memberof google.logging.v2 + * @classdesc Represents a ListBucketsResponse. + * @implements IListBucketsResponse + * @constructor + * @param {google.logging.v2.IListBucketsResponse=} [properties] Properties to set + */ + function ListBucketsResponse(properties) { + this.buckets = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListBucketsResponse buckets. + * @member {Array.} buckets + * @memberof google.logging.v2.ListBucketsResponse + * @instance + */ + ListBucketsResponse.prototype.buckets = $util.emptyArray; + + /** + * ListBucketsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.logging.v2.ListBucketsResponse + * @instance + */ + ListBucketsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListBucketsResponse instance using the specified properties. + * @function create + * @memberof google.logging.v2.ListBucketsResponse + * @static + * @param {google.logging.v2.IListBucketsResponse=} [properties] Properties to set + * @returns {google.logging.v2.ListBucketsResponse} ListBucketsResponse instance + */ + ListBucketsResponse.create = function create(properties) { + return new ListBucketsResponse(properties); + }; + + /** + * Encodes the specified ListBucketsResponse message. Does not implicitly {@link google.logging.v2.ListBucketsResponse.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.ListBucketsResponse + * @static + * @param {google.logging.v2.IListBucketsResponse} message ListBucketsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListBucketsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.buckets != null && message.buckets.length) + for (var i = 0; i < message.buckets.length; ++i) + $root.google.logging.v2.LogBucket.encode(message.buckets[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListBucketsResponse message, length delimited. Does not implicitly {@link google.logging.v2.ListBucketsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.ListBucketsResponse + * @static + * @param {google.logging.v2.IListBucketsResponse} message ListBucketsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListBucketsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListBucketsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.ListBucketsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.ListBucketsResponse} ListBucketsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListBucketsResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.ListBucketsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.buckets && message.buckets.length)) + message.buckets = []; + message.buckets.push($root.google.logging.v2.LogBucket.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListBucketsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.ListBucketsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.ListBucketsResponse} ListBucketsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListBucketsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListBucketsResponse message. + * @function verify + * @memberof google.logging.v2.ListBucketsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListBucketsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.buckets != null && message.hasOwnProperty("buckets")) { + if (!Array.isArray(message.buckets)) + return "buckets: array expected"; + for (var i = 0; i < message.buckets.length; ++i) { + var error = $root.google.logging.v2.LogBucket.verify(message.buckets[i]); + if (error) + return "buckets." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListBucketsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.ListBucketsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.ListBucketsResponse} ListBucketsResponse + */ + ListBucketsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.ListBucketsResponse) + return object; + var message = new $root.google.logging.v2.ListBucketsResponse(); + if (object.buckets) { + if (!Array.isArray(object.buckets)) + throw TypeError(".google.logging.v2.ListBucketsResponse.buckets: array expected"); + message.buckets = []; + for (var i = 0; i < object.buckets.length; ++i) { + if (typeof object.buckets[i] !== "object") + throw TypeError(".google.logging.v2.ListBucketsResponse.buckets: object expected"); + message.buckets[i] = $root.google.logging.v2.LogBucket.fromObject(object.buckets[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListBucketsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.ListBucketsResponse + * @static + * @param {google.logging.v2.ListBucketsResponse} message ListBucketsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListBucketsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.buckets = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.buckets && message.buckets.length) { + object.buckets = []; + for (var j = 0; j < message.buckets.length; ++j) + object.buckets[j] = $root.google.logging.v2.LogBucket.toObject(message.buckets[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListBucketsResponse to JSON. + * @function toJSON + * @memberof google.logging.v2.ListBucketsResponse + * @instance + * @returns {Object.} JSON object + */ + ListBucketsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListBucketsResponse + * @function getTypeUrl + * @memberof google.logging.v2.ListBucketsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListBucketsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.ListBucketsResponse"; + }; + + return ListBucketsResponse; + })(); + + v2.CreateBucketRequest = (function() { + + /** + * Properties of a CreateBucketRequest. + * @memberof google.logging.v2 + * @interface ICreateBucketRequest + * @property {string|null} [parent] CreateBucketRequest parent + * @property {string|null} [bucketId] CreateBucketRequest bucketId + * @property {google.logging.v2.ILogBucket|null} [bucket] CreateBucketRequest bucket + */ + + /** + * Constructs a new CreateBucketRequest. + * @memberof google.logging.v2 + * @classdesc Represents a CreateBucketRequest. + * @implements ICreateBucketRequest + * @constructor + * @param {google.logging.v2.ICreateBucketRequest=} [properties] Properties to set + */ + function CreateBucketRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateBucketRequest parent. + * @member {string} parent + * @memberof google.logging.v2.CreateBucketRequest + * @instance + */ + CreateBucketRequest.prototype.parent = ""; + + /** + * CreateBucketRequest bucketId. + * @member {string} bucketId + * @memberof google.logging.v2.CreateBucketRequest + * @instance + */ + CreateBucketRequest.prototype.bucketId = ""; + + /** + * CreateBucketRequest bucket. + * @member {google.logging.v2.ILogBucket|null|undefined} bucket + * @memberof google.logging.v2.CreateBucketRequest + * @instance + */ + CreateBucketRequest.prototype.bucket = null; + + /** + * Creates a new CreateBucketRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.CreateBucketRequest + * @static + * @param {google.logging.v2.ICreateBucketRequest=} [properties] Properties to set + * @returns {google.logging.v2.CreateBucketRequest} CreateBucketRequest instance + */ + CreateBucketRequest.create = function create(properties) { + return new CreateBucketRequest(properties); + }; + + /** + * Encodes the specified CreateBucketRequest message. Does not implicitly {@link google.logging.v2.CreateBucketRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.CreateBucketRequest + * @static + * @param {google.logging.v2.ICreateBucketRequest} message CreateBucketRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateBucketRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.bucketId != null && Object.hasOwnProperty.call(message, "bucketId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.bucketId); + if (message.bucket != null && Object.hasOwnProperty.call(message, "bucket")) + $root.google.logging.v2.LogBucket.encode(message.bucket, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateBucketRequest message, length delimited. Does not implicitly {@link google.logging.v2.CreateBucketRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.CreateBucketRequest + * @static + * @param {google.logging.v2.ICreateBucketRequest} message CreateBucketRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateBucketRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateBucketRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.CreateBucketRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.CreateBucketRequest} CreateBucketRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateBucketRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.CreateBucketRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.bucketId = reader.string(); + break; + } + case 3: { + message.bucket = $root.google.logging.v2.LogBucket.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateBucketRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.CreateBucketRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.CreateBucketRequest} CreateBucketRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateBucketRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateBucketRequest message. + * @function verify + * @memberof google.logging.v2.CreateBucketRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateBucketRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.bucketId != null && message.hasOwnProperty("bucketId")) + if (!$util.isString(message.bucketId)) + return "bucketId: string expected"; + if (message.bucket != null && message.hasOwnProperty("bucket")) { + var error = $root.google.logging.v2.LogBucket.verify(message.bucket); + if (error) + return "bucket." + error; + } + return null; + }; + + /** + * Creates a CreateBucketRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.CreateBucketRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.CreateBucketRequest} CreateBucketRequest + */ + CreateBucketRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.CreateBucketRequest) + return object; + var message = new $root.google.logging.v2.CreateBucketRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.bucketId != null) + message.bucketId = String(object.bucketId); + if (object.bucket != null) { + if (typeof object.bucket !== "object") + throw TypeError(".google.logging.v2.CreateBucketRequest.bucket: object expected"); + message.bucket = $root.google.logging.v2.LogBucket.fromObject(object.bucket); + } + return message; + }; + + /** + * Creates a plain object from a CreateBucketRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.CreateBucketRequest + * @static + * @param {google.logging.v2.CreateBucketRequest} message CreateBucketRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateBucketRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.bucketId = ""; + object.bucket = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.bucketId != null && message.hasOwnProperty("bucketId")) + object.bucketId = message.bucketId; + if (message.bucket != null && message.hasOwnProperty("bucket")) + object.bucket = $root.google.logging.v2.LogBucket.toObject(message.bucket, options); + return object; + }; + + /** + * Converts this CreateBucketRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.CreateBucketRequest + * @instance + * @returns {Object.} JSON object + */ + CreateBucketRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateBucketRequest + * @function getTypeUrl + * @memberof google.logging.v2.CreateBucketRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateBucketRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.CreateBucketRequest"; + }; + + return CreateBucketRequest; + })(); + + v2.UpdateBucketRequest = (function() { + + /** + * Properties of an UpdateBucketRequest. + * @memberof google.logging.v2 + * @interface IUpdateBucketRequest + * @property {string|null} [name] UpdateBucketRequest name + * @property {google.logging.v2.ILogBucket|null} [bucket] UpdateBucketRequest bucket + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateBucketRequest updateMask + */ + + /** + * Constructs a new UpdateBucketRequest. + * @memberof google.logging.v2 + * @classdesc Represents an UpdateBucketRequest. + * @implements IUpdateBucketRequest + * @constructor + * @param {google.logging.v2.IUpdateBucketRequest=} [properties] Properties to set + */ + function UpdateBucketRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateBucketRequest name. + * @member {string} name + * @memberof google.logging.v2.UpdateBucketRequest + * @instance + */ + UpdateBucketRequest.prototype.name = ""; + + /** + * UpdateBucketRequest bucket. + * @member {google.logging.v2.ILogBucket|null|undefined} bucket + * @memberof google.logging.v2.UpdateBucketRequest + * @instance + */ + UpdateBucketRequest.prototype.bucket = null; + + /** + * UpdateBucketRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.logging.v2.UpdateBucketRequest + * @instance + */ + UpdateBucketRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateBucketRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.UpdateBucketRequest + * @static + * @param {google.logging.v2.IUpdateBucketRequest=} [properties] Properties to set + * @returns {google.logging.v2.UpdateBucketRequest} UpdateBucketRequest instance + */ + UpdateBucketRequest.create = function create(properties) { + return new UpdateBucketRequest(properties); + }; + + /** + * Encodes the specified UpdateBucketRequest message. Does not implicitly {@link google.logging.v2.UpdateBucketRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.UpdateBucketRequest + * @static + * @param {google.logging.v2.IUpdateBucketRequest} message UpdateBucketRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateBucketRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.bucket != null && Object.hasOwnProperty.call(message, "bucket")) + $root.google.logging.v2.LogBucket.encode(message.bucket, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateBucketRequest message, length delimited. Does not implicitly {@link google.logging.v2.UpdateBucketRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.UpdateBucketRequest + * @static + * @param {google.logging.v2.IUpdateBucketRequest} message UpdateBucketRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateBucketRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateBucketRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.UpdateBucketRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.UpdateBucketRequest} UpdateBucketRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateBucketRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.UpdateBucketRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.bucket = $root.google.logging.v2.LogBucket.decode(reader, reader.uint32()); + break; + } + case 4: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateBucketRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.UpdateBucketRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.UpdateBucketRequest} UpdateBucketRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateBucketRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateBucketRequest message. + * @function verify + * @memberof google.logging.v2.UpdateBucketRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateBucketRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.bucket != null && message.hasOwnProperty("bucket")) { + var error = $root.google.logging.v2.LogBucket.verify(message.bucket); + if (error) + return "bucket." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateBucketRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.UpdateBucketRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.UpdateBucketRequest} UpdateBucketRequest + */ + UpdateBucketRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.UpdateBucketRequest) + return object; + var message = new $root.google.logging.v2.UpdateBucketRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.bucket != null) { + if (typeof object.bucket !== "object") + throw TypeError(".google.logging.v2.UpdateBucketRequest.bucket: object expected"); + message.bucket = $root.google.logging.v2.LogBucket.fromObject(object.bucket); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.logging.v2.UpdateBucketRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateBucketRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.UpdateBucketRequest + * @static + * @param {google.logging.v2.UpdateBucketRequest} message UpdateBucketRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateBucketRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.bucket = null; + object.updateMask = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.bucket != null && message.hasOwnProperty("bucket")) + object.bucket = $root.google.logging.v2.LogBucket.toObject(message.bucket, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateBucketRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.UpdateBucketRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateBucketRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateBucketRequest + * @function getTypeUrl + * @memberof google.logging.v2.UpdateBucketRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateBucketRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.UpdateBucketRequest"; + }; + + return UpdateBucketRequest; + })(); + + v2.GetBucketRequest = (function() { + + /** + * Properties of a GetBucketRequest. + * @memberof google.logging.v2 + * @interface IGetBucketRequest + * @property {string|null} [name] GetBucketRequest name + */ + + /** + * Constructs a new GetBucketRequest. + * @memberof google.logging.v2 + * @classdesc Represents a GetBucketRequest. + * @implements IGetBucketRequest + * @constructor + * @param {google.logging.v2.IGetBucketRequest=} [properties] Properties to set + */ + function GetBucketRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetBucketRequest name. + * @member {string} name + * @memberof google.logging.v2.GetBucketRequest + * @instance + */ + GetBucketRequest.prototype.name = ""; + + /** + * Creates a new GetBucketRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.GetBucketRequest + * @static + * @param {google.logging.v2.IGetBucketRequest=} [properties] Properties to set + * @returns {google.logging.v2.GetBucketRequest} GetBucketRequest instance + */ + GetBucketRequest.create = function create(properties) { + return new GetBucketRequest(properties); + }; + + /** + * Encodes the specified GetBucketRequest message. Does not implicitly {@link google.logging.v2.GetBucketRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.GetBucketRequest + * @static + * @param {google.logging.v2.IGetBucketRequest} message GetBucketRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetBucketRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetBucketRequest message, length delimited. Does not implicitly {@link google.logging.v2.GetBucketRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.GetBucketRequest + * @static + * @param {google.logging.v2.IGetBucketRequest} message GetBucketRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetBucketRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetBucketRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.GetBucketRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.GetBucketRequest} GetBucketRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetBucketRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.GetBucketRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetBucketRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.GetBucketRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.GetBucketRequest} GetBucketRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetBucketRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetBucketRequest message. + * @function verify + * @memberof google.logging.v2.GetBucketRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetBucketRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetBucketRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.GetBucketRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.GetBucketRequest} GetBucketRequest + */ + GetBucketRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.GetBucketRequest) + return object; + var message = new $root.google.logging.v2.GetBucketRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetBucketRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.GetBucketRequest + * @static + * @param {google.logging.v2.GetBucketRequest} message GetBucketRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetBucketRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetBucketRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.GetBucketRequest + * @instance + * @returns {Object.} JSON object + */ + GetBucketRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetBucketRequest + * @function getTypeUrl + * @memberof google.logging.v2.GetBucketRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetBucketRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.GetBucketRequest"; + }; + + return GetBucketRequest; + })(); + + v2.DeleteBucketRequest = (function() { + + /** + * Properties of a DeleteBucketRequest. + * @memberof google.logging.v2 + * @interface IDeleteBucketRequest + * @property {string|null} [name] DeleteBucketRequest name + */ + + /** + * Constructs a new DeleteBucketRequest. + * @memberof google.logging.v2 + * @classdesc Represents a DeleteBucketRequest. + * @implements IDeleteBucketRequest + * @constructor + * @param {google.logging.v2.IDeleteBucketRequest=} [properties] Properties to set + */ + function DeleteBucketRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteBucketRequest name. + * @member {string} name + * @memberof google.logging.v2.DeleteBucketRequest + * @instance + */ + DeleteBucketRequest.prototype.name = ""; + + /** + * Creates a new DeleteBucketRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.DeleteBucketRequest + * @static + * @param {google.logging.v2.IDeleteBucketRequest=} [properties] Properties to set + * @returns {google.logging.v2.DeleteBucketRequest} DeleteBucketRequest instance + */ + DeleteBucketRequest.create = function create(properties) { + return new DeleteBucketRequest(properties); + }; + + /** + * Encodes the specified DeleteBucketRequest message. Does not implicitly {@link google.logging.v2.DeleteBucketRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.DeleteBucketRequest + * @static + * @param {google.logging.v2.IDeleteBucketRequest} message DeleteBucketRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteBucketRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteBucketRequest message, length delimited. Does not implicitly {@link google.logging.v2.DeleteBucketRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.DeleteBucketRequest + * @static + * @param {google.logging.v2.IDeleteBucketRequest} message DeleteBucketRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteBucketRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteBucketRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.DeleteBucketRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.DeleteBucketRequest} DeleteBucketRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteBucketRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.DeleteBucketRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteBucketRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.DeleteBucketRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.DeleteBucketRequest} DeleteBucketRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteBucketRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteBucketRequest message. + * @function verify + * @memberof google.logging.v2.DeleteBucketRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteBucketRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a DeleteBucketRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.DeleteBucketRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.DeleteBucketRequest} DeleteBucketRequest + */ + DeleteBucketRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.DeleteBucketRequest) + return object; + var message = new $root.google.logging.v2.DeleteBucketRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteBucketRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.DeleteBucketRequest + * @static + * @param {google.logging.v2.DeleteBucketRequest} message DeleteBucketRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteBucketRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteBucketRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.DeleteBucketRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteBucketRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteBucketRequest + * @function getTypeUrl + * @memberof google.logging.v2.DeleteBucketRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteBucketRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.DeleteBucketRequest"; + }; + + return DeleteBucketRequest; + })(); + + v2.UndeleteBucketRequest = (function() { + + /** + * Properties of an UndeleteBucketRequest. + * @memberof google.logging.v2 + * @interface IUndeleteBucketRequest + * @property {string|null} [name] UndeleteBucketRequest name + */ + + /** + * Constructs a new UndeleteBucketRequest. + * @memberof google.logging.v2 + * @classdesc Represents an UndeleteBucketRequest. + * @implements IUndeleteBucketRequest + * @constructor + * @param {google.logging.v2.IUndeleteBucketRequest=} [properties] Properties to set + */ + function UndeleteBucketRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UndeleteBucketRequest name. + * @member {string} name + * @memberof google.logging.v2.UndeleteBucketRequest + * @instance + */ + UndeleteBucketRequest.prototype.name = ""; + + /** + * Creates a new UndeleteBucketRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.UndeleteBucketRequest + * @static + * @param {google.logging.v2.IUndeleteBucketRequest=} [properties] Properties to set + * @returns {google.logging.v2.UndeleteBucketRequest} UndeleteBucketRequest instance + */ + UndeleteBucketRequest.create = function create(properties) { + return new UndeleteBucketRequest(properties); + }; + + /** + * Encodes the specified UndeleteBucketRequest message. Does not implicitly {@link google.logging.v2.UndeleteBucketRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.UndeleteBucketRequest + * @static + * @param {google.logging.v2.IUndeleteBucketRequest} message UndeleteBucketRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UndeleteBucketRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified UndeleteBucketRequest message, length delimited. Does not implicitly {@link google.logging.v2.UndeleteBucketRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.UndeleteBucketRequest + * @static + * @param {google.logging.v2.IUndeleteBucketRequest} message UndeleteBucketRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UndeleteBucketRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UndeleteBucketRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.UndeleteBucketRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.UndeleteBucketRequest} UndeleteBucketRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UndeleteBucketRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.UndeleteBucketRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UndeleteBucketRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.UndeleteBucketRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.UndeleteBucketRequest} UndeleteBucketRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UndeleteBucketRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UndeleteBucketRequest message. + * @function verify + * @memberof google.logging.v2.UndeleteBucketRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UndeleteBucketRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates an UndeleteBucketRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.UndeleteBucketRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.UndeleteBucketRequest} UndeleteBucketRequest + */ + UndeleteBucketRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.UndeleteBucketRequest) + return object; + var message = new $root.google.logging.v2.UndeleteBucketRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from an UndeleteBucketRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.UndeleteBucketRequest + * @static + * @param {google.logging.v2.UndeleteBucketRequest} message UndeleteBucketRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UndeleteBucketRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this UndeleteBucketRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.UndeleteBucketRequest + * @instance + * @returns {Object.} JSON object + */ + UndeleteBucketRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UndeleteBucketRequest + * @function getTypeUrl + * @memberof google.logging.v2.UndeleteBucketRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UndeleteBucketRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.UndeleteBucketRequest"; + }; + + return UndeleteBucketRequest; + })(); + + v2.ListViewsRequest = (function() { + + /** + * Properties of a ListViewsRequest. + * @memberof google.logging.v2 + * @interface IListViewsRequest + * @property {string|null} [parent] ListViewsRequest parent + * @property {string|null} [pageToken] ListViewsRequest pageToken + * @property {number|null} [pageSize] ListViewsRequest pageSize + */ + + /** + * Constructs a new ListViewsRequest. + * @memberof google.logging.v2 + * @classdesc Represents a ListViewsRequest. + * @implements IListViewsRequest + * @constructor + * @param {google.logging.v2.IListViewsRequest=} [properties] Properties to set + */ + function ListViewsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListViewsRequest parent. + * @member {string} parent + * @memberof google.logging.v2.ListViewsRequest + * @instance + */ + ListViewsRequest.prototype.parent = ""; + + /** + * ListViewsRequest pageToken. + * @member {string} pageToken + * @memberof google.logging.v2.ListViewsRequest + * @instance + */ + ListViewsRequest.prototype.pageToken = ""; + + /** + * ListViewsRequest pageSize. + * @member {number} pageSize + * @memberof google.logging.v2.ListViewsRequest + * @instance + */ + ListViewsRequest.prototype.pageSize = 0; + + /** + * Creates a new ListViewsRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.ListViewsRequest + * @static + * @param {google.logging.v2.IListViewsRequest=} [properties] Properties to set + * @returns {google.logging.v2.ListViewsRequest} ListViewsRequest instance + */ + ListViewsRequest.create = function create(properties) { + return new ListViewsRequest(properties); + }; + + /** + * Encodes the specified ListViewsRequest message. Does not implicitly {@link google.logging.v2.ListViewsRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.ListViewsRequest + * @static + * @param {google.logging.v2.IListViewsRequest} message ListViewsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListViewsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.pageToken); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + return writer; + }; + + /** + * Encodes the specified ListViewsRequest message, length delimited. Does not implicitly {@link google.logging.v2.ListViewsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.ListViewsRequest + * @static + * @param {google.logging.v2.IListViewsRequest} message ListViewsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListViewsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListViewsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.ListViewsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.ListViewsRequest} ListViewsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListViewsRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.ListViewsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageToken = reader.string(); + break; + } + case 3: { + message.pageSize = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListViewsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.ListViewsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.ListViewsRequest} ListViewsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListViewsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListViewsRequest message. + * @function verify + * @memberof google.logging.v2.ListViewsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListViewsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + return null; + }; + + /** + * Creates a ListViewsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.ListViewsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.ListViewsRequest} ListViewsRequest + */ + ListViewsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.ListViewsRequest) + return object; + var message = new $root.google.logging.v2.ListViewsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + return message; + }; + + /** + * Creates a plain object from a ListViewsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.ListViewsRequest + * @static + * @param {google.logging.v2.ListViewsRequest} message ListViewsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListViewsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageToken = ""; + object.pageSize = 0; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + return object; + }; + + /** + * Converts this ListViewsRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.ListViewsRequest + * @instance + * @returns {Object.} JSON object + */ + ListViewsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListViewsRequest + * @function getTypeUrl + * @memberof google.logging.v2.ListViewsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListViewsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.ListViewsRequest"; + }; + + return ListViewsRequest; + })(); + + v2.ListViewsResponse = (function() { + + /** + * Properties of a ListViewsResponse. + * @memberof google.logging.v2 + * @interface IListViewsResponse + * @property {Array.|null} [views] ListViewsResponse views + * @property {string|null} [nextPageToken] ListViewsResponse nextPageToken + */ + + /** + * Constructs a new ListViewsResponse. + * @memberof google.logging.v2 + * @classdesc Represents a ListViewsResponse. + * @implements IListViewsResponse + * @constructor + * @param {google.logging.v2.IListViewsResponse=} [properties] Properties to set + */ + function ListViewsResponse(properties) { + this.views = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListViewsResponse views. + * @member {Array.} views + * @memberof google.logging.v2.ListViewsResponse + * @instance + */ + ListViewsResponse.prototype.views = $util.emptyArray; + + /** + * ListViewsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.logging.v2.ListViewsResponse + * @instance + */ + ListViewsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListViewsResponse instance using the specified properties. + * @function create + * @memberof google.logging.v2.ListViewsResponse + * @static + * @param {google.logging.v2.IListViewsResponse=} [properties] Properties to set + * @returns {google.logging.v2.ListViewsResponse} ListViewsResponse instance + */ + ListViewsResponse.create = function create(properties) { + return new ListViewsResponse(properties); + }; + + /** + * Encodes the specified ListViewsResponse message. Does not implicitly {@link google.logging.v2.ListViewsResponse.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.ListViewsResponse + * @static + * @param {google.logging.v2.IListViewsResponse} message ListViewsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListViewsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.views != null && message.views.length) + for (var i = 0; i < message.views.length; ++i) + $root.google.logging.v2.LogView.encode(message.views[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListViewsResponse message, length delimited. Does not implicitly {@link google.logging.v2.ListViewsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.ListViewsResponse + * @static + * @param {google.logging.v2.IListViewsResponse} message ListViewsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListViewsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListViewsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.ListViewsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.ListViewsResponse} ListViewsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListViewsResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.ListViewsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.views && message.views.length)) + message.views = []; + message.views.push($root.google.logging.v2.LogView.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListViewsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.ListViewsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.ListViewsResponse} ListViewsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListViewsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListViewsResponse message. + * @function verify + * @memberof google.logging.v2.ListViewsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListViewsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.views != null && message.hasOwnProperty("views")) { + if (!Array.isArray(message.views)) + return "views: array expected"; + for (var i = 0; i < message.views.length; ++i) { + var error = $root.google.logging.v2.LogView.verify(message.views[i]); + if (error) + return "views." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListViewsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.ListViewsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.ListViewsResponse} ListViewsResponse + */ + ListViewsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.ListViewsResponse) + return object; + var message = new $root.google.logging.v2.ListViewsResponse(); + if (object.views) { + if (!Array.isArray(object.views)) + throw TypeError(".google.logging.v2.ListViewsResponse.views: array expected"); + message.views = []; + for (var i = 0; i < object.views.length; ++i) { + if (typeof object.views[i] !== "object") + throw TypeError(".google.logging.v2.ListViewsResponse.views: object expected"); + message.views[i] = $root.google.logging.v2.LogView.fromObject(object.views[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListViewsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.ListViewsResponse + * @static + * @param {google.logging.v2.ListViewsResponse} message ListViewsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListViewsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.views = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.views && message.views.length) { + object.views = []; + for (var j = 0; j < message.views.length; ++j) + object.views[j] = $root.google.logging.v2.LogView.toObject(message.views[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListViewsResponse to JSON. + * @function toJSON + * @memberof google.logging.v2.ListViewsResponse + * @instance + * @returns {Object.} JSON object + */ + ListViewsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListViewsResponse + * @function getTypeUrl + * @memberof google.logging.v2.ListViewsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListViewsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.ListViewsResponse"; + }; + + return ListViewsResponse; + })(); + + v2.CreateViewRequest = (function() { + + /** + * Properties of a CreateViewRequest. + * @memberof google.logging.v2 + * @interface ICreateViewRequest + * @property {string|null} [parent] CreateViewRequest parent + * @property {string|null} [viewId] CreateViewRequest viewId + * @property {google.logging.v2.ILogView|null} [view] CreateViewRequest view + */ + + /** + * Constructs a new CreateViewRequest. + * @memberof google.logging.v2 + * @classdesc Represents a CreateViewRequest. + * @implements ICreateViewRequest + * @constructor + * @param {google.logging.v2.ICreateViewRequest=} [properties] Properties to set + */ + function CreateViewRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateViewRequest parent. + * @member {string} parent + * @memberof google.logging.v2.CreateViewRequest + * @instance + */ + CreateViewRequest.prototype.parent = ""; + + /** + * CreateViewRequest viewId. + * @member {string} viewId + * @memberof google.logging.v2.CreateViewRequest + * @instance + */ + CreateViewRequest.prototype.viewId = ""; + + /** + * CreateViewRequest view. + * @member {google.logging.v2.ILogView|null|undefined} view + * @memberof google.logging.v2.CreateViewRequest + * @instance + */ + CreateViewRequest.prototype.view = null; + + /** + * Creates a new CreateViewRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.CreateViewRequest + * @static + * @param {google.logging.v2.ICreateViewRequest=} [properties] Properties to set + * @returns {google.logging.v2.CreateViewRequest} CreateViewRequest instance + */ + CreateViewRequest.create = function create(properties) { + return new CreateViewRequest(properties); + }; + + /** + * Encodes the specified CreateViewRequest message. Does not implicitly {@link google.logging.v2.CreateViewRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.CreateViewRequest + * @static + * @param {google.logging.v2.ICreateViewRequest} message CreateViewRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateViewRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.viewId != null && Object.hasOwnProperty.call(message, "viewId")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.viewId); + if (message.view != null && Object.hasOwnProperty.call(message, "view")) + $root.google.logging.v2.LogView.encode(message.view, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateViewRequest message, length delimited. Does not implicitly {@link google.logging.v2.CreateViewRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.CreateViewRequest + * @static + * @param {google.logging.v2.ICreateViewRequest} message CreateViewRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateViewRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateViewRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.CreateViewRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.CreateViewRequest} CreateViewRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateViewRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.CreateViewRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.viewId = reader.string(); + break; + } + case 3: { + message.view = $root.google.logging.v2.LogView.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateViewRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.CreateViewRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.CreateViewRequest} CreateViewRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateViewRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateViewRequest message. + * @function verify + * @memberof google.logging.v2.CreateViewRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateViewRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.viewId != null && message.hasOwnProperty("viewId")) + if (!$util.isString(message.viewId)) + return "viewId: string expected"; + if (message.view != null && message.hasOwnProperty("view")) { + var error = $root.google.logging.v2.LogView.verify(message.view); + if (error) + return "view." + error; + } + return null; + }; + + /** + * Creates a CreateViewRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.CreateViewRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.CreateViewRequest} CreateViewRequest + */ + CreateViewRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.CreateViewRequest) + return object; + var message = new $root.google.logging.v2.CreateViewRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.viewId != null) + message.viewId = String(object.viewId); + if (object.view != null) { + if (typeof object.view !== "object") + throw TypeError(".google.logging.v2.CreateViewRequest.view: object expected"); + message.view = $root.google.logging.v2.LogView.fromObject(object.view); + } + return message; + }; + + /** + * Creates a plain object from a CreateViewRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.CreateViewRequest + * @static + * @param {google.logging.v2.CreateViewRequest} message CreateViewRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateViewRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.viewId = ""; + object.view = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.viewId != null && message.hasOwnProperty("viewId")) + object.viewId = message.viewId; + if (message.view != null && message.hasOwnProperty("view")) + object.view = $root.google.logging.v2.LogView.toObject(message.view, options); + return object; + }; + + /** + * Converts this CreateViewRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.CreateViewRequest + * @instance + * @returns {Object.} JSON object + */ + CreateViewRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateViewRequest + * @function getTypeUrl + * @memberof google.logging.v2.CreateViewRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateViewRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.CreateViewRequest"; + }; + + return CreateViewRequest; + })(); + + v2.UpdateViewRequest = (function() { + + /** + * Properties of an UpdateViewRequest. + * @memberof google.logging.v2 + * @interface IUpdateViewRequest + * @property {string|null} [name] UpdateViewRequest name + * @property {google.logging.v2.ILogView|null} [view] UpdateViewRequest view + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateViewRequest updateMask + */ + + /** + * Constructs a new UpdateViewRequest. + * @memberof google.logging.v2 + * @classdesc Represents an UpdateViewRequest. + * @implements IUpdateViewRequest + * @constructor + * @param {google.logging.v2.IUpdateViewRequest=} [properties] Properties to set + */ + function UpdateViewRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateViewRequest name. + * @member {string} name + * @memberof google.logging.v2.UpdateViewRequest + * @instance + */ + UpdateViewRequest.prototype.name = ""; + + /** + * UpdateViewRequest view. + * @member {google.logging.v2.ILogView|null|undefined} view + * @memberof google.logging.v2.UpdateViewRequest + * @instance + */ + UpdateViewRequest.prototype.view = null; + + /** + * UpdateViewRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.logging.v2.UpdateViewRequest + * @instance + */ + UpdateViewRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateViewRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.UpdateViewRequest + * @static + * @param {google.logging.v2.IUpdateViewRequest=} [properties] Properties to set + * @returns {google.logging.v2.UpdateViewRequest} UpdateViewRequest instance + */ + UpdateViewRequest.create = function create(properties) { + return new UpdateViewRequest(properties); + }; + + /** + * Encodes the specified UpdateViewRequest message. Does not implicitly {@link google.logging.v2.UpdateViewRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.UpdateViewRequest + * @static + * @param {google.logging.v2.IUpdateViewRequest} message UpdateViewRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateViewRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.view != null && Object.hasOwnProperty.call(message, "view")) + $root.google.logging.v2.LogView.encode(message.view, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateViewRequest message, length delimited. Does not implicitly {@link google.logging.v2.UpdateViewRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.UpdateViewRequest + * @static + * @param {google.logging.v2.IUpdateViewRequest} message UpdateViewRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateViewRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateViewRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.UpdateViewRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.UpdateViewRequest} UpdateViewRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateViewRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.UpdateViewRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.view = $root.google.logging.v2.LogView.decode(reader, reader.uint32()); + break; + } + case 4: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateViewRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.UpdateViewRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.UpdateViewRequest} UpdateViewRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateViewRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateViewRequest message. + * @function verify + * @memberof google.logging.v2.UpdateViewRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateViewRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.view != null && message.hasOwnProperty("view")) { + var error = $root.google.logging.v2.LogView.verify(message.view); + if (error) + return "view." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateViewRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.UpdateViewRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.UpdateViewRequest} UpdateViewRequest + */ + UpdateViewRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.UpdateViewRequest) + return object; + var message = new $root.google.logging.v2.UpdateViewRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.view != null) { + if (typeof object.view !== "object") + throw TypeError(".google.logging.v2.UpdateViewRequest.view: object expected"); + message.view = $root.google.logging.v2.LogView.fromObject(object.view); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.logging.v2.UpdateViewRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateViewRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.UpdateViewRequest + * @static + * @param {google.logging.v2.UpdateViewRequest} message UpdateViewRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateViewRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.view = null; + object.updateMask = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.view != null && message.hasOwnProperty("view")) + object.view = $root.google.logging.v2.LogView.toObject(message.view, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateViewRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.UpdateViewRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateViewRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateViewRequest + * @function getTypeUrl + * @memberof google.logging.v2.UpdateViewRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateViewRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.UpdateViewRequest"; + }; + + return UpdateViewRequest; + })(); + + v2.GetViewRequest = (function() { + + /** + * Properties of a GetViewRequest. + * @memberof google.logging.v2 + * @interface IGetViewRequest + * @property {string|null} [name] GetViewRequest name + */ + + /** + * Constructs a new GetViewRequest. + * @memberof google.logging.v2 + * @classdesc Represents a GetViewRequest. + * @implements IGetViewRequest + * @constructor + * @param {google.logging.v2.IGetViewRequest=} [properties] Properties to set + */ + function GetViewRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetViewRequest name. + * @member {string} name + * @memberof google.logging.v2.GetViewRequest + * @instance + */ + GetViewRequest.prototype.name = ""; + + /** + * Creates a new GetViewRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.GetViewRequest + * @static + * @param {google.logging.v2.IGetViewRequest=} [properties] Properties to set + * @returns {google.logging.v2.GetViewRequest} GetViewRequest instance + */ + GetViewRequest.create = function create(properties) { + return new GetViewRequest(properties); + }; + + /** + * Encodes the specified GetViewRequest message. Does not implicitly {@link google.logging.v2.GetViewRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.GetViewRequest + * @static + * @param {google.logging.v2.IGetViewRequest} message GetViewRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetViewRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetViewRequest message, length delimited. Does not implicitly {@link google.logging.v2.GetViewRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.GetViewRequest + * @static + * @param {google.logging.v2.IGetViewRequest} message GetViewRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetViewRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetViewRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.GetViewRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.GetViewRequest} GetViewRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetViewRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.GetViewRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetViewRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.GetViewRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.GetViewRequest} GetViewRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetViewRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetViewRequest message. + * @function verify + * @memberof google.logging.v2.GetViewRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetViewRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetViewRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.GetViewRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.GetViewRequest} GetViewRequest + */ + GetViewRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.GetViewRequest) + return object; + var message = new $root.google.logging.v2.GetViewRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetViewRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.GetViewRequest + * @static + * @param {google.logging.v2.GetViewRequest} message GetViewRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetViewRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetViewRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.GetViewRequest + * @instance + * @returns {Object.} JSON object + */ + GetViewRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetViewRequest + * @function getTypeUrl + * @memberof google.logging.v2.GetViewRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetViewRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.GetViewRequest"; + }; + + return GetViewRequest; + })(); + + v2.DeleteViewRequest = (function() { + + /** + * Properties of a DeleteViewRequest. + * @memberof google.logging.v2 + * @interface IDeleteViewRequest + * @property {string|null} [name] DeleteViewRequest name + */ + + /** + * Constructs a new DeleteViewRequest. + * @memberof google.logging.v2 + * @classdesc Represents a DeleteViewRequest. + * @implements IDeleteViewRequest + * @constructor + * @param {google.logging.v2.IDeleteViewRequest=} [properties] Properties to set + */ + function DeleteViewRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteViewRequest name. + * @member {string} name + * @memberof google.logging.v2.DeleteViewRequest + * @instance + */ + DeleteViewRequest.prototype.name = ""; + + /** + * Creates a new DeleteViewRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.DeleteViewRequest + * @static + * @param {google.logging.v2.IDeleteViewRequest=} [properties] Properties to set + * @returns {google.logging.v2.DeleteViewRequest} DeleteViewRequest instance + */ + DeleteViewRequest.create = function create(properties) { + return new DeleteViewRequest(properties); + }; + + /** + * Encodes the specified DeleteViewRequest message. Does not implicitly {@link google.logging.v2.DeleteViewRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.DeleteViewRequest + * @static + * @param {google.logging.v2.IDeleteViewRequest} message DeleteViewRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteViewRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteViewRequest message, length delimited. Does not implicitly {@link google.logging.v2.DeleteViewRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.DeleteViewRequest + * @static + * @param {google.logging.v2.IDeleteViewRequest} message DeleteViewRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteViewRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteViewRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.DeleteViewRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.DeleteViewRequest} DeleteViewRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteViewRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.DeleteViewRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteViewRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.DeleteViewRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.DeleteViewRequest} DeleteViewRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteViewRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteViewRequest message. + * @function verify + * @memberof google.logging.v2.DeleteViewRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteViewRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a DeleteViewRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.DeleteViewRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.DeleteViewRequest} DeleteViewRequest + */ + DeleteViewRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.DeleteViewRequest) + return object; + var message = new $root.google.logging.v2.DeleteViewRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteViewRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.DeleteViewRequest + * @static + * @param {google.logging.v2.DeleteViewRequest} message DeleteViewRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteViewRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteViewRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.DeleteViewRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteViewRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteViewRequest + * @function getTypeUrl + * @memberof google.logging.v2.DeleteViewRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteViewRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.DeleteViewRequest"; + }; + + return DeleteViewRequest; + })(); + + v2.ListSinksRequest = (function() { + + /** + * Properties of a ListSinksRequest. + * @memberof google.logging.v2 + * @interface IListSinksRequest + * @property {string|null} [parent] ListSinksRequest parent + * @property {string|null} [pageToken] ListSinksRequest pageToken + * @property {number|null} [pageSize] ListSinksRequest pageSize + */ + + /** + * Constructs a new ListSinksRequest. + * @memberof google.logging.v2 + * @classdesc Represents a ListSinksRequest. + * @implements IListSinksRequest + * @constructor + * @param {google.logging.v2.IListSinksRequest=} [properties] Properties to set + */ + function ListSinksRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListSinksRequest parent. + * @member {string} parent + * @memberof google.logging.v2.ListSinksRequest + * @instance + */ + ListSinksRequest.prototype.parent = ""; + + /** + * ListSinksRequest pageToken. + * @member {string} pageToken + * @memberof google.logging.v2.ListSinksRequest + * @instance + */ + ListSinksRequest.prototype.pageToken = ""; + + /** + * ListSinksRequest pageSize. + * @member {number} pageSize + * @memberof google.logging.v2.ListSinksRequest + * @instance + */ + ListSinksRequest.prototype.pageSize = 0; + + /** + * Creates a new ListSinksRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.ListSinksRequest + * @static + * @param {google.logging.v2.IListSinksRequest=} [properties] Properties to set + * @returns {google.logging.v2.ListSinksRequest} ListSinksRequest instance + */ + ListSinksRequest.create = function create(properties) { + return new ListSinksRequest(properties); + }; + + /** + * Encodes the specified ListSinksRequest message. Does not implicitly {@link google.logging.v2.ListSinksRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.ListSinksRequest + * @static + * @param {google.logging.v2.IListSinksRequest} message ListSinksRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSinksRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.pageToken); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + return writer; + }; + + /** + * Encodes the specified ListSinksRequest message, length delimited. Does not implicitly {@link google.logging.v2.ListSinksRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.ListSinksRequest + * @static + * @param {google.logging.v2.IListSinksRequest} message ListSinksRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSinksRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListSinksRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.ListSinksRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.ListSinksRequest} ListSinksRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSinksRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.ListSinksRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageToken = reader.string(); + break; + } + case 3: { + message.pageSize = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListSinksRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.ListSinksRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.ListSinksRequest} ListSinksRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSinksRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListSinksRequest message. + * @function verify + * @memberof google.logging.v2.ListSinksRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListSinksRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + return null; + }; + + /** + * Creates a ListSinksRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.ListSinksRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.ListSinksRequest} ListSinksRequest + */ + ListSinksRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.ListSinksRequest) + return object; + var message = new $root.google.logging.v2.ListSinksRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + return message; + }; + + /** + * Creates a plain object from a ListSinksRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.ListSinksRequest + * @static + * @param {google.logging.v2.ListSinksRequest} message ListSinksRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListSinksRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageToken = ""; + object.pageSize = 0; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + return object; + }; + + /** + * Converts this ListSinksRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.ListSinksRequest + * @instance + * @returns {Object.} JSON object + */ + ListSinksRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListSinksRequest + * @function getTypeUrl + * @memberof google.logging.v2.ListSinksRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListSinksRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.ListSinksRequest"; + }; + + return ListSinksRequest; + })(); + + v2.ListSinksResponse = (function() { + + /** + * Properties of a ListSinksResponse. + * @memberof google.logging.v2 + * @interface IListSinksResponse + * @property {Array.|null} [sinks] ListSinksResponse sinks + * @property {string|null} [nextPageToken] ListSinksResponse nextPageToken + */ + + /** + * Constructs a new ListSinksResponse. + * @memberof google.logging.v2 + * @classdesc Represents a ListSinksResponse. + * @implements IListSinksResponse + * @constructor + * @param {google.logging.v2.IListSinksResponse=} [properties] Properties to set + */ + function ListSinksResponse(properties) { + this.sinks = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListSinksResponse sinks. + * @member {Array.} sinks + * @memberof google.logging.v2.ListSinksResponse + * @instance + */ + ListSinksResponse.prototype.sinks = $util.emptyArray; + + /** + * ListSinksResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.logging.v2.ListSinksResponse + * @instance + */ + ListSinksResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListSinksResponse instance using the specified properties. + * @function create + * @memberof google.logging.v2.ListSinksResponse + * @static + * @param {google.logging.v2.IListSinksResponse=} [properties] Properties to set + * @returns {google.logging.v2.ListSinksResponse} ListSinksResponse instance + */ + ListSinksResponse.create = function create(properties) { + return new ListSinksResponse(properties); + }; + + /** + * Encodes the specified ListSinksResponse message. Does not implicitly {@link google.logging.v2.ListSinksResponse.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.ListSinksResponse + * @static + * @param {google.logging.v2.IListSinksResponse} message ListSinksResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSinksResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sinks != null && message.sinks.length) + for (var i = 0; i < message.sinks.length; ++i) + $root.google.logging.v2.LogSink.encode(message.sinks[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListSinksResponse message, length delimited. Does not implicitly {@link google.logging.v2.ListSinksResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.ListSinksResponse + * @static + * @param {google.logging.v2.IListSinksResponse} message ListSinksResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListSinksResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListSinksResponse message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.ListSinksResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.ListSinksResponse} ListSinksResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSinksResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.ListSinksResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.sinks && message.sinks.length)) + message.sinks = []; + message.sinks.push($root.google.logging.v2.LogSink.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListSinksResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.ListSinksResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.ListSinksResponse} ListSinksResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListSinksResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListSinksResponse message. + * @function verify + * @memberof google.logging.v2.ListSinksResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListSinksResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.sinks != null && message.hasOwnProperty("sinks")) { + if (!Array.isArray(message.sinks)) + return "sinks: array expected"; + for (var i = 0; i < message.sinks.length; ++i) { + var error = $root.google.logging.v2.LogSink.verify(message.sinks[i]); + if (error) + return "sinks." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListSinksResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.ListSinksResponse + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.ListSinksResponse} ListSinksResponse + */ + ListSinksResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.ListSinksResponse) + return object; + var message = new $root.google.logging.v2.ListSinksResponse(); + if (object.sinks) { + if (!Array.isArray(object.sinks)) + throw TypeError(".google.logging.v2.ListSinksResponse.sinks: array expected"); + message.sinks = []; + for (var i = 0; i < object.sinks.length; ++i) { + if (typeof object.sinks[i] !== "object") + throw TypeError(".google.logging.v2.ListSinksResponse.sinks: object expected"); + message.sinks[i] = $root.google.logging.v2.LogSink.fromObject(object.sinks[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListSinksResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.ListSinksResponse + * @static + * @param {google.logging.v2.ListSinksResponse} message ListSinksResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListSinksResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.sinks = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.sinks && message.sinks.length) { + object.sinks = []; + for (var j = 0; j < message.sinks.length; ++j) + object.sinks[j] = $root.google.logging.v2.LogSink.toObject(message.sinks[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListSinksResponse to JSON. + * @function toJSON + * @memberof google.logging.v2.ListSinksResponse + * @instance + * @returns {Object.} JSON object + */ + ListSinksResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListSinksResponse + * @function getTypeUrl + * @memberof google.logging.v2.ListSinksResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListSinksResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.ListSinksResponse"; + }; + + return ListSinksResponse; + })(); + + v2.GetSinkRequest = (function() { + + /** + * Properties of a GetSinkRequest. + * @memberof google.logging.v2 + * @interface IGetSinkRequest + * @property {string|null} [sinkName] GetSinkRequest sinkName + */ + + /** + * Constructs a new GetSinkRequest. + * @memberof google.logging.v2 + * @classdesc Represents a GetSinkRequest. + * @implements IGetSinkRequest + * @constructor + * @param {google.logging.v2.IGetSinkRequest=} [properties] Properties to set + */ + function GetSinkRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetSinkRequest sinkName. + * @member {string} sinkName + * @memberof google.logging.v2.GetSinkRequest + * @instance + */ + GetSinkRequest.prototype.sinkName = ""; + + /** + * Creates a new GetSinkRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.GetSinkRequest + * @static + * @param {google.logging.v2.IGetSinkRequest=} [properties] Properties to set + * @returns {google.logging.v2.GetSinkRequest} GetSinkRequest instance + */ + GetSinkRequest.create = function create(properties) { + return new GetSinkRequest(properties); + }; + + /** + * Encodes the specified GetSinkRequest message. Does not implicitly {@link google.logging.v2.GetSinkRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.GetSinkRequest + * @static + * @param {google.logging.v2.IGetSinkRequest} message GetSinkRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetSinkRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sinkName != null && Object.hasOwnProperty.call(message, "sinkName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.sinkName); + return writer; + }; + + /** + * Encodes the specified GetSinkRequest message, length delimited. Does not implicitly {@link google.logging.v2.GetSinkRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.GetSinkRequest + * @static + * @param {google.logging.v2.IGetSinkRequest} message GetSinkRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetSinkRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetSinkRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.GetSinkRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.GetSinkRequest} GetSinkRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetSinkRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.GetSinkRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.sinkName = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetSinkRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.GetSinkRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.GetSinkRequest} GetSinkRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetSinkRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetSinkRequest message. + * @function verify + * @memberof google.logging.v2.GetSinkRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetSinkRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.sinkName != null && message.hasOwnProperty("sinkName")) + if (!$util.isString(message.sinkName)) + return "sinkName: string expected"; + return null; + }; + + /** + * Creates a GetSinkRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.GetSinkRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.GetSinkRequest} GetSinkRequest + */ + GetSinkRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.GetSinkRequest) + return object; + var message = new $root.google.logging.v2.GetSinkRequest(); + if (object.sinkName != null) + message.sinkName = String(object.sinkName); + return message; + }; + + /** + * Creates a plain object from a GetSinkRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.GetSinkRequest + * @static + * @param {google.logging.v2.GetSinkRequest} message GetSinkRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetSinkRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.sinkName = ""; + if (message.sinkName != null && message.hasOwnProperty("sinkName")) + object.sinkName = message.sinkName; + return object; + }; + + /** + * Converts this GetSinkRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.GetSinkRequest + * @instance + * @returns {Object.} JSON object + */ + GetSinkRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetSinkRequest + * @function getTypeUrl + * @memberof google.logging.v2.GetSinkRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetSinkRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.GetSinkRequest"; + }; + + return GetSinkRequest; + })(); + + v2.CreateSinkRequest = (function() { + + /** + * Properties of a CreateSinkRequest. + * @memberof google.logging.v2 + * @interface ICreateSinkRequest + * @property {string|null} [parent] CreateSinkRequest parent + * @property {google.logging.v2.ILogSink|null} [sink] CreateSinkRequest sink + * @property {boolean|null} [uniqueWriterIdentity] CreateSinkRequest uniqueWriterIdentity + */ + + /** + * Constructs a new CreateSinkRequest. + * @memberof google.logging.v2 + * @classdesc Represents a CreateSinkRequest. + * @implements ICreateSinkRequest + * @constructor + * @param {google.logging.v2.ICreateSinkRequest=} [properties] Properties to set + */ + function CreateSinkRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateSinkRequest parent. + * @member {string} parent + * @memberof google.logging.v2.CreateSinkRequest + * @instance + */ + CreateSinkRequest.prototype.parent = ""; + + /** + * CreateSinkRequest sink. + * @member {google.logging.v2.ILogSink|null|undefined} sink + * @memberof google.logging.v2.CreateSinkRequest + * @instance + */ + CreateSinkRequest.prototype.sink = null; + + /** + * CreateSinkRequest uniqueWriterIdentity. + * @member {boolean} uniqueWriterIdentity + * @memberof google.logging.v2.CreateSinkRequest + * @instance + */ + CreateSinkRequest.prototype.uniqueWriterIdentity = false; + + /** + * Creates a new CreateSinkRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.CreateSinkRequest + * @static + * @param {google.logging.v2.ICreateSinkRequest=} [properties] Properties to set + * @returns {google.logging.v2.CreateSinkRequest} CreateSinkRequest instance + */ + CreateSinkRequest.create = function create(properties) { + return new CreateSinkRequest(properties); + }; + + /** + * Encodes the specified CreateSinkRequest message. Does not implicitly {@link google.logging.v2.CreateSinkRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.CreateSinkRequest + * @static + * @param {google.logging.v2.ICreateSinkRequest} message CreateSinkRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateSinkRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.sink != null && Object.hasOwnProperty.call(message, "sink")) + $root.google.logging.v2.LogSink.encode(message.sink, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.uniqueWriterIdentity != null && Object.hasOwnProperty.call(message, "uniqueWriterIdentity")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.uniqueWriterIdentity); + return writer; + }; + + /** + * Encodes the specified CreateSinkRequest message, length delimited. Does not implicitly {@link google.logging.v2.CreateSinkRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.CreateSinkRequest + * @static + * @param {google.logging.v2.ICreateSinkRequest} message CreateSinkRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateSinkRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateSinkRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.CreateSinkRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.CreateSinkRequest} CreateSinkRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateSinkRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.CreateSinkRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.sink = $root.google.logging.v2.LogSink.decode(reader, reader.uint32()); + break; + } + case 3: { + message.uniqueWriterIdentity = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateSinkRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.CreateSinkRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.CreateSinkRequest} CreateSinkRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateSinkRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateSinkRequest message. + * @function verify + * @memberof google.logging.v2.CreateSinkRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateSinkRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.sink != null && message.hasOwnProperty("sink")) { + var error = $root.google.logging.v2.LogSink.verify(message.sink); + if (error) + return "sink." + error; + } + if (message.uniqueWriterIdentity != null && message.hasOwnProperty("uniqueWriterIdentity")) + if (typeof message.uniqueWriterIdentity !== "boolean") + return "uniqueWriterIdentity: boolean expected"; + return null; + }; + + /** + * Creates a CreateSinkRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.CreateSinkRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.CreateSinkRequest} CreateSinkRequest + */ + CreateSinkRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.CreateSinkRequest) + return object; + var message = new $root.google.logging.v2.CreateSinkRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.sink != null) { + if (typeof object.sink !== "object") + throw TypeError(".google.logging.v2.CreateSinkRequest.sink: object expected"); + message.sink = $root.google.logging.v2.LogSink.fromObject(object.sink); + } + if (object.uniqueWriterIdentity != null) + message.uniqueWriterIdentity = Boolean(object.uniqueWriterIdentity); + return message; + }; + + /** + * Creates a plain object from a CreateSinkRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.CreateSinkRequest + * @static + * @param {google.logging.v2.CreateSinkRequest} message CreateSinkRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateSinkRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.sink = null; + object.uniqueWriterIdentity = false; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.sink != null && message.hasOwnProperty("sink")) + object.sink = $root.google.logging.v2.LogSink.toObject(message.sink, options); + if (message.uniqueWriterIdentity != null && message.hasOwnProperty("uniqueWriterIdentity")) + object.uniqueWriterIdentity = message.uniqueWriterIdentity; + return object; + }; + + /** + * Converts this CreateSinkRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.CreateSinkRequest + * @instance + * @returns {Object.} JSON object + */ + CreateSinkRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateSinkRequest + * @function getTypeUrl + * @memberof google.logging.v2.CreateSinkRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateSinkRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.CreateSinkRequest"; + }; + + return CreateSinkRequest; + })(); + + v2.UpdateSinkRequest = (function() { + + /** + * Properties of an UpdateSinkRequest. + * @memberof google.logging.v2 + * @interface IUpdateSinkRequest + * @property {string|null} [sinkName] UpdateSinkRequest sinkName + * @property {google.logging.v2.ILogSink|null} [sink] UpdateSinkRequest sink + * @property {boolean|null} [uniqueWriterIdentity] UpdateSinkRequest uniqueWriterIdentity + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateSinkRequest updateMask + */ + + /** + * Constructs a new UpdateSinkRequest. + * @memberof google.logging.v2 + * @classdesc Represents an UpdateSinkRequest. + * @implements IUpdateSinkRequest + * @constructor + * @param {google.logging.v2.IUpdateSinkRequest=} [properties] Properties to set + */ + function UpdateSinkRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateSinkRequest sinkName. + * @member {string} sinkName + * @memberof google.logging.v2.UpdateSinkRequest + * @instance + */ + UpdateSinkRequest.prototype.sinkName = ""; + + /** + * UpdateSinkRequest sink. + * @member {google.logging.v2.ILogSink|null|undefined} sink + * @memberof google.logging.v2.UpdateSinkRequest + * @instance + */ + UpdateSinkRequest.prototype.sink = null; + + /** + * UpdateSinkRequest uniqueWriterIdentity. + * @member {boolean} uniqueWriterIdentity + * @memberof google.logging.v2.UpdateSinkRequest + * @instance + */ + UpdateSinkRequest.prototype.uniqueWriterIdentity = false; + + /** + * UpdateSinkRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.logging.v2.UpdateSinkRequest + * @instance + */ + UpdateSinkRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateSinkRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.UpdateSinkRequest + * @static + * @param {google.logging.v2.IUpdateSinkRequest=} [properties] Properties to set + * @returns {google.logging.v2.UpdateSinkRequest} UpdateSinkRequest instance + */ + UpdateSinkRequest.create = function create(properties) { + return new UpdateSinkRequest(properties); + }; + + /** + * Encodes the specified UpdateSinkRequest message. Does not implicitly {@link google.logging.v2.UpdateSinkRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.UpdateSinkRequest + * @static + * @param {google.logging.v2.IUpdateSinkRequest} message UpdateSinkRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateSinkRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sinkName != null && Object.hasOwnProperty.call(message, "sinkName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.sinkName); + if (message.sink != null && Object.hasOwnProperty.call(message, "sink")) + $root.google.logging.v2.LogSink.encode(message.sink, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.uniqueWriterIdentity != null && Object.hasOwnProperty.call(message, "uniqueWriterIdentity")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.uniqueWriterIdentity); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateSinkRequest message, length delimited. Does not implicitly {@link google.logging.v2.UpdateSinkRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.UpdateSinkRequest + * @static + * @param {google.logging.v2.IUpdateSinkRequest} message UpdateSinkRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateSinkRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateSinkRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.UpdateSinkRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.UpdateSinkRequest} UpdateSinkRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateSinkRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.UpdateSinkRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.sinkName = reader.string(); + break; + } + case 2: { + message.sink = $root.google.logging.v2.LogSink.decode(reader, reader.uint32()); + break; + } + case 3: { + message.uniqueWriterIdentity = reader.bool(); + break; + } + case 4: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateSinkRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.UpdateSinkRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.UpdateSinkRequest} UpdateSinkRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateSinkRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateSinkRequest message. + * @function verify + * @memberof google.logging.v2.UpdateSinkRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateSinkRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.sinkName != null && message.hasOwnProperty("sinkName")) + if (!$util.isString(message.sinkName)) + return "sinkName: string expected"; + if (message.sink != null && message.hasOwnProperty("sink")) { + var error = $root.google.logging.v2.LogSink.verify(message.sink); + if (error) + return "sink." + error; + } + if (message.uniqueWriterIdentity != null && message.hasOwnProperty("uniqueWriterIdentity")) + if (typeof message.uniqueWriterIdentity !== "boolean") + return "uniqueWriterIdentity: boolean expected"; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateSinkRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.UpdateSinkRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.UpdateSinkRequest} UpdateSinkRequest + */ + UpdateSinkRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.UpdateSinkRequest) + return object; + var message = new $root.google.logging.v2.UpdateSinkRequest(); + if (object.sinkName != null) + message.sinkName = String(object.sinkName); + if (object.sink != null) { + if (typeof object.sink !== "object") + throw TypeError(".google.logging.v2.UpdateSinkRequest.sink: object expected"); + message.sink = $root.google.logging.v2.LogSink.fromObject(object.sink); + } + if (object.uniqueWriterIdentity != null) + message.uniqueWriterIdentity = Boolean(object.uniqueWriterIdentity); + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.logging.v2.UpdateSinkRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateSinkRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.UpdateSinkRequest + * @static + * @param {google.logging.v2.UpdateSinkRequest} message UpdateSinkRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateSinkRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.sinkName = ""; + object.sink = null; + object.uniqueWriterIdentity = false; + object.updateMask = null; + } + if (message.sinkName != null && message.hasOwnProperty("sinkName")) + object.sinkName = message.sinkName; + if (message.sink != null && message.hasOwnProperty("sink")) + object.sink = $root.google.logging.v2.LogSink.toObject(message.sink, options); + if (message.uniqueWriterIdentity != null && message.hasOwnProperty("uniqueWriterIdentity")) + object.uniqueWriterIdentity = message.uniqueWriterIdentity; + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateSinkRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.UpdateSinkRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateSinkRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateSinkRequest + * @function getTypeUrl + * @memberof google.logging.v2.UpdateSinkRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateSinkRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.UpdateSinkRequest"; + }; + + return UpdateSinkRequest; + })(); + + v2.DeleteSinkRequest = (function() { + + /** + * Properties of a DeleteSinkRequest. + * @memberof google.logging.v2 + * @interface IDeleteSinkRequest + * @property {string|null} [sinkName] DeleteSinkRequest sinkName + */ + + /** + * Constructs a new DeleteSinkRequest. + * @memberof google.logging.v2 + * @classdesc Represents a DeleteSinkRequest. + * @implements IDeleteSinkRequest + * @constructor + * @param {google.logging.v2.IDeleteSinkRequest=} [properties] Properties to set + */ + function DeleteSinkRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteSinkRequest sinkName. + * @member {string} sinkName + * @memberof google.logging.v2.DeleteSinkRequest + * @instance + */ + DeleteSinkRequest.prototype.sinkName = ""; + + /** + * Creates a new DeleteSinkRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.DeleteSinkRequest + * @static + * @param {google.logging.v2.IDeleteSinkRequest=} [properties] Properties to set + * @returns {google.logging.v2.DeleteSinkRequest} DeleteSinkRequest instance + */ + DeleteSinkRequest.create = function create(properties) { + return new DeleteSinkRequest(properties); + }; + + /** + * Encodes the specified DeleteSinkRequest message. Does not implicitly {@link google.logging.v2.DeleteSinkRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.DeleteSinkRequest + * @static + * @param {google.logging.v2.IDeleteSinkRequest} message DeleteSinkRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteSinkRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.sinkName != null && Object.hasOwnProperty.call(message, "sinkName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.sinkName); + return writer; + }; + + /** + * Encodes the specified DeleteSinkRequest message, length delimited. Does not implicitly {@link google.logging.v2.DeleteSinkRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.DeleteSinkRequest + * @static + * @param {google.logging.v2.IDeleteSinkRequest} message DeleteSinkRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteSinkRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteSinkRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.DeleteSinkRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.DeleteSinkRequest} DeleteSinkRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteSinkRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.DeleteSinkRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.sinkName = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteSinkRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.DeleteSinkRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.DeleteSinkRequest} DeleteSinkRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteSinkRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteSinkRequest message. + * @function verify + * @memberof google.logging.v2.DeleteSinkRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteSinkRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.sinkName != null && message.hasOwnProperty("sinkName")) + if (!$util.isString(message.sinkName)) + return "sinkName: string expected"; + return null; + }; + + /** + * Creates a DeleteSinkRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.DeleteSinkRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.DeleteSinkRequest} DeleteSinkRequest + */ + DeleteSinkRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.DeleteSinkRequest) + return object; + var message = new $root.google.logging.v2.DeleteSinkRequest(); + if (object.sinkName != null) + message.sinkName = String(object.sinkName); + return message; + }; + + /** + * Creates a plain object from a DeleteSinkRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.DeleteSinkRequest + * @static + * @param {google.logging.v2.DeleteSinkRequest} message DeleteSinkRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteSinkRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.sinkName = ""; + if (message.sinkName != null && message.hasOwnProperty("sinkName")) + object.sinkName = message.sinkName; + return object; + }; + + /** + * Converts this DeleteSinkRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.DeleteSinkRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteSinkRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteSinkRequest + * @function getTypeUrl + * @memberof google.logging.v2.DeleteSinkRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteSinkRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.DeleteSinkRequest"; + }; + + return DeleteSinkRequest; + })(); + + v2.CreateLinkRequest = (function() { + + /** + * Properties of a CreateLinkRequest. + * @memberof google.logging.v2 + * @interface ICreateLinkRequest + * @property {string|null} [parent] CreateLinkRequest parent + * @property {google.logging.v2.ILink|null} [link] CreateLinkRequest link + * @property {string|null} [linkId] CreateLinkRequest linkId + */ + + /** + * Constructs a new CreateLinkRequest. + * @memberof google.logging.v2 + * @classdesc Represents a CreateLinkRequest. + * @implements ICreateLinkRequest + * @constructor + * @param {google.logging.v2.ICreateLinkRequest=} [properties] Properties to set + */ + function CreateLinkRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateLinkRequest parent. + * @member {string} parent + * @memberof google.logging.v2.CreateLinkRequest + * @instance + */ + CreateLinkRequest.prototype.parent = ""; + + /** + * CreateLinkRequest link. + * @member {google.logging.v2.ILink|null|undefined} link + * @memberof google.logging.v2.CreateLinkRequest + * @instance + */ + CreateLinkRequest.prototype.link = null; + + /** + * CreateLinkRequest linkId. + * @member {string} linkId + * @memberof google.logging.v2.CreateLinkRequest + * @instance + */ + CreateLinkRequest.prototype.linkId = ""; + + /** + * Creates a new CreateLinkRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.CreateLinkRequest + * @static + * @param {google.logging.v2.ICreateLinkRequest=} [properties] Properties to set + * @returns {google.logging.v2.CreateLinkRequest} CreateLinkRequest instance + */ + CreateLinkRequest.create = function create(properties) { + return new CreateLinkRequest(properties); + }; + + /** + * Encodes the specified CreateLinkRequest message. Does not implicitly {@link google.logging.v2.CreateLinkRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.CreateLinkRequest + * @static + * @param {google.logging.v2.ICreateLinkRequest} message CreateLinkRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateLinkRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.link != null && Object.hasOwnProperty.call(message, "link")) + $root.google.logging.v2.Link.encode(message.link, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.linkId != null && Object.hasOwnProperty.call(message, "linkId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.linkId); + return writer; + }; + + /** + * Encodes the specified CreateLinkRequest message, length delimited. Does not implicitly {@link google.logging.v2.CreateLinkRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.CreateLinkRequest + * @static + * @param {google.logging.v2.ICreateLinkRequest} message CreateLinkRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateLinkRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateLinkRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.CreateLinkRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.CreateLinkRequest} CreateLinkRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateLinkRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.CreateLinkRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.link = $root.google.logging.v2.Link.decode(reader, reader.uint32()); + break; + } + case 3: { + message.linkId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateLinkRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.CreateLinkRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.CreateLinkRequest} CreateLinkRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateLinkRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateLinkRequest message. + * @function verify + * @memberof google.logging.v2.CreateLinkRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateLinkRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.link != null && message.hasOwnProperty("link")) { + var error = $root.google.logging.v2.Link.verify(message.link); + if (error) + return "link." + error; + } + if (message.linkId != null && message.hasOwnProperty("linkId")) + if (!$util.isString(message.linkId)) + return "linkId: string expected"; + return null; + }; + + /** + * Creates a CreateLinkRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.CreateLinkRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.CreateLinkRequest} CreateLinkRequest + */ + CreateLinkRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.CreateLinkRequest) + return object; + var message = new $root.google.logging.v2.CreateLinkRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.link != null) { + if (typeof object.link !== "object") + throw TypeError(".google.logging.v2.CreateLinkRequest.link: object expected"); + message.link = $root.google.logging.v2.Link.fromObject(object.link); + } + if (object.linkId != null) + message.linkId = String(object.linkId); + return message; + }; + + /** + * Creates a plain object from a CreateLinkRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.CreateLinkRequest + * @static + * @param {google.logging.v2.CreateLinkRequest} message CreateLinkRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateLinkRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.link = null; + object.linkId = ""; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.link != null && message.hasOwnProperty("link")) + object.link = $root.google.logging.v2.Link.toObject(message.link, options); + if (message.linkId != null && message.hasOwnProperty("linkId")) + object.linkId = message.linkId; + return object; + }; + + /** + * Converts this CreateLinkRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.CreateLinkRequest + * @instance + * @returns {Object.} JSON object + */ + CreateLinkRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateLinkRequest + * @function getTypeUrl + * @memberof google.logging.v2.CreateLinkRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateLinkRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.CreateLinkRequest"; + }; + + return CreateLinkRequest; + })(); + + v2.DeleteLinkRequest = (function() { + + /** + * Properties of a DeleteLinkRequest. + * @memberof google.logging.v2 + * @interface IDeleteLinkRequest + * @property {string|null} [name] DeleteLinkRequest name + */ + + /** + * Constructs a new DeleteLinkRequest. + * @memberof google.logging.v2 + * @classdesc Represents a DeleteLinkRequest. + * @implements IDeleteLinkRequest + * @constructor + * @param {google.logging.v2.IDeleteLinkRequest=} [properties] Properties to set + */ + function DeleteLinkRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteLinkRequest name. + * @member {string} name + * @memberof google.logging.v2.DeleteLinkRequest + * @instance + */ + DeleteLinkRequest.prototype.name = ""; + + /** + * Creates a new DeleteLinkRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.DeleteLinkRequest + * @static + * @param {google.logging.v2.IDeleteLinkRequest=} [properties] Properties to set + * @returns {google.logging.v2.DeleteLinkRequest} DeleteLinkRequest instance + */ + DeleteLinkRequest.create = function create(properties) { + return new DeleteLinkRequest(properties); + }; + + /** + * Encodes the specified DeleteLinkRequest message. Does not implicitly {@link google.logging.v2.DeleteLinkRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.DeleteLinkRequest + * @static + * @param {google.logging.v2.IDeleteLinkRequest} message DeleteLinkRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteLinkRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteLinkRequest message, length delimited. Does not implicitly {@link google.logging.v2.DeleteLinkRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.DeleteLinkRequest + * @static + * @param {google.logging.v2.IDeleteLinkRequest} message DeleteLinkRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteLinkRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteLinkRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.DeleteLinkRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.DeleteLinkRequest} DeleteLinkRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteLinkRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.DeleteLinkRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteLinkRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.DeleteLinkRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.DeleteLinkRequest} DeleteLinkRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteLinkRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteLinkRequest message. + * @function verify + * @memberof google.logging.v2.DeleteLinkRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteLinkRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a DeleteLinkRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.DeleteLinkRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.DeleteLinkRequest} DeleteLinkRequest + */ + DeleteLinkRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.DeleteLinkRequest) + return object; + var message = new $root.google.logging.v2.DeleteLinkRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteLinkRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.DeleteLinkRequest + * @static + * @param {google.logging.v2.DeleteLinkRequest} message DeleteLinkRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteLinkRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteLinkRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.DeleteLinkRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteLinkRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteLinkRequest + * @function getTypeUrl + * @memberof google.logging.v2.DeleteLinkRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteLinkRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.DeleteLinkRequest"; + }; + + return DeleteLinkRequest; + })(); + + v2.ListLinksRequest = (function() { + + /** + * Properties of a ListLinksRequest. + * @memberof google.logging.v2 + * @interface IListLinksRequest + * @property {string|null} [parent] ListLinksRequest parent + * @property {string|null} [pageToken] ListLinksRequest pageToken + * @property {number|null} [pageSize] ListLinksRequest pageSize + */ + + /** + * Constructs a new ListLinksRequest. + * @memberof google.logging.v2 + * @classdesc Represents a ListLinksRequest. + * @implements IListLinksRequest + * @constructor + * @param {google.logging.v2.IListLinksRequest=} [properties] Properties to set + */ + function ListLinksRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListLinksRequest parent. + * @member {string} parent + * @memberof google.logging.v2.ListLinksRequest + * @instance + */ + ListLinksRequest.prototype.parent = ""; + + /** + * ListLinksRequest pageToken. + * @member {string} pageToken + * @memberof google.logging.v2.ListLinksRequest + * @instance + */ + ListLinksRequest.prototype.pageToken = ""; + + /** + * ListLinksRequest pageSize. + * @member {number} pageSize + * @memberof google.logging.v2.ListLinksRequest + * @instance + */ + ListLinksRequest.prototype.pageSize = 0; + + /** + * Creates a new ListLinksRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.ListLinksRequest + * @static + * @param {google.logging.v2.IListLinksRequest=} [properties] Properties to set + * @returns {google.logging.v2.ListLinksRequest} ListLinksRequest instance + */ + ListLinksRequest.create = function create(properties) { + return new ListLinksRequest(properties); + }; + + /** + * Encodes the specified ListLinksRequest message. Does not implicitly {@link google.logging.v2.ListLinksRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.ListLinksRequest + * @static + * @param {google.logging.v2.IListLinksRequest} message ListLinksRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListLinksRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.pageToken); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + return writer; + }; + + /** + * Encodes the specified ListLinksRequest message, length delimited. Does not implicitly {@link google.logging.v2.ListLinksRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.ListLinksRequest + * @static + * @param {google.logging.v2.IListLinksRequest} message ListLinksRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListLinksRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListLinksRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.ListLinksRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.ListLinksRequest} ListLinksRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListLinksRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.ListLinksRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageToken = reader.string(); + break; + } + case 3: { + message.pageSize = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListLinksRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.ListLinksRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.ListLinksRequest} ListLinksRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListLinksRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListLinksRequest message. + * @function verify + * @memberof google.logging.v2.ListLinksRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListLinksRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + return null; + }; + + /** + * Creates a ListLinksRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.ListLinksRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.ListLinksRequest} ListLinksRequest + */ + ListLinksRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.ListLinksRequest) + return object; + var message = new $root.google.logging.v2.ListLinksRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + return message; + }; + + /** + * Creates a plain object from a ListLinksRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.ListLinksRequest + * @static + * @param {google.logging.v2.ListLinksRequest} message ListLinksRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListLinksRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageToken = ""; + object.pageSize = 0; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + return object; + }; + + /** + * Converts this ListLinksRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.ListLinksRequest + * @instance + * @returns {Object.} JSON object + */ + ListLinksRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListLinksRequest + * @function getTypeUrl + * @memberof google.logging.v2.ListLinksRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListLinksRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.ListLinksRequest"; + }; + + return ListLinksRequest; + })(); + + v2.ListLinksResponse = (function() { + + /** + * Properties of a ListLinksResponse. + * @memberof google.logging.v2 + * @interface IListLinksResponse + * @property {Array.|null} [links] ListLinksResponse links + * @property {string|null} [nextPageToken] ListLinksResponse nextPageToken + */ + + /** + * Constructs a new ListLinksResponse. + * @memberof google.logging.v2 + * @classdesc Represents a ListLinksResponse. + * @implements IListLinksResponse + * @constructor + * @param {google.logging.v2.IListLinksResponse=} [properties] Properties to set + */ + function ListLinksResponse(properties) { + this.links = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListLinksResponse links. + * @member {Array.} links + * @memberof google.logging.v2.ListLinksResponse + * @instance + */ + ListLinksResponse.prototype.links = $util.emptyArray; + + /** + * ListLinksResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.logging.v2.ListLinksResponse + * @instance + */ + ListLinksResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListLinksResponse instance using the specified properties. + * @function create + * @memberof google.logging.v2.ListLinksResponse + * @static + * @param {google.logging.v2.IListLinksResponse=} [properties] Properties to set + * @returns {google.logging.v2.ListLinksResponse} ListLinksResponse instance + */ + ListLinksResponse.create = function create(properties) { + return new ListLinksResponse(properties); + }; + + /** + * Encodes the specified ListLinksResponse message. Does not implicitly {@link google.logging.v2.ListLinksResponse.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.ListLinksResponse + * @static + * @param {google.logging.v2.IListLinksResponse} message ListLinksResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListLinksResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.links != null && message.links.length) + for (var i = 0; i < message.links.length; ++i) + $root.google.logging.v2.Link.encode(message.links[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListLinksResponse message, length delimited. Does not implicitly {@link google.logging.v2.ListLinksResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.ListLinksResponse + * @static + * @param {google.logging.v2.IListLinksResponse} message ListLinksResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListLinksResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListLinksResponse message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.ListLinksResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.ListLinksResponse} ListLinksResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListLinksResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.ListLinksResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.links && message.links.length)) + message.links = []; + message.links.push($root.google.logging.v2.Link.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListLinksResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.ListLinksResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.ListLinksResponse} ListLinksResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListLinksResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListLinksResponse message. + * @function verify + * @memberof google.logging.v2.ListLinksResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListLinksResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.links != null && message.hasOwnProperty("links")) { + if (!Array.isArray(message.links)) + return "links: array expected"; + for (var i = 0; i < message.links.length; ++i) { + var error = $root.google.logging.v2.Link.verify(message.links[i]); + if (error) + return "links." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListLinksResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.ListLinksResponse + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.ListLinksResponse} ListLinksResponse + */ + ListLinksResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.ListLinksResponse) + return object; + var message = new $root.google.logging.v2.ListLinksResponse(); + if (object.links) { + if (!Array.isArray(object.links)) + throw TypeError(".google.logging.v2.ListLinksResponse.links: array expected"); + message.links = []; + for (var i = 0; i < object.links.length; ++i) { + if (typeof object.links[i] !== "object") + throw TypeError(".google.logging.v2.ListLinksResponse.links: object expected"); + message.links[i] = $root.google.logging.v2.Link.fromObject(object.links[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListLinksResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.ListLinksResponse + * @static + * @param {google.logging.v2.ListLinksResponse} message ListLinksResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListLinksResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.links = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.links && message.links.length) { + object.links = []; + for (var j = 0; j < message.links.length; ++j) + object.links[j] = $root.google.logging.v2.Link.toObject(message.links[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListLinksResponse to JSON. + * @function toJSON + * @memberof google.logging.v2.ListLinksResponse + * @instance + * @returns {Object.} JSON object + */ + ListLinksResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListLinksResponse + * @function getTypeUrl + * @memberof google.logging.v2.ListLinksResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListLinksResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.ListLinksResponse"; + }; + + return ListLinksResponse; + })(); + + v2.GetLinkRequest = (function() { + + /** + * Properties of a GetLinkRequest. + * @memberof google.logging.v2 + * @interface IGetLinkRequest + * @property {string|null} [name] GetLinkRequest name + */ + + /** + * Constructs a new GetLinkRequest. + * @memberof google.logging.v2 + * @classdesc Represents a GetLinkRequest. + * @implements IGetLinkRequest + * @constructor + * @param {google.logging.v2.IGetLinkRequest=} [properties] Properties to set + */ + function GetLinkRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetLinkRequest name. + * @member {string} name + * @memberof google.logging.v2.GetLinkRequest + * @instance + */ + GetLinkRequest.prototype.name = ""; + + /** + * Creates a new GetLinkRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.GetLinkRequest + * @static + * @param {google.logging.v2.IGetLinkRequest=} [properties] Properties to set + * @returns {google.logging.v2.GetLinkRequest} GetLinkRequest instance + */ + GetLinkRequest.create = function create(properties) { + return new GetLinkRequest(properties); + }; + + /** + * Encodes the specified GetLinkRequest message. Does not implicitly {@link google.logging.v2.GetLinkRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.GetLinkRequest + * @static + * @param {google.logging.v2.IGetLinkRequest} message GetLinkRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetLinkRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetLinkRequest message, length delimited. Does not implicitly {@link google.logging.v2.GetLinkRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.GetLinkRequest + * @static + * @param {google.logging.v2.IGetLinkRequest} message GetLinkRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetLinkRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetLinkRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.GetLinkRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.GetLinkRequest} GetLinkRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetLinkRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.GetLinkRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetLinkRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.GetLinkRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.GetLinkRequest} GetLinkRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetLinkRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetLinkRequest message. + * @function verify + * @memberof google.logging.v2.GetLinkRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetLinkRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetLinkRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.GetLinkRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.GetLinkRequest} GetLinkRequest + */ + GetLinkRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.GetLinkRequest) + return object; + var message = new $root.google.logging.v2.GetLinkRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetLinkRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.GetLinkRequest + * @static + * @param {google.logging.v2.GetLinkRequest} message GetLinkRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetLinkRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetLinkRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.GetLinkRequest + * @instance + * @returns {Object.} JSON object + */ + GetLinkRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetLinkRequest + * @function getTypeUrl + * @memberof google.logging.v2.GetLinkRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetLinkRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.GetLinkRequest"; + }; + + return GetLinkRequest; + })(); + + v2.LogExclusion = (function() { + + /** + * Properties of a LogExclusion. + * @memberof google.logging.v2 + * @interface ILogExclusion + * @property {string|null} [name] LogExclusion name + * @property {string|null} [description] LogExclusion description + * @property {string|null} [filter] LogExclusion filter + * @property {boolean|null} [disabled] LogExclusion disabled + * @property {google.protobuf.ITimestamp|null} [createTime] LogExclusion createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] LogExclusion updateTime + */ + + /** + * Constructs a new LogExclusion. + * @memberof google.logging.v2 + * @classdesc Represents a LogExclusion. + * @implements ILogExclusion + * @constructor + * @param {google.logging.v2.ILogExclusion=} [properties] Properties to set + */ + function LogExclusion(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LogExclusion name. + * @member {string} name + * @memberof google.logging.v2.LogExclusion + * @instance + */ + LogExclusion.prototype.name = ""; + + /** + * LogExclusion description. + * @member {string} description + * @memberof google.logging.v2.LogExclusion + * @instance + */ + LogExclusion.prototype.description = ""; + + /** + * LogExclusion filter. + * @member {string} filter + * @memberof google.logging.v2.LogExclusion + * @instance + */ + LogExclusion.prototype.filter = ""; + + /** + * LogExclusion disabled. + * @member {boolean} disabled + * @memberof google.logging.v2.LogExclusion + * @instance + */ + LogExclusion.prototype.disabled = false; + + /** + * LogExclusion createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.logging.v2.LogExclusion + * @instance + */ + LogExclusion.prototype.createTime = null; + + /** + * LogExclusion updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.logging.v2.LogExclusion + * @instance + */ + LogExclusion.prototype.updateTime = null; + + /** + * Creates a new LogExclusion instance using the specified properties. + * @function create + * @memberof google.logging.v2.LogExclusion + * @static + * @param {google.logging.v2.ILogExclusion=} [properties] Properties to set + * @returns {google.logging.v2.LogExclusion} LogExclusion instance + */ + LogExclusion.create = function create(properties) { + return new LogExclusion(properties); + }; + + /** + * Encodes the specified LogExclusion message. Does not implicitly {@link google.logging.v2.LogExclusion.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.LogExclusion + * @static + * @param {google.logging.v2.ILogExclusion} message LogExclusion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LogExclusion.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.filter); + if (message.disabled != null && Object.hasOwnProperty.call(message, "disabled")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.disabled); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified LogExclusion message, length delimited. Does not implicitly {@link google.logging.v2.LogExclusion.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.LogExclusion + * @static + * @param {google.logging.v2.ILogExclusion} message LogExclusion message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LogExclusion.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LogExclusion message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.LogExclusion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.LogExclusion} LogExclusion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LogExclusion.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.LogExclusion(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.description = reader.string(); + break; + } + case 3: { + message.filter = reader.string(); + break; + } + case 4: { + message.disabled = reader.bool(); + break; + } + case 5: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 6: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LogExclusion message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.LogExclusion + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.LogExclusion} LogExclusion + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LogExclusion.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LogExclusion message. + * @function verify + * @memberof google.logging.v2.LogExclusion + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LogExclusion.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.disabled != null && message.hasOwnProperty("disabled")) + if (typeof message.disabled !== "boolean") + return "disabled: boolean expected"; + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } + return null; + }; + + /** + * Creates a LogExclusion message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.LogExclusion + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.LogExclusion} LogExclusion + */ + LogExclusion.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.LogExclusion) + return object; + var message = new $root.google.logging.v2.LogExclusion(); + if (object.name != null) + message.name = String(object.name); + if (object.description != null) + message.description = String(object.description); + if (object.filter != null) + message.filter = String(object.filter); + if (object.disabled != null) + message.disabled = Boolean(object.disabled); + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.logging.v2.LogExclusion.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.logging.v2.LogExclusion.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + return message; + }; + + /** + * Creates a plain object from a LogExclusion message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.LogExclusion + * @static + * @param {google.logging.v2.LogExclusion} message LogExclusion + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LogExclusion.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.description = ""; + object.filter = ""; + object.disabled = false; + object.createTime = null; + object.updateTime = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.disabled != null && message.hasOwnProperty("disabled")) + object.disabled = message.disabled; + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + return object; + }; + + /** + * Converts this LogExclusion to JSON. + * @function toJSON + * @memberof google.logging.v2.LogExclusion + * @instance + * @returns {Object.} JSON object + */ + LogExclusion.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LogExclusion + * @function getTypeUrl + * @memberof google.logging.v2.LogExclusion + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LogExclusion.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.LogExclusion"; + }; + + return LogExclusion; + })(); + + v2.ListExclusionsRequest = (function() { + + /** + * Properties of a ListExclusionsRequest. + * @memberof google.logging.v2 + * @interface IListExclusionsRequest + * @property {string|null} [parent] ListExclusionsRequest parent + * @property {string|null} [pageToken] ListExclusionsRequest pageToken + * @property {number|null} [pageSize] ListExclusionsRequest pageSize + */ + + /** + * Constructs a new ListExclusionsRequest. + * @memberof google.logging.v2 + * @classdesc Represents a ListExclusionsRequest. + * @implements IListExclusionsRequest + * @constructor + * @param {google.logging.v2.IListExclusionsRequest=} [properties] Properties to set + */ + function ListExclusionsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListExclusionsRequest parent. + * @member {string} parent + * @memberof google.logging.v2.ListExclusionsRequest + * @instance + */ + ListExclusionsRequest.prototype.parent = ""; + + /** + * ListExclusionsRequest pageToken. + * @member {string} pageToken + * @memberof google.logging.v2.ListExclusionsRequest + * @instance + */ + ListExclusionsRequest.prototype.pageToken = ""; + + /** + * ListExclusionsRequest pageSize. + * @member {number} pageSize + * @memberof google.logging.v2.ListExclusionsRequest + * @instance + */ + ListExclusionsRequest.prototype.pageSize = 0; + + /** + * Creates a new ListExclusionsRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.ListExclusionsRequest + * @static + * @param {google.logging.v2.IListExclusionsRequest=} [properties] Properties to set + * @returns {google.logging.v2.ListExclusionsRequest} ListExclusionsRequest instance + */ + ListExclusionsRequest.create = function create(properties) { + return new ListExclusionsRequest(properties); + }; + + /** + * Encodes the specified ListExclusionsRequest message. Does not implicitly {@link google.logging.v2.ListExclusionsRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.ListExclusionsRequest + * @static + * @param {google.logging.v2.IListExclusionsRequest} message ListExclusionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListExclusionsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.pageToken); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + return writer; + }; + + /** + * Encodes the specified ListExclusionsRequest message, length delimited. Does not implicitly {@link google.logging.v2.ListExclusionsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.ListExclusionsRequest + * @static + * @param {google.logging.v2.IListExclusionsRequest} message ListExclusionsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListExclusionsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListExclusionsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.ListExclusionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.ListExclusionsRequest} ListExclusionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListExclusionsRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.ListExclusionsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageToken = reader.string(); + break; + } + case 3: { + message.pageSize = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListExclusionsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.ListExclusionsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.ListExclusionsRequest} ListExclusionsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListExclusionsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListExclusionsRequest message. + * @function verify + * @memberof google.logging.v2.ListExclusionsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListExclusionsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + return null; + }; + + /** + * Creates a ListExclusionsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.ListExclusionsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.ListExclusionsRequest} ListExclusionsRequest + */ + ListExclusionsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.ListExclusionsRequest) + return object; + var message = new $root.google.logging.v2.ListExclusionsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + return message; + }; + + /** + * Creates a plain object from a ListExclusionsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.ListExclusionsRequest + * @static + * @param {google.logging.v2.ListExclusionsRequest} message ListExclusionsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListExclusionsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageToken = ""; + object.pageSize = 0; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + return object; + }; + + /** + * Converts this ListExclusionsRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.ListExclusionsRequest + * @instance + * @returns {Object.} JSON object + */ + ListExclusionsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListExclusionsRequest + * @function getTypeUrl + * @memberof google.logging.v2.ListExclusionsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListExclusionsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.ListExclusionsRequest"; + }; + + return ListExclusionsRequest; + })(); + + v2.ListExclusionsResponse = (function() { + + /** + * Properties of a ListExclusionsResponse. + * @memberof google.logging.v2 + * @interface IListExclusionsResponse + * @property {Array.|null} [exclusions] ListExclusionsResponse exclusions + * @property {string|null} [nextPageToken] ListExclusionsResponse nextPageToken + */ + + /** + * Constructs a new ListExclusionsResponse. + * @memberof google.logging.v2 + * @classdesc Represents a ListExclusionsResponse. + * @implements IListExclusionsResponse + * @constructor + * @param {google.logging.v2.IListExclusionsResponse=} [properties] Properties to set + */ + function ListExclusionsResponse(properties) { + this.exclusions = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListExclusionsResponse exclusions. + * @member {Array.} exclusions + * @memberof google.logging.v2.ListExclusionsResponse + * @instance + */ + ListExclusionsResponse.prototype.exclusions = $util.emptyArray; + + /** + * ListExclusionsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.logging.v2.ListExclusionsResponse + * @instance + */ + ListExclusionsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListExclusionsResponse instance using the specified properties. + * @function create + * @memberof google.logging.v2.ListExclusionsResponse + * @static + * @param {google.logging.v2.IListExclusionsResponse=} [properties] Properties to set + * @returns {google.logging.v2.ListExclusionsResponse} ListExclusionsResponse instance + */ + ListExclusionsResponse.create = function create(properties) { + return new ListExclusionsResponse(properties); + }; + + /** + * Encodes the specified ListExclusionsResponse message. Does not implicitly {@link google.logging.v2.ListExclusionsResponse.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.ListExclusionsResponse + * @static + * @param {google.logging.v2.IListExclusionsResponse} message ListExclusionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListExclusionsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.exclusions != null && message.exclusions.length) + for (var i = 0; i < message.exclusions.length; ++i) + $root.google.logging.v2.LogExclusion.encode(message.exclusions[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListExclusionsResponse message, length delimited. Does not implicitly {@link google.logging.v2.ListExclusionsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.ListExclusionsResponse + * @static + * @param {google.logging.v2.IListExclusionsResponse} message ListExclusionsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListExclusionsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListExclusionsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.ListExclusionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.ListExclusionsResponse} ListExclusionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListExclusionsResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.ListExclusionsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.exclusions && message.exclusions.length)) + message.exclusions = []; + message.exclusions.push($root.google.logging.v2.LogExclusion.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListExclusionsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.ListExclusionsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.ListExclusionsResponse} ListExclusionsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListExclusionsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListExclusionsResponse message. + * @function verify + * @memberof google.logging.v2.ListExclusionsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListExclusionsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.exclusions != null && message.hasOwnProperty("exclusions")) { + if (!Array.isArray(message.exclusions)) + return "exclusions: array expected"; + for (var i = 0; i < message.exclusions.length; ++i) { + var error = $root.google.logging.v2.LogExclusion.verify(message.exclusions[i]); + if (error) + return "exclusions." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListExclusionsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.ListExclusionsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.ListExclusionsResponse} ListExclusionsResponse + */ + ListExclusionsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.ListExclusionsResponse) + return object; + var message = new $root.google.logging.v2.ListExclusionsResponse(); + if (object.exclusions) { + if (!Array.isArray(object.exclusions)) + throw TypeError(".google.logging.v2.ListExclusionsResponse.exclusions: array expected"); + message.exclusions = []; + for (var i = 0; i < object.exclusions.length; ++i) { + if (typeof object.exclusions[i] !== "object") + throw TypeError(".google.logging.v2.ListExclusionsResponse.exclusions: object expected"); + message.exclusions[i] = $root.google.logging.v2.LogExclusion.fromObject(object.exclusions[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListExclusionsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.ListExclusionsResponse + * @static + * @param {google.logging.v2.ListExclusionsResponse} message ListExclusionsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListExclusionsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.exclusions = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.exclusions && message.exclusions.length) { + object.exclusions = []; + for (var j = 0; j < message.exclusions.length; ++j) + object.exclusions[j] = $root.google.logging.v2.LogExclusion.toObject(message.exclusions[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListExclusionsResponse to JSON. + * @function toJSON + * @memberof google.logging.v2.ListExclusionsResponse + * @instance + * @returns {Object.} JSON object + */ + ListExclusionsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListExclusionsResponse + * @function getTypeUrl + * @memberof google.logging.v2.ListExclusionsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListExclusionsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.ListExclusionsResponse"; + }; + + return ListExclusionsResponse; + })(); + + v2.GetExclusionRequest = (function() { + + /** + * Properties of a GetExclusionRequest. + * @memberof google.logging.v2 + * @interface IGetExclusionRequest + * @property {string|null} [name] GetExclusionRequest name + */ + + /** + * Constructs a new GetExclusionRequest. + * @memberof google.logging.v2 + * @classdesc Represents a GetExclusionRequest. + * @implements IGetExclusionRequest + * @constructor + * @param {google.logging.v2.IGetExclusionRequest=} [properties] Properties to set + */ + function GetExclusionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetExclusionRequest name. + * @member {string} name + * @memberof google.logging.v2.GetExclusionRequest + * @instance + */ + GetExclusionRequest.prototype.name = ""; + + /** + * Creates a new GetExclusionRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.GetExclusionRequest + * @static + * @param {google.logging.v2.IGetExclusionRequest=} [properties] Properties to set + * @returns {google.logging.v2.GetExclusionRequest} GetExclusionRequest instance + */ + GetExclusionRequest.create = function create(properties) { + return new GetExclusionRequest(properties); + }; + + /** + * Encodes the specified GetExclusionRequest message. Does not implicitly {@link google.logging.v2.GetExclusionRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.GetExclusionRequest + * @static + * @param {google.logging.v2.IGetExclusionRequest} message GetExclusionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetExclusionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetExclusionRequest message, length delimited. Does not implicitly {@link google.logging.v2.GetExclusionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.GetExclusionRequest + * @static + * @param {google.logging.v2.IGetExclusionRequest} message GetExclusionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetExclusionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetExclusionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.GetExclusionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.GetExclusionRequest} GetExclusionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetExclusionRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.GetExclusionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetExclusionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.GetExclusionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.GetExclusionRequest} GetExclusionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetExclusionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetExclusionRequest message. + * @function verify + * @memberof google.logging.v2.GetExclusionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetExclusionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetExclusionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.GetExclusionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.GetExclusionRequest} GetExclusionRequest + */ + GetExclusionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.GetExclusionRequest) + return object; + var message = new $root.google.logging.v2.GetExclusionRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetExclusionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.GetExclusionRequest + * @static + * @param {google.logging.v2.GetExclusionRequest} message GetExclusionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetExclusionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetExclusionRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.GetExclusionRequest + * @instance + * @returns {Object.} JSON object + */ + GetExclusionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetExclusionRequest + * @function getTypeUrl + * @memberof google.logging.v2.GetExclusionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetExclusionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.GetExclusionRequest"; + }; + + return GetExclusionRequest; + })(); + + v2.CreateExclusionRequest = (function() { + + /** + * Properties of a CreateExclusionRequest. + * @memberof google.logging.v2 + * @interface ICreateExclusionRequest + * @property {string|null} [parent] CreateExclusionRequest parent + * @property {google.logging.v2.ILogExclusion|null} [exclusion] CreateExclusionRequest exclusion + */ + + /** + * Constructs a new CreateExclusionRequest. + * @memberof google.logging.v2 + * @classdesc Represents a CreateExclusionRequest. + * @implements ICreateExclusionRequest + * @constructor + * @param {google.logging.v2.ICreateExclusionRequest=} [properties] Properties to set + */ + function CreateExclusionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateExclusionRequest parent. + * @member {string} parent + * @memberof google.logging.v2.CreateExclusionRequest + * @instance + */ + CreateExclusionRequest.prototype.parent = ""; + + /** + * CreateExclusionRequest exclusion. + * @member {google.logging.v2.ILogExclusion|null|undefined} exclusion + * @memberof google.logging.v2.CreateExclusionRequest + * @instance + */ + CreateExclusionRequest.prototype.exclusion = null; + + /** + * Creates a new CreateExclusionRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.CreateExclusionRequest + * @static + * @param {google.logging.v2.ICreateExclusionRequest=} [properties] Properties to set + * @returns {google.logging.v2.CreateExclusionRequest} CreateExclusionRequest instance + */ + CreateExclusionRequest.create = function create(properties) { + return new CreateExclusionRequest(properties); + }; + + /** + * Encodes the specified CreateExclusionRequest message. Does not implicitly {@link google.logging.v2.CreateExclusionRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.CreateExclusionRequest + * @static + * @param {google.logging.v2.ICreateExclusionRequest} message CreateExclusionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateExclusionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.exclusion != null && Object.hasOwnProperty.call(message, "exclusion")) + $root.google.logging.v2.LogExclusion.encode(message.exclusion, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateExclusionRequest message, length delimited. Does not implicitly {@link google.logging.v2.CreateExclusionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.CreateExclusionRequest + * @static + * @param {google.logging.v2.ICreateExclusionRequest} message CreateExclusionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateExclusionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateExclusionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.CreateExclusionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.CreateExclusionRequest} CreateExclusionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateExclusionRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.CreateExclusionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.exclusion = $root.google.logging.v2.LogExclusion.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateExclusionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.CreateExclusionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.CreateExclusionRequest} CreateExclusionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateExclusionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateExclusionRequest message. + * @function verify + * @memberof google.logging.v2.CreateExclusionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateExclusionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.exclusion != null && message.hasOwnProperty("exclusion")) { + var error = $root.google.logging.v2.LogExclusion.verify(message.exclusion); + if (error) + return "exclusion." + error; + } + return null; + }; + + /** + * Creates a CreateExclusionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.CreateExclusionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.CreateExclusionRequest} CreateExclusionRequest + */ + CreateExclusionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.CreateExclusionRequest) + return object; + var message = new $root.google.logging.v2.CreateExclusionRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.exclusion != null) { + if (typeof object.exclusion !== "object") + throw TypeError(".google.logging.v2.CreateExclusionRequest.exclusion: object expected"); + message.exclusion = $root.google.logging.v2.LogExclusion.fromObject(object.exclusion); + } + return message; + }; + + /** + * Creates a plain object from a CreateExclusionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.CreateExclusionRequest + * @static + * @param {google.logging.v2.CreateExclusionRequest} message CreateExclusionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateExclusionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.exclusion = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.exclusion != null && message.hasOwnProperty("exclusion")) + object.exclusion = $root.google.logging.v2.LogExclusion.toObject(message.exclusion, options); + return object; + }; + + /** + * Converts this CreateExclusionRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.CreateExclusionRequest + * @instance + * @returns {Object.} JSON object + */ + CreateExclusionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateExclusionRequest + * @function getTypeUrl + * @memberof google.logging.v2.CreateExclusionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateExclusionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.CreateExclusionRequest"; + }; + + return CreateExclusionRequest; + })(); + + v2.UpdateExclusionRequest = (function() { + + /** + * Properties of an UpdateExclusionRequest. + * @memberof google.logging.v2 + * @interface IUpdateExclusionRequest + * @property {string|null} [name] UpdateExclusionRequest name + * @property {google.logging.v2.ILogExclusion|null} [exclusion] UpdateExclusionRequest exclusion + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateExclusionRequest updateMask + */ + + /** + * Constructs a new UpdateExclusionRequest. + * @memberof google.logging.v2 + * @classdesc Represents an UpdateExclusionRequest. + * @implements IUpdateExclusionRequest + * @constructor + * @param {google.logging.v2.IUpdateExclusionRequest=} [properties] Properties to set + */ + function UpdateExclusionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateExclusionRequest name. + * @member {string} name + * @memberof google.logging.v2.UpdateExclusionRequest + * @instance + */ + UpdateExclusionRequest.prototype.name = ""; + + /** + * UpdateExclusionRequest exclusion. + * @member {google.logging.v2.ILogExclusion|null|undefined} exclusion + * @memberof google.logging.v2.UpdateExclusionRequest + * @instance + */ + UpdateExclusionRequest.prototype.exclusion = null; + + /** + * UpdateExclusionRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.logging.v2.UpdateExclusionRequest + * @instance + */ + UpdateExclusionRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateExclusionRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.UpdateExclusionRequest + * @static + * @param {google.logging.v2.IUpdateExclusionRequest=} [properties] Properties to set + * @returns {google.logging.v2.UpdateExclusionRequest} UpdateExclusionRequest instance + */ + UpdateExclusionRequest.create = function create(properties) { + return new UpdateExclusionRequest(properties); + }; + + /** + * Encodes the specified UpdateExclusionRequest message. Does not implicitly {@link google.logging.v2.UpdateExclusionRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.UpdateExclusionRequest + * @static + * @param {google.logging.v2.IUpdateExclusionRequest} message UpdateExclusionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateExclusionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.exclusion != null && Object.hasOwnProperty.call(message, "exclusion")) + $root.google.logging.v2.LogExclusion.encode(message.exclusion, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateExclusionRequest message, length delimited. Does not implicitly {@link google.logging.v2.UpdateExclusionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.UpdateExclusionRequest + * @static + * @param {google.logging.v2.IUpdateExclusionRequest} message UpdateExclusionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateExclusionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateExclusionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.UpdateExclusionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.UpdateExclusionRequest} UpdateExclusionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateExclusionRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.UpdateExclusionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.exclusion = $root.google.logging.v2.LogExclusion.decode(reader, reader.uint32()); + break; + } + case 3: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateExclusionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.UpdateExclusionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.UpdateExclusionRequest} UpdateExclusionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateExclusionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateExclusionRequest message. + * @function verify + * @memberof google.logging.v2.UpdateExclusionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateExclusionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.exclusion != null && message.hasOwnProperty("exclusion")) { + var error = $root.google.logging.v2.LogExclusion.verify(message.exclusion); + if (error) + return "exclusion." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateExclusionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.UpdateExclusionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.UpdateExclusionRequest} UpdateExclusionRequest + */ + UpdateExclusionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.UpdateExclusionRequest) + return object; + var message = new $root.google.logging.v2.UpdateExclusionRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.exclusion != null) { + if (typeof object.exclusion !== "object") + throw TypeError(".google.logging.v2.UpdateExclusionRequest.exclusion: object expected"); + message.exclusion = $root.google.logging.v2.LogExclusion.fromObject(object.exclusion); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.logging.v2.UpdateExclusionRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateExclusionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.UpdateExclusionRequest + * @static + * @param {google.logging.v2.UpdateExclusionRequest} message UpdateExclusionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateExclusionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.exclusion = null; + object.updateMask = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.exclusion != null && message.hasOwnProperty("exclusion")) + object.exclusion = $root.google.logging.v2.LogExclusion.toObject(message.exclusion, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateExclusionRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.UpdateExclusionRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateExclusionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateExclusionRequest + * @function getTypeUrl + * @memberof google.logging.v2.UpdateExclusionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateExclusionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.UpdateExclusionRequest"; + }; + + return UpdateExclusionRequest; + })(); + + v2.DeleteExclusionRequest = (function() { + + /** + * Properties of a DeleteExclusionRequest. + * @memberof google.logging.v2 + * @interface IDeleteExclusionRequest + * @property {string|null} [name] DeleteExclusionRequest name + */ + + /** + * Constructs a new DeleteExclusionRequest. + * @memberof google.logging.v2 + * @classdesc Represents a DeleteExclusionRequest. + * @implements IDeleteExclusionRequest + * @constructor + * @param {google.logging.v2.IDeleteExclusionRequest=} [properties] Properties to set + */ + function DeleteExclusionRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteExclusionRequest name. + * @member {string} name + * @memberof google.logging.v2.DeleteExclusionRequest + * @instance + */ + DeleteExclusionRequest.prototype.name = ""; + + /** + * Creates a new DeleteExclusionRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.DeleteExclusionRequest + * @static + * @param {google.logging.v2.IDeleteExclusionRequest=} [properties] Properties to set + * @returns {google.logging.v2.DeleteExclusionRequest} DeleteExclusionRequest instance + */ + DeleteExclusionRequest.create = function create(properties) { + return new DeleteExclusionRequest(properties); + }; + + /** + * Encodes the specified DeleteExclusionRequest message. Does not implicitly {@link google.logging.v2.DeleteExclusionRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.DeleteExclusionRequest + * @static + * @param {google.logging.v2.IDeleteExclusionRequest} message DeleteExclusionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteExclusionRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteExclusionRequest message, length delimited. Does not implicitly {@link google.logging.v2.DeleteExclusionRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.DeleteExclusionRequest + * @static + * @param {google.logging.v2.IDeleteExclusionRequest} message DeleteExclusionRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteExclusionRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteExclusionRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.DeleteExclusionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.DeleteExclusionRequest} DeleteExclusionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteExclusionRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.DeleteExclusionRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteExclusionRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.DeleteExclusionRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.DeleteExclusionRequest} DeleteExclusionRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteExclusionRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteExclusionRequest message. + * @function verify + * @memberof google.logging.v2.DeleteExclusionRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteExclusionRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a DeleteExclusionRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.DeleteExclusionRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.DeleteExclusionRequest} DeleteExclusionRequest + */ + DeleteExclusionRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.DeleteExclusionRequest) + return object; + var message = new $root.google.logging.v2.DeleteExclusionRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteExclusionRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.DeleteExclusionRequest + * @static + * @param {google.logging.v2.DeleteExclusionRequest} message DeleteExclusionRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteExclusionRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteExclusionRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.DeleteExclusionRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteExclusionRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteExclusionRequest + * @function getTypeUrl + * @memberof google.logging.v2.DeleteExclusionRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteExclusionRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.DeleteExclusionRequest"; + }; + + return DeleteExclusionRequest; + })(); + + v2.GetCmekSettingsRequest = (function() { + + /** + * Properties of a GetCmekSettingsRequest. + * @memberof google.logging.v2 + * @interface IGetCmekSettingsRequest + * @property {string|null} [name] GetCmekSettingsRequest name + */ + + /** + * Constructs a new GetCmekSettingsRequest. + * @memberof google.logging.v2 + * @classdesc Represents a GetCmekSettingsRequest. + * @implements IGetCmekSettingsRequest + * @constructor + * @param {google.logging.v2.IGetCmekSettingsRequest=} [properties] Properties to set + */ + function GetCmekSettingsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetCmekSettingsRequest name. + * @member {string} name + * @memberof google.logging.v2.GetCmekSettingsRequest + * @instance + */ + GetCmekSettingsRequest.prototype.name = ""; + + /** + * Creates a new GetCmekSettingsRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.GetCmekSettingsRequest + * @static + * @param {google.logging.v2.IGetCmekSettingsRequest=} [properties] Properties to set + * @returns {google.logging.v2.GetCmekSettingsRequest} GetCmekSettingsRequest instance + */ + GetCmekSettingsRequest.create = function create(properties) { + return new GetCmekSettingsRequest(properties); + }; + + /** + * Encodes the specified GetCmekSettingsRequest message. Does not implicitly {@link google.logging.v2.GetCmekSettingsRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.GetCmekSettingsRequest + * @static + * @param {google.logging.v2.IGetCmekSettingsRequest} message GetCmekSettingsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetCmekSettingsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetCmekSettingsRequest message, length delimited. Does not implicitly {@link google.logging.v2.GetCmekSettingsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.GetCmekSettingsRequest + * @static + * @param {google.logging.v2.IGetCmekSettingsRequest} message GetCmekSettingsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetCmekSettingsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetCmekSettingsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.GetCmekSettingsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.GetCmekSettingsRequest} GetCmekSettingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetCmekSettingsRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.GetCmekSettingsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetCmekSettingsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.GetCmekSettingsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.GetCmekSettingsRequest} GetCmekSettingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetCmekSettingsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetCmekSettingsRequest message. + * @function verify + * @memberof google.logging.v2.GetCmekSettingsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetCmekSettingsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetCmekSettingsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.GetCmekSettingsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.GetCmekSettingsRequest} GetCmekSettingsRequest + */ + GetCmekSettingsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.GetCmekSettingsRequest) + return object; + var message = new $root.google.logging.v2.GetCmekSettingsRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetCmekSettingsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.GetCmekSettingsRequest + * @static + * @param {google.logging.v2.GetCmekSettingsRequest} message GetCmekSettingsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetCmekSettingsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetCmekSettingsRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.GetCmekSettingsRequest + * @instance + * @returns {Object.} JSON object + */ + GetCmekSettingsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetCmekSettingsRequest + * @function getTypeUrl + * @memberof google.logging.v2.GetCmekSettingsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetCmekSettingsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.GetCmekSettingsRequest"; + }; + + return GetCmekSettingsRequest; + })(); + + v2.UpdateCmekSettingsRequest = (function() { + + /** + * Properties of an UpdateCmekSettingsRequest. + * @memberof google.logging.v2 + * @interface IUpdateCmekSettingsRequest + * @property {string|null} [name] UpdateCmekSettingsRequest name + * @property {google.logging.v2.ICmekSettings|null} [cmekSettings] UpdateCmekSettingsRequest cmekSettings + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateCmekSettingsRequest updateMask + */ + + /** + * Constructs a new UpdateCmekSettingsRequest. + * @memberof google.logging.v2 + * @classdesc Represents an UpdateCmekSettingsRequest. + * @implements IUpdateCmekSettingsRequest + * @constructor + * @param {google.logging.v2.IUpdateCmekSettingsRequest=} [properties] Properties to set + */ + function UpdateCmekSettingsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateCmekSettingsRequest name. + * @member {string} name + * @memberof google.logging.v2.UpdateCmekSettingsRequest + * @instance + */ + UpdateCmekSettingsRequest.prototype.name = ""; + + /** + * UpdateCmekSettingsRequest cmekSettings. + * @member {google.logging.v2.ICmekSettings|null|undefined} cmekSettings + * @memberof google.logging.v2.UpdateCmekSettingsRequest + * @instance + */ + UpdateCmekSettingsRequest.prototype.cmekSettings = null; + + /** + * UpdateCmekSettingsRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.logging.v2.UpdateCmekSettingsRequest + * @instance + */ + UpdateCmekSettingsRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateCmekSettingsRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.UpdateCmekSettingsRequest + * @static + * @param {google.logging.v2.IUpdateCmekSettingsRequest=} [properties] Properties to set + * @returns {google.logging.v2.UpdateCmekSettingsRequest} UpdateCmekSettingsRequest instance + */ + UpdateCmekSettingsRequest.create = function create(properties) { + return new UpdateCmekSettingsRequest(properties); + }; + + /** + * Encodes the specified UpdateCmekSettingsRequest message. Does not implicitly {@link google.logging.v2.UpdateCmekSettingsRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.UpdateCmekSettingsRequest + * @static + * @param {google.logging.v2.IUpdateCmekSettingsRequest} message UpdateCmekSettingsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateCmekSettingsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.cmekSettings != null && Object.hasOwnProperty.call(message, "cmekSettings")) + $root.google.logging.v2.CmekSettings.encode(message.cmekSettings, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateCmekSettingsRequest message, length delimited. Does not implicitly {@link google.logging.v2.UpdateCmekSettingsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.UpdateCmekSettingsRequest + * @static + * @param {google.logging.v2.IUpdateCmekSettingsRequest} message UpdateCmekSettingsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateCmekSettingsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateCmekSettingsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.UpdateCmekSettingsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.UpdateCmekSettingsRequest} UpdateCmekSettingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateCmekSettingsRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.UpdateCmekSettingsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.cmekSettings = $root.google.logging.v2.CmekSettings.decode(reader, reader.uint32()); + break; + } + case 3: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateCmekSettingsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.UpdateCmekSettingsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.UpdateCmekSettingsRequest} UpdateCmekSettingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateCmekSettingsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateCmekSettingsRequest message. + * @function verify + * @memberof google.logging.v2.UpdateCmekSettingsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateCmekSettingsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.cmekSettings != null && message.hasOwnProperty("cmekSettings")) { + var error = $root.google.logging.v2.CmekSettings.verify(message.cmekSettings); + if (error) + return "cmekSettings." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateCmekSettingsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.UpdateCmekSettingsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.UpdateCmekSettingsRequest} UpdateCmekSettingsRequest + */ + UpdateCmekSettingsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.UpdateCmekSettingsRequest) + return object; + var message = new $root.google.logging.v2.UpdateCmekSettingsRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.cmekSettings != null) { + if (typeof object.cmekSettings !== "object") + throw TypeError(".google.logging.v2.UpdateCmekSettingsRequest.cmekSettings: object expected"); + message.cmekSettings = $root.google.logging.v2.CmekSettings.fromObject(object.cmekSettings); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.logging.v2.UpdateCmekSettingsRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateCmekSettingsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.UpdateCmekSettingsRequest + * @static + * @param {google.logging.v2.UpdateCmekSettingsRequest} message UpdateCmekSettingsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateCmekSettingsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.cmekSettings = null; + object.updateMask = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.cmekSettings != null && message.hasOwnProperty("cmekSettings")) + object.cmekSettings = $root.google.logging.v2.CmekSettings.toObject(message.cmekSettings, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateCmekSettingsRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.UpdateCmekSettingsRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateCmekSettingsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateCmekSettingsRequest + * @function getTypeUrl + * @memberof google.logging.v2.UpdateCmekSettingsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateCmekSettingsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.UpdateCmekSettingsRequest"; + }; + + return UpdateCmekSettingsRequest; + })(); + + v2.CmekSettings = (function() { + + /** + * Properties of a CmekSettings. + * @memberof google.logging.v2 + * @interface ICmekSettings + * @property {string|null} [name] CmekSettings name + * @property {string|null} [kmsKeyName] CmekSettings kmsKeyName + * @property {string|null} [kmsKeyVersionName] CmekSettings kmsKeyVersionName + * @property {string|null} [serviceAccountId] CmekSettings serviceAccountId + */ + + /** + * Constructs a new CmekSettings. + * @memberof google.logging.v2 + * @classdesc Represents a CmekSettings. + * @implements ICmekSettings + * @constructor + * @param {google.logging.v2.ICmekSettings=} [properties] Properties to set + */ + function CmekSettings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CmekSettings name. + * @member {string} name + * @memberof google.logging.v2.CmekSettings + * @instance + */ + CmekSettings.prototype.name = ""; + + /** + * CmekSettings kmsKeyName. + * @member {string} kmsKeyName + * @memberof google.logging.v2.CmekSettings + * @instance + */ + CmekSettings.prototype.kmsKeyName = ""; + + /** + * CmekSettings kmsKeyVersionName. + * @member {string} kmsKeyVersionName + * @memberof google.logging.v2.CmekSettings + * @instance + */ + CmekSettings.prototype.kmsKeyVersionName = ""; + + /** + * CmekSettings serviceAccountId. + * @member {string} serviceAccountId + * @memberof google.logging.v2.CmekSettings + * @instance + */ + CmekSettings.prototype.serviceAccountId = ""; + + /** + * Creates a new CmekSettings instance using the specified properties. + * @function create + * @memberof google.logging.v2.CmekSettings + * @static + * @param {google.logging.v2.ICmekSettings=} [properties] Properties to set + * @returns {google.logging.v2.CmekSettings} CmekSettings instance + */ + CmekSettings.create = function create(properties) { + return new CmekSettings(properties); + }; + + /** + * Encodes the specified CmekSettings message. Does not implicitly {@link google.logging.v2.CmekSettings.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.CmekSettings + * @static + * @param {google.logging.v2.ICmekSettings} message CmekSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CmekSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.kmsKeyName != null && Object.hasOwnProperty.call(message, "kmsKeyName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.kmsKeyName); + if (message.serviceAccountId != null && Object.hasOwnProperty.call(message, "serviceAccountId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.serviceAccountId); + if (message.kmsKeyVersionName != null && Object.hasOwnProperty.call(message, "kmsKeyVersionName")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.kmsKeyVersionName); + return writer; + }; + + /** + * Encodes the specified CmekSettings message, length delimited. Does not implicitly {@link google.logging.v2.CmekSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.CmekSettings + * @static + * @param {google.logging.v2.ICmekSettings} message CmekSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CmekSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CmekSettings message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.CmekSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.CmekSettings} CmekSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CmekSettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.CmekSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.kmsKeyName = reader.string(); + break; + } + case 4: { + message.kmsKeyVersionName = reader.string(); + break; + } + case 3: { + message.serviceAccountId = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CmekSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.CmekSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.CmekSettings} CmekSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CmekSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CmekSettings message. + * @function verify + * @memberof google.logging.v2.CmekSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CmekSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) + if (!$util.isString(message.kmsKeyName)) + return "kmsKeyName: string expected"; + if (message.kmsKeyVersionName != null && message.hasOwnProperty("kmsKeyVersionName")) + if (!$util.isString(message.kmsKeyVersionName)) + return "kmsKeyVersionName: string expected"; + if (message.serviceAccountId != null && message.hasOwnProperty("serviceAccountId")) + if (!$util.isString(message.serviceAccountId)) + return "serviceAccountId: string expected"; + return null; + }; + + /** + * Creates a CmekSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.CmekSettings + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.CmekSettings} CmekSettings + */ + CmekSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.CmekSettings) + return object; + var message = new $root.google.logging.v2.CmekSettings(); + if (object.name != null) + message.name = String(object.name); + if (object.kmsKeyName != null) + message.kmsKeyName = String(object.kmsKeyName); + if (object.kmsKeyVersionName != null) + message.kmsKeyVersionName = String(object.kmsKeyVersionName); + if (object.serviceAccountId != null) + message.serviceAccountId = String(object.serviceAccountId); + return message; + }; + + /** + * Creates a plain object from a CmekSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.CmekSettings + * @static + * @param {google.logging.v2.CmekSettings} message CmekSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CmekSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.kmsKeyName = ""; + object.serviceAccountId = ""; + object.kmsKeyVersionName = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) + object.kmsKeyName = message.kmsKeyName; + if (message.serviceAccountId != null && message.hasOwnProperty("serviceAccountId")) + object.serviceAccountId = message.serviceAccountId; + if (message.kmsKeyVersionName != null && message.hasOwnProperty("kmsKeyVersionName")) + object.kmsKeyVersionName = message.kmsKeyVersionName; + return object; + }; + + /** + * Converts this CmekSettings to JSON. + * @function toJSON + * @memberof google.logging.v2.CmekSettings + * @instance + * @returns {Object.} JSON object + */ + CmekSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CmekSettings + * @function getTypeUrl + * @memberof google.logging.v2.CmekSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CmekSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.CmekSettings"; + }; + + return CmekSettings; + })(); + + v2.GetSettingsRequest = (function() { + + /** + * Properties of a GetSettingsRequest. + * @memberof google.logging.v2 + * @interface IGetSettingsRequest + * @property {string|null} [name] GetSettingsRequest name + */ + + /** + * Constructs a new GetSettingsRequest. + * @memberof google.logging.v2 + * @classdesc Represents a GetSettingsRequest. + * @implements IGetSettingsRequest + * @constructor + * @param {google.logging.v2.IGetSettingsRequest=} [properties] Properties to set + */ + function GetSettingsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetSettingsRequest name. + * @member {string} name + * @memberof google.logging.v2.GetSettingsRequest + * @instance + */ + GetSettingsRequest.prototype.name = ""; + + /** + * Creates a new GetSettingsRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.GetSettingsRequest + * @static + * @param {google.logging.v2.IGetSettingsRequest=} [properties] Properties to set + * @returns {google.logging.v2.GetSettingsRequest} GetSettingsRequest instance + */ + GetSettingsRequest.create = function create(properties) { + return new GetSettingsRequest(properties); + }; + + /** + * Encodes the specified GetSettingsRequest message. Does not implicitly {@link google.logging.v2.GetSettingsRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.GetSettingsRequest + * @static + * @param {google.logging.v2.IGetSettingsRequest} message GetSettingsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetSettingsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetSettingsRequest message, length delimited. Does not implicitly {@link google.logging.v2.GetSettingsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.GetSettingsRequest + * @static + * @param {google.logging.v2.IGetSettingsRequest} message GetSettingsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetSettingsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetSettingsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.GetSettingsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.GetSettingsRequest} GetSettingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetSettingsRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.GetSettingsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetSettingsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.GetSettingsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.GetSettingsRequest} GetSettingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetSettingsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetSettingsRequest message. + * @function verify + * @memberof google.logging.v2.GetSettingsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetSettingsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetSettingsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.GetSettingsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.GetSettingsRequest} GetSettingsRequest + */ + GetSettingsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.GetSettingsRequest) + return object; + var message = new $root.google.logging.v2.GetSettingsRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetSettingsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.GetSettingsRequest + * @static + * @param {google.logging.v2.GetSettingsRequest} message GetSettingsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetSettingsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetSettingsRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.GetSettingsRequest + * @instance + * @returns {Object.} JSON object + */ + GetSettingsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetSettingsRequest + * @function getTypeUrl + * @memberof google.logging.v2.GetSettingsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetSettingsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.GetSettingsRequest"; + }; + + return GetSettingsRequest; + })(); + + v2.UpdateSettingsRequest = (function() { + + /** + * Properties of an UpdateSettingsRequest. + * @memberof google.logging.v2 + * @interface IUpdateSettingsRequest + * @property {string|null} [name] UpdateSettingsRequest name + * @property {google.logging.v2.ISettings|null} [settings] UpdateSettingsRequest settings + * @property {google.protobuf.IFieldMask|null} [updateMask] UpdateSettingsRequest updateMask + */ + + /** + * Constructs a new UpdateSettingsRequest. + * @memberof google.logging.v2 + * @classdesc Represents an UpdateSettingsRequest. + * @implements IUpdateSettingsRequest + * @constructor + * @param {google.logging.v2.IUpdateSettingsRequest=} [properties] Properties to set + */ + function UpdateSettingsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateSettingsRequest name. + * @member {string} name + * @memberof google.logging.v2.UpdateSettingsRequest + * @instance + */ + UpdateSettingsRequest.prototype.name = ""; + + /** + * UpdateSettingsRequest settings. + * @member {google.logging.v2.ISettings|null|undefined} settings + * @memberof google.logging.v2.UpdateSettingsRequest + * @instance + */ + UpdateSettingsRequest.prototype.settings = null; + + /** + * UpdateSettingsRequest updateMask. + * @member {google.protobuf.IFieldMask|null|undefined} updateMask + * @memberof google.logging.v2.UpdateSettingsRequest + * @instance + */ + UpdateSettingsRequest.prototype.updateMask = null; + + /** + * Creates a new UpdateSettingsRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.UpdateSettingsRequest + * @static + * @param {google.logging.v2.IUpdateSettingsRequest=} [properties] Properties to set + * @returns {google.logging.v2.UpdateSettingsRequest} UpdateSettingsRequest instance + */ + UpdateSettingsRequest.create = function create(properties) { + return new UpdateSettingsRequest(properties); + }; + + /** + * Encodes the specified UpdateSettingsRequest message. Does not implicitly {@link google.logging.v2.UpdateSettingsRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.UpdateSettingsRequest + * @static + * @param {google.logging.v2.IUpdateSettingsRequest} message UpdateSettingsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateSettingsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.settings != null && Object.hasOwnProperty.call(message, "settings")) + $root.google.logging.v2.Settings.encode(message.settings, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.updateMask != null && Object.hasOwnProperty.call(message, "updateMask")) + $root.google.protobuf.FieldMask.encode(message.updateMask, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateSettingsRequest message, length delimited. Does not implicitly {@link google.logging.v2.UpdateSettingsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.UpdateSettingsRequest + * @static + * @param {google.logging.v2.IUpdateSettingsRequest} message UpdateSettingsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateSettingsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateSettingsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.UpdateSettingsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.UpdateSettingsRequest} UpdateSettingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateSettingsRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.UpdateSettingsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.settings = $root.google.logging.v2.Settings.decode(reader, reader.uint32()); + break; + } + case 3: { + message.updateMask = $root.google.protobuf.FieldMask.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateSettingsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.UpdateSettingsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.UpdateSettingsRequest} UpdateSettingsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateSettingsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateSettingsRequest message. + * @function verify + * @memberof google.logging.v2.UpdateSettingsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateSettingsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.settings != null && message.hasOwnProperty("settings")) { + var error = $root.google.logging.v2.Settings.verify(message.settings); + if (error) + return "settings." + error; + } + if (message.updateMask != null && message.hasOwnProperty("updateMask")) { + var error = $root.google.protobuf.FieldMask.verify(message.updateMask); + if (error) + return "updateMask." + error; + } + return null; + }; + + /** + * Creates an UpdateSettingsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.UpdateSettingsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.UpdateSettingsRequest} UpdateSettingsRequest + */ + UpdateSettingsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.UpdateSettingsRequest) + return object; + var message = new $root.google.logging.v2.UpdateSettingsRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.settings != null) { + if (typeof object.settings !== "object") + throw TypeError(".google.logging.v2.UpdateSettingsRequest.settings: object expected"); + message.settings = $root.google.logging.v2.Settings.fromObject(object.settings); + } + if (object.updateMask != null) { + if (typeof object.updateMask !== "object") + throw TypeError(".google.logging.v2.UpdateSettingsRequest.updateMask: object expected"); + message.updateMask = $root.google.protobuf.FieldMask.fromObject(object.updateMask); + } + return message; + }; + + /** + * Creates a plain object from an UpdateSettingsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.UpdateSettingsRequest + * @static + * @param {google.logging.v2.UpdateSettingsRequest} message UpdateSettingsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateSettingsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.settings = null; + object.updateMask = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.settings != null && message.hasOwnProperty("settings")) + object.settings = $root.google.logging.v2.Settings.toObject(message.settings, options); + if (message.updateMask != null && message.hasOwnProperty("updateMask")) + object.updateMask = $root.google.protobuf.FieldMask.toObject(message.updateMask, options); + return object; + }; + + /** + * Converts this UpdateSettingsRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.UpdateSettingsRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateSettingsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateSettingsRequest + * @function getTypeUrl + * @memberof google.logging.v2.UpdateSettingsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateSettingsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.UpdateSettingsRequest"; + }; + + return UpdateSettingsRequest; + })(); + + v2.Settings = (function() { + + /** + * Properties of a Settings. + * @memberof google.logging.v2 + * @interface ISettings + * @property {string|null} [name] Settings name + * @property {string|null} [kmsKeyName] Settings kmsKeyName + * @property {string|null} [kmsServiceAccountId] Settings kmsServiceAccountId + * @property {string|null} [storageLocation] Settings storageLocation + * @property {boolean|null} [disableDefaultSink] Settings disableDefaultSink + */ + + /** + * Constructs a new Settings. + * @memberof google.logging.v2 + * @classdesc Represents a Settings. + * @implements ISettings + * @constructor + * @param {google.logging.v2.ISettings=} [properties] Properties to set + */ + function Settings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Settings name. + * @member {string} name + * @memberof google.logging.v2.Settings + * @instance + */ + Settings.prototype.name = ""; + + /** + * Settings kmsKeyName. + * @member {string} kmsKeyName + * @memberof google.logging.v2.Settings + * @instance + */ + Settings.prototype.kmsKeyName = ""; + + /** + * Settings kmsServiceAccountId. + * @member {string} kmsServiceAccountId + * @memberof google.logging.v2.Settings + * @instance + */ + Settings.prototype.kmsServiceAccountId = ""; + + /** + * Settings storageLocation. + * @member {string} storageLocation + * @memberof google.logging.v2.Settings + * @instance + */ + Settings.prototype.storageLocation = ""; + + /** + * Settings disableDefaultSink. + * @member {boolean} disableDefaultSink + * @memberof google.logging.v2.Settings + * @instance + */ + Settings.prototype.disableDefaultSink = false; + + /** + * Creates a new Settings instance using the specified properties. + * @function create + * @memberof google.logging.v2.Settings + * @static + * @param {google.logging.v2.ISettings=} [properties] Properties to set + * @returns {google.logging.v2.Settings} Settings instance + */ + Settings.create = function create(properties) { + return new Settings(properties); + }; + + /** + * Encodes the specified Settings message. Does not implicitly {@link google.logging.v2.Settings.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.Settings + * @static + * @param {google.logging.v2.ISettings} message Settings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Settings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.kmsKeyName != null && Object.hasOwnProperty.call(message, "kmsKeyName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.kmsKeyName); + if (message.kmsServiceAccountId != null && Object.hasOwnProperty.call(message, "kmsServiceAccountId")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.kmsServiceAccountId); + if (message.storageLocation != null && Object.hasOwnProperty.call(message, "storageLocation")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.storageLocation); + if (message.disableDefaultSink != null && Object.hasOwnProperty.call(message, "disableDefaultSink")) + writer.uint32(/* id 5, wireType 0 =*/40).bool(message.disableDefaultSink); + return writer; + }; + + /** + * Encodes the specified Settings message, length delimited. Does not implicitly {@link google.logging.v2.Settings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.Settings + * @static + * @param {google.logging.v2.ISettings} message Settings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Settings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Settings message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.Settings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.Settings} Settings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Settings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.Settings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.kmsKeyName = reader.string(); + break; + } + case 3: { + message.kmsServiceAccountId = reader.string(); + break; + } + case 4: { + message.storageLocation = reader.string(); + break; + } + case 5: { + message.disableDefaultSink = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Settings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.Settings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.Settings} Settings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Settings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Settings message. + * @function verify + * @memberof google.logging.v2.Settings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Settings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) + if (!$util.isString(message.kmsKeyName)) + return "kmsKeyName: string expected"; + if (message.kmsServiceAccountId != null && message.hasOwnProperty("kmsServiceAccountId")) + if (!$util.isString(message.kmsServiceAccountId)) + return "kmsServiceAccountId: string expected"; + if (message.storageLocation != null && message.hasOwnProperty("storageLocation")) + if (!$util.isString(message.storageLocation)) + return "storageLocation: string expected"; + if (message.disableDefaultSink != null && message.hasOwnProperty("disableDefaultSink")) + if (typeof message.disableDefaultSink !== "boolean") + return "disableDefaultSink: boolean expected"; + return null; + }; + + /** + * Creates a Settings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.Settings + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.Settings} Settings + */ + Settings.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.Settings) + return object; + var message = new $root.google.logging.v2.Settings(); + if (object.name != null) + message.name = String(object.name); + if (object.kmsKeyName != null) + message.kmsKeyName = String(object.kmsKeyName); + if (object.kmsServiceAccountId != null) + message.kmsServiceAccountId = String(object.kmsServiceAccountId); + if (object.storageLocation != null) + message.storageLocation = String(object.storageLocation); + if (object.disableDefaultSink != null) + message.disableDefaultSink = Boolean(object.disableDefaultSink); + return message; + }; + + /** + * Creates a plain object from a Settings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.Settings + * @static + * @param {google.logging.v2.Settings} message Settings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Settings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.kmsKeyName = ""; + object.kmsServiceAccountId = ""; + object.storageLocation = ""; + object.disableDefaultSink = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.kmsKeyName != null && message.hasOwnProperty("kmsKeyName")) + object.kmsKeyName = message.kmsKeyName; + if (message.kmsServiceAccountId != null && message.hasOwnProperty("kmsServiceAccountId")) + object.kmsServiceAccountId = message.kmsServiceAccountId; + if (message.storageLocation != null && message.hasOwnProperty("storageLocation")) + object.storageLocation = message.storageLocation; + if (message.disableDefaultSink != null && message.hasOwnProperty("disableDefaultSink")) + object.disableDefaultSink = message.disableDefaultSink; + return object; + }; + + /** + * Converts this Settings to JSON. + * @function toJSON + * @memberof google.logging.v2.Settings + * @instance + * @returns {Object.} JSON object + */ + Settings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Settings + * @function getTypeUrl + * @memberof google.logging.v2.Settings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Settings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.Settings"; + }; + + return Settings; + })(); + + v2.CopyLogEntriesRequest = (function() { + + /** + * Properties of a CopyLogEntriesRequest. + * @memberof google.logging.v2 + * @interface ICopyLogEntriesRequest + * @property {string|null} [name] CopyLogEntriesRequest name + * @property {string|null} [filter] CopyLogEntriesRequest filter + * @property {string|null} [destination] CopyLogEntriesRequest destination + */ + + /** + * Constructs a new CopyLogEntriesRequest. + * @memberof google.logging.v2 + * @classdesc Represents a CopyLogEntriesRequest. + * @implements ICopyLogEntriesRequest + * @constructor + * @param {google.logging.v2.ICopyLogEntriesRequest=} [properties] Properties to set + */ + function CopyLogEntriesRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CopyLogEntriesRequest name. + * @member {string} name + * @memberof google.logging.v2.CopyLogEntriesRequest + * @instance + */ + CopyLogEntriesRequest.prototype.name = ""; + + /** + * CopyLogEntriesRequest filter. + * @member {string} filter + * @memberof google.logging.v2.CopyLogEntriesRequest + * @instance + */ + CopyLogEntriesRequest.prototype.filter = ""; + + /** + * CopyLogEntriesRequest destination. + * @member {string} destination + * @memberof google.logging.v2.CopyLogEntriesRequest + * @instance + */ + CopyLogEntriesRequest.prototype.destination = ""; + + /** + * Creates a new CopyLogEntriesRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.CopyLogEntriesRequest + * @static + * @param {google.logging.v2.ICopyLogEntriesRequest=} [properties] Properties to set + * @returns {google.logging.v2.CopyLogEntriesRequest} CopyLogEntriesRequest instance + */ + CopyLogEntriesRequest.create = function create(properties) { + return new CopyLogEntriesRequest(properties); + }; + + /** + * Encodes the specified CopyLogEntriesRequest message. Does not implicitly {@link google.logging.v2.CopyLogEntriesRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.CopyLogEntriesRequest + * @static + * @param {google.logging.v2.ICopyLogEntriesRequest} message CopyLogEntriesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CopyLogEntriesRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.filter); + if (message.destination != null && Object.hasOwnProperty.call(message, "destination")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.destination); + return writer; + }; + + /** + * Encodes the specified CopyLogEntriesRequest message, length delimited. Does not implicitly {@link google.logging.v2.CopyLogEntriesRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.CopyLogEntriesRequest + * @static + * @param {google.logging.v2.ICopyLogEntriesRequest} message CopyLogEntriesRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CopyLogEntriesRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CopyLogEntriesRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.CopyLogEntriesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.CopyLogEntriesRequest} CopyLogEntriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CopyLogEntriesRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.CopyLogEntriesRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 3: { + message.filter = reader.string(); + break; + } + case 4: { + message.destination = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CopyLogEntriesRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.CopyLogEntriesRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.CopyLogEntriesRequest} CopyLogEntriesRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CopyLogEntriesRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CopyLogEntriesRequest message. + * @function verify + * @memberof google.logging.v2.CopyLogEntriesRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CopyLogEntriesRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.destination != null && message.hasOwnProperty("destination")) + if (!$util.isString(message.destination)) + return "destination: string expected"; + return null; + }; + + /** + * Creates a CopyLogEntriesRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.CopyLogEntriesRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.CopyLogEntriesRequest} CopyLogEntriesRequest + */ + CopyLogEntriesRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.CopyLogEntriesRequest) + return object; + var message = new $root.google.logging.v2.CopyLogEntriesRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.filter != null) + message.filter = String(object.filter); + if (object.destination != null) + message.destination = String(object.destination); + return message; + }; + + /** + * Creates a plain object from a CopyLogEntriesRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.CopyLogEntriesRequest + * @static + * @param {google.logging.v2.CopyLogEntriesRequest} message CopyLogEntriesRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CopyLogEntriesRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.filter = ""; + object.destination = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.destination != null && message.hasOwnProperty("destination")) + object.destination = message.destination; + return object; + }; + + /** + * Converts this CopyLogEntriesRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.CopyLogEntriesRequest + * @instance + * @returns {Object.} JSON object + */ + CopyLogEntriesRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CopyLogEntriesRequest + * @function getTypeUrl + * @memberof google.logging.v2.CopyLogEntriesRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CopyLogEntriesRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.CopyLogEntriesRequest"; + }; + + return CopyLogEntriesRequest; + })(); + + v2.CopyLogEntriesMetadata = (function() { + + /** + * Properties of a CopyLogEntriesMetadata. + * @memberof google.logging.v2 + * @interface ICopyLogEntriesMetadata + * @property {google.protobuf.ITimestamp|null} [startTime] CopyLogEntriesMetadata startTime + * @property {google.protobuf.ITimestamp|null} [endTime] CopyLogEntriesMetadata endTime + * @property {google.logging.v2.OperationState|null} [state] CopyLogEntriesMetadata state + * @property {boolean|null} [cancellationRequested] CopyLogEntriesMetadata cancellationRequested + * @property {google.logging.v2.ICopyLogEntriesRequest|null} [request] CopyLogEntriesMetadata request + * @property {number|null} [progress] CopyLogEntriesMetadata progress + * @property {string|null} [writerIdentity] CopyLogEntriesMetadata writerIdentity + */ + + /** + * Constructs a new CopyLogEntriesMetadata. + * @memberof google.logging.v2 + * @classdesc Represents a CopyLogEntriesMetadata. + * @implements ICopyLogEntriesMetadata + * @constructor + * @param {google.logging.v2.ICopyLogEntriesMetadata=} [properties] Properties to set + */ + function CopyLogEntriesMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CopyLogEntriesMetadata startTime. + * @member {google.protobuf.ITimestamp|null|undefined} startTime + * @memberof google.logging.v2.CopyLogEntriesMetadata + * @instance + */ + CopyLogEntriesMetadata.prototype.startTime = null; + + /** + * CopyLogEntriesMetadata endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.logging.v2.CopyLogEntriesMetadata + * @instance + */ + CopyLogEntriesMetadata.prototype.endTime = null; + + /** + * CopyLogEntriesMetadata state. + * @member {google.logging.v2.OperationState} state + * @memberof google.logging.v2.CopyLogEntriesMetadata + * @instance + */ + CopyLogEntriesMetadata.prototype.state = 0; + + /** + * CopyLogEntriesMetadata cancellationRequested. + * @member {boolean} cancellationRequested + * @memberof google.logging.v2.CopyLogEntriesMetadata + * @instance + */ + CopyLogEntriesMetadata.prototype.cancellationRequested = false; + + /** + * CopyLogEntriesMetadata request. + * @member {google.logging.v2.ICopyLogEntriesRequest|null|undefined} request + * @memberof google.logging.v2.CopyLogEntriesMetadata + * @instance + */ + CopyLogEntriesMetadata.prototype.request = null; + + /** + * CopyLogEntriesMetadata progress. + * @member {number} progress + * @memberof google.logging.v2.CopyLogEntriesMetadata + * @instance + */ + CopyLogEntriesMetadata.prototype.progress = 0; + + /** + * CopyLogEntriesMetadata writerIdentity. + * @member {string} writerIdentity + * @memberof google.logging.v2.CopyLogEntriesMetadata + * @instance + */ + CopyLogEntriesMetadata.prototype.writerIdentity = ""; + + /** + * Creates a new CopyLogEntriesMetadata instance using the specified properties. + * @function create + * @memberof google.logging.v2.CopyLogEntriesMetadata + * @static + * @param {google.logging.v2.ICopyLogEntriesMetadata=} [properties] Properties to set + * @returns {google.logging.v2.CopyLogEntriesMetadata} CopyLogEntriesMetadata instance + */ + CopyLogEntriesMetadata.create = function create(properties) { + return new CopyLogEntriesMetadata(properties); + }; + + /** + * Encodes the specified CopyLogEntriesMetadata message. Does not implicitly {@link google.logging.v2.CopyLogEntriesMetadata.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.CopyLogEntriesMetadata + * @static + * @param {google.logging.v2.ICopyLogEntriesMetadata} message CopyLogEntriesMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CopyLogEntriesMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.state); + if (message.cancellationRequested != null && Object.hasOwnProperty.call(message, "cancellationRequested")) + writer.uint32(/* id 4, wireType 0 =*/32).bool(message.cancellationRequested); + if (message.request != null && Object.hasOwnProperty.call(message, "request")) + $root.google.logging.v2.CopyLogEntriesRequest.encode(message.request, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.progress != null && Object.hasOwnProperty.call(message, "progress")) + writer.uint32(/* id 6, wireType 0 =*/48).int32(message.progress); + if (message.writerIdentity != null && Object.hasOwnProperty.call(message, "writerIdentity")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.writerIdentity); + return writer; + }; + + /** + * Encodes the specified CopyLogEntriesMetadata message, length delimited. Does not implicitly {@link google.logging.v2.CopyLogEntriesMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.CopyLogEntriesMetadata + * @static + * @param {google.logging.v2.ICopyLogEntriesMetadata} message CopyLogEntriesMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CopyLogEntriesMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CopyLogEntriesMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.CopyLogEntriesMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.CopyLogEntriesMetadata} CopyLogEntriesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CopyLogEntriesMetadata.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.CopyLogEntriesMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 2: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.state = reader.int32(); + break; + } + case 4: { + message.cancellationRequested = reader.bool(); + break; + } + case 5: { + message.request = $root.google.logging.v2.CopyLogEntriesRequest.decode(reader, reader.uint32()); + break; + } + case 6: { + message.progress = reader.int32(); + break; + } + case 7: { + message.writerIdentity = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CopyLogEntriesMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.CopyLogEntriesMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.CopyLogEntriesMetadata} CopyLogEntriesMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CopyLogEntriesMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CopyLogEntriesMetadata message. + * @function verify + * @memberof google.logging.v2.CopyLogEntriesMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CopyLogEntriesMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.startTime != null && message.hasOwnProperty("startTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.startTime); + if (error) + return "startTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.cancellationRequested != null && message.hasOwnProperty("cancellationRequested")) + if (typeof message.cancellationRequested !== "boolean") + return "cancellationRequested: boolean expected"; + if (message.request != null && message.hasOwnProperty("request")) { + var error = $root.google.logging.v2.CopyLogEntriesRequest.verify(message.request); + if (error) + return "request." + error; + } + if (message.progress != null && message.hasOwnProperty("progress")) + if (!$util.isInteger(message.progress)) + return "progress: integer expected"; + if (message.writerIdentity != null && message.hasOwnProperty("writerIdentity")) + if (!$util.isString(message.writerIdentity)) + return "writerIdentity: string expected"; + return null; + }; + + /** + * Creates a CopyLogEntriesMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.CopyLogEntriesMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.CopyLogEntriesMetadata} CopyLogEntriesMetadata + */ + CopyLogEntriesMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.CopyLogEntriesMetadata) + return object; + var message = new $root.google.logging.v2.CopyLogEntriesMetadata(); + if (object.startTime != null) { + if (typeof object.startTime !== "object") + throw TypeError(".google.logging.v2.CopyLogEntriesMetadata.startTime: object expected"); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.logging.v2.CopyLogEntriesMetadata.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + case "OPERATION_STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "OPERATION_STATE_SCHEDULED": + case 1: + message.state = 1; + break; + case "OPERATION_STATE_WAITING_FOR_PERMISSIONS": + case 2: + message.state = 2; + break; + case "OPERATION_STATE_RUNNING": + case 3: + message.state = 3; + break; + case "OPERATION_STATE_SUCCEEDED": + case 4: + message.state = 4; + break; + case "OPERATION_STATE_FAILED": + case 5: + message.state = 5; + break; + case "OPERATION_STATE_CANCELLED": + case 6: + message.state = 6; + break; + } + if (object.cancellationRequested != null) + message.cancellationRequested = Boolean(object.cancellationRequested); + if (object.request != null) { + if (typeof object.request !== "object") + throw TypeError(".google.logging.v2.CopyLogEntriesMetadata.request: object expected"); + message.request = $root.google.logging.v2.CopyLogEntriesRequest.fromObject(object.request); + } + if (object.progress != null) + message.progress = object.progress | 0; + if (object.writerIdentity != null) + message.writerIdentity = String(object.writerIdentity); + return message; + }; + + /** + * Creates a plain object from a CopyLogEntriesMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.CopyLogEntriesMetadata + * @static + * @param {google.logging.v2.CopyLogEntriesMetadata} message CopyLogEntriesMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CopyLogEntriesMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.startTime = null; + object.endTime = null; + object.state = options.enums === String ? "OPERATION_STATE_UNSPECIFIED" : 0; + object.cancellationRequested = false; + object.request = null; + object.progress = 0; + object.writerIdentity = ""; + } + if (message.startTime != null && message.hasOwnProperty("startTime")) + object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.logging.v2.OperationState[message.state] === undefined ? message.state : $root.google.logging.v2.OperationState[message.state] : message.state; + if (message.cancellationRequested != null && message.hasOwnProperty("cancellationRequested")) + object.cancellationRequested = message.cancellationRequested; + if (message.request != null && message.hasOwnProperty("request")) + object.request = $root.google.logging.v2.CopyLogEntriesRequest.toObject(message.request, options); + if (message.progress != null && message.hasOwnProperty("progress")) + object.progress = message.progress; + if (message.writerIdentity != null && message.hasOwnProperty("writerIdentity")) + object.writerIdentity = message.writerIdentity; + return object; + }; + + /** + * Converts this CopyLogEntriesMetadata to JSON. + * @function toJSON + * @memberof google.logging.v2.CopyLogEntriesMetadata + * @instance + * @returns {Object.} JSON object + */ + CopyLogEntriesMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CopyLogEntriesMetadata + * @function getTypeUrl + * @memberof google.logging.v2.CopyLogEntriesMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CopyLogEntriesMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.CopyLogEntriesMetadata"; + }; + + return CopyLogEntriesMetadata; + })(); + + v2.CopyLogEntriesResponse = (function() { + + /** + * Properties of a CopyLogEntriesResponse. + * @memberof google.logging.v2 + * @interface ICopyLogEntriesResponse + * @property {number|Long|null} [logEntriesCopiedCount] CopyLogEntriesResponse logEntriesCopiedCount + */ + + /** + * Constructs a new CopyLogEntriesResponse. + * @memberof google.logging.v2 + * @classdesc Represents a CopyLogEntriesResponse. + * @implements ICopyLogEntriesResponse + * @constructor + * @param {google.logging.v2.ICopyLogEntriesResponse=} [properties] Properties to set + */ + function CopyLogEntriesResponse(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CopyLogEntriesResponse logEntriesCopiedCount. + * @member {number|Long} logEntriesCopiedCount + * @memberof google.logging.v2.CopyLogEntriesResponse + * @instance + */ + CopyLogEntriesResponse.prototype.logEntriesCopiedCount = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Creates a new CopyLogEntriesResponse instance using the specified properties. + * @function create + * @memberof google.logging.v2.CopyLogEntriesResponse + * @static + * @param {google.logging.v2.ICopyLogEntriesResponse=} [properties] Properties to set + * @returns {google.logging.v2.CopyLogEntriesResponse} CopyLogEntriesResponse instance + */ + CopyLogEntriesResponse.create = function create(properties) { + return new CopyLogEntriesResponse(properties); + }; + + /** + * Encodes the specified CopyLogEntriesResponse message. Does not implicitly {@link google.logging.v2.CopyLogEntriesResponse.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.CopyLogEntriesResponse + * @static + * @param {google.logging.v2.ICopyLogEntriesResponse} message CopyLogEntriesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CopyLogEntriesResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.logEntriesCopiedCount != null && Object.hasOwnProperty.call(message, "logEntriesCopiedCount")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.logEntriesCopiedCount); + return writer; + }; + + /** + * Encodes the specified CopyLogEntriesResponse message, length delimited. Does not implicitly {@link google.logging.v2.CopyLogEntriesResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.CopyLogEntriesResponse + * @static + * @param {google.logging.v2.ICopyLogEntriesResponse} message CopyLogEntriesResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CopyLogEntriesResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CopyLogEntriesResponse message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.CopyLogEntriesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.CopyLogEntriesResponse} CopyLogEntriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CopyLogEntriesResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.CopyLogEntriesResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.logEntriesCopiedCount = reader.int64(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CopyLogEntriesResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.CopyLogEntriesResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.CopyLogEntriesResponse} CopyLogEntriesResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CopyLogEntriesResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CopyLogEntriesResponse message. + * @function verify + * @memberof google.logging.v2.CopyLogEntriesResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CopyLogEntriesResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.logEntriesCopiedCount != null && message.hasOwnProperty("logEntriesCopiedCount")) + if (!$util.isInteger(message.logEntriesCopiedCount) && !(message.logEntriesCopiedCount && $util.isInteger(message.logEntriesCopiedCount.low) && $util.isInteger(message.logEntriesCopiedCount.high))) + return "logEntriesCopiedCount: integer|Long expected"; + return null; + }; + + /** + * Creates a CopyLogEntriesResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.CopyLogEntriesResponse + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.CopyLogEntriesResponse} CopyLogEntriesResponse + */ + CopyLogEntriesResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.CopyLogEntriesResponse) + return object; + var message = new $root.google.logging.v2.CopyLogEntriesResponse(); + if (object.logEntriesCopiedCount != null) + if ($util.Long) + (message.logEntriesCopiedCount = $util.Long.fromValue(object.logEntriesCopiedCount)).unsigned = false; + else if (typeof object.logEntriesCopiedCount === "string") + message.logEntriesCopiedCount = parseInt(object.logEntriesCopiedCount, 10); + else if (typeof object.logEntriesCopiedCount === "number") + message.logEntriesCopiedCount = object.logEntriesCopiedCount; + else if (typeof object.logEntriesCopiedCount === "object") + message.logEntriesCopiedCount = new $util.LongBits(object.logEntriesCopiedCount.low >>> 0, object.logEntriesCopiedCount.high >>> 0).toNumber(); + return message; + }; + + /** + * Creates a plain object from a CopyLogEntriesResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.CopyLogEntriesResponse + * @static + * @param {google.logging.v2.CopyLogEntriesResponse} message CopyLogEntriesResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CopyLogEntriesResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.logEntriesCopiedCount = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.logEntriesCopiedCount = options.longs === String ? "0" : 0; + if (message.logEntriesCopiedCount != null && message.hasOwnProperty("logEntriesCopiedCount")) + if (typeof message.logEntriesCopiedCount === "number") + object.logEntriesCopiedCount = options.longs === String ? String(message.logEntriesCopiedCount) : message.logEntriesCopiedCount; + else + object.logEntriesCopiedCount = options.longs === String ? $util.Long.prototype.toString.call(message.logEntriesCopiedCount) : options.longs === Number ? new $util.LongBits(message.logEntriesCopiedCount.low >>> 0, message.logEntriesCopiedCount.high >>> 0).toNumber() : message.logEntriesCopiedCount; + return object; + }; + + /** + * Converts this CopyLogEntriesResponse to JSON. + * @function toJSON + * @memberof google.logging.v2.CopyLogEntriesResponse + * @instance + * @returns {Object.} JSON object + */ + CopyLogEntriesResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CopyLogEntriesResponse + * @function getTypeUrl + * @memberof google.logging.v2.CopyLogEntriesResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CopyLogEntriesResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.CopyLogEntriesResponse"; + }; + + return CopyLogEntriesResponse; + })(); + + v2.BucketMetadata = (function() { + + /** + * Properties of a BucketMetadata. + * @memberof google.logging.v2 + * @interface IBucketMetadata + * @property {google.protobuf.ITimestamp|null} [startTime] BucketMetadata startTime + * @property {google.protobuf.ITimestamp|null} [endTime] BucketMetadata endTime + * @property {google.logging.v2.OperationState|null} [state] BucketMetadata state + * @property {google.logging.v2.ICreateBucketRequest|null} [createBucketRequest] BucketMetadata createBucketRequest + * @property {google.logging.v2.IUpdateBucketRequest|null} [updateBucketRequest] BucketMetadata updateBucketRequest + */ + + /** + * Constructs a new BucketMetadata. + * @memberof google.logging.v2 + * @classdesc Represents a BucketMetadata. + * @implements IBucketMetadata + * @constructor + * @param {google.logging.v2.IBucketMetadata=} [properties] Properties to set + */ + function BucketMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BucketMetadata startTime. + * @member {google.protobuf.ITimestamp|null|undefined} startTime + * @memberof google.logging.v2.BucketMetadata + * @instance + */ + BucketMetadata.prototype.startTime = null; + + /** + * BucketMetadata endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.logging.v2.BucketMetadata + * @instance + */ + BucketMetadata.prototype.endTime = null; + + /** + * BucketMetadata state. + * @member {google.logging.v2.OperationState} state + * @memberof google.logging.v2.BucketMetadata + * @instance + */ + BucketMetadata.prototype.state = 0; + + /** + * BucketMetadata createBucketRequest. + * @member {google.logging.v2.ICreateBucketRequest|null|undefined} createBucketRequest + * @memberof google.logging.v2.BucketMetadata + * @instance + */ + BucketMetadata.prototype.createBucketRequest = null; + + /** + * BucketMetadata updateBucketRequest. + * @member {google.logging.v2.IUpdateBucketRequest|null|undefined} updateBucketRequest + * @memberof google.logging.v2.BucketMetadata + * @instance + */ + BucketMetadata.prototype.updateBucketRequest = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * BucketMetadata request. + * @member {"createBucketRequest"|"updateBucketRequest"|undefined} request + * @memberof google.logging.v2.BucketMetadata + * @instance + */ + Object.defineProperty(BucketMetadata.prototype, "request", { + get: $util.oneOfGetter($oneOfFields = ["createBucketRequest", "updateBucketRequest"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BucketMetadata instance using the specified properties. + * @function create + * @memberof google.logging.v2.BucketMetadata + * @static + * @param {google.logging.v2.IBucketMetadata=} [properties] Properties to set + * @returns {google.logging.v2.BucketMetadata} BucketMetadata instance + */ + BucketMetadata.create = function create(properties) { + return new BucketMetadata(properties); + }; + + /** + * Encodes the specified BucketMetadata message. Does not implicitly {@link google.logging.v2.BucketMetadata.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.BucketMetadata + * @static + * @param {google.logging.v2.IBucketMetadata} message BucketMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BucketMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.state); + if (message.createBucketRequest != null && Object.hasOwnProperty.call(message, "createBucketRequest")) + $root.google.logging.v2.CreateBucketRequest.encode(message.createBucketRequest, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.updateBucketRequest != null && Object.hasOwnProperty.call(message, "updateBucketRequest")) + $root.google.logging.v2.UpdateBucketRequest.encode(message.updateBucketRequest, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BucketMetadata message, length delimited. Does not implicitly {@link google.logging.v2.BucketMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.BucketMetadata + * @static + * @param {google.logging.v2.IBucketMetadata} message BucketMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BucketMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BucketMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.BucketMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.BucketMetadata} BucketMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BucketMetadata.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.BucketMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 2: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.state = reader.int32(); + break; + } + case 4: { + message.createBucketRequest = $root.google.logging.v2.CreateBucketRequest.decode(reader, reader.uint32()); + break; + } + case 5: { + message.updateBucketRequest = $root.google.logging.v2.UpdateBucketRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BucketMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.BucketMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.BucketMetadata} BucketMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BucketMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BucketMetadata message. + * @function verify + * @memberof google.logging.v2.BucketMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BucketMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.startTime != null && message.hasOwnProperty("startTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.startTime); + if (error) + return "startTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.createBucketRequest != null && message.hasOwnProperty("createBucketRequest")) { + properties.request = 1; + { + var error = $root.google.logging.v2.CreateBucketRequest.verify(message.createBucketRequest); + if (error) + return "createBucketRequest." + error; + } + } + if (message.updateBucketRequest != null && message.hasOwnProperty("updateBucketRequest")) { + if (properties.request === 1) + return "request: multiple values"; + properties.request = 1; + { + var error = $root.google.logging.v2.UpdateBucketRequest.verify(message.updateBucketRequest); + if (error) + return "updateBucketRequest." + error; + } + } + return null; + }; + + /** + * Creates a BucketMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.BucketMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.BucketMetadata} BucketMetadata + */ + BucketMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.BucketMetadata) + return object; + var message = new $root.google.logging.v2.BucketMetadata(); + if (object.startTime != null) { + if (typeof object.startTime !== "object") + throw TypeError(".google.logging.v2.BucketMetadata.startTime: object expected"); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.logging.v2.BucketMetadata.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + case "OPERATION_STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "OPERATION_STATE_SCHEDULED": + case 1: + message.state = 1; + break; + case "OPERATION_STATE_WAITING_FOR_PERMISSIONS": + case 2: + message.state = 2; + break; + case "OPERATION_STATE_RUNNING": + case 3: + message.state = 3; + break; + case "OPERATION_STATE_SUCCEEDED": + case 4: + message.state = 4; + break; + case "OPERATION_STATE_FAILED": + case 5: + message.state = 5; + break; + case "OPERATION_STATE_CANCELLED": + case 6: + message.state = 6; + break; + } + if (object.createBucketRequest != null) { + if (typeof object.createBucketRequest !== "object") + throw TypeError(".google.logging.v2.BucketMetadata.createBucketRequest: object expected"); + message.createBucketRequest = $root.google.logging.v2.CreateBucketRequest.fromObject(object.createBucketRequest); + } + if (object.updateBucketRequest != null) { + if (typeof object.updateBucketRequest !== "object") + throw TypeError(".google.logging.v2.BucketMetadata.updateBucketRequest: object expected"); + message.updateBucketRequest = $root.google.logging.v2.UpdateBucketRequest.fromObject(object.updateBucketRequest); + } + return message; + }; + + /** + * Creates a plain object from a BucketMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.BucketMetadata + * @static + * @param {google.logging.v2.BucketMetadata} message BucketMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BucketMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.startTime = null; + object.endTime = null; + object.state = options.enums === String ? "OPERATION_STATE_UNSPECIFIED" : 0; + } + if (message.startTime != null && message.hasOwnProperty("startTime")) + object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.logging.v2.OperationState[message.state] === undefined ? message.state : $root.google.logging.v2.OperationState[message.state] : message.state; + if (message.createBucketRequest != null && message.hasOwnProperty("createBucketRequest")) { + object.createBucketRequest = $root.google.logging.v2.CreateBucketRequest.toObject(message.createBucketRequest, options); + if (options.oneofs) + object.request = "createBucketRequest"; + } + if (message.updateBucketRequest != null && message.hasOwnProperty("updateBucketRequest")) { + object.updateBucketRequest = $root.google.logging.v2.UpdateBucketRequest.toObject(message.updateBucketRequest, options); + if (options.oneofs) + object.request = "updateBucketRequest"; + } + return object; + }; + + /** + * Converts this BucketMetadata to JSON. + * @function toJSON + * @memberof google.logging.v2.BucketMetadata + * @instance + * @returns {Object.} JSON object + */ + BucketMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BucketMetadata + * @function getTypeUrl + * @memberof google.logging.v2.BucketMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BucketMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.BucketMetadata"; + }; + + return BucketMetadata; + })(); + + v2.LinkMetadata = (function() { + + /** + * Properties of a LinkMetadata. + * @memberof google.logging.v2 + * @interface ILinkMetadata + * @property {google.protobuf.ITimestamp|null} [startTime] LinkMetadata startTime + * @property {google.protobuf.ITimestamp|null} [endTime] LinkMetadata endTime + * @property {google.logging.v2.OperationState|null} [state] LinkMetadata state + * @property {google.logging.v2.ICreateLinkRequest|null} [createLinkRequest] LinkMetadata createLinkRequest + * @property {google.logging.v2.IDeleteLinkRequest|null} [deleteLinkRequest] LinkMetadata deleteLinkRequest + */ + + /** + * Constructs a new LinkMetadata. + * @memberof google.logging.v2 + * @classdesc Represents a LinkMetadata. + * @implements ILinkMetadata + * @constructor + * @param {google.logging.v2.ILinkMetadata=} [properties] Properties to set + */ + function LinkMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LinkMetadata startTime. + * @member {google.protobuf.ITimestamp|null|undefined} startTime + * @memberof google.logging.v2.LinkMetadata + * @instance + */ + LinkMetadata.prototype.startTime = null; + + /** + * LinkMetadata endTime. + * @member {google.protobuf.ITimestamp|null|undefined} endTime + * @memberof google.logging.v2.LinkMetadata + * @instance + */ + LinkMetadata.prototype.endTime = null; + + /** + * LinkMetadata state. + * @member {google.logging.v2.OperationState} state + * @memberof google.logging.v2.LinkMetadata + * @instance + */ + LinkMetadata.prototype.state = 0; + + /** + * LinkMetadata createLinkRequest. + * @member {google.logging.v2.ICreateLinkRequest|null|undefined} createLinkRequest + * @memberof google.logging.v2.LinkMetadata + * @instance + */ + LinkMetadata.prototype.createLinkRequest = null; + + /** + * LinkMetadata deleteLinkRequest. + * @member {google.logging.v2.IDeleteLinkRequest|null|undefined} deleteLinkRequest + * @memberof google.logging.v2.LinkMetadata + * @instance + */ + LinkMetadata.prototype.deleteLinkRequest = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * LinkMetadata request. + * @member {"createLinkRequest"|"deleteLinkRequest"|undefined} request + * @memberof google.logging.v2.LinkMetadata + * @instance + */ + Object.defineProperty(LinkMetadata.prototype, "request", { + get: $util.oneOfGetter($oneOfFields = ["createLinkRequest", "deleteLinkRequest"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new LinkMetadata instance using the specified properties. + * @function create + * @memberof google.logging.v2.LinkMetadata + * @static + * @param {google.logging.v2.ILinkMetadata=} [properties] Properties to set + * @returns {google.logging.v2.LinkMetadata} LinkMetadata instance + */ + LinkMetadata.create = function create(properties) { + return new LinkMetadata(properties); + }; + + /** + * Encodes the specified LinkMetadata message. Does not implicitly {@link google.logging.v2.LinkMetadata.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.LinkMetadata + * @static + * @param {google.logging.v2.ILinkMetadata} message LinkMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LinkMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.startTime != null && Object.hasOwnProperty.call(message, "startTime")) + $root.google.protobuf.Timestamp.encode(message.startTime, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.endTime != null && Object.hasOwnProperty.call(message, "endTime")) + $root.google.protobuf.Timestamp.encode(message.endTime, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.state != null && Object.hasOwnProperty.call(message, "state")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.state); + if (message.createLinkRequest != null && Object.hasOwnProperty.call(message, "createLinkRequest")) + $root.google.logging.v2.CreateLinkRequest.encode(message.createLinkRequest, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.deleteLinkRequest != null && Object.hasOwnProperty.call(message, "deleteLinkRequest")) + $root.google.logging.v2.DeleteLinkRequest.encode(message.deleteLinkRequest, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified LinkMetadata message, length delimited. Does not implicitly {@link google.logging.v2.LinkMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.LinkMetadata + * @static + * @param {google.logging.v2.ILinkMetadata} message LinkMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LinkMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LinkMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.LinkMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.LinkMetadata} LinkMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LinkMetadata.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.LinkMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.startTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 2: { + message.endTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + message.state = reader.int32(); + break; + } + case 4: { + message.createLinkRequest = $root.google.logging.v2.CreateLinkRequest.decode(reader, reader.uint32()); + break; + } + case 5: { + message.deleteLinkRequest = $root.google.logging.v2.DeleteLinkRequest.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LinkMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.LinkMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.LinkMetadata} LinkMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LinkMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LinkMetadata message. + * @function verify + * @memberof google.logging.v2.LinkMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LinkMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.startTime != null && message.hasOwnProperty("startTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.startTime); + if (error) + return "startTime." + error; + } + if (message.endTime != null && message.hasOwnProperty("endTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.endTime); + if (error) + return "endTime." + error; + } + if (message.state != null && message.hasOwnProperty("state")) + switch (message.state) { + default: + return "state: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.createLinkRequest != null && message.hasOwnProperty("createLinkRequest")) { + properties.request = 1; + { + var error = $root.google.logging.v2.CreateLinkRequest.verify(message.createLinkRequest); + if (error) + return "createLinkRequest." + error; + } + } + if (message.deleteLinkRequest != null && message.hasOwnProperty("deleteLinkRequest")) { + if (properties.request === 1) + return "request: multiple values"; + properties.request = 1; + { + var error = $root.google.logging.v2.DeleteLinkRequest.verify(message.deleteLinkRequest); + if (error) + return "deleteLinkRequest." + error; + } + } + return null; + }; + + /** + * Creates a LinkMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.LinkMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.LinkMetadata} LinkMetadata + */ + LinkMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.LinkMetadata) + return object; + var message = new $root.google.logging.v2.LinkMetadata(); + if (object.startTime != null) { + if (typeof object.startTime !== "object") + throw TypeError(".google.logging.v2.LinkMetadata.startTime: object expected"); + message.startTime = $root.google.protobuf.Timestamp.fromObject(object.startTime); + } + if (object.endTime != null) { + if (typeof object.endTime !== "object") + throw TypeError(".google.logging.v2.LinkMetadata.endTime: object expected"); + message.endTime = $root.google.protobuf.Timestamp.fromObject(object.endTime); + } + switch (object.state) { + default: + if (typeof object.state === "number") { + message.state = object.state; + break; + } + break; + case "OPERATION_STATE_UNSPECIFIED": + case 0: + message.state = 0; + break; + case "OPERATION_STATE_SCHEDULED": + case 1: + message.state = 1; + break; + case "OPERATION_STATE_WAITING_FOR_PERMISSIONS": + case 2: + message.state = 2; + break; + case "OPERATION_STATE_RUNNING": + case 3: + message.state = 3; + break; + case "OPERATION_STATE_SUCCEEDED": + case 4: + message.state = 4; + break; + case "OPERATION_STATE_FAILED": + case 5: + message.state = 5; + break; + case "OPERATION_STATE_CANCELLED": + case 6: + message.state = 6; + break; + } + if (object.createLinkRequest != null) { + if (typeof object.createLinkRequest !== "object") + throw TypeError(".google.logging.v2.LinkMetadata.createLinkRequest: object expected"); + message.createLinkRequest = $root.google.logging.v2.CreateLinkRequest.fromObject(object.createLinkRequest); + } + if (object.deleteLinkRequest != null) { + if (typeof object.deleteLinkRequest !== "object") + throw TypeError(".google.logging.v2.LinkMetadata.deleteLinkRequest: object expected"); + message.deleteLinkRequest = $root.google.logging.v2.DeleteLinkRequest.fromObject(object.deleteLinkRequest); + } + return message; + }; + + /** + * Creates a plain object from a LinkMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.LinkMetadata + * @static + * @param {google.logging.v2.LinkMetadata} message LinkMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LinkMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.startTime = null; + object.endTime = null; + object.state = options.enums === String ? "OPERATION_STATE_UNSPECIFIED" : 0; + } + if (message.startTime != null && message.hasOwnProperty("startTime")) + object.startTime = $root.google.protobuf.Timestamp.toObject(message.startTime, options); + if (message.endTime != null && message.hasOwnProperty("endTime")) + object.endTime = $root.google.protobuf.Timestamp.toObject(message.endTime, options); + if (message.state != null && message.hasOwnProperty("state")) + object.state = options.enums === String ? $root.google.logging.v2.OperationState[message.state] === undefined ? message.state : $root.google.logging.v2.OperationState[message.state] : message.state; + if (message.createLinkRequest != null && message.hasOwnProperty("createLinkRequest")) { + object.createLinkRequest = $root.google.logging.v2.CreateLinkRequest.toObject(message.createLinkRequest, options); + if (options.oneofs) + object.request = "createLinkRequest"; + } + if (message.deleteLinkRequest != null && message.hasOwnProperty("deleteLinkRequest")) { + object.deleteLinkRequest = $root.google.logging.v2.DeleteLinkRequest.toObject(message.deleteLinkRequest, options); + if (options.oneofs) + object.request = "deleteLinkRequest"; + } + return object; + }; + + /** + * Converts this LinkMetadata to JSON. + * @function toJSON + * @memberof google.logging.v2.LinkMetadata + * @instance + * @returns {Object.} JSON object + */ + LinkMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LinkMetadata + * @function getTypeUrl + * @memberof google.logging.v2.LinkMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LinkMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.LinkMetadata"; + }; + + return LinkMetadata; + })(); + + /** + * OperationState enum. + * @name google.logging.v2.OperationState + * @enum {number} + * @property {number} OPERATION_STATE_UNSPECIFIED=0 OPERATION_STATE_UNSPECIFIED value + * @property {number} OPERATION_STATE_SCHEDULED=1 OPERATION_STATE_SCHEDULED value + * @property {number} OPERATION_STATE_WAITING_FOR_PERMISSIONS=2 OPERATION_STATE_WAITING_FOR_PERMISSIONS value + * @property {number} OPERATION_STATE_RUNNING=3 OPERATION_STATE_RUNNING value + * @property {number} OPERATION_STATE_SUCCEEDED=4 OPERATION_STATE_SUCCEEDED value + * @property {number} OPERATION_STATE_FAILED=5 OPERATION_STATE_FAILED value + * @property {number} OPERATION_STATE_CANCELLED=6 OPERATION_STATE_CANCELLED value + */ + v2.OperationState = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "OPERATION_STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "OPERATION_STATE_SCHEDULED"] = 1; + values[valuesById[2] = "OPERATION_STATE_WAITING_FOR_PERMISSIONS"] = 2; + values[valuesById[3] = "OPERATION_STATE_RUNNING"] = 3; + values[valuesById[4] = "OPERATION_STATE_SUCCEEDED"] = 4; + values[valuesById[5] = "OPERATION_STATE_FAILED"] = 5; + values[valuesById[6] = "OPERATION_STATE_CANCELLED"] = 6; + return values; + })(); + + /** + * LifecycleState enum. + * @name google.logging.v2.LifecycleState + * @enum {number} + * @property {number} LIFECYCLE_STATE_UNSPECIFIED=0 LIFECYCLE_STATE_UNSPECIFIED value + * @property {number} ACTIVE=1 ACTIVE value + * @property {number} DELETE_REQUESTED=2 DELETE_REQUESTED value + * @property {number} UPDATING=3 UPDATING value + * @property {number} CREATING=4 CREATING value + * @property {number} FAILED=5 FAILED value + */ + v2.LifecycleState = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "LIFECYCLE_STATE_UNSPECIFIED"] = 0; + values[valuesById[1] = "ACTIVE"] = 1; + values[valuesById[2] = "DELETE_REQUESTED"] = 2; + values[valuesById[3] = "UPDATING"] = 3; + values[valuesById[4] = "CREATING"] = 4; + values[valuesById[5] = "FAILED"] = 5; + return values; + })(); + + /** + * IndexType enum. + * @name google.logging.v2.IndexType + * @enum {number} + * @property {number} INDEX_TYPE_UNSPECIFIED=0 INDEX_TYPE_UNSPECIFIED value + * @property {number} INDEX_TYPE_STRING=1 INDEX_TYPE_STRING value + * @property {number} INDEX_TYPE_INTEGER=2 INDEX_TYPE_INTEGER value + */ + v2.IndexType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "INDEX_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "INDEX_TYPE_STRING"] = 1; + values[valuesById[2] = "INDEX_TYPE_INTEGER"] = 2; + return values; + })(); + + v2.LocationMetadata = (function() { + + /** + * Properties of a LocationMetadata. + * @memberof google.logging.v2 + * @interface ILocationMetadata + * @property {boolean|null} [logAnalyticsEnabled] LocationMetadata logAnalyticsEnabled + */ + + /** + * Constructs a new LocationMetadata. + * @memberof google.logging.v2 + * @classdesc Represents a LocationMetadata. + * @implements ILocationMetadata + * @constructor + * @param {google.logging.v2.ILocationMetadata=} [properties] Properties to set + */ + function LocationMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LocationMetadata logAnalyticsEnabled. + * @member {boolean} logAnalyticsEnabled + * @memberof google.logging.v2.LocationMetadata + * @instance + */ + LocationMetadata.prototype.logAnalyticsEnabled = false; + + /** + * Creates a new LocationMetadata instance using the specified properties. + * @function create + * @memberof google.logging.v2.LocationMetadata + * @static + * @param {google.logging.v2.ILocationMetadata=} [properties] Properties to set + * @returns {google.logging.v2.LocationMetadata} LocationMetadata instance + */ + LocationMetadata.create = function create(properties) { + return new LocationMetadata(properties); + }; + + /** + * Encodes the specified LocationMetadata message. Does not implicitly {@link google.logging.v2.LocationMetadata.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.LocationMetadata + * @static + * @param {google.logging.v2.ILocationMetadata} message LocationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LocationMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.logAnalyticsEnabled != null && Object.hasOwnProperty.call(message, "logAnalyticsEnabled")) + writer.uint32(/* id 1, wireType 0 =*/8).bool(message.logAnalyticsEnabled); + return writer; + }; + + /** + * Encodes the specified LocationMetadata message, length delimited. Does not implicitly {@link google.logging.v2.LocationMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.LocationMetadata + * @static + * @param {google.logging.v2.ILocationMetadata} message LocationMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LocationMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LocationMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.LocationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.LocationMetadata} LocationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LocationMetadata.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.LocationMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.logAnalyticsEnabled = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LocationMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.LocationMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.LocationMetadata} LocationMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LocationMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LocationMetadata message. + * @function verify + * @memberof google.logging.v2.LocationMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LocationMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.logAnalyticsEnabled != null && message.hasOwnProperty("logAnalyticsEnabled")) + if (typeof message.logAnalyticsEnabled !== "boolean") + return "logAnalyticsEnabled: boolean expected"; + return null; + }; + + /** + * Creates a LocationMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.LocationMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.LocationMetadata} LocationMetadata + */ + LocationMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.LocationMetadata) + return object; + var message = new $root.google.logging.v2.LocationMetadata(); + if (object.logAnalyticsEnabled != null) + message.logAnalyticsEnabled = Boolean(object.logAnalyticsEnabled); + return message; + }; + + /** + * Creates a plain object from a LocationMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.LocationMetadata + * @static + * @param {google.logging.v2.LocationMetadata} message LocationMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LocationMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.logAnalyticsEnabled = false; + if (message.logAnalyticsEnabled != null && message.hasOwnProperty("logAnalyticsEnabled")) + object.logAnalyticsEnabled = message.logAnalyticsEnabled; + return object; + }; + + /** + * Converts this LocationMetadata to JSON. + * @function toJSON + * @memberof google.logging.v2.LocationMetadata + * @instance + * @returns {Object.} JSON object + */ + LocationMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LocationMetadata + * @function getTypeUrl + * @memberof google.logging.v2.LocationMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LocationMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.LocationMetadata"; + }; + + return LocationMetadata; + })(); + + v2.MetricsServiceV2 = (function() { + + /** + * Constructs a new MetricsServiceV2 service. + * @memberof google.logging.v2 + * @classdesc Represents a MetricsServiceV2 + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function MetricsServiceV2(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (MetricsServiceV2.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = MetricsServiceV2; + + /** + * Creates new MetricsServiceV2 service using the specified rpc implementation. + * @function create + * @memberof google.logging.v2.MetricsServiceV2 + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {MetricsServiceV2} RPC service. Useful where requests and/or responses are streamed. + */ + MetricsServiceV2.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.logging.v2.MetricsServiceV2|listLogMetrics}. + * @memberof google.logging.v2.MetricsServiceV2 + * @typedef ListLogMetricsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.logging.v2.ListLogMetricsResponse} [response] ListLogMetricsResponse + */ + + /** + * Calls ListLogMetrics. + * @function listLogMetrics + * @memberof google.logging.v2.MetricsServiceV2 + * @instance + * @param {google.logging.v2.IListLogMetricsRequest} request ListLogMetricsRequest message or plain object + * @param {google.logging.v2.MetricsServiceV2.ListLogMetricsCallback} callback Node-style callback called with the error, if any, and ListLogMetricsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(MetricsServiceV2.prototype.listLogMetrics = function listLogMetrics(request, callback) { + return this.rpcCall(listLogMetrics, $root.google.logging.v2.ListLogMetricsRequest, $root.google.logging.v2.ListLogMetricsResponse, request, callback); + }, "name", { value: "ListLogMetrics" }); + + /** + * Calls ListLogMetrics. + * @function listLogMetrics + * @memberof google.logging.v2.MetricsServiceV2 + * @instance + * @param {google.logging.v2.IListLogMetricsRequest} request ListLogMetricsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.MetricsServiceV2|getLogMetric}. + * @memberof google.logging.v2.MetricsServiceV2 + * @typedef GetLogMetricCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.logging.v2.LogMetric} [response] LogMetric + */ + + /** + * Calls GetLogMetric. + * @function getLogMetric + * @memberof google.logging.v2.MetricsServiceV2 + * @instance + * @param {google.logging.v2.IGetLogMetricRequest} request GetLogMetricRequest message or plain object + * @param {google.logging.v2.MetricsServiceV2.GetLogMetricCallback} callback Node-style callback called with the error, if any, and LogMetric + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(MetricsServiceV2.prototype.getLogMetric = function getLogMetric(request, callback) { + return this.rpcCall(getLogMetric, $root.google.logging.v2.GetLogMetricRequest, $root.google.logging.v2.LogMetric, request, callback); + }, "name", { value: "GetLogMetric" }); + + /** + * Calls GetLogMetric. + * @function getLogMetric + * @memberof google.logging.v2.MetricsServiceV2 + * @instance + * @param {google.logging.v2.IGetLogMetricRequest} request GetLogMetricRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.MetricsServiceV2|createLogMetric}. + * @memberof google.logging.v2.MetricsServiceV2 + * @typedef CreateLogMetricCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.logging.v2.LogMetric} [response] LogMetric + */ + + /** + * Calls CreateLogMetric. + * @function createLogMetric + * @memberof google.logging.v2.MetricsServiceV2 + * @instance + * @param {google.logging.v2.ICreateLogMetricRequest} request CreateLogMetricRequest message or plain object + * @param {google.logging.v2.MetricsServiceV2.CreateLogMetricCallback} callback Node-style callback called with the error, if any, and LogMetric + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(MetricsServiceV2.prototype.createLogMetric = function createLogMetric(request, callback) { + return this.rpcCall(createLogMetric, $root.google.logging.v2.CreateLogMetricRequest, $root.google.logging.v2.LogMetric, request, callback); + }, "name", { value: "CreateLogMetric" }); + + /** + * Calls CreateLogMetric. + * @function createLogMetric + * @memberof google.logging.v2.MetricsServiceV2 + * @instance + * @param {google.logging.v2.ICreateLogMetricRequest} request CreateLogMetricRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.MetricsServiceV2|updateLogMetric}. + * @memberof google.logging.v2.MetricsServiceV2 + * @typedef UpdateLogMetricCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.logging.v2.LogMetric} [response] LogMetric + */ + + /** + * Calls UpdateLogMetric. + * @function updateLogMetric + * @memberof google.logging.v2.MetricsServiceV2 + * @instance + * @param {google.logging.v2.IUpdateLogMetricRequest} request UpdateLogMetricRequest message or plain object + * @param {google.logging.v2.MetricsServiceV2.UpdateLogMetricCallback} callback Node-style callback called with the error, if any, and LogMetric + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(MetricsServiceV2.prototype.updateLogMetric = function updateLogMetric(request, callback) { + return this.rpcCall(updateLogMetric, $root.google.logging.v2.UpdateLogMetricRequest, $root.google.logging.v2.LogMetric, request, callback); + }, "name", { value: "UpdateLogMetric" }); + + /** + * Calls UpdateLogMetric. + * @function updateLogMetric + * @memberof google.logging.v2.MetricsServiceV2 + * @instance + * @param {google.logging.v2.IUpdateLogMetricRequest} request UpdateLogMetricRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.logging.v2.MetricsServiceV2|deleteLogMetric}. + * @memberof google.logging.v2.MetricsServiceV2 + * @typedef DeleteLogMetricCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteLogMetric. + * @function deleteLogMetric + * @memberof google.logging.v2.MetricsServiceV2 + * @instance + * @param {google.logging.v2.IDeleteLogMetricRequest} request DeleteLogMetricRequest message or plain object + * @param {google.logging.v2.MetricsServiceV2.DeleteLogMetricCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(MetricsServiceV2.prototype.deleteLogMetric = function deleteLogMetric(request, callback) { + return this.rpcCall(deleteLogMetric, $root.google.logging.v2.DeleteLogMetricRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteLogMetric" }); + + /** + * Calls DeleteLogMetric. + * @function deleteLogMetric + * @memberof google.logging.v2.MetricsServiceV2 + * @instance + * @param {google.logging.v2.IDeleteLogMetricRequest} request DeleteLogMetricRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return MetricsServiceV2; + })(); + + v2.LogMetric = (function() { + + /** + * Properties of a LogMetric. + * @memberof google.logging.v2 + * @interface ILogMetric + * @property {string|null} [name] LogMetric name + * @property {string|null} [description] LogMetric description + * @property {string|null} [filter] LogMetric filter + * @property {string|null} [bucketName] LogMetric bucketName + * @property {boolean|null} [disabled] LogMetric disabled + * @property {google.api.IMetricDescriptor|null} [metricDescriptor] LogMetric metricDescriptor + * @property {string|null} [valueExtractor] LogMetric valueExtractor + * @property {Object.|null} [labelExtractors] LogMetric labelExtractors + * @property {google.api.Distribution.IBucketOptions|null} [bucketOptions] LogMetric bucketOptions + * @property {google.protobuf.ITimestamp|null} [createTime] LogMetric createTime + * @property {google.protobuf.ITimestamp|null} [updateTime] LogMetric updateTime + * @property {google.logging.v2.LogMetric.ApiVersion|null} [version] LogMetric version + */ + + /** + * Constructs a new LogMetric. + * @memberof google.logging.v2 + * @classdesc Represents a LogMetric. + * @implements ILogMetric + * @constructor + * @param {google.logging.v2.ILogMetric=} [properties] Properties to set + */ + function LogMetric(properties) { + this.labelExtractors = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LogMetric name. + * @member {string} name + * @memberof google.logging.v2.LogMetric + * @instance + */ + LogMetric.prototype.name = ""; + + /** + * LogMetric description. + * @member {string} description + * @memberof google.logging.v2.LogMetric + * @instance + */ + LogMetric.prototype.description = ""; + + /** + * LogMetric filter. + * @member {string} filter + * @memberof google.logging.v2.LogMetric + * @instance + */ + LogMetric.prototype.filter = ""; + + /** + * LogMetric bucketName. + * @member {string} bucketName + * @memberof google.logging.v2.LogMetric + * @instance + */ + LogMetric.prototype.bucketName = ""; + + /** + * LogMetric disabled. + * @member {boolean} disabled + * @memberof google.logging.v2.LogMetric + * @instance + */ + LogMetric.prototype.disabled = false; + + /** + * LogMetric metricDescriptor. + * @member {google.api.IMetricDescriptor|null|undefined} metricDescriptor + * @memberof google.logging.v2.LogMetric + * @instance + */ + LogMetric.prototype.metricDescriptor = null; + + /** + * LogMetric valueExtractor. + * @member {string} valueExtractor + * @memberof google.logging.v2.LogMetric + * @instance + */ + LogMetric.prototype.valueExtractor = ""; + + /** + * LogMetric labelExtractors. + * @member {Object.} labelExtractors + * @memberof google.logging.v2.LogMetric + * @instance + */ + LogMetric.prototype.labelExtractors = $util.emptyObject; + + /** + * LogMetric bucketOptions. + * @member {google.api.Distribution.IBucketOptions|null|undefined} bucketOptions + * @memberof google.logging.v2.LogMetric + * @instance + */ + LogMetric.prototype.bucketOptions = null; + + /** + * LogMetric createTime. + * @member {google.protobuf.ITimestamp|null|undefined} createTime + * @memberof google.logging.v2.LogMetric + * @instance + */ + LogMetric.prototype.createTime = null; + + /** + * LogMetric updateTime. + * @member {google.protobuf.ITimestamp|null|undefined} updateTime + * @memberof google.logging.v2.LogMetric + * @instance + */ + LogMetric.prototype.updateTime = null; + + /** + * LogMetric version. + * @member {google.logging.v2.LogMetric.ApiVersion} version + * @memberof google.logging.v2.LogMetric + * @instance + */ + LogMetric.prototype.version = 0; + + /** + * Creates a new LogMetric instance using the specified properties. + * @function create + * @memberof google.logging.v2.LogMetric + * @static + * @param {google.logging.v2.ILogMetric=} [properties] Properties to set + * @returns {google.logging.v2.LogMetric} LogMetric instance + */ + LogMetric.create = function create(properties) { + return new LogMetric(properties); + }; + + /** + * Encodes the specified LogMetric message. Does not implicitly {@link google.logging.v2.LogMetric.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.LogMetric + * @static + * @param {google.logging.v2.ILogMetric} message LogMetric message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LogMetric.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.description); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.filter); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.version); + if (message.metricDescriptor != null && Object.hasOwnProperty.call(message, "metricDescriptor")) + $root.google.api.MetricDescriptor.encode(message.metricDescriptor, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + if (message.valueExtractor != null && Object.hasOwnProperty.call(message, "valueExtractor")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.valueExtractor); + if (message.labelExtractors != null && Object.hasOwnProperty.call(message, "labelExtractors")) + for (var keys = Object.keys(message.labelExtractors), i = 0; i < keys.length; ++i) + writer.uint32(/* id 7, wireType 2 =*/58).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labelExtractors[keys[i]]).ldelim(); + if (message.bucketOptions != null && Object.hasOwnProperty.call(message, "bucketOptions")) + $root.google.api.Distribution.BucketOptions.encode(message.bucketOptions, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.createTime != null && Object.hasOwnProperty.call(message, "createTime")) + $root.google.protobuf.Timestamp.encode(message.createTime, writer.uint32(/* id 9, wireType 2 =*/74).fork()).ldelim(); + if (message.updateTime != null && Object.hasOwnProperty.call(message, "updateTime")) + $root.google.protobuf.Timestamp.encode(message.updateTime, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.disabled != null && Object.hasOwnProperty.call(message, "disabled")) + writer.uint32(/* id 12, wireType 0 =*/96).bool(message.disabled); + if (message.bucketName != null && Object.hasOwnProperty.call(message, "bucketName")) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.bucketName); + return writer; + }; + + /** + * Encodes the specified LogMetric message, length delimited. Does not implicitly {@link google.logging.v2.LogMetric.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.LogMetric + * @static + * @param {google.logging.v2.ILogMetric} message LogMetric message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LogMetric.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LogMetric message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.LogMetric + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.LogMetric} LogMetric + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LogMetric.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.LogMetric(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.description = reader.string(); + break; + } + case 3: { + message.filter = reader.string(); + break; + } + case 13: { + message.bucketName = reader.string(); + break; + } + case 12: { + message.disabled = reader.bool(); + break; + } + case 5: { + message.metricDescriptor = $root.google.api.MetricDescriptor.decode(reader, reader.uint32()); + break; + } + case 6: { + message.valueExtractor = reader.string(); + break; + } + case 7: { + if (message.labelExtractors === $util.emptyObject) + message.labelExtractors = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labelExtractors[key] = value; + break; + } + case 8: { + message.bucketOptions = $root.google.api.Distribution.BucketOptions.decode(reader, reader.uint32()); + break; + } + case 9: { + message.createTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 10: { + message.updateTime = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 4: { + message.version = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LogMetric message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.LogMetric + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.LogMetric} LogMetric + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LogMetric.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LogMetric message. + * @function verify + * @memberof google.logging.v2.LogMetric + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LogMetric.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.bucketName != null && message.hasOwnProperty("bucketName")) + if (!$util.isString(message.bucketName)) + return "bucketName: string expected"; + if (message.disabled != null && message.hasOwnProperty("disabled")) + if (typeof message.disabled !== "boolean") + return "disabled: boolean expected"; + if (message.metricDescriptor != null && message.hasOwnProperty("metricDescriptor")) { + var error = $root.google.api.MetricDescriptor.verify(message.metricDescriptor); + if (error) + return "metricDescriptor." + error; + } + if (message.valueExtractor != null && message.hasOwnProperty("valueExtractor")) + if (!$util.isString(message.valueExtractor)) + return "valueExtractor: string expected"; + if (message.labelExtractors != null && message.hasOwnProperty("labelExtractors")) { + if (!$util.isObject(message.labelExtractors)) + return "labelExtractors: object expected"; + var key = Object.keys(message.labelExtractors); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labelExtractors[key[i]])) + return "labelExtractors: string{k:string} expected"; + } + if (message.bucketOptions != null && message.hasOwnProperty("bucketOptions")) { + var error = $root.google.api.Distribution.BucketOptions.verify(message.bucketOptions); + if (error) + return "bucketOptions." + error; + } + if (message.createTime != null && message.hasOwnProperty("createTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.createTime); + if (error) + return "createTime." + error; + } + if (message.updateTime != null && message.hasOwnProperty("updateTime")) { + var error = $root.google.protobuf.Timestamp.verify(message.updateTime); + if (error) + return "updateTime." + error; + } + if (message.version != null && message.hasOwnProperty("version")) + switch (message.version) { + default: + return "version: enum value expected"; + case 0: + case 1: + break; + } + return null; + }; + + /** + * Creates a LogMetric message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.LogMetric + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.LogMetric} LogMetric + */ + LogMetric.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.LogMetric) + return object; + var message = new $root.google.logging.v2.LogMetric(); + if (object.name != null) + message.name = String(object.name); + if (object.description != null) + message.description = String(object.description); + if (object.filter != null) + message.filter = String(object.filter); + if (object.bucketName != null) + message.bucketName = String(object.bucketName); + if (object.disabled != null) + message.disabled = Boolean(object.disabled); + if (object.metricDescriptor != null) { + if (typeof object.metricDescriptor !== "object") + throw TypeError(".google.logging.v2.LogMetric.metricDescriptor: object expected"); + message.metricDescriptor = $root.google.api.MetricDescriptor.fromObject(object.metricDescriptor); + } + if (object.valueExtractor != null) + message.valueExtractor = String(object.valueExtractor); + if (object.labelExtractors) { + if (typeof object.labelExtractors !== "object") + throw TypeError(".google.logging.v2.LogMetric.labelExtractors: object expected"); + message.labelExtractors = {}; + for (var keys = Object.keys(object.labelExtractors), i = 0; i < keys.length; ++i) + message.labelExtractors[keys[i]] = String(object.labelExtractors[keys[i]]); + } + if (object.bucketOptions != null) { + if (typeof object.bucketOptions !== "object") + throw TypeError(".google.logging.v2.LogMetric.bucketOptions: object expected"); + message.bucketOptions = $root.google.api.Distribution.BucketOptions.fromObject(object.bucketOptions); + } + if (object.createTime != null) { + if (typeof object.createTime !== "object") + throw TypeError(".google.logging.v2.LogMetric.createTime: object expected"); + message.createTime = $root.google.protobuf.Timestamp.fromObject(object.createTime); + } + if (object.updateTime != null) { + if (typeof object.updateTime !== "object") + throw TypeError(".google.logging.v2.LogMetric.updateTime: object expected"); + message.updateTime = $root.google.protobuf.Timestamp.fromObject(object.updateTime); + } + switch (object.version) { + default: + if (typeof object.version === "number") { + message.version = object.version; + break; + } + break; + case "V2": + case 0: + message.version = 0; + break; + case "V1": + case 1: + message.version = 1; + break; + } + return message; + }; + + /** + * Creates a plain object from a LogMetric message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.LogMetric + * @static + * @param {google.logging.v2.LogMetric} message LogMetric + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LogMetric.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.labelExtractors = {}; + if (options.defaults) { + object.name = ""; + object.description = ""; + object.filter = ""; + object.version = options.enums === String ? "V2" : 0; + object.metricDescriptor = null; + object.valueExtractor = ""; + object.bucketOptions = null; + object.createTime = null; + object.updateTime = null; + object.disabled = false; + object.bucketName = ""; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.version != null && message.hasOwnProperty("version")) + object.version = options.enums === String ? $root.google.logging.v2.LogMetric.ApiVersion[message.version] === undefined ? message.version : $root.google.logging.v2.LogMetric.ApiVersion[message.version] : message.version; + if (message.metricDescriptor != null && message.hasOwnProperty("metricDescriptor")) + object.metricDescriptor = $root.google.api.MetricDescriptor.toObject(message.metricDescriptor, options); + if (message.valueExtractor != null && message.hasOwnProperty("valueExtractor")) + object.valueExtractor = message.valueExtractor; + var keys2; + if (message.labelExtractors && (keys2 = Object.keys(message.labelExtractors)).length) { + object.labelExtractors = {}; + for (var j = 0; j < keys2.length; ++j) + object.labelExtractors[keys2[j]] = message.labelExtractors[keys2[j]]; + } + if (message.bucketOptions != null && message.hasOwnProperty("bucketOptions")) + object.bucketOptions = $root.google.api.Distribution.BucketOptions.toObject(message.bucketOptions, options); + if (message.createTime != null && message.hasOwnProperty("createTime")) + object.createTime = $root.google.protobuf.Timestamp.toObject(message.createTime, options); + if (message.updateTime != null && message.hasOwnProperty("updateTime")) + object.updateTime = $root.google.protobuf.Timestamp.toObject(message.updateTime, options); + if (message.disabled != null && message.hasOwnProperty("disabled")) + object.disabled = message.disabled; + if (message.bucketName != null && message.hasOwnProperty("bucketName")) + object.bucketName = message.bucketName; + return object; + }; + + /** + * Converts this LogMetric to JSON. + * @function toJSON + * @memberof google.logging.v2.LogMetric + * @instance + * @returns {Object.} JSON object + */ + LogMetric.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LogMetric + * @function getTypeUrl + * @memberof google.logging.v2.LogMetric + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LogMetric.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.LogMetric"; + }; + + /** + * ApiVersion enum. + * @name google.logging.v2.LogMetric.ApiVersion + * @enum {number} + * @property {number} V2=0 V2 value + * @property {number} V1=1 V1 value + */ + LogMetric.ApiVersion = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "V2"] = 0; + values[valuesById[1] = "V1"] = 1; + return values; + })(); + + return LogMetric; + })(); + + v2.ListLogMetricsRequest = (function() { + + /** + * Properties of a ListLogMetricsRequest. + * @memberof google.logging.v2 + * @interface IListLogMetricsRequest + * @property {string|null} [parent] ListLogMetricsRequest parent + * @property {string|null} [pageToken] ListLogMetricsRequest pageToken + * @property {number|null} [pageSize] ListLogMetricsRequest pageSize + */ + + /** + * Constructs a new ListLogMetricsRequest. + * @memberof google.logging.v2 + * @classdesc Represents a ListLogMetricsRequest. + * @implements IListLogMetricsRequest + * @constructor + * @param {google.logging.v2.IListLogMetricsRequest=} [properties] Properties to set + */ + function ListLogMetricsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListLogMetricsRequest parent. + * @member {string} parent + * @memberof google.logging.v2.ListLogMetricsRequest + * @instance + */ + ListLogMetricsRequest.prototype.parent = ""; + + /** + * ListLogMetricsRequest pageToken. + * @member {string} pageToken + * @memberof google.logging.v2.ListLogMetricsRequest + * @instance + */ + ListLogMetricsRequest.prototype.pageToken = ""; + + /** + * ListLogMetricsRequest pageSize. + * @member {number} pageSize + * @memberof google.logging.v2.ListLogMetricsRequest + * @instance + */ + ListLogMetricsRequest.prototype.pageSize = 0; + + /** + * Creates a new ListLogMetricsRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.ListLogMetricsRequest + * @static + * @param {google.logging.v2.IListLogMetricsRequest=} [properties] Properties to set + * @returns {google.logging.v2.ListLogMetricsRequest} ListLogMetricsRequest instance + */ + ListLogMetricsRequest.create = function create(properties) { + return new ListLogMetricsRequest(properties); + }; + + /** + * Encodes the specified ListLogMetricsRequest message. Does not implicitly {@link google.logging.v2.ListLogMetricsRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.ListLogMetricsRequest + * @static + * @param {google.logging.v2.IListLogMetricsRequest} message ListLogMetricsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListLogMetricsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.pageToken); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.pageSize); + return writer; + }; + + /** + * Encodes the specified ListLogMetricsRequest message, length delimited. Does not implicitly {@link google.logging.v2.ListLogMetricsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.ListLogMetricsRequest + * @static + * @param {google.logging.v2.IListLogMetricsRequest} message ListLogMetricsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListLogMetricsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListLogMetricsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.ListLogMetricsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.ListLogMetricsRequest} ListLogMetricsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListLogMetricsRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.ListLogMetricsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.pageToken = reader.string(); + break; + } + case 3: { + message.pageSize = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListLogMetricsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.ListLogMetricsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.ListLogMetricsRequest} ListLogMetricsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListLogMetricsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListLogMetricsRequest message. + * @function verify + * @memberof google.logging.v2.ListLogMetricsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListLogMetricsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + return null; + }; + + /** + * Creates a ListLogMetricsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.ListLogMetricsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.ListLogMetricsRequest} ListLogMetricsRequest + */ + ListLogMetricsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.ListLogMetricsRequest) + return object; + var message = new $root.google.logging.v2.ListLogMetricsRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + return message; + }; + + /** + * Creates a plain object from a ListLogMetricsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.ListLogMetricsRequest + * @static + * @param {google.logging.v2.ListLogMetricsRequest} message ListLogMetricsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListLogMetricsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.pageToken = ""; + object.pageSize = 0; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + return object; + }; + + /** + * Converts this ListLogMetricsRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.ListLogMetricsRequest + * @instance + * @returns {Object.} JSON object + */ + ListLogMetricsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListLogMetricsRequest + * @function getTypeUrl + * @memberof google.logging.v2.ListLogMetricsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListLogMetricsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.ListLogMetricsRequest"; + }; + + return ListLogMetricsRequest; + })(); + + v2.ListLogMetricsResponse = (function() { + + /** + * Properties of a ListLogMetricsResponse. + * @memberof google.logging.v2 + * @interface IListLogMetricsResponse + * @property {Array.|null} [metrics] ListLogMetricsResponse metrics + * @property {string|null} [nextPageToken] ListLogMetricsResponse nextPageToken + */ + + /** + * Constructs a new ListLogMetricsResponse. + * @memberof google.logging.v2 + * @classdesc Represents a ListLogMetricsResponse. + * @implements IListLogMetricsResponse + * @constructor + * @param {google.logging.v2.IListLogMetricsResponse=} [properties] Properties to set + */ + function ListLogMetricsResponse(properties) { + this.metrics = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListLogMetricsResponse metrics. + * @member {Array.} metrics + * @memberof google.logging.v2.ListLogMetricsResponse + * @instance + */ + ListLogMetricsResponse.prototype.metrics = $util.emptyArray; + + /** + * ListLogMetricsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.logging.v2.ListLogMetricsResponse + * @instance + */ + ListLogMetricsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListLogMetricsResponse instance using the specified properties. + * @function create + * @memberof google.logging.v2.ListLogMetricsResponse + * @static + * @param {google.logging.v2.IListLogMetricsResponse=} [properties] Properties to set + * @returns {google.logging.v2.ListLogMetricsResponse} ListLogMetricsResponse instance + */ + ListLogMetricsResponse.create = function create(properties) { + return new ListLogMetricsResponse(properties); + }; + + /** + * Encodes the specified ListLogMetricsResponse message. Does not implicitly {@link google.logging.v2.ListLogMetricsResponse.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.ListLogMetricsResponse + * @static + * @param {google.logging.v2.IListLogMetricsResponse} message ListLogMetricsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListLogMetricsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.metrics != null && message.metrics.length) + for (var i = 0; i < message.metrics.length; ++i) + $root.google.logging.v2.LogMetric.encode(message.metrics[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListLogMetricsResponse message, length delimited. Does not implicitly {@link google.logging.v2.ListLogMetricsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.ListLogMetricsResponse + * @static + * @param {google.logging.v2.IListLogMetricsResponse} message ListLogMetricsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListLogMetricsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListLogMetricsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.ListLogMetricsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.ListLogMetricsResponse} ListLogMetricsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListLogMetricsResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.ListLogMetricsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.metrics && message.metrics.length)) + message.metrics = []; + message.metrics.push($root.google.logging.v2.LogMetric.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListLogMetricsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.ListLogMetricsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.ListLogMetricsResponse} ListLogMetricsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListLogMetricsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListLogMetricsResponse message. + * @function verify + * @memberof google.logging.v2.ListLogMetricsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListLogMetricsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.metrics != null && message.hasOwnProperty("metrics")) { + if (!Array.isArray(message.metrics)) + return "metrics: array expected"; + for (var i = 0; i < message.metrics.length; ++i) { + var error = $root.google.logging.v2.LogMetric.verify(message.metrics[i]); + if (error) + return "metrics." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListLogMetricsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.ListLogMetricsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.ListLogMetricsResponse} ListLogMetricsResponse + */ + ListLogMetricsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.ListLogMetricsResponse) + return object; + var message = new $root.google.logging.v2.ListLogMetricsResponse(); + if (object.metrics) { + if (!Array.isArray(object.metrics)) + throw TypeError(".google.logging.v2.ListLogMetricsResponse.metrics: array expected"); + message.metrics = []; + for (var i = 0; i < object.metrics.length; ++i) { + if (typeof object.metrics[i] !== "object") + throw TypeError(".google.logging.v2.ListLogMetricsResponse.metrics: object expected"); + message.metrics[i] = $root.google.logging.v2.LogMetric.fromObject(object.metrics[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListLogMetricsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.ListLogMetricsResponse + * @static + * @param {google.logging.v2.ListLogMetricsResponse} message ListLogMetricsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListLogMetricsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.metrics = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.metrics && message.metrics.length) { + object.metrics = []; + for (var j = 0; j < message.metrics.length; ++j) + object.metrics[j] = $root.google.logging.v2.LogMetric.toObject(message.metrics[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListLogMetricsResponse to JSON. + * @function toJSON + * @memberof google.logging.v2.ListLogMetricsResponse + * @instance + * @returns {Object.} JSON object + */ + ListLogMetricsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListLogMetricsResponse + * @function getTypeUrl + * @memberof google.logging.v2.ListLogMetricsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListLogMetricsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.ListLogMetricsResponse"; + }; + + return ListLogMetricsResponse; + })(); + + v2.GetLogMetricRequest = (function() { + + /** + * Properties of a GetLogMetricRequest. + * @memberof google.logging.v2 + * @interface IGetLogMetricRequest + * @property {string|null} [metricName] GetLogMetricRequest metricName + */ + + /** + * Constructs a new GetLogMetricRequest. + * @memberof google.logging.v2 + * @classdesc Represents a GetLogMetricRequest. + * @implements IGetLogMetricRequest + * @constructor + * @param {google.logging.v2.IGetLogMetricRequest=} [properties] Properties to set + */ + function GetLogMetricRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetLogMetricRequest metricName. + * @member {string} metricName + * @memberof google.logging.v2.GetLogMetricRequest + * @instance + */ + GetLogMetricRequest.prototype.metricName = ""; + + /** + * Creates a new GetLogMetricRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.GetLogMetricRequest + * @static + * @param {google.logging.v2.IGetLogMetricRequest=} [properties] Properties to set + * @returns {google.logging.v2.GetLogMetricRequest} GetLogMetricRequest instance + */ + GetLogMetricRequest.create = function create(properties) { + return new GetLogMetricRequest(properties); + }; + + /** + * Encodes the specified GetLogMetricRequest message. Does not implicitly {@link google.logging.v2.GetLogMetricRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.GetLogMetricRequest + * @static + * @param {google.logging.v2.IGetLogMetricRequest} message GetLogMetricRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetLogMetricRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.metricName != null && Object.hasOwnProperty.call(message, "metricName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.metricName); + return writer; + }; + + /** + * Encodes the specified GetLogMetricRequest message, length delimited. Does not implicitly {@link google.logging.v2.GetLogMetricRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.GetLogMetricRequest + * @static + * @param {google.logging.v2.IGetLogMetricRequest} message GetLogMetricRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetLogMetricRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetLogMetricRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.GetLogMetricRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.GetLogMetricRequest} GetLogMetricRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetLogMetricRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.GetLogMetricRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.metricName = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetLogMetricRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.GetLogMetricRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.GetLogMetricRequest} GetLogMetricRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetLogMetricRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetLogMetricRequest message. + * @function verify + * @memberof google.logging.v2.GetLogMetricRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetLogMetricRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.metricName != null && message.hasOwnProperty("metricName")) + if (!$util.isString(message.metricName)) + return "metricName: string expected"; + return null; + }; + + /** + * Creates a GetLogMetricRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.GetLogMetricRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.GetLogMetricRequest} GetLogMetricRequest + */ + GetLogMetricRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.GetLogMetricRequest) + return object; + var message = new $root.google.logging.v2.GetLogMetricRequest(); + if (object.metricName != null) + message.metricName = String(object.metricName); + return message; + }; + + /** + * Creates a plain object from a GetLogMetricRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.GetLogMetricRequest + * @static + * @param {google.logging.v2.GetLogMetricRequest} message GetLogMetricRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetLogMetricRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.metricName = ""; + if (message.metricName != null && message.hasOwnProperty("metricName")) + object.metricName = message.metricName; + return object; + }; + + /** + * Converts this GetLogMetricRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.GetLogMetricRequest + * @instance + * @returns {Object.} JSON object + */ + GetLogMetricRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetLogMetricRequest + * @function getTypeUrl + * @memberof google.logging.v2.GetLogMetricRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetLogMetricRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.GetLogMetricRequest"; + }; + + return GetLogMetricRequest; + })(); + + v2.CreateLogMetricRequest = (function() { + + /** + * Properties of a CreateLogMetricRequest. + * @memberof google.logging.v2 + * @interface ICreateLogMetricRequest + * @property {string|null} [parent] CreateLogMetricRequest parent + * @property {google.logging.v2.ILogMetric|null} [metric] CreateLogMetricRequest metric + */ + + /** + * Constructs a new CreateLogMetricRequest. + * @memberof google.logging.v2 + * @classdesc Represents a CreateLogMetricRequest. + * @implements ICreateLogMetricRequest + * @constructor + * @param {google.logging.v2.ICreateLogMetricRequest=} [properties] Properties to set + */ + function CreateLogMetricRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CreateLogMetricRequest parent. + * @member {string} parent + * @memberof google.logging.v2.CreateLogMetricRequest + * @instance + */ + CreateLogMetricRequest.prototype.parent = ""; + + /** + * CreateLogMetricRequest metric. + * @member {google.logging.v2.ILogMetric|null|undefined} metric + * @memberof google.logging.v2.CreateLogMetricRequest + * @instance + */ + CreateLogMetricRequest.prototype.metric = null; + + /** + * Creates a new CreateLogMetricRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.CreateLogMetricRequest + * @static + * @param {google.logging.v2.ICreateLogMetricRequest=} [properties] Properties to set + * @returns {google.logging.v2.CreateLogMetricRequest} CreateLogMetricRequest instance + */ + CreateLogMetricRequest.create = function create(properties) { + return new CreateLogMetricRequest(properties); + }; + + /** + * Encodes the specified CreateLogMetricRequest message. Does not implicitly {@link google.logging.v2.CreateLogMetricRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.CreateLogMetricRequest + * @static + * @param {google.logging.v2.ICreateLogMetricRequest} message CreateLogMetricRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateLogMetricRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.parent != null && Object.hasOwnProperty.call(message, "parent")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.parent); + if (message.metric != null && Object.hasOwnProperty.call(message, "metric")) + $root.google.logging.v2.LogMetric.encode(message.metric, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CreateLogMetricRequest message, length delimited. Does not implicitly {@link google.logging.v2.CreateLogMetricRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.CreateLogMetricRequest + * @static + * @param {google.logging.v2.ICreateLogMetricRequest} message CreateLogMetricRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CreateLogMetricRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CreateLogMetricRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.CreateLogMetricRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.CreateLogMetricRequest} CreateLogMetricRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateLogMetricRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.CreateLogMetricRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.parent = reader.string(); + break; + } + case 2: { + message.metric = $root.google.logging.v2.LogMetric.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CreateLogMetricRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.CreateLogMetricRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.CreateLogMetricRequest} CreateLogMetricRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CreateLogMetricRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CreateLogMetricRequest message. + * @function verify + * @memberof google.logging.v2.CreateLogMetricRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CreateLogMetricRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.parent != null && message.hasOwnProperty("parent")) + if (!$util.isString(message.parent)) + return "parent: string expected"; + if (message.metric != null && message.hasOwnProperty("metric")) { + var error = $root.google.logging.v2.LogMetric.verify(message.metric); + if (error) + return "metric." + error; + } + return null; + }; + + /** + * Creates a CreateLogMetricRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.CreateLogMetricRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.CreateLogMetricRequest} CreateLogMetricRequest + */ + CreateLogMetricRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.CreateLogMetricRequest) + return object; + var message = new $root.google.logging.v2.CreateLogMetricRequest(); + if (object.parent != null) + message.parent = String(object.parent); + if (object.metric != null) { + if (typeof object.metric !== "object") + throw TypeError(".google.logging.v2.CreateLogMetricRequest.metric: object expected"); + message.metric = $root.google.logging.v2.LogMetric.fromObject(object.metric); + } + return message; + }; + + /** + * Creates a plain object from a CreateLogMetricRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.CreateLogMetricRequest + * @static + * @param {google.logging.v2.CreateLogMetricRequest} message CreateLogMetricRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CreateLogMetricRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.parent = ""; + object.metric = null; + } + if (message.parent != null && message.hasOwnProperty("parent")) + object.parent = message.parent; + if (message.metric != null && message.hasOwnProperty("metric")) + object.metric = $root.google.logging.v2.LogMetric.toObject(message.metric, options); + return object; + }; + + /** + * Converts this CreateLogMetricRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.CreateLogMetricRequest + * @instance + * @returns {Object.} JSON object + */ + CreateLogMetricRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CreateLogMetricRequest + * @function getTypeUrl + * @memberof google.logging.v2.CreateLogMetricRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CreateLogMetricRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.CreateLogMetricRequest"; + }; + + return CreateLogMetricRequest; + })(); + + v2.UpdateLogMetricRequest = (function() { + + /** + * Properties of an UpdateLogMetricRequest. + * @memberof google.logging.v2 + * @interface IUpdateLogMetricRequest + * @property {string|null} [metricName] UpdateLogMetricRequest metricName + * @property {google.logging.v2.ILogMetric|null} [metric] UpdateLogMetricRequest metric + */ + + /** + * Constructs a new UpdateLogMetricRequest. + * @memberof google.logging.v2 + * @classdesc Represents an UpdateLogMetricRequest. + * @implements IUpdateLogMetricRequest + * @constructor + * @param {google.logging.v2.IUpdateLogMetricRequest=} [properties] Properties to set + */ + function UpdateLogMetricRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * UpdateLogMetricRequest metricName. + * @member {string} metricName + * @memberof google.logging.v2.UpdateLogMetricRequest + * @instance + */ + UpdateLogMetricRequest.prototype.metricName = ""; + + /** + * UpdateLogMetricRequest metric. + * @member {google.logging.v2.ILogMetric|null|undefined} metric + * @memberof google.logging.v2.UpdateLogMetricRequest + * @instance + */ + UpdateLogMetricRequest.prototype.metric = null; + + /** + * Creates a new UpdateLogMetricRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.UpdateLogMetricRequest + * @static + * @param {google.logging.v2.IUpdateLogMetricRequest=} [properties] Properties to set + * @returns {google.logging.v2.UpdateLogMetricRequest} UpdateLogMetricRequest instance + */ + UpdateLogMetricRequest.create = function create(properties) { + return new UpdateLogMetricRequest(properties); + }; + + /** + * Encodes the specified UpdateLogMetricRequest message. Does not implicitly {@link google.logging.v2.UpdateLogMetricRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.UpdateLogMetricRequest + * @static + * @param {google.logging.v2.IUpdateLogMetricRequest} message UpdateLogMetricRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateLogMetricRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.metricName != null && Object.hasOwnProperty.call(message, "metricName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.metricName); + if (message.metric != null && Object.hasOwnProperty.call(message, "metric")) + $root.google.logging.v2.LogMetric.encode(message.metric, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified UpdateLogMetricRequest message, length delimited. Does not implicitly {@link google.logging.v2.UpdateLogMetricRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.UpdateLogMetricRequest + * @static + * @param {google.logging.v2.IUpdateLogMetricRequest} message UpdateLogMetricRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + UpdateLogMetricRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an UpdateLogMetricRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.UpdateLogMetricRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.UpdateLogMetricRequest} UpdateLogMetricRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateLogMetricRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.UpdateLogMetricRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.metricName = reader.string(); + break; + } + case 2: { + message.metric = $root.google.logging.v2.LogMetric.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an UpdateLogMetricRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.UpdateLogMetricRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.UpdateLogMetricRequest} UpdateLogMetricRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + UpdateLogMetricRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an UpdateLogMetricRequest message. + * @function verify + * @memberof google.logging.v2.UpdateLogMetricRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + UpdateLogMetricRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.metricName != null && message.hasOwnProperty("metricName")) + if (!$util.isString(message.metricName)) + return "metricName: string expected"; + if (message.metric != null && message.hasOwnProperty("metric")) { + var error = $root.google.logging.v2.LogMetric.verify(message.metric); + if (error) + return "metric." + error; + } + return null; + }; + + /** + * Creates an UpdateLogMetricRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.UpdateLogMetricRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.UpdateLogMetricRequest} UpdateLogMetricRequest + */ + UpdateLogMetricRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.UpdateLogMetricRequest) + return object; + var message = new $root.google.logging.v2.UpdateLogMetricRequest(); + if (object.metricName != null) + message.metricName = String(object.metricName); + if (object.metric != null) { + if (typeof object.metric !== "object") + throw TypeError(".google.logging.v2.UpdateLogMetricRequest.metric: object expected"); + message.metric = $root.google.logging.v2.LogMetric.fromObject(object.metric); + } + return message; + }; + + /** + * Creates a plain object from an UpdateLogMetricRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.UpdateLogMetricRequest + * @static + * @param {google.logging.v2.UpdateLogMetricRequest} message UpdateLogMetricRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + UpdateLogMetricRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.metricName = ""; + object.metric = null; + } + if (message.metricName != null && message.hasOwnProperty("metricName")) + object.metricName = message.metricName; + if (message.metric != null && message.hasOwnProperty("metric")) + object.metric = $root.google.logging.v2.LogMetric.toObject(message.metric, options); + return object; + }; + + /** + * Converts this UpdateLogMetricRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.UpdateLogMetricRequest + * @instance + * @returns {Object.} JSON object + */ + UpdateLogMetricRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for UpdateLogMetricRequest + * @function getTypeUrl + * @memberof google.logging.v2.UpdateLogMetricRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + UpdateLogMetricRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.UpdateLogMetricRequest"; + }; + + return UpdateLogMetricRequest; + })(); + + v2.DeleteLogMetricRequest = (function() { + + /** + * Properties of a DeleteLogMetricRequest. + * @memberof google.logging.v2 + * @interface IDeleteLogMetricRequest + * @property {string|null} [metricName] DeleteLogMetricRequest metricName + */ + + /** + * Constructs a new DeleteLogMetricRequest. + * @memberof google.logging.v2 + * @classdesc Represents a DeleteLogMetricRequest. + * @implements IDeleteLogMetricRequest + * @constructor + * @param {google.logging.v2.IDeleteLogMetricRequest=} [properties] Properties to set + */ + function DeleteLogMetricRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteLogMetricRequest metricName. + * @member {string} metricName + * @memberof google.logging.v2.DeleteLogMetricRequest + * @instance + */ + DeleteLogMetricRequest.prototype.metricName = ""; + + /** + * Creates a new DeleteLogMetricRequest instance using the specified properties. + * @function create + * @memberof google.logging.v2.DeleteLogMetricRequest + * @static + * @param {google.logging.v2.IDeleteLogMetricRequest=} [properties] Properties to set + * @returns {google.logging.v2.DeleteLogMetricRequest} DeleteLogMetricRequest instance + */ + DeleteLogMetricRequest.create = function create(properties) { + return new DeleteLogMetricRequest(properties); + }; + + /** + * Encodes the specified DeleteLogMetricRequest message. Does not implicitly {@link google.logging.v2.DeleteLogMetricRequest.verify|verify} messages. + * @function encode + * @memberof google.logging.v2.DeleteLogMetricRequest + * @static + * @param {google.logging.v2.IDeleteLogMetricRequest} message DeleteLogMetricRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteLogMetricRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.metricName != null && Object.hasOwnProperty.call(message, "metricName")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.metricName); + return writer; + }; + + /** + * Encodes the specified DeleteLogMetricRequest message, length delimited. Does not implicitly {@link google.logging.v2.DeleteLogMetricRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.logging.v2.DeleteLogMetricRequest + * @static + * @param {google.logging.v2.IDeleteLogMetricRequest} message DeleteLogMetricRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteLogMetricRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteLogMetricRequest message from the specified reader or buffer. + * @function decode + * @memberof google.logging.v2.DeleteLogMetricRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.logging.v2.DeleteLogMetricRequest} DeleteLogMetricRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteLogMetricRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.logging.v2.DeleteLogMetricRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.metricName = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteLogMetricRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.logging.v2.DeleteLogMetricRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.logging.v2.DeleteLogMetricRequest} DeleteLogMetricRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteLogMetricRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteLogMetricRequest message. + * @function verify + * @memberof google.logging.v2.DeleteLogMetricRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteLogMetricRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.metricName != null && message.hasOwnProperty("metricName")) + if (!$util.isString(message.metricName)) + return "metricName: string expected"; + return null; + }; + + /** + * Creates a DeleteLogMetricRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.logging.v2.DeleteLogMetricRequest + * @static + * @param {Object.} object Plain object + * @returns {google.logging.v2.DeleteLogMetricRequest} DeleteLogMetricRequest + */ + DeleteLogMetricRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.logging.v2.DeleteLogMetricRequest) + return object; + var message = new $root.google.logging.v2.DeleteLogMetricRequest(); + if (object.metricName != null) + message.metricName = String(object.metricName); + return message; + }; + + /** + * Creates a plain object from a DeleteLogMetricRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.logging.v2.DeleteLogMetricRequest + * @static + * @param {google.logging.v2.DeleteLogMetricRequest} message DeleteLogMetricRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteLogMetricRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.metricName = ""; + if (message.metricName != null && message.hasOwnProperty("metricName")) + object.metricName = message.metricName; + return object; + }; + + /** + * Converts this DeleteLogMetricRequest to JSON. + * @function toJSON + * @memberof google.logging.v2.DeleteLogMetricRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteLogMetricRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteLogMetricRequest + * @function getTypeUrl + * @memberof google.logging.v2.DeleteLogMetricRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteLogMetricRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.logging.v2.DeleteLogMetricRequest"; + }; + + return DeleteLogMetricRequest; + })(); + + return v2; + })(); + + return logging; + })(); + + google.api = (function() { + + /** + * Namespace api. + * @memberof google + * @namespace + */ + var api = {}; + + /** + * FieldBehavior enum. + * @name google.api.FieldBehavior + * @enum {number} + * @property {number} FIELD_BEHAVIOR_UNSPECIFIED=0 FIELD_BEHAVIOR_UNSPECIFIED value + * @property {number} OPTIONAL=1 OPTIONAL value + * @property {number} REQUIRED=2 REQUIRED value + * @property {number} OUTPUT_ONLY=3 OUTPUT_ONLY value + * @property {number} INPUT_ONLY=4 INPUT_ONLY value + * @property {number} IMMUTABLE=5 IMMUTABLE value + * @property {number} UNORDERED_LIST=6 UNORDERED_LIST value + * @property {number} NON_EMPTY_DEFAULT=7 NON_EMPTY_DEFAULT value + * @property {number} IDENTIFIER=8 IDENTIFIER value + */ + api.FieldBehavior = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "FIELD_BEHAVIOR_UNSPECIFIED"] = 0; + values[valuesById[1] = "OPTIONAL"] = 1; + values[valuesById[2] = "REQUIRED"] = 2; + values[valuesById[3] = "OUTPUT_ONLY"] = 3; + values[valuesById[4] = "INPUT_ONLY"] = 4; + values[valuesById[5] = "IMMUTABLE"] = 5; + values[valuesById[6] = "UNORDERED_LIST"] = 6; + values[valuesById[7] = "NON_EMPTY_DEFAULT"] = 7; + values[valuesById[8] = "IDENTIFIER"] = 8; + return values; + })(); + + api.MonitoredResourceDescriptor = (function() { + + /** + * Properties of a MonitoredResourceDescriptor. + * @memberof google.api + * @interface IMonitoredResourceDescriptor + * @property {string|null} [name] MonitoredResourceDescriptor name + * @property {string|null} [type] MonitoredResourceDescriptor type + * @property {string|null} [displayName] MonitoredResourceDescriptor displayName + * @property {string|null} [description] MonitoredResourceDescriptor description + * @property {Array.|null} [labels] MonitoredResourceDescriptor labels + * @property {google.api.LaunchStage|null} [launchStage] MonitoredResourceDescriptor launchStage + */ + + /** + * Constructs a new MonitoredResourceDescriptor. + * @memberof google.api + * @classdesc Represents a MonitoredResourceDescriptor. + * @implements IMonitoredResourceDescriptor + * @constructor + * @param {google.api.IMonitoredResourceDescriptor=} [properties] Properties to set + */ + function MonitoredResourceDescriptor(properties) { + this.labels = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MonitoredResourceDescriptor name. + * @member {string} name + * @memberof google.api.MonitoredResourceDescriptor + * @instance + */ + MonitoredResourceDescriptor.prototype.name = ""; + + /** + * MonitoredResourceDescriptor type. + * @member {string} type + * @memberof google.api.MonitoredResourceDescriptor + * @instance + */ + MonitoredResourceDescriptor.prototype.type = ""; + + /** + * MonitoredResourceDescriptor displayName. + * @member {string} displayName + * @memberof google.api.MonitoredResourceDescriptor + * @instance + */ + MonitoredResourceDescriptor.prototype.displayName = ""; + + /** + * MonitoredResourceDescriptor description. + * @member {string} description + * @memberof google.api.MonitoredResourceDescriptor + * @instance + */ + MonitoredResourceDescriptor.prototype.description = ""; + + /** + * MonitoredResourceDescriptor labels. + * @member {Array.} labels + * @memberof google.api.MonitoredResourceDescriptor + * @instance + */ + MonitoredResourceDescriptor.prototype.labels = $util.emptyArray; + + /** + * MonitoredResourceDescriptor launchStage. + * @member {google.api.LaunchStage} launchStage + * @memberof google.api.MonitoredResourceDescriptor + * @instance + */ + MonitoredResourceDescriptor.prototype.launchStage = 0; + + /** + * Creates a new MonitoredResourceDescriptor instance using the specified properties. + * @function create + * @memberof google.api.MonitoredResourceDescriptor + * @static + * @param {google.api.IMonitoredResourceDescriptor=} [properties] Properties to set + * @returns {google.api.MonitoredResourceDescriptor} MonitoredResourceDescriptor instance + */ + MonitoredResourceDescriptor.create = function create(properties) { + return new MonitoredResourceDescriptor(properties); + }; + + /** + * Encodes the specified MonitoredResourceDescriptor message. Does not implicitly {@link google.api.MonitoredResourceDescriptor.verify|verify} messages. + * @function encode + * @memberof google.api.MonitoredResourceDescriptor + * @static + * @param {google.api.IMonitoredResourceDescriptor} message MonitoredResourceDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MonitoredResourceDescriptor.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.displayName); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); + if (message.labels != null && message.labels.length) + for (var i = 0; i < message.labels.length; ++i) + $root.google.api.LabelDescriptor.encode(message.labels[i], writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.name); + if (message.launchStage != null && Object.hasOwnProperty.call(message, "launchStage")) + writer.uint32(/* id 7, wireType 0 =*/56).int32(message.launchStage); + return writer; + }; + + /** + * Encodes the specified MonitoredResourceDescriptor message, length delimited. Does not implicitly {@link google.api.MonitoredResourceDescriptor.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.MonitoredResourceDescriptor + * @static + * @param {google.api.IMonitoredResourceDescriptor} message MonitoredResourceDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MonitoredResourceDescriptor.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MonitoredResourceDescriptor message from the specified reader or buffer. + * @function decode + * @memberof google.api.MonitoredResourceDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.MonitoredResourceDescriptor} MonitoredResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MonitoredResourceDescriptor.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.MonitoredResourceDescriptor(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 5: { + message.name = reader.string(); + break; + } + case 1: { + message.type = reader.string(); + break; + } + case 2: { + message.displayName = reader.string(); + break; + } + case 3: { + message.description = reader.string(); + break; + } + case 4: { + if (!(message.labels && message.labels.length)) + message.labels = []; + message.labels.push($root.google.api.LabelDescriptor.decode(reader, reader.uint32())); + break; + } + case 7: { + message.launchStage = reader.int32(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MonitoredResourceDescriptor message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.MonitoredResourceDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.MonitoredResourceDescriptor} MonitoredResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MonitoredResourceDescriptor.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MonitoredResourceDescriptor message. + * @function verify + * @memberof google.api.MonitoredResourceDescriptor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MonitoredResourceDescriptor.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!Array.isArray(message.labels)) + return "labels: array expected"; + for (var i = 0; i < message.labels.length; ++i) { + var error = $root.google.api.LabelDescriptor.verify(message.labels[i]); + if (error) + return "labels." + error; + } + } + if (message.launchStage != null && message.hasOwnProperty("launchStage")) + switch (message.launchStage) { + default: + return "launchStage: enum value expected"; + case 0: + case 6: + case 7: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + return null; + }; + + /** + * Creates a MonitoredResourceDescriptor message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.MonitoredResourceDescriptor + * @static + * @param {Object.} object Plain object + * @returns {google.api.MonitoredResourceDescriptor} MonitoredResourceDescriptor + */ + MonitoredResourceDescriptor.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.MonitoredResourceDescriptor) + return object; + var message = new $root.google.api.MonitoredResourceDescriptor(); + if (object.name != null) + message.name = String(object.name); + if (object.type != null) + message.type = String(object.type); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.description != null) + message.description = String(object.description); + if (object.labels) { + if (!Array.isArray(object.labels)) + throw TypeError(".google.api.MonitoredResourceDescriptor.labels: array expected"); + message.labels = []; + for (var i = 0; i < object.labels.length; ++i) { + if (typeof object.labels[i] !== "object") + throw TypeError(".google.api.MonitoredResourceDescriptor.labels: object expected"); + message.labels[i] = $root.google.api.LabelDescriptor.fromObject(object.labels[i]); + } + } + switch (object.launchStage) { + default: + if (typeof object.launchStage === "number") { + message.launchStage = object.launchStage; + break; + } + break; + case "LAUNCH_STAGE_UNSPECIFIED": + case 0: + message.launchStage = 0; + break; + case "UNIMPLEMENTED": + case 6: + message.launchStage = 6; + break; + case "PRELAUNCH": + case 7: + message.launchStage = 7; + break; + case "EARLY_ACCESS": + case 1: + message.launchStage = 1; + break; + case "ALPHA": + case 2: + message.launchStage = 2; + break; + case "BETA": + case 3: + message.launchStage = 3; + break; + case "GA": + case 4: + message.launchStage = 4; + break; + case "DEPRECATED": + case 5: + message.launchStage = 5; + break; + } + return message; + }; + + /** + * Creates a plain object from a MonitoredResourceDescriptor message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.MonitoredResourceDescriptor + * @static + * @param {google.api.MonitoredResourceDescriptor} message MonitoredResourceDescriptor + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MonitoredResourceDescriptor.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.labels = []; + if (options.defaults) { + object.type = ""; + object.displayName = ""; + object.description = ""; + object.name = ""; + object.launchStage = options.enums === String ? "LAUNCH_STAGE_UNSPECIFIED" : 0; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.labels && message.labels.length) { + object.labels = []; + for (var j = 0; j < message.labels.length; ++j) + object.labels[j] = $root.google.api.LabelDescriptor.toObject(message.labels[j], options); + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.launchStage != null && message.hasOwnProperty("launchStage")) + object.launchStage = options.enums === String ? $root.google.api.LaunchStage[message.launchStage] === undefined ? message.launchStage : $root.google.api.LaunchStage[message.launchStage] : message.launchStage; + return object; + }; + + /** + * Converts this MonitoredResourceDescriptor to JSON. + * @function toJSON + * @memberof google.api.MonitoredResourceDescriptor + * @instance + * @returns {Object.} JSON object + */ + MonitoredResourceDescriptor.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MonitoredResourceDescriptor + * @function getTypeUrl + * @memberof google.api.MonitoredResourceDescriptor + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MonitoredResourceDescriptor.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.MonitoredResourceDescriptor"; + }; + + return MonitoredResourceDescriptor; + })(); + + api.MonitoredResource = (function() { + + /** + * Properties of a MonitoredResource. + * @memberof google.api + * @interface IMonitoredResource + * @property {string|null} [type] MonitoredResource type + * @property {Object.|null} [labels] MonitoredResource labels + */ + + /** + * Constructs a new MonitoredResource. + * @memberof google.api + * @classdesc Represents a MonitoredResource. + * @implements IMonitoredResource + * @constructor + * @param {google.api.IMonitoredResource=} [properties] Properties to set + */ + function MonitoredResource(properties) { + this.labels = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MonitoredResource type. + * @member {string} type + * @memberof google.api.MonitoredResource + * @instance + */ + MonitoredResource.prototype.type = ""; + + /** + * MonitoredResource labels. + * @member {Object.} labels + * @memberof google.api.MonitoredResource + * @instance + */ + MonitoredResource.prototype.labels = $util.emptyObject; + + /** + * Creates a new MonitoredResource instance using the specified properties. + * @function create + * @memberof google.api.MonitoredResource + * @static + * @param {google.api.IMonitoredResource=} [properties] Properties to set + * @returns {google.api.MonitoredResource} MonitoredResource instance + */ + MonitoredResource.create = function create(properties) { + return new MonitoredResource(properties); + }; + + /** + * Encodes the specified MonitoredResource message. Does not implicitly {@link google.api.MonitoredResource.verify|verify} messages. + * @function encode + * @memberof google.api.MonitoredResource + * @static + * @param {google.api.IMonitoredResource} message MonitoredResource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MonitoredResource.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified MonitoredResource message, length delimited. Does not implicitly {@link google.api.MonitoredResource.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.MonitoredResource + * @static + * @param {google.api.IMonitoredResource} message MonitoredResource message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MonitoredResource.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MonitoredResource message from the specified reader or buffer. + * @function decode + * @memberof google.api.MonitoredResource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.MonitoredResource} MonitoredResource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MonitoredResource.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.MonitoredResource(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.type = reader.string(); + break; + } + case 2: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MonitoredResource message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.MonitoredResource + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.MonitoredResource} MonitoredResource + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MonitoredResource.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MonitoredResource message. + * @function verify + * @memberof google.api.MonitoredResource + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MonitoredResource.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a MonitoredResource message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.MonitoredResource + * @static + * @param {Object.} object Plain object + * @returns {google.api.MonitoredResource} MonitoredResource + */ + MonitoredResource.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.MonitoredResource) + return object; + var message = new $root.google.api.MonitoredResource(); + if (object.type != null) + message.type = String(object.type); + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.api.MonitoredResource.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from a MonitoredResource message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.MonitoredResource + * @static + * @param {google.api.MonitoredResource} message MonitoredResource + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MonitoredResource.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) + object.type = ""; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + return object; + }; + + /** + * Converts this MonitoredResource to JSON. + * @function toJSON + * @memberof google.api.MonitoredResource + * @instance + * @returns {Object.} JSON object + */ + MonitoredResource.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MonitoredResource + * @function getTypeUrl + * @memberof google.api.MonitoredResource + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MonitoredResource.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.MonitoredResource"; + }; + + return MonitoredResource; + })(); + + api.MonitoredResourceMetadata = (function() { + + /** + * Properties of a MonitoredResourceMetadata. + * @memberof google.api + * @interface IMonitoredResourceMetadata + * @property {google.protobuf.IStruct|null} [systemLabels] MonitoredResourceMetadata systemLabels + * @property {Object.|null} [userLabels] MonitoredResourceMetadata userLabels + */ + + /** + * Constructs a new MonitoredResourceMetadata. + * @memberof google.api + * @classdesc Represents a MonitoredResourceMetadata. + * @implements IMonitoredResourceMetadata + * @constructor + * @param {google.api.IMonitoredResourceMetadata=} [properties] Properties to set + */ + function MonitoredResourceMetadata(properties) { + this.userLabels = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MonitoredResourceMetadata systemLabels. + * @member {google.protobuf.IStruct|null|undefined} systemLabels + * @memberof google.api.MonitoredResourceMetadata + * @instance + */ + MonitoredResourceMetadata.prototype.systemLabels = null; + + /** + * MonitoredResourceMetadata userLabels. + * @member {Object.} userLabels + * @memberof google.api.MonitoredResourceMetadata + * @instance + */ + MonitoredResourceMetadata.prototype.userLabels = $util.emptyObject; + + /** + * Creates a new MonitoredResourceMetadata instance using the specified properties. + * @function create + * @memberof google.api.MonitoredResourceMetadata + * @static + * @param {google.api.IMonitoredResourceMetadata=} [properties] Properties to set + * @returns {google.api.MonitoredResourceMetadata} MonitoredResourceMetadata instance + */ + MonitoredResourceMetadata.create = function create(properties) { + return new MonitoredResourceMetadata(properties); + }; + + /** + * Encodes the specified MonitoredResourceMetadata message. Does not implicitly {@link google.api.MonitoredResourceMetadata.verify|verify} messages. + * @function encode + * @memberof google.api.MonitoredResourceMetadata + * @static + * @param {google.api.IMonitoredResourceMetadata} message MonitoredResourceMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MonitoredResourceMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.systemLabels != null && Object.hasOwnProperty.call(message, "systemLabels")) + $root.google.protobuf.Struct.encode(message.systemLabels, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.userLabels != null && Object.hasOwnProperty.call(message, "userLabels")) + for (var keys = Object.keys(message.userLabels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.userLabels[keys[i]]).ldelim(); + return writer; + }; + + /** + * Encodes the specified MonitoredResourceMetadata message, length delimited. Does not implicitly {@link google.api.MonitoredResourceMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.MonitoredResourceMetadata + * @static + * @param {google.api.IMonitoredResourceMetadata} message MonitoredResourceMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MonitoredResourceMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MonitoredResourceMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.api.MonitoredResourceMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.MonitoredResourceMetadata} MonitoredResourceMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MonitoredResourceMetadata.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.MonitoredResourceMetadata(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.systemLabels = $root.google.protobuf.Struct.decode(reader, reader.uint32()); + break; + } + case 2: { + if (message.userLabels === $util.emptyObject) + message.userLabels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.userLabels[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MonitoredResourceMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.MonitoredResourceMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.MonitoredResourceMetadata} MonitoredResourceMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MonitoredResourceMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MonitoredResourceMetadata message. + * @function verify + * @memberof google.api.MonitoredResourceMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MonitoredResourceMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.systemLabels != null && message.hasOwnProperty("systemLabels")) { + var error = $root.google.protobuf.Struct.verify(message.systemLabels); + if (error) + return "systemLabels." + error; + } + if (message.userLabels != null && message.hasOwnProperty("userLabels")) { + if (!$util.isObject(message.userLabels)) + return "userLabels: object expected"; + var key = Object.keys(message.userLabels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.userLabels[key[i]])) + return "userLabels: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a MonitoredResourceMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.MonitoredResourceMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.api.MonitoredResourceMetadata} MonitoredResourceMetadata + */ + MonitoredResourceMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.MonitoredResourceMetadata) + return object; + var message = new $root.google.api.MonitoredResourceMetadata(); + if (object.systemLabels != null) { + if (typeof object.systemLabels !== "object") + throw TypeError(".google.api.MonitoredResourceMetadata.systemLabels: object expected"); + message.systemLabels = $root.google.protobuf.Struct.fromObject(object.systemLabels); + } + if (object.userLabels) { + if (typeof object.userLabels !== "object") + throw TypeError(".google.api.MonitoredResourceMetadata.userLabels: object expected"); + message.userLabels = {}; + for (var keys = Object.keys(object.userLabels), i = 0; i < keys.length; ++i) + message.userLabels[keys[i]] = String(object.userLabels[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from a MonitoredResourceMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.MonitoredResourceMetadata + * @static + * @param {google.api.MonitoredResourceMetadata} message MonitoredResourceMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MonitoredResourceMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.userLabels = {}; + if (options.defaults) + object.systemLabels = null; + if (message.systemLabels != null && message.hasOwnProperty("systemLabels")) + object.systemLabels = $root.google.protobuf.Struct.toObject(message.systemLabels, options); + var keys2; + if (message.userLabels && (keys2 = Object.keys(message.userLabels)).length) { + object.userLabels = {}; + for (var j = 0; j < keys2.length; ++j) + object.userLabels[keys2[j]] = message.userLabels[keys2[j]]; + } + return object; + }; + + /** + * Converts this MonitoredResourceMetadata to JSON. + * @function toJSON + * @memberof google.api.MonitoredResourceMetadata + * @instance + * @returns {Object.} JSON object + */ + MonitoredResourceMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MonitoredResourceMetadata + * @function getTypeUrl + * @memberof google.api.MonitoredResourceMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MonitoredResourceMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.MonitoredResourceMetadata"; + }; + + return MonitoredResourceMetadata; + })(); + + api.LabelDescriptor = (function() { + + /** + * Properties of a LabelDescriptor. + * @memberof google.api + * @interface ILabelDescriptor + * @property {string|null} [key] LabelDescriptor key + * @property {google.api.LabelDescriptor.ValueType|null} [valueType] LabelDescriptor valueType + * @property {string|null} [description] LabelDescriptor description + */ + + /** + * Constructs a new LabelDescriptor. + * @memberof google.api + * @classdesc Represents a LabelDescriptor. + * @implements ILabelDescriptor + * @constructor + * @param {google.api.ILabelDescriptor=} [properties] Properties to set + */ + function LabelDescriptor(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LabelDescriptor key. + * @member {string} key + * @memberof google.api.LabelDescriptor + * @instance + */ + LabelDescriptor.prototype.key = ""; + + /** + * LabelDescriptor valueType. + * @member {google.api.LabelDescriptor.ValueType} valueType + * @memberof google.api.LabelDescriptor + * @instance + */ + LabelDescriptor.prototype.valueType = 0; + + /** + * LabelDescriptor description. + * @member {string} description + * @memberof google.api.LabelDescriptor + * @instance + */ + LabelDescriptor.prototype.description = ""; + + /** + * Creates a new LabelDescriptor instance using the specified properties. + * @function create + * @memberof google.api.LabelDescriptor + * @static + * @param {google.api.ILabelDescriptor=} [properties] Properties to set + * @returns {google.api.LabelDescriptor} LabelDescriptor instance + */ + LabelDescriptor.create = function create(properties) { + return new LabelDescriptor(properties); + }; + + /** + * Encodes the specified LabelDescriptor message. Does not implicitly {@link google.api.LabelDescriptor.verify|verify} messages. + * @function encode + * @memberof google.api.LabelDescriptor + * @static + * @param {google.api.ILabelDescriptor} message LabelDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LabelDescriptor.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.key != null && Object.hasOwnProperty.call(message, "key")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.key); + if (message.valueType != null && Object.hasOwnProperty.call(message, "valueType")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.valueType); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.description); + return writer; + }; + + /** + * Encodes the specified LabelDescriptor message, length delimited. Does not implicitly {@link google.api.LabelDescriptor.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.LabelDescriptor + * @static + * @param {google.api.ILabelDescriptor} message LabelDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LabelDescriptor.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LabelDescriptor message from the specified reader or buffer. + * @function decode + * @memberof google.api.LabelDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.LabelDescriptor} LabelDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LabelDescriptor.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.LabelDescriptor(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.key = reader.string(); + break; + } + case 2: { + message.valueType = reader.int32(); + break; + } + case 3: { + message.description = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LabelDescriptor message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.LabelDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.LabelDescriptor} LabelDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LabelDescriptor.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LabelDescriptor message. + * @function verify + * @memberof google.api.LabelDescriptor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LabelDescriptor.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.key != null && message.hasOwnProperty("key")) + if (!$util.isString(message.key)) + return "key: string expected"; + if (message.valueType != null && message.hasOwnProperty("valueType")) + switch (message.valueType) { + default: + return "valueType: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + return null; + }; + + /** + * Creates a LabelDescriptor message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.LabelDescriptor + * @static + * @param {Object.} object Plain object + * @returns {google.api.LabelDescriptor} LabelDescriptor + */ + LabelDescriptor.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.LabelDescriptor) + return object; + var message = new $root.google.api.LabelDescriptor(); + if (object.key != null) + message.key = String(object.key); + switch (object.valueType) { + default: + if (typeof object.valueType === "number") { + message.valueType = object.valueType; + break; + } + break; + case "STRING": + case 0: + message.valueType = 0; + break; + case "BOOL": + case 1: + message.valueType = 1; + break; + case "INT64": + case 2: + message.valueType = 2; + break; + } + if (object.description != null) + message.description = String(object.description); + return message; + }; + + /** + * Creates a plain object from a LabelDescriptor message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.LabelDescriptor + * @static + * @param {google.api.LabelDescriptor} message LabelDescriptor + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LabelDescriptor.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.key = ""; + object.valueType = options.enums === String ? "STRING" : 0; + object.description = ""; + } + if (message.key != null && message.hasOwnProperty("key")) + object.key = message.key; + if (message.valueType != null && message.hasOwnProperty("valueType")) + object.valueType = options.enums === String ? $root.google.api.LabelDescriptor.ValueType[message.valueType] === undefined ? message.valueType : $root.google.api.LabelDescriptor.ValueType[message.valueType] : message.valueType; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + return object; + }; + + /** + * Converts this LabelDescriptor to JSON. + * @function toJSON + * @memberof google.api.LabelDescriptor + * @instance + * @returns {Object.} JSON object + */ + LabelDescriptor.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LabelDescriptor + * @function getTypeUrl + * @memberof google.api.LabelDescriptor + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LabelDescriptor.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.LabelDescriptor"; + }; + + /** + * ValueType enum. + * @name google.api.LabelDescriptor.ValueType + * @enum {number} + * @property {number} STRING=0 STRING value + * @property {number} BOOL=1 BOOL value + * @property {number} INT64=2 INT64 value + */ + LabelDescriptor.ValueType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STRING"] = 0; + values[valuesById[1] = "BOOL"] = 1; + values[valuesById[2] = "INT64"] = 2; + return values; + })(); + + return LabelDescriptor; + })(); + + /** + * LaunchStage enum. + * @name google.api.LaunchStage + * @enum {number} + * @property {number} LAUNCH_STAGE_UNSPECIFIED=0 LAUNCH_STAGE_UNSPECIFIED value + * @property {number} UNIMPLEMENTED=6 UNIMPLEMENTED value + * @property {number} PRELAUNCH=7 PRELAUNCH value + * @property {number} EARLY_ACCESS=1 EARLY_ACCESS value + * @property {number} ALPHA=2 ALPHA value + * @property {number} BETA=3 BETA value + * @property {number} GA=4 GA value + * @property {number} DEPRECATED=5 DEPRECATED value + */ + api.LaunchStage = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "LAUNCH_STAGE_UNSPECIFIED"] = 0; + values[valuesById[6] = "UNIMPLEMENTED"] = 6; + values[valuesById[7] = "PRELAUNCH"] = 7; + values[valuesById[1] = "EARLY_ACCESS"] = 1; + values[valuesById[2] = "ALPHA"] = 2; + values[valuesById[3] = "BETA"] = 3; + values[valuesById[4] = "GA"] = 4; + values[valuesById[5] = "DEPRECATED"] = 5; + return values; + })(); + + api.ResourceDescriptor = (function() { + + /** + * Properties of a ResourceDescriptor. + * @memberof google.api + * @interface IResourceDescriptor + * @property {string|null} [type] ResourceDescriptor type + * @property {Array.|null} [pattern] ResourceDescriptor pattern + * @property {string|null} [nameField] ResourceDescriptor nameField + * @property {google.api.ResourceDescriptor.History|null} [history] ResourceDescriptor history + * @property {string|null} [plural] ResourceDescriptor plural + * @property {string|null} [singular] ResourceDescriptor singular + * @property {Array.|null} [style] ResourceDescriptor style + */ + + /** + * Constructs a new ResourceDescriptor. + * @memberof google.api + * @classdesc Represents a ResourceDescriptor. + * @implements IResourceDescriptor + * @constructor + * @param {google.api.IResourceDescriptor=} [properties] Properties to set + */ + function ResourceDescriptor(properties) { + this.pattern = []; + this.style = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResourceDescriptor type. + * @member {string} type + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.type = ""; + + /** + * ResourceDescriptor pattern. + * @member {Array.} pattern + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.pattern = $util.emptyArray; + + /** + * ResourceDescriptor nameField. + * @member {string} nameField + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.nameField = ""; + + /** + * ResourceDescriptor history. + * @member {google.api.ResourceDescriptor.History} history + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.history = 0; + + /** + * ResourceDescriptor plural. + * @member {string} plural + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.plural = ""; + + /** + * ResourceDescriptor singular. + * @member {string} singular + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.singular = ""; + + /** + * ResourceDescriptor style. + * @member {Array.} style + * @memberof google.api.ResourceDescriptor + * @instance + */ + ResourceDescriptor.prototype.style = $util.emptyArray; + + /** + * Creates a new ResourceDescriptor instance using the specified properties. + * @function create + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.IResourceDescriptor=} [properties] Properties to set + * @returns {google.api.ResourceDescriptor} ResourceDescriptor instance + */ + ResourceDescriptor.create = function create(properties) { + return new ResourceDescriptor(properties); + }; + + /** + * Encodes the specified ResourceDescriptor message. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @function encode + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceDescriptor.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.pattern != null && message.pattern.length) + for (var i = 0; i < message.pattern.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.pattern[i]); + if (message.nameField != null && Object.hasOwnProperty.call(message, "nameField")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.nameField); + if (message.history != null && Object.hasOwnProperty.call(message, "history")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.history); + if (message.plural != null && Object.hasOwnProperty.call(message, "plural")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.plural); + if (message.singular != null && Object.hasOwnProperty.call(message, "singular")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.singular); + if (message.style != null && message.style.length) { + writer.uint32(/* id 10, wireType 2 =*/82).fork(); + for (var i = 0; i < message.style.length; ++i) + writer.int32(message.style[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified ResourceDescriptor message, length delimited. Does not implicitly {@link google.api.ResourceDescriptor.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.IResourceDescriptor} message ResourceDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceDescriptor.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer. + * @function decode + * @memberof google.api.ResourceDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.ResourceDescriptor} ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceDescriptor.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceDescriptor(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.type = reader.string(); + break; + } + case 2: { + if (!(message.pattern && message.pattern.length)) + message.pattern = []; + message.pattern.push(reader.string()); + break; + } + case 3: { + message.nameField = reader.string(); + break; + } + case 4: { + message.history = reader.int32(); + break; + } + case 5: { + message.plural = reader.string(); + break; + } + case 6: { + message.singular = reader.string(); + break; + } + case 10: { + if (!(message.style && message.style.length)) + message.style = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.style.push(reader.int32()); + } else + message.style.push(reader.int32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResourceDescriptor message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.ResourceDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.ResourceDescriptor} ResourceDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceDescriptor.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResourceDescriptor message. + * @function verify + * @memberof google.api.ResourceDescriptor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResourceDescriptor.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.pattern != null && message.hasOwnProperty("pattern")) { + if (!Array.isArray(message.pattern)) + return "pattern: array expected"; + for (var i = 0; i < message.pattern.length; ++i) + if (!$util.isString(message.pattern[i])) + return "pattern: string[] expected"; + } + if (message.nameField != null && message.hasOwnProperty("nameField")) + if (!$util.isString(message.nameField)) + return "nameField: string expected"; + if (message.history != null && message.hasOwnProperty("history")) + switch (message.history) { + default: + return "history: enum value expected"; + case 0: + case 1: + case 2: + break; + } + if (message.plural != null && message.hasOwnProperty("plural")) + if (!$util.isString(message.plural)) + return "plural: string expected"; + if (message.singular != null && message.hasOwnProperty("singular")) + if (!$util.isString(message.singular)) + return "singular: string expected"; + if (message.style != null && message.hasOwnProperty("style")) { + if (!Array.isArray(message.style)) + return "style: array expected"; + for (var i = 0; i < message.style.length; ++i) + switch (message.style[i]) { + default: + return "style: enum value[] expected"; + case 0: + case 1: + break; + } + } + return null; + }; + + /** + * Creates a ResourceDescriptor message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.ResourceDescriptor + * @static + * @param {Object.} object Plain object + * @returns {google.api.ResourceDescriptor} ResourceDescriptor + */ + ResourceDescriptor.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.ResourceDescriptor) + return object; + var message = new $root.google.api.ResourceDescriptor(); + if (object.type != null) + message.type = String(object.type); + if (object.pattern) { + if (!Array.isArray(object.pattern)) + throw TypeError(".google.api.ResourceDescriptor.pattern: array expected"); + message.pattern = []; + for (var i = 0; i < object.pattern.length; ++i) + message.pattern[i] = String(object.pattern[i]); + } + if (object.nameField != null) + message.nameField = String(object.nameField); + switch (object.history) { + default: + if (typeof object.history === "number") { + message.history = object.history; + break; + } + break; + case "HISTORY_UNSPECIFIED": + case 0: + message.history = 0; + break; + case "ORIGINALLY_SINGLE_PATTERN": + case 1: + message.history = 1; + break; + case "FUTURE_MULTI_PATTERN": + case 2: + message.history = 2; + break; + } + if (object.plural != null) + message.plural = String(object.plural); + if (object.singular != null) + message.singular = String(object.singular); + if (object.style) { + if (!Array.isArray(object.style)) + throw TypeError(".google.api.ResourceDescriptor.style: array expected"); + message.style = []; + for (var i = 0; i < object.style.length; ++i) + switch (object.style[i]) { + default: + if (typeof object.style[i] === "number") { + message.style[i] = object.style[i]; + break; + } + case "STYLE_UNSPECIFIED": + case 0: + message.style[i] = 0; + break; + case "DECLARATIVE_FRIENDLY": + case 1: + message.style[i] = 1; + break; + } + } + return message; + }; + + /** + * Creates a plain object from a ResourceDescriptor message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.ResourceDescriptor + * @static + * @param {google.api.ResourceDescriptor} message ResourceDescriptor + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResourceDescriptor.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.pattern = []; + object.style = []; + } + if (options.defaults) { + object.type = ""; + object.nameField = ""; + object.history = options.enums === String ? "HISTORY_UNSPECIFIED" : 0; + object.plural = ""; + object.singular = ""; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.pattern && message.pattern.length) { + object.pattern = []; + for (var j = 0; j < message.pattern.length; ++j) + object.pattern[j] = message.pattern[j]; + } + if (message.nameField != null && message.hasOwnProperty("nameField")) + object.nameField = message.nameField; + if (message.history != null && message.hasOwnProperty("history")) + object.history = options.enums === String ? $root.google.api.ResourceDescriptor.History[message.history] === undefined ? message.history : $root.google.api.ResourceDescriptor.History[message.history] : message.history; + if (message.plural != null && message.hasOwnProperty("plural")) + object.plural = message.plural; + if (message.singular != null && message.hasOwnProperty("singular")) + object.singular = message.singular; + if (message.style && message.style.length) { + object.style = []; + for (var j = 0; j < message.style.length; ++j) + object.style[j] = options.enums === String ? $root.google.api.ResourceDescriptor.Style[message.style[j]] === undefined ? message.style[j] : $root.google.api.ResourceDescriptor.Style[message.style[j]] : message.style[j]; + } + return object; + }; + + /** + * Converts this ResourceDescriptor to JSON. + * @function toJSON + * @memberof google.api.ResourceDescriptor + * @instance + * @returns {Object.} JSON object + */ + ResourceDescriptor.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ResourceDescriptor + * @function getTypeUrl + * @memberof google.api.ResourceDescriptor + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ResourceDescriptor.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.ResourceDescriptor"; + }; + + /** + * History enum. + * @name google.api.ResourceDescriptor.History + * @enum {number} + * @property {number} HISTORY_UNSPECIFIED=0 HISTORY_UNSPECIFIED value + * @property {number} ORIGINALLY_SINGLE_PATTERN=1 ORIGINALLY_SINGLE_PATTERN value + * @property {number} FUTURE_MULTI_PATTERN=2 FUTURE_MULTI_PATTERN value + */ + ResourceDescriptor.History = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "HISTORY_UNSPECIFIED"] = 0; + values[valuesById[1] = "ORIGINALLY_SINGLE_PATTERN"] = 1; + values[valuesById[2] = "FUTURE_MULTI_PATTERN"] = 2; + return values; + })(); + + /** + * Style enum. + * @name google.api.ResourceDescriptor.Style + * @enum {number} + * @property {number} STYLE_UNSPECIFIED=0 STYLE_UNSPECIFIED value + * @property {number} DECLARATIVE_FRIENDLY=1 DECLARATIVE_FRIENDLY value + */ + ResourceDescriptor.Style = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "STYLE_UNSPECIFIED"] = 0; + values[valuesById[1] = "DECLARATIVE_FRIENDLY"] = 1; + return values; + })(); + + return ResourceDescriptor; + })(); + + api.ResourceReference = (function() { + + /** + * Properties of a ResourceReference. + * @memberof google.api + * @interface IResourceReference + * @property {string|null} [type] ResourceReference type + * @property {string|null} [childType] ResourceReference childType + */ + + /** + * Constructs a new ResourceReference. + * @memberof google.api + * @classdesc Represents a ResourceReference. + * @implements IResourceReference + * @constructor + * @param {google.api.IResourceReference=} [properties] Properties to set + */ + function ResourceReference(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ResourceReference type. + * @member {string} type + * @memberof google.api.ResourceReference + * @instance + */ + ResourceReference.prototype.type = ""; + + /** + * ResourceReference childType. + * @member {string} childType + * @memberof google.api.ResourceReference + * @instance + */ + ResourceReference.prototype.childType = ""; + + /** + * Creates a new ResourceReference instance using the specified properties. + * @function create + * @memberof google.api.ResourceReference + * @static + * @param {google.api.IResourceReference=} [properties] Properties to set + * @returns {google.api.ResourceReference} ResourceReference instance + */ + ResourceReference.create = function create(properties) { + return new ResourceReference(properties); + }; + + /** + * Encodes the specified ResourceReference message. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @function encode + * @memberof google.api.ResourceReference + * @static + * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceReference.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.type); + if (message.childType != null && Object.hasOwnProperty.call(message, "childType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.childType); + return writer; + }; + + /** + * Encodes the specified ResourceReference message, length delimited. Does not implicitly {@link google.api.ResourceReference.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.ResourceReference + * @static + * @param {google.api.IResourceReference} message ResourceReference message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ResourceReference.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ResourceReference message from the specified reader or buffer. + * @function decode + * @memberof google.api.ResourceReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.ResourceReference} ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceReference.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ResourceReference(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.type = reader.string(); + break; + } + case 2: { + message.childType = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ResourceReference message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.ResourceReference + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.ResourceReference} ResourceReference + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ResourceReference.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ResourceReference message. + * @function verify + * @memberof google.api.ResourceReference + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ResourceReference.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.childType != null && message.hasOwnProperty("childType")) + if (!$util.isString(message.childType)) + return "childType: string expected"; + return null; + }; + + /** + * Creates a ResourceReference message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.ResourceReference + * @static + * @param {Object.} object Plain object + * @returns {google.api.ResourceReference} ResourceReference + */ + ResourceReference.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.ResourceReference) + return object; + var message = new $root.google.api.ResourceReference(); + if (object.type != null) + message.type = String(object.type); + if (object.childType != null) + message.childType = String(object.childType); + return message; + }; + + /** + * Creates a plain object from a ResourceReference message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.ResourceReference + * @static + * @param {google.api.ResourceReference} message ResourceReference + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ResourceReference.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.type = ""; + object.childType = ""; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.childType != null && message.hasOwnProperty("childType")) + object.childType = message.childType; + return object; + }; + + /** + * Converts this ResourceReference to JSON. + * @function toJSON + * @memberof google.api.ResourceReference + * @instance + * @returns {Object.} JSON object + */ + ResourceReference.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ResourceReference + * @function getTypeUrl + * @memberof google.api.ResourceReference + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ResourceReference.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.ResourceReference"; + }; + + return ResourceReference; + })(); + + api.Http = (function() { + + /** + * Properties of a Http. + * @memberof google.api + * @interface IHttp + * @property {Array.|null} [rules] Http rules + * @property {boolean|null} [fullyDecodeReservedExpansion] Http fullyDecodeReservedExpansion + */ + + /** + * Constructs a new Http. + * @memberof google.api + * @classdesc Represents a Http. + * @implements IHttp + * @constructor + * @param {google.api.IHttp=} [properties] Properties to set + */ + function Http(properties) { + this.rules = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Http rules. + * @member {Array.} rules + * @memberof google.api.Http + * @instance + */ + Http.prototype.rules = $util.emptyArray; + + /** + * Http fullyDecodeReservedExpansion. + * @member {boolean} fullyDecodeReservedExpansion + * @memberof google.api.Http + * @instance + */ + Http.prototype.fullyDecodeReservedExpansion = false; + + /** + * Creates a new Http instance using the specified properties. + * @function create + * @memberof google.api.Http + * @static + * @param {google.api.IHttp=} [properties] Properties to set + * @returns {google.api.Http} Http instance + */ + Http.create = function create(properties) { + return new Http(properties); + }; + + /** + * Encodes the specified Http message. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @function encode + * @memberof google.api.Http + * @static + * @param {google.api.IHttp} message Http message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Http.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.rules != null && message.rules.length) + for (var i = 0; i < message.rules.length; ++i) + $root.google.api.HttpRule.encode(message.rules[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.fullyDecodeReservedExpansion != null && Object.hasOwnProperty.call(message, "fullyDecodeReservedExpansion")) + writer.uint32(/* id 2, wireType 0 =*/16).bool(message.fullyDecodeReservedExpansion); + return writer; + }; + + /** + * Encodes the specified Http message, length delimited. Does not implicitly {@link google.api.Http.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.Http + * @static + * @param {google.api.IHttp} message Http message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Http.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Http message from the specified reader or buffer. + * @function decode + * @memberof google.api.Http + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.Http} Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Http.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Http(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.rules && message.rules.length)) + message.rules = []; + message.rules.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + break; + } + case 2: { + message.fullyDecodeReservedExpansion = reader.bool(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Http message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.Http + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.Http} Http + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Http.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Http message. + * @function verify + * @memberof google.api.Http + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Http.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.rules != null && message.hasOwnProperty("rules")) { + if (!Array.isArray(message.rules)) + return "rules: array expected"; + for (var i = 0; i < message.rules.length; ++i) { + var error = $root.google.api.HttpRule.verify(message.rules[i]); + if (error) + return "rules." + error; + } + } + if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) + if (typeof message.fullyDecodeReservedExpansion !== "boolean") + return "fullyDecodeReservedExpansion: boolean expected"; + return null; + }; + + /** + * Creates a Http message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.Http + * @static + * @param {Object.} object Plain object + * @returns {google.api.Http} Http + */ + Http.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.Http) + return object; + var message = new $root.google.api.Http(); + if (object.rules) { + if (!Array.isArray(object.rules)) + throw TypeError(".google.api.Http.rules: array expected"); + message.rules = []; + for (var i = 0; i < object.rules.length; ++i) { + if (typeof object.rules[i] !== "object") + throw TypeError(".google.api.Http.rules: object expected"); + message.rules[i] = $root.google.api.HttpRule.fromObject(object.rules[i]); + } + } + if (object.fullyDecodeReservedExpansion != null) + message.fullyDecodeReservedExpansion = Boolean(object.fullyDecodeReservedExpansion); + return message; + }; + + /** + * Creates a plain object from a Http message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.Http + * @static + * @param {google.api.Http} message Http + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Http.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.rules = []; + if (options.defaults) + object.fullyDecodeReservedExpansion = false; + if (message.rules && message.rules.length) { + object.rules = []; + for (var j = 0; j < message.rules.length; ++j) + object.rules[j] = $root.google.api.HttpRule.toObject(message.rules[j], options); + } + if (message.fullyDecodeReservedExpansion != null && message.hasOwnProperty("fullyDecodeReservedExpansion")) + object.fullyDecodeReservedExpansion = message.fullyDecodeReservedExpansion; + return object; + }; + + /** + * Converts this Http to JSON. + * @function toJSON + * @memberof google.api.Http + * @instance + * @returns {Object.} JSON object + */ + Http.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Http + * @function getTypeUrl + * @memberof google.api.Http + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Http.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.Http"; + }; + + return Http; + })(); + + api.HttpRule = (function() { + + /** + * Properties of a HttpRule. + * @memberof google.api + * @interface IHttpRule + * @property {string|null} [selector] HttpRule selector + * @property {string|null} [get] HttpRule get + * @property {string|null} [put] HttpRule put + * @property {string|null} [post] HttpRule post + * @property {string|null} ["delete"] HttpRule delete + * @property {string|null} [patch] HttpRule patch + * @property {google.api.ICustomHttpPattern|null} [custom] HttpRule custom + * @property {string|null} [body] HttpRule body + * @property {string|null} [responseBody] HttpRule responseBody + * @property {Array.|null} [additionalBindings] HttpRule additionalBindings + */ + + /** + * Constructs a new HttpRule. + * @memberof google.api + * @classdesc Represents a HttpRule. + * @implements IHttpRule + * @constructor + * @param {google.api.IHttpRule=} [properties] Properties to set + */ + function HttpRule(properties) { + this.additionalBindings = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * HttpRule selector. + * @member {string} selector + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.selector = ""; + + /** + * HttpRule get. + * @member {string|null|undefined} get + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.get = null; + + /** + * HttpRule put. + * @member {string|null|undefined} put + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.put = null; + + /** + * HttpRule post. + * @member {string|null|undefined} post + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.post = null; + + /** + * HttpRule delete. + * @member {string|null|undefined} delete + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype["delete"] = null; + + /** + * HttpRule patch. + * @member {string|null|undefined} patch + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.patch = null; + + /** + * HttpRule custom. + * @member {google.api.ICustomHttpPattern|null|undefined} custom + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.custom = null; + + /** + * HttpRule body. + * @member {string} body + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.body = ""; + + /** + * HttpRule responseBody. + * @member {string} responseBody + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.responseBody = ""; + + /** + * HttpRule additionalBindings. + * @member {Array.} additionalBindings + * @memberof google.api.HttpRule + * @instance + */ + HttpRule.prototype.additionalBindings = $util.emptyArray; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * HttpRule pattern. + * @member {"get"|"put"|"post"|"delete"|"patch"|"custom"|undefined} pattern + * @memberof google.api.HttpRule + * @instance + */ + Object.defineProperty(HttpRule.prototype, "pattern", { + get: $util.oneOfGetter($oneOfFields = ["get", "put", "post", "delete", "patch", "custom"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new HttpRule instance using the specified properties. + * @function create + * @memberof google.api.HttpRule + * @static + * @param {google.api.IHttpRule=} [properties] Properties to set + * @returns {google.api.HttpRule} HttpRule instance + */ + HttpRule.create = function create(properties) { + return new HttpRule(properties); + }; + + /** + * Encodes the specified HttpRule message. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @function encode + * @memberof google.api.HttpRule + * @static + * @param {google.api.IHttpRule} message HttpRule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HttpRule.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.selector != null && Object.hasOwnProperty.call(message, "selector")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector); + if (message.get != null && Object.hasOwnProperty.call(message, "get")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.get); + if (message.put != null && Object.hasOwnProperty.call(message, "put")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.put); + if (message.post != null && Object.hasOwnProperty.call(message, "post")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.post); + if (message["delete"] != null && Object.hasOwnProperty.call(message, "delete")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message["delete"]); + if (message.patch != null && Object.hasOwnProperty.call(message, "patch")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.patch); + if (message.body != null && Object.hasOwnProperty.call(message, "body")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.body); + if (message.custom != null && Object.hasOwnProperty.call(message, "custom")) + $root.google.api.CustomHttpPattern.encode(message.custom, writer.uint32(/* id 8, wireType 2 =*/66).fork()).ldelim(); + if (message.additionalBindings != null && message.additionalBindings.length) + for (var i = 0; i < message.additionalBindings.length; ++i) + $root.google.api.HttpRule.encode(message.additionalBindings[i], writer.uint32(/* id 11, wireType 2 =*/90).fork()).ldelim(); + if (message.responseBody != null && Object.hasOwnProperty.call(message, "responseBody")) + writer.uint32(/* id 12, wireType 2 =*/98).string(message.responseBody); + return writer; + }; + + /** + * Encodes the specified HttpRule message, length delimited. Does not implicitly {@link google.api.HttpRule.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.HttpRule + * @static + * @param {google.api.IHttpRule} message HttpRule message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + HttpRule.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a HttpRule message from the specified reader or buffer. + * @function decode + * @memberof google.api.HttpRule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.HttpRule} HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HttpRule.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.HttpRule(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.selector = reader.string(); + break; + } + case 2: { + message.get = reader.string(); + break; + } + case 3: { + message.put = reader.string(); + break; + } + case 4: { + message.post = reader.string(); + break; + } + case 5: { + message["delete"] = reader.string(); + break; + } + case 6: { + message.patch = reader.string(); + break; + } + case 8: { + message.custom = $root.google.api.CustomHttpPattern.decode(reader, reader.uint32()); + break; + } + case 7: { + message.body = reader.string(); + break; + } + case 12: { + message.responseBody = reader.string(); + break; + } + case 11: { + if (!(message.additionalBindings && message.additionalBindings.length)) + message.additionalBindings = []; + message.additionalBindings.push($root.google.api.HttpRule.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a HttpRule message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.HttpRule + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.HttpRule} HttpRule + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + HttpRule.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a HttpRule message. + * @function verify + * @memberof google.api.HttpRule + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + HttpRule.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.selector != null && message.hasOwnProperty("selector")) + if (!$util.isString(message.selector)) + return "selector: string expected"; + if (message.get != null && message.hasOwnProperty("get")) { + properties.pattern = 1; + if (!$util.isString(message.get)) + return "get: string expected"; + } + if (message.put != null && message.hasOwnProperty("put")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.put)) + return "put: string expected"; + } + if (message.post != null && message.hasOwnProperty("post")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.post)) + return "post: string expected"; + } + if (message["delete"] != null && message.hasOwnProperty("delete")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message["delete"])) + return "delete: string expected"; + } + if (message.patch != null && message.hasOwnProperty("patch")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + if (!$util.isString(message.patch)) + return "patch: string expected"; + } + if (message.custom != null && message.hasOwnProperty("custom")) { + if (properties.pattern === 1) + return "pattern: multiple values"; + properties.pattern = 1; + { + var error = $root.google.api.CustomHttpPattern.verify(message.custom); + if (error) + return "custom." + error; + } + } + if (message.body != null && message.hasOwnProperty("body")) + if (!$util.isString(message.body)) + return "body: string expected"; + if (message.responseBody != null && message.hasOwnProperty("responseBody")) + if (!$util.isString(message.responseBody)) + return "responseBody: string expected"; + if (message.additionalBindings != null && message.hasOwnProperty("additionalBindings")) { + if (!Array.isArray(message.additionalBindings)) + return "additionalBindings: array expected"; + for (var i = 0; i < message.additionalBindings.length; ++i) { + var error = $root.google.api.HttpRule.verify(message.additionalBindings[i]); + if (error) + return "additionalBindings." + error; + } + } + return null; + }; + + /** + * Creates a HttpRule message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.HttpRule + * @static + * @param {Object.} object Plain object + * @returns {google.api.HttpRule} HttpRule + */ + HttpRule.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.HttpRule) + return object; + var message = new $root.google.api.HttpRule(); + if (object.selector != null) + message.selector = String(object.selector); + if (object.get != null) + message.get = String(object.get); + if (object.put != null) + message.put = String(object.put); + if (object.post != null) + message.post = String(object.post); + if (object["delete"] != null) + message["delete"] = String(object["delete"]); + if (object.patch != null) + message.patch = String(object.patch); + if (object.custom != null) { + if (typeof object.custom !== "object") + throw TypeError(".google.api.HttpRule.custom: object expected"); + message.custom = $root.google.api.CustomHttpPattern.fromObject(object.custom); + } + if (object.body != null) + message.body = String(object.body); + if (object.responseBody != null) + message.responseBody = String(object.responseBody); + if (object.additionalBindings) { + if (!Array.isArray(object.additionalBindings)) + throw TypeError(".google.api.HttpRule.additionalBindings: array expected"); + message.additionalBindings = []; + for (var i = 0; i < object.additionalBindings.length; ++i) { + if (typeof object.additionalBindings[i] !== "object") + throw TypeError(".google.api.HttpRule.additionalBindings: object expected"); + message.additionalBindings[i] = $root.google.api.HttpRule.fromObject(object.additionalBindings[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a HttpRule message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.HttpRule + * @static + * @param {google.api.HttpRule} message HttpRule + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + HttpRule.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.additionalBindings = []; + if (options.defaults) { + object.selector = ""; + object.body = ""; + object.responseBody = ""; + } + if (message.selector != null && message.hasOwnProperty("selector")) + object.selector = message.selector; + if (message.get != null && message.hasOwnProperty("get")) { + object.get = message.get; + if (options.oneofs) + object.pattern = "get"; + } + if (message.put != null && message.hasOwnProperty("put")) { + object.put = message.put; + if (options.oneofs) + object.pattern = "put"; + } + if (message.post != null && message.hasOwnProperty("post")) { + object.post = message.post; + if (options.oneofs) + object.pattern = "post"; + } + if (message["delete"] != null && message.hasOwnProperty("delete")) { + object["delete"] = message["delete"]; + if (options.oneofs) + object.pattern = "delete"; + } + if (message.patch != null && message.hasOwnProperty("patch")) { + object.patch = message.patch; + if (options.oneofs) + object.pattern = "patch"; + } + if (message.body != null && message.hasOwnProperty("body")) + object.body = message.body; + if (message.custom != null && message.hasOwnProperty("custom")) { + object.custom = $root.google.api.CustomHttpPattern.toObject(message.custom, options); + if (options.oneofs) + object.pattern = "custom"; + } + if (message.additionalBindings && message.additionalBindings.length) { + object.additionalBindings = []; + for (var j = 0; j < message.additionalBindings.length; ++j) + object.additionalBindings[j] = $root.google.api.HttpRule.toObject(message.additionalBindings[j], options); + } + if (message.responseBody != null && message.hasOwnProperty("responseBody")) + object.responseBody = message.responseBody; + return object; + }; + + /** + * Converts this HttpRule to JSON. + * @function toJSON + * @memberof google.api.HttpRule + * @instance + * @returns {Object.} JSON object + */ + HttpRule.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for HttpRule + * @function getTypeUrl + * @memberof google.api.HttpRule + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + HttpRule.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.HttpRule"; + }; + + return HttpRule; + })(); + + api.CustomHttpPattern = (function() { + + /** + * Properties of a CustomHttpPattern. + * @memberof google.api + * @interface ICustomHttpPattern + * @property {string|null} [kind] CustomHttpPattern kind + * @property {string|null} [path] CustomHttpPattern path + */ + + /** + * Constructs a new CustomHttpPattern. + * @memberof google.api + * @classdesc Represents a CustomHttpPattern. + * @implements ICustomHttpPattern + * @constructor + * @param {google.api.ICustomHttpPattern=} [properties] Properties to set + */ + function CustomHttpPattern(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CustomHttpPattern kind. + * @member {string} kind + * @memberof google.api.CustomHttpPattern + * @instance + */ + CustomHttpPattern.prototype.kind = ""; + + /** + * CustomHttpPattern path. + * @member {string} path + * @memberof google.api.CustomHttpPattern + * @instance + */ + CustomHttpPattern.prototype.path = ""; + + /** + * Creates a new CustomHttpPattern instance using the specified properties. + * @function create + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.ICustomHttpPattern=} [properties] Properties to set + * @returns {google.api.CustomHttpPattern} CustomHttpPattern instance + */ + CustomHttpPattern.create = function create(properties) { + return new CustomHttpPattern(properties); + }; + + /** + * Encodes the specified CustomHttpPattern message. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @function encode + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomHttpPattern.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.kind != null && Object.hasOwnProperty.call(message, "kind")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.kind); + if (message.path != null && Object.hasOwnProperty.call(message, "path")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.path); + return writer; + }; + + /** + * Encodes the specified CustomHttpPattern message, length delimited. Does not implicitly {@link google.api.CustomHttpPattern.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.ICustomHttpPattern} message CustomHttpPattern message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CustomHttpPattern.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer. + * @function decode + * @memberof google.api.CustomHttpPattern + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.CustomHttpPattern} CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomHttpPattern.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CustomHttpPattern(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.kind = reader.string(); + break; + } + case 2: { + message.path = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CustomHttpPattern message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.CustomHttpPattern + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.CustomHttpPattern} CustomHttpPattern + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CustomHttpPattern.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CustomHttpPattern message. + * @function verify + * @memberof google.api.CustomHttpPattern + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CustomHttpPattern.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.kind != null && message.hasOwnProperty("kind")) + if (!$util.isString(message.kind)) + return "kind: string expected"; + if (message.path != null && message.hasOwnProperty("path")) + if (!$util.isString(message.path)) + return "path: string expected"; + return null; + }; + + /** + * Creates a CustomHttpPattern message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.CustomHttpPattern + * @static + * @param {Object.} object Plain object + * @returns {google.api.CustomHttpPattern} CustomHttpPattern + */ + CustomHttpPattern.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.CustomHttpPattern) + return object; + var message = new $root.google.api.CustomHttpPattern(); + if (object.kind != null) + message.kind = String(object.kind); + if (object.path != null) + message.path = String(object.path); + return message; + }; + + /** + * Creates a plain object from a CustomHttpPattern message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.CustomHttpPattern + * @static + * @param {google.api.CustomHttpPattern} message CustomHttpPattern + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CustomHttpPattern.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.kind = ""; + object.path = ""; + } + if (message.kind != null && message.hasOwnProperty("kind")) + object.kind = message.kind; + if (message.path != null && message.hasOwnProperty("path")) + object.path = message.path; + return object; + }; + + /** + * Converts this CustomHttpPattern to JSON. + * @function toJSON + * @memberof google.api.CustomHttpPattern + * @instance + * @returns {Object.} JSON object + */ + CustomHttpPattern.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CustomHttpPattern + * @function getTypeUrl + * @memberof google.api.CustomHttpPattern + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CustomHttpPattern.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.CustomHttpPattern"; + }; + + return CustomHttpPattern; + })(); + + api.CommonLanguageSettings = (function() { + + /** + * Properties of a CommonLanguageSettings. + * @memberof google.api + * @interface ICommonLanguageSettings + * @property {string|null} [referenceDocsUri] CommonLanguageSettings referenceDocsUri + * @property {Array.|null} [destinations] CommonLanguageSettings destinations + */ + + /** + * Constructs a new CommonLanguageSettings. + * @memberof google.api + * @classdesc Represents a CommonLanguageSettings. + * @implements ICommonLanguageSettings + * @constructor + * @param {google.api.ICommonLanguageSettings=} [properties] Properties to set + */ + function CommonLanguageSettings(properties) { + this.destinations = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CommonLanguageSettings referenceDocsUri. + * @member {string} referenceDocsUri + * @memberof google.api.CommonLanguageSettings + * @instance + */ + CommonLanguageSettings.prototype.referenceDocsUri = ""; + + /** + * CommonLanguageSettings destinations. + * @member {Array.} destinations + * @memberof google.api.CommonLanguageSettings + * @instance + */ + CommonLanguageSettings.prototype.destinations = $util.emptyArray; + + /** + * Creates a new CommonLanguageSettings instance using the specified properties. + * @function create + * @memberof google.api.CommonLanguageSettings + * @static + * @param {google.api.ICommonLanguageSettings=} [properties] Properties to set + * @returns {google.api.CommonLanguageSettings} CommonLanguageSettings instance + */ + CommonLanguageSettings.create = function create(properties) { + return new CommonLanguageSettings(properties); + }; + + /** + * Encodes the specified CommonLanguageSettings message. Does not implicitly {@link google.api.CommonLanguageSettings.verify|verify} messages. + * @function encode + * @memberof google.api.CommonLanguageSettings + * @static + * @param {google.api.ICommonLanguageSettings} message CommonLanguageSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommonLanguageSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.referenceDocsUri != null && Object.hasOwnProperty.call(message, "referenceDocsUri")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.referenceDocsUri); + if (message.destinations != null && message.destinations.length) { + writer.uint32(/* id 2, wireType 2 =*/18).fork(); + for (var i = 0; i < message.destinations.length; ++i) + writer.int32(message.destinations[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified CommonLanguageSettings message, length delimited. Does not implicitly {@link google.api.CommonLanguageSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.CommonLanguageSettings + * @static + * @param {google.api.ICommonLanguageSettings} message CommonLanguageSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CommonLanguageSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CommonLanguageSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.CommonLanguageSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.CommonLanguageSettings} CommonLanguageSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommonLanguageSettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CommonLanguageSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.referenceDocsUri = reader.string(); + break; + } + case 2: { + if (!(message.destinations && message.destinations.length)) + message.destinations = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.destinations.push(reader.int32()); + } else + message.destinations.push(reader.int32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CommonLanguageSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.CommonLanguageSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.CommonLanguageSettings} CommonLanguageSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CommonLanguageSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CommonLanguageSettings message. + * @function verify + * @memberof google.api.CommonLanguageSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CommonLanguageSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.referenceDocsUri != null && message.hasOwnProperty("referenceDocsUri")) + if (!$util.isString(message.referenceDocsUri)) + return "referenceDocsUri: string expected"; + if (message.destinations != null && message.hasOwnProperty("destinations")) { + if (!Array.isArray(message.destinations)) + return "destinations: array expected"; + for (var i = 0; i < message.destinations.length; ++i) + switch (message.destinations[i]) { + default: + return "destinations: enum value[] expected"; + case 0: + case 10: + case 20: + break; + } + } + return null; + }; + + /** + * Creates a CommonLanguageSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.CommonLanguageSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.CommonLanguageSettings} CommonLanguageSettings + */ + CommonLanguageSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.CommonLanguageSettings) + return object; + var message = new $root.google.api.CommonLanguageSettings(); + if (object.referenceDocsUri != null) + message.referenceDocsUri = String(object.referenceDocsUri); + if (object.destinations) { + if (!Array.isArray(object.destinations)) + throw TypeError(".google.api.CommonLanguageSettings.destinations: array expected"); + message.destinations = []; + for (var i = 0; i < object.destinations.length; ++i) + switch (object.destinations[i]) { + default: + if (typeof object.destinations[i] === "number") { + message.destinations[i] = object.destinations[i]; + break; + } + case "CLIENT_LIBRARY_DESTINATION_UNSPECIFIED": + case 0: + message.destinations[i] = 0; + break; + case "GITHUB": + case 10: + message.destinations[i] = 10; + break; + case "PACKAGE_MANAGER": + case 20: + message.destinations[i] = 20; + break; + } + } + return message; + }; + + /** + * Creates a plain object from a CommonLanguageSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.CommonLanguageSettings + * @static + * @param {google.api.CommonLanguageSettings} message CommonLanguageSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CommonLanguageSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.destinations = []; + if (options.defaults) + object.referenceDocsUri = ""; + if (message.referenceDocsUri != null && message.hasOwnProperty("referenceDocsUri")) + object.referenceDocsUri = message.referenceDocsUri; + if (message.destinations && message.destinations.length) { + object.destinations = []; + for (var j = 0; j < message.destinations.length; ++j) + object.destinations[j] = options.enums === String ? $root.google.api.ClientLibraryDestination[message.destinations[j]] === undefined ? message.destinations[j] : $root.google.api.ClientLibraryDestination[message.destinations[j]] : message.destinations[j]; + } + return object; + }; + + /** + * Converts this CommonLanguageSettings to JSON. + * @function toJSON + * @memberof google.api.CommonLanguageSettings + * @instance + * @returns {Object.} JSON object + */ + CommonLanguageSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CommonLanguageSettings + * @function getTypeUrl + * @memberof google.api.CommonLanguageSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CommonLanguageSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.CommonLanguageSettings"; + }; + + return CommonLanguageSettings; + })(); + + api.ClientLibrarySettings = (function() { + + /** + * Properties of a ClientLibrarySettings. + * @memberof google.api + * @interface IClientLibrarySettings + * @property {string|null} [version] ClientLibrarySettings version + * @property {google.api.LaunchStage|null} [launchStage] ClientLibrarySettings launchStage + * @property {boolean|null} [restNumericEnums] ClientLibrarySettings restNumericEnums + * @property {google.api.IJavaSettings|null} [javaSettings] ClientLibrarySettings javaSettings + * @property {google.api.ICppSettings|null} [cppSettings] ClientLibrarySettings cppSettings + * @property {google.api.IPhpSettings|null} [phpSettings] ClientLibrarySettings phpSettings + * @property {google.api.IPythonSettings|null} [pythonSettings] ClientLibrarySettings pythonSettings + * @property {google.api.INodeSettings|null} [nodeSettings] ClientLibrarySettings nodeSettings + * @property {google.api.IDotnetSettings|null} [dotnetSettings] ClientLibrarySettings dotnetSettings + * @property {google.api.IRubySettings|null} [rubySettings] ClientLibrarySettings rubySettings + * @property {google.api.IGoSettings|null} [goSettings] ClientLibrarySettings goSettings + */ + + /** + * Constructs a new ClientLibrarySettings. + * @memberof google.api + * @classdesc Represents a ClientLibrarySettings. + * @implements IClientLibrarySettings + * @constructor + * @param {google.api.IClientLibrarySettings=} [properties] Properties to set + */ + function ClientLibrarySettings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ClientLibrarySettings version. + * @member {string} version + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.version = ""; + + /** + * ClientLibrarySettings launchStage. + * @member {google.api.LaunchStage} launchStage + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.launchStage = 0; + + /** + * ClientLibrarySettings restNumericEnums. + * @member {boolean} restNumericEnums + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.restNumericEnums = false; + + /** + * ClientLibrarySettings javaSettings. + * @member {google.api.IJavaSettings|null|undefined} javaSettings + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.javaSettings = null; + + /** + * ClientLibrarySettings cppSettings. + * @member {google.api.ICppSettings|null|undefined} cppSettings + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.cppSettings = null; + + /** + * ClientLibrarySettings phpSettings. + * @member {google.api.IPhpSettings|null|undefined} phpSettings + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.phpSettings = null; + + /** + * ClientLibrarySettings pythonSettings. + * @member {google.api.IPythonSettings|null|undefined} pythonSettings + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.pythonSettings = null; + + /** + * ClientLibrarySettings nodeSettings. + * @member {google.api.INodeSettings|null|undefined} nodeSettings + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.nodeSettings = null; + + /** + * ClientLibrarySettings dotnetSettings. + * @member {google.api.IDotnetSettings|null|undefined} dotnetSettings + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.dotnetSettings = null; + + /** + * ClientLibrarySettings rubySettings. + * @member {google.api.IRubySettings|null|undefined} rubySettings + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.rubySettings = null; + + /** + * ClientLibrarySettings goSettings. + * @member {google.api.IGoSettings|null|undefined} goSettings + * @memberof google.api.ClientLibrarySettings + * @instance + */ + ClientLibrarySettings.prototype.goSettings = null; + + /** + * Creates a new ClientLibrarySettings instance using the specified properties. + * @function create + * @memberof google.api.ClientLibrarySettings + * @static + * @param {google.api.IClientLibrarySettings=} [properties] Properties to set + * @returns {google.api.ClientLibrarySettings} ClientLibrarySettings instance + */ + ClientLibrarySettings.create = function create(properties) { + return new ClientLibrarySettings(properties); + }; + + /** + * Encodes the specified ClientLibrarySettings message. Does not implicitly {@link google.api.ClientLibrarySettings.verify|verify} messages. + * @function encode + * @memberof google.api.ClientLibrarySettings + * @static + * @param {google.api.IClientLibrarySettings} message ClientLibrarySettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClientLibrarySettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.version != null && Object.hasOwnProperty.call(message, "version")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.version); + if (message.launchStage != null && Object.hasOwnProperty.call(message, "launchStage")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.launchStage); + if (message.restNumericEnums != null && Object.hasOwnProperty.call(message, "restNumericEnums")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.restNumericEnums); + if (message.javaSettings != null && Object.hasOwnProperty.call(message, "javaSettings")) + $root.google.api.JavaSettings.encode(message.javaSettings, writer.uint32(/* id 21, wireType 2 =*/170).fork()).ldelim(); + if (message.cppSettings != null && Object.hasOwnProperty.call(message, "cppSettings")) + $root.google.api.CppSettings.encode(message.cppSettings, writer.uint32(/* id 22, wireType 2 =*/178).fork()).ldelim(); + if (message.phpSettings != null && Object.hasOwnProperty.call(message, "phpSettings")) + $root.google.api.PhpSettings.encode(message.phpSettings, writer.uint32(/* id 23, wireType 2 =*/186).fork()).ldelim(); + if (message.pythonSettings != null && Object.hasOwnProperty.call(message, "pythonSettings")) + $root.google.api.PythonSettings.encode(message.pythonSettings, writer.uint32(/* id 24, wireType 2 =*/194).fork()).ldelim(); + if (message.nodeSettings != null && Object.hasOwnProperty.call(message, "nodeSettings")) + $root.google.api.NodeSettings.encode(message.nodeSettings, writer.uint32(/* id 25, wireType 2 =*/202).fork()).ldelim(); + if (message.dotnetSettings != null && Object.hasOwnProperty.call(message, "dotnetSettings")) + $root.google.api.DotnetSettings.encode(message.dotnetSettings, writer.uint32(/* id 26, wireType 2 =*/210).fork()).ldelim(); + if (message.rubySettings != null && Object.hasOwnProperty.call(message, "rubySettings")) + $root.google.api.RubySettings.encode(message.rubySettings, writer.uint32(/* id 27, wireType 2 =*/218).fork()).ldelim(); + if (message.goSettings != null && Object.hasOwnProperty.call(message, "goSettings")) + $root.google.api.GoSettings.encode(message.goSettings, writer.uint32(/* id 28, wireType 2 =*/226).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified ClientLibrarySettings message, length delimited. Does not implicitly {@link google.api.ClientLibrarySettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.ClientLibrarySettings + * @static + * @param {google.api.IClientLibrarySettings} message ClientLibrarySettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ClientLibrarySettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ClientLibrarySettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.ClientLibrarySettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.ClientLibrarySettings} ClientLibrarySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClientLibrarySettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.ClientLibrarySettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.version = reader.string(); + break; + } + case 2: { + message.launchStage = reader.int32(); + break; + } + case 3: { + message.restNumericEnums = reader.bool(); + break; + } + case 21: { + message.javaSettings = $root.google.api.JavaSettings.decode(reader, reader.uint32()); + break; + } + case 22: { + message.cppSettings = $root.google.api.CppSettings.decode(reader, reader.uint32()); + break; + } + case 23: { + message.phpSettings = $root.google.api.PhpSettings.decode(reader, reader.uint32()); + break; + } + case 24: { + message.pythonSettings = $root.google.api.PythonSettings.decode(reader, reader.uint32()); + break; + } + case 25: { + message.nodeSettings = $root.google.api.NodeSettings.decode(reader, reader.uint32()); + break; + } + case 26: { + message.dotnetSettings = $root.google.api.DotnetSettings.decode(reader, reader.uint32()); + break; + } + case 27: { + message.rubySettings = $root.google.api.RubySettings.decode(reader, reader.uint32()); + break; + } + case 28: { + message.goSettings = $root.google.api.GoSettings.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ClientLibrarySettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.ClientLibrarySettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.ClientLibrarySettings} ClientLibrarySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ClientLibrarySettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ClientLibrarySettings message. + * @function verify + * @memberof google.api.ClientLibrarySettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ClientLibrarySettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.version != null && message.hasOwnProperty("version")) + if (!$util.isString(message.version)) + return "version: string expected"; + if (message.launchStage != null && message.hasOwnProperty("launchStage")) + switch (message.launchStage) { + default: + return "launchStage: enum value expected"; + case 0: + case 6: + case 7: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.restNumericEnums != null && message.hasOwnProperty("restNumericEnums")) + if (typeof message.restNumericEnums !== "boolean") + return "restNumericEnums: boolean expected"; + if (message.javaSettings != null && message.hasOwnProperty("javaSettings")) { + var error = $root.google.api.JavaSettings.verify(message.javaSettings); + if (error) + return "javaSettings." + error; + } + if (message.cppSettings != null && message.hasOwnProperty("cppSettings")) { + var error = $root.google.api.CppSettings.verify(message.cppSettings); + if (error) + return "cppSettings." + error; + } + if (message.phpSettings != null && message.hasOwnProperty("phpSettings")) { + var error = $root.google.api.PhpSettings.verify(message.phpSettings); + if (error) + return "phpSettings." + error; + } + if (message.pythonSettings != null && message.hasOwnProperty("pythonSettings")) { + var error = $root.google.api.PythonSettings.verify(message.pythonSettings); + if (error) + return "pythonSettings." + error; + } + if (message.nodeSettings != null && message.hasOwnProperty("nodeSettings")) { + var error = $root.google.api.NodeSettings.verify(message.nodeSettings); + if (error) + return "nodeSettings." + error; + } + if (message.dotnetSettings != null && message.hasOwnProperty("dotnetSettings")) { + var error = $root.google.api.DotnetSettings.verify(message.dotnetSettings); + if (error) + return "dotnetSettings." + error; + } + if (message.rubySettings != null && message.hasOwnProperty("rubySettings")) { + var error = $root.google.api.RubySettings.verify(message.rubySettings); + if (error) + return "rubySettings." + error; + } + if (message.goSettings != null && message.hasOwnProperty("goSettings")) { + var error = $root.google.api.GoSettings.verify(message.goSettings); + if (error) + return "goSettings." + error; + } + return null; + }; + + /** + * Creates a ClientLibrarySettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.ClientLibrarySettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.ClientLibrarySettings} ClientLibrarySettings + */ + ClientLibrarySettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.ClientLibrarySettings) + return object; + var message = new $root.google.api.ClientLibrarySettings(); + if (object.version != null) + message.version = String(object.version); + switch (object.launchStage) { + default: + if (typeof object.launchStage === "number") { + message.launchStage = object.launchStage; + break; + } + break; + case "LAUNCH_STAGE_UNSPECIFIED": + case 0: + message.launchStage = 0; + break; + case "UNIMPLEMENTED": + case 6: + message.launchStage = 6; + break; + case "PRELAUNCH": + case 7: + message.launchStage = 7; + break; + case "EARLY_ACCESS": + case 1: + message.launchStage = 1; + break; + case "ALPHA": + case 2: + message.launchStage = 2; + break; + case "BETA": + case 3: + message.launchStage = 3; + break; + case "GA": + case 4: + message.launchStage = 4; + break; + case "DEPRECATED": + case 5: + message.launchStage = 5; + break; + } + if (object.restNumericEnums != null) + message.restNumericEnums = Boolean(object.restNumericEnums); + if (object.javaSettings != null) { + if (typeof object.javaSettings !== "object") + throw TypeError(".google.api.ClientLibrarySettings.javaSettings: object expected"); + message.javaSettings = $root.google.api.JavaSettings.fromObject(object.javaSettings); + } + if (object.cppSettings != null) { + if (typeof object.cppSettings !== "object") + throw TypeError(".google.api.ClientLibrarySettings.cppSettings: object expected"); + message.cppSettings = $root.google.api.CppSettings.fromObject(object.cppSettings); + } + if (object.phpSettings != null) { + if (typeof object.phpSettings !== "object") + throw TypeError(".google.api.ClientLibrarySettings.phpSettings: object expected"); + message.phpSettings = $root.google.api.PhpSettings.fromObject(object.phpSettings); + } + if (object.pythonSettings != null) { + if (typeof object.pythonSettings !== "object") + throw TypeError(".google.api.ClientLibrarySettings.pythonSettings: object expected"); + message.pythonSettings = $root.google.api.PythonSettings.fromObject(object.pythonSettings); + } + if (object.nodeSettings != null) { + if (typeof object.nodeSettings !== "object") + throw TypeError(".google.api.ClientLibrarySettings.nodeSettings: object expected"); + message.nodeSettings = $root.google.api.NodeSettings.fromObject(object.nodeSettings); + } + if (object.dotnetSettings != null) { + if (typeof object.dotnetSettings !== "object") + throw TypeError(".google.api.ClientLibrarySettings.dotnetSettings: object expected"); + message.dotnetSettings = $root.google.api.DotnetSettings.fromObject(object.dotnetSettings); + } + if (object.rubySettings != null) { + if (typeof object.rubySettings !== "object") + throw TypeError(".google.api.ClientLibrarySettings.rubySettings: object expected"); + message.rubySettings = $root.google.api.RubySettings.fromObject(object.rubySettings); + } + if (object.goSettings != null) { + if (typeof object.goSettings !== "object") + throw TypeError(".google.api.ClientLibrarySettings.goSettings: object expected"); + message.goSettings = $root.google.api.GoSettings.fromObject(object.goSettings); + } + return message; + }; + + /** + * Creates a plain object from a ClientLibrarySettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.ClientLibrarySettings + * @static + * @param {google.api.ClientLibrarySettings} message ClientLibrarySettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ClientLibrarySettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.version = ""; + object.launchStage = options.enums === String ? "LAUNCH_STAGE_UNSPECIFIED" : 0; + object.restNumericEnums = false; + object.javaSettings = null; + object.cppSettings = null; + object.phpSettings = null; + object.pythonSettings = null; + object.nodeSettings = null; + object.dotnetSettings = null; + object.rubySettings = null; + object.goSettings = null; + } + if (message.version != null && message.hasOwnProperty("version")) + object.version = message.version; + if (message.launchStage != null && message.hasOwnProperty("launchStage")) + object.launchStage = options.enums === String ? $root.google.api.LaunchStage[message.launchStage] === undefined ? message.launchStage : $root.google.api.LaunchStage[message.launchStage] : message.launchStage; + if (message.restNumericEnums != null && message.hasOwnProperty("restNumericEnums")) + object.restNumericEnums = message.restNumericEnums; + if (message.javaSettings != null && message.hasOwnProperty("javaSettings")) + object.javaSettings = $root.google.api.JavaSettings.toObject(message.javaSettings, options); + if (message.cppSettings != null && message.hasOwnProperty("cppSettings")) + object.cppSettings = $root.google.api.CppSettings.toObject(message.cppSettings, options); + if (message.phpSettings != null && message.hasOwnProperty("phpSettings")) + object.phpSettings = $root.google.api.PhpSettings.toObject(message.phpSettings, options); + if (message.pythonSettings != null && message.hasOwnProperty("pythonSettings")) + object.pythonSettings = $root.google.api.PythonSettings.toObject(message.pythonSettings, options); + if (message.nodeSettings != null && message.hasOwnProperty("nodeSettings")) + object.nodeSettings = $root.google.api.NodeSettings.toObject(message.nodeSettings, options); + if (message.dotnetSettings != null && message.hasOwnProperty("dotnetSettings")) + object.dotnetSettings = $root.google.api.DotnetSettings.toObject(message.dotnetSettings, options); + if (message.rubySettings != null && message.hasOwnProperty("rubySettings")) + object.rubySettings = $root.google.api.RubySettings.toObject(message.rubySettings, options); + if (message.goSettings != null && message.hasOwnProperty("goSettings")) + object.goSettings = $root.google.api.GoSettings.toObject(message.goSettings, options); + return object; + }; + + /** + * Converts this ClientLibrarySettings to JSON. + * @function toJSON + * @memberof google.api.ClientLibrarySettings + * @instance + * @returns {Object.} JSON object + */ + ClientLibrarySettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ClientLibrarySettings + * @function getTypeUrl + * @memberof google.api.ClientLibrarySettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ClientLibrarySettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.ClientLibrarySettings"; + }; + + return ClientLibrarySettings; + })(); + + api.Publishing = (function() { + + /** + * Properties of a Publishing. + * @memberof google.api + * @interface IPublishing + * @property {Array.|null} [methodSettings] Publishing methodSettings + * @property {string|null} [newIssueUri] Publishing newIssueUri + * @property {string|null} [documentationUri] Publishing documentationUri + * @property {string|null} [apiShortName] Publishing apiShortName + * @property {string|null} [githubLabel] Publishing githubLabel + * @property {Array.|null} [codeownerGithubTeams] Publishing codeownerGithubTeams + * @property {string|null} [docTagPrefix] Publishing docTagPrefix + * @property {google.api.ClientLibraryOrganization|null} [organization] Publishing organization + * @property {Array.|null} [librarySettings] Publishing librarySettings + * @property {string|null} [protoReferenceDocumentationUri] Publishing protoReferenceDocumentationUri + * @property {string|null} [restReferenceDocumentationUri] Publishing restReferenceDocumentationUri + */ + + /** + * Constructs a new Publishing. + * @memberof google.api + * @classdesc Represents a Publishing. + * @implements IPublishing + * @constructor + * @param {google.api.IPublishing=} [properties] Properties to set + */ + function Publishing(properties) { + this.methodSettings = []; + this.codeownerGithubTeams = []; + this.librarySettings = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Publishing methodSettings. + * @member {Array.} methodSettings + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.methodSettings = $util.emptyArray; + + /** + * Publishing newIssueUri. + * @member {string} newIssueUri + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.newIssueUri = ""; + + /** + * Publishing documentationUri. + * @member {string} documentationUri + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.documentationUri = ""; + + /** + * Publishing apiShortName. + * @member {string} apiShortName + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.apiShortName = ""; + + /** + * Publishing githubLabel. + * @member {string} githubLabel + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.githubLabel = ""; + + /** + * Publishing codeownerGithubTeams. + * @member {Array.} codeownerGithubTeams + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.codeownerGithubTeams = $util.emptyArray; + + /** + * Publishing docTagPrefix. + * @member {string} docTagPrefix + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.docTagPrefix = ""; + + /** + * Publishing organization. + * @member {google.api.ClientLibraryOrganization} organization + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.organization = 0; + + /** + * Publishing librarySettings. + * @member {Array.} librarySettings + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.librarySettings = $util.emptyArray; + + /** + * Publishing protoReferenceDocumentationUri. + * @member {string} protoReferenceDocumentationUri + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.protoReferenceDocumentationUri = ""; + + /** + * Publishing restReferenceDocumentationUri. + * @member {string} restReferenceDocumentationUri + * @memberof google.api.Publishing + * @instance + */ + Publishing.prototype.restReferenceDocumentationUri = ""; + + /** + * Creates a new Publishing instance using the specified properties. + * @function create + * @memberof google.api.Publishing + * @static + * @param {google.api.IPublishing=} [properties] Properties to set + * @returns {google.api.Publishing} Publishing instance + */ + Publishing.create = function create(properties) { + return new Publishing(properties); + }; + + /** + * Encodes the specified Publishing message. Does not implicitly {@link google.api.Publishing.verify|verify} messages. + * @function encode + * @memberof google.api.Publishing + * @static + * @param {google.api.IPublishing} message Publishing message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Publishing.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.methodSettings != null && message.methodSettings.length) + for (var i = 0; i < message.methodSettings.length; ++i) + $root.google.api.MethodSettings.encode(message.methodSettings[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.newIssueUri != null && Object.hasOwnProperty.call(message, "newIssueUri")) + writer.uint32(/* id 101, wireType 2 =*/810).string(message.newIssueUri); + if (message.documentationUri != null && Object.hasOwnProperty.call(message, "documentationUri")) + writer.uint32(/* id 102, wireType 2 =*/818).string(message.documentationUri); + if (message.apiShortName != null && Object.hasOwnProperty.call(message, "apiShortName")) + writer.uint32(/* id 103, wireType 2 =*/826).string(message.apiShortName); + if (message.githubLabel != null && Object.hasOwnProperty.call(message, "githubLabel")) + writer.uint32(/* id 104, wireType 2 =*/834).string(message.githubLabel); + if (message.codeownerGithubTeams != null && message.codeownerGithubTeams.length) + for (var i = 0; i < message.codeownerGithubTeams.length; ++i) + writer.uint32(/* id 105, wireType 2 =*/842).string(message.codeownerGithubTeams[i]); + if (message.docTagPrefix != null && Object.hasOwnProperty.call(message, "docTagPrefix")) + writer.uint32(/* id 106, wireType 2 =*/850).string(message.docTagPrefix); + if (message.organization != null && Object.hasOwnProperty.call(message, "organization")) + writer.uint32(/* id 107, wireType 0 =*/856).int32(message.organization); + if (message.librarySettings != null && message.librarySettings.length) + for (var i = 0; i < message.librarySettings.length; ++i) + $root.google.api.ClientLibrarySettings.encode(message.librarySettings[i], writer.uint32(/* id 109, wireType 2 =*/874).fork()).ldelim(); + if (message.protoReferenceDocumentationUri != null && Object.hasOwnProperty.call(message, "protoReferenceDocumentationUri")) + writer.uint32(/* id 110, wireType 2 =*/882).string(message.protoReferenceDocumentationUri); + if (message.restReferenceDocumentationUri != null && Object.hasOwnProperty.call(message, "restReferenceDocumentationUri")) + writer.uint32(/* id 111, wireType 2 =*/890).string(message.restReferenceDocumentationUri); + return writer; + }; + + /** + * Encodes the specified Publishing message, length delimited. Does not implicitly {@link google.api.Publishing.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.Publishing + * @static + * @param {google.api.IPublishing} message Publishing message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Publishing.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Publishing message from the specified reader or buffer. + * @function decode + * @memberof google.api.Publishing + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.Publishing} Publishing + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Publishing.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Publishing(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 2: { + if (!(message.methodSettings && message.methodSettings.length)) + message.methodSettings = []; + message.methodSettings.push($root.google.api.MethodSettings.decode(reader, reader.uint32())); + break; + } + case 101: { + message.newIssueUri = reader.string(); + break; + } + case 102: { + message.documentationUri = reader.string(); + break; + } + case 103: { + message.apiShortName = reader.string(); + break; + } + case 104: { + message.githubLabel = reader.string(); + break; + } + case 105: { + if (!(message.codeownerGithubTeams && message.codeownerGithubTeams.length)) + message.codeownerGithubTeams = []; + message.codeownerGithubTeams.push(reader.string()); + break; + } + case 106: { + message.docTagPrefix = reader.string(); + break; + } + case 107: { + message.organization = reader.int32(); + break; + } + case 109: { + if (!(message.librarySettings && message.librarySettings.length)) + message.librarySettings = []; + message.librarySettings.push($root.google.api.ClientLibrarySettings.decode(reader, reader.uint32())); + break; + } + case 110: { + message.protoReferenceDocumentationUri = reader.string(); + break; + } + case 111: { + message.restReferenceDocumentationUri = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Publishing message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.Publishing + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.Publishing} Publishing + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Publishing.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Publishing message. + * @function verify + * @memberof google.api.Publishing + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Publishing.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.methodSettings != null && message.hasOwnProperty("methodSettings")) { + if (!Array.isArray(message.methodSettings)) + return "methodSettings: array expected"; + for (var i = 0; i < message.methodSettings.length; ++i) { + var error = $root.google.api.MethodSettings.verify(message.methodSettings[i]); + if (error) + return "methodSettings." + error; + } + } + if (message.newIssueUri != null && message.hasOwnProperty("newIssueUri")) + if (!$util.isString(message.newIssueUri)) + return "newIssueUri: string expected"; + if (message.documentationUri != null && message.hasOwnProperty("documentationUri")) + if (!$util.isString(message.documentationUri)) + return "documentationUri: string expected"; + if (message.apiShortName != null && message.hasOwnProperty("apiShortName")) + if (!$util.isString(message.apiShortName)) + return "apiShortName: string expected"; + if (message.githubLabel != null && message.hasOwnProperty("githubLabel")) + if (!$util.isString(message.githubLabel)) + return "githubLabel: string expected"; + if (message.codeownerGithubTeams != null && message.hasOwnProperty("codeownerGithubTeams")) { + if (!Array.isArray(message.codeownerGithubTeams)) + return "codeownerGithubTeams: array expected"; + for (var i = 0; i < message.codeownerGithubTeams.length; ++i) + if (!$util.isString(message.codeownerGithubTeams[i])) + return "codeownerGithubTeams: string[] expected"; + } + if (message.docTagPrefix != null && message.hasOwnProperty("docTagPrefix")) + if (!$util.isString(message.docTagPrefix)) + return "docTagPrefix: string expected"; + if (message.organization != null && message.hasOwnProperty("organization")) + switch (message.organization) { + default: + return "organization: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + break; + } + if (message.librarySettings != null && message.hasOwnProperty("librarySettings")) { + if (!Array.isArray(message.librarySettings)) + return "librarySettings: array expected"; + for (var i = 0; i < message.librarySettings.length; ++i) { + var error = $root.google.api.ClientLibrarySettings.verify(message.librarySettings[i]); + if (error) + return "librarySettings." + error; + } + } + if (message.protoReferenceDocumentationUri != null && message.hasOwnProperty("protoReferenceDocumentationUri")) + if (!$util.isString(message.protoReferenceDocumentationUri)) + return "protoReferenceDocumentationUri: string expected"; + if (message.restReferenceDocumentationUri != null && message.hasOwnProperty("restReferenceDocumentationUri")) + if (!$util.isString(message.restReferenceDocumentationUri)) + return "restReferenceDocumentationUri: string expected"; + return null; + }; + + /** + * Creates a Publishing message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.Publishing + * @static + * @param {Object.} object Plain object + * @returns {google.api.Publishing} Publishing + */ + Publishing.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.Publishing) + return object; + var message = new $root.google.api.Publishing(); + if (object.methodSettings) { + if (!Array.isArray(object.methodSettings)) + throw TypeError(".google.api.Publishing.methodSettings: array expected"); + message.methodSettings = []; + for (var i = 0; i < object.methodSettings.length; ++i) { + if (typeof object.methodSettings[i] !== "object") + throw TypeError(".google.api.Publishing.methodSettings: object expected"); + message.methodSettings[i] = $root.google.api.MethodSettings.fromObject(object.methodSettings[i]); + } + } + if (object.newIssueUri != null) + message.newIssueUri = String(object.newIssueUri); + if (object.documentationUri != null) + message.documentationUri = String(object.documentationUri); + if (object.apiShortName != null) + message.apiShortName = String(object.apiShortName); + if (object.githubLabel != null) + message.githubLabel = String(object.githubLabel); + if (object.codeownerGithubTeams) { + if (!Array.isArray(object.codeownerGithubTeams)) + throw TypeError(".google.api.Publishing.codeownerGithubTeams: array expected"); + message.codeownerGithubTeams = []; + for (var i = 0; i < object.codeownerGithubTeams.length; ++i) + message.codeownerGithubTeams[i] = String(object.codeownerGithubTeams[i]); + } + if (object.docTagPrefix != null) + message.docTagPrefix = String(object.docTagPrefix); + switch (object.organization) { + default: + if (typeof object.organization === "number") { + message.organization = object.organization; + break; + } + break; + case "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED": + case 0: + message.organization = 0; + break; + case "CLOUD": + case 1: + message.organization = 1; + break; + case "ADS": + case 2: + message.organization = 2; + break; + case "PHOTOS": + case 3: + message.organization = 3; + break; + case "STREET_VIEW": + case 4: + message.organization = 4; + break; + case "SHOPPING": + case 5: + message.organization = 5; + break; + case "GEO": + case 6: + message.organization = 6; + break; + case "GENERATIVE_AI": + case 7: + message.organization = 7; + break; + } + if (object.librarySettings) { + if (!Array.isArray(object.librarySettings)) + throw TypeError(".google.api.Publishing.librarySettings: array expected"); + message.librarySettings = []; + for (var i = 0; i < object.librarySettings.length; ++i) { + if (typeof object.librarySettings[i] !== "object") + throw TypeError(".google.api.Publishing.librarySettings: object expected"); + message.librarySettings[i] = $root.google.api.ClientLibrarySettings.fromObject(object.librarySettings[i]); + } + } + if (object.protoReferenceDocumentationUri != null) + message.protoReferenceDocumentationUri = String(object.protoReferenceDocumentationUri); + if (object.restReferenceDocumentationUri != null) + message.restReferenceDocumentationUri = String(object.restReferenceDocumentationUri); + return message; + }; + + /** + * Creates a plain object from a Publishing message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.Publishing + * @static + * @param {google.api.Publishing} message Publishing + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Publishing.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.methodSettings = []; + object.codeownerGithubTeams = []; + object.librarySettings = []; + } + if (options.defaults) { + object.newIssueUri = ""; + object.documentationUri = ""; + object.apiShortName = ""; + object.githubLabel = ""; + object.docTagPrefix = ""; + object.organization = options.enums === String ? "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED" : 0; + object.protoReferenceDocumentationUri = ""; + object.restReferenceDocumentationUri = ""; + } + if (message.methodSettings && message.methodSettings.length) { + object.methodSettings = []; + for (var j = 0; j < message.methodSettings.length; ++j) + object.methodSettings[j] = $root.google.api.MethodSettings.toObject(message.methodSettings[j], options); + } + if (message.newIssueUri != null && message.hasOwnProperty("newIssueUri")) + object.newIssueUri = message.newIssueUri; + if (message.documentationUri != null && message.hasOwnProperty("documentationUri")) + object.documentationUri = message.documentationUri; + if (message.apiShortName != null && message.hasOwnProperty("apiShortName")) + object.apiShortName = message.apiShortName; + if (message.githubLabel != null && message.hasOwnProperty("githubLabel")) + object.githubLabel = message.githubLabel; + if (message.codeownerGithubTeams && message.codeownerGithubTeams.length) { + object.codeownerGithubTeams = []; + for (var j = 0; j < message.codeownerGithubTeams.length; ++j) + object.codeownerGithubTeams[j] = message.codeownerGithubTeams[j]; + } + if (message.docTagPrefix != null && message.hasOwnProperty("docTagPrefix")) + object.docTagPrefix = message.docTagPrefix; + if (message.organization != null && message.hasOwnProperty("organization")) + object.organization = options.enums === String ? $root.google.api.ClientLibraryOrganization[message.organization] === undefined ? message.organization : $root.google.api.ClientLibraryOrganization[message.organization] : message.organization; + if (message.librarySettings && message.librarySettings.length) { + object.librarySettings = []; + for (var j = 0; j < message.librarySettings.length; ++j) + object.librarySettings[j] = $root.google.api.ClientLibrarySettings.toObject(message.librarySettings[j], options); + } + if (message.protoReferenceDocumentationUri != null && message.hasOwnProperty("protoReferenceDocumentationUri")) + object.protoReferenceDocumentationUri = message.protoReferenceDocumentationUri; + if (message.restReferenceDocumentationUri != null && message.hasOwnProperty("restReferenceDocumentationUri")) + object.restReferenceDocumentationUri = message.restReferenceDocumentationUri; + return object; + }; + + /** + * Converts this Publishing to JSON. + * @function toJSON + * @memberof google.api.Publishing + * @instance + * @returns {Object.} JSON object + */ + Publishing.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Publishing + * @function getTypeUrl + * @memberof google.api.Publishing + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Publishing.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.Publishing"; + }; + + return Publishing; + })(); + + api.JavaSettings = (function() { + + /** + * Properties of a JavaSettings. + * @memberof google.api + * @interface IJavaSettings + * @property {string|null} [libraryPackage] JavaSettings libraryPackage + * @property {Object.|null} [serviceClassNames] JavaSettings serviceClassNames + * @property {google.api.ICommonLanguageSettings|null} [common] JavaSettings common + */ + + /** + * Constructs a new JavaSettings. + * @memberof google.api + * @classdesc Represents a JavaSettings. + * @implements IJavaSettings + * @constructor + * @param {google.api.IJavaSettings=} [properties] Properties to set + */ + function JavaSettings(properties) { + this.serviceClassNames = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * JavaSettings libraryPackage. + * @member {string} libraryPackage + * @memberof google.api.JavaSettings + * @instance + */ + JavaSettings.prototype.libraryPackage = ""; + + /** + * JavaSettings serviceClassNames. + * @member {Object.} serviceClassNames + * @memberof google.api.JavaSettings + * @instance + */ + JavaSettings.prototype.serviceClassNames = $util.emptyObject; + + /** + * JavaSettings common. + * @member {google.api.ICommonLanguageSettings|null|undefined} common + * @memberof google.api.JavaSettings + * @instance + */ + JavaSettings.prototype.common = null; + + /** + * Creates a new JavaSettings instance using the specified properties. + * @function create + * @memberof google.api.JavaSettings + * @static + * @param {google.api.IJavaSettings=} [properties] Properties to set + * @returns {google.api.JavaSettings} JavaSettings instance + */ + JavaSettings.create = function create(properties) { + return new JavaSettings(properties); + }; + + /** + * Encodes the specified JavaSettings message. Does not implicitly {@link google.api.JavaSettings.verify|verify} messages. + * @function encode + * @memberof google.api.JavaSettings + * @static + * @param {google.api.IJavaSettings} message JavaSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + JavaSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.libraryPackage != null && Object.hasOwnProperty.call(message, "libraryPackage")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.libraryPackage); + if (message.serviceClassNames != null && Object.hasOwnProperty.call(message, "serviceClassNames")) + for (var keys = Object.keys(message.serviceClassNames), i = 0; i < keys.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.serviceClassNames[keys[i]]).ldelim(); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified JavaSettings message, length delimited. Does not implicitly {@link google.api.JavaSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.JavaSettings + * @static + * @param {google.api.IJavaSettings} message JavaSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + JavaSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a JavaSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.JavaSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.JavaSettings} JavaSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + JavaSettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.JavaSettings(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.libraryPackage = reader.string(); + break; + } + case 2: { + if (message.serviceClassNames === $util.emptyObject) + message.serviceClassNames = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.serviceClassNames[key] = value; + break; + } + case 3: { + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a JavaSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.JavaSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.JavaSettings} JavaSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + JavaSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a JavaSettings message. + * @function verify + * @memberof google.api.JavaSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + JavaSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.libraryPackage != null && message.hasOwnProperty("libraryPackage")) + if (!$util.isString(message.libraryPackage)) + return "libraryPackage: string expected"; + if (message.serviceClassNames != null && message.hasOwnProperty("serviceClassNames")) { + if (!$util.isObject(message.serviceClassNames)) + return "serviceClassNames: object expected"; + var key = Object.keys(message.serviceClassNames); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.serviceClassNames[key[i]])) + return "serviceClassNames: string{k:string} expected"; + } + if (message.common != null && message.hasOwnProperty("common")) { + var error = $root.google.api.CommonLanguageSettings.verify(message.common); + if (error) + return "common." + error; + } + return null; + }; + + /** + * Creates a JavaSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.JavaSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.JavaSettings} JavaSettings + */ + JavaSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.JavaSettings) + return object; + var message = new $root.google.api.JavaSettings(); + if (object.libraryPackage != null) + message.libraryPackage = String(object.libraryPackage); + if (object.serviceClassNames) { + if (typeof object.serviceClassNames !== "object") + throw TypeError(".google.api.JavaSettings.serviceClassNames: object expected"); + message.serviceClassNames = {}; + for (var keys = Object.keys(object.serviceClassNames), i = 0; i < keys.length; ++i) + message.serviceClassNames[keys[i]] = String(object.serviceClassNames[keys[i]]); + } + if (object.common != null) { + if (typeof object.common !== "object") + throw TypeError(".google.api.JavaSettings.common: object expected"); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); + } + return message; + }; + + /** + * Creates a plain object from a JavaSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.JavaSettings + * @static + * @param {google.api.JavaSettings} message JavaSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + JavaSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.serviceClassNames = {}; + if (options.defaults) { + object.libraryPackage = ""; + object.common = null; + } + if (message.libraryPackage != null && message.hasOwnProperty("libraryPackage")) + object.libraryPackage = message.libraryPackage; + var keys2; + if (message.serviceClassNames && (keys2 = Object.keys(message.serviceClassNames)).length) { + object.serviceClassNames = {}; + for (var j = 0; j < keys2.length; ++j) + object.serviceClassNames[keys2[j]] = message.serviceClassNames[keys2[j]]; + } + if (message.common != null && message.hasOwnProperty("common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + return object; + }; + + /** + * Converts this JavaSettings to JSON. + * @function toJSON + * @memberof google.api.JavaSettings + * @instance + * @returns {Object.} JSON object + */ + JavaSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for JavaSettings + * @function getTypeUrl + * @memberof google.api.JavaSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + JavaSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.JavaSettings"; + }; + + return JavaSettings; + })(); + + api.CppSettings = (function() { + + /** + * Properties of a CppSettings. + * @memberof google.api + * @interface ICppSettings + * @property {google.api.ICommonLanguageSettings|null} [common] CppSettings common + */ + + /** + * Constructs a new CppSettings. + * @memberof google.api + * @classdesc Represents a CppSettings. + * @implements ICppSettings + * @constructor + * @param {google.api.ICppSettings=} [properties] Properties to set + */ + function CppSettings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CppSettings common. + * @member {google.api.ICommonLanguageSettings|null|undefined} common + * @memberof google.api.CppSettings + * @instance + */ + CppSettings.prototype.common = null; + + /** + * Creates a new CppSettings instance using the specified properties. + * @function create + * @memberof google.api.CppSettings + * @static + * @param {google.api.ICppSettings=} [properties] Properties to set + * @returns {google.api.CppSettings} CppSettings instance + */ + CppSettings.create = function create(properties) { + return new CppSettings(properties); + }; + + /** + * Encodes the specified CppSettings message. Does not implicitly {@link google.api.CppSettings.verify|verify} messages. + * @function encode + * @memberof google.api.CppSettings + * @static + * @param {google.api.ICppSettings} message CppSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CppSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified CppSettings message, length delimited. Does not implicitly {@link google.api.CppSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.CppSettings + * @static + * @param {google.api.ICppSettings} message CppSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CppSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CppSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.CppSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.CppSettings} CppSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CppSettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.CppSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CppSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.CppSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.CppSettings} CppSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CppSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CppSettings message. + * @function verify + * @memberof google.api.CppSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CppSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.common != null && message.hasOwnProperty("common")) { + var error = $root.google.api.CommonLanguageSettings.verify(message.common); + if (error) + return "common." + error; + } + return null; + }; + + /** + * Creates a CppSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.CppSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.CppSettings} CppSettings + */ + CppSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.CppSettings) + return object; + var message = new $root.google.api.CppSettings(); + if (object.common != null) { + if (typeof object.common !== "object") + throw TypeError(".google.api.CppSettings.common: object expected"); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); + } + return message; + }; + + /** + * Creates a plain object from a CppSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.CppSettings + * @static + * @param {google.api.CppSettings} message CppSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CppSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.common = null; + if (message.common != null && message.hasOwnProperty("common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + return object; + }; + + /** + * Converts this CppSettings to JSON. + * @function toJSON + * @memberof google.api.CppSettings + * @instance + * @returns {Object.} JSON object + */ + CppSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CppSettings + * @function getTypeUrl + * @memberof google.api.CppSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CppSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.CppSettings"; + }; + + return CppSettings; + })(); + + api.PhpSettings = (function() { + + /** + * Properties of a PhpSettings. + * @memberof google.api + * @interface IPhpSettings + * @property {google.api.ICommonLanguageSettings|null} [common] PhpSettings common + */ + + /** + * Constructs a new PhpSettings. + * @memberof google.api + * @classdesc Represents a PhpSettings. + * @implements IPhpSettings + * @constructor + * @param {google.api.IPhpSettings=} [properties] Properties to set + */ + function PhpSettings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PhpSettings common. + * @member {google.api.ICommonLanguageSettings|null|undefined} common + * @memberof google.api.PhpSettings + * @instance + */ + PhpSettings.prototype.common = null; + + /** + * Creates a new PhpSettings instance using the specified properties. + * @function create + * @memberof google.api.PhpSettings + * @static + * @param {google.api.IPhpSettings=} [properties] Properties to set + * @returns {google.api.PhpSettings} PhpSettings instance + */ + PhpSettings.create = function create(properties) { + return new PhpSettings(properties); + }; + + /** + * Encodes the specified PhpSettings message. Does not implicitly {@link google.api.PhpSettings.verify|verify} messages. + * @function encode + * @memberof google.api.PhpSettings + * @static + * @param {google.api.IPhpSettings} message PhpSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PhpSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PhpSettings message, length delimited. Does not implicitly {@link google.api.PhpSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.PhpSettings + * @static + * @param {google.api.IPhpSettings} message PhpSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PhpSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PhpSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.PhpSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.PhpSettings} PhpSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PhpSettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.PhpSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PhpSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.PhpSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.PhpSettings} PhpSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PhpSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PhpSettings message. + * @function verify + * @memberof google.api.PhpSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PhpSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.common != null && message.hasOwnProperty("common")) { + var error = $root.google.api.CommonLanguageSettings.verify(message.common); + if (error) + return "common." + error; + } + return null; + }; + + /** + * Creates a PhpSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.PhpSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.PhpSettings} PhpSettings + */ + PhpSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.PhpSettings) + return object; + var message = new $root.google.api.PhpSettings(); + if (object.common != null) { + if (typeof object.common !== "object") + throw TypeError(".google.api.PhpSettings.common: object expected"); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); + } + return message; + }; + + /** + * Creates a plain object from a PhpSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.PhpSettings + * @static + * @param {google.api.PhpSettings} message PhpSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PhpSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.common = null; + if (message.common != null && message.hasOwnProperty("common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + return object; + }; + + /** + * Converts this PhpSettings to JSON. + * @function toJSON + * @memberof google.api.PhpSettings + * @instance + * @returns {Object.} JSON object + */ + PhpSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PhpSettings + * @function getTypeUrl + * @memberof google.api.PhpSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PhpSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.PhpSettings"; + }; + + return PhpSettings; + })(); + + api.PythonSettings = (function() { + + /** + * Properties of a PythonSettings. + * @memberof google.api + * @interface IPythonSettings + * @property {google.api.ICommonLanguageSettings|null} [common] PythonSettings common + */ + + /** + * Constructs a new PythonSettings. + * @memberof google.api + * @classdesc Represents a PythonSettings. + * @implements IPythonSettings + * @constructor + * @param {google.api.IPythonSettings=} [properties] Properties to set + */ + function PythonSettings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * PythonSettings common. + * @member {google.api.ICommonLanguageSettings|null|undefined} common + * @memberof google.api.PythonSettings + * @instance + */ + PythonSettings.prototype.common = null; + + /** + * Creates a new PythonSettings instance using the specified properties. + * @function create + * @memberof google.api.PythonSettings + * @static + * @param {google.api.IPythonSettings=} [properties] Properties to set + * @returns {google.api.PythonSettings} PythonSettings instance + */ + PythonSettings.create = function create(properties) { + return new PythonSettings(properties); + }; + + /** + * Encodes the specified PythonSettings message. Does not implicitly {@link google.api.PythonSettings.verify|verify} messages. + * @function encode + * @memberof google.api.PythonSettings + * @static + * @param {google.api.IPythonSettings} message PythonSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PythonSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified PythonSettings message, length delimited. Does not implicitly {@link google.api.PythonSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.PythonSettings + * @static + * @param {google.api.IPythonSettings} message PythonSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + PythonSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a PythonSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.PythonSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.PythonSettings} PythonSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PythonSettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.PythonSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a PythonSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.PythonSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.PythonSettings} PythonSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + PythonSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a PythonSettings message. + * @function verify + * @memberof google.api.PythonSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + PythonSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.common != null && message.hasOwnProperty("common")) { + var error = $root.google.api.CommonLanguageSettings.verify(message.common); + if (error) + return "common." + error; + } + return null; + }; + + /** + * Creates a PythonSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.PythonSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.PythonSettings} PythonSettings + */ + PythonSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.PythonSettings) + return object; + var message = new $root.google.api.PythonSettings(); + if (object.common != null) { + if (typeof object.common !== "object") + throw TypeError(".google.api.PythonSettings.common: object expected"); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); + } + return message; + }; + + /** + * Creates a plain object from a PythonSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.PythonSettings + * @static + * @param {google.api.PythonSettings} message PythonSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + PythonSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.common = null; + if (message.common != null && message.hasOwnProperty("common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + return object; + }; + + /** + * Converts this PythonSettings to JSON. + * @function toJSON + * @memberof google.api.PythonSettings + * @instance + * @returns {Object.} JSON object + */ + PythonSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for PythonSettings + * @function getTypeUrl + * @memberof google.api.PythonSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + PythonSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.PythonSettings"; + }; + + return PythonSettings; + })(); + + api.NodeSettings = (function() { + + /** + * Properties of a NodeSettings. + * @memberof google.api + * @interface INodeSettings + * @property {google.api.ICommonLanguageSettings|null} [common] NodeSettings common + */ + + /** + * Constructs a new NodeSettings. + * @memberof google.api + * @classdesc Represents a NodeSettings. + * @implements INodeSettings + * @constructor + * @param {google.api.INodeSettings=} [properties] Properties to set + */ + function NodeSettings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * NodeSettings common. + * @member {google.api.ICommonLanguageSettings|null|undefined} common + * @memberof google.api.NodeSettings + * @instance + */ + NodeSettings.prototype.common = null; + + /** + * Creates a new NodeSettings instance using the specified properties. + * @function create + * @memberof google.api.NodeSettings + * @static + * @param {google.api.INodeSettings=} [properties] Properties to set + * @returns {google.api.NodeSettings} NodeSettings instance + */ + NodeSettings.create = function create(properties) { + return new NodeSettings(properties); + }; + + /** + * Encodes the specified NodeSettings message. Does not implicitly {@link google.api.NodeSettings.verify|verify} messages. + * @function encode + * @memberof google.api.NodeSettings + * @static + * @param {google.api.INodeSettings} message NodeSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NodeSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified NodeSettings message, length delimited. Does not implicitly {@link google.api.NodeSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.NodeSettings + * @static + * @param {google.api.INodeSettings} message NodeSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + NodeSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a NodeSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.NodeSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.NodeSettings} NodeSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NodeSettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.NodeSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a NodeSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.NodeSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.NodeSettings} NodeSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + NodeSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a NodeSettings message. + * @function verify + * @memberof google.api.NodeSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + NodeSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.common != null && message.hasOwnProperty("common")) { + var error = $root.google.api.CommonLanguageSettings.verify(message.common); + if (error) + return "common." + error; + } + return null; + }; + + /** + * Creates a NodeSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.NodeSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.NodeSettings} NodeSettings + */ + NodeSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.NodeSettings) + return object; + var message = new $root.google.api.NodeSettings(); + if (object.common != null) { + if (typeof object.common !== "object") + throw TypeError(".google.api.NodeSettings.common: object expected"); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); + } + return message; + }; + + /** + * Creates a plain object from a NodeSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.NodeSettings + * @static + * @param {google.api.NodeSettings} message NodeSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + NodeSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.common = null; + if (message.common != null && message.hasOwnProperty("common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + return object; + }; + + /** + * Converts this NodeSettings to JSON. + * @function toJSON + * @memberof google.api.NodeSettings + * @instance + * @returns {Object.} JSON object + */ + NodeSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for NodeSettings + * @function getTypeUrl + * @memberof google.api.NodeSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + NodeSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.NodeSettings"; + }; + + return NodeSettings; + })(); + + api.DotnetSettings = (function() { + + /** + * Properties of a DotnetSettings. + * @memberof google.api + * @interface IDotnetSettings + * @property {google.api.ICommonLanguageSettings|null} [common] DotnetSettings common + * @property {Object.|null} [renamedServices] DotnetSettings renamedServices + * @property {Object.|null} [renamedResources] DotnetSettings renamedResources + * @property {Array.|null} [ignoredResources] DotnetSettings ignoredResources + * @property {Array.|null} [forcedNamespaceAliases] DotnetSettings forcedNamespaceAliases + * @property {Array.|null} [handwrittenSignatures] DotnetSettings handwrittenSignatures + */ + + /** + * Constructs a new DotnetSettings. + * @memberof google.api + * @classdesc Represents a DotnetSettings. + * @implements IDotnetSettings + * @constructor + * @param {google.api.IDotnetSettings=} [properties] Properties to set + */ + function DotnetSettings(properties) { + this.renamedServices = {}; + this.renamedResources = {}; + this.ignoredResources = []; + this.forcedNamespaceAliases = []; + this.handwrittenSignatures = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DotnetSettings common. + * @member {google.api.ICommonLanguageSettings|null|undefined} common + * @memberof google.api.DotnetSettings + * @instance + */ + DotnetSettings.prototype.common = null; + + /** + * DotnetSettings renamedServices. + * @member {Object.} renamedServices + * @memberof google.api.DotnetSettings + * @instance + */ + DotnetSettings.prototype.renamedServices = $util.emptyObject; + + /** + * DotnetSettings renamedResources. + * @member {Object.} renamedResources + * @memberof google.api.DotnetSettings + * @instance + */ + DotnetSettings.prototype.renamedResources = $util.emptyObject; + + /** + * DotnetSettings ignoredResources. + * @member {Array.} ignoredResources + * @memberof google.api.DotnetSettings + * @instance + */ + DotnetSettings.prototype.ignoredResources = $util.emptyArray; + + /** + * DotnetSettings forcedNamespaceAliases. + * @member {Array.} forcedNamespaceAliases + * @memberof google.api.DotnetSettings + * @instance + */ + DotnetSettings.prototype.forcedNamespaceAliases = $util.emptyArray; + + /** + * DotnetSettings handwrittenSignatures. + * @member {Array.} handwrittenSignatures + * @memberof google.api.DotnetSettings + * @instance + */ + DotnetSettings.prototype.handwrittenSignatures = $util.emptyArray; + + /** + * Creates a new DotnetSettings instance using the specified properties. + * @function create + * @memberof google.api.DotnetSettings + * @static + * @param {google.api.IDotnetSettings=} [properties] Properties to set + * @returns {google.api.DotnetSettings} DotnetSettings instance + */ + DotnetSettings.create = function create(properties) { + return new DotnetSettings(properties); + }; + + /** + * Encodes the specified DotnetSettings message. Does not implicitly {@link google.api.DotnetSettings.verify|verify} messages. + * @function encode + * @memberof google.api.DotnetSettings + * @static + * @param {google.api.IDotnetSettings} message DotnetSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DotnetSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.renamedServices != null && Object.hasOwnProperty.call(message, "renamedServices")) + for (var keys = Object.keys(message.renamedServices), i = 0; i < keys.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.renamedServices[keys[i]]).ldelim(); + if (message.renamedResources != null && Object.hasOwnProperty.call(message, "renamedResources")) + for (var keys = Object.keys(message.renamedResources), i = 0; i < keys.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.renamedResources[keys[i]]).ldelim(); + if (message.ignoredResources != null && message.ignoredResources.length) + for (var i = 0; i < message.ignoredResources.length; ++i) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.ignoredResources[i]); + if (message.forcedNamespaceAliases != null && message.forcedNamespaceAliases.length) + for (var i = 0; i < message.forcedNamespaceAliases.length; ++i) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.forcedNamespaceAliases[i]); + if (message.handwrittenSignatures != null && message.handwrittenSignatures.length) + for (var i = 0; i < message.handwrittenSignatures.length; ++i) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.handwrittenSignatures[i]); + return writer; + }; + + /** + * Encodes the specified DotnetSettings message, length delimited. Does not implicitly {@link google.api.DotnetSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.DotnetSettings + * @static + * @param {google.api.IDotnetSettings} message DotnetSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DotnetSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DotnetSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.DotnetSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.DotnetSettings} DotnetSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DotnetSettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.DotnetSettings(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); + break; + } + case 2: { + if (message.renamedServices === $util.emptyObject) + message.renamedServices = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.renamedServices[key] = value; + break; + } + case 3: { + if (message.renamedResources === $util.emptyObject) + message.renamedResources = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.renamedResources[key] = value; + break; + } + case 4: { + if (!(message.ignoredResources && message.ignoredResources.length)) + message.ignoredResources = []; + message.ignoredResources.push(reader.string()); + break; + } + case 5: { + if (!(message.forcedNamespaceAliases && message.forcedNamespaceAliases.length)) + message.forcedNamespaceAliases = []; + message.forcedNamespaceAliases.push(reader.string()); + break; + } + case 6: { + if (!(message.handwrittenSignatures && message.handwrittenSignatures.length)) + message.handwrittenSignatures = []; + message.handwrittenSignatures.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DotnetSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.DotnetSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.DotnetSettings} DotnetSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DotnetSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DotnetSettings message. + * @function verify + * @memberof google.api.DotnetSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DotnetSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.common != null && message.hasOwnProperty("common")) { + var error = $root.google.api.CommonLanguageSettings.verify(message.common); + if (error) + return "common." + error; + } + if (message.renamedServices != null && message.hasOwnProperty("renamedServices")) { + if (!$util.isObject(message.renamedServices)) + return "renamedServices: object expected"; + var key = Object.keys(message.renamedServices); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.renamedServices[key[i]])) + return "renamedServices: string{k:string} expected"; + } + if (message.renamedResources != null && message.hasOwnProperty("renamedResources")) { + if (!$util.isObject(message.renamedResources)) + return "renamedResources: object expected"; + var key = Object.keys(message.renamedResources); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.renamedResources[key[i]])) + return "renamedResources: string{k:string} expected"; + } + if (message.ignoredResources != null && message.hasOwnProperty("ignoredResources")) { + if (!Array.isArray(message.ignoredResources)) + return "ignoredResources: array expected"; + for (var i = 0; i < message.ignoredResources.length; ++i) + if (!$util.isString(message.ignoredResources[i])) + return "ignoredResources: string[] expected"; + } + if (message.forcedNamespaceAliases != null && message.hasOwnProperty("forcedNamespaceAliases")) { + if (!Array.isArray(message.forcedNamespaceAliases)) + return "forcedNamespaceAliases: array expected"; + for (var i = 0; i < message.forcedNamespaceAliases.length; ++i) + if (!$util.isString(message.forcedNamespaceAliases[i])) + return "forcedNamespaceAliases: string[] expected"; + } + if (message.handwrittenSignatures != null && message.hasOwnProperty("handwrittenSignatures")) { + if (!Array.isArray(message.handwrittenSignatures)) + return "handwrittenSignatures: array expected"; + for (var i = 0; i < message.handwrittenSignatures.length; ++i) + if (!$util.isString(message.handwrittenSignatures[i])) + return "handwrittenSignatures: string[] expected"; + } + return null; + }; + + /** + * Creates a DotnetSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.DotnetSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.DotnetSettings} DotnetSettings + */ + DotnetSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.DotnetSettings) + return object; + var message = new $root.google.api.DotnetSettings(); + if (object.common != null) { + if (typeof object.common !== "object") + throw TypeError(".google.api.DotnetSettings.common: object expected"); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); + } + if (object.renamedServices) { + if (typeof object.renamedServices !== "object") + throw TypeError(".google.api.DotnetSettings.renamedServices: object expected"); + message.renamedServices = {}; + for (var keys = Object.keys(object.renamedServices), i = 0; i < keys.length; ++i) + message.renamedServices[keys[i]] = String(object.renamedServices[keys[i]]); + } + if (object.renamedResources) { + if (typeof object.renamedResources !== "object") + throw TypeError(".google.api.DotnetSettings.renamedResources: object expected"); + message.renamedResources = {}; + for (var keys = Object.keys(object.renamedResources), i = 0; i < keys.length; ++i) + message.renamedResources[keys[i]] = String(object.renamedResources[keys[i]]); + } + if (object.ignoredResources) { + if (!Array.isArray(object.ignoredResources)) + throw TypeError(".google.api.DotnetSettings.ignoredResources: array expected"); + message.ignoredResources = []; + for (var i = 0; i < object.ignoredResources.length; ++i) + message.ignoredResources[i] = String(object.ignoredResources[i]); + } + if (object.forcedNamespaceAliases) { + if (!Array.isArray(object.forcedNamespaceAliases)) + throw TypeError(".google.api.DotnetSettings.forcedNamespaceAliases: array expected"); + message.forcedNamespaceAliases = []; + for (var i = 0; i < object.forcedNamespaceAliases.length; ++i) + message.forcedNamespaceAliases[i] = String(object.forcedNamespaceAliases[i]); + } + if (object.handwrittenSignatures) { + if (!Array.isArray(object.handwrittenSignatures)) + throw TypeError(".google.api.DotnetSettings.handwrittenSignatures: array expected"); + message.handwrittenSignatures = []; + for (var i = 0; i < object.handwrittenSignatures.length; ++i) + message.handwrittenSignatures[i] = String(object.handwrittenSignatures[i]); + } + return message; + }; + + /** + * Creates a plain object from a DotnetSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.DotnetSettings + * @static + * @param {google.api.DotnetSettings} message DotnetSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DotnetSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.ignoredResources = []; + object.forcedNamespaceAliases = []; + object.handwrittenSignatures = []; + } + if (options.objects || options.defaults) { + object.renamedServices = {}; + object.renamedResources = {}; + } + if (options.defaults) + object.common = null; + if (message.common != null && message.hasOwnProperty("common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + var keys2; + if (message.renamedServices && (keys2 = Object.keys(message.renamedServices)).length) { + object.renamedServices = {}; + for (var j = 0; j < keys2.length; ++j) + object.renamedServices[keys2[j]] = message.renamedServices[keys2[j]]; + } + if (message.renamedResources && (keys2 = Object.keys(message.renamedResources)).length) { + object.renamedResources = {}; + for (var j = 0; j < keys2.length; ++j) + object.renamedResources[keys2[j]] = message.renamedResources[keys2[j]]; + } + if (message.ignoredResources && message.ignoredResources.length) { + object.ignoredResources = []; + for (var j = 0; j < message.ignoredResources.length; ++j) + object.ignoredResources[j] = message.ignoredResources[j]; + } + if (message.forcedNamespaceAliases && message.forcedNamespaceAliases.length) { + object.forcedNamespaceAliases = []; + for (var j = 0; j < message.forcedNamespaceAliases.length; ++j) + object.forcedNamespaceAliases[j] = message.forcedNamespaceAliases[j]; + } + if (message.handwrittenSignatures && message.handwrittenSignatures.length) { + object.handwrittenSignatures = []; + for (var j = 0; j < message.handwrittenSignatures.length; ++j) + object.handwrittenSignatures[j] = message.handwrittenSignatures[j]; + } + return object; + }; + + /** + * Converts this DotnetSettings to JSON. + * @function toJSON + * @memberof google.api.DotnetSettings + * @instance + * @returns {Object.} JSON object + */ + DotnetSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DotnetSettings + * @function getTypeUrl + * @memberof google.api.DotnetSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DotnetSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.DotnetSettings"; + }; + + return DotnetSettings; + })(); + + api.RubySettings = (function() { + + /** + * Properties of a RubySettings. + * @memberof google.api + * @interface IRubySettings + * @property {google.api.ICommonLanguageSettings|null} [common] RubySettings common + */ + + /** + * Constructs a new RubySettings. + * @memberof google.api + * @classdesc Represents a RubySettings. + * @implements IRubySettings + * @constructor + * @param {google.api.IRubySettings=} [properties] Properties to set + */ + function RubySettings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * RubySettings common. + * @member {google.api.ICommonLanguageSettings|null|undefined} common + * @memberof google.api.RubySettings + * @instance + */ + RubySettings.prototype.common = null; + + /** + * Creates a new RubySettings instance using the specified properties. + * @function create + * @memberof google.api.RubySettings + * @static + * @param {google.api.IRubySettings=} [properties] Properties to set + * @returns {google.api.RubySettings} RubySettings instance + */ + RubySettings.create = function create(properties) { + return new RubySettings(properties); + }; + + /** + * Encodes the specified RubySettings message. Does not implicitly {@link google.api.RubySettings.verify|verify} messages. + * @function encode + * @memberof google.api.RubySettings + * @static + * @param {google.api.IRubySettings} message RubySettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RubySettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified RubySettings message, length delimited. Does not implicitly {@link google.api.RubySettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.RubySettings + * @static + * @param {google.api.IRubySettings} message RubySettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + RubySettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a RubySettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.RubySettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.RubySettings} RubySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RubySettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.RubySettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a RubySettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.RubySettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.RubySettings} RubySettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + RubySettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a RubySettings message. + * @function verify + * @memberof google.api.RubySettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + RubySettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.common != null && message.hasOwnProperty("common")) { + var error = $root.google.api.CommonLanguageSettings.verify(message.common); + if (error) + return "common." + error; + } + return null; + }; + + /** + * Creates a RubySettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.RubySettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.RubySettings} RubySettings + */ + RubySettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.RubySettings) + return object; + var message = new $root.google.api.RubySettings(); + if (object.common != null) { + if (typeof object.common !== "object") + throw TypeError(".google.api.RubySettings.common: object expected"); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); + } + return message; + }; + + /** + * Creates a plain object from a RubySettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.RubySettings + * @static + * @param {google.api.RubySettings} message RubySettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + RubySettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.common = null; + if (message.common != null && message.hasOwnProperty("common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + return object; + }; + + /** + * Converts this RubySettings to JSON. + * @function toJSON + * @memberof google.api.RubySettings + * @instance + * @returns {Object.} JSON object + */ + RubySettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for RubySettings + * @function getTypeUrl + * @memberof google.api.RubySettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + RubySettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.RubySettings"; + }; + + return RubySettings; + })(); + + api.GoSettings = (function() { + + /** + * Properties of a GoSettings. + * @memberof google.api + * @interface IGoSettings + * @property {google.api.ICommonLanguageSettings|null} [common] GoSettings common + */ + + /** + * Constructs a new GoSettings. + * @memberof google.api + * @classdesc Represents a GoSettings. + * @implements IGoSettings + * @constructor + * @param {google.api.IGoSettings=} [properties] Properties to set + */ + function GoSettings(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GoSettings common. + * @member {google.api.ICommonLanguageSettings|null|undefined} common + * @memberof google.api.GoSettings + * @instance + */ + GoSettings.prototype.common = null; + + /** + * Creates a new GoSettings instance using the specified properties. + * @function create + * @memberof google.api.GoSettings + * @static + * @param {google.api.IGoSettings=} [properties] Properties to set + * @returns {google.api.GoSettings} GoSettings instance + */ + GoSettings.create = function create(properties) { + return new GoSettings(properties); + }; + + /** + * Encodes the specified GoSettings message. Does not implicitly {@link google.api.GoSettings.verify|verify} messages. + * @function encode + * @memberof google.api.GoSettings + * @static + * @param {google.api.IGoSettings} message GoSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GoSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.common != null && Object.hasOwnProperty.call(message, "common")) + $root.google.api.CommonLanguageSettings.encode(message.common, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified GoSettings message, length delimited. Does not implicitly {@link google.api.GoSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.GoSettings + * @static + * @param {google.api.IGoSettings} message GoSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GoSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GoSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.GoSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.GoSettings} GoSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GoSettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.GoSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.common = $root.google.api.CommonLanguageSettings.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GoSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.GoSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.GoSettings} GoSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GoSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GoSettings message. + * @function verify + * @memberof google.api.GoSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GoSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.common != null && message.hasOwnProperty("common")) { + var error = $root.google.api.CommonLanguageSettings.verify(message.common); + if (error) + return "common." + error; + } + return null; + }; + + /** + * Creates a GoSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.GoSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.GoSettings} GoSettings + */ + GoSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.GoSettings) + return object; + var message = new $root.google.api.GoSettings(); + if (object.common != null) { + if (typeof object.common !== "object") + throw TypeError(".google.api.GoSettings.common: object expected"); + message.common = $root.google.api.CommonLanguageSettings.fromObject(object.common); + } + return message; + }; + + /** + * Creates a plain object from a GoSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.GoSettings + * @static + * @param {google.api.GoSettings} message GoSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GoSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.common = null; + if (message.common != null && message.hasOwnProperty("common")) + object.common = $root.google.api.CommonLanguageSettings.toObject(message.common, options); + return object; + }; + + /** + * Converts this GoSettings to JSON. + * @function toJSON + * @memberof google.api.GoSettings + * @instance + * @returns {Object.} JSON object + */ + GoSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GoSettings + * @function getTypeUrl + * @memberof google.api.GoSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GoSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.GoSettings"; + }; + + return GoSettings; + })(); + + api.MethodSettings = (function() { + + /** + * Properties of a MethodSettings. + * @memberof google.api + * @interface IMethodSettings + * @property {string|null} [selector] MethodSettings selector + * @property {google.api.MethodSettings.ILongRunning|null} [longRunning] MethodSettings longRunning + * @property {Array.|null} [autoPopulatedFields] MethodSettings autoPopulatedFields + */ + + /** + * Constructs a new MethodSettings. + * @memberof google.api + * @classdesc Represents a MethodSettings. + * @implements IMethodSettings + * @constructor + * @param {google.api.IMethodSettings=} [properties] Properties to set + */ + function MethodSettings(properties) { + this.autoPopulatedFields = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MethodSettings selector. + * @member {string} selector + * @memberof google.api.MethodSettings + * @instance + */ + MethodSettings.prototype.selector = ""; + + /** + * MethodSettings longRunning. + * @member {google.api.MethodSettings.ILongRunning|null|undefined} longRunning + * @memberof google.api.MethodSettings + * @instance + */ + MethodSettings.prototype.longRunning = null; + + /** + * MethodSettings autoPopulatedFields. + * @member {Array.} autoPopulatedFields + * @memberof google.api.MethodSettings + * @instance + */ + MethodSettings.prototype.autoPopulatedFields = $util.emptyArray; + + /** + * Creates a new MethodSettings instance using the specified properties. + * @function create + * @memberof google.api.MethodSettings + * @static + * @param {google.api.IMethodSettings=} [properties] Properties to set + * @returns {google.api.MethodSettings} MethodSettings instance + */ + MethodSettings.create = function create(properties) { + return new MethodSettings(properties); + }; + + /** + * Encodes the specified MethodSettings message. Does not implicitly {@link google.api.MethodSettings.verify|verify} messages. + * @function encode + * @memberof google.api.MethodSettings + * @static + * @param {google.api.IMethodSettings} message MethodSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodSettings.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.selector != null && Object.hasOwnProperty.call(message, "selector")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.selector); + if (message.longRunning != null && Object.hasOwnProperty.call(message, "longRunning")) + $root.google.api.MethodSettings.LongRunning.encode(message.longRunning, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.autoPopulatedFields != null && message.autoPopulatedFields.length) + for (var i = 0; i < message.autoPopulatedFields.length; ++i) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.autoPopulatedFields[i]); + return writer; + }; + + /** + * Encodes the specified MethodSettings message, length delimited. Does not implicitly {@link google.api.MethodSettings.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.MethodSettings + * @static + * @param {google.api.IMethodSettings} message MethodSettings message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MethodSettings.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MethodSettings message from the specified reader or buffer. + * @function decode + * @memberof google.api.MethodSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.MethodSettings} MethodSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodSettings.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.MethodSettings(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.selector = reader.string(); + break; + } + case 2: { + message.longRunning = $root.google.api.MethodSettings.LongRunning.decode(reader, reader.uint32()); + break; + } + case 3: { + if (!(message.autoPopulatedFields && message.autoPopulatedFields.length)) + message.autoPopulatedFields = []; + message.autoPopulatedFields.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MethodSettings message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.MethodSettings + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.MethodSettings} MethodSettings + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MethodSettings.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MethodSettings message. + * @function verify + * @memberof google.api.MethodSettings + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MethodSettings.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.selector != null && message.hasOwnProperty("selector")) + if (!$util.isString(message.selector)) + return "selector: string expected"; + if (message.longRunning != null && message.hasOwnProperty("longRunning")) { + var error = $root.google.api.MethodSettings.LongRunning.verify(message.longRunning); + if (error) + return "longRunning." + error; + } + if (message.autoPopulatedFields != null && message.hasOwnProperty("autoPopulatedFields")) { + if (!Array.isArray(message.autoPopulatedFields)) + return "autoPopulatedFields: array expected"; + for (var i = 0; i < message.autoPopulatedFields.length; ++i) + if (!$util.isString(message.autoPopulatedFields[i])) + return "autoPopulatedFields: string[] expected"; + } + return null; + }; + + /** + * Creates a MethodSettings message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.MethodSettings + * @static + * @param {Object.} object Plain object + * @returns {google.api.MethodSettings} MethodSettings + */ + MethodSettings.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.MethodSettings) + return object; + var message = new $root.google.api.MethodSettings(); + if (object.selector != null) + message.selector = String(object.selector); + if (object.longRunning != null) { + if (typeof object.longRunning !== "object") + throw TypeError(".google.api.MethodSettings.longRunning: object expected"); + message.longRunning = $root.google.api.MethodSettings.LongRunning.fromObject(object.longRunning); + } + if (object.autoPopulatedFields) { + if (!Array.isArray(object.autoPopulatedFields)) + throw TypeError(".google.api.MethodSettings.autoPopulatedFields: array expected"); + message.autoPopulatedFields = []; + for (var i = 0; i < object.autoPopulatedFields.length; ++i) + message.autoPopulatedFields[i] = String(object.autoPopulatedFields[i]); + } + return message; + }; + + /** + * Creates a plain object from a MethodSettings message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.MethodSettings + * @static + * @param {google.api.MethodSettings} message MethodSettings + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MethodSettings.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.autoPopulatedFields = []; + if (options.defaults) { + object.selector = ""; + object.longRunning = null; + } + if (message.selector != null && message.hasOwnProperty("selector")) + object.selector = message.selector; + if (message.longRunning != null && message.hasOwnProperty("longRunning")) + object.longRunning = $root.google.api.MethodSettings.LongRunning.toObject(message.longRunning, options); + if (message.autoPopulatedFields && message.autoPopulatedFields.length) { + object.autoPopulatedFields = []; + for (var j = 0; j < message.autoPopulatedFields.length; ++j) + object.autoPopulatedFields[j] = message.autoPopulatedFields[j]; + } + return object; + }; + + /** + * Converts this MethodSettings to JSON. + * @function toJSON + * @memberof google.api.MethodSettings + * @instance + * @returns {Object.} JSON object + */ + MethodSettings.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MethodSettings + * @function getTypeUrl + * @memberof google.api.MethodSettings + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MethodSettings.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.MethodSettings"; + }; + + MethodSettings.LongRunning = (function() { + + /** + * Properties of a LongRunning. + * @memberof google.api.MethodSettings + * @interface ILongRunning + * @property {google.protobuf.IDuration|null} [initialPollDelay] LongRunning initialPollDelay + * @property {number|null} [pollDelayMultiplier] LongRunning pollDelayMultiplier + * @property {google.protobuf.IDuration|null} [maxPollDelay] LongRunning maxPollDelay + * @property {google.protobuf.IDuration|null} [totalPollTimeout] LongRunning totalPollTimeout + */ + + /** + * Constructs a new LongRunning. + * @memberof google.api.MethodSettings + * @classdesc Represents a LongRunning. + * @implements ILongRunning + * @constructor + * @param {google.api.MethodSettings.ILongRunning=} [properties] Properties to set + */ + function LongRunning(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * LongRunning initialPollDelay. + * @member {google.protobuf.IDuration|null|undefined} initialPollDelay + * @memberof google.api.MethodSettings.LongRunning + * @instance + */ + LongRunning.prototype.initialPollDelay = null; + + /** + * LongRunning pollDelayMultiplier. + * @member {number} pollDelayMultiplier + * @memberof google.api.MethodSettings.LongRunning + * @instance + */ + LongRunning.prototype.pollDelayMultiplier = 0; + + /** + * LongRunning maxPollDelay. + * @member {google.protobuf.IDuration|null|undefined} maxPollDelay + * @memberof google.api.MethodSettings.LongRunning + * @instance + */ + LongRunning.prototype.maxPollDelay = null; + + /** + * LongRunning totalPollTimeout. + * @member {google.protobuf.IDuration|null|undefined} totalPollTimeout + * @memberof google.api.MethodSettings.LongRunning + * @instance + */ + LongRunning.prototype.totalPollTimeout = null; + + /** + * Creates a new LongRunning instance using the specified properties. + * @function create + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {google.api.MethodSettings.ILongRunning=} [properties] Properties to set + * @returns {google.api.MethodSettings.LongRunning} LongRunning instance + */ + LongRunning.create = function create(properties) { + return new LongRunning(properties); + }; + + /** + * Encodes the specified LongRunning message. Does not implicitly {@link google.api.MethodSettings.LongRunning.verify|verify} messages. + * @function encode + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {google.api.MethodSettings.ILongRunning} message LongRunning message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LongRunning.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.initialPollDelay != null && Object.hasOwnProperty.call(message, "initialPollDelay")) + $root.google.protobuf.Duration.encode(message.initialPollDelay, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.pollDelayMultiplier != null && Object.hasOwnProperty.call(message, "pollDelayMultiplier")) + writer.uint32(/* id 2, wireType 5 =*/21).float(message.pollDelayMultiplier); + if (message.maxPollDelay != null && Object.hasOwnProperty.call(message, "maxPollDelay")) + $root.google.protobuf.Duration.encode(message.maxPollDelay, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + if (message.totalPollTimeout != null && Object.hasOwnProperty.call(message, "totalPollTimeout")) + $root.google.protobuf.Duration.encode(message.totalPollTimeout, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified LongRunning message, length delimited. Does not implicitly {@link google.api.MethodSettings.LongRunning.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {google.api.MethodSettings.ILongRunning} message LongRunning message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + LongRunning.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a LongRunning message from the specified reader or buffer. + * @function decode + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.MethodSettings.LongRunning} LongRunning + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LongRunning.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.MethodSettings.LongRunning(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.initialPollDelay = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 2: { + message.pollDelayMultiplier = reader.float(); + break; + } + case 3: { + message.maxPollDelay = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 4: { + message.totalPollTimeout = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a LongRunning message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.MethodSettings.LongRunning} LongRunning + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + LongRunning.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a LongRunning message. + * @function verify + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + LongRunning.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.initialPollDelay != null && message.hasOwnProperty("initialPollDelay")) { + var error = $root.google.protobuf.Duration.verify(message.initialPollDelay); + if (error) + return "initialPollDelay." + error; + } + if (message.pollDelayMultiplier != null && message.hasOwnProperty("pollDelayMultiplier")) + if (typeof message.pollDelayMultiplier !== "number") + return "pollDelayMultiplier: number expected"; + if (message.maxPollDelay != null && message.hasOwnProperty("maxPollDelay")) { + var error = $root.google.protobuf.Duration.verify(message.maxPollDelay); + if (error) + return "maxPollDelay." + error; + } + if (message.totalPollTimeout != null && message.hasOwnProperty("totalPollTimeout")) { + var error = $root.google.protobuf.Duration.verify(message.totalPollTimeout); + if (error) + return "totalPollTimeout." + error; + } + return null; + }; + + /** + * Creates a LongRunning message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {Object.} object Plain object + * @returns {google.api.MethodSettings.LongRunning} LongRunning + */ + LongRunning.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.MethodSettings.LongRunning) + return object; + var message = new $root.google.api.MethodSettings.LongRunning(); + if (object.initialPollDelay != null) { + if (typeof object.initialPollDelay !== "object") + throw TypeError(".google.api.MethodSettings.LongRunning.initialPollDelay: object expected"); + message.initialPollDelay = $root.google.protobuf.Duration.fromObject(object.initialPollDelay); + } + if (object.pollDelayMultiplier != null) + message.pollDelayMultiplier = Number(object.pollDelayMultiplier); + if (object.maxPollDelay != null) { + if (typeof object.maxPollDelay !== "object") + throw TypeError(".google.api.MethodSettings.LongRunning.maxPollDelay: object expected"); + message.maxPollDelay = $root.google.protobuf.Duration.fromObject(object.maxPollDelay); + } + if (object.totalPollTimeout != null) { + if (typeof object.totalPollTimeout !== "object") + throw TypeError(".google.api.MethodSettings.LongRunning.totalPollTimeout: object expected"); + message.totalPollTimeout = $root.google.protobuf.Duration.fromObject(object.totalPollTimeout); + } + return message; + }; + + /** + * Creates a plain object from a LongRunning message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {google.api.MethodSettings.LongRunning} message LongRunning + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + LongRunning.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.initialPollDelay = null; + object.pollDelayMultiplier = 0; + object.maxPollDelay = null; + object.totalPollTimeout = null; + } + if (message.initialPollDelay != null && message.hasOwnProperty("initialPollDelay")) + object.initialPollDelay = $root.google.protobuf.Duration.toObject(message.initialPollDelay, options); + if (message.pollDelayMultiplier != null && message.hasOwnProperty("pollDelayMultiplier")) + object.pollDelayMultiplier = options.json && !isFinite(message.pollDelayMultiplier) ? String(message.pollDelayMultiplier) : message.pollDelayMultiplier; + if (message.maxPollDelay != null && message.hasOwnProperty("maxPollDelay")) + object.maxPollDelay = $root.google.protobuf.Duration.toObject(message.maxPollDelay, options); + if (message.totalPollTimeout != null && message.hasOwnProperty("totalPollTimeout")) + object.totalPollTimeout = $root.google.protobuf.Duration.toObject(message.totalPollTimeout, options); + return object; + }; + + /** + * Converts this LongRunning to JSON. + * @function toJSON + * @memberof google.api.MethodSettings.LongRunning + * @instance + * @returns {Object.} JSON object + */ + LongRunning.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for LongRunning + * @function getTypeUrl + * @memberof google.api.MethodSettings.LongRunning + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + LongRunning.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.MethodSettings.LongRunning"; + }; + + return LongRunning; + })(); + + return MethodSettings; + })(); + + /** + * ClientLibraryOrganization enum. + * @name google.api.ClientLibraryOrganization + * @enum {number} + * @property {number} CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED=0 CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED value + * @property {number} CLOUD=1 CLOUD value + * @property {number} ADS=2 ADS value + * @property {number} PHOTOS=3 PHOTOS value + * @property {number} STREET_VIEW=4 STREET_VIEW value + * @property {number} SHOPPING=5 SHOPPING value + * @property {number} GEO=6 GEO value + * @property {number} GENERATIVE_AI=7 GENERATIVE_AI value + */ + api.ClientLibraryOrganization = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED"] = 0; + values[valuesById[1] = "CLOUD"] = 1; + values[valuesById[2] = "ADS"] = 2; + values[valuesById[3] = "PHOTOS"] = 3; + values[valuesById[4] = "STREET_VIEW"] = 4; + values[valuesById[5] = "SHOPPING"] = 5; + values[valuesById[6] = "GEO"] = 6; + values[valuesById[7] = "GENERATIVE_AI"] = 7; + return values; + })(); + + /** + * ClientLibraryDestination enum. + * @name google.api.ClientLibraryDestination + * @enum {number} + * @property {number} CLIENT_LIBRARY_DESTINATION_UNSPECIFIED=0 CLIENT_LIBRARY_DESTINATION_UNSPECIFIED value + * @property {number} GITHUB=10 GITHUB value + * @property {number} PACKAGE_MANAGER=20 PACKAGE_MANAGER value + */ + api.ClientLibraryDestination = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "CLIENT_LIBRARY_DESTINATION_UNSPECIFIED"] = 0; + values[valuesById[10] = "GITHUB"] = 10; + values[valuesById[20] = "PACKAGE_MANAGER"] = 20; + return values; + })(); + + api.Distribution = (function() { + + /** + * Properties of a Distribution. + * @memberof google.api + * @interface IDistribution + * @property {number|Long|null} [count] Distribution count + * @property {number|null} [mean] Distribution mean + * @property {number|null} [sumOfSquaredDeviation] Distribution sumOfSquaredDeviation + * @property {google.api.Distribution.IRange|null} [range] Distribution range + * @property {google.api.Distribution.IBucketOptions|null} [bucketOptions] Distribution bucketOptions + * @property {Array.|null} [bucketCounts] Distribution bucketCounts + * @property {Array.|null} [exemplars] Distribution exemplars + */ + + /** + * Constructs a new Distribution. + * @memberof google.api + * @classdesc Represents a Distribution. + * @implements IDistribution + * @constructor + * @param {google.api.IDistribution=} [properties] Properties to set + */ + function Distribution(properties) { + this.bucketCounts = []; + this.exemplars = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Distribution count. + * @member {number|Long} count + * @memberof google.api.Distribution + * @instance + */ + Distribution.prototype.count = $util.Long ? $util.Long.fromBits(0,0,false) : 0; + + /** + * Distribution mean. + * @member {number} mean + * @memberof google.api.Distribution + * @instance + */ + Distribution.prototype.mean = 0; + + /** + * Distribution sumOfSquaredDeviation. + * @member {number} sumOfSquaredDeviation + * @memberof google.api.Distribution + * @instance + */ + Distribution.prototype.sumOfSquaredDeviation = 0; + + /** + * Distribution range. + * @member {google.api.Distribution.IRange|null|undefined} range + * @memberof google.api.Distribution + * @instance + */ + Distribution.prototype.range = null; + + /** + * Distribution bucketOptions. + * @member {google.api.Distribution.IBucketOptions|null|undefined} bucketOptions + * @memberof google.api.Distribution + * @instance + */ + Distribution.prototype.bucketOptions = null; + + /** + * Distribution bucketCounts. + * @member {Array.} bucketCounts + * @memberof google.api.Distribution + * @instance + */ + Distribution.prototype.bucketCounts = $util.emptyArray; + + /** + * Distribution exemplars. + * @member {Array.} exemplars + * @memberof google.api.Distribution + * @instance + */ + Distribution.prototype.exemplars = $util.emptyArray; + + /** + * Creates a new Distribution instance using the specified properties. + * @function create + * @memberof google.api.Distribution + * @static + * @param {google.api.IDistribution=} [properties] Properties to set + * @returns {google.api.Distribution} Distribution instance + */ + Distribution.create = function create(properties) { + return new Distribution(properties); + }; + + /** + * Encodes the specified Distribution message. Does not implicitly {@link google.api.Distribution.verify|verify} messages. + * @function encode + * @memberof google.api.Distribution + * @static + * @param {google.api.IDistribution} message Distribution message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Distribution.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.count != null && Object.hasOwnProperty.call(message, "count")) + writer.uint32(/* id 1, wireType 0 =*/8).int64(message.count); + if (message.mean != null && Object.hasOwnProperty.call(message, "mean")) + writer.uint32(/* id 2, wireType 1 =*/17).double(message.mean); + if (message.sumOfSquaredDeviation != null && Object.hasOwnProperty.call(message, "sumOfSquaredDeviation")) + writer.uint32(/* id 3, wireType 1 =*/25).double(message.sumOfSquaredDeviation); + if (message.range != null && Object.hasOwnProperty.call(message, "range")) + $root.google.api.Distribution.Range.encode(message.range, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.bucketOptions != null && Object.hasOwnProperty.call(message, "bucketOptions")) + $root.google.api.Distribution.BucketOptions.encode(message.bucketOptions, writer.uint32(/* id 6, wireType 2 =*/50).fork()).ldelim(); + if (message.bucketCounts != null && message.bucketCounts.length) { + writer.uint32(/* id 7, wireType 2 =*/58).fork(); + for (var i = 0; i < message.bucketCounts.length; ++i) + writer.int64(message.bucketCounts[i]); + writer.ldelim(); + } + if (message.exemplars != null && message.exemplars.length) + for (var i = 0; i < message.exemplars.length; ++i) + $root.google.api.Distribution.Exemplar.encode(message.exemplars[i], writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Distribution message, length delimited. Does not implicitly {@link google.api.Distribution.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.Distribution + * @static + * @param {google.api.IDistribution} message Distribution message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Distribution.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Distribution message from the specified reader or buffer. + * @function decode + * @memberof google.api.Distribution + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.Distribution} Distribution + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Distribution.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Distribution(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.count = reader.int64(); + break; + } + case 2: { + message.mean = reader.double(); + break; + } + case 3: { + message.sumOfSquaredDeviation = reader.double(); + break; + } + case 4: { + message.range = $root.google.api.Distribution.Range.decode(reader, reader.uint32()); + break; + } + case 6: { + message.bucketOptions = $root.google.api.Distribution.BucketOptions.decode(reader, reader.uint32()); + break; + } + case 7: { + if (!(message.bucketCounts && message.bucketCounts.length)) + message.bucketCounts = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.bucketCounts.push(reader.int64()); + } else + message.bucketCounts.push(reader.int64()); + break; + } + case 10: { + if (!(message.exemplars && message.exemplars.length)) + message.exemplars = []; + message.exemplars.push($root.google.api.Distribution.Exemplar.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Distribution message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.Distribution + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.Distribution} Distribution + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Distribution.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Distribution message. + * @function verify + * @memberof google.api.Distribution + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Distribution.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.count != null && message.hasOwnProperty("count")) + if (!$util.isInteger(message.count) && !(message.count && $util.isInteger(message.count.low) && $util.isInteger(message.count.high))) + return "count: integer|Long expected"; + if (message.mean != null && message.hasOwnProperty("mean")) + if (typeof message.mean !== "number") + return "mean: number expected"; + if (message.sumOfSquaredDeviation != null && message.hasOwnProperty("sumOfSquaredDeviation")) + if (typeof message.sumOfSquaredDeviation !== "number") + return "sumOfSquaredDeviation: number expected"; + if (message.range != null && message.hasOwnProperty("range")) { + var error = $root.google.api.Distribution.Range.verify(message.range); + if (error) + return "range." + error; + } + if (message.bucketOptions != null && message.hasOwnProperty("bucketOptions")) { + var error = $root.google.api.Distribution.BucketOptions.verify(message.bucketOptions); + if (error) + return "bucketOptions." + error; + } + if (message.bucketCounts != null && message.hasOwnProperty("bucketCounts")) { + if (!Array.isArray(message.bucketCounts)) + return "bucketCounts: array expected"; + for (var i = 0; i < message.bucketCounts.length; ++i) + if (!$util.isInteger(message.bucketCounts[i]) && !(message.bucketCounts[i] && $util.isInteger(message.bucketCounts[i].low) && $util.isInteger(message.bucketCounts[i].high))) + return "bucketCounts: integer|Long[] expected"; + } + if (message.exemplars != null && message.hasOwnProperty("exemplars")) { + if (!Array.isArray(message.exemplars)) + return "exemplars: array expected"; + for (var i = 0; i < message.exemplars.length; ++i) { + var error = $root.google.api.Distribution.Exemplar.verify(message.exemplars[i]); + if (error) + return "exemplars." + error; + } + } + return null; + }; + + /** + * Creates a Distribution message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.Distribution + * @static + * @param {Object.} object Plain object + * @returns {google.api.Distribution} Distribution + */ + Distribution.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.Distribution) + return object; + var message = new $root.google.api.Distribution(); + if (object.count != null) + if ($util.Long) + (message.count = $util.Long.fromValue(object.count)).unsigned = false; + else if (typeof object.count === "string") + message.count = parseInt(object.count, 10); + else if (typeof object.count === "number") + message.count = object.count; + else if (typeof object.count === "object") + message.count = new $util.LongBits(object.count.low >>> 0, object.count.high >>> 0).toNumber(); + if (object.mean != null) + message.mean = Number(object.mean); + if (object.sumOfSquaredDeviation != null) + message.sumOfSquaredDeviation = Number(object.sumOfSquaredDeviation); + if (object.range != null) { + if (typeof object.range !== "object") + throw TypeError(".google.api.Distribution.range: object expected"); + message.range = $root.google.api.Distribution.Range.fromObject(object.range); + } + if (object.bucketOptions != null) { + if (typeof object.bucketOptions !== "object") + throw TypeError(".google.api.Distribution.bucketOptions: object expected"); + message.bucketOptions = $root.google.api.Distribution.BucketOptions.fromObject(object.bucketOptions); + } + if (object.bucketCounts) { + if (!Array.isArray(object.bucketCounts)) + throw TypeError(".google.api.Distribution.bucketCounts: array expected"); + message.bucketCounts = []; + for (var i = 0; i < object.bucketCounts.length; ++i) + if ($util.Long) + (message.bucketCounts[i] = $util.Long.fromValue(object.bucketCounts[i])).unsigned = false; + else if (typeof object.bucketCounts[i] === "string") + message.bucketCounts[i] = parseInt(object.bucketCounts[i], 10); + else if (typeof object.bucketCounts[i] === "number") + message.bucketCounts[i] = object.bucketCounts[i]; + else if (typeof object.bucketCounts[i] === "object") + message.bucketCounts[i] = new $util.LongBits(object.bucketCounts[i].low >>> 0, object.bucketCounts[i].high >>> 0).toNumber(); + } + if (object.exemplars) { + if (!Array.isArray(object.exemplars)) + throw TypeError(".google.api.Distribution.exemplars: array expected"); + message.exemplars = []; + for (var i = 0; i < object.exemplars.length; ++i) { + if (typeof object.exemplars[i] !== "object") + throw TypeError(".google.api.Distribution.exemplars: object expected"); + message.exemplars[i] = $root.google.api.Distribution.Exemplar.fromObject(object.exemplars[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Distribution message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.Distribution + * @static + * @param {google.api.Distribution} message Distribution + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Distribution.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.bucketCounts = []; + object.exemplars = []; + } + if (options.defaults) { + if ($util.Long) { + var long = new $util.Long(0, 0, false); + object.count = options.longs === String ? long.toString() : options.longs === Number ? long.toNumber() : long; + } else + object.count = options.longs === String ? "0" : 0; + object.mean = 0; + object.sumOfSquaredDeviation = 0; + object.range = null; + object.bucketOptions = null; + } + if (message.count != null && message.hasOwnProperty("count")) + if (typeof message.count === "number") + object.count = options.longs === String ? String(message.count) : message.count; + else + object.count = options.longs === String ? $util.Long.prototype.toString.call(message.count) : options.longs === Number ? new $util.LongBits(message.count.low >>> 0, message.count.high >>> 0).toNumber() : message.count; + if (message.mean != null && message.hasOwnProperty("mean")) + object.mean = options.json && !isFinite(message.mean) ? String(message.mean) : message.mean; + if (message.sumOfSquaredDeviation != null && message.hasOwnProperty("sumOfSquaredDeviation")) + object.sumOfSquaredDeviation = options.json && !isFinite(message.sumOfSquaredDeviation) ? String(message.sumOfSquaredDeviation) : message.sumOfSquaredDeviation; + if (message.range != null && message.hasOwnProperty("range")) + object.range = $root.google.api.Distribution.Range.toObject(message.range, options); + if (message.bucketOptions != null && message.hasOwnProperty("bucketOptions")) + object.bucketOptions = $root.google.api.Distribution.BucketOptions.toObject(message.bucketOptions, options); + if (message.bucketCounts && message.bucketCounts.length) { + object.bucketCounts = []; + for (var j = 0; j < message.bucketCounts.length; ++j) + if (typeof message.bucketCounts[j] === "number") + object.bucketCounts[j] = options.longs === String ? String(message.bucketCounts[j]) : message.bucketCounts[j]; + else + object.bucketCounts[j] = options.longs === String ? $util.Long.prototype.toString.call(message.bucketCounts[j]) : options.longs === Number ? new $util.LongBits(message.bucketCounts[j].low >>> 0, message.bucketCounts[j].high >>> 0).toNumber() : message.bucketCounts[j]; + } + if (message.exemplars && message.exemplars.length) { + object.exemplars = []; + for (var j = 0; j < message.exemplars.length; ++j) + object.exemplars[j] = $root.google.api.Distribution.Exemplar.toObject(message.exemplars[j], options); + } + return object; + }; + + /** + * Converts this Distribution to JSON. + * @function toJSON + * @memberof google.api.Distribution + * @instance + * @returns {Object.} JSON object + */ + Distribution.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Distribution + * @function getTypeUrl + * @memberof google.api.Distribution + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Distribution.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.Distribution"; + }; + + Distribution.Range = (function() { + + /** + * Properties of a Range. + * @memberof google.api.Distribution + * @interface IRange + * @property {number|null} [min] Range min + * @property {number|null} [max] Range max + */ + + /** + * Constructs a new Range. + * @memberof google.api.Distribution + * @classdesc Represents a Range. + * @implements IRange + * @constructor + * @param {google.api.Distribution.IRange=} [properties] Properties to set + */ + function Range(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Range min. + * @member {number} min + * @memberof google.api.Distribution.Range + * @instance + */ + Range.prototype.min = 0; + + /** + * Range max. + * @member {number} max + * @memberof google.api.Distribution.Range + * @instance + */ + Range.prototype.max = 0; + + /** + * Creates a new Range instance using the specified properties. + * @function create + * @memberof google.api.Distribution.Range + * @static + * @param {google.api.Distribution.IRange=} [properties] Properties to set + * @returns {google.api.Distribution.Range} Range instance + */ + Range.create = function create(properties) { + return new Range(properties); + }; + + /** + * Encodes the specified Range message. Does not implicitly {@link google.api.Distribution.Range.verify|verify} messages. + * @function encode + * @memberof google.api.Distribution.Range + * @static + * @param {google.api.Distribution.IRange} message Range message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Range.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.min != null && Object.hasOwnProperty.call(message, "min")) + writer.uint32(/* id 1, wireType 1 =*/9).double(message.min); + if (message.max != null && Object.hasOwnProperty.call(message, "max")) + writer.uint32(/* id 2, wireType 1 =*/17).double(message.max); + return writer; + }; + + /** + * Encodes the specified Range message, length delimited. Does not implicitly {@link google.api.Distribution.Range.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.Distribution.Range + * @static + * @param {google.api.Distribution.IRange} message Range message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Range.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Range message from the specified reader or buffer. + * @function decode + * @memberof google.api.Distribution.Range + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.Distribution.Range} Range + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Range.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Distribution.Range(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.min = reader.double(); + break; + } + case 2: { + message.max = reader.double(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Range message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.Distribution.Range + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.Distribution.Range} Range + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Range.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Range message. + * @function verify + * @memberof google.api.Distribution.Range + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Range.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.min != null && message.hasOwnProperty("min")) + if (typeof message.min !== "number") + return "min: number expected"; + if (message.max != null && message.hasOwnProperty("max")) + if (typeof message.max !== "number") + return "max: number expected"; + return null; + }; + + /** + * Creates a Range message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.Distribution.Range + * @static + * @param {Object.} object Plain object + * @returns {google.api.Distribution.Range} Range + */ + Range.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.Distribution.Range) + return object; + var message = new $root.google.api.Distribution.Range(); + if (object.min != null) + message.min = Number(object.min); + if (object.max != null) + message.max = Number(object.max); + return message; + }; + + /** + * Creates a plain object from a Range message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.Distribution.Range + * @static + * @param {google.api.Distribution.Range} message Range + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Range.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.min = 0; + object.max = 0; + } + if (message.min != null && message.hasOwnProperty("min")) + object.min = options.json && !isFinite(message.min) ? String(message.min) : message.min; + if (message.max != null && message.hasOwnProperty("max")) + object.max = options.json && !isFinite(message.max) ? String(message.max) : message.max; + return object; + }; + + /** + * Converts this Range to JSON. + * @function toJSON + * @memberof google.api.Distribution.Range + * @instance + * @returns {Object.} JSON object + */ + Range.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Range + * @function getTypeUrl + * @memberof google.api.Distribution.Range + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Range.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.Distribution.Range"; + }; + + return Range; + })(); + + Distribution.BucketOptions = (function() { + + /** + * Properties of a BucketOptions. + * @memberof google.api.Distribution + * @interface IBucketOptions + * @property {google.api.Distribution.BucketOptions.ILinear|null} [linearBuckets] BucketOptions linearBuckets + * @property {google.api.Distribution.BucketOptions.IExponential|null} [exponentialBuckets] BucketOptions exponentialBuckets + * @property {google.api.Distribution.BucketOptions.IExplicit|null} [explicitBuckets] BucketOptions explicitBuckets + */ + + /** + * Constructs a new BucketOptions. + * @memberof google.api.Distribution + * @classdesc Represents a BucketOptions. + * @implements IBucketOptions + * @constructor + * @param {google.api.Distribution.IBucketOptions=} [properties] Properties to set + */ + function BucketOptions(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * BucketOptions linearBuckets. + * @member {google.api.Distribution.BucketOptions.ILinear|null|undefined} linearBuckets + * @memberof google.api.Distribution.BucketOptions + * @instance + */ + BucketOptions.prototype.linearBuckets = null; + + /** + * BucketOptions exponentialBuckets. + * @member {google.api.Distribution.BucketOptions.IExponential|null|undefined} exponentialBuckets + * @memberof google.api.Distribution.BucketOptions + * @instance + */ + BucketOptions.prototype.exponentialBuckets = null; + + /** + * BucketOptions explicitBuckets. + * @member {google.api.Distribution.BucketOptions.IExplicit|null|undefined} explicitBuckets + * @memberof google.api.Distribution.BucketOptions + * @instance + */ + BucketOptions.prototype.explicitBuckets = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * BucketOptions options. + * @member {"linearBuckets"|"exponentialBuckets"|"explicitBuckets"|undefined} options + * @memberof google.api.Distribution.BucketOptions + * @instance + */ + Object.defineProperty(BucketOptions.prototype, "options", { + get: $util.oneOfGetter($oneOfFields = ["linearBuckets", "exponentialBuckets", "explicitBuckets"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new BucketOptions instance using the specified properties. + * @function create + * @memberof google.api.Distribution.BucketOptions + * @static + * @param {google.api.Distribution.IBucketOptions=} [properties] Properties to set + * @returns {google.api.Distribution.BucketOptions} BucketOptions instance + */ + BucketOptions.create = function create(properties) { + return new BucketOptions(properties); + }; + + /** + * Encodes the specified BucketOptions message. Does not implicitly {@link google.api.Distribution.BucketOptions.verify|verify} messages. + * @function encode + * @memberof google.api.Distribution.BucketOptions + * @static + * @param {google.api.Distribution.IBucketOptions} message BucketOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BucketOptions.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.linearBuckets != null && Object.hasOwnProperty.call(message, "linearBuckets")) + $root.google.api.Distribution.BucketOptions.Linear.encode(message.linearBuckets, writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.exponentialBuckets != null && Object.hasOwnProperty.call(message, "exponentialBuckets")) + $root.google.api.Distribution.BucketOptions.Exponential.encode(message.exponentialBuckets, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.explicitBuckets != null && Object.hasOwnProperty.call(message, "explicitBuckets")) + $root.google.api.Distribution.BucketOptions.Explicit.encode(message.explicitBuckets, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified BucketOptions message, length delimited. Does not implicitly {@link google.api.Distribution.BucketOptions.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.Distribution.BucketOptions + * @static + * @param {google.api.Distribution.IBucketOptions} message BucketOptions message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + BucketOptions.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a BucketOptions message from the specified reader or buffer. + * @function decode + * @memberof google.api.Distribution.BucketOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.Distribution.BucketOptions} BucketOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BucketOptions.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Distribution.BucketOptions(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.linearBuckets = $root.google.api.Distribution.BucketOptions.Linear.decode(reader, reader.uint32()); + break; + } + case 2: { + message.exponentialBuckets = $root.google.api.Distribution.BucketOptions.Exponential.decode(reader, reader.uint32()); + break; + } + case 3: { + message.explicitBuckets = $root.google.api.Distribution.BucketOptions.Explicit.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a BucketOptions message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.Distribution.BucketOptions + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.Distribution.BucketOptions} BucketOptions + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + BucketOptions.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a BucketOptions message. + * @function verify + * @memberof google.api.Distribution.BucketOptions + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + BucketOptions.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.linearBuckets != null && message.hasOwnProperty("linearBuckets")) { + properties.options = 1; + { + var error = $root.google.api.Distribution.BucketOptions.Linear.verify(message.linearBuckets); + if (error) + return "linearBuckets." + error; + } + } + if (message.exponentialBuckets != null && message.hasOwnProperty("exponentialBuckets")) { + if (properties.options === 1) + return "options: multiple values"; + properties.options = 1; + { + var error = $root.google.api.Distribution.BucketOptions.Exponential.verify(message.exponentialBuckets); + if (error) + return "exponentialBuckets." + error; + } + } + if (message.explicitBuckets != null && message.hasOwnProperty("explicitBuckets")) { + if (properties.options === 1) + return "options: multiple values"; + properties.options = 1; + { + var error = $root.google.api.Distribution.BucketOptions.Explicit.verify(message.explicitBuckets); + if (error) + return "explicitBuckets." + error; + } + } + return null; + }; + + /** + * Creates a BucketOptions message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.Distribution.BucketOptions + * @static + * @param {Object.} object Plain object + * @returns {google.api.Distribution.BucketOptions} BucketOptions + */ + BucketOptions.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.Distribution.BucketOptions) + return object; + var message = new $root.google.api.Distribution.BucketOptions(); + if (object.linearBuckets != null) { + if (typeof object.linearBuckets !== "object") + throw TypeError(".google.api.Distribution.BucketOptions.linearBuckets: object expected"); + message.linearBuckets = $root.google.api.Distribution.BucketOptions.Linear.fromObject(object.linearBuckets); + } + if (object.exponentialBuckets != null) { + if (typeof object.exponentialBuckets !== "object") + throw TypeError(".google.api.Distribution.BucketOptions.exponentialBuckets: object expected"); + message.exponentialBuckets = $root.google.api.Distribution.BucketOptions.Exponential.fromObject(object.exponentialBuckets); + } + if (object.explicitBuckets != null) { + if (typeof object.explicitBuckets !== "object") + throw TypeError(".google.api.Distribution.BucketOptions.explicitBuckets: object expected"); + message.explicitBuckets = $root.google.api.Distribution.BucketOptions.Explicit.fromObject(object.explicitBuckets); + } + return message; + }; + + /** + * Creates a plain object from a BucketOptions message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.Distribution.BucketOptions + * @static + * @param {google.api.Distribution.BucketOptions} message BucketOptions + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + BucketOptions.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (message.linearBuckets != null && message.hasOwnProperty("linearBuckets")) { + object.linearBuckets = $root.google.api.Distribution.BucketOptions.Linear.toObject(message.linearBuckets, options); + if (options.oneofs) + object.options = "linearBuckets"; + } + if (message.exponentialBuckets != null && message.hasOwnProperty("exponentialBuckets")) { + object.exponentialBuckets = $root.google.api.Distribution.BucketOptions.Exponential.toObject(message.exponentialBuckets, options); + if (options.oneofs) + object.options = "exponentialBuckets"; + } + if (message.explicitBuckets != null && message.hasOwnProperty("explicitBuckets")) { + object.explicitBuckets = $root.google.api.Distribution.BucketOptions.Explicit.toObject(message.explicitBuckets, options); + if (options.oneofs) + object.options = "explicitBuckets"; + } + return object; + }; + + /** + * Converts this BucketOptions to JSON. + * @function toJSON + * @memberof google.api.Distribution.BucketOptions + * @instance + * @returns {Object.} JSON object + */ + BucketOptions.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for BucketOptions + * @function getTypeUrl + * @memberof google.api.Distribution.BucketOptions + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + BucketOptions.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.Distribution.BucketOptions"; + }; + + BucketOptions.Linear = (function() { + + /** + * Properties of a Linear. + * @memberof google.api.Distribution.BucketOptions + * @interface ILinear + * @property {number|null} [numFiniteBuckets] Linear numFiniteBuckets + * @property {number|null} [width] Linear width + * @property {number|null} [offset] Linear offset + */ + + /** + * Constructs a new Linear. + * @memberof google.api.Distribution.BucketOptions + * @classdesc Represents a Linear. + * @implements ILinear + * @constructor + * @param {google.api.Distribution.BucketOptions.ILinear=} [properties] Properties to set + */ + function Linear(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Linear numFiniteBuckets. + * @member {number} numFiniteBuckets + * @memberof google.api.Distribution.BucketOptions.Linear + * @instance + */ + Linear.prototype.numFiniteBuckets = 0; + + /** + * Linear width. + * @member {number} width + * @memberof google.api.Distribution.BucketOptions.Linear + * @instance + */ + Linear.prototype.width = 0; + + /** + * Linear offset. + * @member {number} offset + * @memberof google.api.Distribution.BucketOptions.Linear + * @instance + */ + Linear.prototype.offset = 0; + + /** + * Creates a new Linear instance using the specified properties. + * @function create + * @memberof google.api.Distribution.BucketOptions.Linear + * @static + * @param {google.api.Distribution.BucketOptions.ILinear=} [properties] Properties to set + * @returns {google.api.Distribution.BucketOptions.Linear} Linear instance + */ + Linear.create = function create(properties) { + return new Linear(properties); + }; + + /** + * Encodes the specified Linear message. Does not implicitly {@link google.api.Distribution.BucketOptions.Linear.verify|verify} messages. + * @function encode + * @memberof google.api.Distribution.BucketOptions.Linear + * @static + * @param {google.api.Distribution.BucketOptions.ILinear} message Linear message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Linear.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.numFiniteBuckets != null && Object.hasOwnProperty.call(message, "numFiniteBuckets")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.numFiniteBuckets); + if (message.width != null && Object.hasOwnProperty.call(message, "width")) + writer.uint32(/* id 2, wireType 1 =*/17).double(message.width); + if (message.offset != null && Object.hasOwnProperty.call(message, "offset")) + writer.uint32(/* id 3, wireType 1 =*/25).double(message.offset); + return writer; + }; + + /** + * Encodes the specified Linear message, length delimited. Does not implicitly {@link google.api.Distribution.BucketOptions.Linear.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.Distribution.BucketOptions.Linear + * @static + * @param {google.api.Distribution.BucketOptions.ILinear} message Linear message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Linear.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Linear message from the specified reader or buffer. + * @function decode + * @memberof google.api.Distribution.BucketOptions.Linear + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.Distribution.BucketOptions.Linear} Linear + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Linear.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Distribution.BucketOptions.Linear(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.numFiniteBuckets = reader.int32(); + break; + } + case 2: { + message.width = reader.double(); + break; + } + case 3: { + message.offset = reader.double(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Linear message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.Distribution.BucketOptions.Linear + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.Distribution.BucketOptions.Linear} Linear + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Linear.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Linear message. + * @function verify + * @memberof google.api.Distribution.BucketOptions.Linear + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Linear.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.numFiniteBuckets != null && message.hasOwnProperty("numFiniteBuckets")) + if (!$util.isInteger(message.numFiniteBuckets)) + return "numFiniteBuckets: integer expected"; + if (message.width != null && message.hasOwnProperty("width")) + if (typeof message.width !== "number") + return "width: number expected"; + if (message.offset != null && message.hasOwnProperty("offset")) + if (typeof message.offset !== "number") + return "offset: number expected"; + return null; + }; + + /** + * Creates a Linear message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.Distribution.BucketOptions.Linear + * @static + * @param {Object.} object Plain object + * @returns {google.api.Distribution.BucketOptions.Linear} Linear + */ + Linear.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.Distribution.BucketOptions.Linear) + return object; + var message = new $root.google.api.Distribution.BucketOptions.Linear(); + if (object.numFiniteBuckets != null) + message.numFiniteBuckets = object.numFiniteBuckets | 0; + if (object.width != null) + message.width = Number(object.width); + if (object.offset != null) + message.offset = Number(object.offset); + return message; + }; + + /** + * Creates a plain object from a Linear message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.Distribution.BucketOptions.Linear + * @static + * @param {google.api.Distribution.BucketOptions.Linear} message Linear + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Linear.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.numFiniteBuckets = 0; + object.width = 0; + object.offset = 0; + } + if (message.numFiniteBuckets != null && message.hasOwnProperty("numFiniteBuckets")) + object.numFiniteBuckets = message.numFiniteBuckets; + if (message.width != null && message.hasOwnProperty("width")) + object.width = options.json && !isFinite(message.width) ? String(message.width) : message.width; + if (message.offset != null && message.hasOwnProperty("offset")) + object.offset = options.json && !isFinite(message.offset) ? String(message.offset) : message.offset; + return object; + }; + + /** + * Converts this Linear to JSON. + * @function toJSON + * @memberof google.api.Distribution.BucketOptions.Linear + * @instance + * @returns {Object.} JSON object + */ + Linear.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Linear + * @function getTypeUrl + * @memberof google.api.Distribution.BucketOptions.Linear + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Linear.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.Distribution.BucketOptions.Linear"; + }; + + return Linear; + })(); + + BucketOptions.Exponential = (function() { + + /** + * Properties of an Exponential. + * @memberof google.api.Distribution.BucketOptions + * @interface IExponential + * @property {number|null} [numFiniteBuckets] Exponential numFiniteBuckets + * @property {number|null} [growthFactor] Exponential growthFactor + * @property {number|null} [scale] Exponential scale + */ + + /** + * Constructs a new Exponential. + * @memberof google.api.Distribution.BucketOptions + * @classdesc Represents an Exponential. + * @implements IExponential + * @constructor + * @param {google.api.Distribution.BucketOptions.IExponential=} [properties] Properties to set + */ + function Exponential(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Exponential numFiniteBuckets. + * @member {number} numFiniteBuckets + * @memberof google.api.Distribution.BucketOptions.Exponential + * @instance + */ + Exponential.prototype.numFiniteBuckets = 0; + + /** + * Exponential growthFactor. + * @member {number} growthFactor + * @memberof google.api.Distribution.BucketOptions.Exponential + * @instance + */ + Exponential.prototype.growthFactor = 0; + + /** + * Exponential scale. + * @member {number} scale + * @memberof google.api.Distribution.BucketOptions.Exponential + * @instance + */ + Exponential.prototype.scale = 0; + + /** + * Creates a new Exponential instance using the specified properties. + * @function create + * @memberof google.api.Distribution.BucketOptions.Exponential + * @static + * @param {google.api.Distribution.BucketOptions.IExponential=} [properties] Properties to set + * @returns {google.api.Distribution.BucketOptions.Exponential} Exponential instance + */ + Exponential.create = function create(properties) { + return new Exponential(properties); + }; + + /** + * Encodes the specified Exponential message. Does not implicitly {@link google.api.Distribution.BucketOptions.Exponential.verify|verify} messages. + * @function encode + * @memberof google.api.Distribution.BucketOptions.Exponential + * @static + * @param {google.api.Distribution.BucketOptions.IExponential} message Exponential message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Exponential.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.numFiniteBuckets != null && Object.hasOwnProperty.call(message, "numFiniteBuckets")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.numFiniteBuckets); + if (message.growthFactor != null && Object.hasOwnProperty.call(message, "growthFactor")) + writer.uint32(/* id 2, wireType 1 =*/17).double(message.growthFactor); + if (message.scale != null && Object.hasOwnProperty.call(message, "scale")) + writer.uint32(/* id 3, wireType 1 =*/25).double(message.scale); + return writer; + }; + + /** + * Encodes the specified Exponential message, length delimited. Does not implicitly {@link google.api.Distribution.BucketOptions.Exponential.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.Distribution.BucketOptions.Exponential + * @static + * @param {google.api.Distribution.BucketOptions.IExponential} message Exponential message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Exponential.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Exponential message from the specified reader or buffer. + * @function decode + * @memberof google.api.Distribution.BucketOptions.Exponential + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.Distribution.BucketOptions.Exponential} Exponential + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Exponential.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Distribution.BucketOptions.Exponential(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.numFiniteBuckets = reader.int32(); + break; + } + case 2: { + message.growthFactor = reader.double(); + break; + } + case 3: { + message.scale = reader.double(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Exponential message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.Distribution.BucketOptions.Exponential + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.Distribution.BucketOptions.Exponential} Exponential + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Exponential.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Exponential message. + * @function verify + * @memberof google.api.Distribution.BucketOptions.Exponential + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Exponential.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.numFiniteBuckets != null && message.hasOwnProperty("numFiniteBuckets")) + if (!$util.isInteger(message.numFiniteBuckets)) + return "numFiniteBuckets: integer expected"; + if (message.growthFactor != null && message.hasOwnProperty("growthFactor")) + if (typeof message.growthFactor !== "number") + return "growthFactor: number expected"; + if (message.scale != null && message.hasOwnProperty("scale")) + if (typeof message.scale !== "number") + return "scale: number expected"; + return null; + }; + + /** + * Creates an Exponential message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.Distribution.BucketOptions.Exponential + * @static + * @param {Object.} object Plain object + * @returns {google.api.Distribution.BucketOptions.Exponential} Exponential + */ + Exponential.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.Distribution.BucketOptions.Exponential) + return object; + var message = new $root.google.api.Distribution.BucketOptions.Exponential(); + if (object.numFiniteBuckets != null) + message.numFiniteBuckets = object.numFiniteBuckets | 0; + if (object.growthFactor != null) + message.growthFactor = Number(object.growthFactor); + if (object.scale != null) + message.scale = Number(object.scale); + return message; + }; + + /** + * Creates a plain object from an Exponential message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.Distribution.BucketOptions.Exponential + * @static + * @param {google.api.Distribution.BucketOptions.Exponential} message Exponential + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Exponential.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.numFiniteBuckets = 0; + object.growthFactor = 0; + object.scale = 0; + } + if (message.numFiniteBuckets != null && message.hasOwnProperty("numFiniteBuckets")) + object.numFiniteBuckets = message.numFiniteBuckets; + if (message.growthFactor != null && message.hasOwnProperty("growthFactor")) + object.growthFactor = options.json && !isFinite(message.growthFactor) ? String(message.growthFactor) : message.growthFactor; + if (message.scale != null && message.hasOwnProperty("scale")) + object.scale = options.json && !isFinite(message.scale) ? String(message.scale) : message.scale; + return object; + }; + + /** + * Converts this Exponential to JSON. + * @function toJSON + * @memberof google.api.Distribution.BucketOptions.Exponential + * @instance + * @returns {Object.} JSON object + */ + Exponential.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Exponential + * @function getTypeUrl + * @memberof google.api.Distribution.BucketOptions.Exponential + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Exponential.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.Distribution.BucketOptions.Exponential"; + }; + + return Exponential; + })(); + + BucketOptions.Explicit = (function() { + + /** + * Properties of an Explicit. + * @memberof google.api.Distribution.BucketOptions + * @interface IExplicit + * @property {Array.|null} [bounds] Explicit bounds + */ + + /** + * Constructs a new Explicit. + * @memberof google.api.Distribution.BucketOptions + * @classdesc Represents an Explicit. + * @implements IExplicit + * @constructor + * @param {google.api.Distribution.BucketOptions.IExplicit=} [properties] Properties to set + */ + function Explicit(properties) { + this.bounds = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Explicit bounds. + * @member {Array.} bounds + * @memberof google.api.Distribution.BucketOptions.Explicit + * @instance + */ + Explicit.prototype.bounds = $util.emptyArray; + + /** + * Creates a new Explicit instance using the specified properties. + * @function create + * @memberof google.api.Distribution.BucketOptions.Explicit + * @static + * @param {google.api.Distribution.BucketOptions.IExplicit=} [properties] Properties to set + * @returns {google.api.Distribution.BucketOptions.Explicit} Explicit instance + */ + Explicit.create = function create(properties) { + return new Explicit(properties); + }; + + /** + * Encodes the specified Explicit message. Does not implicitly {@link google.api.Distribution.BucketOptions.Explicit.verify|verify} messages. + * @function encode + * @memberof google.api.Distribution.BucketOptions.Explicit + * @static + * @param {google.api.Distribution.BucketOptions.IExplicit} message Explicit message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Explicit.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.bounds != null && message.bounds.length) { + writer.uint32(/* id 1, wireType 2 =*/10).fork(); + for (var i = 0; i < message.bounds.length; ++i) + writer.double(message.bounds[i]); + writer.ldelim(); + } + return writer; + }; + + /** + * Encodes the specified Explicit message, length delimited. Does not implicitly {@link google.api.Distribution.BucketOptions.Explicit.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.Distribution.BucketOptions.Explicit + * @static + * @param {google.api.Distribution.BucketOptions.IExplicit} message Explicit message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Explicit.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Explicit message from the specified reader or buffer. + * @function decode + * @memberof google.api.Distribution.BucketOptions.Explicit + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.Distribution.BucketOptions.Explicit} Explicit + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Explicit.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Distribution.BucketOptions.Explicit(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.bounds && message.bounds.length)) + message.bounds = []; + if ((tag & 7) === 2) { + var end2 = reader.uint32() + reader.pos; + while (reader.pos < end2) + message.bounds.push(reader.double()); + } else + message.bounds.push(reader.double()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Explicit message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.Distribution.BucketOptions.Explicit + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.Distribution.BucketOptions.Explicit} Explicit + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Explicit.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Explicit message. + * @function verify + * @memberof google.api.Distribution.BucketOptions.Explicit + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Explicit.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.bounds != null && message.hasOwnProperty("bounds")) { + if (!Array.isArray(message.bounds)) + return "bounds: array expected"; + for (var i = 0; i < message.bounds.length; ++i) + if (typeof message.bounds[i] !== "number") + return "bounds: number[] expected"; + } + return null; + }; + + /** + * Creates an Explicit message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.Distribution.BucketOptions.Explicit + * @static + * @param {Object.} object Plain object + * @returns {google.api.Distribution.BucketOptions.Explicit} Explicit + */ + Explicit.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.Distribution.BucketOptions.Explicit) + return object; + var message = new $root.google.api.Distribution.BucketOptions.Explicit(); + if (object.bounds) { + if (!Array.isArray(object.bounds)) + throw TypeError(".google.api.Distribution.BucketOptions.Explicit.bounds: array expected"); + message.bounds = []; + for (var i = 0; i < object.bounds.length; ++i) + message.bounds[i] = Number(object.bounds[i]); + } + return message; + }; + + /** + * Creates a plain object from an Explicit message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.Distribution.BucketOptions.Explicit + * @static + * @param {google.api.Distribution.BucketOptions.Explicit} message Explicit + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Explicit.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.bounds = []; + if (message.bounds && message.bounds.length) { + object.bounds = []; + for (var j = 0; j < message.bounds.length; ++j) + object.bounds[j] = options.json && !isFinite(message.bounds[j]) ? String(message.bounds[j]) : message.bounds[j]; + } + return object; + }; + + /** + * Converts this Explicit to JSON. + * @function toJSON + * @memberof google.api.Distribution.BucketOptions.Explicit + * @instance + * @returns {Object.} JSON object + */ + Explicit.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Explicit + * @function getTypeUrl + * @memberof google.api.Distribution.BucketOptions.Explicit + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Explicit.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.Distribution.BucketOptions.Explicit"; + }; + + return Explicit; + })(); + + return BucketOptions; + })(); + + Distribution.Exemplar = (function() { + + /** + * Properties of an Exemplar. + * @memberof google.api.Distribution + * @interface IExemplar + * @property {number|null} [value] Exemplar value + * @property {google.protobuf.ITimestamp|null} [timestamp] Exemplar timestamp + * @property {Array.|null} [attachments] Exemplar attachments + */ + + /** + * Constructs a new Exemplar. + * @memberof google.api.Distribution + * @classdesc Represents an Exemplar. + * @implements IExemplar + * @constructor + * @param {google.api.Distribution.IExemplar=} [properties] Properties to set + */ + function Exemplar(properties) { + this.attachments = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Exemplar value. + * @member {number} value + * @memberof google.api.Distribution.Exemplar + * @instance + */ + Exemplar.prototype.value = 0; + + /** + * Exemplar timestamp. + * @member {google.protobuf.ITimestamp|null|undefined} timestamp + * @memberof google.api.Distribution.Exemplar + * @instance + */ + Exemplar.prototype.timestamp = null; + + /** + * Exemplar attachments. + * @member {Array.} attachments + * @memberof google.api.Distribution.Exemplar + * @instance + */ + Exemplar.prototype.attachments = $util.emptyArray; + + /** + * Creates a new Exemplar instance using the specified properties. + * @function create + * @memberof google.api.Distribution.Exemplar + * @static + * @param {google.api.Distribution.IExemplar=} [properties] Properties to set + * @returns {google.api.Distribution.Exemplar} Exemplar instance + */ + Exemplar.create = function create(properties) { + return new Exemplar(properties); + }; + + /** + * Encodes the specified Exemplar message. Does not implicitly {@link google.api.Distribution.Exemplar.verify|verify} messages. + * @function encode + * @memberof google.api.Distribution.Exemplar + * @static + * @param {google.api.Distribution.IExemplar} message Exemplar message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Exemplar.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.value != null && Object.hasOwnProperty.call(message, "value")) + writer.uint32(/* id 1, wireType 1 =*/9).double(message.value); + if (message.timestamp != null && Object.hasOwnProperty.call(message, "timestamp")) + $root.google.protobuf.Timestamp.encode(message.timestamp, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.attachments != null && message.attachments.length) + for (var i = 0; i < message.attachments.length; ++i) + $root.google.protobuf.Any.encode(message.attachments[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Exemplar message, length delimited. Does not implicitly {@link google.api.Distribution.Exemplar.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.Distribution.Exemplar + * @static + * @param {google.api.Distribution.IExemplar} message Exemplar message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Exemplar.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Exemplar message from the specified reader or buffer. + * @function decode + * @memberof google.api.Distribution.Exemplar + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.Distribution.Exemplar} Exemplar + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Exemplar.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Distribution.Exemplar(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.value = reader.double(); + break; + } + case 2: { + message.timestamp = $root.google.protobuf.Timestamp.decode(reader, reader.uint32()); + break; + } + case 3: { + if (!(message.attachments && message.attachments.length)) + message.attachments = []; + message.attachments.push($root.google.protobuf.Any.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Exemplar message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.Distribution.Exemplar + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.Distribution.Exemplar} Exemplar + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Exemplar.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Exemplar message. + * @function verify + * @memberof google.api.Distribution.Exemplar + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Exemplar.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.value != null && message.hasOwnProperty("value")) + if (typeof message.value !== "number") + return "value: number expected"; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) { + var error = $root.google.protobuf.Timestamp.verify(message.timestamp); + if (error) + return "timestamp." + error; + } + if (message.attachments != null && message.hasOwnProperty("attachments")) { + if (!Array.isArray(message.attachments)) + return "attachments: array expected"; + for (var i = 0; i < message.attachments.length; ++i) { + var error = $root.google.protobuf.Any.verify(message.attachments[i]); + if (error) + return "attachments." + error; + } + } + return null; + }; + + /** + * Creates an Exemplar message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.Distribution.Exemplar + * @static + * @param {Object.} object Plain object + * @returns {google.api.Distribution.Exemplar} Exemplar + */ + Exemplar.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.Distribution.Exemplar) + return object; + var message = new $root.google.api.Distribution.Exemplar(); + if (object.value != null) + message.value = Number(object.value); + if (object.timestamp != null) { + if (typeof object.timestamp !== "object") + throw TypeError(".google.api.Distribution.Exemplar.timestamp: object expected"); + message.timestamp = $root.google.protobuf.Timestamp.fromObject(object.timestamp); + } + if (object.attachments) { + if (!Array.isArray(object.attachments)) + throw TypeError(".google.api.Distribution.Exemplar.attachments: array expected"); + message.attachments = []; + for (var i = 0; i < object.attachments.length; ++i) { + if (typeof object.attachments[i] !== "object") + throw TypeError(".google.api.Distribution.Exemplar.attachments: object expected"); + message.attachments[i] = $root.google.protobuf.Any.fromObject(object.attachments[i]); + } + } + return message; + }; + + /** + * Creates a plain object from an Exemplar message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.Distribution.Exemplar + * @static + * @param {google.api.Distribution.Exemplar} message Exemplar + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Exemplar.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.attachments = []; + if (options.defaults) { + object.value = 0; + object.timestamp = null; + } + if (message.value != null && message.hasOwnProperty("value")) + object.value = options.json && !isFinite(message.value) ? String(message.value) : message.value; + if (message.timestamp != null && message.hasOwnProperty("timestamp")) + object.timestamp = $root.google.protobuf.Timestamp.toObject(message.timestamp, options); + if (message.attachments && message.attachments.length) { + object.attachments = []; + for (var j = 0; j < message.attachments.length; ++j) + object.attachments[j] = $root.google.protobuf.Any.toObject(message.attachments[j], options); + } + return object; + }; + + /** + * Converts this Exemplar to JSON. + * @function toJSON + * @memberof google.api.Distribution.Exemplar + * @instance + * @returns {Object.} JSON object + */ + Exemplar.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Exemplar + * @function getTypeUrl + * @memberof google.api.Distribution.Exemplar + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Exemplar.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.Distribution.Exemplar"; + }; + + return Exemplar; + })(); + + return Distribution; + })(); + + api.MetricDescriptor = (function() { + + /** + * Properties of a MetricDescriptor. + * @memberof google.api + * @interface IMetricDescriptor + * @property {string|null} [name] MetricDescriptor name + * @property {string|null} [type] MetricDescriptor type + * @property {Array.|null} [labels] MetricDescriptor labels + * @property {google.api.MetricDescriptor.MetricKind|null} [metricKind] MetricDescriptor metricKind + * @property {google.api.MetricDescriptor.ValueType|null} [valueType] MetricDescriptor valueType + * @property {string|null} [unit] MetricDescriptor unit + * @property {string|null} [description] MetricDescriptor description + * @property {string|null} [displayName] MetricDescriptor displayName + * @property {google.api.MetricDescriptor.IMetricDescriptorMetadata|null} [metadata] MetricDescriptor metadata + * @property {google.api.LaunchStage|null} [launchStage] MetricDescriptor launchStage + * @property {Array.|null} [monitoredResourceTypes] MetricDescriptor monitoredResourceTypes + */ + + /** + * Constructs a new MetricDescriptor. + * @memberof google.api + * @classdesc Represents a MetricDescriptor. + * @implements IMetricDescriptor + * @constructor + * @param {google.api.IMetricDescriptor=} [properties] Properties to set + */ + function MetricDescriptor(properties) { + this.labels = []; + this.monitoredResourceTypes = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MetricDescriptor name. + * @member {string} name + * @memberof google.api.MetricDescriptor + * @instance + */ + MetricDescriptor.prototype.name = ""; + + /** + * MetricDescriptor type. + * @member {string} type + * @memberof google.api.MetricDescriptor + * @instance + */ + MetricDescriptor.prototype.type = ""; + + /** + * MetricDescriptor labels. + * @member {Array.} labels + * @memberof google.api.MetricDescriptor + * @instance + */ + MetricDescriptor.prototype.labels = $util.emptyArray; + + /** + * MetricDescriptor metricKind. + * @member {google.api.MetricDescriptor.MetricKind} metricKind + * @memberof google.api.MetricDescriptor + * @instance + */ + MetricDescriptor.prototype.metricKind = 0; + + /** + * MetricDescriptor valueType. + * @member {google.api.MetricDescriptor.ValueType} valueType + * @memberof google.api.MetricDescriptor + * @instance + */ + MetricDescriptor.prototype.valueType = 0; + + /** + * MetricDescriptor unit. + * @member {string} unit + * @memberof google.api.MetricDescriptor + * @instance + */ + MetricDescriptor.prototype.unit = ""; + + /** + * MetricDescriptor description. + * @member {string} description + * @memberof google.api.MetricDescriptor + * @instance + */ + MetricDescriptor.prototype.description = ""; + + /** + * MetricDescriptor displayName. + * @member {string} displayName + * @memberof google.api.MetricDescriptor + * @instance + */ + MetricDescriptor.prototype.displayName = ""; + + /** + * MetricDescriptor metadata. + * @member {google.api.MetricDescriptor.IMetricDescriptorMetadata|null|undefined} metadata + * @memberof google.api.MetricDescriptor + * @instance + */ + MetricDescriptor.prototype.metadata = null; + + /** + * MetricDescriptor launchStage. + * @member {google.api.LaunchStage} launchStage + * @memberof google.api.MetricDescriptor + * @instance + */ + MetricDescriptor.prototype.launchStage = 0; + + /** + * MetricDescriptor monitoredResourceTypes. + * @member {Array.} monitoredResourceTypes + * @memberof google.api.MetricDescriptor + * @instance + */ + MetricDescriptor.prototype.monitoredResourceTypes = $util.emptyArray; + + /** + * Creates a new MetricDescriptor instance using the specified properties. + * @function create + * @memberof google.api.MetricDescriptor + * @static + * @param {google.api.IMetricDescriptor=} [properties] Properties to set + * @returns {google.api.MetricDescriptor} MetricDescriptor instance + */ + MetricDescriptor.create = function create(properties) { + return new MetricDescriptor(properties); + }; + + /** + * Encodes the specified MetricDescriptor message. Does not implicitly {@link google.api.MetricDescriptor.verify|verify} messages. + * @function encode + * @memberof google.api.MetricDescriptor + * @static + * @param {google.api.IMetricDescriptor} message MetricDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MetricDescriptor.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.labels != null && message.labels.length) + for (var i = 0; i < message.labels.length; ++i) + $root.google.api.LabelDescriptor.encode(message.labels[i], writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.metricKind != null && Object.hasOwnProperty.call(message, "metricKind")) + writer.uint32(/* id 3, wireType 0 =*/24).int32(message.metricKind); + if (message.valueType != null && Object.hasOwnProperty.call(message, "valueType")) + writer.uint32(/* id 4, wireType 0 =*/32).int32(message.valueType); + if (message.unit != null && Object.hasOwnProperty.call(message, "unit")) + writer.uint32(/* id 5, wireType 2 =*/42).string(message.unit); + if (message.description != null && Object.hasOwnProperty.call(message, "description")) + writer.uint32(/* id 6, wireType 2 =*/50).string(message.description); + if (message.displayName != null && Object.hasOwnProperty.call(message, "displayName")) + writer.uint32(/* id 7, wireType 2 =*/58).string(message.displayName); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 8, wireType 2 =*/66).string(message.type); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.google.api.MetricDescriptor.MetricDescriptorMetadata.encode(message.metadata, writer.uint32(/* id 10, wireType 2 =*/82).fork()).ldelim(); + if (message.launchStage != null && Object.hasOwnProperty.call(message, "launchStage")) + writer.uint32(/* id 12, wireType 0 =*/96).int32(message.launchStage); + if (message.monitoredResourceTypes != null && message.monitoredResourceTypes.length) + for (var i = 0; i < message.monitoredResourceTypes.length; ++i) + writer.uint32(/* id 13, wireType 2 =*/106).string(message.monitoredResourceTypes[i]); + return writer; + }; + + /** + * Encodes the specified MetricDescriptor message, length delimited. Does not implicitly {@link google.api.MetricDescriptor.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.MetricDescriptor + * @static + * @param {google.api.IMetricDescriptor} message MetricDescriptor message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MetricDescriptor.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MetricDescriptor message from the specified reader or buffer. + * @function decode + * @memberof google.api.MetricDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.MetricDescriptor} MetricDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MetricDescriptor.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.MetricDescriptor(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 8: { + message.type = reader.string(); + break; + } + case 2: { + if (!(message.labels && message.labels.length)) + message.labels = []; + message.labels.push($root.google.api.LabelDescriptor.decode(reader, reader.uint32())); + break; + } + case 3: { + message.metricKind = reader.int32(); + break; + } + case 4: { + message.valueType = reader.int32(); + break; + } + case 5: { + message.unit = reader.string(); + break; + } + case 6: { + message.description = reader.string(); + break; + } + case 7: { + message.displayName = reader.string(); + break; + } + case 10: { + message.metadata = $root.google.api.MetricDescriptor.MetricDescriptorMetadata.decode(reader, reader.uint32()); + break; + } + case 12: { + message.launchStage = reader.int32(); + break; + } + case 13: { + if (!(message.monitoredResourceTypes && message.monitoredResourceTypes.length)) + message.monitoredResourceTypes = []; + message.monitoredResourceTypes.push(reader.string()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MetricDescriptor message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.MetricDescriptor + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.MetricDescriptor} MetricDescriptor + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MetricDescriptor.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MetricDescriptor message. + * @function verify + * @memberof google.api.MetricDescriptor + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MetricDescriptor.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!Array.isArray(message.labels)) + return "labels: array expected"; + for (var i = 0; i < message.labels.length; ++i) { + var error = $root.google.api.LabelDescriptor.verify(message.labels[i]); + if (error) + return "labels." + error; + } + } + if (message.metricKind != null && message.hasOwnProperty("metricKind")) + switch (message.metricKind) { + default: + return "metricKind: enum value expected"; + case 0: + case 1: + case 2: + case 3: + break; + } + if (message.valueType != null && message.hasOwnProperty("valueType")) + switch (message.valueType) { + default: + return "valueType: enum value expected"; + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + break; + } + if (message.unit != null && message.hasOwnProperty("unit")) + if (!$util.isString(message.unit)) + return "unit: string expected"; + if (message.description != null && message.hasOwnProperty("description")) + if (!$util.isString(message.description)) + return "description: string expected"; + if (message.displayName != null && message.hasOwnProperty("displayName")) + if (!$util.isString(message.displayName)) + return "displayName: string expected"; + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.google.api.MetricDescriptor.MetricDescriptorMetadata.verify(message.metadata); + if (error) + return "metadata." + error; + } + if (message.launchStage != null && message.hasOwnProperty("launchStage")) + switch (message.launchStage) { + default: + return "launchStage: enum value expected"; + case 0: + case 6: + case 7: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.monitoredResourceTypes != null && message.hasOwnProperty("monitoredResourceTypes")) { + if (!Array.isArray(message.monitoredResourceTypes)) + return "monitoredResourceTypes: array expected"; + for (var i = 0; i < message.monitoredResourceTypes.length; ++i) + if (!$util.isString(message.monitoredResourceTypes[i])) + return "monitoredResourceTypes: string[] expected"; + } + return null; + }; + + /** + * Creates a MetricDescriptor message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.MetricDescriptor + * @static + * @param {Object.} object Plain object + * @returns {google.api.MetricDescriptor} MetricDescriptor + */ + MetricDescriptor.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.MetricDescriptor) + return object; + var message = new $root.google.api.MetricDescriptor(); + if (object.name != null) + message.name = String(object.name); + if (object.type != null) + message.type = String(object.type); + if (object.labels) { + if (!Array.isArray(object.labels)) + throw TypeError(".google.api.MetricDescriptor.labels: array expected"); + message.labels = []; + for (var i = 0; i < object.labels.length; ++i) { + if (typeof object.labels[i] !== "object") + throw TypeError(".google.api.MetricDescriptor.labels: object expected"); + message.labels[i] = $root.google.api.LabelDescriptor.fromObject(object.labels[i]); + } + } + switch (object.metricKind) { + default: + if (typeof object.metricKind === "number") { + message.metricKind = object.metricKind; + break; + } + break; + case "METRIC_KIND_UNSPECIFIED": + case 0: + message.metricKind = 0; + break; + case "GAUGE": + case 1: + message.metricKind = 1; + break; + case "DELTA": + case 2: + message.metricKind = 2; + break; + case "CUMULATIVE": + case 3: + message.metricKind = 3; + break; + } + switch (object.valueType) { + default: + if (typeof object.valueType === "number") { + message.valueType = object.valueType; + break; + } + break; + case "VALUE_TYPE_UNSPECIFIED": + case 0: + message.valueType = 0; + break; + case "BOOL": + case 1: + message.valueType = 1; + break; + case "INT64": + case 2: + message.valueType = 2; + break; + case "DOUBLE": + case 3: + message.valueType = 3; + break; + case "STRING": + case 4: + message.valueType = 4; + break; + case "DISTRIBUTION": + case 5: + message.valueType = 5; + break; + case "MONEY": + case 6: + message.valueType = 6; + break; + } + if (object.unit != null) + message.unit = String(object.unit); + if (object.description != null) + message.description = String(object.description); + if (object.displayName != null) + message.displayName = String(object.displayName); + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".google.api.MetricDescriptor.metadata: object expected"); + message.metadata = $root.google.api.MetricDescriptor.MetricDescriptorMetadata.fromObject(object.metadata); + } + switch (object.launchStage) { + default: + if (typeof object.launchStage === "number") { + message.launchStage = object.launchStage; + break; + } + break; + case "LAUNCH_STAGE_UNSPECIFIED": + case 0: + message.launchStage = 0; + break; + case "UNIMPLEMENTED": + case 6: + message.launchStage = 6; + break; + case "PRELAUNCH": + case 7: + message.launchStage = 7; + break; + case "EARLY_ACCESS": + case 1: + message.launchStage = 1; + break; + case "ALPHA": + case 2: + message.launchStage = 2; + break; + case "BETA": + case 3: + message.launchStage = 3; + break; + case "GA": + case 4: + message.launchStage = 4; + break; + case "DEPRECATED": + case 5: + message.launchStage = 5; + break; + } + if (object.monitoredResourceTypes) { + if (!Array.isArray(object.monitoredResourceTypes)) + throw TypeError(".google.api.MetricDescriptor.monitoredResourceTypes: array expected"); + message.monitoredResourceTypes = []; + for (var i = 0; i < object.monitoredResourceTypes.length; ++i) + message.monitoredResourceTypes[i] = String(object.monitoredResourceTypes[i]); + } + return message; + }; + + /** + * Creates a plain object from a MetricDescriptor message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.MetricDescriptor + * @static + * @param {google.api.MetricDescriptor} message MetricDescriptor + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MetricDescriptor.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) { + object.labels = []; + object.monitoredResourceTypes = []; + } + if (options.defaults) { + object.name = ""; + object.metricKind = options.enums === String ? "METRIC_KIND_UNSPECIFIED" : 0; + object.valueType = options.enums === String ? "VALUE_TYPE_UNSPECIFIED" : 0; + object.unit = ""; + object.description = ""; + object.displayName = ""; + object.type = ""; + object.metadata = null; + object.launchStage = options.enums === String ? "LAUNCH_STAGE_UNSPECIFIED" : 0; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.labels && message.labels.length) { + object.labels = []; + for (var j = 0; j < message.labels.length; ++j) + object.labels[j] = $root.google.api.LabelDescriptor.toObject(message.labels[j], options); + } + if (message.metricKind != null && message.hasOwnProperty("metricKind")) + object.metricKind = options.enums === String ? $root.google.api.MetricDescriptor.MetricKind[message.metricKind] === undefined ? message.metricKind : $root.google.api.MetricDescriptor.MetricKind[message.metricKind] : message.metricKind; + if (message.valueType != null && message.hasOwnProperty("valueType")) + object.valueType = options.enums === String ? $root.google.api.MetricDescriptor.ValueType[message.valueType] === undefined ? message.valueType : $root.google.api.MetricDescriptor.ValueType[message.valueType] : message.valueType; + if (message.unit != null && message.hasOwnProperty("unit")) + object.unit = message.unit; + if (message.description != null && message.hasOwnProperty("description")) + object.description = message.description; + if (message.displayName != null && message.hasOwnProperty("displayName")) + object.displayName = message.displayName; + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.google.api.MetricDescriptor.MetricDescriptorMetadata.toObject(message.metadata, options); + if (message.launchStage != null && message.hasOwnProperty("launchStage")) + object.launchStage = options.enums === String ? $root.google.api.LaunchStage[message.launchStage] === undefined ? message.launchStage : $root.google.api.LaunchStage[message.launchStage] : message.launchStage; + if (message.monitoredResourceTypes && message.monitoredResourceTypes.length) { + object.monitoredResourceTypes = []; + for (var j = 0; j < message.monitoredResourceTypes.length; ++j) + object.monitoredResourceTypes[j] = message.monitoredResourceTypes[j]; + } + return object; + }; + + /** + * Converts this MetricDescriptor to JSON. + * @function toJSON + * @memberof google.api.MetricDescriptor + * @instance + * @returns {Object.} JSON object + */ + MetricDescriptor.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MetricDescriptor + * @function getTypeUrl + * @memberof google.api.MetricDescriptor + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MetricDescriptor.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.MetricDescriptor"; + }; + + /** + * MetricKind enum. + * @name google.api.MetricDescriptor.MetricKind + * @enum {number} + * @property {number} METRIC_KIND_UNSPECIFIED=0 METRIC_KIND_UNSPECIFIED value + * @property {number} GAUGE=1 GAUGE value + * @property {number} DELTA=2 DELTA value + * @property {number} CUMULATIVE=3 CUMULATIVE value + */ + MetricDescriptor.MetricKind = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "METRIC_KIND_UNSPECIFIED"] = 0; + values[valuesById[1] = "GAUGE"] = 1; + values[valuesById[2] = "DELTA"] = 2; + values[valuesById[3] = "CUMULATIVE"] = 3; + return values; + })(); + + /** + * ValueType enum. + * @name google.api.MetricDescriptor.ValueType + * @enum {number} + * @property {number} VALUE_TYPE_UNSPECIFIED=0 VALUE_TYPE_UNSPECIFIED value + * @property {number} BOOL=1 BOOL value + * @property {number} INT64=2 INT64 value + * @property {number} DOUBLE=3 DOUBLE value + * @property {number} STRING=4 STRING value + * @property {number} DISTRIBUTION=5 DISTRIBUTION value + * @property {number} MONEY=6 MONEY value + */ + MetricDescriptor.ValueType = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "VALUE_TYPE_UNSPECIFIED"] = 0; + values[valuesById[1] = "BOOL"] = 1; + values[valuesById[2] = "INT64"] = 2; + values[valuesById[3] = "DOUBLE"] = 3; + values[valuesById[4] = "STRING"] = 4; + values[valuesById[5] = "DISTRIBUTION"] = 5; + values[valuesById[6] = "MONEY"] = 6; + return values; + })(); + + MetricDescriptor.MetricDescriptorMetadata = (function() { + + /** + * Properties of a MetricDescriptorMetadata. + * @memberof google.api.MetricDescriptor + * @interface IMetricDescriptorMetadata + * @property {google.api.LaunchStage|null} [launchStage] MetricDescriptorMetadata launchStage + * @property {google.protobuf.IDuration|null} [samplePeriod] MetricDescriptorMetadata samplePeriod + * @property {google.protobuf.IDuration|null} [ingestDelay] MetricDescriptorMetadata ingestDelay + */ + + /** + * Constructs a new MetricDescriptorMetadata. + * @memberof google.api.MetricDescriptor + * @classdesc Represents a MetricDescriptorMetadata. + * @implements IMetricDescriptorMetadata + * @constructor + * @param {google.api.MetricDescriptor.IMetricDescriptorMetadata=} [properties] Properties to set + */ + function MetricDescriptorMetadata(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * MetricDescriptorMetadata launchStage. + * @member {google.api.LaunchStage} launchStage + * @memberof google.api.MetricDescriptor.MetricDescriptorMetadata + * @instance + */ + MetricDescriptorMetadata.prototype.launchStage = 0; + + /** + * MetricDescriptorMetadata samplePeriod. + * @member {google.protobuf.IDuration|null|undefined} samplePeriod + * @memberof google.api.MetricDescriptor.MetricDescriptorMetadata + * @instance + */ + MetricDescriptorMetadata.prototype.samplePeriod = null; + + /** + * MetricDescriptorMetadata ingestDelay. + * @member {google.protobuf.IDuration|null|undefined} ingestDelay + * @memberof google.api.MetricDescriptor.MetricDescriptorMetadata + * @instance + */ + MetricDescriptorMetadata.prototype.ingestDelay = null; + + /** + * Creates a new MetricDescriptorMetadata instance using the specified properties. + * @function create + * @memberof google.api.MetricDescriptor.MetricDescriptorMetadata + * @static + * @param {google.api.MetricDescriptor.IMetricDescriptorMetadata=} [properties] Properties to set + * @returns {google.api.MetricDescriptor.MetricDescriptorMetadata} MetricDescriptorMetadata instance + */ + MetricDescriptorMetadata.create = function create(properties) { + return new MetricDescriptorMetadata(properties); + }; + + /** + * Encodes the specified MetricDescriptorMetadata message. Does not implicitly {@link google.api.MetricDescriptor.MetricDescriptorMetadata.verify|verify} messages. + * @function encode + * @memberof google.api.MetricDescriptor.MetricDescriptorMetadata + * @static + * @param {google.api.MetricDescriptor.IMetricDescriptorMetadata} message MetricDescriptorMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MetricDescriptorMetadata.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.launchStage != null && Object.hasOwnProperty.call(message, "launchStage")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.launchStage); + if (message.samplePeriod != null && Object.hasOwnProperty.call(message, "samplePeriod")) + $root.google.protobuf.Duration.encode(message.samplePeriod, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.ingestDelay != null && Object.hasOwnProperty.call(message, "ingestDelay")) + $root.google.protobuf.Duration.encode(message.ingestDelay, writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified MetricDescriptorMetadata message, length delimited. Does not implicitly {@link google.api.MetricDescriptor.MetricDescriptorMetadata.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.MetricDescriptor.MetricDescriptorMetadata + * @static + * @param {google.api.MetricDescriptor.IMetricDescriptorMetadata} message MetricDescriptorMetadata message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + MetricDescriptorMetadata.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a MetricDescriptorMetadata message from the specified reader or buffer. + * @function decode + * @memberof google.api.MetricDescriptor.MetricDescriptorMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.MetricDescriptor.MetricDescriptorMetadata} MetricDescriptorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MetricDescriptorMetadata.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.MetricDescriptor.MetricDescriptorMetadata(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.launchStage = reader.int32(); + break; + } + case 2: { + message.samplePeriod = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + case 3: { + message.ingestDelay = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a MetricDescriptorMetadata message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.MetricDescriptor.MetricDescriptorMetadata + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.MetricDescriptor.MetricDescriptorMetadata} MetricDescriptorMetadata + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + MetricDescriptorMetadata.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a MetricDescriptorMetadata message. + * @function verify + * @memberof google.api.MetricDescriptor.MetricDescriptorMetadata + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + MetricDescriptorMetadata.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.launchStage != null && message.hasOwnProperty("launchStage")) + switch (message.launchStage) { + default: + return "launchStage: enum value expected"; + case 0: + case 6: + case 7: + case 1: + case 2: + case 3: + case 4: + case 5: + break; + } + if (message.samplePeriod != null && message.hasOwnProperty("samplePeriod")) { + var error = $root.google.protobuf.Duration.verify(message.samplePeriod); + if (error) + return "samplePeriod." + error; + } + if (message.ingestDelay != null && message.hasOwnProperty("ingestDelay")) { + var error = $root.google.protobuf.Duration.verify(message.ingestDelay); + if (error) + return "ingestDelay." + error; + } + return null; + }; + + /** + * Creates a MetricDescriptorMetadata message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.MetricDescriptor.MetricDescriptorMetadata + * @static + * @param {Object.} object Plain object + * @returns {google.api.MetricDescriptor.MetricDescriptorMetadata} MetricDescriptorMetadata + */ + MetricDescriptorMetadata.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.MetricDescriptor.MetricDescriptorMetadata) + return object; + var message = new $root.google.api.MetricDescriptor.MetricDescriptorMetadata(); + switch (object.launchStage) { + default: + if (typeof object.launchStage === "number") { + message.launchStage = object.launchStage; + break; + } + break; + case "LAUNCH_STAGE_UNSPECIFIED": + case 0: + message.launchStage = 0; + break; + case "UNIMPLEMENTED": + case 6: + message.launchStage = 6; + break; + case "PRELAUNCH": + case 7: + message.launchStage = 7; + break; + case "EARLY_ACCESS": + case 1: + message.launchStage = 1; + break; + case "ALPHA": + case 2: + message.launchStage = 2; + break; + case "BETA": + case 3: + message.launchStage = 3; + break; + case "GA": + case 4: + message.launchStage = 4; + break; + case "DEPRECATED": + case 5: + message.launchStage = 5; + break; + } + if (object.samplePeriod != null) { + if (typeof object.samplePeriod !== "object") + throw TypeError(".google.api.MetricDescriptor.MetricDescriptorMetadata.samplePeriod: object expected"); + message.samplePeriod = $root.google.protobuf.Duration.fromObject(object.samplePeriod); + } + if (object.ingestDelay != null) { + if (typeof object.ingestDelay !== "object") + throw TypeError(".google.api.MetricDescriptor.MetricDescriptorMetadata.ingestDelay: object expected"); + message.ingestDelay = $root.google.protobuf.Duration.fromObject(object.ingestDelay); + } + return message; + }; + + /** + * Creates a plain object from a MetricDescriptorMetadata message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.MetricDescriptor.MetricDescriptorMetadata + * @static + * @param {google.api.MetricDescriptor.MetricDescriptorMetadata} message MetricDescriptorMetadata + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + MetricDescriptorMetadata.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.launchStage = options.enums === String ? "LAUNCH_STAGE_UNSPECIFIED" : 0; + object.samplePeriod = null; + object.ingestDelay = null; + } + if (message.launchStage != null && message.hasOwnProperty("launchStage")) + object.launchStage = options.enums === String ? $root.google.api.LaunchStage[message.launchStage] === undefined ? message.launchStage : $root.google.api.LaunchStage[message.launchStage] : message.launchStage; + if (message.samplePeriod != null && message.hasOwnProperty("samplePeriod")) + object.samplePeriod = $root.google.protobuf.Duration.toObject(message.samplePeriod, options); + if (message.ingestDelay != null && message.hasOwnProperty("ingestDelay")) + object.ingestDelay = $root.google.protobuf.Duration.toObject(message.ingestDelay, options); + return object; + }; + + /** + * Converts this MetricDescriptorMetadata to JSON. + * @function toJSON + * @memberof google.api.MetricDescriptor.MetricDescriptorMetadata + * @instance + * @returns {Object.} JSON object + */ + MetricDescriptorMetadata.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for MetricDescriptorMetadata + * @function getTypeUrl + * @memberof google.api.MetricDescriptor.MetricDescriptorMetadata + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + MetricDescriptorMetadata.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.MetricDescriptor.MetricDescriptorMetadata"; + }; + + return MetricDescriptorMetadata; + })(); + + return MetricDescriptor; + })(); + + api.Metric = (function() { + + /** + * Properties of a Metric. + * @memberof google.api + * @interface IMetric + * @property {string|null} [type] Metric type + * @property {Object.|null} [labels] Metric labels + */ + + /** + * Constructs a new Metric. + * @memberof google.api + * @classdesc Represents a Metric. + * @implements IMetric + * @constructor + * @param {google.api.IMetric=} [properties] Properties to set + */ + function Metric(properties) { + this.labels = {}; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Metric type. + * @member {string} type + * @memberof google.api.Metric + * @instance + */ + Metric.prototype.type = ""; + + /** + * Metric labels. + * @member {Object.} labels + * @memberof google.api.Metric + * @instance + */ + Metric.prototype.labels = $util.emptyObject; + + /** + * Creates a new Metric instance using the specified properties. + * @function create + * @memberof google.api.Metric + * @static + * @param {google.api.IMetric=} [properties] Properties to set + * @returns {google.api.Metric} Metric instance + */ + Metric.create = function create(properties) { + return new Metric(properties); + }; + + /** + * Encodes the specified Metric message. Does not implicitly {@link google.api.Metric.verify|verify} messages. + * @function encode + * @memberof google.api.Metric + * @static + * @param {google.api.IMetric} message Metric message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Metric.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.labels != null && Object.hasOwnProperty.call(message, "labels")) + for (var keys = Object.keys(message.labels), i = 0; i < keys.length; ++i) + writer.uint32(/* id 2, wireType 2 =*/18).fork().uint32(/* id 1, wireType 2 =*/10).string(keys[i]).uint32(/* id 2, wireType 2 =*/18).string(message.labels[keys[i]]).ldelim(); + if (message.type != null && Object.hasOwnProperty.call(message, "type")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.type); + return writer; + }; + + /** + * Encodes the specified Metric message, length delimited. Does not implicitly {@link google.api.Metric.verify|verify} messages. + * @function encodeDelimited + * @memberof google.api.Metric + * @static + * @param {google.api.IMetric} message Metric message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Metric.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Metric message from the specified reader or buffer. + * @function decode + * @memberof google.api.Metric + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.api.Metric} Metric + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Metric.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.api.Metric(), key, value; + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 3: { + message.type = reader.string(); + break; + } + case 2: { + if (message.labels === $util.emptyObject) + message.labels = {}; + var end2 = reader.uint32() + reader.pos; + key = ""; + value = ""; + while (reader.pos < end2) { + var tag2 = reader.uint32(); + switch (tag2 >>> 3) { + case 1: + key = reader.string(); + break; + case 2: + value = reader.string(); + break; + default: + reader.skipType(tag2 & 7); + break; + } + } + message.labels[key] = value; + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Metric message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.api.Metric + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.api.Metric} Metric + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Metric.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Metric message. + * @function verify + * @memberof google.api.Metric + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Metric.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.type != null && message.hasOwnProperty("type")) + if (!$util.isString(message.type)) + return "type: string expected"; + if (message.labels != null && message.hasOwnProperty("labels")) { + if (!$util.isObject(message.labels)) + return "labels: object expected"; + var key = Object.keys(message.labels); + for (var i = 0; i < key.length; ++i) + if (!$util.isString(message.labels[key[i]])) + return "labels: string{k:string} expected"; + } + return null; + }; + + /** + * Creates a Metric message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.api.Metric + * @static + * @param {Object.} object Plain object + * @returns {google.api.Metric} Metric + */ + Metric.fromObject = function fromObject(object) { + if (object instanceof $root.google.api.Metric) + return object; + var message = new $root.google.api.Metric(); + if (object.type != null) + message.type = String(object.type); + if (object.labels) { + if (typeof object.labels !== "object") + throw TypeError(".google.api.Metric.labels: object expected"); + message.labels = {}; + for (var keys = Object.keys(object.labels), i = 0; i < keys.length; ++i) + message.labels[keys[i]] = String(object.labels[keys[i]]); + } + return message; + }; + + /** + * Creates a plain object from a Metric message. Also converts values to other types if specified. + * @function toObject + * @memberof google.api.Metric + * @static + * @param {google.api.Metric} message Metric + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Metric.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.objects || options.defaults) + object.labels = {}; + if (options.defaults) + object.type = ""; + var keys2; + if (message.labels && (keys2 = Object.keys(message.labels)).length) { + object.labels = {}; + for (var j = 0; j < keys2.length; ++j) + object.labels[keys2[j]] = message.labels[keys2[j]]; + } + if (message.type != null && message.hasOwnProperty("type")) + object.type = message.type; + return object; + }; + + /** + * Converts this Metric to JSON. + * @function toJSON + * @memberof google.api.Metric + * @instance + * @returns {Object.} JSON object + */ + Metric.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Metric + * @function getTypeUrl + * @memberof google.api.Metric + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Metric.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.api.Metric"; + }; + + return Metric; + })(); + + return api; + })(); + + google.rpc = (function() { + + /** + * Namespace rpc. + * @memberof google + * @namespace + */ + var rpc = {}; + + rpc.Status = (function() { + + /** + * Properties of a Status. + * @memberof google.rpc + * @interface IStatus + * @property {number|null} [code] Status code + * @property {string|null} [message] Status message + * @property {Array.|null} [details] Status details + */ + + /** + * Constructs a new Status. + * @memberof google.rpc + * @classdesc Represents a Status. + * @implements IStatus + * @constructor + * @param {google.rpc.IStatus=} [properties] Properties to set + */ + function Status(properties) { + this.details = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Status code. + * @member {number} code + * @memberof google.rpc.Status + * @instance + */ + Status.prototype.code = 0; + + /** + * Status message. + * @member {string} message + * @memberof google.rpc.Status + * @instance + */ + Status.prototype.message = ""; + + /** + * Status details. + * @member {Array.} details + * @memberof google.rpc.Status + * @instance + */ + Status.prototype.details = $util.emptyArray; + + /** + * Creates a new Status instance using the specified properties. + * @function create + * @memberof google.rpc.Status + * @static + * @param {google.rpc.IStatus=} [properties] Properties to set + * @returns {google.rpc.Status} Status instance + */ + Status.create = function create(properties) { + return new Status(properties); + }; + + /** + * Encodes the specified Status message. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * @function encode + * @memberof google.rpc.Status + * @static + * @param {google.rpc.IStatus} message Status message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Status.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.code != null && Object.hasOwnProperty.call(message, "code")) + writer.uint32(/* id 1, wireType 0 =*/8).int32(message.code); + if (message.message != null && Object.hasOwnProperty.call(message, "message")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.message); + if (message.details != null && message.details.length) + for (var i = 0; i < message.details.length; ++i) + $root.google.protobuf.Any.encode(message.details[i], writer.uint32(/* id 3, wireType 2 =*/26).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Status message, length delimited. Does not implicitly {@link google.rpc.Status.verify|verify} messages. + * @function encodeDelimited + * @memberof google.rpc.Status + * @static + * @param {google.rpc.IStatus} message Status message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Status.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a Status message from the specified reader or buffer. + * @function decode + * @memberof google.rpc.Status + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.rpc.Status} Status + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Status.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.rpc.Status(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.code = reader.int32(); + break; + } + case 2: { + message.message = reader.string(); + break; + } + case 3: { + if (!(message.details && message.details.length)) + message.details = []; + message.details.push($root.google.protobuf.Any.decode(reader, reader.uint32())); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a Status message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.rpc.Status + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.rpc.Status} Status + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Status.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a Status message. + * @function verify + * @memberof google.rpc.Status + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Status.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.code != null && message.hasOwnProperty("code")) + if (!$util.isInteger(message.code)) + return "code: integer expected"; + if (message.message != null && message.hasOwnProperty("message")) + if (!$util.isString(message.message)) + return "message: string expected"; + if (message.details != null && message.hasOwnProperty("details")) { + if (!Array.isArray(message.details)) + return "details: array expected"; + for (var i = 0; i < message.details.length; ++i) { + var error = $root.google.protobuf.Any.verify(message.details[i]); + if (error) + return "details." + error; + } + } + return null; + }; + + /** + * Creates a Status message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.rpc.Status + * @static + * @param {Object.} object Plain object + * @returns {google.rpc.Status} Status + */ + Status.fromObject = function fromObject(object) { + if (object instanceof $root.google.rpc.Status) + return object; + var message = new $root.google.rpc.Status(); + if (object.code != null) + message.code = object.code | 0; + if (object.message != null) + message.message = String(object.message); + if (object.details) { + if (!Array.isArray(object.details)) + throw TypeError(".google.rpc.Status.details: array expected"); + message.details = []; + for (var i = 0; i < object.details.length; ++i) { + if (typeof object.details[i] !== "object") + throw TypeError(".google.rpc.Status.details: object expected"); + message.details[i] = $root.google.protobuf.Any.fromObject(object.details[i]); + } + } + return message; + }; + + /** + * Creates a plain object from a Status message. Also converts values to other types if specified. + * @function toObject + * @memberof google.rpc.Status + * @static + * @param {google.rpc.Status} message Status + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Status.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.details = []; + if (options.defaults) { + object.code = 0; + object.message = ""; + } + if (message.code != null && message.hasOwnProperty("code")) + object.code = message.code; + if (message.message != null && message.hasOwnProperty("message")) + object.message = message.message; + if (message.details && message.details.length) { + object.details = []; + for (var j = 0; j < message.details.length; ++j) + object.details[j] = $root.google.protobuf.Any.toObject(message.details[j], options); + } + return object; + }; + + /** + * Converts this Status to JSON. + * @function toJSON + * @memberof google.rpc.Status + * @instance + * @returns {Object.} JSON object + */ + Status.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Status + * @function getTypeUrl + * @memberof google.rpc.Status + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Status.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.rpc.Status"; + }; + + return Status; + })(); + + return rpc; + })(); + + google.longrunning = (function() { + + /** + * Namespace longrunning. + * @memberof google + * @namespace + */ + var longrunning = {}; + + longrunning.Operations = (function() { + + /** + * Constructs a new Operations service. + * @memberof google.longrunning + * @classdesc Represents an Operations + * @extends $protobuf.rpc.Service + * @constructor + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ + function Operations(rpcImpl, requestDelimited, responseDelimited) { + $protobuf.rpc.Service.call(this, rpcImpl, requestDelimited, responseDelimited); + } + + (Operations.prototype = Object.create($protobuf.rpc.Service.prototype)).constructor = Operations; + + /** + * Creates new Operations service using the specified rpc implementation. + * @function create + * @memberof google.longrunning.Operations + * @static + * @param {$protobuf.RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {Operations} RPC service. Useful where requests and/or responses are streamed. + */ + Operations.create = function create(rpcImpl, requestDelimited, responseDelimited) { + return new this(rpcImpl, requestDelimited, responseDelimited); + }; + + /** + * Callback as used by {@link google.longrunning.Operations|listOperations}. + * @memberof google.longrunning.Operations + * @typedef ListOperationsCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.ListOperationsResponse} [response] ListOperationsResponse + */ + + /** + * Calls ListOperations. + * @function listOperations + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IListOperationsRequest} request ListOperationsRequest message or plain object + * @param {google.longrunning.Operations.ListOperationsCallback} callback Node-style callback called with the error, if any, and ListOperationsResponse + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.listOperations = function listOperations(request, callback) { + return this.rpcCall(listOperations, $root.google.longrunning.ListOperationsRequest, $root.google.longrunning.ListOperationsResponse, request, callback); + }, "name", { value: "ListOperations" }); + + /** + * Calls ListOperations. + * @function listOperations + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IListOperationsRequest} request ListOperationsRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.longrunning.Operations|getOperation}. + * @memberof google.longrunning.Operations + * @typedef GetOperationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls GetOperation. + * @function getOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IGetOperationRequest} request GetOperationRequest message or plain object + * @param {google.longrunning.Operations.GetOperationCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.getOperation = function getOperation(request, callback) { + return this.rpcCall(getOperation, $root.google.longrunning.GetOperationRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "GetOperation" }); + + /** + * Calls GetOperation. + * @function getOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IGetOperationRequest} request GetOperationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.longrunning.Operations|deleteOperation}. + * @memberof google.longrunning.Operations + * @typedef DeleteOperationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls DeleteOperation. + * @function deleteOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IDeleteOperationRequest} request DeleteOperationRequest message or plain object + * @param {google.longrunning.Operations.DeleteOperationCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.deleteOperation = function deleteOperation(request, callback) { + return this.rpcCall(deleteOperation, $root.google.longrunning.DeleteOperationRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "DeleteOperation" }); + + /** + * Calls DeleteOperation. + * @function deleteOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IDeleteOperationRequest} request DeleteOperationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.longrunning.Operations|cancelOperation}. + * @memberof google.longrunning.Operations + * @typedef CancelOperationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.protobuf.Empty} [response] Empty + */ + + /** + * Calls CancelOperation. + * @function cancelOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.ICancelOperationRequest} request CancelOperationRequest message or plain object + * @param {google.longrunning.Operations.CancelOperationCallback} callback Node-style callback called with the error, if any, and Empty + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.cancelOperation = function cancelOperation(request, callback) { + return this.rpcCall(cancelOperation, $root.google.longrunning.CancelOperationRequest, $root.google.protobuf.Empty, request, callback); + }, "name", { value: "CancelOperation" }); + + /** + * Calls CancelOperation. + * @function cancelOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.ICancelOperationRequest} request CancelOperationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + /** + * Callback as used by {@link google.longrunning.Operations|waitOperation}. + * @memberof google.longrunning.Operations + * @typedef WaitOperationCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {google.longrunning.Operation} [response] Operation + */ + + /** + * Calls WaitOperation. + * @function waitOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IWaitOperationRequest} request WaitOperationRequest message or plain object + * @param {google.longrunning.Operations.WaitOperationCallback} callback Node-style callback called with the error, if any, and Operation + * @returns {undefined} + * @variation 1 + */ + Object.defineProperty(Operations.prototype.waitOperation = function waitOperation(request, callback) { + return this.rpcCall(waitOperation, $root.google.longrunning.WaitOperationRequest, $root.google.longrunning.Operation, request, callback); + }, "name", { value: "WaitOperation" }); + + /** + * Calls WaitOperation. + * @function waitOperation + * @memberof google.longrunning.Operations + * @instance + * @param {google.longrunning.IWaitOperationRequest} request WaitOperationRequest message or plain object + * @returns {Promise} Promise + * @variation 2 + */ + + return Operations; + })(); + + longrunning.Operation = (function() { + + /** + * Properties of an Operation. + * @memberof google.longrunning + * @interface IOperation + * @property {string|null} [name] Operation name + * @property {google.protobuf.IAny|null} [metadata] Operation metadata + * @property {boolean|null} [done] Operation done + * @property {google.rpc.IStatus|null} [error] Operation error + * @property {google.protobuf.IAny|null} [response] Operation response + */ + + /** + * Constructs a new Operation. + * @memberof google.longrunning + * @classdesc Represents an Operation. + * @implements IOperation + * @constructor + * @param {google.longrunning.IOperation=} [properties] Properties to set + */ + function Operation(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * Operation name. + * @member {string} name + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.name = ""; + + /** + * Operation metadata. + * @member {google.protobuf.IAny|null|undefined} metadata + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.metadata = null; + + /** + * Operation done. + * @member {boolean} done + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.done = false; + + /** + * Operation error. + * @member {google.rpc.IStatus|null|undefined} error + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.error = null; + + /** + * Operation response. + * @member {google.protobuf.IAny|null|undefined} response + * @memberof google.longrunning.Operation + * @instance + */ + Operation.prototype.response = null; + + // OneOf field names bound to virtual getters and setters + var $oneOfFields; + + /** + * Operation result. + * @member {"error"|"response"|undefined} result + * @memberof google.longrunning.Operation + * @instance + */ + Object.defineProperty(Operation.prototype, "result", { + get: $util.oneOfGetter($oneOfFields = ["error", "response"]), + set: $util.oneOfSetter($oneOfFields) + }); + + /** + * Creates a new Operation instance using the specified properties. + * @function create + * @memberof google.longrunning.Operation + * @static + * @param {google.longrunning.IOperation=} [properties] Properties to set + * @returns {google.longrunning.Operation} Operation instance + */ + Operation.create = function create(properties) { + return new Operation(properties); + }; + + /** + * Encodes the specified Operation message. Does not implicitly {@link google.longrunning.Operation.verify|verify} messages. + * @function encode + * @memberof google.longrunning.Operation + * @static + * @param {google.longrunning.IOperation} message Operation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Operation.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.metadata != null && Object.hasOwnProperty.call(message, "metadata")) + $root.google.protobuf.Any.encode(message.metadata, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + if (message.done != null && Object.hasOwnProperty.call(message, "done")) + writer.uint32(/* id 3, wireType 0 =*/24).bool(message.done); + if (message.error != null && Object.hasOwnProperty.call(message, "error")) + $root.google.rpc.Status.encode(message.error, writer.uint32(/* id 4, wireType 2 =*/34).fork()).ldelim(); + if (message.response != null && Object.hasOwnProperty.call(message, "response")) + $root.google.protobuf.Any.encode(message.response, writer.uint32(/* id 5, wireType 2 =*/42).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified Operation message, length delimited. Does not implicitly {@link google.longrunning.Operation.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.Operation + * @static + * @param {google.longrunning.IOperation} message Operation message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + Operation.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an Operation message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.Operation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.Operation} Operation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Operation.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.Operation(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.metadata = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + } + case 3: { + message.done = reader.bool(); + break; + } + case 4: { + message.error = $root.google.rpc.Status.decode(reader, reader.uint32()); + break; + } + case 5: { + message.response = $root.google.protobuf.Any.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an Operation message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.Operation + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.Operation} Operation + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + Operation.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an Operation message. + * @function verify + * @memberof google.longrunning.Operation + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + Operation.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + var properties = {}; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.metadata != null && message.hasOwnProperty("metadata")) { + var error = $root.google.protobuf.Any.verify(message.metadata); + if (error) + return "metadata." + error; + } + if (message.done != null && message.hasOwnProperty("done")) + if (typeof message.done !== "boolean") + return "done: boolean expected"; + if (message.error != null && message.hasOwnProperty("error")) { + properties.result = 1; + { + var error = $root.google.rpc.Status.verify(message.error); + if (error) + return "error." + error; + } + } + if (message.response != null && message.hasOwnProperty("response")) { + if (properties.result === 1) + return "result: multiple values"; + properties.result = 1; + { + var error = $root.google.protobuf.Any.verify(message.response); + if (error) + return "response." + error; + } + } + return null; + }; + + /** + * Creates an Operation message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.Operation + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.Operation} Operation + */ + Operation.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.Operation) + return object; + var message = new $root.google.longrunning.Operation(); + if (object.name != null) + message.name = String(object.name); + if (object.metadata != null) { + if (typeof object.metadata !== "object") + throw TypeError(".google.longrunning.Operation.metadata: object expected"); + message.metadata = $root.google.protobuf.Any.fromObject(object.metadata); + } + if (object.done != null) + message.done = Boolean(object.done); + if (object.error != null) { + if (typeof object.error !== "object") + throw TypeError(".google.longrunning.Operation.error: object expected"); + message.error = $root.google.rpc.Status.fromObject(object.error); + } + if (object.response != null) { + if (typeof object.response !== "object") + throw TypeError(".google.longrunning.Operation.response: object expected"); + message.response = $root.google.protobuf.Any.fromObject(object.response); + } + return message; + }; + + /** + * Creates a plain object from an Operation message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.Operation + * @static + * @param {google.longrunning.Operation} message Operation + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + Operation.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.metadata = null; + object.done = false; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.metadata != null && message.hasOwnProperty("metadata")) + object.metadata = $root.google.protobuf.Any.toObject(message.metadata, options); + if (message.done != null && message.hasOwnProperty("done")) + object.done = message.done; + if (message.error != null && message.hasOwnProperty("error")) { + object.error = $root.google.rpc.Status.toObject(message.error, options); + if (options.oneofs) + object.result = "error"; + } + if (message.response != null && message.hasOwnProperty("response")) { + object.response = $root.google.protobuf.Any.toObject(message.response, options); + if (options.oneofs) + object.result = "response"; + } + return object; + }; + + /** + * Converts this Operation to JSON. + * @function toJSON + * @memberof google.longrunning.Operation + * @instance + * @returns {Object.} JSON object + */ + Operation.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for Operation + * @function getTypeUrl + * @memberof google.longrunning.Operation + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + Operation.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.Operation"; + }; + + return Operation; + })(); + + longrunning.GetOperationRequest = (function() { + + /** + * Properties of a GetOperationRequest. + * @memberof google.longrunning + * @interface IGetOperationRequest + * @property {string|null} [name] GetOperationRequest name + */ + + /** + * Constructs a new GetOperationRequest. + * @memberof google.longrunning + * @classdesc Represents a GetOperationRequest. + * @implements IGetOperationRequest + * @constructor + * @param {google.longrunning.IGetOperationRequest=} [properties] Properties to set + */ + function GetOperationRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * GetOperationRequest name. + * @member {string} name + * @memberof google.longrunning.GetOperationRequest + * @instance + */ + GetOperationRequest.prototype.name = ""; + + /** + * Creates a new GetOperationRequest instance using the specified properties. + * @function create + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {google.longrunning.IGetOperationRequest=} [properties] Properties to set + * @returns {google.longrunning.GetOperationRequest} GetOperationRequest instance + */ + GetOperationRequest.create = function create(properties) { + return new GetOperationRequest(properties); + }; + + /** + * Encodes the specified GetOperationRequest message. Does not implicitly {@link google.longrunning.GetOperationRequest.verify|verify} messages. + * @function encode + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {google.longrunning.IGetOperationRequest} message GetOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetOperationRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified GetOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.GetOperationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {google.longrunning.IGetOperationRequest} message GetOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + GetOperationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a GetOperationRequest message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.GetOperationRequest} GetOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetOperationRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.GetOperationRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a GetOperationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.GetOperationRequest} GetOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + GetOperationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a GetOperationRequest message. + * @function verify + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + GetOperationRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a GetOperationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.GetOperationRequest} GetOperationRequest + */ + GetOperationRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.GetOperationRequest) + return object; + var message = new $root.google.longrunning.GetOperationRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a GetOperationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {google.longrunning.GetOperationRequest} message GetOperationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + GetOperationRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this GetOperationRequest to JSON. + * @function toJSON + * @memberof google.longrunning.GetOperationRequest + * @instance + * @returns {Object.} JSON object + */ + GetOperationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for GetOperationRequest + * @function getTypeUrl + * @memberof google.longrunning.GetOperationRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + GetOperationRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.GetOperationRequest"; + }; + + return GetOperationRequest; + })(); + + longrunning.ListOperationsRequest = (function() { + + /** + * Properties of a ListOperationsRequest. + * @memberof google.longrunning + * @interface IListOperationsRequest + * @property {string|null} [name] ListOperationsRequest name + * @property {string|null} [filter] ListOperationsRequest filter + * @property {number|null} [pageSize] ListOperationsRequest pageSize + * @property {string|null} [pageToken] ListOperationsRequest pageToken + */ + + /** + * Constructs a new ListOperationsRequest. + * @memberof google.longrunning + * @classdesc Represents a ListOperationsRequest. + * @implements IListOperationsRequest + * @constructor + * @param {google.longrunning.IListOperationsRequest=} [properties] Properties to set + */ + function ListOperationsRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListOperationsRequest name. + * @member {string} name + * @memberof google.longrunning.ListOperationsRequest + * @instance + */ + ListOperationsRequest.prototype.name = ""; + + /** + * ListOperationsRequest filter. + * @member {string} filter + * @memberof google.longrunning.ListOperationsRequest + * @instance + */ + ListOperationsRequest.prototype.filter = ""; + + /** + * ListOperationsRequest pageSize. + * @member {number} pageSize + * @memberof google.longrunning.ListOperationsRequest + * @instance + */ + ListOperationsRequest.prototype.pageSize = 0; + + /** + * ListOperationsRequest pageToken. + * @member {string} pageToken + * @memberof google.longrunning.ListOperationsRequest + * @instance + */ + ListOperationsRequest.prototype.pageToken = ""; + + /** + * Creates a new ListOperationsRequest instance using the specified properties. + * @function create + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {google.longrunning.IListOperationsRequest=} [properties] Properties to set + * @returns {google.longrunning.ListOperationsRequest} ListOperationsRequest instance + */ + ListOperationsRequest.create = function create(properties) { + return new ListOperationsRequest(properties); + }; + + /** + * Encodes the specified ListOperationsRequest message. Does not implicitly {@link google.longrunning.ListOperationsRequest.verify|verify} messages. + * @function encode + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {google.longrunning.IListOperationsRequest} message ListOperationsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListOperationsRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.filter != null && Object.hasOwnProperty.call(message, "filter")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.filter); + if (message.pageSize != null && Object.hasOwnProperty.call(message, "pageSize")) + writer.uint32(/* id 2, wireType 0 =*/16).int32(message.pageSize); + if (message.pageToken != null && Object.hasOwnProperty.call(message, "pageToken")) + writer.uint32(/* id 3, wireType 2 =*/26).string(message.pageToken); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 4, wireType 2 =*/34).string(message.name); + return writer; + }; + + /** + * Encodes the specified ListOperationsRequest message, length delimited. Does not implicitly {@link google.longrunning.ListOperationsRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {google.longrunning.IListOperationsRequest} message ListOperationsRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListOperationsRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListOperationsRequest message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.ListOperationsRequest} ListOperationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListOperationsRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.ListOperationsRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 4: { + message.name = reader.string(); + break; + } + case 1: { + message.filter = reader.string(); + break; + } + case 2: { + message.pageSize = reader.int32(); + break; + } + case 3: { + message.pageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListOperationsRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.ListOperationsRequest} ListOperationsRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListOperationsRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListOperationsRequest message. + * @function verify + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListOperationsRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.filter != null && message.hasOwnProperty("filter")) + if (!$util.isString(message.filter)) + return "filter: string expected"; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + if (!$util.isInteger(message.pageSize)) + return "pageSize: integer expected"; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + if (!$util.isString(message.pageToken)) + return "pageToken: string expected"; + return null; + }; + + /** + * Creates a ListOperationsRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.ListOperationsRequest} ListOperationsRequest + */ + ListOperationsRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.ListOperationsRequest) + return object; + var message = new $root.google.longrunning.ListOperationsRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.filter != null) + message.filter = String(object.filter); + if (object.pageSize != null) + message.pageSize = object.pageSize | 0; + if (object.pageToken != null) + message.pageToken = String(object.pageToken); + return message; + }; + + /** + * Creates a plain object from a ListOperationsRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {google.longrunning.ListOperationsRequest} message ListOperationsRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListOperationsRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.filter = ""; + object.pageSize = 0; + object.pageToken = ""; + object.name = ""; + } + if (message.filter != null && message.hasOwnProperty("filter")) + object.filter = message.filter; + if (message.pageSize != null && message.hasOwnProperty("pageSize")) + object.pageSize = message.pageSize; + if (message.pageToken != null && message.hasOwnProperty("pageToken")) + object.pageToken = message.pageToken; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this ListOperationsRequest to JSON. + * @function toJSON + * @memberof google.longrunning.ListOperationsRequest + * @instance + * @returns {Object.} JSON object + */ + ListOperationsRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListOperationsRequest + * @function getTypeUrl + * @memberof google.longrunning.ListOperationsRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListOperationsRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.ListOperationsRequest"; + }; + + return ListOperationsRequest; + })(); + + longrunning.ListOperationsResponse = (function() { + + /** + * Properties of a ListOperationsResponse. + * @memberof google.longrunning + * @interface IListOperationsResponse + * @property {Array.|null} [operations] ListOperationsResponse operations + * @property {string|null} [nextPageToken] ListOperationsResponse nextPageToken + */ + + /** + * Constructs a new ListOperationsResponse. + * @memberof google.longrunning + * @classdesc Represents a ListOperationsResponse. + * @implements IListOperationsResponse + * @constructor + * @param {google.longrunning.IListOperationsResponse=} [properties] Properties to set + */ + function ListOperationsResponse(properties) { + this.operations = []; + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * ListOperationsResponse operations. + * @member {Array.} operations + * @memberof google.longrunning.ListOperationsResponse + * @instance + */ + ListOperationsResponse.prototype.operations = $util.emptyArray; + + /** + * ListOperationsResponse nextPageToken. + * @member {string} nextPageToken + * @memberof google.longrunning.ListOperationsResponse + * @instance + */ + ListOperationsResponse.prototype.nextPageToken = ""; + + /** + * Creates a new ListOperationsResponse instance using the specified properties. + * @function create + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {google.longrunning.IListOperationsResponse=} [properties] Properties to set + * @returns {google.longrunning.ListOperationsResponse} ListOperationsResponse instance + */ + ListOperationsResponse.create = function create(properties) { + return new ListOperationsResponse(properties); + }; + + /** + * Encodes the specified ListOperationsResponse message. Does not implicitly {@link google.longrunning.ListOperationsResponse.verify|verify} messages. + * @function encode + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {google.longrunning.IListOperationsResponse} message ListOperationsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListOperationsResponse.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.operations != null && message.operations.length) + for (var i = 0; i < message.operations.length; ++i) + $root.google.longrunning.Operation.encode(message.operations[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim(); + if (message.nextPageToken != null && Object.hasOwnProperty.call(message, "nextPageToken")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.nextPageToken); + return writer; + }; + + /** + * Encodes the specified ListOperationsResponse message, length delimited. Does not implicitly {@link google.longrunning.ListOperationsResponse.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {google.longrunning.IListOperationsResponse} message ListOperationsResponse message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + ListOperationsResponse.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a ListOperationsResponse message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.ListOperationsResponse} ListOperationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListOperationsResponse.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.ListOperationsResponse(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + if (!(message.operations && message.operations.length)) + message.operations = []; + message.operations.push($root.google.longrunning.Operation.decode(reader, reader.uint32())); + break; + } + case 2: { + message.nextPageToken = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a ListOperationsResponse message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.ListOperationsResponse} ListOperationsResponse + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + ListOperationsResponse.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a ListOperationsResponse message. + * @function verify + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + ListOperationsResponse.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.operations != null && message.hasOwnProperty("operations")) { + if (!Array.isArray(message.operations)) + return "operations: array expected"; + for (var i = 0; i < message.operations.length; ++i) { + var error = $root.google.longrunning.Operation.verify(message.operations[i]); + if (error) + return "operations." + error; + } + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + if (!$util.isString(message.nextPageToken)) + return "nextPageToken: string expected"; + return null; + }; + + /** + * Creates a ListOperationsResponse message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.ListOperationsResponse} ListOperationsResponse + */ + ListOperationsResponse.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.ListOperationsResponse) + return object; + var message = new $root.google.longrunning.ListOperationsResponse(); + if (object.operations) { + if (!Array.isArray(object.operations)) + throw TypeError(".google.longrunning.ListOperationsResponse.operations: array expected"); + message.operations = []; + for (var i = 0; i < object.operations.length; ++i) { + if (typeof object.operations[i] !== "object") + throw TypeError(".google.longrunning.ListOperationsResponse.operations: object expected"); + message.operations[i] = $root.google.longrunning.Operation.fromObject(object.operations[i]); + } + } + if (object.nextPageToken != null) + message.nextPageToken = String(object.nextPageToken); + return message; + }; + + /** + * Creates a plain object from a ListOperationsResponse message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {google.longrunning.ListOperationsResponse} message ListOperationsResponse + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + ListOperationsResponse.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.arrays || options.defaults) + object.operations = []; + if (options.defaults) + object.nextPageToken = ""; + if (message.operations && message.operations.length) { + object.operations = []; + for (var j = 0; j < message.operations.length; ++j) + object.operations[j] = $root.google.longrunning.Operation.toObject(message.operations[j], options); + } + if (message.nextPageToken != null && message.hasOwnProperty("nextPageToken")) + object.nextPageToken = message.nextPageToken; + return object; + }; + + /** + * Converts this ListOperationsResponse to JSON. + * @function toJSON + * @memberof google.longrunning.ListOperationsResponse + * @instance + * @returns {Object.} JSON object + */ + ListOperationsResponse.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for ListOperationsResponse + * @function getTypeUrl + * @memberof google.longrunning.ListOperationsResponse + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + ListOperationsResponse.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.ListOperationsResponse"; + }; + + return ListOperationsResponse; + })(); + + longrunning.CancelOperationRequest = (function() { + + /** + * Properties of a CancelOperationRequest. + * @memberof google.longrunning + * @interface ICancelOperationRequest + * @property {string|null} [name] CancelOperationRequest name + */ + + /** + * Constructs a new CancelOperationRequest. + * @memberof google.longrunning + * @classdesc Represents a CancelOperationRequest. + * @implements ICancelOperationRequest + * @constructor + * @param {google.longrunning.ICancelOperationRequest=} [properties] Properties to set + */ + function CancelOperationRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * CancelOperationRequest name. + * @member {string} name + * @memberof google.longrunning.CancelOperationRequest + * @instance + */ + CancelOperationRequest.prototype.name = ""; + + /** + * Creates a new CancelOperationRequest instance using the specified properties. + * @function create + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {google.longrunning.ICancelOperationRequest=} [properties] Properties to set + * @returns {google.longrunning.CancelOperationRequest} CancelOperationRequest instance + */ + CancelOperationRequest.create = function create(properties) { + return new CancelOperationRequest(properties); + }; + + /** + * Encodes the specified CancelOperationRequest message. Does not implicitly {@link google.longrunning.CancelOperationRequest.verify|verify} messages. + * @function encode + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {google.longrunning.ICancelOperationRequest} message CancelOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CancelOperationRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified CancelOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.CancelOperationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {google.longrunning.ICancelOperationRequest} message CancelOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + CancelOperationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a CancelOperationRequest message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.CancelOperationRequest} CancelOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CancelOperationRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.CancelOperationRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a CancelOperationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.CancelOperationRequest} CancelOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + CancelOperationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a CancelOperationRequest message. + * @function verify + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + CancelOperationRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a CancelOperationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.CancelOperationRequest} CancelOperationRequest + */ + CancelOperationRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.CancelOperationRequest) + return object; + var message = new $root.google.longrunning.CancelOperationRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a CancelOperationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {google.longrunning.CancelOperationRequest} message CancelOperationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + CancelOperationRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this CancelOperationRequest to JSON. + * @function toJSON + * @memberof google.longrunning.CancelOperationRequest + * @instance + * @returns {Object.} JSON object + */ + CancelOperationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for CancelOperationRequest + * @function getTypeUrl + * @memberof google.longrunning.CancelOperationRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + CancelOperationRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.CancelOperationRequest"; + }; + + return CancelOperationRequest; + })(); + + longrunning.DeleteOperationRequest = (function() { + + /** + * Properties of a DeleteOperationRequest. + * @memberof google.longrunning + * @interface IDeleteOperationRequest + * @property {string|null} [name] DeleteOperationRequest name + */ + + /** + * Constructs a new DeleteOperationRequest. + * @memberof google.longrunning + * @classdesc Represents a DeleteOperationRequest. + * @implements IDeleteOperationRequest + * @constructor + * @param {google.longrunning.IDeleteOperationRequest=} [properties] Properties to set + */ + function DeleteOperationRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * DeleteOperationRequest name. + * @member {string} name + * @memberof google.longrunning.DeleteOperationRequest + * @instance + */ + DeleteOperationRequest.prototype.name = ""; + + /** + * Creates a new DeleteOperationRequest instance using the specified properties. + * @function create + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {google.longrunning.IDeleteOperationRequest=} [properties] Properties to set + * @returns {google.longrunning.DeleteOperationRequest} DeleteOperationRequest instance + */ + DeleteOperationRequest.create = function create(properties) { + return new DeleteOperationRequest(properties); + }; + + /** + * Encodes the specified DeleteOperationRequest message. Does not implicitly {@link google.longrunning.DeleteOperationRequest.verify|verify} messages. + * @function encode + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {google.longrunning.IDeleteOperationRequest} message DeleteOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteOperationRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + return writer; + }; + + /** + * Encodes the specified DeleteOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.DeleteOperationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {google.longrunning.IDeleteOperationRequest} message DeleteOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + DeleteOperationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a DeleteOperationRequest message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.DeleteOperationRequest} DeleteOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteOperationRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.DeleteOperationRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a DeleteOperationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.DeleteOperationRequest} DeleteOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + DeleteOperationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a DeleteOperationRequest message. + * @function verify + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + DeleteOperationRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + return null; + }; + + /** + * Creates a DeleteOperationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.DeleteOperationRequest} DeleteOperationRequest + */ + DeleteOperationRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.DeleteOperationRequest) + return object; + var message = new $root.google.longrunning.DeleteOperationRequest(); + if (object.name != null) + message.name = String(object.name); + return message; + }; + + /** + * Creates a plain object from a DeleteOperationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {google.longrunning.DeleteOperationRequest} message DeleteOperationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + DeleteOperationRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) + object.name = ""; + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + return object; + }; + + /** + * Converts this DeleteOperationRequest to JSON. + * @function toJSON + * @memberof google.longrunning.DeleteOperationRequest + * @instance + * @returns {Object.} JSON object + */ + DeleteOperationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for DeleteOperationRequest + * @function getTypeUrl + * @memberof google.longrunning.DeleteOperationRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + DeleteOperationRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.DeleteOperationRequest"; + }; + + return DeleteOperationRequest; + })(); + + longrunning.WaitOperationRequest = (function() { + + /** + * Properties of a WaitOperationRequest. + * @memberof google.longrunning + * @interface IWaitOperationRequest + * @property {string|null} [name] WaitOperationRequest name + * @property {google.protobuf.IDuration|null} [timeout] WaitOperationRequest timeout + */ + + /** + * Constructs a new WaitOperationRequest. + * @memberof google.longrunning + * @classdesc Represents a WaitOperationRequest. + * @implements IWaitOperationRequest + * @constructor + * @param {google.longrunning.IWaitOperationRequest=} [properties] Properties to set + */ + function WaitOperationRequest(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * WaitOperationRequest name. + * @member {string} name + * @memberof google.longrunning.WaitOperationRequest + * @instance + */ + WaitOperationRequest.prototype.name = ""; + + /** + * WaitOperationRequest timeout. + * @member {google.protobuf.IDuration|null|undefined} timeout + * @memberof google.longrunning.WaitOperationRequest + * @instance + */ + WaitOperationRequest.prototype.timeout = null; + + /** + * Creates a new WaitOperationRequest instance using the specified properties. + * @function create + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {google.longrunning.IWaitOperationRequest=} [properties] Properties to set + * @returns {google.longrunning.WaitOperationRequest} WaitOperationRequest instance + */ + WaitOperationRequest.create = function create(properties) { + return new WaitOperationRequest(properties); + }; + + /** + * Encodes the specified WaitOperationRequest message. Does not implicitly {@link google.longrunning.WaitOperationRequest.verify|verify} messages. + * @function encode + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {google.longrunning.IWaitOperationRequest} message WaitOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WaitOperationRequest.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.name != null && Object.hasOwnProperty.call(message, "name")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.name); + if (message.timeout != null && Object.hasOwnProperty.call(message, "timeout")) + $root.google.protobuf.Duration.encode(message.timeout, writer.uint32(/* id 2, wireType 2 =*/18).fork()).ldelim(); + return writer; + }; + + /** + * Encodes the specified WaitOperationRequest message, length delimited. Does not implicitly {@link google.longrunning.WaitOperationRequest.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {google.longrunning.IWaitOperationRequest} message WaitOperationRequest message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + WaitOperationRequest.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes a WaitOperationRequest message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.WaitOperationRequest} WaitOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WaitOperationRequest.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.WaitOperationRequest(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.name = reader.string(); + break; + } + case 2: { + message.timeout = $root.google.protobuf.Duration.decode(reader, reader.uint32()); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes a WaitOperationRequest message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.WaitOperationRequest} WaitOperationRequest + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + WaitOperationRequest.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies a WaitOperationRequest message. + * @function verify + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + WaitOperationRequest.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.name != null && message.hasOwnProperty("name")) + if (!$util.isString(message.name)) + return "name: string expected"; + if (message.timeout != null && message.hasOwnProperty("timeout")) { + var error = $root.google.protobuf.Duration.verify(message.timeout); + if (error) + return "timeout." + error; + } + return null; + }; + + /** + * Creates a WaitOperationRequest message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.WaitOperationRequest} WaitOperationRequest + */ + WaitOperationRequest.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.WaitOperationRequest) + return object; + var message = new $root.google.longrunning.WaitOperationRequest(); + if (object.name != null) + message.name = String(object.name); + if (object.timeout != null) { + if (typeof object.timeout !== "object") + throw TypeError(".google.longrunning.WaitOperationRequest.timeout: object expected"); + message.timeout = $root.google.protobuf.Duration.fromObject(object.timeout); + } + return message; + }; + + /** + * Creates a plain object from a WaitOperationRequest message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {google.longrunning.WaitOperationRequest} message WaitOperationRequest + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + WaitOperationRequest.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.name = ""; + object.timeout = null; + } + if (message.name != null && message.hasOwnProperty("name")) + object.name = message.name; + if (message.timeout != null && message.hasOwnProperty("timeout")) + object.timeout = $root.google.protobuf.Duration.toObject(message.timeout, options); + return object; + }; + + /** + * Converts this WaitOperationRequest to JSON. + * @function toJSON + * @memberof google.longrunning.WaitOperationRequest + * @instance + * @returns {Object.} JSON object + */ + WaitOperationRequest.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for WaitOperationRequest + * @function getTypeUrl + * @memberof google.longrunning.WaitOperationRequest + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + WaitOperationRequest.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.WaitOperationRequest"; + }; + + return WaitOperationRequest; + })(); + + longrunning.OperationInfo = (function() { + + /** + * Properties of an OperationInfo. + * @memberof google.longrunning + * @interface IOperationInfo + * @property {string|null} [responseType] OperationInfo responseType + * @property {string|null} [metadataType] OperationInfo metadataType + */ + + /** + * Constructs a new OperationInfo. + * @memberof google.longrunning + * @classdesc Represents an OperationInfo. + * @implements IOperationInfo + * @constructor + * @param {google.longrunning.IOperationInfo=} [properties] Properties to set + */ + function OperationInfo(properties) { + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + if (properties[keys[i]] != null) + this[keys[i]] = properties[keys[i]]; + } + + /** + * OperationInfo responseType. + * @member {string} responseType + * @memberof google.longrunning.OperationInfo + * @instance + */ + OperationInfo.prototype.responseType = ""; + + /** + * OperationInfo metadataType. + * @member {string} metadataType + * @memberof google.longrunning.OperationInfo + * @instance + */ + OperationInfo.prototype.metadataType = ""; + + /** + * Creates a new OperationInfo instance using the specified properties. + * @function create + * @memberof google.longrunning.OperationInfo + * @static + * @param {google.longrunning.IOperationInfo=} [properties] Properties to set + * @returns {google.longrunning.OperationInfo} OperationInfo instance + */ + OperationInfo.create = function create(properties) { + return new OperationInfo(properties); + }; + + /** + * Encodes the specified OperationInfo message. Does not implicitly {@link google.longrunning.OperationInfo.verify|verify} messages. + * @function encode + * @memberof google.longrunning.OperationInfo + * @static + * @param {google.longrunning.IOperationInfo} message OperationInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationInfo.encode = function encode(message, writer) { + if (!writer) + writer = $Writer.create(); + if (message.responseType != null && Object.hasOwnProperty.call(message, "responseType")) + writer.uint32(/* id 1, wireType 2 =*/10).string(message.responseType); + if (message.metadataType != null && Object.hasOwnProperty.call(message, "metadataType")) + writer.uint32(/* id 2, wireType 2 =*/18).string(message.metadataType); + return writer; + }; + + /** + * Encodes the specified OperationInfo message, length delimited. Does not implicitly {@link google.longrunning.OperationInfo.verify|verify} messages. + * @function encodeDelimited + * @memberof google.longrunning.OperationInfo + * @static + * @param {google.longrunning.IOperationInfo} message OperationInfo message or plain object to encode + * @param {$protobuf.Writer} [writer] Writer to encode to + * @returns {$protobuf.Writer} Writer + */ + OperationInfo.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer).ldelim(); + }; + + /** + * Decodes an OperationInfo message from the specified reader or buffer. + * @function decode + * @memberof google.longrunning.OperationInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Message length if known beforehand + * @returns {google.longrunning.OperationInfo} OperationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationInfo.decode = function decode(reader, length, error) { + if (!(reader instanceof $Reader)) + reader = $Reader.create(reader); + var end = length === undefined ? reader.len : reader.pos + length, message = new $root.google.longrunning.OperationInfo(); + while (reader.pos < end) { + var tag = reader.uint32(); + if (tag === error) + break; + switch (tag >>> 3) { + case 1: { + message.responseType = reader.string(); + break; + } + case 2: { + message.metadataType = reader.string(); + break; + } + default: + reader.skipType(tag & 7); + break; + } + } + return message; + }; + + /** + * Decodes an OperationInfo message from the specified reader or buffer, length delimited. + * @function decodeDelimited + * @memberof google.longrunning.OperationInfo + * @static + * @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {google.longrunning.OperationInfo} OperationInfo + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {$protobuf.util.ProtocolError} If required fields are missing + */ + OperationInfo.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof $Reader)) + reader = new $Reader(reader); + return this.decode(reader, reader.uint32()); + }; + + /** + * Verifies an OperationInfo message. + * @function verify + * @memberof google.longrunning.OperationInfo + * @static + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ + OperationInfo.verify = function verify(message) { + if (typeof message !== "object" || message === null) + return "object expected"; + if (message.responseType != null && message.hasOwnProperty("responseType")) + if (!$util.isString(message.responseType)) + return "responseType: string expected"; + if (message.metadataType != null && message.hasOwnProperty("metadataType")) + if (!$util.isString(message.metadataType)) + return "metadataType: string expected"; + return null; + }; + + /** + * Creates an OperationInfo message from a plain object. Also converts values to their respective internal types. + * @function fromObject + * @memberof google.longrunning.OperationInfo + * @static + * @param {Object.} object Plain object + * @returns {google.longrunning.OperationInfo} OperationInfo + */ + OperationInfo.fromObject = function fromObject(object) { + if (object instanceof $root.google.longrunning.OperationInfo) + return object; + var message = new $root.google.longrunning.OperationInfo(); + if (object.responseType != null) + message.responseType = String(object.responseType); + if (object.metadataType != null) + message.metadataType = String(object.metadataType); + return message; + }; + + /** + * Creates a plain object from an OperationInfo message. Also converts values to other types if specified. + * @function toObject + * @memberof google.longrunning.OperationInfo + * @static + * @param {google.longrunning.OperationInfo} message OperationInfo + * @param {$protobuf.IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ + OperationInfo.toObject = function toObject(message, options) { + if (!options) + options = {}; + var object = {}; + if (options.defaults) { + object.responseType = ""; + object.metadataType = ""; + } + if (message.responseType != null && message.hasOwnProperty("responseType")) + object.responseType = message.responseType; + if (message.metadataType != null && message.hasOwnProperty("metadataType")) + object.metadataType = message.metadataType; + return object; + }; + + /** + * Converts this OperationInfo to JSON. + * @function toJSON + * @memberof google.longrunning.OperationInfo + * @instance + * @returns {Object.} JSON object + */ + OperationInfo.prototype.toJSON = function toJSON() { + return this.constructor.toObject(this, $protobuf.util.toJSONOptions); + }; + + /** + * Gets the default type url for OperationInfo + * @function getTypeUrl + * @memberof google.longrunning.OperationInfo + * @static + * @param {string} [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com") + * @returns {string} The default type url + */ + OperationInfo.getTypeUrl = function getTypeUrl(typeUrlPrefix) { + if (typeUrlPrefix === undefined) { + typeUrlPrefix = "type.googleapis.com"; + } + return typeUrlPrefix + "/google.longrunning.OperationInfo"; + }; + + return OperationInfo; + })(); + + return longrunning; + })(); + + return google; + })(); + + return $root; +}); + + +/***/ }), + +/***/ 49679: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/*! + * Copyright 2015 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Entry = exports.TRACE_SAMPLED_KEY = exports.TRACE_KEY = exports.SPAN_ID_KEY = exports.SOURCE_LOCATION_KEY = exports.OPERATION_KEY = exports.LABELS_KEY = exports.INSERT_ID_KEY = void 0; +// eslint-disable-next-line @typescript-eslint/no-var-requires +const EventId = __nccwpck_require__(19367); +const extend = __nccwpck_require__(23860); +const common_1 = __nccwpck_require__(39240); +const http_request_1 = __nccwpck_require__(53293); +const context_1 = __nccwpck_require__(30734); +const eventId = new EventId(); +exports.INSERT_ID_KEY = 'logging.googleapis.com/insertId'; +exports.LABELS_KEY = 'logging.googleapis.com/labels'; +exports.OPERATION_KEY = 'logging.googleapis.com/operation'; +exports.SOURCE_LOCATION_KEY = 'logging.googleapis.com/sourceLocation'; +exports.SPAN_ID_KEY = 'logging.googleapis.com/spanId'; +exports.TRACE_KEY = 'logging.googleapis.com/trace'; +exports.TRACE_SAMPLED_KEY = 'logging.googleapis.com/trace_sampled'; +/** + * Create an entry object to define new data to insert into a meta. + * + * Note, {@link https://cloud.google.com/logging/quotas|Cloud Logging Quotas and limits} + * dictates that the maximum log entry size, including all + * {@link https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry|LogEntry Resource properties}, + * cannot exceed approximately 256 KB. + * + * See {@link https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry|LogEntry JSON representation} + * + * @class + * + * @param {?object} [metadata] See a + * [LogEntry + * Resource](https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry). + * @param {object|string} data The data to use as the value for this log + * entry. + * + * If providing an object, these value types are supported: + * - `String` + * - `Number` + * - `Boolean` + * - `Buffer` + * - `Object` + * - `Array` + * + * Any other types are stringified with `String(value)`. + * + * @example + * ``` + * const {Logging} = require('@google-cloud/logging'); + * const logging = new Logging(); + * const syslog = logging.log('syslog'); + * + * const metadata = { + * resource: { + * type: 'gce_instance', + * labels: { + * zone: 'global', + * instance_id: '3' + * } + * } + * }; + * + * const entry = syslog.entry(metadata, { + * delegate: 'my_username' + * }); + * + * syslog.alert(entry, (err, apiResponse) => { + * if (!err) { + * // Log entry inserted successfully. + * } + * }); + * + * //- + * // You will also receive `Entry` objects when using + * // Logging#getEntries() and Log#getEntries(). + * //- + * logging.getEntries((err, entries) => { + * if (!err) { + * // entries[0].data = The data value from the log entry. + * } + * }); + * ``` + */ +class Entry { + constructor(metadata, data) { + /** + * @name Entry#metadata + * @type {object} + * @property {Date} timestamp + * @property {number} insertId + */ + this.metadata = extend({ + timestamp: new Date(), + }, metadata); + // JavaScript date has a very coarse granularity (millisecond), which makes + // it quite likely that multiple log entries would have the same timestamp. + // The Logging API doesn't guarantee to preserve insertion order for entries + // with the same timestamp. The service does use `insertId` as a secondary + // ordering for entries with the same timestamp. `insertId` needs to be + // globally unique (within the project) however. + // + // We use a globally unique monotonically increasing EventId as the + // insertId. + this.metadata.insertId = this.metadata.insertId || eventId.new(); + /** + * @name Entry#data + * @type {object} + */ + this.data = data; + } + /** + * Serialize an entry to the format the API expects. Read more: + * https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry + * + * @param {object} [options] Configuration object. + * @param {boolean} [options.removeCircular] Replace circular references in an + * object with a string value, `[Circular]`. + * @param {string} [projectId] GCP Project ID. + */ + toJSON(options = {}, projectId = '') { + const entry = extend(true, {}, this.metadata); + // Format log message + if (this.isObject(this.data)) { + entry.jsonPayload = (0, common_1.objToStruct)(this.data, { + removeCircular: !!options.removeCircular, + stringify: true, + }); + } + else if (typeof this.data === 'string') { + entry.textPayload = this.data; + } + // Format log timestamp + if (entry.timestamp instanceof Date) { + entry.timestamp = (0, common_1.toNanosAndSecondsObj)(entry.timestamp); + } + else if (typeof entry.timestamp === 'string') { + entry.timestamp = (0, common_1.zuluToDateObj)(entry.timestamp); + } + // Format httpRequest + const req = this.metadata.httpRequest; + if ((0, http_request_1.isRawHttpRequest)(req)) { + entry.httpRequest = (0, http_request_1.makeHttpRequestData)(req); + } + // Format trace and span + const traceContext = this.extractTraceContext(projectId); + if (traceContext) { + if (!this.metadata.trace && traceContext.trace) + entry.trace = traceContext.trace; + if (!this.metadata.spanId && traceContext.spanId) + entry.spanId = traceContext.spanId; + if (this.metadata.traceSampled === undefined) + entry.traceSampled = traceContext.traceSampled; + } + return entry; + } + /** + * Serialize an entry to a standard format for any transports, e.g. agents. + * Read more: https://cloud.google.com/logging/docs/structured-logging + */ + toStructuredJSON(projectId = '', useMessageField = true) { + const meta = this.metadata; + // Mask out the keys that need to be renamed. + /* eslint-disable @typescript-eslint/no-unused-vars */ + const { textPayload, jsonPayload, insertId, trace, spanId, traceSampled, operation, sourceLocation, labels, ...validKeys } = meta; + /* eslint-enable @typescript-eslint/no-unused-vars */ + let entry = extend(true, {}, validKeys); + // Re-map keys names. + entry[exports.LABELS_KEY] = meta.labels + ? Object.assign({}, meta.labels) + : undefined; + entry[exports.INSERT_ID_KEY] = meta.insertId || undefined; + entry[exports.TRACE_KEY] = meta.trace || undefined; + entry[exports.SPAN_ID_KEY] = meta.spanId || undefined; + entry[exports.TRACE_SAMPLED_KEY] = + 'traceSampled' in meta && meta.traceSampled !== null + ? meta.traceSampled + : undefined; + // Format log payload. + const data = this.data || + meta.textPayload || + meta.jsonPayload || + meta.protoPayload || + undefined; + if (useMessageField) { + /** If useMessageField is set, we add the payload to {@link StructuredJson#message} field.*/ + entry.message = data; + } + else { + /** useMessageField is false, we add the structured payload to {@link StructuredJson} key-value map. + * It could be especially useful for serverless environments like Cloud Run/Functions when stdout transport is used. + * Note that text still added to {@link StructuredJson#message} field for text payload since it does not have fields within. */ + if (data !== undefined && data !== null) { + if (this.isObject(data)) { + entry = extend(true, {}, entry, data); + } + else if (typeof data === 'string') { + entry.message = data; + } + else { + entry.message = JSON.stringify(data); + } + } + } + // Format timestamp + if (meta.timestamp instanceof Date) { + entry.timestamp = (0, common_1.toNanosAndSecondsObj)(meta.timestamp); + } + // Format httprequest + const req = meta.httpRequest; + if ((0, http_request_1.isRawHttpRequest)(req)) { + entry.httpRequest = (0, http_request_1.makeHttpRequestData)(req); + } + // Detected trace context from OpenTelemetry context or http headers if applicable. + const traceContext = this.extractTraceContext(projectId); + if (traceContext) { + if (!entry[exports.TRACE_KEY] && traceContext.trace) + entry[exports.TRACE_KEY] = traceContext.trace; + if (!entry[exports.SPAN_ID_KEY] && traceContext.spanId) + entry[exports.SPAN_ID_KEY] = traceContext.spanId; + if (entry[exports.TRACE_SAMPLED_KEY] === undefined) + entry[exports.TRACE_SAMPLED_KEY] = traceContext.traceSampled; + } + return entry; + } + /** + * extractTraceContext extracts trace and span information from OpenTelemetry + * span context or raw HTTP request headers. + * @private + */ + extractTraceContext(projectId) { + // Extract trace context from OpenTelemetry span context. + const otelContext = (0, context_1.getContextFromOtelContext)(projectId); + if (otelContext) + return otelContext; + // Extract trace context from http request headers. + const rawReq = this.metadata.httpRequest; + if (rawReq && 'headers' in rawReq) { + return (0, context_1.getOrInjectContext)(rawReq, projectId, false); + } + return null; + } + /** + * Create an Entry object from an API response, such as `entries:list`. + * + * @private + * + * @param {object} entry An API representation of an entry. See a + * {@link https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry| LogEntry}. + * @returns {Entry} + */ + static fromApiResponse_(entry) { + let data = entry[entry.payload]; + if (entry.payload === 'jsonPayload') { + data = (0, common_1.structToObj)(data); + } + const serializedEntry = new Entry(entry, data); + if (entry.timestamp) { + let ms = Number(entry.timestamp.seconds) * 1000; + ms += Number(entry.timestamp.nanos) / 1e6; + serializedEntry.metadata.timestamp = new Date(ms); + } + return serializedEntry; + } + /** + * Determines whether `value` is a JavaScript object. + * @param value The value to be checked + * @returns true if `value` is a JavaScript object, false otherwise + */ + isObject(value) { + return Object.prototype.toString.call(value) === '[object Object]'; + } +} +exports.Entry = Entry; +//# sourceMappingURL=entry.js.map + +/***/ }), + +/***/ 44391: +/***/ (function(module, exports, __nccwpck_require__) { + +"use strict"; + +/*! + * Copyright 2015 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.v2 = exports.protos = exports.Logging = exports.Sink = exports.LogSync = exports.formatLogName = exports.assignSeverityToEntries = exports.Severity = exports.Log = exports.Entry = exports.detectServiceContext = exports.middleware = void 0; +const common_1 = __nccwpck_require__(85543); +const paginator_1 = __nccwpck_require__(99469); +const projectify_1 = __nccwpck_require__(87635); +const promisify_1 = __nccwpck_require__(60206); +const arrify = __nccwpck_require__(26251); +const extend = __nccwpck_require__(23860); +const gax = __nccwpck_require__(83232); +// eslint-disable-next-line @typescript-eslint/no-var-requires +const pumpify = __nccwpck_require__(62432); +const streamEvents = __nccwpck_require__(71546); +const middleware = __nccwpck_require__(29804); +exports.middleware = middleware; +const metadata_1 = __nccwpck_require__(45676); +Object.defineProperty(exports, "detectServiceContext", ({ enumerable: true, get: function () { return metadata_1.detectServiceContext; } })); +const version = (__nccwpck_require__(38105)/* .version */ .rE); +// eslint-disable-next-line @typescript-eslint/no-var-requires +const v2 = __nccwpck_require__(96204); +exports.v2 = v2; +const entry_1 = __nccwpck_require__(49679); +Object.defineProperty(exports, "Entry", ({ enumerable: true, get: function () { return entry_1.Entry; } })); +const log_common_1 = __nccwpck_require__(35641); +Object.defineProperty(exports, "Severity", ({ enumerable: true, get: function () { return log_common_1.Severity; } })); +Object.defineProperty(exports, "formatLogName", ({ enumerable: true, get: function () { return log_common_1.formatLogName; } })); +Object.defineProperty(exports, "assignSeverityToEntries", ({ enumerable: true, get: function () { return log_common_1.assignSeverityToEntries; } })); +const log_1 = __nccwpck_require__(30233); +Object.defineProperty(exports, "Log", ({ enumerable: true, get: function () { return log_1.Log; } })); +const log_sync_1 = __nccwpck_require__(40233); +Object.defineProperty(exports, "LogSync", ({ enumerable: true, get: function () { return log_sync_1.LogSync; } })); +const sink_1 = __nccwpck_require__(35068); +Object.defineProperty(exports, "Sink", ({ enumerable: true, get: function () { return sink_1.Sink; } })); +const stream_1 = __nccwpck_require__(2203); +/** + * @typedef {object} ClientConfig + * @property {string} [projectId] The project ID from the Google Developer's + * Console, e.g. 'grape-spaceship-123'. We will also check the environment + * variable `GCLOUD_PROJECT` for your project ID. If your app is running in + * an environment which supports {@link + * https://cloud.google.com/docs/authentication/production#providing_credentials_to_your_application + * Application Default Credentials}, your project ID will be detected + * automatically. + * @property {string} [keyFilename] Full path to the a .json, .pem, or .p12 key + * downloaded from the Google Developers Console. If you provide a path to a + * JSON file, the `projectId` option above is not necessary. NOTE: .pem and + * .p12 require you to specify the `email` option as well. + * @property {string} [email] Account email address. Required when using a .pem + * or .p12 keyFilename. + * @property {object} [credentials] Credentials object. + * @property {string} [credentials.client_email] + * @property {string} [credentials.private_key] + * @property {boolean} [autoRetry=true] Automatically retry requests if the + * response is related to rate limits or certain intermittent server errors. + * We will exponentially backoff subsequent requests by default. + * @property {number} [maxRetries=3] Maximum number of automatic retries + * attempted before returning the error. + * @property {Constructor} [promise] Custom promise module to use instead of + * native Promises. + */ +/** + * {@link https://cloud.google.com/logging/docs| Cloud Logging} allows you to + * store, search, analyze, monitor, and alert on log data and events from Google + * Cloud Platform and Amazon Web Services (AWS). + * + * @class + * + * See {@link https://cloud.google.com/logging/docs| What is Cloud Logging?} + * + * See {@link https://cloud.google.com/logging/docs/api| Introduction to the Cloud Logging API} + * + * See {@link https://www.npmjs.com/package/@google-cloud/logging-bunyan| Logging to Google Cloud from Bunyan} + * + * See {@link https://www.npmjs.com/package/@google-cloud/logging-winston| Logging to Google Cloud from Winston} + * + * @param {ClientConfig} [options] Configuration options. + * + * @example Import the client library + * ``` + * const {Logging} = require('@google-cloud/logging'); + * + * ``` + * @example Create a client that uses Application Default Credentials (ADC): + * ``` + * const logging = new Logging(); + * + * ``` + * @example Create a client with explicitcredentials: + * ``` + * const logging = new Logging({ projectId: + * 'your-project-id', keyFilename: '/path/to/keyfile.json' + * }); + * + * ``` + * @example include:samples/quickstart.js + * region_tag:logging_quickstart + * Full quickstart example: + */ +class Logging { + constructor(options, gaxInstance) { + // Determine what scopes are needed. + // It is the union of the scopes on all three clients. + const scopes = []; + const clientClasses = [ + v2.ConfigServiceV2Client, + v2.LoggingServiceV2Client, + v2.MetricsServiceV2Client, + ]; + for (const clientClass of clientClasses) { + for (const scope of clientClass.scopes) { + if (scopes.indexOf(scope) === -1) { + scopes.push(scope); + } + } + } + const options_ = extend({ + libName: 'gccl', + libVersion: version, + scopes, + }, options); + this.api = {}; + this.auth = new (gaxInstance !== null && gaxInstance !== void 0 ? gaxInstance : gax).GoogleAuth(options_); + this.options = options_; + this.projectId = this.options.projectId || '{{projectId}}'; + this.configService = new v2.ConfigServiceV2Client(this.options, gaxInstance); + this.loggingService = new v2.LoggingServiceV2Client(this.options, gaxInstance); + } + // jscs:disable maximumLineLength + /** + * Create a sink. + * + * See {@link https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks|Sink Overview} + * See {@link https://cloud.google.com/logging/docs/view/advanced_filters|Advanced Logs Filters} + * See {@link https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks/create|projects.sinks.create API Documentation} + * + * @param {string} name Name of the sink. + * @param {CreateSinkRequest} config Config to set for the sink. + * @param {CreateSinkCallback} [callback] Callback function. + * @returns {Promise} + * @throws {Error} If a name is not provided. + * @throws {Error} if a config object is not provided. + * @see Sink#create + * + * @example + * ``` + * const {Storage} = require('@google-cloud/storage'); + * const storage = new Storage({ + * projectId: 'grape-spaceship-123' + * }); + * const {Logging} = require('@google-cloud/logging'); + * const logging = new Logging(); + * + * const config = { + * destination: storage.bucket('logging-bucket'), + * filter: 'severity = ALERT' + * }; + * + * function callback(err, sink, apiResponse) { + * // `sink` is a Sink object. + * } + * + * logging.createSink('new-sink-name', config, callback); + * + * //- + * // If the callback is omitted, we'll return a Promise. + * //- + * logging.createSink('new-sink-name', config).then(data => { + * const sink = data[0]; + * const apiResponse = data[1]; + * }); + * + * ``` + * @example include:samples/sinks.js + * region_tag:logging_create_sink + * Another example: + */ + async createSink(name, config) { + if (typeof name !== 'string') { + throw new Error('A sink name must be provided.'); + } + if (typeof config !== 'object') { + throw new Error('A sink configuration object must be provided.'); + } + if (common_1.util.isCustomType(config.destination, 'bigquery/dataset')) { + await this.setAclForDataset_(config); + } + if (common_1.util.isCustomType(config.destination, 'pubsub/topic')) { + await this.setAclForTopic_(config); + } + if (common_1.util.isCustomType(config.destination, 'storage/bucket')) { + await this.setAclForBucket_(config); + } + const reqOpts = { + parent: 'projects/' + this.projectId, + sink: extend({}, config, { name }), + uniqueWriterIdentity: config.uniqueWriterIdentity, + }; + delete reqOpts.sink.gaxOptions; + delete reqOpts.sink.uniqueWriterIdentity; + await this.setProjectId(reqOpts); + const [resp] = await this.configService.createSink(reqOpts, config.gaxOptions); + const sink = this.sink(resp.name); + sink.metadata = resp; + return [sink, resp]; + } + /** + * Create an entry object. + * + * Using this method will not itself make any API requests. You will use + * the object returned in other API calls, such as + * {@link Log#write}. + * + * Note, {@link https://cloud.google.com/logging/quotas|Cloud Logging Quotas and limits} + * dictates that the maximum log entry size, including all + * [LogEntry Resource properties]{@link https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry}, + * cannot exceed _approximately_ 256 KB. + * + * See {@link https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry|LogEntry JSON representation} + * + * @param {?object|?string} [resource] See a + * [Monitored + * Resource](https://cloud.google.com/logging/docs/reference/v2/rest/v2/MonitoredResource). + * @param {object|string} data The data to use as the value for this log + * entry. + * @returns {Entry} + * + * @example + * ``` + * const {Logging} = require('@google-cloud/logging'); + * const logging = new Logging(); + * + * const resource = { + * type: 'gce_instance', + * labels: { + * zone: 'global', + * instance_id: '3' + * } + * }; + * + * const entry = logging.entry(resource, { + * delegate: 'my_username' + * }); + * + * entry.toJSON(); + * // { + * // resource: { + * // type: 'gce_instance', + * // labels: { + * // zone: 'global', + * // instance_id: '3' + * // } + * // }, + * // jsonPayload: { + * // delegate: 'my_username' + * // } + * // } + * ``` + */ + entry(resource, data) { + return new entry_1.Entry(resource, data); + } + async getEntries(opts) { + const options = opts ? opts : {}; + // By default, sort entries by descending timestamp + let reqOpts = extend({ orderBy: 'timestamp desc' }, options); + // By default, filter entries to last 24 hours only + const time = new Date(); + time.setDate(time.getDate() - 1); + const timeFilter = `timestamp >= "${time.toISOString()}"`; + if (!options.filter) { + reqOpts = extend({ filter: timeFilter }, reqOpts); + } + else if (!options.filter.includes('timestamp')) { + reqOpts.filter += ` AND ${timeFilter}`; + } + this.projectId = await this.auth.getProjectId(); + const resourceName = 'projects/' + this.projectId; + reqOpts.resourceNames = arrify(reqOpts.resourceNames); + if (reqOpts.resourceNames.length === 0) { + // If no resource names are provided, default to the current project. + reqOpts.resourceNames.push(resourceName); + } + delete reqOpts.autoPaginate; + delete reqOpts.gaxOptions; + let gaxOptions = extend({ + autoPaginate: options.autoPaginate, + }, options.gaxOptions); + if (options === null || options === void 0 ? void 0 : options.maxResults) { + gaxOptions = extend({ + maxResults: options.maxResults, + }, gaxOptions); + } + const resp = await this.loggingService.listLogEntries(reqOpts, gaxOptions); + const [entries] = resp; + if (entries) { + resp[0] = entries.map(entry_1.Entry.fromApiResponse_); + } + return resp; + } + /** + * List the {@link Entry} objects in your logs as a readable object + * stream. + * + * @method Logging#getEntriesStream + * @param {GetEntriesRequest} [query] Query object for listing entries. + * @returns {ReadableStream} A readable stream that emits {@link Entry} + * instances. + * + * @example + * ``` + * const {Logging} = require('@google-cloud/logging'); + * const logging = new Logging(); + * + * logging.getEntriesStream() + * .on('error', console.error) + * .on('data', entry => { + * // `entry` is a Cloud Logging entry object. + * // See the `data` property to read the data from the entry. + * }) + * .on('end', function() { + * // All entries retrieved. + * }); + * + * //- + * // If you anticipate many results, you can end a stream early to prevent + * // unnecessary processing and API requests. + * //- + * logging.getEntriesStream() + * .on('data', function(entry) { + * this.end(); + * }); + * ``` + */ + getEntriesStream(options = {}) { + let requestStream; + const userStream = streamEvents(pumpify.obj()); + userStream.abort = () => { + if (requestStream) { + requestStream.abort(); + } + }; + const toEntryStream = new stream_1.Transform({ + objectMode: true, + transform: (chunk, encoding, callback) => { + callback(null, entry_1.Entry.fromApiResponse_(chunk)); + }, + }); + userStream.once('reading', () => { + this.auth.getProjectId().then(projectId => { + this.projectId = projectId; + if (options.log) { + if (options.filter) { + options.filter = `(${options.filter}) AND logName="${(0, log_common_1.formatLogName)(this.projectId, options.log)}"`; + } + else { + options.filter = `logName="${(0, log_common_1.formatLogName)(this.projectId, options.log)}"`; + } + delete options.log; + } + const reqOpts = extend({ + orderBy: 'timestamp desc', + }, options); + reqOpts.resourceNames = arrify(reqOpts.resourceNames); + reqOpts.resourceNames.push(`projects/${this.projectId}`); + delete reqOpts.autoPaginate; + delete reqOpts.gaxOptions; + const gaxOptions = extend({ + autoPaginate: options.autoPaginate, + }, options.gaxOptions); + let gaxStream; + requestStream = streamEvents(new stream_1.PassThrough({ objectMode: true })); + requestStream.abort = () => { + if (gaxStream && gaxStream.cancel) { + gaxStream.cancel(); + } + }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + if (!global.GCLOUD_SANDBOX_ENV) { + requestStream.once('reading', () => { + try { + gaxStream = this.loggingService.listLogEntriesStream(reqOpts, gaxOptions); + } + catch (error) { + requestStream.destroy(error); + return; + } + gaxStream + .on('error', err => { + requestStream.destroy(err); + }) + .pipe(requestStream); + return; + }); + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any + userStream.setPipeline(requestStream, toEntryStream); + }); + }); + return userStream; + } + /** + * Query object for streaming entries. + * + * @typedef {object} TailEntriesRequest + * @property {Array.|string} [resourceNames] Names of project + * resources to stream logs out of. + * @property {string} [filter] An + * [advanced logs + * filter](https://cloud.google.com/logging/docs/view/advanced_filters). An + * empty filter matches all log entries. + * @property {number} [bufferWindow=2] A setting to balance the tradeoff + * between viewing the log entries as they are being written and viewing + * them in ascending order. + * @property {string} [log] A name of the log specifying to only return + * entries from this log. + * @property {object} [gaxOptions] Request configuration options, outlined + * here: https://googleapis.github.io/gax-nodejs/global.html#CallOptions. + */ + /** + * Streaming read of live logs as log entries are ingested. Until the stream + * is terminated, it will continue reading logs. + * + * @method Logging#tailEntries + * @param {TailEntriesRequest} [query] Query object for tailing entries. + * @returns {DuplexStream} A duplex stream that emits TailEntriesResponses + * containing an array of {@link Entry} instances. + * + * @example + * ``` + * const {Logging} = require('@google-cloud/logging'); + * const logging = new Logging(); + * + * logging.tailEntries() + * .on('error', console.error) + * .on('data', resp => { + * console.log(resp.entries); + * console.log(resp.suppressionInfo); + * }) + * .on('end', function() { + * // All entries retrieved. + * }); + * + * //- + * // If you anticipate many results, you can end a stream early to prevent + * // unnecessary processing and API requests. + * //- + * logging.getEntriesStream() + * .on('data', function(entry) { + * this.end(); + * }); + * ``` + */ + tailEntries(options = {}) { + const userStream = streamEvents(pumpify.obj()); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + let gaxStream; + userStream.abort = () => { + if (gaxStream && gaxStream.cancel) { + gaxStream.cancel(); + } + }; + const transformStream = new stream_1.Transform({ + objectMode: true, + transform: (chunk, encoding, callback) => { + callback(null, (() => { + const formattedEntries = []; + chunk.entries.forEach((entry) => { + formattedEntries.push(entry_1.Entry.fromApiResponse_(entry)); + }); + const resp = { + entries: formattedEntries, + suppressionInfo: chunk.suppressionInfo, + }; + return resp; + })()); + }, + }); + this.auth.getProjectId().then(projectId => { + this.projectId = projectId; + if (options.log) { + if (options.filter) { + options.filter = `(${options.filter}) AND logName="${(0, log_common_1.formatLogName)(this.projectId, options.log)}"`; + } + else { + options.filter = `logName="${(0, log_common_1.formatLogName)(this.projectId, options.log)}"`; + } + } + options.resourceNames = arrify(options.resourceNames); + options.resourceNames.push(`projects/${this.projectId}`); + const writeOptions = { + resourceNames: options.resourceNames, + ...(options.filter && { filter: options.filter }), + ...(options.bufferWindow && { bufferwindow: options.bufferWindow }), + }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + if (!global.GCLOUD_SANDBOX_ENV) { + gaxStream = this.loggingService.tailLogEntries(options.gaxOptions); + // Write can only be called once in a single tail streaming session. + gaxStream.write(writeOptions); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + userStream.setPipeline(gaxStream, transformStream); + } + }); + return userStream; + } + async getLogs(opts) { + const options = opts ? opts : {}; + this.projectId = await this.auth.getProjectId(); + const reqOpts = extend({}, options, { + parent: 'projects/' + this.projectId, + }); + delete reqOpts.autoPaginate; + delete reqOpts.gaxOptions; + const gaxOptions = extend({ + autoPaginate: options.autoPaginate, + }, options.gaxOptions); + const resp = await this.loggingService.listLogs(reqOpts, gaxOptions); + const [logs] = resp; + if (logs) { + resp[0] = logs.map((logName) => this.log(logName)); + } + return resp; + } + /** + * List the {@link Log} objects in your project as a readable object stream. + * + * @method Logging#getLogsStream + * @param {GetLogsRequest} [query] Query object for listing entries. + * @returns {ReadableStream} A readable stream that emits {@link Log} + * instances. + * + * @example + * ``` + * const {Logging} = require('@google-cloud/logging'); + * const logging = new Logging(); + * + * logging.getLogsStream() + * .on('error', console.error) + * .on('data', log => { + * // `log` is a Cloud Logging log object. + * }) + * .on('end', function() { + * // All logs retrieved. + * }); + * + * //- + * // If you anticipate many results, you can end a stream early to prevent + * // unnecessary processing and API requests. + * //- + * logging.getLogsStream() + * .on('data', log => { + * this.end(); + * }); + * ``` + */ + getLogsStream(options = {}) { + options = options || {}; + let requestStream; + const userStream = streamEvents(pumpify.obj()); + userStream.abort = () => { + if (requestStream) { + requestStream.abort(); + } + }; + const toLogStream = new stream_1.Transform({ + objectMode: true, + transform: (chunk, encoding, callback) => { + callback(null, this.log(chunk)); + }, + }); + userStream.once('reading', () => { + this.auth.getProjectId().then(projectId => { + this.projectId = projectId; + const reqOpts = extend({}, options, { + parent: 'projects/' + this.projectId, + }); + delete reqOpts.gaxOptions; + const gaxOptions = extend({ + autoPaginate: options.autoPaginate, + }, options.gaxOptions); + let gaxStream; + requestStream = streamEvents(new stream_1.PassThrough({ objectMode: true })); + requestStream.abort = () => { + if (gaxStream && gaxStream.cancel) { + gaxStream.cancel(); + } + }; + requestStream.once('reading', () => { + try { + gaxStream = this.loggingService.listLogsStream(reqOpts, gaxOptions); + } + catch (error) { + requestStream.destroy(error); + return; + } + gaxStream + .on('error', err => { + requestStream.destroy(err); + }) + .pipe(requestStream); + return; + }); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + userStream.setPipeline(requestStream, toLogStream); + }); + }); + return userStream; + } + async getSinks(opts) { + const options = opts ? opts : {}; + this.projectId = await this.auth.getProjectId(); + const reqOpts = extend({}, options, { + parent: 'projects/' + this.projectId, + }); + delete reqOpts.autoPaginate; + delete reqOpts.gaxOptions; + const gaxOptions = extend({ + autoPaginate: options.autoPaginate, + }, options.gaxOptions); + const resp = await this.configService.listSinks(reqOpts, gaxOptions); + const [sinks] = resp; + if (sinks) { + resp[0] = sinks.map((sink) => { + const sinkInstance = this.sink(sink.name); + sinkInstance.metadata = sink; + return sinkInstance; + }); + } + return resp; + } + /** + * Get the {@link Sink} objects associated with this project as a + * readable object stream. + * + * @method Logging#getSinksStream + * @param {GetSinksRequest} [query] Query object for listing sinks. + * @returns {ReadableStream} A readable stream that emits {@link Sink} + * instances. + * + * @example + * ``` + * const {Logging} = require('@google-cloud/logging'); + * const logging = new Logging(); + * + * logging.getSinksStream() + * .on('error', console.error) + * .on('data', sink => { + * // `sink` is a Sink object. + * }) + * .on('end', function() { + * // All sinks retrieved. + * }); + * + * //- + * // If you anticipate many results, you can end a stream early to prevent + * // unnecessary processing and API requests. + * //- + * logging.getSinksStream() + * .on('data', function(sink) { + * this.end(); + * }); + * ``` + */ + getSinksStream(options) { + // eslint-disable-next-line @typescript-eslint/no-this-alias + const self = this; + options = options || {}; + let requestStream; + const userStream = streamEvents(pumpify.obj()); + userStream.abort = () => { + if (requestStream) { + requestStream.abort(); + } + }; + const toSinkStream = new stream_1.Transform({ + objectMode: true, + transform: (chunk, encoding, callback) => { + const sinkInstance = self.sink(chunk.name); + sinkInstance.metadata = chunk; + callback(null, sinkInstance); + }, + }); + userStream.once('reading', () => { + this.auth.getProjectId().then(projectId => { + this.projectId = projectId; + const reqOpts = extend({}, options, { + parent: 'projects/' + self.projectId, + }); + delete reqOpts.gaxOptions; + const gaxOptions = extend({ + autoPaginate: options.autoPaginate, + }, options.gaxOptions); + let gaxStream; + requestStream = streamEvents(new stream_1.PassThrough({ objectMode: true })); + requestStream.abort = () => { + if (gaxStream && gaxStream.cancel) { + gaxStream.cancel(); + } + }; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + if (!global.GCLOUD_SANDBOX_ENV) { + requestStream.once('reading', () => { + try { + gaxStream = this.configService.listSinksStream(reqOpts, gaxOptions); + } + catch (error) { + requestStream.destroy(error); + return; + } + gaxStream + .on('error', err => { + requestStream.destroy(err); + }) + .pipe(requestStream); + return; + }); + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any + userStream.setPipeline(requestStream, toSinkStream); + }); + }); + return userStream; + } + /** + * Get a reference to a Cloud Logging log. + * + * See {@link https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.logs|Log Overview} + * + * @param {string} name Name of the existing log. + * @param {object} [options] Configuration object. + * @param {boolean} [options.removeCircular] Replace circular references in + * logged objects with a string value, `[Circular]`. (Default: false) + * @returns {Log} + * + * @example + * ``` + * const {Logging} = require('@google-cloud/logging'); + * const logging = new Logging(); + * const log = logging.log('my-log'); + * ``` + */ + log(name, options) { + return new log_1.Log(this, name, options); + } + /** + * Get a reference to a Cloud Logging logSync. + * + * @param {string} name Name of the existing log. + * @param {object} transport An optional write stream. + * @param {LogSyncOptions} options An optional configuration object. + * @returns {LogSync} + * + * @example + * ``` + * const {Logging} = require('@google-cloud/logging'); + * const logging = new Logging(); + * + * // Optional: enrich logs with additional context + * await logging.setProjectId(); + * await logging.setDetectedResource(); + * + * // Default transport writes to process.stdout + * const log = logging.logSync('my-log'); + * ``` + */ + logSync(name, transport, options) { + return new log_sync_1.LogSync(this, name, transport, options); + } + /** + * Get a reference to a Cloud Logging sink. + * + * See {@link https://cloud.google.com/logging/docs/reference/v2/rest/v2/projects.sinks|Sink Overview} + * + * @param {string} name Name of the existing sink. + * @returns {Sink} + * + * @example + * ``` + * const {Logging} = require('@google-cloud/logging'); + * const logging = new Logging(); + * const sink = logging.sink('my-sink'); + * ``` + */ + sink(name) { + return new sink_1.Sink(this, name); + } + /** + * Funnel all API requests through this method, to be sure we have a project + * ID. + * + * @param {object} config Configuration object. + * @param {object} config.gaxOpts GAX options. + * @param {function} config.method The gax method to call. + * @param {object} config.reqOpts Request options. + * @param {function} [callback] Callback function. + */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + request(config, callback) { + // eslint-disable-next-line @typescript-eslint/no-this-alias + const self = this; + const isStreamMode = !callback; + let gaxStream; + let stream; + if (isStreamMode) { + stream = streamEvents(new stream_1.PassThrough({ objectMode: true })); + stream.abort = () => { + if (gaxStream && gaxStream.cancel) { + gaxStream.cancel(); + } + }; + stream.once('reading', makeRequestStream); + } + else { + makeRequestCallback(); + } + function prepareGaxRequest(callback) { + self.auth.getProjectId((err, projectId) => { + if (err) { + callback(err); + return; + } + self.projectId = projectId; + let gaxClient = self.api[config.client]; + if (!gaxClient) { + // Lazily instantiate client. + gaxClient = new v2[config.client](self.options); + self.api[config.client] = gaxClient; + } + let reqOpts = extend(true, {}, config.reqOpts); + reqOpts = (0, projectify_1.replaceProjectIdToken)(reqOpts, projectId); + const requestFn = gaxClient[config.method].bind(gaxClient, reqOpts, config.gaxOpts); + callback(null, requestFn); + }); + } + function makeRequestCallback() { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + if (global.GCLOUD_SANDBOX_ENV) { + return; + } + prepareGaxRequest((err, requestFn) => { + if (err) { + callback(err); + return; + } + requestFn(callback); + }); + } + function makeRequestStream() { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + if (global.GCLOUD_SANDBOX_ENV) { + return new stream_1.PassThrough({ objectMode: true }); + } + prepareGaxRequest((err, requestFn) => { + if (err) { + stream.destroy(err); + return; + } + gaxStream = requestFn(); + gaxStream + .on('error', err => { + stream.destroy(err); + }) + .pipe(stream); + }); + return; + } + return stream; + } + /** + * This method is called when creating a sink with a Bucket destination. The + * bucket must first grant proper ACL access to the Cloud Logging + * account. + * + * The parameters are the same as what {@link Logging#createSink} accepts. + * + * @private + */ + async setAclForBucket_(config) { + const bucket = config.destination; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + await bucket.acl.owners.addGroup('cloud-logs@google.com'); + config.destination = 'storage.googleapis.com/' + bucket.name; + } + /** + * This method is called when creating a sink with a Dataset destination. The + * dataset must first grant proper ACL access to the Cloud Logging + * account. + * + * The parameters are the same as what {@link Logging#createSink} accepts. + * + * @private + */ + async setAclForDataset_(config) { + const dataset = config.destination; + const [metadata] = await dataset.getMetadata(); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const access = [].slice.call(arrify(metadata.access)); + access.push({ + role: 'WRITER', + groupByEmail: 'cloud-logs@google.com', + }); + await dataset.setMetadata({ + access, + }); + const baseUrl = 'bigquery.googleapis.com'; + const pId = dataset.parent.projectId; + const dId = dataset.id; + config.destination = `${baseUrl}/projects/${pId}/datasets/${dId}`; + } + /** + * This method is called when creating a sink with a Topic destination. The + * topic must first grant proper ACL access to the Cloud Logging + * account. + * + * The parameters are the same as what {@link Logging#createSink} accepts. + * + * @private + */ + async setAclForTopic_(config) { + const topic = config.destination; + const [policy] = await topic.iam.getPolicy(); + policy.bindings = arrify(policy.bindings); + policy.bindings.push({ + role: 'roles/pubsub.publisher', + members: ['serviceAccount:cloud-logs@system.gserviceaccount.com'], + }); + await topic.iam.setPolicy(policy); + const baseUrl = 'pubsub.googleapis.com'; + const topicName = topic.name; + config.destination = `${baseUrl}/${topicName}`; + } + /** + * setProjectId detects and sets a projectId string on the Logging instance. + * It can be invoked once to ensure ensuing LogSync entries have a projectID. + * @param reqOpts + */ + // eslint-disable-next-line @typescript-eslint/no-unused-vars + async setProjectId(reqOpts) { + if (this.projectId === '{{projectId}}') + this.projectId = await this.auth.getProjectId(); + if (reqOpts) + reqOpts = (0, projectify_1.replaceProjectIdToken)(reqOpts, this.projectId); + } + /** + * setResource detects and sets a detectedresource object on the Logging + * instance. It can be invoked once to ensure ensuing LogSync entries contain + * resource context. + */ + async setDetectedResource() { + if (!this.detectedResource) { + this.detectedResource = await (0, metadata_1.getDefaultResource)(this.auth); + } + } +} +exports.Logging = Logging; +/*! Developer Documentation + * All async methods (except for streams) will execute a callback in the event + * that a callback is provided. + */ +(0, promisify_1.callbackifyAll)(Logging, { + exclude: ['request'], +}); +/*! Developer Documentation + * + * These methods can be auto-paginated. + */ +paginator_1.paginator.extend(Logging, ['getEntries', 'getLogs', 'getSinks']); +/** + * Reference to the low-level auto-generated clients for the V2 Logging service. + * + * @type {object} + * @property {constructor} LoggingServiceV2Client + * Reference to {@link v2.LoggingServiceV2Client} + * @property {constructor} ConfigServiceV2Client + * Reference to {@link v2.ConfigServiceV2Client} + * @property {constructor} MetricsServiceV2Client + * Reference to {@link v2.MetricsServiceV2Client} + */ +module.exports.v2 = v2; +const protos = __nccwpck_require__(12865); +exports.protos = protos; +__exportStar(__nccwpck_require__(63914), exports); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 40233: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/*! + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.LogSync = void 0; +const entry_1 = __nccwpck_require__(49679); +const instrumentation_1 = __nccwpck_require__(49543); +const log_common_1 = __nccwpck_require__(35641); +/** + * A logSync is a named collection of entries in structured log format. In Cloud + * Logging, structured logs refer to log entries that use the jsonPayload field + * to add structure to their payloads. In most GCP environments, like GKE and + * Cloud Functions, structured logs written to process.stdout are automatically + * picked up and formatted by logging agents. + * + * Recommended for Serverless environment logging, especially where async log + * calls made by the `Log` class can be dropped by the CPU. + * + * See {@link https://cloud.google.com/logging/docs/structured-logging|Structured Logging} + * + * @class + * + * @param {Logging} logging {@link Logging} instance. + * @param {string} name Name of the logSync. + * @param {Writable} [transport] transport A custom writable transport stream. + * Default: process.stdout. + * + * @example + * ``` + * const {Logging} = require('@google-cloud/logging'); + * const logging = new Logging(); + * const log = logging.logSync('mylog'); + * ``` + */ +class LogSync { + // not projectId, formattedname is expected + constructor(logging, name, transport, options) { + var _a; + options = options || {}; + this.formattedName_ = (0, log_common_1.formatLogName)(logging.projectId, name); + this.logging = logging; + /** + * @name Log#name + * @type {string} + */ + this.name = this.formattedName_.split('/').pop(); + // Default to writing to stdout + this.transport = transport || process.stdout; + this.useMessageField_ = (_a = options.useMessageField) !== null && _a !== void 0 ? _a : true; + } + /** + * Write a log entry with a severity of "ALERT". + * + * This is a simple wrapper around {@link LogSync#write}. All arguments are + * the same as documented there. + * + * @param {Entry|Entry[]} entry A log entry, or array of entries, to write. + * @param {?WriteOptions} [options] Write options + * @example + * ``` + * const {Logging} = require('@google-cloud/logging'); + * const logging = new Logging(); + * const log = logging.logSync('my-log'); + * + * const entry = log.entry('gce_instance', { + * instance: 'my_instance' + * }); + * + * log.alert(entry); + * ``` + */ + alert(entry, options) { + this.write((0, log_common_1.assignSeverityToEntries)(entry, 'ALERT'), options); + } + /** + * Write a log entry with a severity of "CRITICAL". + * + * This is a simple wrapper around {@link LogSync#write}. All arguments are + * the same as documented there. + * + * @param {Entry|Entry[]} entry A log entry, or array of entries, to write. + * @param {?WriteOptions} [options] Write options + * @example + * ``` + * const {Logging} = require('@google-cloud/logging'); + * const logging = new Logging(); + * const log = logging.logSync('my-log'); + * + * const entry = log.entry('gce_instance', { + * instance: 'my_instance' + * }); + * + * log.critical(entry); + * ``` + */ + critical(entry, options) { + this.write((0, log_common_1.assignSeverityToEntries)(entry, 'CRITICAL'), options); + } + /** + * Write a log entry with a severity of "DEBUG". + * + * This is a simple wrapper around {@link LogSync#write}. All arguments are + * the same as documented there. + * + * @param {Entry|Entry[]} entry A log entry, or array of entries, to write. + * @param {?WriteOptions} [options] Write options + * @example + * ``` + * const {Logging} = require('@google-cloud/logging'); + * const logging = new Logging(); + * const log = logging.logSync('my-log'); + * + * const entry = log.entry('gce_instance', { + * instance: 'my_instance' + * }); + * + * log.debug(entry); + * ``` + */ + debug(entry, options) { + this.write((0, log_common_1.assignSeverityToEntries)(entry, 'DEBUG'), options); + } + /** + * Write a log entry with a severity of "EMERGENCY". + * + * This is a simple wrapper around {@link LogSync#write}. All arguments are + * the same as documented there. + * + * @param {Entry|Entry[]} entry A log entry, or array of entries, to write. + * @param {?WriteOptions} [options] Write options + * @example + * ``` + * const {Logging} = require('@google-cloud/logging'); + * const logging = new Logging(); + * const log = logging.logSync('my-log'); + * + * const entry = log.entry('gce_instance', { + * instance: 'my_instance' + * }); + * + * log.emergency(entry); + * ``` + */ + emergency(entry, options) { + this.write((0, log_common_1.assignSeverityToEntries)(entry, 'EMERGENCY'), options); + } + entry(metadataOrData, data) { + let metadata; + if (!data && + metadataOrData !== null && + Object.prototype.hasOwnProperty.call(metadataOrData, 'httpRequest')) { + // If user logs entry(metadata.httpRequest) + metadata = metadataOrData; + data = {}; + } + else if (!data) { + // If user logs entry(message) + data = metadataOrData; + metadata = {}; + } + else { + // If user logs entry(metadata, message) + metadata = metadataOrData; + } + return this.logging.entry(metadata, data); + } + /** + * Write a log entry with a severity of "ERROR". + * + * This is a simple wrapper around {@link LogSync#write}. All arguments are + * the same as documented there. + * + * @param {Entry|Entry[]} entry A log entry, or array of entries, to write. + * @param {?WriteOptions} [options] Write options + * @example + * ``` + * const {Logging} = require('@google-cloud/logging'); + * const logging = new Logging(); + * const log = logging.logSync('my-log'); + * + * const entry = log.entry('gce_instance', { + * instance: 'my_instance' + * }); + * + * log.error(entry); + * ``` + */ + error(entry, options) { + this.write((0, log_common_1.assignSeverityToEntries)(entry, 'ERROR'), options); + } + /** + * Write a log entry with a severity of "INFO". + * + * This is a simple wrapper around {@link LogSync#write}. All arguments are + * the same as documented there. + * + * @param {Entry|Entry[]} entry A log entry, or array of entries, to write. + * @param {?WriteOptions} [options] Write options + * @example + * ``` + * const {Logging} = require('@google-cloud/logging'); + * const logging = new Logging(); + * const log = logging.logSync('my-log'); + * + * const entry = log.entry('gce_instance', { + * instance: 'my_instance' + * }); + * + * log.info(entry); + * ``` + */ + info(entry, options) { + this.write((0, log_common_1.assignSeverityToEntries)(entry, 'INFO'), options); + } + /** + * Write a log entry with a severity of "NOTICE". + * + * This is a simple wrapper around {@link LogSync#write}. All arguments are + * the same as documented there. + * + * @param {Entry|Entry[]} entry A log entry, or array of entries, to write. + * @param {?WriteOptions} [options] Write options + * @example + * ``` + * const {Logging} = require('@google-cloud/logging'); + * const logging = new Logging(); + * const log = logging.logSync('my-log'); + * + * const entry = log.entry('gce_instance', { + * instance: 'my_instance' + * }); + * + * log.notice(entry); + * ``` + */ + notice(entry, options) { + this.write((0, log_common_1.assignSeverityToEntries)(entry, 'NOTICE'), options); + } + /** + * Write a log entry with a severity of "WARNING". + * + * This is a simple wrapper around {@link LogSync#write}. All arguments are + * the same as documented there. + * + * @param {Entry|Entry[]} entry A log entry, or array of entries, to write. + * @param {?WriteOptions} [options] Write options + * @example + * ``` + * const {Logging} = require('@google-cloud/logging'); + * const logging = new Logging(); + * const log = logging.logSync('my-log'); + * + * const entry = log.entry('gce_instance', { + * instance: 'my_instance' + * }); + * + * log.warning(entry); + * ``` + */ + warning(entry, options) { + this.write((0, log_common_1.assignSeverityToEntries)(entry, 'WARNING'), options); + } + /** + * Write log entries to a custom transport (default: process.stdout). + * + * @param {Entry|Entry[]} entry A log entry, or array of entries, to write. + * @param {?WriteOptions} [options] Write options + * + * @example + * ``` + * const entry = log.entry('gce_instance', { + * instance: 'my_instance' + * }); + * + * log.write(entry); + * + * //- + * // You may also pass multiple log entries to write. + * //- + * const secondEntry = log.entry('compute.googleapis.com', { + * user: 'my_username' + * }); + * + * log.write([entry, secondEntry]); + * + * //- + * // To save some steps, you can also pass in plain values as your entries. + * // Note, however, that you must provide a configuration object to specify + * // the resource. + * //- + * const entries = [ + * { + * user: 'my_username' + * }, + * { + * home: process.env.HOME + * } + * ]; + * + * const options = { + * resource: 'compute.googleapis.com' + * }; + * + * log.write(entries, options); + * + * log.write(entries); + * }); + * ``` + */ + write(entry, opts) { + var _a; + const options = opts ? opts : {}; + // We expect projectId and resource to be set before this fn is called... + let structuredEntries; + this.formattedName_ = (0, log_common_1.formatLogName)(this.logging.projectId, this.name); + try { + // Make sure to add instrumentation info + structuredEntries = (0, instrumentation_1.populateInstrumentationInfo)(entry)[0].map(entry => { + if (!(entry instanceof entry_1.Entry)) { + entry = this.entry(entry); + } + return entry.toStructuredJSON(this.logging.projectId, this.useMessageField_); + }); + for (const entry of structuredEntries) { + entry.logName = this.formattedName_; + entry.resource = + (0, log_common_1.snakecaseKeys)((_a = options.resource) === null || _a === void 0 ? void 0 : _a.labels) || + entry.resource || + this.logging.detectedResource; + entry[entry_1.LABELS_KEY] = options.labels || entry[entry_1.LABELS_KEY]; + this.transport.write(JSON.stringify(entry) + '\n'); + } + } + catch (err) { + // Ignore errors (client libraries do not panic). + } + } +} +exports.LogSync = LogSync; +//# sourceMappingURL=log-sync.js.map + +/***/ }), + +/***/ 30233: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/*! + * Copyright 2015 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Log = void 0; +const promisify_1 = __nccwpck_require__(60206); +const dotProp = __nccwpck_require__(98399); +const extend = __nccwpck_require__(23860); +const entry_1 = __nccwpck_require__(49679); +const instrumentation_1 = __nccwpck_require__(49543); +const log_common_1 = __nccwpck_require__(35641); +/** + * A log is a named collection of entries, each entry representing a timestamped + * event. Logs can be produced by Google Cloud Platform services, by third-party + * services, or by your applications. For example, the log `apache-access` is + * produced by the Apache Web Server, but the log + * `compute.googleapis.com/activity_log` is produced by Google Compute Engine. + * + * See {@link https://cloud.google.com/logging/docs/basic-concepts#logs|Introduction to Logs} + * + * @class + * + * @param {Logging} logging {@link Logging} instance. + * @param {string} name Name of the log. + * @param {object} [options] Configuration object. + * @param {boolean} [options.removeCircular] Replace circular references in + * logged objects with a string value, `[Circular]`. (Default: false) + * @param {number} [options.maxEntrySize] A max entry size + * @param {string[]} [options.jsonFieldsToTruncate] A list of JSON properties at the given full path to be truncated. + * Received values will be prepended to predefined list in the order received and duplicates discarded. + * @param {ApiResponseCallback} [options.defaultWriteDeleteCallback] A default global callback to be used for {@link Log#write} + * and {@link Log#delete} APIs when {@link ApiResponseCallback} callback was not supplied by caller in function parameters. + * Note that {@link LogOptions#defaultWriteDeleteCallback} is useful when {@link Log#write} and {@link Log#delete} APIs are called + * without `await` and without callback added explicitly to every call - this way {@link LogOptions#defaultWriteDeleteCallback} + * can serve as global callback handler, which for example could be used to catch all errors and eliminate crashes. + * @param {boolean} [options.partialSuccess] Global flag indicating Whether a batch's valid entries should be written even if + * some other entry failed due to errors. Default is true. + * See {@link https://cloud.google.com/logging/docs/reference/v2/rest/v2/entries/write#body.request_body.FIELDS.partial_success|partialSuccess} for more info. + * @example + * ``` + * import {Logging} from '@google-cloud/logging'; + * import {LogOptions} from '@google-cloud/logging/build/src/log'; + * const options: LogOptions = { + * maxEntrySize: 256, + * jsonFieldsToTruncate: [ + * 'jsonPayload.fields.metadata.structValue.fields.custom.stringValue', + * ], + * defaultWriteDeleteCallback: (err: any) => { + * if (err) { + * console.log('Error: ' + err); + * } + * }, + * }; + * const logging = new Logging(); + * const log = logging.log('syslog', options); + * ``` + */ +class Log { + constructor(logging, name, options) { + var _a; + options = options || {}; + this.formattedName_ = (0, log_common_1.formatLogName)(logging.projectId, name); + this.removeCircular_ = options.removeCircular === true; + this.maxEntrySize = options.maxEntrySize; + this.logging = logging; + /** + * @name Log#name + * @type {string} + */ + this.name = this.formattedName_.split('/').pop(); + this.jsonFieldsToTruncate = [ + // Winston: + 'jsonPayload.fields.metadata.structValue.fields.stack.stringValue', + // Bunyan: + 'jsonPayload.fields.msg.stringValue', + 'jsonPayload.fields.err.structValue.fields.stack.stringValue', + 'jsonPayload.fields.err.structValue.fields.message.stringValue', + // All: + 'jsonPayload.fields.message.stringValue', + ]; + // Prepend all custom fields to be truncated to a list with defaults, thus + // custom fields will be truncated first. Make sure to filter out fields + // which are not in EntryJson.jsonPayload + if (options.jsonFieldsToTruncate !== null && + options.jsonFieldsToTruncate !== undefined) { + const filteredList = options.jsonFieldsToTruncate.filter(str => str !== null && + !this.jsonFieldsToTruncate.includes(str) && + str.startsWith('jsonPayload')); + const uniqueSet = new Set(filteredList); + this.jsonFieldsToTruncate = Array.from(uniqueSet).concat(this.jsonFieldsToTruncate); + } + /** + * The default callback for {@link Log#write} and {@link Log#delete} APIs + * is going to be used only when {@link LogOptions#defaultWriteDeleteCallback} + * was set by user and only for APIs which does not accept a callback as parameter + */ + this.defaultWriteDeleteCallback = options.defaultWriteDeleteCallback; + /** + Turning partialSuccess by default to be true if not provided in options. This should improve + overall logging reliability since only oversized entries will be dropped + from request. See {@link https://cloud.google.com/logging/quotas#log-limits} for more info + */ + this.partialSuccess = (_a = options.partialSuccess) !== null && _a !== void 0 ? _a : true; + } + alert(entry, options) { + return this.write((0, log_common_1.assignSeverityToEntries)(entry, 'ALERT'), options); + } + critical(entry, options) { + return this.write((0, log_common_1.assignSeverityToEntries)(entry, 'CRITICAL'), options); + } + debug(entry, options) { + return this.write((0, log_common_1.assignSeverityToEntries)(entry, 'DEBUG'), options); + } + async delete(gaxOptions) { + const projectId = await this.logging.auth.getProjectId(); + this.formattedName_ = (0, log_common_1.formatLogName)(projectId, this.name); + const reqOpts = { + logName: this.formattedName_, + }; + return this.logging.loggingService.deleteLog(reqOpts, gaxOptions, this.defaultWriteDeleteCallback); + } + emergency(entry, options) { + return this.write((0, log_common_1.assignSeverityToEntries)(entry, 'EMERGENCY'), options); + } + entry(metadataOrData, data) { + let metadata; + if (!data && + metadataOrData !== null && + Object.prototype.hasOwnProperty.call(metadataOrData, 'httpRequest')) { + // If user logs entry(metadata.httpRequest) + metadata = metadataOrData; + data = {}; + } + else if (!data) { + // If user logs entry(message) + data = metadataOrData; + metadata = {}; + } + else { + // If user logs entry(metadata, message) + metadata = metadataOrData; + } + return this.logging.entry(metadata, data); + } + error(entry, options) { + return this.write((0, log_common_1.assignSeverityToEntries)(entry, 'ERROR'), options); + } + async getEntries(opts) { + const options = extend({}, opts); + const projectId = await this.logging.auth.getProjectId(); + this.formattedName_ = (0, log_common_1.formatLogName)(projectId, this.name); + if (options.filter && !options.filter.includes('logName=')) { + options.filter = `(${options.filter}) AND logName="${this.formattedName_}"`; + } + else if (!options.filter) { + options.filter = `logName="${this.formattedName_}"`; + } + return this.logging.getEntries(options); + } + /** + * This method is a wrapper around {module:logging#getEntriesStream}, but with + * a filter specified to only return {module:logging/entry} objects from this + * log. + * + * @method Log#getEntriesStream + * @param {GetEntriesRequest} [query] Query object for listing entries. + * @returns {ReadableStream} A readable stream that emits {@link Entry} + * instances. + * + * @example + * ``` + * const {Logging} = require('@google-cloud/logging'); + * const logging = new Logging(); + * const log = logging.log('my-log'); + * + * log.getEntriesStream() + * .on('error', console.error) + * .on('data', entry => { + * // `entry` is a Cloud Logging entry object. + * // See the `data` property to read the data from the entry. + * }) + * .on('end', function() { + * // All entries retrieved. + * }); + * + * //- + * // If you anticipate many results, you can end a stream early to prevent + * // unnecessary processing and API requests. + * //- + * log.getEntriesStream() + * .on('data', function(entry) { + * this.end(); + * }); + * ``` + */ + getEntriesStream(options) { + options = extend({ + log: this.name, + }, options); + return this.logging.getEntriesStream(options); + } + /** + * This method is a wrapper around {module:logging#tailEntries}, but with + * a filter specified to only return {module:logging/entry} objects from this + * log. + * + * @method Log#tailEntries + * @param {TailEntriesRequest} [query] Query object for tailing entries. + * @returns {DuplexStream} A duplex stream that emits TailEntriesResponses + * containing an array of {@link Entry} instances. + * + * @example + * ``` + * const {Logging} = require('@google-cloud/logging'); + * const logging = new Logging(); + * const log = logging.log('my-log'); + * + * log.tailEntries() + * .on('error', console.error) + * .on('data', resp => { + * console.log(resp.entries); + * console.log(resp.suppressionInfo); + * }) + * .on('end', function() { + * // All entries retrieved. + * }); + * + * //- + * // If you anticipate many results, you can end a stream early to prevent + * // unnecessary processing and API requests. + * //- + * log.tailEntries() + * .on('data', function(entry) { + * this.end(); + * }); + * ``` + */ + tailEntries(options) { + options = extend({ + log: this.name, + }, options); + return this.logging.tailEntries(options); + } + info(entry, options) { + return this.write((0, log_common_1.assignSeverityToEntries)(entry, 'INFO'), options); + } + notice(entry, options) { + return this.write((0, log_common_1.assignSeverityToEntries)(entry, 'NOTICE'), options); + } + warning(entry, options) { + return this.write((0, log_common_1.assignSeverityToEntries)(entry, 'WARNING'), options); + } + async write(entry, opts) { + var _a, _b, _c; + const options = opts ? opts : {}; + // Extract projectId & resource from Logging - inject & memoize if not. + await this.logging.setProjectId(); + this.formattedName_ = (0, log_common_1.formatLogName)(this.logging.projectId, this.name); + const resource = await this.getOrSetResource(options); + // Extract & format additional context from individual entries. Make sure to add instrumentation info + const info = (0, instrumentation_1.populateInstrumentationInfo)(entry); + const decoratedEntries = this.decorateEntries(info[0]); + // If instrumentation info was added or this.partialSuccess was set, make sure we set + // partialSuccess in outgoing write request, so entire request will make it through and + // only oversized entries will be dropped if any + if (info[1] || ((_a = options.partialSuccess) !== null && _a !== void 0 ? _a : this.partialSuccess)) { + options.partialSuccess = true; + } + this.truncateEntries(decoratedEntries); + // Clobber `labels` and `resource` fields with WriteOptions from the user. + const reqOpts = extend({ + logName: this.formattedName_, + entries: decoratedEntries, + resource, + }, options); + delete reqOpts.gaxOptions; + // Propagate maxRetries properly into writeLogEntries call + if (!((_b = options.gaxOptions) === null || _b === void 0 ? void 0 : _b.maxRetries) && ((_c = this.logging.options) === null || _c === void 0 ? void 0 : _c.maxRetries)) { + options.gaxOptions = extend({ + maxRetries: this.logging.options.maxRetries, + }, options.gaxOptions); + } + return this.logging.loggingService.writeLogEntries(reqOpts, options.gaxOptions, this.defaultWriteDeleteCallback); + } + /** + * getOrSetResource looks for GCP service context first at the user + * declaration level (snakecasing keys), then in the Logging instance, + * before finally detecting a resource from the environment. + * The resource is then memoized at the Logging instance level for future use. + * + * @param options + * @private + */ + async getOrSetResource(options) { + if (options.resource) { + if (options.resource.labels) + (0, log_common_1.snakecaseKeys)(options.resource.labels); + return options.resource; + } + await this.logging.setDetectedResource(); + return this.logging.detectedResource; + } + /** + * All entries are passed through here in order be formatted and serialized. + * User provided Entry values are formatted per LogEntry specifications. + * Read more about the LogEntry format: + * https://cloud.google.com/logging/docs/reference/v2/rest/v2/LogEntry + * + * @private + * + * @param {object[]} entries - Entry objects. + * @returns {object[]} Serialized entries. + * @throws if there is an error during serialization. + */ + decorateEntries(entries) { + return entries.map(entry => { + if (!(entry instanceof entry_1.Entry)) { + entry = this.entry(entry); + } + return entry.toJSON({ + removeCircular: this.removeCircular_, + }, this.logging.projectId); + }); + } + // TODO consider refactoring `truncateEntries` so that it does not mutate + /** + * Truncate log entries at maxEntrySize, so that error is not thrown, see: + * https://cloud.google.com/logging/quotas + * + * @private + * + * @param {object|string} the JSON log entry. + * @returns {object|string} truncated JSON log entry. + */ + truncateEntries(entries) { + return entries.forEach(entry => { + if (this.maxEntrySize === undefined) + return; + const payloadSize = JSON.stringify(entry).length; + if (payloadSize < this.maxEntrySize) + return; + let delta = payloadSize - this.maxEntrySize; + if (entry.textPayload) { + entry.textPayload = entry.textPayload.slice(0, Math.max(entry.textPayload.length - delta, 0)); + } + else { + for (const field of this.jsonFieldsToTruncate) { + const msg = dotProp.get(entry, field, ''); + if (msg !== null && msg !== undefined && msg !== '') { + dotProp.set(entry, field, msg.slice(0, Math.max(msg.length - delta, 0))); + delta -= Math.min(msg.length, delta); + if (delta <= 0) { + break; + } + } + } + } + }); + } + // TODO: in a future breaking release, delete this extranenous function. + /** + * Return an array of log entries with the desired severity assigned. + * + * @private + * + * @param {object|object[]} entries - Log entries. + * @param {string} severity - The desired severity level. + */ + static assignSeverityToEntries_(entries, severity) { + return (0, log_common_1.assignSeverityToEntries)(entries, severity); + } + // TODO: in a future breaking release, delete this extranenous function. + /** + * Format the name of a log. A log's full name is in the format of + * 'projects/{projectId}/logs/{logName}'. + * + * @private + * + * @returns {string} + */ + static formatName_(projectId, name) { + return (0, log_common_1.formatLogName)(projectId, name); + } +} +exports.Log = Log; +/*! Developer Documentation + * + * All async methods (except for streams) will call a callback in the event + * that a callback is provided . + */ +(0, promisify_1.callbackifyAll)(Log, { exclude: ['entry', 'getEntriesStream'] }); +//# sourceMappingURL=log.js.map + +/***/ }), + +/***/ 11471: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +/*! + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +__exportStar(__nccwpck_require__(53282), exports); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 53282: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/*! + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.makeMiddleware = makeMiddleware; +const onFinished = __nccwpck_require__(5698); +const context_1 = __nccwpck_require__(30734); +const http_request_1 = __nccwpck_require__(53293); +/** + * Generates an express middleware that installs a request-specific logger on + * the `request` object. It optionally can do HttpRequest timing that can be + * used for generating request logs. This can be used to integrate with logging + * libraries such as winston and bunyan. + * + * @param projectId Generated traceIds will be associated with this project. + * @param makeChildLogger A function that generates logger instances that will + * be installed onto `req` as `req.log`. The logger should include the trace in + * each log entry's metadata (associated with the LOGGING_TRACE_KEY property. + * @param emitRequestLog Optional. A function that will emit a parent request + * log. While some environments like GAE and GCF emit parent request logs + * automatically, other environments do not. When provided this function will be + * called with a populated `CloudLoggingHttpRequest` which can be emitted as + * request log. + */ +function makeMiddleware(projectId, makeChildLogger, emitRequestLog) { + return (req, res, next) => { + // TODO(ofrobots): use high-resolution timer. + const requestStartMs = Date.now(); + // Detect & establish context if we were the first actor to detect lack of + // context so traceContext is always available when using middleware. + const traceContext = (0, context_1.getOrInjectContext)(req, projectId, true); + // Install a child logger on the request object, with detected trace and + // span. + req.log = makeChildLogger(traceContext.trace, traceContext.spanId, traceContext.traceSampled); + // Emit a 'Request Log' on the parent logger, with detected trace and + // span. + if (emitRequestLog) { + onFinished(res, () => { + const latencyMs = Date.now() - requestStartMs; + const httpRequest = (0, http_request_1.makeHttpRequestData)(req, res, latencyMs); + emitRequestLog(httpRequest, traceContext.trace, traceContext.spanId, traceContext.traceSampled); + }); + } + next(); + }; +} +//# sourceMappingURL=make-middleware.js.map + +/***/ }), + +/***/ 29804: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/*! + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.express = void 0; +const express = __nccwpck_require__(11471); +exports.express = express; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 35068: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/*! + * Copyright 2015 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Sink = void 0; +const promisify_1 = __nccwpck_require__(60206); +const extend = __nccwpck_require__(23860); +/** + * A sink is an object that lets you to specify a set of log entries to export + * to a particular destination. Cloud Logging lets you export log entries + * to destinations including Cloud Storage buckets (for long term log + * storage), Google BigQuery datasets (for log analysis), Google Pub/Sub (for + * streaming to other applications). + * + * See {@link https://cloud.google.com/logging/docs/basic-concepts#sinks|Introduction to Sinks} + * + * @class + * + * @param {Logging} logging {@link Logging} instance. + * @param {string} name Name of the sink. + * + * @example + * ``` + * const {Logging} = require('@google-cloud/logging'); + * const logging = new Logging(); + * const sink = logging.sink('my-sink'); + * ``` + */ +class Sink { + constructor(logging, name) { + this.logging = logging; + /** + * @name Sink#name + * @type {string} + */ + this.name = name; + this.formattedName_ = 'projects/' + logging.projectId + '/sinks/' + name; + } + create(config) { + return this.logging.createSink(this.name, config); + } + async delete(gaxOptions) { + const projectId = await this.logging.auth.getProjectId(); + this.formattedName_ = 'projects/' + projectId + '/sinks/' + this.name; + const reqOpts = { + sinkName: this.formattedName_, + }; + return this.logging.configService.deleteSink(reqOpts, gaxOptions); + } + async getMetadata(gaxOptions) { + const projectId = await this.logging.auth.getProjectId(); + this.formattedName_ = 'projects/' + projectId + '/sinks/' + this.name; + const reqOpts = { + sinkName: this.formattedName_, + }; + [this.metadata] = await this.logging.configService.getSink(reqOpts, gaxOptions); + return [this.metadata]; + } + setFilter(filter) { + return this.setMetadata({ + filter, + }); + } + async setMetadata(metadata) { + const [currentMetadata] = await this.getMetadata(); + const uniqueWriterIdentity = metadata.uniqueWriterIdentity; + delete metadata.uniqueWriterIdentity; + let reqOpts = { + sinkName: this.formattedName_, + sink: extend({}, currentMetadata, metadata), + }; + delete reqOpts.sink.gaxOptions; + // Add user specified uniqueWriterIdentity boolean, if any. + reqOpts = { + ...reqOpts, + ...(uniqueWriterIdentity && { uniqueWriterIdentity }), + }; + [this.metadata] = await this.logging.configService.updateSink(reqOpts, metadata.gaxOptions); + return [this.metadata]; + } +} +exports.Sink = Sink; +/*! Developer Documentation + * + * All async methods (except for streams) will call a callbakc in the event + * that a callback is provided. + */ +(0, promisify_1.callbackifyAll)(Sink); +//# sourceMappingURL=sink.js.map + +/***/ }), + +/***/ 39240: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/*! + * Copyright 2015 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ObjectToStructConverter = void 0; +exports.objToStruct = objToStruct; +exports.structToObj = structToObj; +exports.decodeValue = decodeValue; +exports.zuluToDateObj = zuluToDateObj; +exports.toNanosAndSecondsObj = toNanosAndSecondsObj; +function objToStruct(obj, options) { + return new ObjectToStructConverter(options).convert(obj); +} +class ObjectToStructConverter { + /** + * A class that can be used to convert an object to a struct. Optionally this + * class can be used to erase/throw on circular references during conversion. + * + * @private + * + * @param {object=} options - Configuration object. + * @param {boolean} options.removeCircular - Remove circular references in the + * object with a placeholder string. (Default: `false`) + * @param {boolean} options.stringify - Stringify un-recognized types. (Default: + * `false`) + */ + constructor(options) { + options = options || {}; + this.seenObjects = new Set(); + this.removeCircular = options.removeCircular === true; + this.stringify = options.stringify === true; + } + /** + * Begin the conversion process from a JS object to an encoded gRPC Value + * message. + * + * @param {*} value - The input value. + * @return {object} - The encoded value. + * + * @example + * ``` + * ObjectToStructConverter.convert({ + * aString: 'Hi' + * }); + * // { + * // fields: { + * // aString: { + * // stringValue: 'Hello!' + * // } + * // } + * // } + * ``` + */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + convert(obj) { + const convertedObject = { + fields: {}, + }; + this.seenObjects.add(obj); + for (const prop in obj) { + if (Object.prototype.hasOwnProperty.call(obj, prop)) { + const value = obj[prop]; + if (value === undefined) { + continue; + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any + convertedObject.fields[prop] = this.encodeValue_(value); + } + } + this.seenObjects.delete(obj); + return convertedObject; + } + /** + * Convert a raw value to a type-denoted protobuf message-friendly object. + * + * @private + * + * @param {*} value - The input value. + * @return {*} - The encoded value. + * + * @example + * ``` + * ObjectToStructConverter.encodeValue('Hi'); + * // { + * // stringValue: 'Hello!' + * // } + * ``` + */ + // eslint-disable-next-line @typescript-eslint/no-explicit-any + encodeValue_(value) { + let convertedValue; + if (value === null) { + convertedValue = { + nullValue: 0, + }; + } + else if (typeof value === 'number') { + convertedValue = { + numberValue: value, + }; + } + else if (typeof value === 'string') { + convertedValue = { + stringValue: value, + }; + } + else if (typeof value === 'boolean') { + convertedValue = { + boolValue: value, + }; + } + else if (Buffer.isBuffer(value)) { + convertedValue = { + blobValue: value, + }; + } + else if (Array.isArray(value)) { + convertedValue = { + listValue: { + values: value.map(this.encodeValue_.bind(this)), + }, + }; + } + else if (Object.prototype.toString.call(value) === '[object Object]') { + if (this.seenObjects.has(value)) { + // Circular reference. + if (!this.removeCircular) { + throw new Error([ + 'This object contains a circular reference. To automatically', + 'remove it, set the `removeCircular` option to true.', + ].join(' ')); + } + convertedValue = { + stringValue: '[Circular]', + }; + } + else { + convertedValue = { + structValue: this.convert(value), + }; + } + } + else { + if (!this.stringify) { + throw new Error('Value of type ' + typeof value + ' not recognized.'); + } + convertedValue = { + stringValue: String(value), + }; + } + return convertedValue; + } +} +exports.ObjectToStructConverter = ObjectToStructConverter; +/** + * Condense a protobuf Struct into an object of only its values. + * + * @private + * + * @param {object} struct - A protobuf Struct message. + * @return {object} - The simplified object. + * + * @example + * ``` + * GrpcService.structToObj_({ + * fields: { + * name: { + * kind: 'stringValue', + * stringValue: 'Stephen' + * } + * } + * }); + * // { + * // name: 'Stephen' + * // } + * ``` + */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function structToObj(struct) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const convertedObject = {}; + for (const prop in struct.fields) { + // eslint-disable-next-line no-prototype-builtins + if (struct.fields.hasOwnProperty(prop)) { + const value = struct.fields[prop]; + convertedObject[prop] = decodeValue(value); + } + } + return convertedObject; +} +/** + * Decode a protobuf Struct's value. + * + * @param {object} value - A Struct's Field message. + * @return {*} - The decoded value. + */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function decodeValue(value) { + switch (value.kind) { + case 'structValue': { + return structToObj(value.structValue); + } + case 'nullValue': { + return null; + } + case 'listValue': { + return value.listValue.values.map(decodeValue); + } + default: { + return value[value.kind]; + } + } +} +/** + * zuluToDateObj RFC3339 "Zulu" timestamp into a format that can be parsed to + * a JS Date Object. + * @param zuluTime + */ +function zuluToDateObj(zuluTime) { + var _a; + const ms = Date.parse(zuluTime.split(/[.,Z]/)[0] + 'Z'); + const reNano = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.(\d{0,9})Z$/; + const nanoSecs = (_a = zuluTime.match(reNano)) === null || _a === void 0 ? void 0 : _a[1]; + return { + seconds: ms ? Math.floor(ms / 1000) : 0, + nanos: nanoSecs ? Number(nanoSecs.padEnd(9, '0')) : 0, + }; +} +/** + * Converts Date to nanoseconds format suported by Logging. + * See https://cloud.google.com/logging/docs/agent/logging/configuration#timestamp-processing for more details + * @param date The date to be converted to Logging nanos and seconds format + */ +function toNanosAndSecondsObj(date) { + const seconds = date.getTime() / 1000; + const secondsRounded = Math.floor(seconds); + return { + seconds: secondsRounded, + nanos: Math.floor((seconds - secondsRounded) * 1e9), + }; +} +//# sourceMappingURL=common.js.map + +/***/ }), + +/***/ 30734: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/*! + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.W3C_TRACE_PARENT_HEADER = exports.X_CLOUD_TRACE_HEADER = void 0; +exports.makeHeaderWrapper = makeHeaderWrapper; +exports.getOrInjectContext = getOrInjectContext; +exports.getContextFromOtelContext = getContextFromOtelContext; +exports.getContextFromXCloudTrace = getContextFromXCloudTrace; +exports.getContextFromTraceParent = getContextFromTraceParent; +exports.parseXCloudTraceHeader = parseXCloudTraceHeader; +exports.parseTraceParentHeader = parseTraceParentHeader; +const uuid = __nccwpck_require__(12048); +const crypto = __nccwpck_require__(76982); +const api_1 = __nccwpck_require__(63914); +/** Header that carries span context across Google infrastructure. */ +exports.X_CLOUD_TRACE_HEADER = 'x-cloud-trace-context'; +const SPAN_ID_RANDOM_BYTES = 8; +const spanIdBuffer = Buffer.alloc(SPAN_ID_RANDOM_BYTES); +const randomFillSync = crypto.randomFillSync; +const randomBytes = crypto.randomBytes; +const spanRandomBuffer = randomFillSync + ? () => randomFillSync(spanIdBuffer) + : () => randomBytes(SPAN_ID_RANDOM_BYTES); +/** Header that carries span context across W3C compliant infrastructure. */ +exports.W3C_TRACE_PARENT_HEADER = 'traceparent'; +/** + * makeHeaderWrapper returns a wrapper with set and get header functionality, + * returning null if the incoming request object doesn't contain the 'header' + * propery. + * @param req + */ +function makeHeaderWrapper(req) { + if (!req.headers) + return null; + const wrapper = { + setHeader(name, value) { + req.headers[name] = value; + }, + getHeader(name) { + return req.headers[name]; + }, + }; + return wrapper; +} +/** + * getOrInjectContext returns a CloudTraceContext with as many available trace + * and span properties as possible. It examines HTTP headers for trace context. + * Optionally, it can inject a Google compliant trace context when no context is + * available from headers. + * + * @param req + * @param projectId + * @param inject + */ +function getOrInjectContext(req, projectId, inject) { + const defaultContext = toCloudTraceContext({}, projectId); + // Get trace context from OpenTelemetry span context. + const otelContext = getContextFromOtelContext(projectId); + if (otelContext) + return otelContext; + const wrapper = makeHeaderWrapper(req); + if (wrapper) { + // Detect 'traceparent' header. + const traceContext = getContextFromTraceParent(wrapper, projectId); + if (traceContext) + return traceContext; + // Detect 'X-Cloud-Trace-Context' header. + const cloudContext = getContextFromXCloudTrace(wrapper, projectId); + if (cloudContext) + return cloudContext; + // Optional: Generate and inject a context for the user as last resort. + if (inject) { + wrapper.setHeader(exports.X_CLOUD_TRACE_HEADER, makeCloudTraceHeader()); + return getContextFromXCloudTrace(wrapper, projectId); + } + } + return defaultContext; +} +/** + * toCloudTraceContext converts any context format to cloudTraceContext format. + * @param context + * @param projectId + */ +function toCloudTraceContext( +// eslint-disable-next-line @typescript-eslint/no-explicit-any +anyContext, projectId) { + const context = { + trace: '', + }; + if (anyContext === null || anyContext === void 0 ? void 0 : anyContext.trace) { + context.trace = `projects/${projectId}/traces/${anyContext.trace}`; + } + if (anyContext === null || anyContext === void 0 ? void 0 : anyContext.spanId) { + context.spanId = anyContext.spanId; + } + if ('traceSampled' in anyContext) { + context.traceSampled = anyContext.traceSampled; + } + return context; +} +/** + * makeCloudTraceHeader generates valid X-Cloud-Trace-Context trace and spanId. + */ +function makeCloudTraceHeader() { + const trace = uuid.v4().replace(/-/g, ''); + const spanId = spanRandomBuffer().toString('hex'); + return `${trace}/${spanId}`; +} +/** + * getContextFromOtelContext looks for the active open telemetry span context + * per Open Telemetry specifications for tracing contexts. + * + * @param projectId + */ +function getContextFromOtelContext(projectId) { + var _a; + const spanContext = (_a = api_1.trace.getActiveSpan()) === null || _a === void 0 ? void 0 : _a.spanContext(); + const FLAG_SAMPLED = 1; // 00000001 + if (spanContext !== undefined && (0, api_1.isSpanContextValid)(spanContext)) { + const otelSpanContext = { + trace: spanContext === null || spanContext === void 0 ? void 0 : spanContext.traceId, + spanId: spanContext === null || spanContext === void 0 ? void 0 : spanContext.spanId, + traceSampled: (spanContext.traceFlags & FLAG_SAMPLED) !== 0, + }; + return toCloudTraceContext(otelSpanContext, projectId); + } + return null; +} +/** + * getContextFromXCloudTrace looks for the HTTP header 'x-cloud-trace-context' + * per Google Cloud specifications for Cloud Tracing. + * + * @param headerWrapper + * @param projectId + */ +function getContextFromXCloudTrace(headerWrapper, projectId) { + const context = parseXCloudTraceHeader(headerWrapper); + if (!context) + return null; + return toCloudTraceContext(context, projectId); +} +/** + * getOrInjectTraceParent looks for the HTTP header 'traceparent' + * per W3C specifications for OpenTelemetry and OpenCensus + * Read more about W3C protocol: https://www.w3.org/TR/trace-context/ + * + * @param headerWrapper + * @param projectId + */ +function getContextFromTraceParent(headerWrapper, projectId) { + const context = parseTraceParentHeader(headerWrapper); + if (!context) + return null; + return toCloudTraceContext(context, projectId); +} +/** + * parseXCloudTraceHeader looks for trace context in `X-Cloud-Trace-Context` + * header + * @param headerWrapper + */ +function parseXCloudTraceHeader(headerWrapper) { + var _a; + const regex = /([a-f\d]+)?(\/?([a-f\d]+))?(;?o=(\d))?/; + const match = (_a = headerWrapper + .getHeader(exports.X_CLOUD_TRACE_HEADER)) === null || _a === void 0 ? void 0 : _a.toString().match(regex); + if (!match) + return null; + return { + trace: match[1], + spanId: match[3], + traceSampled: match[5] === '1', + }; +} +/** + * parseTraceParentHeader is a custom implementation of the `parseTraceParent` + * function in @opentelemetry-core/trace. + * For more information see {@link https://www.w3.org/TR/trace-context/} + * @param headerWrapper + */ +function parseTraceParentHeader(headerWrapper) { + var _a; + const VERSION_PART = '(?!ff)[\\da-f]{2}'; + const TRACE_ID_PART = '(?![0]{32})[\\da-f]{32}'; + const PARENT_ID_PART = '(?![0]{16})[\\da-f]{16}'; + const FLAGS_PART = '[\\da-f]{2}'; + const TRACE_PARENT_REGEX = new RegExp(`^\\s?(${VERSION_PART})-(${TRACE_ID_PART})-(${PARENT_ID_PART})-(${FLAGS_PART})(-.*)?\\s?$`); + const match = (_a = headerWrapper + .getHeader(exports.W3C_TRACE_PARENT_HEADER)) === null || _a === void 0 ? void 0 : _a.toString().match(TRACE_PARENT_REGEX); + if (!match) + return null; + // According to the specification the implementation should be compatible + // with future versions. If there are more parts, we only reject it if it's using version 00 + // See https://www.w3.org/TR/trace-context/#versioning-of-traceparent + if (match[1] === '00' && match[5]) + return null; + return { + trace: match[2], + spanId: match[3], + traceSampled: (parseInt(match[4], 16) & 1) === 1, + }; +} +//# sourceMappingURL=context.js.map + +/***/ }), + +/***/ 53293: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/*! + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.makeHttpRequestData = makeHttpRequestData; +exports.isRawHttpRequest = isRawHttpRequest; +/** + * makeHttpRequestData turns raw incoming HTTPRequests into structured + * HTTPRequest objects interpreted by Cloud Logging. + * + * @param req + * @param res + * @param latencyMilliseconds + */ +function makeHttpRequestData(req, res, latencyMilliseconds) { + let requestUrl, protocol, requestMethod, userAgent, referer, status, responseSize, latency; + // Format request properties + if (req.url) + requestUrl = req.url; + // OriginalURL overwrites inferred url + if ('originalUrl' in req && req.originalUrl) + requestUrl = req.originalUrl; + // Format protocol from valid URL + if (requestUrl) { + try { + const url = new URL(requestUrl); + protocol = url.protocol; + } + catch (e) { + // Library should not panic + } + } + req.method ? (requestMethod = req.method) : null; + if (req.headers && req.headers['user-agent']) { + req.headers['user-agent'] ? (userAgent = req.headers['user-agent']) : null; + req.headers['referer'] ? (referer = req.headers['referer']) : null; + } + // Format response properties + if (res) { + res.statusCode ? (status = res.statusCode) : null; + responseSize = + (res.getHeader && Number(res.getHeader('Content-Length'))) || 0; + } + // Format latency + if (latencyMilliseconds) { + latency = { + seconds: Math.floor(latencyMilliseconds / 1e3), + nanos: Math.floor((latencyMilliseconds % 1e3) * 1e6), + }; + } + // Only include the property if its value exists + return Object.assign({}, requestUrl ? { requestUrl } : null, protocol ? { protocol } : null, requestMethod ? { requestMethod } : null, userAgent ? { userAgent } : null, referer ? { referer } : null, responseSize ? { responseSize } : null, status ? { status } : null, latency ? { latency } : null); +} +/** + * isRawHttpRequest detects whether a request object extends the + * http.IncomingMessage class. It should return true on HTTP compliant requests + * and all requests created by an http.Server. + * + * @param req + */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function isRawHttpRequest(req) { + if (req && + ('originalUrl' in req || + 'headers' in req || + 'method' in req || + 'url' in req)) { + return true; + } + return false; +} +//# sourceMappingURL=http-request.js.map + +/***/ }), + +/***/ 49543: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/*! + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.MAX_INSTRUMENTATION_COUNT = exports.NODEJS_DEFAULT_LIBRARY_VERSION = exports.NODEJS_LIBRARY_NAME_PREFIX = exports.INSTRUMENTATION_SOURCE_KEY = exports.DIAGNOSTIC_INFO_KEY = void 0; +exports.populateInstrumentationInfo = populateInstrumentationInfo; +exports.createDiagnosticEntry = createDiagnosticEntry; +exports.getNodejsLibraryVersion = getNodejsLibraryVersion; +exports.setInstrumentationStatus = setInstrumentationStatus; +const arrify = __nccwpck_require__(26251); +const entry_1 = __nccwpck_require__(49679); +// The global variable keeping track if instrumentation record was already written or not. +// The instrumentation record should be generated only once per process and contain logging +// libraries related info. +global.instrumentationAdded = false; +// The global variable to avoid records inspection once instrumentation already written to prevent perf impact +global.shouldSkipInstrumentationCheck = false; +// Max length for instrumentation library name and version values +const maxDiagnosticValueLen = 14; +exports.DIAGNOSTIC_INFO_KEY = 'logging.googleapis.com/diagnostic'; +exports.INSTRUMENTATION_SOURCE_KEY = 'instrumentation_source'; +exports.NODEJS_LIBRARY_NAME_PREFIX = 'nodejs'; +/** + * Default library version to be used + * Using release-please annotations to update DEFAULT_INSTRUMENTATION_VERSION with latest version. + * See https://github.com/googleapis/release-please/blob/main/docs/customizing.md#updating-arbitrary-files + */ +exports.NODEJS_DEFAULT_LIBRARY_VERSION = '11.2.1'; // {x-release-please-version} +exports.MAX_INSTRUMENTATION_COUNT = 3; +/** + * This method helps to populate entries with instrumentation data + * @param entry {Entry} The entry or array of entries to be populated with instrumentation info + * @returns [Entry[], boolean] Array of entries which contains an entry with current library + * instrumentation info and boolean flag indicating if instrumentation was added or not in this call + */ +function populateInstrumentationInfo(entry) { + var _a, _b; + // Check if instrumentation data was already written once. This prevents also inspection of + // the entries for instrumentation data to prevent perf degradation + if (global.shouldSkipInstrumentationCheck) { + return [arrify(entry), false]; + } + // Update the flag indicating that instrumentation entry was already added once, + // so any subsequent calls to this method will not add a separate instrumentation log entry + let isWritten = setInstrumentationStatus(true); + // Flag keeping track if this specific call added any instrumentation info + let isInfoAdded = false; + const entries = []; + if (entry) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + for (const entryItem of arrify(entry)) { + if (entryItem) { + const info = (_b = (_a = entryItem.data) === null || _a === void 0 ? void 0 : _a[exports.DIAGNOSTIC_INFO_KEY]) === null || _b === void 0 ? void 0 : _b[exports.INSTRUMENTATION_SOURCE_KEY]; + if (info) { + // Validate and update the instrumentation info with current library info + entryItem.data[exports.DIAGNOSTIC_INFO_KEY][exports.INSTRUMENTATION_SOURCE_KEY] = + validateAndUpdateInstrumentation(info); + // Indicate that instrumentation info log entry already exists + // and that current library info was added to existing log entry + global.shouldSkipInstrumentationCheck = + isInfoAdded = + isWritten = + true; + } + entries.push(entryItem); + } + } + } + // If no instrumentation info was added before, append a separate log entry with + // instrumentation data for this library + if (!isWritten) { + entries.push(createDiagnosticEntry(undefined, undefined)); + global.shouldSkipInstrumentationCheck = isInfoAdded = true; + } + return [entries, isInfoAdded]; +} +/** + * The helper method to generate a log entry with diagnostic instrumentation data. + * @param libraryName {string} The name of the logging library to be reported. Should be prefixed with 'nodejs'. + * Will be truncated if longer than 14 characters. + * @param libraryVersion {string} The version of the logging library to be reported. Will be truncated if longer than 14 characters. + * @returns {Entry} The entry with diagnostic instrumentation data. + */ +function createDiagnosticEntry(libraryName, libraryVersion) { + // Validate the libraryName first and make sure it starts with 'nodejs' prefix. + if (!libraryName || !libraryName.startsWith(exports.NODEJS_LIBRARY_NAME_PREFIX)) { + libraryName = exports.NODEJS_LIBRARY_NAME_PREFIX; + } + const entry = new entry_1.Entry(undefined, { + [exports.DIAGNOSTIC_INFO_KEY]: { + [exports.INSTRUMENTATION_SOURCE_KEY]: [ + { + // Truncate libraryName and libraryVersion if more than 14 characters length + name: truncateValue(libraryName, maxDiagnosticValueLen), + version: truncateValue(libraryVersion !== null && libraryVersion !== void 0 ? libraryVersion : getNodejsLibraryVersion(), maxDiagnosticValueLen), + }, + ], + }, + }); + return entry; +} +/** + * This method validates that provided instrumentation info list is valid and also adds current library info to a list. + * @param infoList {InstrumentationInfo} The array of InstrumentationInfo to be validated and updated. + * @returns {InstrumentationInfo} The updated list of InstrumentationInfo. + */ +function validateAndUpdateInstrumentation(infoList) { + const finalInfo = []; + // First, iterate through given list of libraries and for each entry perform validations and transformations. + // Limit amount of entries to be up to MAX_INSTRUMENTATION_COUNT + let count = 1; + for (const info of infoList) { + if (isValidInfo(info)) { + finalInfo.push({ + name: truncateValue(info.name, maxDiagnosticValueLen), + version: truncateValue(info.version, maxDiagnosticValueLen), + }); + if (++count === exports.MAX_INSTRUMENTATION_COUNT) + break; + } + } + // Finally, add current library information to be the last entry added + finalInfo.push({ + name: exports.NODEJS_LIBRARY_NAME_PREFIX, + version: getNodejsLibraryVersion(), + }); + return finalInfo; +} +/** + * A helper function to truncate a value (library name or version for example). The value is truncated + * when it is longer than {maxLen} chars and '*' is added instead of truncated suffix. + * @param value {object|string} The value to be truncated. + * @param maxLen {number} The max length to be used for truncation. + * @returns {string} The truncated value. + */ +function truncateValue(value, maxLen) { + // Currently there are cases when we get here JSON object instead of string + // Adding here additional validation to see if version still can be retrieved + if (typeof value !== 'string') { + try { + if (Object.prototype.hasOwnProperty.call(value, 'version')) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + value = value.version; + } + } + catch (err) { + // Ignore error since flow should continue + } + } + // Return NODEJS_DEFAULT_LIBRARY_VERSION if version cannot be retrieved + if (typeof value !== 'string') { + return exports.NODEJS_DEFAULT_LIBRARY_VERSION; + } + if (value && value.length > maxLen) { + return value.substring(0, maxLen).concat('*'); + } + return value; +} +/** + * The helper function to retrieve current library version from annotated NODEJS_DEFAULT_LIBRARY_VERSION + * @returns {string} A current library version. + */ +function getNodejsLibraryVersion() { + return exports.NODEJS_DEFAULT_LIBRARY_VERSION; +} +/** + * The helper function which checks if given InstrumentationInfo is valid. + * @param info {InstrumentationInfo} The info to be validated. + * @returns true if given info is valid, false otherwise + */ +function isValidInfo(info) { + if (!info || + !info.name || + !info.version || + !info.name.startsWith(exports.NODEJS_LIBRARY_NAME_PREFIX)) { + return false; + } + return true; +} +/** + * The helper method used to set a status of a flag which indicates if instrumentation info already written or not. + * @param value {boolean} The value to be set. + * @returns The value of the flag before it is set. + */ +function setInstrumentationStatus(value) { + const status = global.instrumentationAdded; + global.instrumentationAdded = value; + return status; +} +//# sourceMappingURL=instrumentation.js.map + +/***/ }), + +/***/ 35641: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/*! + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Severity = void 0; +exports.snakecaseKeys = snakecaseKeys; +exports.assignSeverityToEntries = assignSeverityToEntries; +exports.formatLogName = formatLogName; +/** + * Common construct and functions used by both Log and LogSync + */ +const entry_1 = __nccwpck_require__(49679); +const extend = __nccwpck_require__(23860); +const arrify = __nccwpck_require__(26251); +var Severity; +(function (Severity) { + Severity[Severity["emergency"] = 0] = "emergency"; + Severity[Severity["alert"] = 1] = "alert"; + Severity[Severity["critical"] = 2] = "critical"; + Severity[Severity["error"] = 3] = "error"; + Severity[Severity["warning"] = 4] = "warning"; + Severity[Severity["notice"] = 5] = "notice"; + Severity[Severity["info"] = 6] = "info"; + Severity[Severity["debug"] = 7] = "debug"; +})(Severity || (exports.Severity = Severity = {})); +/** + * snakecaseKeys turns label keys from camel case to snake case. + * @param labels + */ +function snakecaseKeys(labels) { + for (const key in labels) { + const replaced = key.replace(/[A-Z]/g, letter => `_${letter.toLowerCase()}`); + Object.defineProperty(labels, replaced, Object.getOwnPropertyDescriptor(labels, key)); + if (replaced !== key) { + delete labels[key]; + } + } + return labels; +} +/** + * Return an array of log entries with the desired severity assigned. + * + * @private + * + * @param {object|object[]} entries - Log entries. + * @param {string} severity - The desired severity level. + */ +function assignSeverityToEntries(entries, severity) { + return arrify(entries).map(entry => { + const metadata = extend(true, {}, entry.metadata, { + severity, + }); + return extend(new entry_1.Entry(), entry, { + metadata, + }); + }); +} +/** + * Format the name of a log. A log's full name is in the format of + * 'projects/{projectId}/logs/{logName}'. + * + * @param projectId + * @param name + */ +function formatLogName(projectId, name) { + const path = 'projects/' + projectId + '/logs/'; + name = name.replace(path, ''); + if (decodeURIComponent(name) === name) { + // The name has not been encoded yet. + name = encodeURIComponent(name); + } + return path + name; +} +//# sourceMappingURL=log-common.js.map + +/***/ }), + +/***/ 45676: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/*! + * Copyright 2016 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.KUBERNETES_NAMESPACE_ID_PATH = void 0; +exports.getCloudFunctionDescriptor = getCloudFunctionDescriptor; +exports.getCloudRunDescriptor = getCloudRunDescriptor; +exports.getGAEDescriptor = getGAEDescriptor; +exports.getGCEDescriptor = getGCEDescriptor; +exports.getGKEDescriptor = getGKEDescriptor; +exports.getGlobalDescriptor = getGlobalDescriptor; +exports.getDefaultResource = getDefaultResource; +exports.detectServiceContext = detectServiceContext; +const fs = __nccwpck_require__(79896); +const gcpMetadata = __nccwpck_require__(23046); +const google_auth_library_1 = __nccwpck_require__(492); +const util_1 = __nccwpck_require__(39023); +const readFile = (0, util_1.promisify)(fs.readFile); +function zoneFromQualifiedZone(qualified) { + // Some parsing is necessary. Metadata service returns a fully + // qualified zone name: 'projects/{projectId}/zones/{zone}'. Logging + // wants just the zone part. + // + return qualified.split('/').pop(); +} +function regionFromQualifiedZone(qualified) { + // Parses the region from the zone. Used for GCF and GCR which dynamically + // allocate zones. + const zone = zoneFromQualifiedZone(qualified); + const region = zone === undefined ? undefined : zone.slice(0, zone.lastIndexOf('-')); + return region; +} +/** + * Create a descriptor for Cloud Functions. + * + * @returns {object} + */ +async function getCloudFunctionDescriptor() { + // If the region is already available via an environment variable, don't delay the function by pinging metaserver. + let region = undefined; + if (!(process.env.GOOGLE_CLOUD_REGION || process.env.FUNCTION_REGION)) { + const qualifiedZone = await gcpMetadata.instance('zone'); + region = regionFromQualifiedZone(qualifiedZone); + } + /** + * In GCF versions after Node 8, K_SERVICE is the preferred way to + * get the function name. We still check for GOOGLE_CLOUD_REGION and FUNCTION_REGION for backwards Node runtime compatibility. + */ + return { + type: 'cloud_function', + labels: { + function_name: process.env.K_SERVICE || process.env.FUNCTION_NAME, + region: process.env.GOOGLE_CLOUD_REGION || + process.env.FUNCTION_REGION || + region, + }, + }; +} +/** + * Create a descriptor for Cloud Run. + * + * @returns {object} + */ +async function getCloudRunDescriptor() { + const qualifiedZone = await gcpMetadata.instance('zone'); + const location = regionFromQualifiedZone(qualifiedZone); + return { + type: 'cloud_run_revision', + labels: { + location, + service_name: process.env.K_SERVICE, + revision_name: process.env.K_REVISION, + configuration_name: process.env.K_CONFIGURATION, + }, + }; +} +/** + * Create a descriptor for Google App Engine. + * + * @returns {object} + */ +async function getGAEDescriptor() { + const qualifiedZone = await gcpMetadata.instance('zone'); + const zone = zoneFromQualifiedZone(qualifiedZone); + return { + type: 'gae_app', + labels: { + module_id: process.env.GAE_SERVICE || process.env.GAE_MODULE_NAME, + version_id: process.env.GAE_VERSION, + zone, + }, + }; +} +/** + * Create a descriptor for Google Compute Engine. + * @return {object} + */ +async function getGCEDescriptor() { + const idResponse = await gcpMetadata.instance('id'); + const zoneResponse = await gcpMetadata.instance('zone'); + // Some parsing is necessary. Metadata service returns a fully + // qualified zone name: 'projects/{projectId}/zones/{zone}'. Logging + // wants just the zone part. + // + const zone = zoneFromQualifiedZone(zoneResponse); + return { + type: 'gce_instance', + labels: { + // idResponse can be BigNumber when the id too large for JavaScript + // numbers. Use a toString() to uniformly convert to a string. + instance_id: idResponse.toString(), + zone, + }, + }; +} +exports.KUBERNETES_NAMESPACE_ID_PATH = '/var/run/secrets/kubernetes.io/serviceaccount/namespace'; +/** + * Create a descriptor for Google Container Engine. + * + * @return {object} + */ +async function getGKEDescriptor() { + // Cloud Logging Monitored Resource for 'container' requires + // cluster_name and namespace_id fields. Note that these *need* to be + // snake_case. The namespace_id is not easily available from inside the + // container, but we can get the namespace_name. Logging has been using the + // namespace_name in place of namespace_id for a while now. Log correlation + // with metrics may not necessarily work however. + // + const resp = await gcpMetadata.instance('attributes/cluster-name'); + const qualifiedZone = await gcpMetadata.instance('zone'); + const location = zoneFromQualifiedZone(qualifiedZone); + let namespace = ''; + try { + namespace = await readFile(exports.KUBERNETES_NAMESPACE_ID_PATH, 'utf8'); + } + catch (err) { + // Ignore errors (leave namespace as a nil string). + } + return { + type: 'k8s_container', + labels: { + location, + cluster_name: resp, + namespace_name: namespace, + pod_name: process.env.HOSTNAME, + // Users must manually supply container name for now. + // This may be autodetected in the future, pending b/145137070. + container_name: process.env.CONTAINER_NAME, + }, + }; +} +/** + * Create a global descriptor. + * + * @returns {object} + */ +function getGlobalDescriptor() { + return { + type: 'global', + }; +} +/** + * Attempt to contact the metadata service and determine, + * based on request success and environment variables, what type of resource + * the library is operating on. + */ +async function getDefaultResource(auth) { + const env = await auth.getEnv(); + switch (env) { + case google_auth_library_1.GCPEnv.KUBERNETES_ENGINE: + return getGKEDescriptor().catch(() => getGlobalDescriptor()); + case google_auth_library_1.GCPEnv.APP_ENGINE: + return getGAEDescriptor().catch(() => getGlobalDescriptor()); + case google_auth_library_1.GCPEnv.CLOUD_FUNCTIONS: + return getCloudFunctionDescriptor().catch(() => getGlobalDescriptor()); + case google_auth_library_1.GCPEnv.CLOUD_RUN: + return getCloudRunDescriptor().catch(() => getGlobalDescriptor()); + case google_auth_library_1.GCPEnv.COMPUTE_ENGINE: + return getGCEDescriptor().catch(() => getGlobalDescriptor()); + default: + return getGlobalDescriptor(); + } +} +/** + * For logged errors, users can provide a service context. This enables errors + * to be picked up Cloud Error Reporting. For more information see + * [this guide]{@link + * https://cloud.google.com/error-reporting/docs/formatting-error-messages} and + * the [official documentation]{@link + * https://cloud.google.com/error-reporting/reference/rest/v1beta1/ServiceContext}. + */ +async function detectServiceContext(auth) { + const env = await auth.getEnv(); + switch (env) { + case google_auth_library_1.GCPEnv.APP_ENGINE: + return { + service: process.env.GAE_SERVICE || process.env.GAE_MODULE_NAME, + version: process.env.GAE_VERSION || process.env.GAE_MODULE_VERSION, + }; + case google_auth_library_1.GCPEnv.CLOUD_FUNCTIONS: + return { + service: process.env.FUNCTION_NAME, + }; + // On Kubernetes we use the pod-name to describe the service. Currently, + // we acquire the pod-name from within the pod through env var `HOSTNAME`. + case google_auth_library_1.GCPEnv.KUBERNETES_ENGINE: + return { + service: process.env.HOSTNAME, + }; + case google_auth_library_1.GCPEnv.CLOUD_RUN: + return { + service: process.env.K_SERVICE, + }; + case google_auth_library_1.GCPEnv.COMPUTE_ENGINE: + return null; + default: + return null; + } +} +//# sourceMappingURL=metadata.js.map + +/***/ }), + +/***/ 46185: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ConfigServiceV2Client = void 0; +const jsonProtos = __nccwpck_require__(82721); +/** + * Client JSON configuration object, loaded from + * `src/v2/config_service_v2_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +const gapicConfig = __nccwpck_require__(61240); +const version = (__nccwpck_require__(38105)/* .version */ .rE); +/** + * Service for configuring sinks used to route log entries. + * @class + * @memberof v2 + */ +class ConfigServiceV2Client { + /** + * Construct an instance of ConfigServiceV2Client. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new ConfigServiceV2Client({fallback: true}, gax); + * ``` + */ + constructor(opts, gaxInstance) { + var _a, _b, _c, _d, _e; + this._terminated = false; + this.descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + // Ensure that options include all the required fields. + const staticMembers = this.constructor; + if ((opts === null || opts === void 0 ? void 0 : opts.universe_domain) && + (opts === null || opts === void 0 ? void 0 : opts.universeDomain) && + (opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== (opts === null || opts === void 0 ? void 0 : opts.universeDomain)) { + throw new Error('Please set either universe_domain or universeDomain, but not both.'); + } + const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + (_c = (_b = (_a = opts === null || opts === void 0 ? void 0 : opts.universeDomain) !== null && _a !== void 0 ? _a : opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== null && _b !== void 0 ? _b : universeDomainEnvVar) !== null && _c !== void 0 ? _c : 'googleapis.com'; + this._servicePath = 'logging.' + this._universeDomain; + const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || this._servicePath; + this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint)); + const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port; + const clientConfig = (_d = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _d !== void 0 ? _d : {}; + const fallback = (_e = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _e !== void 0 ? _e : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = __nccwpck_require__(83232); + } + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + // Save options to use in initialize() method. + this._opts = opts; + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth; + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } + else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } + else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + billingAccountCmekSettingsPathTemplate: new this._gaxModule.PathTemplate('billingAccounts/{billing_account}/cmekSettings'), + billingAccountExclusionPathTemplate: new this._gaxModule.PathTemplate('billingAccounts/{billing_account}/exclusions/{exclusion}'), + billingAccountLocationBucketPathTemplate: new this._gaxModule.PathTemplate('billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}'), + billingAccountLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate('billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/links/{link}'), + billingAccountLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate('billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/views/{view}'), + billingAccountLogPathTemplate: new this._gaxModule.PathTemplate('billingAccounts/{billing_account}/logs/{log}'), + billingAccountSettingsPathTemplate: new this._gaxModule.PathTemplate('billingAccounts/{billing_account}/settings'), + billingAccountSinkPathTemplate: new this._gaxModule.PathTemplate('billingAccounts/{billing_account}/sinks/{sink}'), + folderCmekSettingsPathTemplate: new this._gaxModule.PathTemplate('folders/{folder}/cmekSettings'), + folderExclusionPathTemplate: new this._gaxModule.PathTemplate('folders/{folder}/exclusions/{exclusion}'), + folderLocationBucketPathTemplate: new this._gaxModule.PathTemplate('folders/{folder}/locations/{location}/buckets/{bucket}'), + folderLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate('folders/{folder}/locations/{location}/buckets/{bucket}/links/{link}'), + folderLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate('folders/{folder}/locations/{location}/buckets/{bucket}/views/{view}'), + folderLogPathTemplate: new this._gaxModule.PathTemplate('folders/{folder}/logs/{log}'), + folderSettingsPathTemplate: new this._gaxModule.PathTemplate('folders/{folder}/settings'), + folderSinkPathTemplate: new this._gaxModule.PathTemplate('folders/{folder}/sinks/{sink}'), + locationPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}'), + logMetricPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/metrics/{metric}'), + organizationCmekSettingsPathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}/cmekSettings'), + organizationExclusionPathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}/exclusions/{exclusion}'), + organizationLocationBucketPathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}/locations/{location}/buckets/{bucket}'), + organizationLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}/locations/{location}/buckets/{bucket}/links/{link}'), + organizationLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}/locations/{location}/buckets/{bucket}/views/{view}'), + organizationLogPathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}/logs/{log}'), + organizationSettingsPathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}/settings'), + organizationSinkPathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}/sinks/{sink}'), + projectPathTemplate: new this._gaxModule.PathTemplate('projects/{project}'), + projectCmekSettingsPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/cmekSettings'), + projectExclusionPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/exclusions/{exclusion}'), + projectLocationBucketPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/buckets/{bucket}'), + projectLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/buckets/{bucket}/links/{link}'), + projectLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/buckets/{bucket}/views/{view}'), + projectLogPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/logs/{log}'), + projectSettingsPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/settings'), + projectSinkPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/sinks/{sink}'), + }; + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listBuckets: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'buckets'), + listViews: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'views'), + listSinks: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'sinks'), + listLinks: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'links'), + listExclusions: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'exclusions'), + }; + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // This API contains "long-running operations", which return a + // an Operation object that allows for tracking of the operation, + // rather than holding a request open. + const lroOptions = { + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined, + }; + if (opts.fallback) { + lroOptions.protoJson = protoFilesRoot; + lroOptions.httpRules = [ + { + selector: 'google.longrunning.Operations.CancelOperation', + post: '/v2/{name=*/*/locations/*/operations/*}:cancel', + body: '*', + additional_bindings: [ + { + post: '/v2/{name=projects/*/locations/*/operations/*}:cancel', + body: '*', + }, + { + post: '/v2/{name=organizations/*/locations/*/operations/*}:cancel', + body: '*', + }, + { + post: '/v2/{name=folders/*/locations/*/operations/*}:cancel', + body: '*', + }, + { + post: '/v2/{name=billingAccounts/*/locations/*/operations/*}:cancel', + body: '*', + }, + ], + }, + { + selector: 'google.longrunning.Operations.GetOperation', + get: '/v2/{name=*/*/locations/*/operations/*}', + additional_bindings: [ + { get: '/v2/{name=projects/*/locations/*/operations/*}' }, + { get: '/v2/{name=organizations/*/locations/*/operations/*}' }, + { get: '/v2/{name=folders/*/locations/*/operations/*}' }, + { get: '/v2/{name=billingAccounts/*/locations/*/operations/*}' }, + ], + }, + { + selector: 'google.longrunning.Operations.ListOperations', + get: '/v2/{name=*/*/locations/*}/operations', + additional_bindings: [ + { get: '/v2/{name=projects/*/locations/*}/operations' }, + { get: '/v2/{name=organizations/*/locations/*}/operations' }, + { get: '/v2/{name=folders/*/locations/*}/operations' }, + { get: '/v2/{name=billingAccounts/*/locations/*}/operations' }, + ], + }, + ]; + } + this.operationsClient = this._gaxModule + .lro(lroOptions) + .operationsClient(opts); + const createBucketAsyncResponse = protoFilesRoot.lookup('.google.logging.v2.LogBucket'); + const createBucketAsyncMetadata = protoFilesRoot.lookup('.google.logging.v2.BucketMetadata'); + const updateBucketAsyncResponse = protoFilesRoot.lookup('.google.logging.v2.LogBucket'); + const updateBucketAsyncMetadata = protoFilesRoot.lookup('.google.logging.v2.BucketMetadata'); + const createLinkResponse = protoFilesRoot.lookup('.google.logging.v2.Link'); + const createLinkMetadata = protoFilesRoot.lookup('.google.logging.v2.LinkMetadata'); + const deleteLinkResponse = protoFilesRoot.lookup('.google.protobuf.Empty'); + const deleteLinkMetadata = protoFilesRoot.lookup('.google.logging.v2.LinkMetadata'); + const copyLogEntriesResponse = protoFilesRoot.lookup('.google.logging.v2.CopyLogEntriesResponse'); + const copyLogEntriesMetadata = protoFilesRoot.lookup('.google.logging.v2.CopyLogEntriesMetadata'); + this.descriptors.longrunning = { + createBucketAsync: new this._gaxModule.LongrunningDescriptor(this.operationsClient, createBucketAsyncResponse.decode.bind(createBucketAsyncResponse), createBucketAsyncMetadata.decode.bind(createBucketAsyncMetadata)), + updateBucketAsync: new this._gaxModule.LongrunningDescriptor(this.operationsClient, updateBucketAsyncResponse.decode.bind(updateBucketAsyncResponse), updateBucketAsyncMetadata.decode.bind(updateBucketAsyncMetadata)), + createLink: new this._gaxModule.LongrunningDescriptor(this.operationsClient, createLinkResponse.decode.bind(createLinkResponse), createLinkMetadata.decode.bind(createLinkMetadata)), + deleteLink: new this._gaxModule.LongrunningDescriptor(this.operationsClient, deleteLinkResponse.decode.bind(deleteLinkResponse), deleteLinkMetadata.decode.bind(deleteLinkMetadata)), + copyLogEntries: new this._gaxModule.LongrunningDescriptor(this.operationsClient, copyLogEntriesResponse.decode.bind(copyLogEntriesResponse), copyLogEntriesMetadata.decode.bind(copyLogEntriesMetadata)), + }; + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings('google.logging.v2.ConfigServiceV2', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') }); + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.configServiceV2Stub) { + return this.configServiceV2Stub; + } + // Put together the "service stub" for + // google.logging.v2.ConfigServiceV2. + this.configServiceV2Stub = this._gaxGrpc.createStub(this._opts.fallback + ? this._protos.lookupService('google.logging.v2.ConfigServiceV2') + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._protos.google.logging.v2.ConfigServiceV2, this._opts, this._providedCustomServicePath); + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const configServiceV2StubMethods = [ + 'listBuckets', + 'getBucket', + 'createBucketAsync', + 'updateBucketAsync', + 'createBucket', + 'updateBucket', + 'deleteBucket', + 'undeleteBucket', + 'listViews', + 'getView', + 'createView', + 'updateView', + 'deleteView', + 'listSinks', + 'getSink', + 'createSink', + 'updateSink', + 'deleteSink', + 'createLink', + 'deleteLink', + 'listLinks', + 'getLink', + 'listExclusions', + 'getExclusion', + 'createExclusion', + 'updateExclusion', + 'deleteExclusion', + 'getCmekSettings', + 'updateCmekSettings', + 'getSettings', + 'updateSettings', + 'copyLogEntries', + ]; + for (const methodName of configServiceV2StubMethods) { + const callPromise = this.configServiceV2Stub.then(stub => (...args) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, (err) => () => { + throw err; + }); + const descriptor = this.descriptors.page[methodName] || + this.descriptors.longrunning[methodName] || + undefined; + const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], descriptor, this._opts.fallback); + this.innerApiCalls[methodName] = apiCall; + } + return this.configServiceV2Stub; + } + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if (typeof process === 'object' && + typeof process.emitWarning === 'function') { + process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + } + return 'logging.googleapis.com'; + } + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if (typeof process === 'object' && + typeof process.emitWarning === 'function') { + process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + } + return 'logging.googleapis.com'; + } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + get universeDomain() { + return this._universeDomain; + } + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/cloud-platform.read-only', + 'https://www.googleapis.com/auth/logging.admin', + 'https://www.googleapis.com/auth/logging.read', + ]; + } + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback) { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + getBucket(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: (_a = request.name) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.getBucket(request, options, callback); + } + createBucket(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.createBucket(request, options, callback); + } + updateBucket(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: (_a = request.name) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.updateBucket(request, options, callback); + } + deleteBucket(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: (_a = request.name) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.deleteBucket(request, options, callback); + } + undeleteBucket(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: (_a = request.name) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.undeleteBucket(request, options, callback); + } + getView(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: (_a = request.name) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.getView(request, options, callback); + } + createView(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.createView(request, options, callback); + } + updateView(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: (_a = request.name) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.updateView(request, options, callback); + } + deleteView(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: (_a = request.name) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.deleteView(request, options, callback); + } + getSink(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + sink_name: (_a = request.sinkName) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.getSink(request, options, callback); + } + createSink(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.createSink(request, options, callback); + } + updateSink(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + sink_name: (_a = request.sinkName) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.updateSink(request, options, callback); + } + deleteSink(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + sink_name: (_a = request.sinkName) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.deleteSink(request, options, callback); + } + getLink(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: (_a = request.name) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.getLink(request, options, callback); + } + getExclusion(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: (_a = request.name) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.getExclusion(request, options, callback); + } + createExclusion(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.createExclusion(request, options, callback); + } + updateExclusion(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: (_a = request.name) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.updateExclusion(request, options, callback); + } + deleteExclusion(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: (_a = request.name) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.deleteExclusion(request, options, callback); + } + getCmekSettings(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: (_a = request.name) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.getCmekSettings(request, options, callback); + } + updateCmekSettings(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: (_a = request.name) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.updateCmekSettings(request, options, callback); + } + getSettings(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: (_a = request.name) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.getSettings(request, options, callback); + } + updateSettings(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: (_a = request.name) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.updateSettings(request, options, callback); + } + createBucketAsync(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.createBucketAsync(request, options, callback); + } + /** + * Check the status of the long running operation returned by `createBucketAsync()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.create_bucket_async.js + * region_tag:logging_v2_generated_ConfigServiceV2_CreateBucketAsync_async + */ + async checkCreateBucketAsyncProgress(name) { + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name }); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createBucketAsync, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation; + } + updateBucketAsync(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: (_a = request.name) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.updateBucketAsync(request, options, callback); + } + /** + * Check the status of the long running operation returned by `updateBucketAsync()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.update_bucket_async.js + * region_tag:logging_v2_generated_ConfigServiceV2_UpdateBucketAsync_async + */ + async checkUpdateBucketAsyncProgress(name) { + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name }); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.updateBucketAsync, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation; + } + createLink(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.createLink(request, options, callback); + } + /** + * Check the status of the long running operation returned by `createLink()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.create_link.js + * region_tag:logging_v2_generated_ConfigServiceV2_CreateLink_async + */ + async checkCreateLinkProgress(name) { + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name }); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.createLink, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation; + } + deleteLink(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + name: (_a = request.name) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.deleteLink(request, options, callback); + } + /** + * Check the status of the long running operation returned by `deleteLink()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.delete_link.js + * region_tag:logging_v2_generated_ConfigServiceV2_DeleteLink_async + */ + async checkDeleteLinkProgress(name) { + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name }); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.deleteLink, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation; + } + copyLogEntries(request, optionsOrCallback, callback) { + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + this.initialize(); + return this.innerApiCalls.copyLogEntries(request, options, callback); + } + /** + * Check the status of the long running operation returned by `copyLogEntries()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.copy_log_entries.js + * region_tag:logging_v2_generated_ConfigServiceV2_CopyLogEntries_async + */ + async checkCopyLogEntriesProgress(name) { + const request = new this._gaxModule.operationsProtos.google.longrunning.GetOperationRequest({ name }); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new this._gaxModule.Operation(operation, this.descriptors.longrunning.copyLogEntries, this._gaxModule.createDefaultBackoffSettings()); + return decodeOperation; + } + listBuckets(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.listBuckets(request, options, callback); + } + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource whose buckets are to be listed: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]" + * + * Note: The locations portion of the resource must be specified, but + * supplying the character `-` in place of [LOCATION_ID] will return all + * buckets. + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.logging.v2.LogBucket|LogBucket} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listBucketsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listBucketsStream(request, options) { + var _a; + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', + }); + const defaultCallSettings = this._defaults['listBuckets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBuckets.createStream(this.innerApiCalls.listBuckets, request, callSettings); + } + /** + * Equivalent to `listBuckets`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource whose buckets are to be listed: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]" + * + * Note: The locations portion of the resource must be specified, but + * supplying the character `-` in place of [LOCATION_ID] will return all + * buckets. + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.logging.v2.LogBucket|LogBucket}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.list_buckets.js + * region_tag:logging_v2_generated_ConfigServiceV2_ListBuckets_async + */ + listBucketsAsync(request, options) { + var _a; + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', + }); + const defaultCallSettings = this._defaults['listBuckets']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listBuckets.asyncIterate(this.innerApiCalls['listBuckets'], request, callSettings); + } + listViews(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.listViews(request, options, callback); + } + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The bucket whose views are to be listed: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.logging.v2.LogView|LogView} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listViewsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listViewsStream(request, options) { + var _a; + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', + }); + const defaultCallSettings = this._defaults['listViews']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listViews.createStream(this.innerApiCalls.listViews, request, callSettings); + } + /** + * Equivalent to `listViews`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The bucket whose views are to be listed: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]" + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.logging.v2.LogView|LogView}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.list_views.js + * region_tag:logging_v2_generated_ConfigServiceV2_ListViews_async + */ + listViewsAsync(request, options) { + var _a; + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', + }); + const defaultCallSettings = this._defaults['listViews']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listViews.asyncIterate(this.innerApiCalls['listViews'], request, callSettings); + } + listSinks(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.listSinks(request, options, callback); + } + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource whose sinks are to be listed: + * + * "projects/[PROJECT_ID]" + * "organizations/[ORGANIZATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]" + * "folders/[FOLDER_ID]" + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.logging.v2.LogSink|LogSink} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listSinksAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listSinksStream(request, options) { + var _a; + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', + }); + const defaultCallSettings = this._defaults['listSinks']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSinks.createStream(this.innerApiCalls.listSinks, request, callSettings); + } + /** + * Equivalent to `listSinks`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource whose sinks are to be listed: + * + * "projects/[PROJECT_ID]" + * "organizations/[ORGANIZATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]" + * "folders/[FOLDER_ID]" + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.logging.v2.LogSink|LogSink}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.list_sinks.js + * region_tag:logging_v2_generated_ConfigServiceV2_ListSinks_async + */ + listSinksAsync(request, options) { + var _a; + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', + }); + const defaultCallSettings = this._defaults['listSinks']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listSinks.asyncIterate(this.innerApiCalls['listSinks'], request, callSettings); + } + listLinks(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.listLinks(request, options, callback); + } + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource whose links are to be listed: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/ + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.logging.v2.Link|Link} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listLinksAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listLinksStream(request, options) { + var _a; + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', + }); + const defaultCallSettings = this._defaults['listLinks']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listLinks.createStream(this.innerApiCalls.listLinks, request, callSettings); + } + /** + * Equivalent to `listLinks`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource whose links are to be listed: + * + * "projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/links/" + * "organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" + * "billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/" + * "folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/ + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.logging.v2.Link|Link}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.list_links.js + * region_tag:logging_v2_generated_ConfigServiceV2_ListLinks_async + */ + listLinksAsync(request, options) { + var _a; + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', + }); + const defaultCallSettings = this._defaults['listLinks']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listLinks.asyncIterate(this.innerApiCalls['listLinks'], request, callSettings); + } + listExclusions(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.listExclusions(request, options, callback); + } + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource whose exclusions are to be listed. + * + * "projects/[PROJECT_ID]" + * "organizations/[ORGANIZATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]" + * "folders/[FOLDER_ID]" + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.logging.v2.LogExclusion|LogExclusion} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listExclusionsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listExclusionsStream(request, options) { + var _a; + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', + }); + const defaultCallSettings = this._defaults['listExclusions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listExclusions.createStream(this.innerApiCalls.listExclusions, request, callSettings); + } + /** + * Equivalent to `listExclusions`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource whose exclusions are to be listed. + * + * "projects/[PROJECT_ID]" + * "organizations/[ORGANIZATION_ID]" + * "billingAccounts/[BILLING_ACCOUNT_ID]" + * "folders/[FOLDER_ID]" + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.logging.v2.LogExclusion|LogExclusion}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v2/config_service_v2.list_exclusions.js + * region_tag:logging_v2_generated_ConfigServiceV2_ListExclusions_async + */ + listExclusionsAsync(request, options) { + var _a; + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', + }); + const defaultCallSettings = this._defaults['listExclusions']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listExclusions.asyncIterate(this.innerApiCalls['listExclusions'], request, callSettings); + } + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * {@link google.longrunning.Operation | google.longrunning.Operation}. + * The promise has a method named "cancel" which cancels the ongoing API call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + * ``` + */ + getOperation(request, options, callback) { + return this.operationsClient.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. Returns an iterable object. + * + * For-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | iteration protocols}. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * for await (const response of client.listOperationsAsync(request)); + * // doThingsWith(response) + * ``` + */ + listOperationsAsync(request, options) { + return this.operationsClient.listOperationsAsync(request, options); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + * ``` + */ + cancelOperation(request, options, callback) { + return this.operationsClient.cancelOperation(request, options, callback); + } + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See {@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions | gax.CallOptions} + * for the details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * ``` + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + * ``` + */ + deleteOperation(request, options, callback) { + return this.operationsClient.deleteOperation(request, options, callback); + } + // -------------------- + // -- Path templates -- + // -------------------- + /** + * Return a fully-qualified billingAccountCmekSettings resource name string. + * + * @param {string} billing_account + * @returns {string} Resource name string. + */ + billingAccountCmekSettingsPath(billingAccount) { + return this.pathTemplates.billingAccountCmekSettingsPathTemplate.render({ + billing_account: billingAccount, + }); + } + /** + * Parse the billing_account from BillingAccountCmekSettings resource. + * + * @param {string} billingAccountCmekSettingsName + * A fully-qualified path representing billing_account_cmekSettings resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountCmekSettingsName(billingAccountCmekSettingsName) { + return this.pathTemplates.billingAccountCmekSettingsPathTemplate.match(billingAccountCmekSettingsName).billing_account; + } + /** + * Return a fully-qualified billingAccountExclusion resource name string. + * + * @param {string} billing_account + * @param {string} exclusion + * @returns {string} Resource name string. + */ + billingAccountExclusionPath(billingAccount, exclusion) { + return this.pathTemplates.billingAccountExclusionPathTemplate.render({ + billing_account: billingAccount, + exclusion: exclusion, + }); + } + /** + * Parse the billing_account from BillingAccountExclusion resource. + * + * @param {string} billingAccountExclusionName + * A fully-qualified path representing billing_account_exclusion resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountExclusionName(billingAccountExclusionName) { + return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).billing_account; + } + /** + * Parse the exclusion from BillingAccountExclusion resource. + * + * @param {string} billingAccountExclusionName + * A fully-qualified path representing billing_account_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromBillingAccountExclusionName(billingAccountExclusionName) { + return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).exclusion; + } + /** + * Return a fully-qualified billingAccountLocationBucket resource name string. + * + * @param {string} billing_account + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + billingAccountLocationBucketPath(billingAccount, location, bucket) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.render({ + billing_account: billingAccount, + location: location, + bucket: bucket, + }); + } + /** + * Parse the billing_account from BillingAccountLocationBucket resource. + * + * @param {string} billingAccountLocationBucketName + * A fully-qualified path representing billing_account_location_bucket resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLocationBucketName(billingAccountLocationBucketName) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).billing_account; + } + /** + * Parse the location from BillingAccountLocationBucket resource. + * + * @param {string} billingAccountLocationBucketName + * A fully-qualified path representing billing_account_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBillingAccountLocationBucketName(billingAccountLocationBucketName) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).location; + } + /** + * Parse the bucket from BillingAccountLocationBucket resource. + * + * @param {string} billingAccountLocationBucketName + * A fully-qualified path representing billing_account_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromBillingAccountLocationBucketName(billingAccountLocationBucketName) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).bucket; + } + /** + * Return a fully-qualified billingAccountLocationBucketLink resource name string. + * + * @param {string} billing_account + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + billingAccountLocationBucketLinkPath(billingAccount, location, bucket, link) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render({ + billing_account: billingAccount, + location: location, + bucket: bucket, + link: link, + }); + } + /** + * Parse the billing_account from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).billing_account; + } + /** + * Parse the location from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).location; + } + /** + * Parse the bucket from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).bucket; + } + /** + * Parse the link from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).link; + } + /** + * Return a fully-qualified billingAccountLocationBucketView resource name string. + * + * @param {string} billing_account + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + billingAccountLocationBucketViewPath(billingAccount, location, bucket, view) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.render({ + billing_account: billingAccount, + location: location, + bucket: bucket, + view: view, + }); + } + /** + * Parse the billing_account from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).billing_account; + } + /** + * Parse the location from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).location; + } + /** + * Parse the bucket from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).bucket; + } + /** + * Parse the view from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).view; + } + /** + * Return a fully-qualified billingAccountLog resource name string. + * + * @param {string} billing_account + * @param {string} log + * @returns {string} Resource name string. + */ + billingAccountLogPath(billingAccount, log) { + return this.pathTemplates.billingAccountLogPathTemplate.render({ + billing_account: billingAccount, + log: log, + }); + } + /** + * Parse the billing_account from BillingAccountLog resource. + * + * @param {string} billingAccountLogName + * A fully-qualified path representing billing_account_log resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLogName(billingAccountLogName) { + return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).billing_account; + } + /** + * Parse the log from BillingAccountLog resource. + * + * @param {string} billingAccountLogName + * A fully-qualified path representing billing_account_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromBillingAccountLogName(billingAccountLogName) { + return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).log; + } + /** + * Return a fully-qualified billingAccountSettings resource name string. + * + * @param {string} billing_account + * @returns {string} Resource name string. + */ + billingAccountSettingsPath(billingAccount) { + return this.pathTemplates.billingAccountSettingsPathTemplate.render({ + billing_account: billingAccount, + }); + } + /** + * Parse the billing_account from BillingAccountSettings resource. + * + * @param {string} billingAccountSettingsName + * A fully-qualified path representing billing_account_settings resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountSettingsName(billingAccountSettingsName) { + return this.pathTemplates.billingAccountSettingsPathTemplate.match(billingAccountSettingsName).billing_account; + } + /** + * Return a fully-qualified billingAccountSink resource name string. + * + * @param {string} billing_account + * @param {string} sink + * @returns {string} Resource name string. + */ + billingAccountSinkPath(billingAccount, sink) { + return this.pathTemplates.billingAccountSinkPathTemplate.render({ + billing_account: billingAccount, + sink: sink, + }); + } + /** + * Parse the billing_account from BillingAccountSink resource. + * + * @param {string} billingAccountSinkName + * A fully-qualified path representing billing_account_sink resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountSinkName(billingAccountSinkName) { + return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).billing_account; + } + /** + * Parse the sink from BillingAccountSink resource. + * + * @param {string} billingAccountSinkName + * A fully-qualified path representing billing_account_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromBillingAccountSinkName(billingAccountSinkName) { + return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).sink; + } + /** + * Return a fully-qualified folderCmekSettings resource name string. + * + * @param {string} folder + * @returns {string} Resource name string. + */ + folderCmekSettingsPath(folder) { + return this.pathTemplates.folderCmekSettingsPathTemplate.render({ + folder: folder, + }); + } + /** + * Parse the folder from FolderCmekSettings resource. + * + * @param {string} folderCmekSettingsName + * A fully-qualified path representing folder_cmekSettings resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderCmekSettingsName(folderCmekSettingsName) { + return this.pathTemplates.folderCmekSettingsPathTemplate.match(folderCmekSettingsName).folder; + } + /** + * Return a fully-qualified folderExclusion resource name string. + * + * @param {string} folder + * @param {string} exclusion + * @returns {string} Resource name string. + */ + folderExclusionPath(folder, exclusion) { + return this.pathTemplates.folderExclusionPathTemplate.render({ + folder: folder, + exclusion: exclusion, + }); + } + /** + * Parse the folder from FolderExclusion resource. + * + * @param {string} folderExclusionName + * A fully-qualified path representing folder_exclusion resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderExclusionName(folderExclusionName) { + return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).folder; + } + /** + * Parse the exclusion from FolderExclusion resource. + * + * @param {string} folderExclusionName + * A fully-qualified path representing folder_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromFolderExclusionName(folderExclusionName) { + return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).exclusion; + } + /** + * Return a fully-qualified folderLocationBucket resource name string. + * + * @param {string} folder + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + folderLocationBucketPath(folder, location, bucket) { + return this.pathTemplates.folderLocationBucketPathTemplate.render({ + folder: folder, + location: location, + bucket: bucket, + }); + } + /** + * Parse the folder from FolderLocationBucket resource. + * + * @param {string} folderLocationBucketName + * A fully-qualified path representing folder_location_bucket resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLocationBucketName(folderLocationBucketName) { + return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).folder; + } + /** + * Parse the location from FolderLocationBucket resource. + * + * @param {string} folderLocationBucketName + * A fully-qualified path representing folder_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFolderLocationBucketName(folderLocationBucketName) { + return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).location; + } + /** + * Parse the bucket from FolderLocationBucket resource. + * + * @param {string} folderLocationBucketName + * A fully-qualified path representing folder_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromFolderLocationBucketName(folderLocationBucketName) { + return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).bucket; + } + /** + * Return a fully-qualified folderLocationBucketLink resource name string. + * + * @param {string} folder + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + folderLocationBucketLinkPath(folder, location, bucket, link) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.render({ + folder: folder, + location: location, + bucket: bucket, + link: link, + }); + } + /** + * Parse the folder from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLocationBucketLinkName(folderLocationBucketLinkName) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).folder; + } + /** + * Parse the location from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFolderLocationBucketLinkName(folderLocationBucketLinkName) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).location; + } + /** + * Parse the bucket from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromFolderLocationBucketLinkName(folderLocationBucketLinkName) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).bucket; + } + /** + * Parse the link from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromFolderLocationBucketLinkName(folderLocationBucketLinkName) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).link; + } + /** + * Return a fully-qualified folderLocationBucketView resource name string. + * + * @param {string} folder + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + folderLocationBucketViewPath(folder, location, bucket, view) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.render({ + folder: folder, + location: location, + bucket: bucket, + view: view, + }); + } + /** + * Parse the folder from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLocationBucketViewName(folderLocationBucketViewName) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).folder; + } + /** + * Parse the location from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFolderLocationBucketViewName(folderLocationBucketViewName) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).location; + } + /** + * Parse the bucket from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromFolderLocationBucketViewName(folderLocationBucketViewName) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).bucket; + } + /** + * Parse the view from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromFolderLocationBucketViewName(folderLocationBucketViewName) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).view; + } + /** + * Return a fully-qualified folderLog resource name string. + * + * @param {string} folder + * @param {string} log + * @returns {string} Resource name string. + */ + folderLogPath(folder, log) { + return this.pathTemplates.folderLogPathTemplate.render({ + folder: folder, + log: log, + }); + } + /** + * Parse the folder from FolderLog resource. + * + * @param {string} folderLogName + * A fully-qualified path representing folder_log resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLogName(folderLogName) { + return this.pathTemplates.folderLogPathTemplate.match(folderLogName).folder; + } + /** + * Parse the log from FolderLog resource. + * + * @param {string} folderLogName + * A fully-qualified path representing folder_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromFolderLogName(folderLogName) { + return this.pathTemplates.folderLogPathTemplate.match(folderLogName).log; + } + /** + * Return a fully-qualified folderSettings resource name string. + * + * @param {string} folder + * @returns {string} Resource name string. + */ + folderSettingsPath(folder) { + return this.pathTemplates.folderSettingsPathTemplate.render({ + folder: folder, + }); + } + /** + * Parse the folder from FolderSettings resource. + * + * @param {string} folderSettingsName + * A fully-qualified path representing folder_settings resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderSettingsName(folderSettingsName) { + return this.pathTemplates.folderSettingsPathTemplate.match(folderSettingsName).folder; + } + /** + * Return a fully-qualified folderSink resource name string. + * + * @param {string} folder + * @param {string} sink + * @returns {string} Resource name string. + */ + folderSinkPath(folder, sink) { + return this.pathTemplates.folderSinkPathTemplate.render({ + folder: folder, + sink: sink, + }); + } + /** + * Parse the folder from FolderSink resource. + * + * @param {string} folderSinkName + * A fully-qualified path representing folder_sink resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderSinkName(folderSinkName) { + return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName) + .folder; + } + /** + * Parse the sink from FolderSink resource. + * + * @param {string} folderSinkName + * A fully-qualified path representing folder_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromFolderSinkName(folderSinkName) { + return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).sink; + } + /** + * Return a fully-qualified location resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + locationPath(project, location) { + return this.pathTemplates.locationPathTemplate.render({ + project: project, + location: location, + }); + } + /** + * Parse the project from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLocationName(locationName) { + return this.pathTemplates.locationPathTemplate.match(locationName).project; + } + /** + * Parse the location from Location resource. + * + * @param {string} locationName + * A fully-qualified path representing Location resource. + * @returns {string} A string representing the location. + */ + matchLocationFromLocationName(locationName) { + return this.pathTemplates.locationPathTemplate.match(locationName).location; + } + /** + * Return a fully-qualified logMetric resource name string. + * + * @param {string} project + * @param {string} metric + * @returns {string} Resource name string. + */ + logMetricPath(project, metric) { + return this.pathTemplates.logMetricPathTemplate.render({ + project: project, + metric: metric, + }); + } + /** + * Parse the project from LogMetric resource. + * + * @param {string} logMetricName + * A fully-qualified path representing LogMetric resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLogMetricName(logMetricName) { + return this.pathTemplates.logMetricPathTemplate.match(logMetricName) + .project; + } + /** + * Parse the metric from LogMetric resource. + * + * @param {string} logMetricName + * A fully-qualified path representing LogMetric resource. + * @returns {string} A string representing the metric. + */ + matchMetricFromLogMetricName(logMetricName) { + return this.pathTemplates.logMetricPathTemplate.match(logMetricName).metric; + } + /** + * Return a fully-qualified organizationCmekSettings resource name string. + * + * @param {string} organization + * @returns {string} Resource name string. + */ + organizationCmekSettingsPath(organization) { + return this.pathTemplates.organizationCmekSettingsPathTemplate.render({ + organization: organization, + }); + } + /** + * Parse the organization from OrganizationCmekSettings resource. + * + * @param {string} organizationCmekSettingsName + * A fully-qualified path representing organization_cmekSettings resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationCmekSettingsName(organizationCmekSettingsName) { + return this.pathTemplates.organizationCmekSettingsPathTemplate.match(organizationCmekSettingsName).organization; + } + /** + * Return a fully-qualified organizationExclusion resource name string. + * + * @param {string} organization + * @param {string} exclusion + * @returns {string} Resource name string. + */ + organizationExclusionPath(organization, exclusion) { + return this.pathTemplates.organizationExclusionPathTemplate.render({ + organization: organization, + exclusion: exclusion, + }); + } + /** + * Parse the organization from OrganizationExclusion resource. + * + * @param {string} organizationExclusionName + * A fully-qualified path representing organization_exclusion resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationExclusionName(organizationExclusionName) { + return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).organization; + } + /** + * Parse the exclusion from OrganizationExclusion resource. + * + * @param {string} organizationExclusionName + * A fully-qualified path representing organization_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromOrganizationExclusionName(organizationExclusionName) { + return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).exclusion; + } + /** + * Return a fully-qualified organizationLocationBucket resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + organizationLocationBucketPath(organization, location, bucket) { + return this.pathTemplates.organizationLocationBucketPathTemplate.render({ + organization: organization, + location: location, + bucket: bucket, + }); + } + /** + * Parse the organization from OrganizationLocationBucket resource. + * + * @param {string} organizationLocationBucketName + * A fully-qualified path representing organization_location_bucket resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationBucketName(organizationLocationBucketName) { + return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).organization; + } + /** + * Parse the location from OrganizationLocationBucket resource. + * + * @param {string} organizationLocationBucketName + * A fully-qualified path representing organization_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationBucketName(organizationLocationBucketName) { + return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).location; + } + /** + * Parse the bucket from OrganizationLocationBucket resource. + * + * @param {string} organizationLocationBucketName + * A fully-qualified path representing organization_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromOrganizationLocationBucketName(organizationLocationBucketName) { + return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).bucket; + } + /** + * Return a fully-qualified organizationLocationBucketLink resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + organizationLocationBucketLinkPath(organization, location, bucket, link) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.render({ + organization: organization, + location: location, + bucket: bucket, + link: link, + }); + } + /** + * Parse the organization from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).organization; + } + /** + * Parse the location from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).location; + } + /** + * Parse the bucket from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).bucket; + } + /** + * Parse the link from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).link; + } + /** + * Return a fully-qualified organizationLocationBucketView resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + organizationLocationBucketViewPath(organization, location, bucket, view) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.render({ + organization: organization, + location: location, + bucket: bucket, + view: view, + }); + } + /** + * Parse the organization from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).organization; + } + /** + * Parse the location from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).location; + } + /** + * Parse the bucket from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromOrganizationLocationBucketViewName(organizationLocationBucketViewName) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).bucket; + } + /** + * Parse the view from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromOrganizationLocationBucketViewName(organizationLocationBucketViewName) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).view; + } + /** + * Return a fully-qualified organizationLog resource name string. + * + * @param {string} organization + * @param {string} log + * @returns {string} Resource name string. + */ + organizationLogPath(organization, log) { + return this.pathTemplates.organizationLogPathTemplate.render({ + organization: organization, + log: log, + }); + } + /** + * Parse the organization from OrganizationLog resource. + * + * @param {string} organizationLogName + * A fully-qualified path representing organization_log resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLogName(organizationLogName) { + return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).organization; + } + /** + * Parse the log from OrganizationLog resource. + * + * @param {string} organizationLogName + * A fully-qualified path representing organization_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromOrganizationLogName(organizationLogName) { + return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).log; + } + /** + * Return a fully-qualified organizationSettings resource name string. + * + * @param {string} organization + * @returns {string} Resource name string. + */ + organizationSettingsPath(organization) { + return this.pathTemplates.organizationSettingsPathTemplate.render({ + organization: organization, + }); + } + /** + * Parse the organization from OrganizationSettings resource. + * + * @param {string} organizationSettingsName + * A fully-qualified path representing organization_settings resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSettingsName(organizationSettingsName) { + return this.pathTemplates.organizationSettingsPathTemplate.match(organizationSettingsName).organization; + } + /** + * Return a fully-qualified organizationSink resource name string. + * + * @param {string} organization + * @param {string} sink + * @returns {string} Resource name string. + */ + organizationSinkPath(organization, sink) { + return this.pathTemplates.organizationSinkPathTemplate.render({ + organization: organization, + sink: sink, + }); + } + /** + * Parse the organization from OrganizationSink resource. + * + * @param {string} organizationSinkName + * A fully-qualified path representing organization_sink resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSinkName(organizationSinkName) { + return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).organization; + } + /** + * Parse the sink from OrganizationSink resource. + * + * @param {string} organizationSinkName + * A fully-qualified path representing organization_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromOrganizationSinkName(organizationSinkName) { + return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).sink; + } + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + /** + * Return a fully-qualified projectCmekSettings resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectCmekSettingsPath(project) { + return this.pathTemplates.projectCmekSettingsPathTemplate.render({ + project: project, + }); + } + /** + * Parse the project from ProjectCmekSettings resource. + * + * @param {string} projectCmekSettingsName + * A fully-qualified path representing project_cmekSettings resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectCmekSettingsName(projectCmekSettingsName) { + return this.pathTemplates.projectCmekSettingsPathTemplate.match(projectCmekSettingsName).project; + } + /** + * Return a fully-qualified projectExclusion resource name string. + * + * @param {string} project + * @param {string} exclusion + * @returns {string} Resource name string. + */ + projectExclusionPath(project, exclusion) { + return this.pathTemplates.projectExclusionPathTemplate.render({ + project: project, + exclusion: exclusion, + }); + } + /** + * Parse the project from ProjectExclusion resource. + * + * @param {string} projectExclusionName + * A fully-qualified path representing project_exclusion resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectExclusionName(projectExclusionName) { + return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).project; + } + /** + * Parse the exclusion from ProjectExclusion resource. + * + * @param {string} projectExclusionName + * A fully-qualified path representing project_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromProjectExclusionName(projectExclusionName) { + return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).exclusion; + } + /** + * Return a fully-qualified projectLocationBucket resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + projectLocationBucketPath(project, location, bucket) { + return this.pathTemplates.projectLocationBucketPathTemplate.render({ + project: project, + location: location, + bucket: bucket, + }); + } + /** + * Parse the project from ProjectLocationBucket resource. + * + * @param {string} projectLocationBucketName + * A fully-qualified path representing project_location_bucket resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationBucketName(projectLocationBucketName) { + return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).project; + } + /** + * Parse the location from ProjectLocationBucket resource. + * + * @param {string} projectLocationBucketName + * A fully-qualified path representing project_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationBucketName(projectLocationBucketName) { + return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).location; + } + /** + * Parse the bucket from ProjectLocationBucket resource. + * + * @param {string} projectLocationBucketName + * A fully-qualified path representing project_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromProjectLocationBucketName(projectLocationBucketName) { + return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).bucket; + } + /** + * Return a fully-qualified projectLocationBucketLink resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + projectLocationBucketLinkPath(project, location, bucket, link) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.render({ + project: project, + location: location, + bucket: bucket, + link: link, + }); + } + /** + * Parse the project from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationBucketLinkName(projectLocationBucketLinkName) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).project; + } + /** + * Parse the location from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationBucketLinkName(projectLocationBucketLinkName) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).location; + } + /** + * Parse the bucket from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromProjectLocationBucketLinkName(projectLocationBucketLinkName) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).bucket; + } + /** + * Parse the link from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromProjectLocationBucketLinkName(projectLocationBucketLinkName) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).link; + } + /** + * Return a fully-qualified projectLocationBucketView resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + projectLocationBucketViewPath(project, location, bucket, view) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.render({ + project: project, + location: location, + bucket: bucket, + view: view, + }); + } + /** + * Parse the project from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationBucketViewName(projectLocationBucketViewName) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).project; + } + /** + * Parse the location from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationBucketViewName(projectLocationBucketViewName) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).location; + } + /** + * Parse the bucket from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromProjectLocationBucketViewName(projectLocationBucketViewName) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).bucket; + } + /** + * Parse the view from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromProjectLocationBucketViewName(projectLocationBucketViewName) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).view; + } + /** + * Return a fully-qualified projectLog resource name string. + * + * @param {string} project + * @param {string} log + * @returns {string} Resource name string. + */ + projectLogPath(project, log) { + return this.pathTemplates.projectLogPathTemplate.render({ + project: project, + log: log, + }); + } + /** + * Parse the project from ProjectLog resource. + * + * @param {string} projectLogName + * A fully-qualified path representing project_log resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLogName(projectLogName) { + return this.pathTemplates.projectLogPathTemplate.match(projectLogName) + .project; + } + /** + * Parse the log from ProjectLog resource. + * + * @param {string} projectLogName + * A fully-qualified path representing project_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromProjectLogName(projectLogName) { + return this.pathTemplates.projectLogPathTemplate.match(projectLogName).log; + } + /** + * Return a fully-qualified projectSettings resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectSettingsPath(project) { + return this.pathTemplates.projectSettingsPathTemplate.render({ + project: project, + }); + } + /** + * Parse the project from ProjectSettings resource. + * + * @param {string} projectSettingsName + * A fully-qualified path representing project_settings resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSettingsName(projectSettingsName) { + return this.pathTemplates.projectSettingsPathTemplate.match(projectSettingsName).project; + } + /** + * Return a fully-qualified projectSink resource name string. + * + * @param {string} project + * @param {string} sink + * @returns {string} Resource name string. + */ + projectSinkPath(project, sink) { + return this.pathTemplates.projectSinkPathTemplate.render({ + project: project, + sink: sink, + }); + } + /** + * Parse the project from ProjectSink resource. + * + * @param {string} projectSinkName + * A fully-qualified path representing project_sink resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSinkName(projectSinkName) { + return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName) + .project; + } + /** + * Parse the sink from ProjectSink resource. + * + * @param {string} projectSinkName + * A fully-qualified path representing project_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromProjectSinkName(projectSinkName) { + return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName) + .sink; + } + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close() { + if (this.configServiceV2Stub && !this._terminated) { + return this.configServiceV2Stub.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} +exports.ConfigServiceV2Client = ConfigServiceV2Client; +//# sourceMappingURL=config_service_v2_client.js.map + +/***/ }), + +/***/ 96204: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.MetricsServiceV2Client = exports.LoggingServiceV2Client = exports.ConfigServiceV2Client = void 0; +var config_service_v2_client_1 = __nccwpck_require__(46185); +Object.defineProperty(exports, "ConfigServiceV2Client", ({ enumerable: true, get: function () { return config_service_v2_client_1.ConfigServiceV2Client; } })); +var logging_service_v2_client_1 = __nccwpck_require__(85800); +Object.defineProperty(exports, "LoggingServiceV2Client", ({ enumerable: true, get: function () { return logging_service_v2_client_1.LoggingServiceV2Client; } })); +var metrics_service_v2_client_1 = __nccwpck_require__(92944); +Object.defineProperty(exports, "MetricsServiceV2Client", ({ enumerable: true, get: function () { return metrics_service_v2_client_1.MetricsServiceV2Client; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 85800: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.LoggingServiceV2Client = void 0; +const stream_1 = __nccwpck_require__(2203); +const jsonProtos = __nccwpck_require__(82721); +/** + * Client JSON configuration object, loaded from + * `src/v2/logging_service_v2_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +const gapicConfig = __nccwpck_require__(58921); +const version = (__nccwpck_require__(38105)/* .version */ .rE); +/** + * Service for ingesting and querying logs. + * @class + * @memberof v2 + */ +class LoggingServiceV2Client { + /** + * Construct an instance of LoggingServiceV2Client. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new LoggingServiceV2Client({fallback: true}, gax); + * ``` + */ + constructor(opts, gaxInstance) { + var _a, _b, _c, _d, _e; + this._terminated = false; + this.descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + // Ensure that options include all the required fields. + const staticMembers = this.constructor; + if ((opts === null || opts === void 0 ? void 0 : opts.universe_domain) && + (opts === null || opts === void 0 ? void 0 : opts.universeDomain) && + (opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== (opts === null || opts === void 0 ? void 0 : opts.universeDomain)) { + throw new Error('Please set either universe_domain or universeDomain, but not both.'); + } + const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + (_c = (_b = (_a = opts === null || opts === void 0 ? void 0 : opts.universeDomain) !== null && _a !== void 0 ? _a : opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== null && _b !== void 0 ? _b : universeDomainEnvVar) !== null && _c !== void 0 ? _c : 'googleapis.com'; + this._servicePath = 'logging.' + this._universeDomain; + const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || this._servicePath; + this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint)); + const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port; + const clientConfig = (_d = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _d !== void 0 ? _d : {}; + const fallback = (_e = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _e !== void 0 ? _e : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = __nccwpck_require__(83232); + } + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + // Save options to use in initialize() method. + this._opts = opts; + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth; + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } + else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } + else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + billingAccountCmekSettingsPathTemplate: new this._gaxModule.PathTemplate('billingAccounts/{billing_account}/cmekSettings'), + billingAccountExclusionPathTemplate: new this._gaxModule.PathTemplate('billingAccounts/{billing_account}/exclusions/{exclusion}'), + billingAccountLocationBucketPathTemplate: new this._gaxModule.PathTemplate('billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}'), + billingAccountLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate('billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/links/{link}'), + billingAccountLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate('billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/views/{view}'), + billingAccountLogPathTemplate: new this._gaxModule.PathTemplate('billingAccounts/{billing_account}/logs/{log}'), + billingAccountSettingsPathTemplate: new this._gaxModule.PathTemplate('billingAccounts/{billing_account}/settings'), + billingAccountSinkPathTemplate: new this._gaxModule.PathTemplate('billingAccounts/{billing_account}/sinks/{sink}'), + folderCmekSettingsPathTemplate: new this._gaxModule.PathTemplate('folders/{folder}/cmekSettings'), + folderExclusionPathTemplate: new this._gaxModule.PathTemplate('folders/{folder}/exclusions/{exclusion}'), + folderLocationBucketPathTemplate: new this._gaxModule.PathTemplate('folders/{folder}/locations/{location}/buckets/{bucket}'), + folderLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate('folders/{folder}/locations/{location}/buckets/{bucket}/links/{link}'), + folderLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate('folders/{folder}/locations/{location}/buckets/{bucket}/views/{view}'), + folderLogPathTemplate: new this._gaxModule.PathTemplate('folders/{folder}/logs/{log}'), + folderSettingsPathTemplate: new this._gaxModule.PathTemplate('folders/{folder}/settings'), + folderSinkPathTemplate: new this._gaxModule.PathTemplate('folders/{folder}/sinks/{sink}'), + logMetricPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/metrics/{metric}'), + organizationCmekSettingsPathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}/cmekSettings'), + organizationExclusionPathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}/exclusions/{exclusion}'), + organizationLocationBucketPathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}/locations/{location}/buckets/{bucket}'), + organizationLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}/locations/{location}/buckets/{bucket}/links/{link}'), + organizationLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}/locations/{location}/buckets/{bucket}/views/{view}'), + organizationLogPathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}/logs/{log}'), + organizationSettingsPathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}/settings'), + organizationSinkPathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}/sinks/{sink}'), + projectPathTemplate: new this._gaxModule.PathTemplate('projects/{project}'), + projectCmekSettingsPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/cmekSettings'), + projectExclusionPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/exclusions/{exclusion}'), + projectLocationBucketPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/buckets/{bucket}'), + projectLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/buckets/{bucket}/links/{link}'), + projectLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/buckets/{bucket}/views/{view}'), + projectLogPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/logs/{log}'), + projectSettingsPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/settings'), + projectSinkPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/sinks/{sink}'), + }; + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listLogEntries: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'entries'), + listMonitoredResourceDescriptors: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'resourceDescriptors'), + listLogs: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'logNames'), + }; + // Some of the methods on this service provide streaming responses. + // Provide descriptors for these. + this.descriptors.stream = { + tailLogEntries: new this._gaxModule.StreamDescriptor(this._gaxModule.StreamType.BIDI_STREAMING, !!opts.fallback, !!opts.gaxServerStreamingRetries), + }; + const protoFilesRoot = this._gaxModule.protobuf.Root.fromJSON(jsonProtos); + // Some methods on this API support automatically batching + // requests; denote this. + this.descriptors.batching = { + writeLogEntries: new this._gaxModule.BundleDescriptor('entries', ['log_name', 'resource', 'labels'], null, this._gaxModule.GrpcClient.createByteLengthFunction( + // eslint-disable-next-line @typescript-eslint/no-explicit-any + protoFilesRoot.lookupType('google.logging.v2.LogEntry'))), + }; + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings('google.logging.v2.LoggingServiceV2', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') }); + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + var _a; + // If the client stub promise is already initialized, return immediately. + if (this.loggingServiceV2Stub) { + return this.loggingServiceV2Stub; + } + // Put together the "service stub" for + // google.logging.v2.LoggingServiceV2. + this.loggingServiceV2Stub = this._gaxGrpc.createStub(this._opts.fallback + ? this._protos.lookupService('google.logging.v2.LoggingServiceV2') + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._protos.google.logging.v2.LoggingServiceV2, this._opts, this._providedCustomServicePath); + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const loggingServiceV2StubMethods = [ + 'deleteLog', + 'writeLogEntries', + 'listLogEntries', + 'listMonitoredResourceDescriptors', + 'listLogs', + 'tailLogEntries', + ]; + for (const methodName of loggingServiceV2StubMethods) { + const callPromise = this.loggingServiceV2Stub.then(stub => (...args) => { + if (this._terminated) { + if (methodName in this.descriptors.stream) { + const stream = new stream_1.PassThrough(); + setImmediate(() => { + stream.emit('error', new this._gaxModule.GoogleError('The client has already been closed.')); + }); + return stream; + } + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, (err) => () => { + throw err; + }); + const descriptor = this.descriptors.page[methodName] || + this.descriptors.stream[methodName] || + ((_a = this.descriptors.batching) === null || _a === void 0 ? void 0 : _a[methodName]) || + undefined; + const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], descriptor, this._opts.fallback); + this.innerApiCalls[methodName] = apiCall; + } + return this.loggingServiceV2Stub; + } + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if (typeof process === 'object' && + typeof process.emitWarning === 'function') { + process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + } + return 'logging.googleapis.com'; + } + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if (typeof process === 'object' && + typeof process.emitWarning === 'function') { + process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + } + return 'logging.googleapis.com'; + } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + get universeDomain() { + return this._universeDomain; + } + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/cloud-platform.read-only', + 'https://www.googleapis.com/auth/logging.admin', + 'https://www.googleapis.com/auth/logging.read', + 'https://www.googleapis.com/auth/logging.write', + ]; + } + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback) { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + deleteLog(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + log_name: (_a = request.logName) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.deleteLog(request, options, callback); + } + writeLogEntries(request, optionsOrCallback, callback) { + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + this.initialize(); + return this.innerApiCalls.writeLogEntries(request, options, callback); + } + /** + * Streaming read of log entries as they are ingested. Until the stream is + * terminated, it will continue reading logs. + * + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which is both readable and writable. It accepts objects + * representing {@link protos.google.logging.v2.TailLogEntriesRequest|TailLogEntriesRequest} for write() method, and + * will emit objects representing {@link protos.google.logging.v2.TailLogEntriesResponse|TailLogEntriesResponse} on 'data' event asynchronously. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#bi-directional-streaming | documentation } + * for more details and examples. + * @example include:samples/generated/v2/logging_service_v2.tail_log_entries.js + * region_tag:logging_v2_generated_LoggingServiceV2_TailLogEntries_async + */ + tailLogEntries(options) { + this.initialize(); + return this.innerApiCalls.tailLogEntries(null, options); + } + listLogEntries(request, optionsOrCallback, callback) { + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + this.initialize(); + return this.innerApiCalls.listLogEntries(request, options, callback); + } + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string[]} request.resourceNames + * Required. Names of one or more parent resources from which to + * retrieve log entries: + * + * * `projects/[PROJECT_ID]` + * * `organizations/[ORGANIZATION_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]` + * * `folders/[FOLDER_ID]` + * + * May alternatively be one or more views: + * + * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * + * Projects listed in the `project_ids` field are added to this list. + * A maximum of 100 resources may be specified in a single request. + * @param {string} [request.filter] + * Optional. Only log entries that match the filter are returned. An empty + * filter matches all log entries in the resources listed in `resource_names`. + * Referencing a parent resource that is not listed in `resource_names` will + * cause the filter to return no results. The maximum length of a filter is + * 20,000 characters. + * @param {string} [request.orderBy] + * Optional. How the results should be sorted. Presently, the only permitted + * values are `"timestamp asc"` (default) and `"timestamp desc"`. The first + * option returns entries in order of increasing values of + * `LogEntry.timestamp` (oldest first), and the second option returns entries + * in order of decreasing timestamps (newest first). Entries with equal + * timestamps are returned in order of their `insert_id` values. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Default is 50. If the value is negative or exceeds 1000, the request is + * rejected. The presence of `next_page_token` in the response indicates that + * more results might be available. + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `page_token` must be the value of + * `next_page_token` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.logging.v2.LogEntry|LogEntry} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listLogEntriesAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listLogEntriesStream(request, options) { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + const defaultCallSettings = this._defaults['listLogEntries']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listLogEntries.createStream(this.innerApiCalls.listLogEntries, request, callSettings); + } + /** + * Equivalent to `listLogEntries`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string[]} request.resourceNames + * Required. Names of one or more parent resources from which to + * retrieve log entries: + * + * * `projects/[PROJECT_ID]` + * * `organizations/[ORGANIZATION_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]` + * * `folders/[FOLDER_ID]` + * + * May alternatively be one or more views: + * + * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * + * Projects listed in the `project_ids` field are added to this list. + * A maximum of 100 resources may be specified in a single request. + * @param {string} [request.filter] + * Optional. Only log entries that match the filter are returned. An empty + * filter matches all log entries in the resources listed in `resource_names`. + * Referencing a parent resource that is not listed in `resource_names` will + * cause the filter to return no results. The maximum length of a filter is + * 20,000 characters. + * @param {string} [request.orderBy] + * Optional. How the results should be sorted. Presently, the only permitted + * values are `"timestamp asc"` (default) and `"timestamp desc"`. The first + * option returns entries in order of increasing values of + * `LogEntry.timestamp` (oldest first), and the second option returns entries + * in order of decreasing timestamps (newest first). Entries with equal + * timestamps are returned in order of their `insert_id` values. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Default is 50. If the value is negative or exceeds 1000, the request is + * rejected. The presence of `next_page_token` in the response indicates that + * more results might be available. + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `page_token` must be the value of + * `next_page_token` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.logging.v2.LogEntry|LogEntry}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v2/logging_service_v2.list_log_entries.js + * region_tag:logging_v2_generated_LoggingServiceV2_ListLogEntries_async + */ + listLogEntriesAsync(request, options) { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + const defaultCallSettings = this._defaults['listLogEntries']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listLogEntries.asyncIterate(this.innerApiCalls['listLogEntries'], request, callSettings); + } + listMonitoredResourceDescriptors(request, optionsOrCallback, callback) { + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + this.initialize(); + return this.innerApiCalls.listMonitoredResourceDescriptors(request, options, callback); + } + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listMonitoredResourceDescriptorsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listMonitoredResourceDescriptorsStream(request, options) { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + const defaultCallSettings = this._defaults['listMonitoredResourceDescriptors']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMonitoredResourceDescriptors.createStream(this.innerApiCalls.listMonitoredResourceDescriptors, request, callSettings); + } + /** + * Equivalent to `listMonitoredResourceDescriptors`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.api.MonitoredResourceDescriptor|MonitoredResourceDescriptor}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v2/logging_service_v2.list_monitored_resource_descriptors.js + * region_tag:logging_v2_generated_LoggingServiceV2_ListMonitoredResourceDescriptors_async + */ + listMonitoredResourceDescriptorsAsync(request, options) { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + const defaultCallSettings = this._defaults['listMonitoredResourceDescriptors']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listMonitoredResourceDescriptors.asyncIterate(this.innerApiCalls['listMonitoredResourceDescriptors'], request, callSettings); + } + listLogs(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.listLogs(request, options, callback); + } + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name to list logs for: + * + * * `projects/[PROJECT_ID]` + * * `organizations/[ORGANIZATION_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]` + * * `folders/[FOLDER_ID]` + * @param {string[]} [request.resourceNames] + * Optional. List of resource names to list logs for: + * + * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * + * To support legacy queries, it could also be: + * + * * `projects/[PROJECT_ID]` + * * `organizations/[ORGANIZATION_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]` + * * `folders/[FOLDER_ID]` + * + * The resource name in the `parent` field is added to this list. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing string on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listLogsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listLogsStream(request, options) { + var _a; + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', + }); + const defaultCallSettings = this._defaults['listLogs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listLogs.createStream(this.innerApiCalls.listLogs, request, callSettings); + } + /** + * Equivalent to `listLogs`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The resource name to list logs for: + * + * * `projects/[PROJECT_ID]` + * * `organizations/[ORGANIZATION_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]` + * * `folders/[FOLDER_ID]` + * @param {string[]} [request.resourceNames] + * Optional. List of resource names to list logs for: + * + * * `projects/[PROJECT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `organizations/[ORGANIZATION_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * * `folders/[FOLDER_ID]/locations/[LOCATION_ID]/buckets/[BUCKET_ID]/views/[VIEW_ID]` + * + * To support legacy queries, it could also be: + * + * * `projects/[PROJECT_ID]` + * * `organizations/[ORGANIZATION_ID]` + * * `billingAccounts/[BILLING_ACCOUNT_ID]` + * * `folders/[FOLDER_ID]` + * + * The resource name in the `parent` field is added to this list. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * string. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v2/logging_service_v2.list_logs.js + * region_tag:logging_v2_generated_LoggingServiceV2_ListLogs_async + */ + listLogsAsync(request, options) { + var _a; + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', + }); + const defaultCallSettings = this._defaults['listLogs']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listLogs.asyncIterate(this.innerApiCalls['listLogs'], request, callSettings); + } + // -------------------- + // -- Path templates -- + // -------------------- + /** + * Return a fully-qualified billingAccountCmekSettings resource name string. + * + * @param {string} billing_account + * @returns {string} Resource name string. + */ + billingAccountCmekSettingsPath(billingAccount) { + return this.pathTemplates.billingAccountCmekSettingsPathTemplate.render({ + billing_account: billingAccount, + }); + } + /** + * Parse the billing_account from BillingAccountCmekSettings resource. + * + * @param {string} billingAccountCmekSettingsName + * A fully-qualified path representing billing_account_cmekSettings resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountCmekSettingsName(billingAccountCmekSettingsName) { + return this.pathTemplates.billingAccountCmekSettingsPathTemplate.match(billingAccountCmekSettingsName).billing_account; + } + /** + * Return a fully-qualified billingAccountExclusion resource name string. + * + * @param {string} billing_account + * @param {string} exclusion + * @returns {string} Resource name string. + */ + billingAccountExclusionPath(billingAccount, exclusion) { + return this.pathTemplates.billingAccountExclusionPathTemplate.render({ + billing_account: billingAccount, + exclusion: exclusion, + }); + } + /** + * Parse the billing_account from BillingAccountExclusion resource. + * + * @param {string} billingAccountExclusionName + * A fully-qualified path representing billing_account_exclusion resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountExclusionName(billingAccountExclusionName) { + return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).billing_account; + } + /** + * Parse the exclusion from BillingAccountExclusion resource. + * + * @param {string} billingAccountExclusionName + * A fully-qualified path representing billing_account_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromBillingAccountExclusionName(billingAccountExclusionName) { + return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).exclusion; + } + /** + * Return a fully-qualified billingAccountLocationBucket resource name string. + * + * @param {string} billing_account + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + billingAccountLocationBucketPath(billingAccount, location, bucket) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.render({ + billing_account: billingAccount, + location: location, + bucket: bucket, + }); + } + /** + * Parse the billing_account from BillingAccountLocationBucket resource. + * + * @param {string} billingAccountLocationBucketName + * A fully-qualified path representing billing_account_location_bucket resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLocationBucketName(billingAccountLocationBucketName) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).billing_account; + } + /** + * Parse the location from BillingAccountLocationBucket resource. + * + * @param {string} billingAccountLocationBucketName + * A fully-qualified path representing billing_account_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBillingAccountLocationBucketName(billingAccountLocationBucketName) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).location; + } + /** + * Parse the bucket from BillingAccountLocationBucket resource. + * + * @param {string} billingAccountLocationBucketName + * A fully-qualified path representing billing_account_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromBillingAccountLocationBucketName(billingAccountLocationBucketName) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).bucket; + } + /** + * Return a fully-qualified billingAccountLocationBucketLink resource name string. + * + * @param {string} billing_account + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + billingAccountLocationBucketLinkPath(billingAccount, location, bucket, link) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render({ + billing_account: billingAccount, + location: location, + bucket: bucket, + link: link, + }); + } + /** + * Parse the billing_account from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).billing_account; + } + /** + * Parse the location from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).location; + } + /** + * Parse the bucket from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).bucket; + } + /** + * Parse the link from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).link; + } + /** + * Return a fully-qualified billingAccountLocationBucketView resource name string. + * + * @param {string} billing_account + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + billingAccountLocationBucketViewPath(billingAccount, location, bucket, view) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.render({ + billing_account: billingAccount, + location: location, + bucket: bucket, + view: view, + }); + } + /** + * Parse the billing_account from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).billing_account; + } + /** + * Parse the location from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).location; + } + /** + * Parse the bucket from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).bucket; + } + /** + * Parse the view from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).view; + } + /** + * Return a fully-qualified billingAccountLog resource name string. + * + * @param {string} billing_account + * @param {string} log + * @returns {string} Resource name string. + */ + billingAccountLogPath(billingAccount, log) { + return this.pathTemplates.billingAccountLogPathTemplate.render({ + billing_account: billingAccount, + log: log, + }); + } + /** + * Parse the billing_account from BillingAccountLog resource. + * + * @param {string} billingAccountLogName + * A fully-qualified path representing billing_account_log resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLogName(billingAccountLogName) { + return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).billing_account; + } + /** + * Parse the log from BillingAccountLog resource. + * + * @param {string} billingAccountLogName + * A fully-qualified path representing billing_account_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromBillingAccountLogName(billingAccountLogName) { + return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).log; + } + /** + * Return a fully-qualified billingAccountSettings resource name string. + * + * @param {string} billing_account + * @returns {string} Resource name string. + */ + billingAccountSettingsPath(billingAccount) { + return this.pathTemplates.billingAccountSettingsPathTemplate.render({ + billing_account: billingAccount, + }); + } + /** + * Parse the billing_account from BillingAccountSettings resource. + * + * @param {string} billingAccountSettingsName + * A fully-qualified path representing billing_account_settings resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountSettingsName(billingAccountSettingsName) { + return this.pathTemplates.billingAccountSettingsPathTemplate.match(billingAccountSettingsName).billing_account; + } + /** + * Return a fully-qualified billingAccountSink resource name string. + * + * @param {string} billing_account + * @param {string} sink + * @returns {string} Resource name string. + */ + billingAccountSinkPath(billingAccount, sink) { + return this.pathTemplates.billingAccountSinkPathTemplate.render({ + billing_account: billingAccount, + sink: sink, + }); + } + /** + * Parse the billing_account from BillingAccountSink resource. + * + * @param {string} billingAccountSinkName + * A fully-qualified path representing billing_account_sink resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountSinkName(billingAccountSinkName) { + return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).billing_account; + } + /** + * Parse the sink from BillingAccountSink resource. + * + * @param {string} billingAccountSinkName + * A fully-qualified path representing billing_account_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromBillingAccountSinkName(billingAccountSinkName) { + return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).sink; + } + /** + * Return a fully-qualified folderCmekSettings resource name string. + * + * @param {string} folder + * @returns {string} Resource name string. + */ + folderCmekSettingsPath(folder) { + return this.pathTemplates.folderCmekSettingsPathTemplate.render({ + folder: folder, + }); + } + /** + * Parse the folder from FolderCmekSettings resource. + * + * @param {string} folderCmekSettingsName + * A fully-qualified path representing folder_cmekSettings resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderCmekSettingsName(folderCmekSettingsName) { + return this.pathTemplates.folderCmekSettingsPathTemplate.match(folderCmekSettingsName).folder; + } + /** + * Return a fully-qualified folderExclusion resource name string. + * + * @param {string} folder + * @param {string} exclusion + * @returns {string} Resource name string. + */ + folderExclusionPath(folder, exclusion) { + return this.pathTemplates.folderExclusionPathTemplate.render({ + folder: folder, + exclusion: exclusion, + }); + } + /** + * Parse the folder from FolderExclusion resource. + * + * @param {string} folderExclusionName + * A fully-qualified path representing folder_exclusion resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderExclusionName(folderExclusionName) { + return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).folder; + } + /** + * Parse the exclusion from FolderExclusion resource. + * + * @param {string} folderExclusionName + * A fully-qualified path representing folder_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromFolderExclusionName(folderExclusionName) { + return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).exclusion; + } + /** + * Return a fully-qualified folderLocationBucket resource name string. + * + * @param {string} folder + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + folderLocationBucketPath(folder, location, bucket) { + return this.pathTemplates.folderLocationBucketPathTemplate.render({ + folder: folder, + location: location, + bucket: bucket, + }); + } + /** + * Parse the folder from FolderLocationBucket resource. + * + * @param {string} folderLocationBucketName + * A fully-qualified path representing folder_location_bucket resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLocationBucketName(folderLocationBucketName) { + return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).folder; + } + /** + * Parse the location from FolderLocationBucket resource. + * + * @param {string} folderLocationBucketName + * A fully-qualified path representing folder_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFolderLocationBucketName(folderLocationBucketName) { + return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).location; + } + /** + * Parse the bucket from FolderLocationBucket resource. + * + * @param {string} folderLocationBucketName + * A fully-qualified path representing folder_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromFolderLocationBucketName(folderLocationBucketName) { + return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).bucket; + } + /** + * Return a fully-qualified folderLocationBucketLink resource name string. + * + * @param {string} folder + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + folderLocationBucketLinkPath(folder, location, bucket, link) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.render({ + folder: folder, + location: location, + bucket: bucket, + link: link, + }); + } + /** + * Parse the folder from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLocationBucketLinkName(folderLocationBucketLinkName) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).folder; + } + /** + * Parse the location from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFolderLocationBucketLinkName(folderLocationBucketLinkName) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).location; + } + /** + * Parse the bucket from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromFolderLocationBucketLinkName(folderLocationBucketLinkName) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).bucket; + } + /** + * Parse the link from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromFolderLocationBucketLinkName(folderLocationBucketLinkName) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).link; + } + /** + * Return a fully-qualified folderLocationBucketView resource name string. + * + * @param {string} folder + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + folderLocationBucketViewPath(folder, location, bucket, view) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.render({ + folder: folder, + location: location, + bucket: bucket, + view: view, + }); + } + /** + * Parse the folder from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLocationBucketViewName(folderLocationBucketViewName) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).folder; + } + /** + * Parse the location from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFolderLocationBucketViewName(folderLocationBucketViewName) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).location; + } + /** + * Parse the bucket from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromFolderLocationBucketViewName(folderLocationBucketViewName) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).bucket; + } + /** + * Parse the view from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromFolderLocationBucketViewName(folderLocationBucketViewName) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).view; + } + /** + * Return a fully-qualified folderLog resource name string. + * + * @param {string} folder + * @param {string} log + * @returns {string} Resource name string. + */ + folderLogPath(folder, log) { + return this.pathTemplates.folderLogPathTemplate.render({ + folder: folder, + log: log, + }); + } + /** + * Parse the folder from FolderLog resource. + * + * @param {string} folderLogName + * A fully-qualified path representing folder_log resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLogName(folderLogName) { + return this.pathTemplates.folderLogPathTemplate.match(folderLogName).folder; + } + /** + * Parse the log from FolderLog resource. + * + * @param {string} folderLogName + * A fully-qualified path representing folder_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromFolderLogName(folderLogName) { + return this.pathTemplates.folderLogPathTemplate.match(folderLogName).log; + } + /** + * Return a fully-qualified folderSettings resource name string. + * + * @param {string} folder + * @returns {string} Resource name string. + */ + folderSettingsPath(folder) { + return this.pathTemplates.folderSettingsPathTemplate.render({ + folder: folder, + }); + } + /** + * Parse the folder from FolderSettings resource. + * + * @param {string} folderSettingsName + * A fully-qualified path representing folder_settings resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderSettingsName(folderSettingsName) { + return this.pathTemplates.folderSettingsPathTemplate.match(folderSettingsName).folder; + } + /** + * Return a fully-qualified folderSink resource name string. + * + * @param {string} folder + * @param {string} sink + * @returns {string} Resource name string. + */ + folderSinkPath(folder, sink) { + return this.pathTemplates.folderSinkPathTemplate.render({ + folder: folder, + sink: sink, + }); + } + /** + * Parse the folder from FolderSink resource. + * + * @param {string} folderSinkName + * A fully-qualified path representing folder_sink resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderSinkName(folderSinkName) { + return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName) + .folder; + } + /** + * Parse the sink from FolderSink resource. + * + * @param {string} folderSinkName + * A fully-qualified path representing folder_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromFolderSinkName(folderSinkName) { + return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).sink; + } + /** + * Return a fully-qualified logMetric resource name string. + * + * @param {string} project + * @param {string} metric + * @returns {string} Resource name string. + */ + logMetricPath(project, metric) { + return this.pathTemplates.logMetricPathTemplate.render({ + project: project, + metric: metric, + }); + } + /** + * Parse the project from LogMetric resource. + * + * @param {string} logMetricName + * A fully-qualified path representing LogMetric resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLogMetricName(logMetricName) { + return this.pathTemplates.logMetricPathTemplate.match(logMetricName) + .project; + } + /** + * Parse the metric from LogMetric resource. + * + * @param {string} logMetricName + * A fully-qualified path representing LogMetric resource. + * @returns {string} A string representing the metric. + */ + matchMetricFromLogMetricName(logMetricName) { + return this.pathTemplates.logMetricPathTemplate.match(logMetricName).metric; + } + /** + * Return a fully-qualified organizationCmekSettings resource name string. + * + * @param {string} organization + * @returns {string} Resource name string. + */ + organizationCmekSettingsPath(organization) { + return this.pathTemplates.organizationCmekSettingsPathTemplate.render({ + organization: organization, + }); + } + /** + * Parse the organization from OrganizationCmekSettings resource. + * + * @param {string} organizationCmekSettingsName + * A fully-qualified path representing organization_cmekSettings resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationCmekSettingsName(organizationCmekSettingsName) { + return this.pathTemplates.organizationCmekSettingsPathTemplate.match(organizationCmekSettingsName).organization; + } + /** + * Return a fully-qualified organizationExclusion resource name string. + * + * @param {string} organization + * @param {string} exclusion + * @returns {string} Resource name string. + */ + organizationExclusionPath(organization, exclusion) { + return this.pathTemplates.organizationExclusionPathTemplate.render({ + organization: organization, + exclusion: exclusion, + }); + } + /** + * Parse the organization from OrganizationExclusion resource. + * + * @param {string} organizationExclusionName + * A fully-qualified path representing organization_exclusion resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationExclusionName(organizationExclusionName) { + return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).organization; + } + /** + * Parse the exclusion from OrganizationExclusion resource. + * + * @param {string} organizationExclusionName + * A fully-qualified path representing organization_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromOrganizationExclusionName(organizationExclusionName) { + return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).exclusion; + } + /** + * Return a fully-qualified organizationLocationBucket resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + organizationLocationBucketPath(organization, location, bucket) { + return this.pathTemplates.organizationLocationBucketPathTemplate.render({ + organization: organization, + location: location, + bucket: bucket, + }); + } + /** + * Parse the organization from OrganizationLocationBucket resource. + * + * @param {string} organizationLocationBucketName + * A fully-qualified path representing organization_location_bucket resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationBucketName(organizationLocationBucketName) { + return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).organization; + } + /** + * Parse the location from OrganizationLocationBucket resource. + * + * @param {string} organizationLocationBucketName + * A fully-qualified path representing organization_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationBucketName(organizationLocationBucketName) { + return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).location; + } + /** + * Parse the bucket from OrganizationLocationBucket resource. + * + * @param {string} organizationLocationBucketName + * A fully-qualified path representing organization_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromOrganizationLocationBucketName(organizationLocationBucketName) { + return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).bucket; + } + /** + * Return a fully-qualified organizationLocationBucketLink resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + organizationLocationBucketLinkPath(organization, location, bucket, link) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.render({ + organization: organization, + location: location, + bucket: bucket, + link: link, + }); + } + /** + * Parse the organization from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).organization; + } + /** + * Parse the location from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).location; + } + /** + * Parse the bucket from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).bucket; + } + /** + * Parse the link from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).link; + } + /** + * Return a fully-qualified organizationLocationBucketView resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + organizationLocationBucketViewPath(organization, location, bucket, view) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.render({ + organization: organization, + location: location, + bucket: bucket, + view: view, + }); + } + /** + * Parse the organization from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).organization; + } + /** + * Parse the location from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).location; + } + /** + * Parse the bucket from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromOrganizationLocationBucketViewName(organizationLocationBucketViewName) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).bucket; + } + /** + * Parse the view from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromOrganizationLocationBucketViewName(organizationLocationBucketViewName) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).view; + } + /** + * Return a fully-qualified organizationLog resource name string. + * + * @param {string} organization + * @param {string} log + * @returns {string} Resource name string. + */ + organizationLogPath(organization, log) { + return this.pathTemplates.organizationLogPathTemplate.render({ + organization: organization, + log: log, + }); + } + /** + * Parse the organization from OrganizationLog resource. + * + * @param {string} organizationLogName + * A fully-qualified path representing organization_log resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLogName(organizationLogName) { + return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).organization; + } + /** + * Parse the log from OrganizationLog resource. + * + * @param {string} organizationLogName + * A fully-qualified path representing organization_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromOrganizationLogName(organizationLogName) { + return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).log; + } + /** + * Return a fully-qualified organizationSettings resource name string. + * + * @param {string} organization + * @returns {string} Resource name string. + */ + organizationSettingsPath(organization) { + return this.pathTemplates.organizationSettingsPathTemplate.render({ + organization: organization, + }); + } + /** + * Parse the organization from OrganizationSettings resource. + * + * @param {string} organizationSettingsName + * A fully-qualified path representing organization_settings resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSettingsName(organizationSettingsName) { + return this.pathTemplates.organizationSettingsPathTemplate.match(organizationSettingsName).organization; + } + /** + * Return a fully-qualified organizationSink resource name string. + * + * @param {string} organization + * @param {string} sink + * @returns {string} Resource name string. + */ + organizationSinkPath(organization, sink) { + return this.pathTemplates.organizationSinkPathTemplate.render({ + organization: organization, + sink: sink, + }); + } + /** + * Parse the organization from OrganizationSink resource. + * + * @param {string} organizationSinkName + * A fully-qualified path representing organization_sink resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSinkName(organizationSinkName) { + return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).organization; + } + /** + * Parse the sink from OrganizationSink resource. + * + * @param {string} organizationSinkName + * A fully-qualified path representing organization_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromOrganizationSinkName(organizationSinkName) { + return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).sink; + } + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + /** + * Return a fully-qualified projectCmekSettings resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectCmekSettingsPath(project) { + return this.pathTemplates.projectCmekSettingsPathTemplate.render({ + project: project, + }); + } + /** + * Parse the project from ProjectCmekSettings resource. + * + * @param {string} projectCmekSettingsName + * A fully-qualified path representing project_cmekSettings resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectCmekSettingsName(projectCmekSettingsName) { + return this.pathTemplates.projectCmekSettingsPathTemplate.match(projectCmekSettingsName).project; + } + /** + * Return a fully-qualified projectExclusion resource name string. + * + * @param {string} project + * @param {string} exclusion + * @returns {string} Resource name string. + */ + projectExclusionPath(project, exclusion) { + return this.pathTemplates.projectExclusionPathTemplate.render({ + project: project, + exclusion: exclusion, + }); + } + /** + * Parse the project from ProjectExclusion resource. + * + * @param {string} projectExclusionName + * A fully-qualified path representing project_exclusion resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectExclusionName(projectExclusionName) { + return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).project; + } + /** + * Parse the exclusion from ProjectExclusion resource. + * + * @param {string} projectExclusionName + * A fully-qualified path representing project_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromProjectExclusionName(projectExclusionName) { + return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).exclusion; + } + /** + * Return a fully-qualified projectLocationBucket resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + projectLocationBucketPath(project, location, bucket) { + return this.pathTemplates.projectLocationBucketPathTemplate.render({ + project: project, + location: location, + bucket: bucket, + }); + } + /** + * Parse the project from ProjectLocationBucket resource. + * + * @param {string} projectLocationBucketName + * A fully-qualified path representing project_location_bucket resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationBucketName(projectLocationBucketName) { + return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).project; + } + /** + * Parse the location from ProjectLocationBucket resource. + * + * @param {string} projectLocationBucketName + * A fully-qualified path representing project_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationBucketName(projectLocationBucketName) { + return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).location; + } + /** + * Parse the bucket from ProjectLocationBucket resource. + * + * @param {string} projectLocationBucketName + * A fully-qualified path representing project_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromProjectLocationBucketName(projectLocationBucketName) { + return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).bucket; + } + /** + * Return a fully-qualified projectLocationBucketLink resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + projectLocationBucketLinkPath(project, location, bucket, link) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.render({ + project: project, + location: location, + bucket: bucket, + link: link, + }); + } + /** + * Parse the project from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationBucketLinkName(projectLocationBucketLinkName) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).project; + } + /** + * Parse the location from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationBucketLinkName(projectLocationBucketLinkName) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).location; + } + /** + * Parse the bucket from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromProjectLocationBucketLinkName(projectLocationBucketLinkName) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).bucket; + } + /** + * Parse the link from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromProjectLocationBucketLinkName(projectLocationBucketLinkName) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).link; + } + /** + * Return a fully-qualified projectLocationBucketView resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + projectLocationBucketViewPath(project, location, bucket, view) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.render({ + project: project, + location: location, + bucket: bucket, + view: view, + }); + } + /** + * Parse the project from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationBucketViewName(projectLocationBucketViewName) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).project; + } + /** + * Parse the location from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationBucketViewName(projectLocationBucketViewName) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).location; + } + /** + * Parse the bucket from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromProjectLocationBucketViewName(projectLocationBucketViewName) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).bucket; + } + /** + * Parse the view from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromProjectLocationBucketViewName(projectLocationBucketViewName) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).view; + } + /** + * Return a fully-qualified projectLog resource name string. + * + * @param {string} project + * @param {string} log + * @returns {string} Resource name string. + */ + projectLogPath(project, log) { + return this.pathTemplates.projectLogPathTemplate.render({ + project: project, + log: log, + }); + } + /** + * Parse the project from ProjectLog resource. + * + * @param {string} projectLogName + * A fully-qualified path representing project_log resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLogName(projectLogName) { + return this.pathTemplates.projectLogPathTemplate.match(projectLogName) + .project; + } + /** + * Parse the log from ProjectLog resource. + * + * @param {string} projectLogName + * A fully-qualified path representing project_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromProjectLogName(projectLogName) { + return this.pathTemplates.projectLogPathTemplate.match(projectLogName).log; + } + /** + * Return a fully-qualified projectSettings resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectSettingsPath(project) { + return this.pathTemplates.projectSettingsPathTemplate.render({ + project: project, + }); + } + /** + * Parse the project from ProjectSettings resource. + * + * @param {string} projectSettingsName + * A fully-qualified path representing project_settings resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSettingsName(projectSettingsName) { + return this.pathTemplates.projectSettingsPathTemplate.match(projectSettingsName).project; + } + /** + * Return a fully-qualified projectSink resource name string. + * + * @param {string} project + * @param {string} sink + * @returns {string} Resource name string. + */ + projectSinkPath(project, sink) { + return this.pathTemplates.projectSinkPathTemplate.render({ + project: project, + sink: sink, + }); + } + /** + * Parse the project from ProjectSink resource. + * + * @param {string} projectSinkName + * A fully-qualified path representing project_sink resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSinkName(projectSinkName) { + return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName) + .project; + } + /** + * Parse the sink from ProjectSink resource. + * + * @param {string} projectSinkName + * A fully-qualified path representing project_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromProjectSinkName(projectSinkName) { + return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName) + .sink; + } + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close() { + if (this.loggingServiceV2Stub && !this._terminated) { + return this.loggingServiceV2Stub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} +exports.LoggingServiceV2Client = LoggingServiceV2Client; +//# sourceMappingURL=logging_service_v2_client.js.map + +/***/ }), + +/***/ 92944: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright 2024 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.MetricsServiceV2Client = void 0; +const jsonProtos = __nccwpck_require__(82721); +/** + * Client JSON configuration object, loaded from + * `src/v2/metrics_service_v2_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +const gapicConfig = __nccwpck_require__(95061); +const version = (__nccwpck_require__(38105)/* .version */ .rE); +/** + * Service for configuring logs-based metrics. + * @class + * @memberof v2 + */ +class MetricsServiceV2Client { + /** + * Construct an instance of MetricsServiceV2Client. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP/1.1 REST mode. + * For more information, please check the + * {@link https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#http11-rest-api-mode documentation}. + * @param {gax} [gaxInstance]: loaded instance of `google-gax`. Useful if you + * need to avoid loading the default gRPC version and want to use the fallback + * HTTP implementation. Load only fallback version and pass it to the constructor: + * ``` + * const gax = require('google-gax/build/src/fallback'); // avoids loading google-gax with gRPC + * const client = new MetricsServiceV2Client({fallback: true}, gax); + * ``` + */ + constructor(opts, gaxInstance) { + var _a, _b, _c, _d, _e; + this._terminated = false; + this.descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + // Ensure that options include all the required fields. + const staticMembers = this.constructor; + if ((opts === null || opts === void 0 ? void 0 : opts.universe_domain) && + (opts === null || opts === void 0 ? void 0 : opts.universeDomain) && + (opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== (opts === null || opts === void 0 ? void 0 : opts.universeDomain)) { + throw new Error('Please set either universe_domain or universeDomain, but not both.'); + } + const universeDomainEnvVar = typeof process === 'object' && typeof process.env === 'object' + ? process.env['GOOGLE_CLOUD_UNIVERSE_DOMAIN'] + : undefined; + this._universeDomain = + (_c = (_b = (_a = opts === null || opts === void 0 ? void 0 : opts.universeDomain) !== null && _a !== void 0 ? _a : opts === null || opts === void 0 ? void 0 : opts.universe_domain) !== null && _b !== void 0 ? _b : universeDomainEnvVar) !== null && _c !== void 0 ? _c : 'googleapis.com'; + this._servicePath = 'logging.' + this._universeDomain; + const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || this._servicePath; + this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint)); + const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port; + const clientConfig = (_d = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _d !== void 0 ? _d : {}; + const fallback = (_e = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _e !== void 0 ? _e : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + // Request numeric enum values if REST transport is used. + opts.numericEnums = true; + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== this._servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + // Load google-gax module synchronously if needed + if (!gaxInstance) { + gaxInstance = __nccwpck_require__(83232); + } + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gaxInstance.fallback : gaxInstance; + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + // Save options to use in initialize() method. + this._opts = opts; + // Save the auth object to the client, for use by other methods. + this.auth = this._gaxGrpc.auth; + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = this._servicePath; + // Set the default scopes in auth client if needed. + if (servicePath === this._servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + // Determine the client header string. + const clientHeader = [`gax/${this._gaxModule.version}`, `gapic/${version}`]; + if (typeof process === 'object' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } + else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } + else { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + billingAccountCmekSettingsPathTemplate: new this._gaxModule.PathTemplate('billingAccounts/{billing_account}/cmekSettings'), + billingAccountExclusionPathTemplate: new this._gaxModule.PathTemplate('billingAccounts/{billing_account}/exclusions/{exclusion}'), + billingAccountLocationBucketPathTemplate: new this._gaxModule.PathTemplate('billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}'), + billingAccountLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate('billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/links/{link}'), + billingAccountLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate('billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/views/{view}'), + billingAccountLogPathTemplate: new this._gaxModule.PathTemplate('billingAccounts/{billing_account}/logs/{log}'), + billingAccountSettingsPathTemplate: new this._gaxModule.PathTemplate('billingAccounts/{billing_account}/settings'), + billingAccountSinkPathTemplate: new this._gaxModule.PathTemplate('billingAccounts/{billing_account}/sinks/{sink}'), + folderCmekSettingsPathTemplate: new this._gaxModule.PathTemplate('folders/{folder}/cmekSettings'), + folderExclusionPathTemplate: new this._gaxModule.PathTemplate('folders/{folder}/exclusions/{exclusion}'), + folderLocationBucketPathTemplate: new this._gaxModule.PathTemplate('folders/{folder}/locations/{location}/buckets/{bucket}'), + folderLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate('folders/{folder}/locations/{location}/buckets/{bucket}/links/{link}'), + folderLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate('folders/{folder}/locations/{location}/buckets/{bucket}/views/{view}'), + folderLogPathTemplate: new this._gaxModule.PathTemplate('folders/{folder}/logs/{log}'), + folderSettingsPathTemplate: new this._gaxModule.PathTemplate('folders/{folder}/settings'), + folderSinkPathTemplate: new this._gaxModule.PathTemplate('folders/{folder}/sinks/{sink}'), + logMetricPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/metrics/{metric}'), + organizationCmekSettingsPathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}/cmekSettings'), + organizationExclusionPathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}/exclusions/{exclusion}'), + organizationLocationBucketPathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}/locations/{location}/buckets/{bucket}'), + organizationLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}/locations/{location}/buckets/{bucket}/links/{link}'), + organizationLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}/locations/{location}/buckets/{bucket}/views/{view}'), + organizationLogPathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}/logs/{log}'), + organizationSettingsPathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}/settings'), + organizationSinkPathTemplate: new this._gaxModule.PathTemplate('organizations/{organization}/sinks/{sink}'), + projectPathTemplate: new this._gaxModule.PathTemplate('projects/{project}'), + projectCmekSettingsPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/cmekSettings'), + projectExclusionPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/exclusions/{exclusion}'), + projectLocationBucketPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/buckets/{bucket}'), + projectLocationBucketLinkPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/buckets/{bucket}/links/{link}'), + projectLocationBucketViewPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/locations/{location}/buckets/{bucket}/views/{view}'), + projectLogPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/logs/{log}'), + projectSettingsPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/settings'), + projectSinkPathTemplate: new this._gaxModule.PathTemplate('projects/{project}/sinks/{sink}'), + }; + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listLogMetrics: new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'metrics'), + }; + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings('google.logging.v2.MetricsServiceV2', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') }); + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + // Add a warn function to the client constructor so it can be easily tested. + this.warn = this._gaxModule.warn; + } + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.metricsServiceV2Stub) { + return this.metricsServiceV2Stub; + } + // Put together the "service stub" for + // google.logging.v2.MetricsServiceV2. + this.metricsServiceV2Stub = this._gaxGrpc.createStub(this._opts.fallback + ? this._protos.lookupService('google.logging.v2.MetricsServiceV2') + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._protos.google.logging.v2.MetricsServiceV2, this._opts, this._providedCustomServicePath); + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const metricsServiceV2StubMethods = [ + 'listLogMetrics', + 'getLogMetric', + 'createLogMetric', + 'updateLogMetric', + 'deleteLogMetric', + ]; + for (const methodName of metricsServiceV2StubMethods) { + const callPromise = this.metricsServiceV2Stub.then(stub => (...args) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, (err) => () => { + throw err; + }); + const descriptor = this.descriptors.page[methodName] || undefined; + const apiCall = this._gaxModule.createApiCall(callPromise, this._defaults[methodName], descriptor, this._opts.fallback); + this.innerApiCalls[methodName] = apiCall; + } + return this.metricsServiceV2Stub; + } + /** + * The DNS address for this API service. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + if (typeof process === 'object' && + typeof process.emitWarning === 'function') { + process.emitWarning('Static servicePath is deprecated, please use the instance method instead.', 'DeprecationWarning'); + } + return 'logging.googleapis.com'; + } + /** + * The DNS address for this API service - same as servicePath. + * @deprecated Use the apiEndpoint method of the client instance. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + if (typeof process === 'object' && + typeof process.emitWarning === 'function') { + process.emitWarning('Static apiEndpoint is deprecated, please use the instance method instead.', 'DeprecationWarning'); + } + return 'logging.googleapis.com'; + } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + get apiEndpoint() { + return this._servicePath; + } + get universeDomain() { + return this._universeDomain; + } + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/cloud-platform.read-only', + 'https://www.googleapis.com/auth/logging.admin', + 'https://www.googleapis.com/auth/logging.read', + 'https://www.googleapis.com/auth/logging.write', + ]; + } + /** + * Return the project ID used by this class. + * @returns {Promise} A promise that resolves to string containing the project ID. + */ + getProjectId(callback) { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + getLogMetric(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + metric_name: (_a = request.metricName) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.getLogMetric(request, options, callback); + } + createLogMetric(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.createLogMetric(request, options, callback); + } + updateLogMetric(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + metric_name: (_a = request.metricName) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.updateLogMetric(request, options, callback); + } + deleteLogMetric(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + metric_name: (_a = request.metricName) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.deleteLogMetric(request, options, callback); + } + listLogMetrics(request, optionsOrCallback, callback) { + var _a; + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', + }); + this.initialize(); + return this.innerApiCalls.listLogMetrics(request, options, callback); + } + /** + * Equivalent to `method.name.toCamelCase()`, but returns a NodeJS Stream object. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the project containing the metrics: + * + * "projects/[PROJECT_ID]" + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Stream} + * An object stream which emits an object representing {@link protos.google.logging.v2.LogMetric|LogMetric} on 'data' event. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed. Note that it can affect your quota. + * We recommend using `listLogMetricsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + */ + listLogMetricsStream(request, options) { + var _a; + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', + }); + const defaultCallSettings = this._defaults['listLogMetrics']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listLogMetrics.createStream(this.innerApiCalls.listLogMetrics, request, callSettings); + } + /** + * Equivalent to `listLogMetrics`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The name of the project containing the metrics: + * + * "projects/[PROJECT_ID]" + * @param {string} [request.pageToken] + * Optional. If present, then retrieve the next batch of results from the + * preceding call to this method. `pageToken` must be the value of + * `nextPageToken` from the previous response. The values of other method + * parameters should be identical to those in the previous call. + * @param {number} [request.pageSize] + * Optional. The maximum number of results to return from this request. + * Non-positive values are ignored. The presence of `nextPageToken` in the + * response indicates that more results might be available. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols | async iteration }. + * When you iterate the returned iterable, each element will be an object representing + * {@link protos.google.logging.v2.LogMetric|LogMetric}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the {@link https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination | documentation } + * for more details and examples. + * @example include:samples/generated/v2/metrics_service_v2.list_log_metrics.js + * region_tag:logging_v2_generated_MetricsServiceV2_ListLogMetrics_async + */ + listLogMetricsAsync(request, options) { + var _a; + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + this._gaxModule.routingHeader.fromParams({ + parent: (_a = request.parent) !== null && _a !== void 0 ? _a : '', + }); + const defaultCallSettings = this._defaults['listLogMetrics']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listLogMetrics.asyncIterate(this.innerApiCalls['listLogMetrics'], request, callSettings); + } + // -------------------- + // -- Path templates -- + // -------------------- + /** + * Return a fully-qualified billingAccountCmekSettings resource name string. + * + * @param {string} billing_account + * @returns {string} Resource name string. + */ + billingAccountCmekSettingsPath(billingAccount) { + return this.pathTemplates.billingAccountCmekSettingsPathTemplate.render({ + billing_account: billingAccount, + }); + } + /** + * Parse the billing_account from BillingAccountCmekSettings resource. + * + * @param {string} billingAccountCmekSettingsName + * A fully-qualified path representing billing_account_cmekSettings resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountCmekSettingsName(billingAccountCmekSettingsName) { + return this.pathTemplates.billingAccountCmekSettingsPathTemplate.match(billingAccountCmekSettingsName).billing_account; + } + /** + * Return a fully-qualified billingAccountExclusion resource name string. + * + * @param {string} billing_account + * @param {string} exclusion + * @returns {string} Resource name string. + */ + billingAccountExclusionPath(billingAccount, exclusion) { + return this.pathTemplates.billingAccountExclusionPathTemplate.render({ + billing_account: billingAccount, + exclusion: exclusion, + }); + } + /** + * Parse the billing_account from BillingAccountExclusion resource. + * + * @param {string} billingAccountExclusionName + * A fully-qualified path representing billing_account_exclusion resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountExclusionName(billingAccountExclusionName) { + return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).billing_account; + } + /** + * Parse the exclusion from BillingAccountExclusion resource. + * + * @param {string} billingAccountExclusionName + * A fully-qualified path representing billing_account_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromBillingAccountExclusionName(billingAccountExclusionName) { + return this.pathTemplates.billingAccountExclusionPathTemplate.match(billingAccountExclusionName).exclusion; + } + /** + * Return a fully-qualified billingAccountLocationBucket resource name string. + * + * @param {string} billing_account + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + billingAccountLocationBucketPath(billingAccount, location, bucket) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.render({ + billing_account: billingAccount, + location: location, + bucket: bucket, + }); + } + /** + * Parse the billing_account from BillingAccountLocationBucket resource. + * + * @param {string} billingAccountLocationBucketName + * A fully-qualified path representing billing_account_location_bucket resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLocationBucketName(billingAccountLocationBucketName) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).billing_account; + } + /** + * Parse the location from BillingAccountLocationBucket resource. + * + * @param {string} billingAccountLocationBucketName + * A fully-qualified path representing billing_account_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBillingAccountLocationBucketName(billingAccountLocationBucketName) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).location; + } + /** + * Parse the bucket from BillingAccountLocationBucket resource. + * + * @param {string} billingAccountLocationBucketName + * A fully-qualified path representing billing_account_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromBillingAccountLocationBucketName(billingAccountLocationBucketName) { + return this.pathTemplates.billingAccountLocationBucketPathTemplate.match(billingAccountLocationBucketName).bucket; + } + /** + * Return a fully-qualified billingAccountLocationBucketLink resource name string. + * + * @param {string} billing_account + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + billingAccountLocationBucketLinkPath(billingAccount, location, bucket, link) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.render({ + billing_account: billingAccount, + location: location, + bucket: bucket, + link: link, + }); + } + /** + * Parse the billing_account from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).billing_account; + } + /** + * Parse the location from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).location; + } + /** + * Parse the bucket from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).bucket; + } + /** + * Parse the link from BillingAccountLocationBucketLink resource. + * + * @param {string} billingAccountLocationBucketLinkName + * A fully-qualified path representing billing_account_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromBillingAccountLocationBucketLinkName(billingAccountLocationBucketLinkName) { + return this.pathTemplates.billingAccountLocationBucketLinkPathTemplate.match(billingAccountLocationBucketLinkName).link; + } + /** + * Return a fully-qualified billingAccountLocationBucketView resource name string. + * + * @param {string} billing_account + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + billingAccountLocationBucketViewPath(billingAccount, location, bucket, view) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.render({ + billing_account: billingAccount, + location: location, + bucket: bucket, + view: view, + }); + } + /** + * Parse the billing_account from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).billing_account; + } + /** + * Parse the location from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).location; + } + /** + * Parse the bucket from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).bucket; + } + /** + * Parse the view from BillingAccountLocationBucketView resource. + * + * @param {string} billingAccountLocationBucketViewName + * A fully-qualified path representing billing_account_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromBillingAccountLocationBucketViewName(billingAccountLocationBucketViewName) { + return this.pathTemplates.billingAccountLocationBucketViewPathTemplate.match(billingAccountLocationBucketViewName).view; + } + /** + * Return a fully-qualified billingAccountLog resource name string. + * + * @param {string} billing_account + * @param {string} log + * @returns {string} Resource name string. + */ + billingAccountLogPath(billingAccount, log) { + return this.pathTemplates.billingAccountLogPathTemplate.render({ + billing_account: billingAccount, + log: log, + }); + } + /** + * Parse the billing_account from BillingAccountLog resource. + * + * @param {string} billingAccountLogName + * A fully-qualified path representing billing_account_log resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountLogName(billingAccountLogName) { + return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).billing_account; + } + /** + * Parse the log from BillingAccountLog resource. + * + * @param {string} billingAccountLogName + * A fully-qualified path representing billing_account_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromBillingAccountLogName(billingAccountLogName) { + return this.pathTemplates.billingAccountLogPathTemplate.match(billingAccountLogName).log; + } + /** + * Return a fully-qualified billingAccountSettings resource name string. + * + * @param {string} billing_account + * @returns {string} Resource name string. + */ + billingAccountSettingsPath(billingAccount) { + return this.pathTemplates.billingAccountSettingsPathTemplate.render({ + billing_account: billingAccount, + }); + } + /** + * Parse the billing_account from BillingAccountSettings resource. + * + * @param {string} billingAccountSettingsName + * A fully-qualified path representing billing_account_settings resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountSettingsName(billingAccountSettingsName) { + return this.pathTemplates.billingAccountSettingsPathTemplate.match(billingAccountSettingsName).billing_account; + } + /** + * Return a fully-qualified billingAccountSink resource name string. + * + * @param {string} billing_account + * @param {string} sink + * @returns {string} Resource name string. + */ + billingAccountSinkPath(billingAccount, sink) { + return this.pathTemplates.billingAccountSinkPathTemplate.render({ + billing_account: billingAccount, + sink: sink, + }); + } + /** + * Parse the billing_account from BillingAccountSink resource. + * + * @param {string} billingAccountSinkName + * A fully-qualified path representing billing_account_sink resource. + * @returns {string} A string representing the billing_account. + */ + matchBillingAccountFromBillingAccountSinkName(billingAccountSinkName) { + return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).billing_account; + } + /** + * Parse the sink from BillingAccountSink resource. + * + * @param {string} billingAccountSinkName + * A fully-qualified path representing billing_account_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromBillingAccountSinkName(billingAccountSinkName) { + return this.pathTemplates.billingAccountSinkPathTemplate.match(billingAccountSinkName).sink; + } + /** + * Return a fully-qualified folderCmekSettings resource name string. + * + * @param {string} folder + * @returns {string} Resource name string. + */ + folderCmekSettingsPath(folder) { + return this.pathTemplates.folderCmekSettingsPathTemplate.render({ + folder: folder, + }); + } + /** + * Parse the folder from FolderCmekSettings resource. + * + * @param {string} folderCmekSettingsName + * A fully-qualified path representing folder_cmekSettings resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderCmekSettingsName(folderCmekSettingsName) { + return this.pathTemplates.folderCmekSettingsPathTemplate.match(folderCmekSettingsName).folder; + } + /** + * Return a fully-qualified folderExclusion resource name string. + * + * @param {string} folder + * @param {string} exclusion + * @returns {string} Resource name string. + */ + folderExclusionPath(folder, exclusion) { + return this.pathTemplates.folderExclusionPathTemplate.render({ + folder: folder, + exclusion: exclusion, + }); + } + /** + * Parse the folder from FolderExclusion resource. + * + * @param {string} folderExclusionName + * A fully-qualified path representing folder_exclusion resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderExclusionName(folderExclusionName) { + return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).folder; + } + /** + * Parse the exclusion from FolderExclusion resource. + * + * @param {string} folderExclusionName + * A fully-qualified path representing folder_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromFolderExclusionName(folderExclusionName) { + return this.pathTemplates.folderExclusionPathTemplate.match(folderExclusionName).exclusion; + } + /** + * Return a fully-qualified folderLocationBucket resource name string. + * + * @param {string} folder + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + folderLocationBucketPath(folder, location, bucket) { + return this.pathTemplates.folderLocationBucketPathTemplate.render({ + folder: folder, + location: location, + bucket: bucket, + }); + } + /** + * Parse the folder from FolderLocationBucket resource. + * + * @param {string} folderLocationBucketName + * A fully-qualified path representing folder_location_bucket resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLocationBucketName(folderLocationBucketName) { + return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).folder; + } + /** + * Parse the location from FolderLocationBucket resource. + * + * @param {string} folderLocationBucketName + * A fully-qualified path representing folder_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFolderLocationBucketName(folderLocationBucketName) { + return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).location; + } + /** + * Parse the bucket from FolderLocationBucket resource. + * + * @param {string} folderLocationBucketName + * A fully-qualified path representing folder_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromFolderLocationBucketName(folderLocationBucketName) { + return this.pathTemplates.folderLocationBucketPathTemplate.match(folderLocationBucketName).bucket; + } + /** + * Return a fully-qualified folderLocationBucketLink resource name string. + * + * @param {string} folder + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + folderLocationBucketLinkPath(folder, location, bucket, link) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.render({ + folder: folder, + location: location, + bucket: bucket, + link: link, + }); + } + /** + * Parse the folder from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLocationBucketLinkName(folderLocationBucketLinkName) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).folder; + } + /** + * Parse the location from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFolderLocationBucketLinkName(folderLocationBucketLinkName) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).location; + } + /** + * Parse the bucket from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromFolderLocationBucketLinkName(folderLocationBucketLinkName) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).bucket; + } + /** + * Parse the link from FolderLocationBucketLink resource. + * + * @param {string} folderLocationBucketLinkName + * A fully-qualified path representing folder_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromFolderLocationBucketLinkName(folderLocationBucketLinkName) { + return this.pathTemplates.folderLocationBucketLinkPathTemplate.match(folderLocationBucketLinkName).link; + } + /** + * Return a fully-qualified folderLocationBucketView resource name string. + * + * @param {string} folder + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + folderLocationBucketViewPath(folder, location, bucket, view) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.render({ + folder: folder, + location: location, + bucket: bucket, + view: view, + }); + } + /** + * Parse the folder from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLocationBucketViewName(folderLocationBucketViewName) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).folder; + } + /** + * Parse the location from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromFolderLocationBucketViewName(folderLocationBucketViewName) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).location; + } + /** + * Parse the bucket from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromFolderLocationBucketViewName(folderLocationBucketViewName) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).bucket; + } + /** + * Parse the view from FolderLocationBucketView resource. + * + * @param {string} folderLocationBucketViewName + * A fully-qualified path representing folder_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromFolderLocationBucketViewName(folderLocationBucketViewName) { + return this.pathTemplates.folderLocationBucketViewPathTemplate.match(folderLocationBucketViewName).view; + } + /** + * Return a fully-qualified folderLog resource name string. + * + * @param {string} folder + * @param {string} log + * @returns {string} Resource name string. + */ + folderLogPath(folder, log) { + return this.pathTemplates.folderLogPathTemplate.render({ + folder: folder, + log: log, + }); + } + /** + * Parse the folder from FolderLog resource. + * + * @param {string} folderLogName + * A fully-qualified path representing folder_log resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderLogName(folderLogName) { + return this.pathTemplates.folderLogPathTemplate.match(folderLogName).folder; + } + /** + * Parse the log from FolderLog resource. + * + * @param {string} folderLogName + * A fully-qualified path representing folder_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromFolderLogName(folderLogName) { + return this.pathTemplates.folderLogPathTemplate.match(folderLogName).log; + } + /** + * Return a fully-qualified folderSettings resource name string. + * + * @param {string} folder + * @returns {string} Resource name string. + */ + folderSettingsPath(folder) { + return this.pathTemplates.folderSettingsPathTemplate.render({ + folder: folder, + }); + } + /** + * Parse the folder from FolderSettings resource. + * + * @param {string} folderSettingsName + * A fully-qualified path representing folder_settings resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderSettingsName(folderSettingsName) { + return this.pathTemplates.folderSettingsPathTemplate.match(folderSettingsName).folder; + } + /** + * Return a fully-qualified folderSink resource name string. + * + * @param {string} folder + * @param {string} sink + * @returns {string} Resource name string. + */ + folderSinkPath(folder, sink) { + return this.pathTemplates.folderSinkPathTemplate.render({ + folder: folder, + sink: sink, + }); + } + /** + * Parse the folder from FolderSink resource. + * + * @param {string} folderSinkName + * A fully-qualified path representing folder_sink resource. + * @returns {string} A string representing the folder. + */ + matchFolderFromFolderSinkName(folderSinkName) { + return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName) + .folder; + } + /** + * Parse the sink from FolderSink resource. + * + * @param {string} folderSinkName + * A fully-qualified path representing folder_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromFolderSinkName(folderSinkName) { + return this.pathTemplates.folderSinkPathTemplate.match(folderSinkName).sink; + } + /** + * Return a fully-qualified logMetric resource name string. + * + * @param {string} project + * @param {string} metric + * @returns {string} Resource name string. + */ + logMetricPath(project, metric) { + return this.pathTemplates.logMetricPathTemplate.render({ + project: project, + metric: metric, + }); + } + /** + * Parse the project from LogMetric resource. + * + * @param {string} logMetricName + * A fully-qualified path representing LogMetric resource. + * @returns {string} A string representing the project. + */ + matchProjectFromLogMetricName(logMetricName) { + return this.pathTemplates.logMetricPathTemplate.match(logMetricName) + .project; + } + /** + * Parse the metric from LogMetric resource. + * + * @param {string} logMetricName + * A fully-qualified path representing LogMetric resource. + * @returns {string} A string representing the metric. + */ + matchMetricFromLogMetricName(logMetricName) { + return this.pathTemplates.logMetricPathTemplate.match(logMetricName).metric; + } + /** + * Return a fully-qualified organizationCmekSettings resource name string. + * + * @param {string} organization + * @returns {string} Resource name string. + */ + organizationCmekSettingsPath(organization) { + return this.pathTemplates.organizationCmekSettingsPathTemplate.render({ + organization: organization, + }); + } + /** + * Parse the organization from OrganizationCmekSettings resource. + * + * @param {string} organizationCmekSettingsName + * A fully-qualified path representing organization_cmekSettings resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationCmekSettingsName(organizationCmekSettingsName) { + return this.pathTemplates.organizationCmekSettingsPathTemplate.match(organizationCmekSettingsName).organization; + } + /** + * Return a fully-qualified organizationExclusion resource name string. + * + * @param {string} organization + * @param {string} exclusion + * @returns {string} Resource name string. + */ + organizationExclusionPath(organization, exclusion) { + return this.pathTemplates.organizationExclusionPathTemplate.render({ + organization: organization, + exclusion: exclusion, + }); + } + /** + * Parse the organization from OrganizationExclusion resource. + * + * @param {string} organizationExclusionName + * A fully-qualified path representing organization_exclusion resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationExclusionName(organizationExclusionName) { + return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).organization; + } + /** + * Parse the exclusion from OrganizationExclusion resource. + * + * @param {string} organizationExclusionName + * A fully-qualified path representing organization_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromOrganizationExclusionName(organizationExclusionName) { + return this.pathTemplates.organizationExclusionPathTemplate.match(organizationExclusionName).exclusion; + } + /** + * Return a fully-qualified organizationLocationBucket resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + organizationLocationBucketPath(organization, location, bucket) { + return this.pathTemplates.organizationLocationBucketPathTemplate.render({ + organization: organization, + location: location, + bucket: bucket, + }); + } + /** + * Parse the organization from OrganizationLocationBucket resource. + * + * @param {string} organizationLocationBucketName + * A fully-qualified path representing organization_location_bucket resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationBucketName(organizationLocationBucketName) { + return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).organization; + } + /** + * Parse the location from OrganizationLocationBucket resource. + * + * @param {string} organizationLocationBucketName + * A fully-qualified path representing organization_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationBucketName(organizationLocationBucketName) { + return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).location; + } + /** + * Parse the bucket from OrganizationLocationBucket resource. + * + * @param {string} organizationLocationBucketName + * A fully-qualified path representing organization_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromOrganizationLocationBucketName(organizationLocationBucketName) { + return this.pathTemplates.organizationLocationBucketPathTemplate.match(organizationLocationBucketName).bucket; + } + /** + * Return a fully-qualified organizationLocationBucketLink resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + organizationLocationBucketLinkPath(organization, location, bucket, link) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.render({ + organization: organization, + location: location, + bucket: bucket, + link: link, + }); + } + /** + * Parse the organization from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).organization; + } + /** + * Parse the location from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).location; + } + /** + * Parse the bucket from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).bucket; + } + /** + * Parse the link from OrganizationLocationBucketLink resource. + * + * @param {string} organizationLocationBucketLinkName + * A fully-qualified path representing organization_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromOrganizationLocationBucketLinkName(organizationLocationBucketLinkName) { + return this.pathTemplates.organizationLocationBucketLinkPathTemplate.match(organizationLocationBucketLinkName).link; + } + /** + * Return a fully-qualified organizationLocationBucketView resource name string. + * + * @param {string} organization + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + organizationLocationBucketViewPath(organization, location, bucket, view) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.render({ + organization: organization, + location: location, + bucket: bucket, + view: view, + }); + } + /** + * Parse the organization from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).organization; + } + /** + * Parse the location from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromOrganizationLocationBucketViewName(organizationLocationBucketViewName) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).location; + } + /** + * Parse the bucket from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromOrganizationLocationBucketViewName(organizationLocationBucketViewName) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).bucket; + } + /** + * Parse the view from OrganizationLocationBucketView resource. + * + * @param {string} organizationLocationBucketViewName + * A fully-qualified path representing organization_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromOrganizationLocationBucketViewName(organizationLocationBucketViewName) { + return this.pathTemplates.organizationLocationBucketViewPathTemplate.match(organizationLocationBucketViewName).view; + } + /** + * Return a fully-qualified organizationLog resource name string. + * + * @param {string} organization + * @param {string} log + * @returns {string} Resource name string. + */ + organizationLogPath(organization, log) { + return this.pathTemplates.organizationLogPathTemplate.render({ + organization: organization, + log: log, + }); + } + /** + * Parse the organization from OrganizationLog resource. + * + * @param {string} organizationLogName + * A fully-qualified path representing organization_log resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationLogName(organizationLogName) { + return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).organization; + } + /** + * Parse the log from OrganizationLog resource. + * + * @param {string} organizationLogName + * A fully-qualified path representing organization_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromOrganizationLogName(organizationLogName) { + return this.pathTemplates.organizationLogPathTemplate.match(organizationLogName).log; + } + /** + * Return a fully-qualified organizationSettings resource name string. + * + * @param {string} organization + * @returns {string} Resource name string. + */ + organizationSettingsPath(organization) { + return this.pathTemplates.organizationSettingsPathTemplate.render({ + organization: organization, + }); + } + /** + * Parse the organization from OrganizationSettings resource. + * + * @param {string} organizationSettingsName + * A fully-qualified path representing organization_settings resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSettingsName(organizationSettingsName) { + return this.pathTemplates.organizationSettingsPathTemplate.match(organizationSettingsName).organization; + } + /** + * Return a fully-qualified organizationSink resource name string. + * + * @param {string} organization + * @param {string} sink + * @returns {string} Resource name string. + */ + organizationSinkPath(organization, sink) { + return this.pathTemplates.organizationSinkPathTemplate.render({ + organization: organization, + sink: sink, + }); + } + /** + * Parse the organization from OrganizationSink resource. + * + * @param {string} organizationSinkName + * A fully-qualified path representing organization_sink resource. + * @returns {string} A string representing the organization. + */ + matchOrganizationFromOrganizationSinkName(organizationSinkName) { + return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).organization; + } + /** + * Parse the sink from OrganizationSink resource. + * + * @param {string} organizationSinkName + * A fully-qualified path representing organization_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromOrganizationSinkName(organizationSinkName) { + return this.pathTemplates.organizationSinkPathTemplate.match(organizationSinkName).sink; + } + /** + * Return a fully-qualified project resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectPath(project) { + return this.pathTemplates.projectPathTemplate.render({ + project: project, + }); + } + /** + * Parse the project from Project resource. + * + * @param {string} projectName + * A fully-qualified path representing Project resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectName(projectName) { + return this.pathTemplates.projectPathTemplate.match(projectName).project; + } + /** + * Return a fully-qualified projectCmekSettings resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectCmekSettingsPath(project) { + return this.pathTemplates.projectCmekSettingsPathTemplate.render({ + project: project, + }); + } + /** + * Parse the project from ProjectCmekSettings resource. + * + * @param {string} projectCmekSettingsName + * A fully-qualified path representing project_cmekSettings resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectCmekSettingsName(projectCmekSettingsName) { + return this.pathTemplates.projectCmekSettingsPathTemplate.match(projectCmekSettingsName).project; + } + /** + * Return a fully-qualified projectExclusion resource name string. + * + * @param {string} project + * @param {string} exclusion + * @returns {string} Resource name string. + */ + projectExclusionPath(project, exclusion) { + return this.pathTemplates.projectExclusionPathTemplate.render({ + project: project, + exclusion: exclusion, + }); + } + /** + * Parse the project from ProjectExclusion resource. + * + * @param {string} projectExclusionName + * A fully-qualified path representing project_exclusion resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectExclusionName(projectExclusionName) { + return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).project; + } + /** + * Parse the exclusion from ProjectExclusion resource. + * + * @param {string} projectExclusionName + * A fully-qualified path representing project_exclusion resource. + * @returns {string} A string representing the exclusion. + */ + matchExclusionFromProjectExclusionName(projectExclusionName) { + return this.pathTemplates.projectExclusionPathTemplate.match(projectExclusionName).exclusion; + } + /** + * Return a fully-qualified projectLocationBucket resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} bucket + * @returns {string} Resource name string. + */ + projectLocationBucketPath(project, location, bucket) { + return this.pathTemplates.projectLocationBucketPathTemplate.render({ + project: project, + location: location, + bucket: bucket, + }); + } + /** + * Parse the project from ProjectLocationBucket resource. + * + * @param {string} projectLocationBucketName + * A fully-qualified path representing project_location_bucket resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationBucketName(projectLocationBucketName) { + return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).project; + } + /** + * Parse the location from ProjectLocationBucket resource. + * + * @param {string} projectLocationBucketName + * A fully-qualified path representing project_location_bucket resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationBucketName(projectLocationBucketName) { + return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).location; + } + /** + * Parse the bucket from ProjectLocationBucket resource. + * + * @param {string} projectLocationBucketName + * A fully-qualified path representing project_location_bucket resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromProjectLocationBucketName(projectLocationBucketName) { + return this.pathTemplates.projectLocationBucketPathTemplate.match(projectLocationBucketName).bucket; + } + /** + * Return a fully-qualified projectLocationBucketLink resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} bucket + * @param {string} link + * @returns {string} Resource name string. + */ + projectLocationBucketLinkPath(project, location, bucket, link) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.render({ + project: project, + location: location, + bucket: bucket, + link: link, + }); + } + /** + * Parse the project from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationBucketLinkName(projectLocationBucketLinkName) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).project; + } + /** + * Parse the location from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationBucketLinkName(projectLocationBucketLinkName) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).location; + } + /** + * Parse the bucket from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromProjectLocationBucketLinkName(projectLocationBucketLinkName) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).bucket; + } + /** + * Parse the link from ProjectLocationBucketLink resource. + * + * @param {string} projectLocationBucketLinkName + * A fully-qualified path representing project_location_bucket_link resource. + * @returns {string} A string representing the link. + */ + matchLinkFromProjectLocationBucketLinkName(projectLocationBucketLinkName) { + return this.pathTemplates.projectLocationBucketLinkPathTemplate.match(projectLocationBucketLinkName).link; + } + /** + * Return a fully-qualified projectLocationBucketView resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} bucket + * @param {string} view + * @returns {string} Resource name string. + */ + projectLocationBucketViewPath(project, location, bucket, view) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.render({ + project: project, + location: location, + bucket: bucket, + view: view, + }); + } + /** + * Parse the project from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLocationBucketViewName(projectLocationBucketViewName) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).project; + } + /** + * Parse the location from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the location. + */ + matchLocationFromProjectLocationBucketViewName(projectLocationBucketViewName) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).location; + } + /** + * Parse the bucket from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the bucket. + */ + matchBucketFromProjectLocationBucketViewName(projectLocationBucketViewName) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).bucket; + } + /** + * Parse the view from ProjectLocationBucketView resource. + * + * @param {string} projectLocationBucketViewName + * A fully-qualified path representing project_location_bucket_view resource. + * @returns {string} A string representing the view. + */ + matchViewFromProjectLocationBucketViewName(projectLocationBucketViewName) { + return this.pathTemplates.projectLocationBucketViewPathTemplate.match(projectLocationBucketViewName).view; + } + /** + * Return a fully-qualified projectLog resource name string. + * + * @param {string} project + * @param {string} log + * @returns {string} Resource name string. + */ + projectLogPath(project, log) { + return this.pathTemplates.projectLogPathTemplate.render({ + project: project, + log: log, + }); + } + /** + * Parse the project from ProjectLog resource. + * + * @param {string} projectLogName + * A fully-qualified path representing project_log resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectLogName(projectLogName) { + return this.pathTemplates.projectLogPathTemplate.match(projectLogName) + .project; + } + /** + * Parse the log from ProjectLog resource. + * + * @param {string} projectLogName + * A fully-qualified path representing project_log resource. + * @returns {string} A string representing the log. + */ + matchLogFromProjectLogName(projectLogName) { + return this.pathTemplates.projectLogPathTemplate.match(projectLogName).log; + } + /** + * Return a fully-qualified projectSettings resource name string. + * + * @param {string} project + * @returns {string} Resource name string. + */ + projectSettingsPath(project) { + return this.pathTemplates.projectSettingsPathTemplate.render({ + project: project, + }); + } + /** + * Parse the project from ProjectSettings resource. + * + * @param {string} projectSettingsName + * A fully-qualified path representing project_settings resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSettingsName(projectSettingsName) { + return this.pathTemplates.projectSettingsPathTemplate.match(projectSettingsName).project; + } + /** + * Return a fully-qualified projectSink resource name string. + * + * @param {string} project + * @param {string} sink + * @returns {string} Resource name string. + */ + projectSinkPath(project, sink) { + return this.pathTemplates.projectSinkPathTemplate.render({ + project: project, + sink: sink, + }); + } + /** + * Parse the project from ProjectSink resource. + * + * @param {string} projectSinkName + * A fully-qualified path representing project_sink resource. + * @returns {string} A string representing the project. + */ + matchProjectFromProjectSinkName(projectSinkName) { + return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName) + .project; + } + /** + * Parse the sink from ProjectSink resource. + * + * @param {string} projectSinkName + * A fully-qualified path representing project_sink resource. + * @returns {string} A string representing the sink. + */ + matchSinkFromProjectSinkName(projectSinkName) { + return this.pathTemplates.projectSinkPathTemplate.match(projectSinkName) + .sink; + } + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close() { + if (this.metricsServiceV2Stub && !this._terminated) { + return this.metricsServiceV2Stub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} +exports.MetricsServiceV2Client = MetricsServiceV2Client; +//# sourceMappingURL=metrics_service_v2_client.js.map + +/***/ }), + /***/ 53257: /***/ ((__unused_webpack_module, exports) => { @@ -4645,6 +65831,543 @@ exports.VERSION = '0.19.0'; /***/ }), +/***/ 86434: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +//# sourceMappingURL=external-types.js.map + +/***/ }), + +/***/ 93837: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + var desc = Object.getOwnPropertyDescriptor(m, k); + if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { + desc = { enumerable: true, get: function() { return m[k]; } }; + } + Object.defineProperty(o, k2, desc); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +__exportStar(__nccwpck_require__(86434), exports); +__exportStar(__nccwpck_require__(34216), exports); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 34216: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.TraceExporter = void 0; +const core_1 = __nccwpck_require__(24637); +const api_1 = __nccwpck_require__(63914); +const protoloader = __nccwpck_require__(76081); +const grpc = __nccwpck_require__(83033); +const google_auth_library_1 = __nccwpck_require__(492); +const util_1 = __nccwpck_require__(39023); +const transform_1 = __nccwpck_require__(69529); +const version_1 = __nccwpck_require__(90949); +const protoJson = __nccwpck_require__(3093); +const OT_REQUEST_HEADER = 'x-opentelemetry-outgoing-request'; +const TRACE_USER_AGENT = `opentelemetry-js ${core_1.VERSION}; google-cloud-trace-exporter ${version_1.VERSION}`; +const OPTIONS = { + 'grpc.primary_user_agent': TRACE_USER_AGENT, +}; +/** + * Format and sends span information to Google Cloud Trace. + */ +class TraceExporter { + constructor(options = {}) { + var _a; + this._traceServiceClient = undefined; + this._resourceFilter = undefined; + this._apiEndpoint = 'cloudtrace.googleapis.com:443'; + this._resourceFilter = options.resourceFilter; + this._stringifyArrayAttributes = (_a = options.stringifyArrayAttributes) !== null && _a !== void 0 ? _a : false; + this._auth = new google_auth_library_1.GoogleAuth({ + credentials: options.credentials, + keyFile: options.keyFile, + keyFilename: options.keyFilename, + projectId: options.projectId, + scopes: ['https://www.googleapis.com/auth/cloud-platform'], + }); + // Start this async process as early as possible. It will be + // awaited on the first export because constructors are synchronous + this._projectId = this._auth.getProjectId().catch(err => { + api_1.diag.error(err); + }); + if (options.apiEndpoint) { + this._apiEndpoint = options.apiEndpoint; + } + } + /** + * Publishes a list of spans to Google Cloud Trace. + * @param spans The list of spans to transmit to Google Cloud Trace + */ + async export(spans, resultCallback) { + if (this._projectId instanceof Promise) { + this._projectId = await this._projectId; + } + if (!this._projectId) { + return resultCallback({ + code: core_1.ExportResultCode.FAILED, + error: new Error('Was not able to determine GCP project ID'), + }); + } + api_1.diag.debug('Google Cloud Trace export'); + const namedSpans = { + name: `projects/${this._projectId}`, + spans: spans.map((0, transform_1.getReadableSpanTransformer)(this._projectId, this._resourceFilter, this._stringifyArrayAttributes)), + }; + const result = await this._batchWriteSpans(namedSpans); + resultCallback(result); + } + async shutdown() { } + /** + * Sends new spans to new or existing traces in the Google Cloud Trace format to the + * service. + * @param spans + */ + async _batchWriteSpans(spans) { + api_1.diag.debug('Google Cloud Trace batch writing traces'); + try { + this._traceServiceClient = await this._getClient(); + } + catch (e) { + const error = asError(e); + error.message = `failed to create client: ${error.message}`; + api_1.diag.error(error.message); + return { code: core_1.ExportResultCode.FAILED, error }; + } + const metadata = new grpc.Metadata(); + metadata.add(OT_REQUEST_HEADER, '1'); + metadata.add('user-agent', TRACE_USER_AGENT); + const batchWriteSpans = (0, util_1.promisify)(this._traceServiceClient.BatchWriteSpans).bind(this._traceServiceClient); + try { + await batchWriteSpans(spans, metadata); + api_1.diag.debug('batchWriteSpans successfully'); + return { code: core_1.ExportResultCode.SUCCESS }; + } + catch (e) { + const error = asError(e); + error.message = `batchWriteSpans error: ${error.message}`; + api_1.diag.error(error.message); + return { code: core_1.ExportResultCode.FAILED, error }; + } + } + /** + * If the rpc client is not already initialized, + * authenticates with google credentials and initializes the rpc client + */ + async _getClient() { + if (this._traceServiceClient) { + return this._traceServiceClient; + } + api_1.diag.debug('Google Cloud Trace authenticating'); + const creds = await this._auth.getClient(); + api_1.diag.debug('Google Cloud Trace got authentication. Initializaing rpc client'); + const packageDefinition = protoloader.fromJSON(protoJson); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const { google } = grpc.loadPackageDefinition(packageDefinition); + const traceService = google.devtools.cloudtrace.v2.TraceService; + const sslCreds = grpc.credentials.createSsl(); + const callCreds = grpc.credentials.createFromGoogleCredential(creds); + return new traceService(this._apiEndpoint, grpc.credentials.combineChannelCredentials(sslCreds, callCreds), OPTIONS); + } +} +exports.TraceExporter = TraceExporter; +function asError(error) { + if (error instanceof Error) { + return error; + } + return new Error(String(error)); +} +//# sourceMappingURL=trace.js.map + +/***/ }), + +/***/ 69529: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getReadableSpanTransformer = void 0; +const ot = __nccwpck_require__(63914); +const core_1 = __nccwpck_require__(24637); +const types_1 = __nccwpck_require__(71188); +const opentelemetry_resource_util_1 = __nccwpck_require__(17539); +const version_1 = __nccwpck_require__(90949); +const AGENT_LABEL_KEY = 'g.co/agent'; +const AGENT_LABEL_VALUE = `opentelemetry-js ${core_1.VERSION}; google-cloud-trace-exporter ${version_1.VERSION}`; +function getReadableSpanTransformer(projectId, resourceFilter, stringifyArrayAttributes) { + return span => { + // @todo get dropped attribute count from sdk ReadableSpan + const attributes = mergeAttributes(transformAttributes({ + ...span.attributes, + [AGENT_LABEL_KEY]: AGENT_LABEL_VALUE, + }, stringifyArrayAttributes), + // Add in special g.co/r resource labels + transformResourceToAttributes(span.resource, projectId, resourceFilter, stringifyArrayAttributes)); + const out = { + attributes, + displayName: stringToTruncatableString(span.name), + links: { + link: span.links.map(getLinkTransformer(stringifyArrayAttributes)), + }, + endTime: transformTime(span.endTime), + startTime: transformTime(span.startTime), + name: `projects/${projectId}/traces/${span.spanContext().traceId}/spans/${span.spanContext().spanId}`, + spanKind: transformKind(span.kind), + spanId: span.spanContext().spanId, + sameProcessAsParentSpan: { value: !span.spanContext().isRemote }, + status: transformStatus(span.status), + timeEvents: { + timeEvent: span.events.map(e => { + var _a; + return ({ + time: transformTime(e.time), + annotation: { + attributes: transformAttributes((_a = e.attributes) !== null && _a !== void 0 ? _a : {}, stringifyArrayAttributes), + description: stringToTruncatableString(e.name), + }, + }); + }), + }, + }; + if (span.parentSpanId) { + out.parentSpanId = span.parentSpanId; + } + return out; + }; +} +exports.getReadableSpanTransformer = getReadableSpanTransformer; +function transformStatus(status) { + switch (status.code) { + case ot.SpanStatusCode.UNSET: + return undefined; + case ot.SpanStatusCode.OK: + return { code: types_1.Code.OK }; + case ot.SpanStatusCode.ERROR: + return { code: types_1.Code.UNKNOWN, message: status.message }; + default: { + exhaust(status.code); + // TODO: log failed mapping + return { code: types_1.Code.UNKNOWN, message: status.message }; + } + } +} +function transformKind(kind) { + switch (kind) { + case ot.SpanKind.INTERNAL: + return types_1.SpanKind.INTERNAL; + case ot.SpanKind.SERVER: + return types_1.SpanKind.SERVER; + case ot.SpanKind.CLIENT: + return types_1.SpanKind.CLIENT; + case ot.SpanKind.PRODUCER: + return types_1.SpanKind.PRODUCER; + case ot.SpanKind.CONSUMER: + return types_1.SpanKind.CONSUMER; + default: { + exhaust(kind); + // TODO: log failed mapping + return types_1.SpanKind.SPAN_KIND_UNSPECIFIED; + } + } +} +/** + * Assert switch case is exhaustive + */ +function exhaust(switchValue) { + return switchValue; +} +function transformTime(time) { + return { + seconds: time[0], + nanos: time[1], + }; +} +function getLinkTransformer(stringifyArrayAttributes) { + return link => { + var _a; + return ({ + attributes: transformAttributes((_a = link.attributes) !== null && _a !== void 0 ? _a : {}, stringifyArrayAttributes), + spanId: link.context.spanId, + traceId: link.context.traceId, + type: types_1.LinkType.UNSPECIFIED, + }); + }; +} +function transformAttributes(attributes, stringifyArrayAttributes) { + const changedAttributes = transformAttributeNames(attributes); + return spanAttributesToGCTAttributes(changedAttributes, stringifyArrayAttributes); +} +function spanAttributesToGCTAttributes(attributes, stringifyArrayAttributes) { + const attributeMap = transformAttributeValues(attributes, stringifyArrayAttributes); + return { + attributeMap, + droppedAttributesCount: Object.keys(attributes).length - Object.keys(attributeMap).length, + }; +} +function mergeAttributes(...attributeList) { + const attributesOut = { + attributeMap: {}, + droppedAttributesCount: 0, + }; + attributeList.forEach(attributes => { + var _a; + Object.assign(attributesOut.attributeMap, attributes.attributeMap); + attributesOut.droppedAttributesCount += + (_a = attributes.droppedAttributesCount) !== null && _a !== void 0 ? _a : 0; + }); + return attributesOut; +} +function transformResourceToAttributes(resource, projectId, resourceFilter, stringifyArrayAttributes) { + const monitoredResource = (0, opentelemetry_resource_util_1.mapOtelResourceToMonitoredResource)(resource); + const attributes = {}; + if (resourceFilter) { + Object.keys(resource.attributes) + .filter(key => resourceFilter.test(key)) + .forEach(key => { + attributes[key] = resource.attributes[key]; + }); + } + // global is the "default" so just skip + if (monitoredResource.type !== 'global') { + Object.keys(monitoredResource.labels).forEach(labelKey => { + const key = `g.co/r/${monitoredResource.type}/${labelKey}`; + attributes[key] = monitoredResource.labels[labelKey]; + }); + } + return spanAttributesToGCTAttributes(attributes, stringifyArrayAttributes); +} +function transformAttributeValues(attributes, stringifyArrayAttributes) { + const out = {}; + for (const [key, value] of Object.entries(attributes)) { + if (value === undefined) { + continue; + } + const attributeValue = valueToAttributeValue(value, stringifyArrayAttributes); + if (attributeValue !== undefined) { + out[key] = attributeValue; + } + } + return out; +} +function stringToTruncatableString(value) { + return { value }; +} +function valueToAttributeValue(value, stringifyArrayAttributes) { + switch (typeof value) { + case 'number': + // TODO: Consider to change to doubleValue when available in V2 API. + return { intValue: String(Math.round(value)) }; + case 'boolean': + return { boolValue: value }; + case 'string': + return { stringValue: stringToTruncatableString(value) }; + default: + if (stringifyArrayAttributes) { + return { stringValue: stringToTruncatableString(JSON.stringify(value)) }; + } + // TODO: Handle array types without stringification once API level support is added + return undefined; + } +} +const HTTP_ATTRIBUTE_MAPPING = { + 'http.method': '/http/method', + 'http.url': '/http/url', + 'http.host': '/http/host', + 'http.scheme': '/http/client_protocol', + 'http.status_code': '/http/status_code', + 'http.user_agent': '/http/user_agent', + 'http.request_content_length': '/http/request/size', + 'http.response_content_length': '/http/response/size', + 'http.route': '/http/route', +}; +function transformAttributeNames(attributes) { + const out = {}; + for (const [key, value] of Object.entries(attributes)) { + if (HTTP_ATTRIBUTE_MAPPING[key]) { + out[HTTP_ATTRIBUTE_MAPPING[key]] = value; + } + else { + out[key] = value; + } + } + return out; +} +//# sourceMappingURL=transform.js.map + +/***/ }), + +/***/ 71188: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.SpanKind = exports.Code = exports.LinkType = exports.Type = void 0; +var Type; +(function (Type) { + Type[Type["TYPE_UNSPECIFIED"] = 0] = "TYPE_UNSPECIFIED"; + Type[Type["SENT"] = 1] = "SENT"; + Type[Type["RECEIVED"] = 2] = "RECEIVED"; +})(Type = exports.Type || (exports.Type = {})); +var LinkType; +(function (LinkType) { + LinkType[LinkType["UNSPECIFIED"] = 0] = "UNSPECIFIED"; + LinkType[LinkType["CHILD_LINKED_SPAN"] = 1] = "CHILD_LINKED_SPAN"; + LinkType[LinkType["PARENT_LINKED_SPAN"] = 2] = "PARENT_LINKED_SPAN"; +})(LinkType = exports.LinkType || (exports.LinkType = {})); +/** + * A google.rpc.Code + */ +var Code; +(function (Code) { + // These are the only two we care about mapping to + Code[Code["OK"] = 0] = "OK"; + Code[Code["UNKNOWN"] = 2] = "UNKNOWN"; +})(Code = exports.Code || (exports.Code = {})); +/** + * See https://github.com/googleapis/googleapis/blob/8cd4d12c0a02872469176659603451d84c0fbee7/google/devtools/cloudtrace/v2/trace.proto#L182 + */ +var SpanKind; +(function (SpanKind) { + // Unspecified. Do NOT use as default. + // Implementations MAY assume SpanKind.INTERNAL to be default. + SpanKind[SpanKind["SPAN_KIND_UNSPECIFIED"] = 0] = "SPAN_KIND_UNSPECIFIED"; + // Indicates that the span is used internally. Default value. + SpanKind[SpanKind["INTERNAL"] = 1] = "INTERNAL"; + // Indicates that the span covers server-side handling of an RPC or other + // remote network request. + SpanKind[SpanKind["SERVER"] = 2] = "SERVER"; + // Indicates that the span covers the client-side wrapper around an RPC or + // other remote request. + SpanKind[SpanKind["CLIENT"] = 3] = "CLIENT"; + // Indicates that the span describes producer sending a message to a broker. + // Unlike client and server, there is no direct critical path latency + // relationship between producer and consumer spans (e.g. publishing a + // message to a pubsub service). + SpanKind[SpanKind["PRODUCER"] = 4] = "PRODUCER"; + // Indicates that the span describes consumer receiving a message from a + // broker. Unlike client and server, there is no direct critical path + // latency relationship between producer and consumer spans (e.g. receiving + // a message from a pubsub service subscription). + SpanKind[SpanKind["CONSUMER"] = 5] = "CONSUMER"; +})(SpanKind = exports.SpanKind || (exports.SpanKind = {})); +//# sourceMappingURL=types.js.map + +/***/ }), + +/***/ 90949: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.VERSION = void 0; +// Autogenerated by scripts/version-update.js during compilation. Check this +// file in. +exports.VERSION = '2.4.1'; +//# sourceMappingURL=version.js.map + +/***/ }), + /***/ 5882: /***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { @@ -5454,6 +67177,312 @@ Object.defineProperty(exports, "GcpDetectorSync", ({ enumerable: true, get: func /***/ }), +/***/ 99469: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/*! + * Copyright 2015 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ResourceStream = exports.paginator = exports.Paginator = void 0; +/*! + * @module common/paginator + */ +const arrify = __nccwpck_require__(26251); +const extend = __nccwpck_require__(23860); +const resource_stream_1 = __nccwpck_require__(97618); +Object.defineProperty(exports, "ResourceStream", ({ enumerable: true, get: function () { return resource_stream_1.ResourceStream; } })); +/*! Developer Documentation + * + * paginator is used to auto-paginate `nextQuery` methods as well as + * streamifying them. + * + * Before: + * + * search.query('done=true', function(err, results, nextQuery) { + * search.query(nextQuery, function(err, results, nextQuery) {}); + * }); + * + * After: + * + * search.query('done=true', function(err, results) {}); + * + * Methods to extend should be written to accept callbacks and return a + * `nextQuery`. + */ +class Paginator { + /** + * Cache the original method, then overwrite it on the Class's prototype. + * + * @param {function} Class - The parent class of the methods to extend. + * @param {string|string[]} methodNames - Name(s) of the methods to extend. + */ + // tslint:disable-next-line:variable-name + extend(Class, methodNames) { + methodNames = arrify(methodNames); + methodNames.forEach(methodName => { + const originalMethod = Class.prototype[methodName]; + // map the original method to a private member + Class.prototype[methodName + '_'] = originalMethod; + // overwrite the original to auto-paginate + /* eslint-disable @typescript-eslint/no-explicit-any */ + Class.prototype[methodName] = function (...args) { + const parsedArguments = paginator.parseArguments_(args); + return paginator.run_(parsedArguments, originalMethod.bind(this)); + }; + }); + } + /** + * Wraps paginated API calls in a readable object stream. + * + * This method simply calls the nextQuery recursively, emitting results to a + * stream. The stream ends when `nextQuery` is null. + * + * `maxResults` will act as a cap for how many results are fetched and emitted + * to the stream. + * + * @param {string} methodName - Name of the method to streamify. + * @return {function} - Wrapped function. + */ + /* eslint-disable @typescript-eslint/no-explicit-any */ + streamify(methodName) { + return function ( + /* eslint-disable @typescript-eslint/no-explicit-any */ + ...args) { + const parsedArguments = paginator.parseArguments_(args); + const originalMethod = this[methodName + '_'] || this[methodName]; + return paginator.runAsStream_(parsedArguments, originalMethod.bind(this)); + }; + } + /** + * Parse a pseudo-array `arguments` for a query and callback. + * + * @param {array} args - The original `arguments` pseduo-array that the original + * method received. + */ + /* eslint-disable @typescript-eslint/no-explicit-any */ + parseArguments_(args) { + let query; + let autoPaginate = true; + let maxApiCalls = -1; + let maxResults = -1; + let callback; + const firstArgument = args[0]; + const lastArgument = args[args.length - 1]; + if (typeof firstArgument === 'function') { + callback = firstArgument; + } + else { + query = firstArgument; + } + if (typeof lastArgument === 'function') { + callback = lastArgument; + } + if (typeof query === 'object') { + query = extend(true, {}, query); + // Check if the user only asked for a certain amount of results. + if (query.maxResults && typeof query.maxResults === 'number') { + // `maxResults` is used API-wide. + maxResults = query.maxResults; + } + else if (typeof query.pageSize === 'number') { + // `pageSize` is Pub/Sub's `maxResults`. + maxResults = query.pageSize; + } + if (query.maxApiCalls && typeof query.maxApiCalls === 'number') { + maxApiCalls = query.maxApiCalls; + delete query.maxApiCalls; + } + // maxResults is the user specified limit. + if (maxResults !== -1 || query.autoPaginate === false) { + autoPaginate = false; + } + } + const parsedArguments = { + query: query || {}, + autoPaginate, + maxApiCalls, + maxResults, + callback, + }; + parsedArguments.streamOptions = extend(true, {}, parsedArguments.query); + delete parsedArguments.streamOptions.autoPaginate; + delete parsedArguments.streamOptions.maxResults; + delete parsedArguments.streamOptions.pageSize; + return parsedArguments; + } + /** + * This simply checks to see if `autoPaginate` is set or not, if it's true + * then we buffer all results, otherwise simply call the original method. + * + * @param {array} parsedArguments - Parsed arguments from the original method + * call. + * @param {object=|string=} parsedArguments.query - Query object. This is most + * commonly an object, but to make the API more simple, it can also be a + * string in some places. + * @param {function=} parsedArguments.callback - Callback function. + * @param {boolean} parsedArguments.autoPaginate - Auto-pagination enabled. + * @param {boolean} parsedArguments.maxApiCalls - Maximum API calls to make. + * @param {number} parsedArguments.maxResults - Maximum results to return. + * @param {function} originalMethod - The cached method that accepts a callback + * and returns `nextQuery` to receive more results. + */ + run_(parsedArguments, originalMethod) { + const query = parsedArguments.query; + const callback = parsedArguments.callback; + if (!parsedArguments.autoPaginate) { + return originalMethod(query, callback); + } + const results = new Array(); + let otherArgs = []; + const promise = new Promise((resolve, reject) => { + const stream = paginator.runAsStream_(parsedArguments, originalMethod); + stream + .on('error', reject) + .on('data', (data) => results.push(data)) + .on('end', () => { + otherArgs = stream._otherArgs || []; + resolve(results); + }); + }); + if (!callback) { + return promise.then(results => [results, query, ...otherArgs]); + } + promise.then(results => callback(null, results, query, ...otherArgs), (err) => callback(err)); + } + /** + * This method simply calls the nextQuery recursively, emitting results to a + * stream. The stream ends when `nextQuery` is null. + * + * `maxResults` will act as a cap for how many results are fetched and emitted + * to the stream. + * + * @param {object=|string=} parsedArguments.query - Query object. This is most + * commonly an object, but to make the API more simple, it can also be a + * string in some places. + * @param {function=} parsedArguments.callback - Callback function. + * @param {boolean} parsedArguments.autoPaginate - Auto-pagination enabled. + * @param {boolean} parsedArguments.maxApiCalls - Maximum API calls to make. + * @param {number} parsedArguments.maxResults - Maximum results to return. + * @param {function} originalMethod - The cached method that accepts a callback + * and returns `nextQuery` to receive more results. + * @return {stream} - Readable object stream. + */ + /* eslint-disable @typescript-eslint/no-explicit-any */ + runAsStream_(parsedArguments, originalMethod) { + return new resource_stream_1.ResourceStream(parsedArguments, originalMethod); + } +} +exports.Paginator = Paginator; +const paginator = new Paginator(); +exports.paginator = paginator; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 97618: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/*! + * Copyright 2019 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ResourceStream = void 0; +const stream_1 = __nccwpck_require__(2203); +class ResourceStream extends stream_1.Transform { + constructor(args, requestFn) { + const options = Object.assign({ objectMode: true }, args.streamOptions); + super(options); + this._ended = false; + this._maxApiCalls = args.maxApiCalls === -1 ? Infinity : args.maxApiCalls; + this._nextQuery = args.query; + this._reading = false; + this._requestFn = requestFn; + this._requestsMade = 0; + this._resultsToSend = args.maxResults === -1 ? Infinity : args.maxResults; + this._otherArgs = []; + } + /* eslint-disable @typescript-eslint/no-explicit-any */ + end(...args) { + this._ended = true; + return super.end(...args); + } + _read() { + if (this._reading) { + return; + } + this._reading = true; + // Wrap in a try/catch to catch input linting errors, e.g. + // an invalid BigQuery query. These errors are thrown in an + // async fashion, which makes them un-catchable by the user. + try { + this._requestFn(this._nextQuery, (err, results, nextQuery, ...otherArgs) => { + if (err) { + this.destroy(err); + return; + } + this._otherArgs = otherArgs; + this._nextQuery = nextQuery; + if (this._resultsToSend !== Infinity) { + results = results.splice(0, this._resultsToSend); + this._resultsToSend -= results.length; + } + let more = true; + for (const result of results) { + if (this._ended) { + break; + } + more = this.push(result); + } + const isFinished = !this._nextQuery || this._resultsToSend < 1; + const madeMaxCalls = ++this._requestsMade >= this._maxApiCalls; + if (isFinished || madeMaxCalls) { + this.end(); + } + if (more && !this._ended) { + setImmediate(() => this._read()); + } + this._reading = false; + }); + } + catch (e) { + this.destroy(e); + } + } +} +exports.ResourceStream = ResourceStream; +//# sourceMappingURL=resource-stream.js.map + +/***/ }), + /***/ 84770: /***/ ((__unused_webpack_module, exports) => { @@ -6042,6 +68071,18155 @@ function getPadding(n, min) { } //# sourceMappingURL=index.js.map +/***/ }), + +/***/ 87635: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.MissingProjectIdError = exports.replaceProjectIdToken = void 0; +const stream_1 = __nccwpck_require__(2203); +// Copyright 2014 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +/** + * Populate the `{{projectId}}` placeholder. + * + * @throws {Error} If a projectId is required, but one is not provided. + * + * @param {*} - Any input value that may contain a placeholder. Arrays and objects will be looped. + * @param {string} projectId - A projectId. If not provided + * @return {*} - The original argument with all placeholders populated. + */ +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function replaceProjectIdToken(value, projectId) { + if (Array.isArray(value)) { + value = value.map(v => replaceProjectIdToken(v, projectId)); + } + if (value !== null && + typeof value === 'object' && + !(value instanceof Buffer) && + !(value instanceof stream_1.Stream) && + typeof value.hasOwnProperty === 'function') { + for (const opt in value) { + // eslint-disable-next-line no-prototype-builtins + if (value.hasOwnProperty(opt)) { + value[opt] = replaceProjectIdToken(value[opt], projectId); + } + } + } + if (typeof value === 'string' && + value.indexOf('{{projectId}}') > -1) { + if (!projectId || projectId === '{{projectId}}') { + throw new MissingProjectIdError(); + } + value = value.replace(/{{projectId}}/g, projectId); + } + return value; +} +exports.replaceProjectIdToken = replaceProjectIdToken; +/** + * Custom error type for missing project ID errors. + */ +class MissingProjectIdError extends Error { + constructor() { + super(...arguments); + this.message = `Sorry, we cannot connect to Cloud Services without a project + ID. You may specify one with an environment variable named + "GOOGLE_CLOUD_PROJECT".`.replace(/ +/g, ' '); + } +} +exports.MissingProjectIdError = MissingProjectIdError; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 60206: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* eslint-disable prefer-rest-params */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.callbackifyAll = exports.callbackify = exports.promisifyAll = exports.promisify = void 0; +/** + * Wraps a callback style function to conditionally return a promise. + * + * @param {function} originalMethod - The method to promisify. + * @param {object=} options - Promise options. + * @param {boolean} options.singular - Resolve the promise with single arg instead of an array. + * @return {function} wrapped + */ +function promisify(originalMethod, options) { + if (originalMethod.promisified_) { + return originalMethod; + } + options = options || {}; + const slice = Array.prototype.slice; + // tslint:disable-next-line:no-any + const wrapper = function () { + let last; + for (last = arguments.length - 1; last >= 0; last--) { + const arg = arguments[last]; + if (typeof arg === 'undefined') { + continue; // skip trailing undefined. + } + if (typeof arg !== 'function') { + break; // non-callback last argument found. + } + return originalMethod.apply(this, arguments); + } + // peel trailing undefined. + const args = slice.call(arguments, 0, last + 1); + // tslint:disable-next-line:variable-name + let PromiseCtor = Promise; + // Because dedupe will likely create a single install of + // @google-cloud/common to be shared amongst all modules, we need to + // localize it at the Service level. + if (this && this.Promise) { + PromiseCtor = this.Promise; + } + return new PromiseCtor((resolve, reject) => { + // tslint:disable-next-line:no-any + args.push((...args) => { + const callbackArgs = slice.call(args); + const err = callbackArgs.shift(); + if (err) { + return reject(err); + } + if (options.singular && callbackArgs.length === 1) { + resolve(callbackArgs[0]); + } + else { + resolve(callbackArgs); + } + }); + originalMethod.apply(this, args); + }); + }; + wrapper.promisified_ = true; + return wrapper; +} +exports.promisify = promisify; +/** + * Promisifies certain Class methods. This will not promisify private or + * streaming methods. + * + * @param {module:common/service} Class - Service class. + * @param {object=} options - Configuration object. + */ +// tslint:disable-next-line:variable-name +function promisifyAll(Class, options) { + const exclude = (options && options.exclude) || []; + const ownPropertyNames = Object.getOwnPropertyNames(Class.prototype); + const methods = ownPropertyNames.filter(methodName => { + // clang-format off + return (!exclude.includes(methodName) && + typeof Class.prototype[methodName] === 'function' && // is it a function? + !/(^_|(Stream|_)|promise$)|^constructor$/.test(methodName) // is it promisable? + ); + // clang-format on + }); + methods.forEach(methodName => { + const originalMethod = Class.prototype[methodName]; + if (!originalMethod.promisified_) { + Class.prototype[methodName] = exports.promisify(originalMethod, options); + } + }); +} +exports.promisifyAll = promisifyAll; +/** + * Wraps a promisy type function to conditionally call a callback function. + * + * @param {function} originalMethod - The method to callbackify. + * @param {object=} options - Callback options. + * @param {boolean} options.singular - Pass to the callback a single arg instead of an array. + * @return {function} wrapped + */ +function callbackify(originalMethod) { + if (originalMethod.callbackified_) { + return originalMethod; + } + // tslint:disable-next-line:no-any + const wrapper = function () { + if (typeof arguments[arguments.length - 1] !== 'function') { + return originalMethod.apply(this, arguments); + } + const cb = Array.prototype.pop.call(arguments); + originalMethod.apply(this, arguments).then( + // tslint:disable-next-line:no-any + (res) => { + res = Array.isArray(res) ? res : [res]; + cb(null, ...res); + }, (err) => cb(err)); + }; + wrapper.callbackified_ = true; + return wrapper; +} +exports.callbackify = callbackify; +/** + * Callbackifies certain Class methods. This will not callbackify private or + * streaming methods. + * + * @param {module:common/service} Class - Service class. + * @param {object=} options - Configuration object. + */ +function callbackifyAll( +// tslint:disable-next-line:variable-name +Class, options) { + const exclude = (options && options.exclude) || []; + const ownPropertyNames = Object.getOwnPropertyNames(Class.prototype); + const methods = ownPropertyNames.filter(methodName => { + // clang-format off + return (!exclude.includes(methodName) && + typeof Class.prototype[methodName] === 'function' && // is it a function? + !/^_|(Stream|_)|^constructor$/.test(methodName) // is it callbackifyable? + ); + // clang-format on + }); + methods.forEach(methodName => { + const originalMethod = Class.prototype[methodName]; + if (!originalMethod.callbackified_) { + Class.prototype[methodName] = exports.callbackify(originalMethod); + } + }); +} +exports.callbackifyAll = callbackifyAll; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 52914: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright 2021 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.registerAdminService = registerAdminService; +exports.addAdminServicesToServer = addAdminServicesToServer; +const registeredAdminServices = []; +function registerAdminService(getServiceDefinition, getHandlers) { + registeredAdminServices.push({ getServiceDefinition, getHandlers }); +} +function addAdminServicesToServer(server) { + for (const { getServiceDefinition, getHandlers } of registeredAdminServices) { + server.addService(getServiceDefinition(), getHandlers()); + } +} +//# sourceMappingURL=admin.js.map + +/***/ }), + +/***/ 14643: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.BackoffTimeout = void 0; +const constants_1 = __nccwpck_require__(68288); +const logging = __nccwpck_require__(8536); +const TRACER_NAME = 'backoff'; +const INITIAL_BACKOFF_MS = 1000; +const BACKOFF_MULTIPLIER = 1.6; +const MAX_BACKOFF_MS = 120000; +const BACKOFF_JITTER = 0.2; +/** + * Get a number uniformly at random in the range [min, max) + * @param min + * @param max + */ +function uniformRandom(min, max) { + return Math.random() * (max - min) + min; +} +class BackoffTimeout { + constructor(callback, options) { + this.callback = callback; + /** + * The delay time at the start, and after each reset. + */ + this.initialDelay = INITIAL_BACKOFF_MS; + /** + * The exponential backoff multiplier. + */ + this.multiplier = BACKOFF_MULTIPLIER; + /** + * The maximum delay time + */ + this.maxDelay = MAX_BACKOFF_MS; + /** + * The maximum fraction by which the delay time can randomly vary after + * applying the multiplier. + */ + this.jitter = BACKOFF_JITTER; + /** + * Indicates whether the timer is currently running. + */ + this.running = false; + /** + * Indicates whether the timer should keep the Node process running if no + * other async operation is doing so. + */ + this.hasRef = true; + /** + * The time that the currently running timer was started. Only valid if + * running is true. + */ + this.startTime = new Date(); + /** + * The approximate time that the currently running timer will end. Only valid + * if running is true. + */ + this.endTime = new Date(); + this.id = BackoffTimeout.getNextId(); + if (options) { + if (options.initialDelay) { + this.initialDelay = options.initialDelay; + } + if (options.multiplier) { + this.multiplier = options.multiplier; + } + if (options.jitter) { + this.jitter = options.jitter; + } + if (options.maxDelay) { + this.maxDelay = options.maxDelay; + } + } + this.trace('constructed initialDelay=' + this.initialDelay + ' multiplier=' + this.multiplier + ' jitter=' + this.jitter + ' maxDelay=' + this.maxDelay); + this.nextDelay = this.initialDelay; + this.timerId = setTimeout(() => { }, 0); + clearTimeout(this.timerId); + } + static getNextId() { + return this.nextId++; + } + trace(text) { + logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, '{' + this.id + '} ' + text); + } + runTimer(delay) { + var _a, _b; + this.trace('runTimer(delay=' + delay + ')'); + this.endTime = this.startTime; + this.endTime.setMilliseconds(this.endTime.getMilliseconds() + delay); + clearTimeout(this.timerId); + this.timerId = setTimeout(() => { + this.trace('timer fired'); + this.running = false; + this.callback(); + }, delay); + if (!this.hasRef) { + (_b = (_a = this.timerId).unref) === null || _b === void 0 ? void 0 : _b.call(_a); + } + } + /** + * Call the callback after the current amount of delay time + */ + runOnce() { + this.trace('runOnce()'); + this.running = true; + this.startTime = new Date(); + this.runTimer(this.nextDelay); + const nextBackoff = Math.min(this.nextDelay * this.multiplier, this.maxDelay); + const jitterMagnitude = nextBackoff * this.jitter; + this.nextDelay = + nextBackoff + uniformRandom(-jitterMagnitude, jitterMagnitude); + } + /** + * Stop the timer. The callback will not be called until `runOnce` is called + * again. + */ + stop() { + this.trace('stop()'); + clearTimeout(this.timerId); + this.running = false; + } + /** + * Reset the delay time to its initial value. If the timer is still running, + * retroactively apply that reset to the current timer. + */ + reset() { + this.trace('reset() running=' + this.running); + this.nextDelay = this.initialDelay; + if (this.running) { + const now = new Date(); + const newEndTime = this.startTime; + newEndTime.setMilliseconds(newEndTime.getMilliseconds() + this.nextDelay); + clearTimeout(this.timerId); + if (now < newEndTime) { + this.runTimer(newEndTime.getTime() - now.getTime()); + } + else { + this.running = false; + } + } + } + /** + * Check whether the timer is currently running. + */ + isRunning() { + return this.running; + } + /** + * Set that while the timer is running, it should keep the Node process + * running. + */ + ref() { + var _a, _b; + this.hasRef = true; + (_b = (_a = this.timerId).ref) === null || _b === void 0 ? void 0 : _b.call(_a); + } + /** + * Set that while the timer is running, it should not keep the Node process + * running. + */ + unref() { + var _a, _b; + this.hasRef = false; + (_b = (_a = this.timerId).unref) === null || _b === void 0 ? void 0 : _b.call(_a); + } + /** + * Get the approximate timestamp of when the timer will fire. Only valid if + * this.isRunning() is true. + */ + getEndTime() { + return this.endTime; + } +} +exports.BackoffTimeout = BackoffTimeout; +BackoffTimeout.nextId = 0; +//# sourceMappingURL=backoff-timeout.js.map + +/***/ }), + +/***/ 79190: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.CallCredentials = void 0; +const metadata_1 = __nccwpck_require__(36100); +function isCurrentOauth2Client(client) { + return ('getRequestHeaders' in client && + typeof client.getRequestHeaders === 'function'); +} +/** + * A class that represents a generic method of adding authentication-related + * metadata on a per-request basis. + */ +class CallCredentials { + /** + * Creates a new CallCredentials object from a given function that generates + * Metadata objects. + * @param metadataGenerator A function that accepts a set of options, and + * generates a Metadata object based on these options, which is passed back + * to the caller via a supplied (err, metadata) callback. + */ + static createFromMetadataGenerator(metadataGenerator) { + return new SingleCallCredentials(metadataGenerator); + } + /** + * Create a gRPC credential from a Google credential object. + * @param googleCredentials The authentication client to use. + * @return The resulting CallCredentials object. + */ + static createFromGoogleCredential(googleCredentials) { + return CallCredentials.createFromMetadataGenerator((options, callback) => { + let getHeaders; + if (isCurrentOauth2Client(googleCredentials)) { + getHeaders = googleCredentials.getRequestHeaders(options.service_url); + } + else { + getHeaders = new Promise((resolve, reject) => { + googleCredentials.getRequestMetadata(options.service_url, (err, headers) => { + if (err) { + reject(err); + return; + } + if (!headers) { + reject(new Error('Headers not set by metadata plugin')); + return; + } + resolve(headers); + }); + }); + } + getHeaders.then(headers => { + const metadata = new metadata_1.Metadata(); + for (const key of Object.keys(headers)) { + metadata.add(key, headers[key]); + } + callback(null, metadata); + }, err => { + callback(err); + }); + }); + } + static createEmpty() { + return new EmptyCallCredentials(); + } +} +exports.CallCredentials = CallCredentials; +class ComposedCallCredentials extends CallCredentials { + constructor(creds) { + super(); + this.creds = creds; + } + async generateMetadata(options) { + const base = new metadata_1.Metadata(); + const generated = await Promise.all(this.creds.map(cred => cred.generateMetadata(options))); + for (const gen of generated) { + base.merge(gen); + } + return base; + } + compose(other) { + return new ComposedCallCredentials(this.creds.concat([other])); + } + _equals(other) { + if (this === other) { + return true; + } + if (other instanceof ComposedCallCredentials) { + return this.creds.every((value, index) => value._equals(other.creds[index])); + } + else { + return false; + } + } +} +class SingleCallCredentials extends CallCredentials { + constructor(metadataGenerator) { + super(); + this.metadataGenerator = metadataGenerator; + } + generateMetadata(options) { + return new Promise((resolve, reject) => { + this.metadataGenerator(options, (err, metadata) => { + if (metadata !== undefined) { + resolve(metadata); + } + else { + reject(err); + } + }); + }); + } + compose(other) { + return new ComposedCallCredentials([this, other]); + } + _equals(other) { + if (this === other) { + return true; + } + if (other instanceof SingleCallCredentials) { + return this.metadataGenerator === other.metadataGenerator; + } + else { + return false; + } + } +} +class EmptyCallCredentials extends CallCredentials { + generateMetadata(options) { + return Promise.resolve(new metadata_1.Metadata()); + } + compose(other) { + return other; + } + _equals(other) { + return other instanceof EmptyCallCredentials; + } +} +//# sourceMappingURL=call-credentials.js.map + +/***/ }), + +/***/ 61803: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2022 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.InterceptingListenerImpl = void 0; +exports.statusOrFromValue = statusOrFromValue; +exports.statusOrFromError = statusOrFromError; +exports.isInterceptingListener = isInterceptingListener; +const metadata_1 = __nccwpck_require__(36100); +function statusOrFromValue(value) { + return { + ok: true, + value: value + }; +} +function statusOrFromError(error) { + var _a; + return { + ok: false, + error: Object.assign(Object.assign({}, error), { metadata: (_a = error.metadata) !== null && _a !== void 0 ? _a : new metadata_1.Metadata() }) + }; +} +function isInterceptingListener(listener) { + return (listener.onReceiveMetadata !== undefined && + listener.onReceiveMetadata.length === 1); +} +class InterceptingListenerImpl { + constructor(listener, nextListener) { + this.listener = listener; + this.nextListener = nextListener; + this.processingMetadata = false; + this.hasPendingMessage = false; + this.processingMessage = false; + this.pendingStatus = null; + } + processPendingMessage() { + if (this.hasPendingMessage) { + this.nextListener.onReceiveMessage(this.pendingMessage); + this.pendingMessage = null; + this.hasPendingMessage = false; + } + } + processPendingStatus() { + if (this.pendingStatus) { + this.nextListener.onReceiveStatus(this.pendingStatus); + } + } + onReceiveMetadata(metadata) { + this.processingMetadata = true; + this.listener.onReceiveMetadata(metadata, metadata => { + this.processingMetadata = false; + this.nextListener.onReceiveMetadata(metadata); + this.processPendingMessage(); + this.processPendingStatus(); + }); + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any + onReceiveMessage(message) { + /* If this listener processes messages asynchronously, the last message may + * be reordered with respect to the status */ + this.processingMessage = true; + this.listener.onReceiveMessage(message, msg => { + this.processingMessage = false; + if (this.processingMetadata) { + this.pendingMessage = msg; + this.hasPendingMessage = true; + } + else { + this.nextListener.onReceiveMessage(msg); + this.processPendingStatus(); + } + }); + } + onReceiveStatus(status) { + this.listener.onReceiveStatus(status, processedStatus => { + if (this.processingMetadata || this.processingMessage) { + this.pendingStatus = processedStatus; + } + else { + this.nextListener.onReceiveStatus(processedStatus); + } + }); + } +} +exports.InterceptingListenerImpl = InterceptingListenerImpl; +//# sourceMappingURL=call-interface.js.map + +/***/ }), + +/***/ 35675: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright 2022 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getNextCallNumber = getNextCallNumber; +let nextCallNumber = 0; +function getNextCallNumber() { + return nextCallNumber++; +} +//# sourceMappingURL=call-number.js.map + +/***/ }), + +/***/ 91161: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ClientDuplexStreamImpl = exports.ClientWritableStreamImpl = exports.ClientReadableStreamImpl = exports.ClientUnaryCallImpl = void 0; +exports.callErrorFromStatus = callErrorFromStatus; +const events_1 = __nccwpck_require__(24434); +const stream_1 = __nccwpck_require__(2203); +const constants_1 = __nccwpck_require__(68288); +/** + * Construct a ServiceError from a StatusObject. This function exists primarily + * as an attempt to make the error stack trace clearly communicate that the + * error is not necessarily a problem in gRPC itself. + * @param status + */ +function callErrorFromStatus(status, callerStack) { + const message = `${status.code} ${constants_1.Status[status.code]}: ${status.details}`; + const error = new Error(message); + const stack = `${error.stack}\nfor call at\n${callerStack}`; + return Object.assign(new Error(message), status, { stack }); +} +class ClientUnaryCallImpl extends events_1.EventEmitter { + constructor() { + super(); + } + cancel() { + var _a; + (_a = this.call) === null || _a === void 0 ? void 0 : _a.cancelWithStatus(constants_1.Status.CANCELLED, 'Cancelled on client'); + } + getPeer() { + var _a, _b; + return (_b = (_a = this.call) === null || _a === void 0 ? void 0 : _a.getPeer()) !== null && _b !== void 0 ? _b : 'unknown'; + } + getAuthContext() { + var _a, _b; + return (_b = (_a = this.call) === null || _a === void 0 ? void 0 : _a.getAuthContext()) !== null && _b !== void 0 ? _b : null; + } +} +exports.ClientUnaryCallImpl = ClientUnaryCallImpl; +class ClientReadableStreamImpl extends stream_1.Readable { + constructor(deserialize) { + super({ objectMode: true }); + this.deserialize = deserialize; + } + cancel() { + var _a; + (_a = this.call) === null || _a === void 0 ? void 0 : _a.cancelWithStatus(constants_1.Status.CANCELLED, 'Cancelled on client'); + } + getPeer() { + var _a, _b; + return (_b = (_a = this.call) === null || _a === void 0 ? void 0 : _a.getPeer()) !== null && _b !== void 0 ? _b : 'unknown'; + } + getAuthContext() { + var _a, _b; + return (_b = (_a = this.call) === null || _a === void 0 ? void 0 : _a.getAuthContext()) !== null && _b !== void 0 ? _b : null; + } + _read(_size) { + var _a; + (_a = this.call) === null || _a === void 0 ? void 0 : _a.startRead(); + } +} +exports.ClientReadableStreamImpl = ClientReadableStreamImpl; +class ClientWritableStreamImpl extends stream_1.Writable { + constructor(serialize) { + super({ objectMode: true }); + this.serialize = serialize; + } + cancel() { + var _a; + (_a = this.call) === null || _a === void 0 ? void 0 : _a.cancelWithStatus(constants_1.Status.CANCELLED, 'Cancelled on client'); + } + getPeer() { + var _a, _b; + return (_b = (_a = this.call) === null || _a === void 0 ? void 0 : _a.getPeer()) !== null && _b !== void 0 ? _b : 'unknown'; + } + getAuthContext() { + var _a, _b; + return (_b = (_a = this.call) === null || _a === void 0 ? void 0 : _a.getAuthContext()) !== null && _b !== void 0 ? _b : null; + } + _write(chunk, encoding, cb) { + var _a; + const context = { + callback: cb, + }; + const flags = Number(encoding); + if (!Number.isNaN(flags)) { + context.flags = flags; + } + (_a = this.call) === null || _a === void 0 ? void 0 : _a.sendMessageWithContext(context, chunk); + } + _final(cb) { + var _a; + (_a = this.call) === null || _a === void 0 ? void 0 : _a.halfClose(); + cb(); + } +} +exports.ClientWritableStreamImpl = ClientWritableStreamImpl; +class ClientDuplexStreamImpl extends stream_1.Duplex { + constructor(serialize, deserialize) { + super({ objectMode: true }); + this.serialize = serialize; + this.deserialize = deserialize; + } + cancel() { + var _a; + (_a = this.call) === null || _a === void 0 ? void 0 : _a.cancelWithStatus(constants_1.Status.CANCELLED, 'Cancelled on client'); + } + getPeer() { + var _a, _b; + return (_b = (_a = this.call) === null || _a === void 0 ? void 0 : _a.getPeer()) !== null && _b !== void 0 ? _b : 'unknown'; + } + getAuthContext() { + var _a, _b; + return (_b = (_a = this.call) === null || _a === void 0 ? void 0 : _a.getAuthContext()) !== null && _b !== void 0 ? _b : null; + } + _read(_size) { + var _a; + (_a = this.call) === null || _a === void 0 ? void 0 : _a.startRead(); + } + _write(chunk, encoding, cb) { + var _a; + const context = { + callback: cb, + }; + const flags = Number(encoding); + if (!Number.isNaN(flags)) { + context.flags = flags; + } + (_a = this.call) === null || _a === void 0 ? void 0 : _a.sendMessageWithContext(context, chunk); + } + _final(cb) { + var _a; + (_a = this.call) === null || _a === void 0 ? void 0 : _a.halfClose(); + cb(); + } +} +exports.ClientDuplexStreamImpl = ClientDuplexStreamImpl; +//# sourceMappingURL=call.js.map + +/***/ }), + +/***/ 27974: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2024 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.FileWatcherCertificateProvider = void 0; +const fs = __nccwpck_require__(79896); +const logging = __nccwpck_require__(8536); +const constants_1 = __nccwpck_require__(68288); +const util_1 = __nccwpck_require__(39023); +const TRACER_NAME = 'certificate_provider'; +function trace(text) { + logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text); +} +const readFilePromise = (0, util_1.promisify)(fs.readFile); +class FileWatcherCertificateProvider { + constructor(config) { + this.config = config; + this.refreshTimer = null; + this.fileResultPromise = null; + this.latestCaUpdate = undefined; + this.caListeners = new Set(); + this.latestIdentityUpdate = undefined; + this.identityListeners = new Set(); + this.lastUpdateTime = null; + if ((config.certificateFile === undefined) !== (config.privateKeyFile === undefined)) { + throw new Error('certificateFile and privateKeyFile must be set or unset together'); + } + if (config.certificateFile === undefined && config.caCertificateFile === undefined) { + throw new Error('At least one of certificateFile and caCertificateFile must be set'); + } + trace('File watcher constructed with config ' + JSON.stringify(config)); + } + updateCertificates() { + if (this.fileResultPromise) { + return; + } + this.fileResultPromise = Promise.allSettled([ + this.config.certificateFile ? readFilePromise(this.config.certificateFile) : Promise.reject(), + this.config.privateKeyFile ? readFilePromise(this.config.privateKeyFile) : Promise.reject(), + this.config.caCertificateFile ? readFilePromise(this.config.caCertificateFile) : Promise.reject() + ]); + this.fileResultPromise.then(([certificateResult, privateKeyResult, caCertificateResult]) => { + if (!this.refreshTimer) { + return; + } + trace('File watcher read certificates certificate ' + certificateResult.status + ', privateKey ' + privateKeyResult.status + ', CA certificate ' + caCertificateResult.status); + this.lastUpdateTime = new Date(); + this.fileResultPromise = null; + if (certificateResult.status === 'fulfilled' && privateKeyResult.status === 'fulfilled') { + this.latestIdentityUpdate = { + certificate: certificateResult.value, + privateKey: privateKeyResult.value + }; + } + else { + this.latestIdentityUpdate = null; + } + if (caCertificateResult.status === 'fulfilled') { + this.latestCaUpdate = { + caCertificate: caCertificateResult.value + }; + } + else { + this.latestCaUpdate = null; + } + for (const listener of this.identityListeners) { + listener(this.latestIdentityUpdate); + } + for (const listener of this.caListeners) { + listener(this.latestCaUpdate); + } + }); + trace('File watcher initiated certificate update'); + } + maybeStartWatchingFiles() { + if (!this.refreshTimer) { + /* Perform the first read immediately, but only if there was not already + * a recent read, to avoid reading from the filesystem significantly more + * frequently than configured if the provider quickly switches between + * used and unused. */ + const timeSinceLastUpdate = this.lastUpdateTime ? (new Date()).getTime() - this.lastUpdateTime.getTime() : Infinity; + if (timeSinceLastUpdate > this.config.refreshIntervalMs) { + this.updateCertificates(); + } + if (timeSinceLastUpdate > this.config.refreshIntervalMs * 2) { + // Clear out old updates if they are definitely stale + this.latestCaUpdate = undefined; + this.latestIdentityUpdate = undefined; + } + this.refreshTimer = setInterval(() => this.updateCertificates(), this.config.refreshIntervalMs); + trace('File watcher started watching'); + } + } + maybeStopWatchingFiles() { + if (this.caListeners.size === 0 && this.identityListeners.size === 0) { + this.fileResultPromise = null; + if (this.refreshTimer) { + clearInterval(this.refreshTimer); + this.refreshTimer = null; + } + } + } + addCaCertificateListener(listener) { + this.caListeners.add(listener); + this.maybeStartWatchingFiles(); + if (this.latestCaUpdate !== undefined) { + process.nextTick(listener, this.latestCaUpdate); + } + } + removeCaCertificateListener(listener) { + this.caListeners.delete(listener); + this.maybeStopWatchingFiles(); + } + addIdentityCertificateListener(listener) { + this.identityListeners.add(listener); + this.maybeStartWatchingFiles(); + if (this.latestIdentityUpdate !== undefined) { + process.nextTick(listener, this.latestIdentityUpdate); + } + } + removeIdentityCertificateListener(listener) { + this.identityListeners.delete(listener); + this.maybeStopWatchingFiles(); + } +} +exports.FileWatcherCertificateProvider = FileWatcherCertificateProvider; +//# sourceMappingURL=certificate-provider.js.map + +/***/ }), + +/***/ 32257: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ChannelCredentials = void 0; +exports.createCertificateProviderChannelCredentials = createCertificateProviderChannelCredentials; +const tls_1 = __nccwpck_require__(64756); +const call_credentials_1 = __nccwpck_require__(79190); +const tls_helpers_1 = __nccwpck_require__(68876); +const uri_parser_1 = __nccwpck_require__(56027); +const resolver_1 = __nccwpck_require__(76255); +const logging_1 = __nccwpck_require__(8536); +const constants_1 = __nccwpck_require__(68288); +// eslint-disable-next-line @typescript-eslint/no-explicit-any +function verifyIsBufferOrNull(obj, friendlyName) { + if (obj && !(obj instanceof Buffer)) { + throw new TypeError(`${friendlyName}, if provided, must be a Buffer.`); + } +} +/** + * A class that contains credentials for communicating over a channel, as well + * as a set of per-call credentials, which are applied to every method call made + * over a channel initialized with an instance of this class. + */ +class ChannelCredentials { + /** + * Returns a copy of this object with the included set of per-call credentials + * expanded to include callCredentials. + * @param callCredentials A CallCredentials object to associate with this + * instance. + */ + compose(callCredentials) { + return new ComposedChannelCredentialsImpl(this, callCredentials); + } + /** + * Return a new ChannelCredentials instance with a given set of credentials. + * The resulting instance can be used to construct a Channel that communicates + * over TLS. + * @param rootCerts The root certificate data. + * @param privateKey The client certificate private key, if available. + * @param certChain The client certificate key chain, if available. + * @param verifyOptions Additional options to modify certificate verification + */ + static createSsl(rootCerts, privateKey, certChain, verifyOptions) { + var _a; + verifyIsBufferOrNull(rootCerts, 'Root certificate'); + verifyIsBufferOrNull(privateKey, 'Private key'); + verifyIsBufferOrNull(certChain, 'Certificate chain'); + if (privateKey && !certChain) { + throw new Error('Private key must be given with accompanying certificate chain'); + } + if (!privateKey && certChain) { + throw new Error('Certificate chain must be given with accompanying private key'); + } + const secureContext = (0, tls_1.createSecureContext)({ + ca: (_a = rootCerts !== null && rootCerts !== void 0 ? rootCerts : (0, tls_helpers_1.getDefaultRootsData)()) !== null && _a !== void 0 ? _a : undefined, + key: privateKey !== null && privateKey !== void 0 ? privateKey : undefined, + cert: certChain !== null && certChain !== void 0 ? certChain : undefined, + ciphers: tls_helpers_1.CIPHER_SUITES, + }); + return new SecureChannelCredentialsImpl(secureContext, verifyOptions !== null && verifyOptions !== void 0 ? verifyOptions : {}); + } + /** + * Return a new ChannelCredentials instance with credentials created using + * the provided secureContext. The resulting instances can be used to + * construct a Channel that communicates over TLS. gRPC will not override + * anything in the provided secureContext, so the environment variables + * GRPC_SSL_CIPHER_SUITES and GRPC_DEFAULT_SSL_ROOTS_FILE_PATH will + * not be applied. + * @param secureContext The return value of tls.createSecureContext() + * @param verifyOptions Additional options to modify certificate verification + */ + static createFromSecureContext(secureContext, verifyOptions) { + return new SecureChannelCredentialsImpl(secureContext, verifyOptions !== null && verifyOptions !== void 0 ? verifyOptions : {}); + } + /** + * Return a new ChannelCredentials instance with no credentials. + */ + static createInsecure() { + return new InsecureChannelCredentialsImpl(); + } +} +exports.ChannelCredentials = ChannelCredentials; +class InsecureChannelCredentialsImpl extends ChannelCredentials { + constructor() { + super(); + } + compose(callCredentials) { + throw new Error('Cannot compose insecure credentials'); + } + _isSecure() { + return false; + } + _equals(other) { + return other instanceof InsecureChannelCredentialsImpl; + } + _createSecureConnector(channelTarget, options, callCredentials) { + return { + connect(socket) { + return Promise.resolve({ + socket, + secure: false + }); + }, + waitForReady: () => { + return Promise.resolve(); + }, + getCallCredentials: () => { + return callCredentials !== null && callCredentials !== void 0 ? callCredentials : call_credentials_1.CallCredentials.createEmpty(); + }, + destroy() { } + }; + } +} +function getConnectionOptions(secureContext, verifyOptions, channelTarget, options) { + var _a, _b; + const connectionOptions = { + secureContext: secureContext + }; + let realTarget = channelTarget; + if ('grpc.http_connect_target' in options) { + const parsedTarget = (0, uri_parser_1.parseUri)(options['grpc.http_connect_target']); + if (parsedTarget) { + realTarget = parsedTarget; + } + } + const targetPath = (0, resolver_1.getDefaultAuthority)(realTarget); + const hostPort = (0, uri_parser_1.splitHostPort)(targetPath); + const remoteHost = (_a = hostPort === null || hostPort === void 0 ? void 0 : hostPort.host) !== null && _a !== void 0 ? _a : targetPath; + connectionOptions.host = remoteHost; + if (verifyOptions.checkServerIdentity) { + connectionOptions.checkServerIdentity = verifyOptions.checkServerIdentity; + } + if (verifyOptions.rejectUnauthorized !== undefined) { + connectionOptions.rejectUnauthorized = verifyOptions.rejectUnauthorized; + } + connectionOptions.ALPNProtocols = ['h2']; + if (options['grpc.ssl_target_name_override']) { + const sslTargetNameOverride = options['grpc.ssl_target_name_override']; + const originalCheckServerIdentity = (_b = connectionOptions.checkServerIdentity) !== null && _b !== void 0 ? _b : tls_1.checkServerIdentity; + connectionOptions.checkServerIdentity = (host, cert) => { + return originalCheckServerIdentity(sslTargetNameOverride, cert); + }; + connectionOptions.servername = sslTargetNameOverride; + } + else { + connectionOptions.servername = remoteHost; + } + if (options['grpc-node.tls_enable_trace']) { + connectionOptions.enableTrace = true; + } + return connectionOptions; +} +class SecureConnectorImpl { + constructor(connectionOptions, callCredentials) { + this.connectionOptions = connectionOptions; + this.callCredentials = callCredentials; + } + connect(socket) { + const tlsConnectOptions = Object.assign({ socket: socket }, this.connectionOptions); + return new Promise((resolve, reject) => { + const tlsSocket = (0, tls_1.connect)(tlsConnectOptions, () => { + var _a; + if (((_a = this.connectionOptions.rejectUnauthorized) !== null && _a !== void 0 ? _a : true) && !tlsSocket.authorized) { + reject(tlsSocket.authorizationError); + return; + } + resolve({ + socket: tlsSocket, + secure: true + }); + }); + tlsSocket.on('error', (error) => { + reject(error); + }); + }); + } + waitForReady() { + return Promise.resolve(); + } + getCallCredentials() { + return this.callCredentials; + } + destroy() { } +} +class SecureChannelCredentialsImpl extends ChannelCredentials { + constructor(secureContext, verifyOptions) { + super(); + this.secureContext = secureContext; + this.verifyOptions = verifyOptions; + } + _isSecure() { + return true; + } + _equals(other) { + if (this === other) { + return true; + } + if (other instanceof SecureChannelCredentialsImpl) { + return (this.secureContext === other.secureContext && + this.verifyOptions.checkServerIdentity === + other.verifyOptions.checkServerIdentity); + } + else { + return false; + } + } + _createSecureConnector(channelTarget, options, callCredentials) { + const connectionOptions = getConnectionOptions(this.secureContext, this.verifyOptions, channelTarget, options); + return new SecureConnectorImpl(connectionOptions, callCredentials !== null && callCredentials !== void 0 ? callCredentials : call_credentials_1.CallCredentials.createEmpty()); + } +} +class CertificateProviderChannelCredentialsImpl extends ChannelCredentials { + constructor(caCertificateProvider, identityCertificateProvider, verifyOptions) { + super(); + this.caCertificateProvider = caCertificateProvider; + this.identityCertificateProvider = identityCertificateProvider; + this.verifyOptions = verifyOptions; + this.refcount = 0; + /** + * `undefined` means that the certificates have not yet been loaded. `null` + * means that an attempt to load them has completed, and has failed. + */ + this.latestCaUpdate = undefined; + /** + * `undefined` means that the certificates have not yet been loaded. `null` + * means that an attempt to load them has completed, and has failed. + */ + this.latestIdentityUpdate = undefined; + this.caCertificateUpdateListener = this.handleCaCertificateUpdate.bind(this); + this.identityCertificateUpdateListener = this.handleIdentityCertitificateUpdate.bind(this); + this.secureContextWatchers = []; + } + _isSecure() { + return true; + } + _equals(other) { + var _a, _b; + if (this === other) { + return true; + } + if (other instanceof CertificateProviderChannelCredentialsImpl) { + return this.caCertificateProvider === other.caCertificateProvider && + this.identityCertificateProvider === other.identityCertificateProvider && + ((_a = this.verifyOptions) === null || _a === void 0 ? void 0 : _a.checkServerIdentity) === ((_b = other.verifyOptions) === null || _b === void 0 ? void 0 : _b.checkServerIdentity); + } + else { + return false; + } + } + ref() { + var _a; + if (this.refcount === 0) { + this.caCertificateProvider.addCaCertificateListener(this.caCertificateUpdateListener); + (_a = this.identityCertificateProvider) === null || _a === void 0 ? void 0 : _a.addIdentityCertificateListener(this.identityCertificateUpdateListener); + } + this.refcount += 1; + } + unref() { + var _a; + this.refcount -= 1; + if (this.refcount === 0) { + this.caCertificateProvider.removeCaCertificateListener(this.caCertificateUpdateListener); + (_a = this.identityCertificateProvider) === null || _a === void 0 ? void 0 : _a.removeIdentityCertificateListener(this.identityCertificateUpdateListener); + } + } + _createSecureConnector(channelTarget, options, callCredentials) { + this.ref(); + return new CertificateProviderChannelCredentialsImpl.SecureConnectorImpl(this, channelTarget, options, callCredentials !== null && callCredentials !== void 0 ? callCredentials : call_credentials_1.CallCredentials.createEmpty()); + } + maybeUpdateWatchers() { + if (this.hasReceivedUpdates()) { + for (const watcher of this.secureContextWatchers) { + watcher(this.getLatestSecureContext()); + } + this.secureContextWatchers = []; + } + } + handleCaCertificateUpdate(update) { + this.latestCaUpdate = update; + this.maybeUpdateWatchers(); + } + handleIdentityCertitificateUpdate(update) { + this.latestIdentityUpdate = update; + this.maybeUpdateWatchers(); + } + hasReceivedUpdates() { + if (this.latestCaUpdate === undefined) { + return false; + } + if (this.identityCertificateProvider && this.latestIdentityUpdate === undefined) { + return false; + } + return true; + } + getSecureContext() { + if (this.hasReceivedUpdates()) { + return Promise.resolve(this.getLatestSecureContext()); + } + else { + return new Promise(resolve => { + this.secureContextWatchers.push(resolve); + }); + } + } + getLatestSecureContext() { + var _a, _b; + if (!this.latestCaUpdate) { + return null; + } + if (this.identityCertificateProvider !== null && !this.latestIdentityUpdate) { + return null; + } + try { + return (0, tls_1.createSecureContext)({ + ca: this.latestCaUpdate.caCertificate, + key: (_a = this.latestIdentityUpdate) === null || _a === void 0 ? void 0 : _a.privateKey, + cert: (_b = this.latestIdentityUpdate) === null || _b === void 0 ? void 0 : _b.certificate, + ciphers: tls_helpers_1.CIPHER_SUITES + }); + } + catch (e) { + (0, logging_1.log)(constants_1.LogVerbosity.ERROR, 'Failed to createSecureContext with error ' + e.message); + return null; + } + } +} +CertificateProviderChannelCredentialsImpl.SecureConnectorImpl = class { + constructor(parent, channelTarget, options, callCredentials) { + this.parent = parent; + this.channelTarget = channelTarget; + this.options = options; + this.callCredentials = callCredentials; + } + connect(socket) { + return new Promise((resolve, reject) => { + const secureContext = this.parent.getLatestSecureContext(); + if (!secureContext) { + reject(new Error('Failed to load credentials')); + return; + } + if (socket.closed) { + reject(new Error('Socket closed while loading credentials')); + } + const connnectionOptions = getConnectionOptions(secureContext, this.parent.verifyOptions, this.channelTarget, this.options); + const tlsConnectOptions = Object.assign({ socket: socket }, connnectionOptions); + const closeCallback = () => { + reject(new Error('Socket closed')); + }; + const errorCallback = (error) => { + reject(error); + }; + const tlsSocket = (0, tls_1.connect)(tlsConnectOptions, () => { + var _a; + tlsSocket.removeListener('close', closeCallback); + tlsSocket.removeListener('error', errorCallback); + if (((_a = this.parent.verifyOptions.rejectUnauthorized) !== null && _a !== void 0 ? _a : true) && !tlsSocket.authorized) { + reject(tlsSocket.authorizationError); + return; + } + resolve({ + socket: tlsSocket, + secure: true + }); + }); + tlsSocket.once('close', closeCallback); + tlsSocket.once('error', errorCallback); + }); + } + async waitForReady() { + await this.parent.getSecureContext(); + } + getCallCredentials() { + return this.callCredentials; + } + destroy() { + this.parent.unref(); + } +}; +function createCertificateProviderChannelCredentials(caCertificateProvider, identityCertificateProvider, verifyOptions) { + return new CertificateProviderChannelCredentialsImpl(caCertificateProvider, identityCertificateProvider, verifyOptions !== null && verifyOptions !== void 0 ? verifyOptions : {}); +} +class ComposedChannelCredentialsImpl extends ChannelCredentials { + constructor(channelCredentials, callCredentials) { + super(); + this.channelCredentials = channelCredentials; + this.callCredentials = callCredentials; + if (!channelCredentials._isSecure()) { + throw new Error('Cannot compose insecure credentials'); + } + } + compose(callCredentials) { + const combinedCallCredentials = this.callCredentials.compose(callCredentials); + return new ComposedChannelCredentialsImpl(this.channelCredentials, combinedCallCredentials); + } + _isSecure() { + return true; + } + _equals(other) { + if (this === other) { + return true; + } + if (other instanceof ComposedChannelCredentialsImpl) { + return (this.channelCredentials._equals(other.channelCredentials) && + this.callCredentials._equals(other.callCredentials)); + } + else { + return false; + } + } + _createSecureConnector(channelTarget, options, callCredentials) { + const combinedCallCredentials = this.callCredentials.compose(callCredentials !== null && callCredentials !== void 0 ? callCredentials : call_credentials_1.CallCredentials.createEmpty()); + return this.channelCredentials._createSecureConnector(channelTarget, options, combinedCallCredentials); + } +} +//# sourceMappingURL=channel-credentials.js.map + +/***/ }), + +/***/ 86793: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.recognizedOptions = void 0; +exports.channelOptionsEqual = channelOptionsEqual; +/** + * This is for checking provided options at runtime. This is an object for + * easier membership checking. + */ +exports.recognizedOptions = { + 'grpc.ssl_target_name_override': true, + 'grpc.primary_user_agent': true, + 'grpc.secondary_user_agent': true, + 'grpc.default_authority': true, + 'grpc.keepalive_time_ms': true, + 'grpc.keepalive_timeout_ms': true, + 'grpc.keepalive_permit_without_calls': true, + 'grpc.service_config': true, + 'grpc.max_concurrent_streams': true, + 'grpc.initial_reconnect_backoff_ms': true, + 'grpc.max_reconnect_backoff_ms': true, + 'grpc.use_local_subchannel_pool': true, + 'grpc.max_send_message_length': true, + 'grpc.max_receive_message_length': true, + 'grpc.enable_http_proxy': true, + 'grpc.enable_channelz': true, + 'grpc.dns_min_time_between_resolutions_ms': true, + 'grpc.enable_retries': true, + 'grpc.per_rpc_retry_buffer_size': true, + 'grpc.retry_buffer_size': true, + 'grpc.max_connection_age_ms': true, + 'grpc.max_connection_age_grace_ms': true, + 'grpc-node.max_session_memory': true, + 'grpc.service_config_disable_resolution': true, + 'grpc.client_idle_timeout_ms': true, + 'grpc-node.tls_enable_trace': true, + 'grpc.lb.ring_hash.ring_size_cap': true, + 'grpc-node.retry_max_attempts_limit': true, + 'grpc-node.flow_control_window': true, + 'grpc.server_call_metric_recording': true +}; +function channelOptionsEqual(options1, options2) { + const keys1 = Object.keys(options1).sort(); + const keys2 = Object.keys(options2).sort(); + if (keys1.length !== keys2.length) { + return false; + } + for (let i = 0; i < keys1.length; i += 1) { + if (keys1[i] !== keys2[i]) { + return false; + } + if (options1[keys1[i]] !== options2[keys2[i]]) { + return false; + } + } + return true; +} +//# sourceMappingURL=channel-options.js.map + +/***/ }), + +/***/ 86918: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ChannelImplementation = void 0; +const channel_credentials_1 = __nccwpck_require__(32257); +const internal_channel_1 = __nccwpck_require__(40114); +class ChannelImplementation { + constructor(target, credentials, options) { + if (typeof target !== 'string') { + throw new TypeError('Channel target must be a string'); + } + if (!(credentials instanceof channel_credentials_1.ChannelCredentials)) { + throw new TypeError('Channel credentials must be a ChannelCredentials object'); + } + if (options) { + if (typeof options !== 'object') { + throw new TypeError('Channel options must be an object'); + } + } + this.internalChannel = new internal_channel_1.InternalChannel(target, credentials, options); + } + close() { + this.internalChannel.close(); + } + getTarget() { + return this.internalChannel.getTarget(); + } + getConnectivityState(tryToConnect) { + return this.internalChannel.getConnectivityState(tryToConnect); + } + watchConnectivityState(currentState, deadline, callback) { + this.internalChannel.watchConnectivityState(currentState, deadline, callback); + } + /** + * Get the channelz reference object for this channel. The returned value is + * garbage if channelz is disabled for this channel. + * @returns + */ + getChannelzRef() { + return this.internalChannel.getChannelzRef(); + } + createCall(method, deadline, host, parentCall, propagateFlags) { + if (typeof method !== 'string') { + throw new TypeError('Channel#createCall: method must be a string'); + } + if (!(typeof deadline === 'number' || deadline instanceof Date)) { + throw new TypeError('Channel#createCall: deadline must be a number or Date'); + } + return this.internalChannel.createCall(method, deadline, host, parentCall, propagateFlags); + } +} +exports.ChannelImplementation = ChannelImplementation; +//# sourceMappingURL=channel.js.map + +/***/ }), + +/***/ 68198: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2021 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.registerChannelzSocket = exports.registerChannelzServer = exports.registerChannelzSubchannel = exports.registerChannelzChannel = exports.ChannelzCallTrackerStub = exports.ChannelzCallTracker = exports.ChannelzChildrenTrackerStub = exports.ChannelzChildrenTracker = exports.ChannelzTrace = exports.ChannelzTraceStub = void 0; +exports.unregisterChannelzRef = unregisterChannelzRef; +exports.getChannelzHandlers = getChannelzHandlers; +exports.getChannelzServiceDefinition = getChannelzServiceDefinition; +exports.setup = setup; +const net_1 = __nccwpck_require__(69278); +const ordered_map_1 = __nccwpck_require__(60137); +const connectivity_state_1 = __nccwpck_require__(60778); +const constants_1 = __nccwpck_require__(68288); +const subchannel_address_1 = __nccwpck_require__(97021); +const admin_1 = __nccwpck_require__(52914); +const make_client_1 = __nccwpck_require__(76983); +function channelRefToMessage(ref) { + return { + channel_id: ref.id, + name: ref.name, + }; +} +function subchannelRefToMessage(ref) { + return { + subchannel_id: ref.id, + name: ref.name, + }; +} +function serverRefToMessage(ref) { + return { + server_id: ref.id, + }; +} +function socketRefToMessage(ref) { + return { + socket_id: ref.id, + name: ref.name, + }; +} +/** + * The loose upper bound on the number of events that should be retained in a + * trace. This may be exceeded by up to a factor of 2. Arbitrarily chosen as a + * number that should be large enough to contain the recent relevant + * information, but small enough to not use excessive memory. + */ +const TARGET_RETAINED_TRACES = 32; +/** + * Default number of sockets/servers/channels/subchannels to return + */ +const DEFAULT_MAX_RESULTS = 100; +class ChannelzTraceStub { + constructor() { + this.events = []; + this.creationTimestamp = new Date(); + this.eventsLogged = 0; + } + addTrace() { } + getTraceMessage() { + return { + creation_timestamp: dateToProtoTimestamp(this.creationTimestamp), + num_events_logged: this.eventsLogged, + events: [], + }; + } +} +exports.ChannelzTraceStub = ChannelzTraceStub; +class ChannelzTrace { + constructor() { + this.events = []; + this.eventsLogged = 0; + this.creationTimestamp = new Date(); + } + addTrace(severity, description, child) { + const timestamp = new Date(); + this.events.push({ + description: description, + severity: severity, + timestamp: timestamp, + childChannel: (child === null || child === void 0 ? void 0 : child.kind) === 'channel' ? child : undefined, + childSubchannel: (child === null || child === void 0 ? void 0 : child.kind) === 'subchannel' ? child : undefined, + }); + // Whenever the trace array gets too large, discard the first half + if (this.events.length >= TARGET_RETAINED_TRACES * 2) { + this.events = this.events.slice(TARGET_RETAINED_TRACES); + } + this.eventsLogged += 1; + } + getTraceMessage() { + return { + creation_timestamp: dateToProtoTimestamp(this.creationTimestamp), + num_events_logged: this.eventsLogged, + events: this.events.map(event => { + return { + description: event.description, + severity: event.severity, + timestamp: dateToProtoTimestamp(event.timestamp), + channel_ref: event.childChannel + ? channelRefToMessage(event.childChannel) + : null, + subchannel_ref: event.childSubchannel + ? subchannelRefToMessage(event.childSubchannel) + : null, + }; + }), + }; + } +} +exports.ChannelzTrace = ChannelzTrace; +class ChannelzChildrenTracker { + constructor() { + this.channelChildren = new ordered_map_1.OrderedMap(); + this.subchannelChildren = new ordered_map_1.OrderedMap(); + this.socketChildren = new ordered_map_1.OrderedMap(); + this.trackerMap = { + ["channel" /* EntityTypes.channel */]: this.channelChildren, + ["subchannel" /* EntityTypes.subchannel */]: this.subchannelChildren, + ["socket" /* EntityTypes.socket */]: this.socketChildren, + }; + } + refChild(child) { + const tracker = this.trackerMap[child.kind]; + const trackedChild = tracker.find(child.id); + if (trackedChild.equals(tracker.end())) { + tracker.setElement(child.id, { + ref: child, + count: 1, + }, trackedChild); + } + else { + trackedChild.pointer[1].count += 1; + } + } + unrefChild(child) { + const tracker = this.trackerMap[child.kind]; + const trackedChild = tracker.getElementByKey(child.id); + if (trackedChild !== undefined) { + trackedChild.count -= 1; + if (trackedChild.count === 0) { + tracker.eraseElementByKey(child.id); + } + } + } + getChildLists() { + return { + channels: this.channelChildren, + subchannels: this.subchannelChildren, + sockets: this.socketChildren, + }; + } +} +exports.ChannelzChildrenTracker = ChannelzChildrenTracker; +class ChannelzChildrenTrackerStub extends ChannelzChildrenTracker { + refChild() { } + unrefChild() { } +} +exports.ChannelzChildrenTrackerStub = ChannelzChildrenTrackerStub; +class ChannelzCallTracker { + constructor() { + this.callsStarted = 0; + this.callsSucceeded = 0; + this.callsFailed = 0; + this.lastCallStartedTimestamp = null; + } + addCallStarted() { + this.callsStarted += 1; + this.lastCallStartedTimestamp = new Date(); + } + addCallSucceeded() { + this.callsSucceeded += 1; + } + addCallFailed() { + this.callsFailed += 1; + } +} +exports.ChannelzCallTracker = ChannelzCallTracker; +class ChannelzCallTrackerStub extends ChannelzCallTracker { + addCallStarted() { } + addCallSucceeded() { } + addCallFailed() { } +} +exports.ChannelzCallTrackerStub = ChannelzCallTrackerStub; +const entityMaps = { + ["channel" /* EntityTypes.channel */]: new ordered_map_1.OrderedMap(), + ["subchannel" /* EntityTypes.subchannel */]: new ordered_map_1.OrderedMap(), + ["server" /* EntityTypes.server */]: new ordered_map_1.OrderedMap(), + ["socket" /* EntityTypes.socket */]: new ordered_map_1.OrderedMap(), +}; +const generateRegisterFn = (kind) => { + let nextId = 1; + function getNextId() { + return nextId++; + } + const entityMap = entityMaps[kind]; + return (name, getInfo, channelzEnabled) => { + const id = getNextId(); + const ref = { id, name, kind }; + if (channelzEnabled) { + entityMap.setElement(id, { ref, getInfo }); + } + return ref; + }; +}; +exports.registerChannelzChannel = generateRegisterFn("channel" /* EntityTypes.channel */); +exports.registerChannelzSubchannel = generateRegisterFn("subchannel" /* EntityTypes.subchannel */); +exports.registerChannelzServer = generateRegisterFn("server" /* EntityTypes.server */); +exports.registerChannelzSocket = generateRegisterFn("socket" /* EntityTypes.socket */); +function unregisterChannelzRef(ref) { + entityMaps[ref.kind].eraseElementByKey(ref.id); +} +/** + * Parse a single section of an IPv6 address as two bytes + * @param addressSection A hexadecimal string of length up to 4 + * @returns The pair of bytes representing this address section + */ +function parseIPv6Section(addressSection) { + const numberValue = Number.parseInt(addressSection, 16); + return [(numberValue / 256) | 0, numberValue % 256]; +} +/** + * Parse a chunk of an IPv6 address string to some number of bytes + * @param addressChunk Some number of segments of up to 4 hexadecimal + * characters each, joined by colons. + * @returns The list of bytes representing this address chunk + */ +function parseIPv6Chunk(addressChunk) { + if (addressChunk === '') { + return []; + } + const bytePairs = addressChunk + .split(':') + .map(section => parseIPv6Section(section)); + const result = []; + return result.concat(...bytePairs); +} +function isIPv6MappedIPv4(ipAddress) { + return (0, net_1.isIPv6)(ipAddress) && ipAddress.toLowerCase().startsWith('::ffff:') && (0, net_1.isIPv4)(ipAddress.substring(7)); +} +/** + * Prerequisite: isIPv4(ipAddress) + * @param ipAddress + * @returns + */ +function ipv4AddressStringToBuffer(ipAddress) { + return Buffer.from(Uint8Array.from(ipAddress.split('.').map(segment => Number.parseInt(segment)))); +} +/** + * Converts an IPv4 or IPv6 address from string representation to binary + * representation + * @param ipAddress an IP address in standard IPv4 or IPv6 text format + * @returns + */ +function ipAddressStringToBuffer(ipAddress) { + if ((0, net_1.isIPv4)(ipAddress)) { + return ipv4AddressStringToBuffer(ipAddress); + } + else if (isIPv6MappedIPv4(ipAddress)) { + return ipv4AddressStringToBuffer(ipAddress.substring(7)); + } + else if ((0, net_1.isIPv6)(ipAddress)) { + let leftSection; + let rightSection; + const doubleColonIndex = ipAddress.indexOf('::'); + if (doubleColonIndex === -1) { + leftSection = ipAddress; + rightSection = ''; + } + else { + leftSection = ipAddress.substring(0, doubleColonIndex); + rightSection = ipAddress.substring(doubleColonIndex + 2); + } + const leftBuffer = Buffer.from(parseIPv6Chunk(leftSection)); + const rightBuffer = Buffer.from(parseIPv6Chunk(rightSection)); + const middleBuffer = Buffer.alloc(16 - leftBuffer.length - rightBuffer.length, 0); + return Buffer.concat([leftBuffer, middleBuffer, rightBuffer]); + } + else { + return null; + } +} +function connectivityStateToMessage(state) { + switch (state) { + case connectivity_state_1.ConnectivityState.CONNECTING: + return { + state: 'CONNECTING', + }; + case connectivity_state_1.ConnectivityState.IDLE: + return { + state: 'IDLE', + }; + case connectivity_state_1.ConnectivityState.READY: + return { + state: 'READY', + }; + case connectivity_state_1.ConnectivityState.SHUTDOWN: + return { + state: 'SHUTDOWN', + }; + case connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE: + return { + state: 'TRANSIENT_FAILURE', + }; + default: + return { + state: 'UNKNOWN', + }; + } +} +function dateToProtoTimestamp(date) { + if (!date) { + return null; + } + const millisSinceEpoch = date.getTime(); + return { + seconds: (millisSinceEpoch / 1000) | 0, + nanos: (millisSinceEpoch % 1000) * 1000000, + }; +} +function getChannelMessage(channelEntry) { + const resolvedInfo = channelEntry.getInfo(); + const channelRef = []; + const subchannelRef = []; + resolvedInfo.children.channels.forEach(el => { + channelRef.push(channelRefToMessage(el[1].ref)); + }); + resolvedInfo.children.subchannels.forEach(el => { + subchannelRef.push(subchannelRefToMessage(el[1].ref)); + }); + return { + ref: channelRefToMessage(channelEntry.ref), + data: { + target: resolvedInfo.target, + state: connectivityStateToMessage(resolvedInfo.state), + calls_started: resolvedInfo.callTracker.callsStarted, + calls_succeeded: resolvedInfo.callTracker.callsSucceeded, + calls_failed: resolvedInfo.callTracker.callsFailed, + last_call_started_timestamp: dateToProtoTimestamp(resolvedInfo.callTracker.lastCallStartedTimestamp), + trace: resolvedInfo.trace.getTraceMessage(), + }, + channel_ref: channelRef, + subchannel_ref: subchannelRef, + }; +} +function GetChannel(call, callback) { + const channelId = parseInt(call.request.channel_id, 10); + const channelEntry = entityMaps["channel" /* EntityTypes.channel */].getElementByKey(channelId); + if (channelEntry === undefined) { + callback({ + code: constants_1.Status.NOT_FOUND, + details: 'No channel data found for id ' + channelId, + }); + return; + } + callback(null, { channel: getChannelMessage(channelEntry) }); +} +function GetTopChannels(call, callback) { + const maxResults = parseInt(call.request.max_results, 10) || DEFAULT_MAX_RESULTS; + const resultList = []; + const startId = parseInt(call.request.start_channel_id, 10); + const channelEntries = entityMaps["channel" /* EntityTypes.channel */]; + let i; + for (i = channelEntries.lowerBound(startId); !i.equals(channelEntries.end()) && resultList.length < maxResults; i = i.next()) { + resultList.push(getChannelMessage(i.pointer[1])); + } + callback(null, { + channel: resultList, + end: i.equals(channelEntries.end()), + }); +} +function getServerMessage(serverEntry) { + const resolvedInfo = serverEntry.getInfo(); + const listenSocket = []; + resolvedInfo.listenerChildren.sockets.forEach(el => { + listenSocket.push(socketRefToMessage(el[1].ref)); + }); + return { + ref: serverRefToMessage(serverEntry.ref), + data: { + calls_started: resolvedInfo.callTracker.callsStarted, + calls_succeeded: resolvedInfo.callTracker.callsSucceeded, + calls_failed: resolvedInfo.callTracker.callsFailed, + last_call_started_timestamp: dateToProtoTimestamp(resolvedInfo.callTracker.lastCallStartedTimestamp), + trace: resolvedInfo.trace.getTraceMessage(), + }, + listen_socket: listenSocket, + }; +} +function GetServer(call, callback) { + const serverId = parseInt(call.request.server_id, 10); + const serverEntries = entityMaps["server" /* EntityTypes.server */]; + const serverEntry = serverEntries.getElementByKey(serverId); + if (serverEntry === undefined) { + callback({ + code: constants_1.Status.NOT_FOUND, + details: 'No server data found for id ' + serverId, + }); + return; + } + callback(null, { server: getServerMessage(serverEntry) }); +} +function GetServers(call, callback) { + const maxResults = parseInt(call.request.max_results, 10) || DEFAULT_MAX_RESULTS; + const startId = parseInt(call.request.start_server_id, 10); + const serverEntries = entityMaps["server" /* EntityTypes.server */]; + const resultList = []; + let i; + for (i = serverEntries.lowerBound(startId); !i.equals(serverEntries.end()) && resultList.length < maxResults; i = i.next()) { + resultList.push(getServerMessage(i.pointer[1])); + } + callback(null, { + server: resultList, + end: i.equals(serverEntries.end()), + }); +} +function GetSubchannel(call, callback) { + const subchannelId = parseInt(call.request.subchannel_id, 10); + const subchannelEntry = entityMaps["subchannel" /* EntityTypes.subchannel */].getElementByKey(subchannelId); + if (subchannelEntry === undefined) { + callback({ + code: constants_1.Status.NOT_FOUND, + details: 'No subchannel data found for id ' + subchannelId, + }); + return; + } + const resolvedInfo = subchannelEntry.getInfo(); + const listenSocket = []; + resolvedInfo.children.sockets.forEach(el => { + listenSocket.push(socketRefToMessage(el[1].ref)); + }); + const subchannelMessage = { + ref: subchannelRefToMessage(subchannelEntry.ref), + data: { + target: resolvedInfo.target, + state: connectivityStateToMessage(resolvedInfo.state), + calls_started: resolvedInfo.callTracker.callsStarted, + calls_succeeded: resolvedInfo.callTracker.callsSucceeded, + calls_failed: resolvedInfo.callTracker.callsFailed, + last_call_started_timestamp: dateToProtoTimestamp(resolvedInfo.callTracker.lastCallStartedTimestamp), + trace: resolvedInfo.trace.getTraceMessage(), + }, + socket_ref: listenSocket, + }; + callback(null, { subchannel: subchannelMessage }); +} +function subchannelAddressToAddressMessage(subchannelAddress) { + var _a; + if ((0, subchannel_address_1.isTcpSubchannelAddress)(subchannelAddress)) { + return { + address: 'tcpip_address', + tcpip_address: { + ip_address: (_a = ipAddressStringToBuffer(subchannelAddress.host)) !== null && _a !== void 0 ? _a : undefined, + port: subchannelAddress.port, + }, + }; + } + else { + return { + address: 'uds_address', + uds_address: { + filename: subchannelAddress.path, + }, + }; + } +} +function GetSocket(call, callback) { + var _a, _b, _c, _d, _e; + const socketId = parseInt(call.request.socket_id, 10); + const socketEntry = entityMaps["socket" /* EntityTypes.socket */].getElementByKey(socketId); + if (socketEntry === undefined) { + callback({ + code: constants_1.Status.NOT_FOUND, + details: 'No socket data found for id ' + socketId, + }); + return; + } + const resolvedInfo = socketEntry.getInfo(); + const securityMessage = resolvedInfo.security + ? { + model: 'tls', + tls: { + cipher_suite: resolvedInfo.security.cipherSuiteStandardName + ? 'standard_name' + : 'other_name', + standard_name: (_a = resolvedInfo.security.cipherSuiteStandardName) !== null && _a !== void 0 ? _a : undefined, + other_name: (_b = resolvedInfo.security.cipherSuiteOtherName) !== null && _b !== void 0 ? _b : undefined, + local_certificate: (_c = resolvedInfo.security.localCertificate) !== null && _c !== void 0 ? _c : undefined, + remote_certificate: (_d = resolvedInfo.security.remoteCertificate) !== null && _d !== void 0 ? _d : undefined, + }, + } + : null; + const socketMessage = { + ref: socketRefToMessage(socketEntry.ref), + local: resolvedInfo.localAddress + ? subchannelAddressToAddressMessage(resolvedInfo.localAddress) + : null, + remote: resolvedInfo.remoteAddress + ? subchannelAddressToAddressMessage(resolvedInfo.remoteAddress) + : null, + remote_name: (_e = resolvedInfo.remoteName) !== null && _e !== void 0 ? _e : undefined, + security: securityMessage, + data: { + keep_alives_sent: resolvedInfo.keepAlivesSent, + streams_started: resolvedInfo.streamsStarted, + streams_succeeded: resolvedInfo.streamsSucceeded, + streams_failed: resolvedInfo.streamsFailed, + last_local_stream_created_timestamp: dateToProtoTimestamp(resolvedInfo.lastLocalStreamCreatedTimestamp), + last_remote_stream_created_timestamp: dateToProtoTimestamp(resolvedInfo.lastRemoteStreamCreatedTimestamp), + messages_received: resolvedInfo.messagesReceived, + messages_sent: resolvedInfo.messagesSent, + last_message_received_timestamp: dateToProtoTimestamp(resolvedInfo.lastMessageReceivedTimestamp), + last_message_sent_timestamp: dateToProtoTimestamp(resolvedInfo.lastMessageSentTimestamp), + local_flow_control_window: resolvedInfo.localFlowControlWindow + ? { value: resolvedInfo.localFlowControlWindow } + : null, + remote_flow_control_window: resolvedInfo.remoteFlowControlWindow + ? { value: resolvedInfo.remoteFlowControlWindow } + : null, + }, + }; + callback(null, { socket: socketMessage }); +} +function GetServerSockets(call, callback) { + const serverId = parseInt(call.request.server_id, 10); + const serverEntry = entityMaps["server" /* EntityTypes.server */].getElementByKey(serverId); + if (serverEntry === undefined) { + callback({ + code: constants_1.Status.NOT_FOUND, + details: 'No server data found for id ' + serverId, + }); + return; + } + const startId = parseInt(call.request.start_socket_id, 10); + const maxResults = parseInt(call.request.max_results, 10) || DEFAULT_MAX_RESULTS; + const resolvedInfo = serverEntry.getInfo(); + // If we wanted to include listener sockets in the result, this line would + // instead say + // const allSockets = resolvedInfo.listenerChildren.sockets.concat(resolvedInfo.sessionChildren.sockets).sort((ref1, ref2) => ref1.id - ref2.id); + const allSockets = resolvedInfo.sessionChildren.sockets; + const resultList = []; + let i; + for (i = allSockets.lowerBound(startId); !i.equals(allSockets.end()) && resultList.length < maxResults; i = i.next()) { + resultList.push(socketRefToMessage(i.pointer[1].ref)); + } + callback(null, { + socket_ref: resultList, + end: i.equals(allSockets.end()), + }); +} +function getChannelzHandlers() { + return { + GetChannel, + GetTopChannels, + GetServer, + GetServers, + GetSubchannel, + GetSocket, + GetServerSockets, + }; +} +let loadedChannelzDefinition = null; +function getChannelzServiceDefinition() { + if (loadedChannelzDefinition) { + return loadedChannelzDefinition; + } + /* The purpose of this complexity is to avoid loading @grpc/proto-loader at + * runtime for users who will not use/enable channelz. */ + const loaderLoadSync = (__nccwpck_require__(73066)/* .loadSync */ .Yi); + const loadedProto = loaderLoadSync('channelz.proto', { + keepCase: true, + longs: String, + enums: String, + defaults: true, + oneofs: true, + includeDirs: [__nccwpck_require__.ab + "proto"], + }); + const channelzGrpcObject = (0, make_client_1.loadPackageDefinition)(loadedProto); + loadedChannelzDefinition = + channelzGrpcObject.grpc.channelz.v1.Channelz.service; + return loadedChannelzDefinition; +} +function setup() { + (0, admin_1.registerAdminService)(getChannelzServiceDefinition, getChannelzHandlers); +} +//# sourceMappingURL=channelz.js.map + +/***/ }), + +/***/ 82451: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.InterceptingCall = exports.RequesterBuilder = exports.ListenerBuilder = exports.InterceptorConfigurationError = void 0; +exports.getInterceptingCall = getInterceptingCall; +const metadata_1 = __nccwpck_require__(36100); +const call_interface_1 = __nccwpck_require__(61803); +const constants_1 = __nccwpck_require__(68288); +const error_1 = __nccwpck_require__(98219); +/** + * Error class associated with passing both interceptors and interceptor + * providers to a client constructor or as call options. + */ +class InterceptorConfigurationError extends Error { + constructor(message) { + super(message); + this.name = 'InterceptorConfigurationError'; + Error.captureStackTrace(this, InterceptorConfigurationError); + } +} +exports.InterceptorConfigurationError = InterceptorConfigurationError; +class ListenerBuilder { + constructor() { + this.metadata = undefined; + this.message = undefined; + this.status = undefined; + } + withOnReceiveMetadata(onReceiveMetadata) { + this.metadata = onReceiveMetadata; + return this; + } + withOnReceiveMessage(onReceiveMessage) { + this.message = onReceiveMessage; + return this; + } + withOnReceiveStatus(onReceiveStatus) { + this.status = onReceiveStatus; + return this; + } + build() { + return { + onReceiveMetadata: this.metadata, + onReceiveMessage: this.message, + onReceiveStatus: this.status, + }; + } +} +exports.ListenerBuilder = ListenerBuilder; +class RequesterBuilder { + constructor() { + this.start = undefined; + this.message = undefined; + this.halfClose = undefined; + this.cancel = undefined; + } + withStart(start) { + this.start = start; + return this; + } + withSendMessage(sendMessage) { + this.message = sendMessage; + return this; + } + withHalfClose(halfClose) { + this.halfClose = halfClose; + return this; + } + withCancel(cancel) { + this.cancel = cancel; + return this; + } + build() { + return { + start: this.start, + sendMessage: this.message, + halfClose: this.halfClose, + cancel: this.cancel, + }; + } +} +exports.RequesterBuilder = RequesterBuilder; +/** + * A Listener with a default pass-through implementation of each method. Used + * for filling out Listeners with some methods omitted. + */ +const defaultListener = { + onReceiveMetadata: (metadata, next) => { + next(metadata); + }, + onReceiveMessage: (message, next) => { + next(message); + }, + onReceiveStatus: (status, next) => { + next(status); + }, +}; +/** + * A Requester with a default pass-through implementation of each method. Used + * for filling out Requesters with some methods omitted. + */ +const defaultRequester = { + start: (metadata, listener, next) => { + next(metadata, listener); + }, + sendMessage: (message, next) => { + next(message); + }, + halfClose: next => { + next(); + }, + cancel: next => { + next(); + }, +}; +class InterceptingCall { + constructor(nextCall, requester) { + var _a, _b, _c, _d; + this.nextCall = nextCall; + /** + * Indicates that metadata has been passed to the requester's start + * method but it has not been passed to the corresponding next callback + */ + this.processingMetadata = false; + /** + * Message context for a pending message that is waiting for + */ + this.pendingMessageContext = null; + /** + * Indicates that a message has been passed to the requester's sendMessage + * method but it has not been passed to the corresponding next callback + */ + this.processingMessage = false; + /** + * Indicates that a status was received but could not be propagated because + * a message was still being processed. + */ + this.pendingHalfClose = false; + if (requester) { + this.requester = { + start: (_a = requester.start) !== null && _a !== void 0 ? _a : defaultRequester.start, + sendMessage: (_b = requester.sendMessage) !== null && _b !== void 0 ? _b : defaultRequester.sendMessage, + halfClose: (_c = requester.halfClose) !== null && _c !== void 0 ? _c : defaultRequester.halfClose, + cancel: (_d = requester.cancel) !== null && _d !== void 0 ? _d : defaultRequester.cancel, + }; + } + else { + this.requester = defaultRequester; + } + } + cancelWithStatus(status, details) { + this.requester.cancel(() => { + this.nextCall.cancelWithStatus(status, details); + }); + } + getPeer() { + return this.nextCall.getPeer(); + } + processPendingMessage() { + if (this.pendingMessageContext) { + this.nextCall.sendMessageWithContext(this.pendingMessageContext, this.pendingMessage); + this.pendingMessageContext = null; + this.pendingMessage = null; + } + } + processPendingHalfClose() { + if (this.pendingHalfClose) { + this.nextCall.halfClose(); + } + } + start(metadata, interceptingListener) { + var _a, _b, _c, _d, _e, _f; + const fullInterceptingListener = { + onReceiveMetadata: (_b = (_a = interceptingListener === null || interceptingListener === void 0 ? void 0 : interceptingListener.onReceiveMetadata) === null || _a === void 0 ? void 0 : _a.bind(interceptingListener)) !== null && _b !== void 0 ? _b : (metadata => { }), + onReceiveMessage: (_d = (_c = interceptingListener === null || interceptingListener === void 0 ? void 0 : interceptingListener.onReceiveMessage) === null || _c === void 0 ? void 0 : _c.bind(interceptingListener)) !== null && _d !== void 0 ? _d : (message => { }), + onReceiveStatus: (_f = (_e = interceptingListener === null || interceptingListener === void 0 ? void 0 : interceptingListener.onReceiveStatus) === null || _e === void 0 ? void 0 : _e.bind(interceptingListener)) !== null && _f !== void 0 ? _f : (status => { }), + }; + this.processingMetadata = true; + this.requester.start(metadata, fullInterceptingListener, (md, listener) => { + var _a, _b, _c; + this.processingMetadata = false; + let finalInterceptingListener; + if ((0, call_interface_1.isInterceptingListener)(listener)) { + finalInterceptingListener = listener; + } + else { + const fullListener = { + onReceiveMetadata: (_a = listener.onReceiveMetadata) !== null && _a !== void 0 ? _a : defaultListener.onReceiveMetadata, + onReceiveMessage: (_b = listener.onReceiveMessage) !== null && _b !== void 0 ? _b : defaultListener.onReceiveMessage, + onReceiveStatus: (_c = listener.onReceiveStatus) !== null && _c !== void 0 ? _c : defaultListener.onReceiveStatus, + }; + finalInterceptingListener = new call_interface_1.InterceptingListenerImpl(fullListener, fullInterceptingListener); + } + this.nextCall.start(md, finalInterceptingListener); + this.processPendingMessage(); + this.processPendingHalfClose(); + }); + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any + sendMessageWithContext(context, message) { + this.processingMessage = true; + this.requester.sendMessage(message, finalMessage => { + this.processingMessage = false; + if (this.processingMetadata) { + this.pendingMessageContext = context; + this.pendingMessage = message; + } + else { + this.nextCall.sendMessageWithContext(context, finalMessage); + this.processPendingHalfClose(); + } + }); + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any + sendMessage(message) { + this.sendMessageWithContext({}, message); + } + startRead() { + this.nextCall.startRead(); + } + halfClose() { + this.requester.halfClose(() => { + if (this.processingMetadata || this.processingMessage) { + this.pendingHalfClose = true; + } + else { + this.nextCall.halfClose(); + } + }); + } + getAuthContext() { + return this.nextCall.getAuthContext(); + } +} +exports.InterceptingCall = InterceptingCall; +function getCall(channel, path, options) { + var _a, _b; + const deadline = (_a = options.deadline) !== null && _a !== void 0 ? _a : Infinity; + const host = options.host; + const parent = (_b = options.parent) !== null && _b !== void 0 ? _b : null; + const propagateFlags = options.propagate_flags; + const credentials = options.credentials; + const call = channel.createCall(path, deadline, host, parent, propagateFlags); + if (credentials) { + call.setCredentials(credentials); + } + return call; +} +/** + * InterceptingCall implementation that directly owns the underlying Call + * object and handles serialization and deseraizliation. + */ +class BaseInterceptingCall { + constructor(call, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + methodDefinition) { + this.call = call; + this.methodDefinition = methodDefinition; + } + cancelWithStatus(status, details) { + this.call.cancelWithStatus(status, details); + } + getPeer() { + return this.call.getPeer(); + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any + sendMessageWithContext(context, message) { + let serialized; + try { + serialized = this.methodDefinition.requestSerialize(message); + } + catch (e) { + this.call.cancelWithStatus(constants_1.Status.INTERNAL, `Request message serialization failure: ${(0, error_1.getErrorMessage)(e)}`); + return; + } + this.call.sendMessageWithContext(context, serialized); + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any + sendMessage(message) { + this.sendMessageWithContext({}, message); + } + start(metadata, interceptingListener) { + let readError = null; + this.call.start(metadata, { + onReceiveMetadata: metadata => { + var _a; + (_a = interceptingListener === null || interceptingListener === void 0 ? void 0 : interceptingListener.onReceiveMetadata) === null || _a === void 0 ? void 0 : _a.call(interceptingListener, metadata); + }, + onReceiveMessage: message => { + var _a; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + let deserialized; + try { + deserialized = this.methodDefinition.responseDeserialize(message); + } + catch (e) { + readError = { + code: constants_1.Status.INTERNAL, + details: `Response message parsing error: ${(0, error_1.getErrorMessage)(e)}`, + metadata: new metadata_1.Metadata(), + }; + this.call.cancelWithStatus(readError.code, readError.details); + return; + } + (_a = interceptingListener === null || interceptingListener === void 0 ? void 0 : interceptingListener.onReceiveMessage) === null || _a === void 0 ? void 0 : _a.call(interceptingListener, deserialized); + }, + onReceiveStatus: status => { + var _a, _b; + if (readError) { + (_a = interceptingListener === null || interceptingListener === void 0 ? void 0 : interceptingListener.onReceiveStatus) === null || _a === void 0 ? void 0 : _a.call(interceptingListener, readError); + } + else { + (_b = interceptingListener === null || interceptingListener === void 0 ? void 0 : interceptingListener.onReceiveStatus) === null || _b === void 0 ? void 0 : _b.call(interceptingListener, status); + } + }, + }); + } + startRead() { + this.call.startRead(); + } + halfClose() { + this.call.halfClose(); + } + getAuthContext() { + return this.call.getAuthContext(); + } +} +/** + * BaseInterceptingCall with special-cased behavior for methods with unary + * responses. + */ +class BaseUnaryInterceptingCall extends BaseInterceptingCall { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + constructor(call, methodDefinition) { + super(call, methodDefinition); + } + start(metadata, listener) { + var _a, _b; + let receivedMessage = false; + const wrapperListener = { + onReceiveMetadata: (_b = (_a = listener === null || listener === void 0 ? void 0 : listener.onReceiveMetadata) === null || _a === void 0 ? void 0 : _a.bind(listener)) !== null && _b !== void 0 ? _b : (metadata => { }), + // eslint-disable-next-line @typescript-eslint/no-explicit-any + onReceiveMessage: (message) => { + var _a; + receivedMessage = true; + (_a = listener === null || listener === void 0 ? void 0 : listener.onReceiveMessage) === null || _a === void 0 ? void 0 : _a.call(listener, message); + }, + onReceiveStatus: (status) => { + var _a, _b; + if (!receivedMessage) { + (_a = listener === null || listener === void 0 ? void 0 : listener.onReceiveMessage) === null || _a === void 0 ? void 0 : _a.call(listener, null); + } + (_b = listener === null || listener === void 0 ? void 0 : listener.onReceiveStatus) === null || _b === void 0 ? void 0 : _b.call(listener, status); + }, + }; + super.start(metadata, wrapperListener); + this.call.startRead(); + } +} +/** + * BaseInterceptingCall with special-cased behavior for methods with streaming + * responses. + */ +class BaseStreamingInterceptingCall extends BaseInterceptingCall { +} +function getBottomInterceptingCall(channel, options, +// eslint-disable-next-line @typescript-eslint/no-explicit-any +methodDefinition) { + const call = getCall(channel, methodDefinition.path, options); + if (methodDefinition.responseStream) { + return new BaseStreamingInterceptingCall(call, methodDefinition); + } + else { + return new BaseUnaryInterceptingCall(call, methodDefinition); + } +} +function getInterceptingCall(interceptorArgs, +// eslint-disable-next-line @typescript-eslint/no-explicit-any +methodDefinition, options, channel) { + if (interceptorArgs.clientInterceptors.length > 0 && + interceptorArgs.clientInterceptorProviders.length > 0) { + throw new InterceptorConfigurationError('Both interceptors and interceptor_providers were passed as options ' + + 'to the client constructor. Only one of these is allowed.'); + } + if (interceptorArgs.callInterceptors.length > 0 && + interceptorArgs.callInterceptorProviders.length > 0) { + throw new InterceptorConfigurationError('Both interceptors and interceptor_providers were passed as call ' + + 'options. Only one of these is allowed.'); + } + let interceptors = []; + // Interceptors passed to the call override interceptors passed to the client constructor + if (interceptorArgs.callInterceptors.length > 0 || + interceptorArgs.callInterceptorProviders.length > 0) { + interceptors = [] + .concat(interceptorArgs.callInterceptors, interceptorArgs.callInterceptorProviders.map(provider => provider(methodDefinition))) + .filter(interceptor => interceptor); + // Filter out falsy values when providers return nothing + } + else { + interceptors = [] + .concat(interceptorArgs.clientInterceptors, interceptorArgs.clientInterceptorProviders.map(provider => provider(methodDefinition))) + .filter(interceptor => interceptor); + // Filter out falsy values when providers return nothing + } + const interceptorOptions = Object.assign({}, options, { + method_definition: methodDefinition, + }); + /* For each interceptor in the list, the nextCall function passed to it is + * based on the next interceptor in the list, using a nextCall function + * constructed with the following interceptor in the list, and so on. The + * initialValue, which is effectively at the end of the list, is a nextCall + * function that invokes getBottomInterceptingCall, the result of which + * handles (de)serialization and also gets the underlying call from the + * channel. */ + const getCall = interceptors.reduceRight((nextCall, nextInterceptor) => { + return currentOptions => nextInterceptor(currentOptions, nextCall); + }, (finalOptions) => getBottomInterceptingCall(channel, finalOptions, methodDefinition)); + return getCall(interceptorOptions); +} +//# sourceMappingURL=client-interceptors.js.map + +/***/ }), + +/***/ 54210: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Client = void 0; +const call_1 = __nccwpck_require__(91161); +const channel_1 = __nccwpck_require__(86918); +const connectivity_state_1 = __nccwpck_require__(60778); +const constants_1 = __nccwpck_require__(68288); +const metadata_1 = __nccwpck_require__(36100); +const client_interceptors_1 = __nccwpck_require__(82451); +const CHANNEL_SYMBOL = Symbol(); +const INTERCEPTOR_SYMBOL = Symbol(); +const INTERCEPTOR_PROVIDER_SYMBOL = Symbol(); +const CALL_INVOCATION_TRANSFORMER_SYMBOL = Symbol(); +function isFunction(arg) { + return typeof arg === 'function'; +} +function getErrorStackString(error) { + var _a; + return ((_a = error.stack) === null || _a === void 0 ? void 0 : _a.split('\n').slice(1).join('\n')) || 'no stack trace available'; +} +/** + * A generic gRPC client. Primarily useful as a base class for all generated + * clients. + */ +class Client { + constructor(address, credentials, options = {}) { + var _a, _b; + options = Object.assign({}, options); + this[INTERCEPTOR_SYMBOL] = (_a = options.interceptors) !== null && _a !== void 0 ? _a : []; + delete options.interceptors; + this[INTERCEPTOR_PROVIDER_SYMBOL] = (_b = options.interceptor_providers) !== null && _b !== void 0 ? _b : []; + delete options.interceptor_providers; + if (this[INTERCEPTOR_SYMBOL].length > 0 && + this[INTERCEPTOR_PROVIDER_SYMBOL].length > 0) { + throw new Error('Both interceptors and interceptor_providers were passed as options ' + + 'to the client constructor. Only one of these is allowed.'); + } + this[CALL_INVOCATION_TRANSFORMER_SYMBOL] = + options.callInvocationTransformer; + delete options.callInvocationTransformer; + if (options.channelOverride) { + this[CHANNEL_SYMBOL] = options.channelOverride; + } + else if (options.channelFactoryOverride) { + const channelFactoryOverride = options.channelFactoryOverride; + delete options.channelFactoryOverride; + this[CHANNEL_SYMBOL] = channelFactoryOverride(address, credentials, options); + } + else { + this[CHANNEL_SYMBOL] = new channel_1.ChannelImplementation(address, credentials, options); + } + } + close() { + this[CHANNEL_SYMBOL].close(); + } + getChannel() { + return this[CHANNEL_SYMBOL]; + } + waitForReady(deadline, callback) { + const checkState = (err) => { + if (err) { + callback(new Error('Failed to connect before the deadline')); + return; + } + let newState; + try { + newState = this[CHANNEL_SYMBOL].getConnectivityState(true); + } + catch (e) { + callback(new Error('The channel has been closed')); + return; + } + if (newState === connectivity_state_1.ConnectivityState.READY) { + callback(); + } + else { + try { + this[CHANNEL_SYMBOL].watchConnectivityState(newState, deadline, checkState); + } + catch (e) { + callback(new Error('The channel has been closed')); + } + } + }; + setImmediate(checkState); + } + checkOptionalUnaryResponseArguments(arg1, arg2, arg3) { + if (isFunction(arg1)) { + return { metadata: new metadata_1.Metadata(), options: {}, callback: arg1 }; + } + else if (isFunction(arg2)) { + if (arg1 instanceof metadata_1.Metadata) { + return { metadata: arg1, options: {}, callback: arg2 }; + } + else { + return { metadata: new metadata_1.Metadata(), options: arg1, callback: arg2 }; + } + } + else { + if (!(arg1 instanceof metadata_1.Metadata && + arg2 instanceof Object && + isFunction(arg3))) { + throw new Error('Incorrect arguments passed'); + } + return { metadata: arg1, options: arg2, callback: arg3 }; + } + } + makeUnaryRequest(method, serialize, deserialize, argument, metadata, options, callback) { + var _a, _b; + const checkedArguments = this.checkOptionalUnaryResponseArguments(metadata, options, callback); + const methodDefinition = { + path: method, + requestStream: false, + responseStream: false, + requestSerialize: serialize, + responseDeserialize: deserialize, + }; + let callProperties = { + argument: argument, + metadata: checkedArguments.metadata, + call: new call_1.ClientUnaryCallImpl(), + channel: this[CHANNEL_SYMBOL], + methodDefinition: methodDefinition, + callOptions: checkedArguments.options, + callback: checkedArguments.callback, + }; + if (this[CALL_INVOCATION_TRANSFORMER_SYMBOL]) { + callProperties = this[CALL_INVOCATION_TRANSFORMER_SYMBOL](callProperties); + } + const emitter = callProperties.call; + const interceptorArgs = { + clientInterceptors: this[INTERCEPTOR_SYMBOL], + clientInterceptorProviders: this[INTERCEPTOR_PROVIDER_SYMBOL], + callInterceptors: (_a = callProperties.callOptions.interceptors) !== null && _a !== void 0 ? _a : [], + callInterceptorProviders: (_b = callProperties.callOptions.interceptor_providers) !== null && _b !== void 0 ? _b : [], + }; + const call = (0, client_interceptors_1.getInterceptingCall)(interceptorArgs, callProperties.methodDefinition, callProperties.callOptions, callProperties.channel); + /* This needs to happen before the emitter is used. Unfortunately we can't + * enforce this with the type system. We need to construct this emitter + * before calling the CallInvocationTransformer, and we need to create the + * call after that. */ + emitter.call = call; + let responseMessage = null; + let receivedStatus = false; + let callerStackError = new Error(); + call.start(callProperties.metadata, { + onReceiveMetadata: metadata => { + emitter.emit('metadata', metadata); + }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + onReceiveMessage(message) { + if (responseMessage !== null) { + call.cancelWithStatus(constants_1.Status.UNIMPLEMENTED, 'Too many responses received'); + } + responseMessage = message; + }, + onReceiveStatus(status) { + if (receivedStatus) { + return; + } + receivedStatus = true; + if (status.code === constants_1.Status.OK) { + if (responseMessage === null) { + const callerStack = getErrorStackString(callerStackError); + callProperties.callback((0, call_1.callErrorFromStatus)({ + code: constants_1.Status.UNIMPLEMENTED, + details: 'No message received', + metadata: status.metadata, + }, callerStack)); + } + else { + callProperties.callback(null, responseMessage); + } + } + else { + const callerStack = getErrorStackString(callerStackError); + callProperties.callback((0, call_1.callErrorFromStatus)(status, callerStack)); + } + /* Avoid retaining the callerStackError object in the call context of + * the status event handler. */ + callerStackError = null; + emitter.emit('status', status); + }, + }); + call.sendMessage(argument); + call.halfClose(); + return emitter; + } + makeClientStreamRequest(method, serialize, deserialize, metadata, options, callback) { + var _a, _b; + const checkedArguments = this.checkOptionalUnaryResponseArguments(metadata, options, callback); + const methodDefinition = { + path: method, + requestStream: true, + responseStream: false, + requestSerialize: serialize, + responseDeserialize: deserialize, + }; + let callProperties = { + metadata: checkedArguments.metadata, + call: new call_1.ClientWritableStreamImpl(serialize), + channel: this[CHANNEL_SYMBOL], + methodDefinition: methodDefinition, + callOptions: checkedArguments.options, + callback: checkedArguments.callback, + }; + if (this[CALL_INVOCATION_TRANSFORMER_SYMBOL]) { + callProperties = this[CALL_INVOCATION_TRANSFORMER_SYMBOL](callProperties); + } + const emitter = callProperties.call; + const interceptorArgs = { + clientInterceptors: this[INTERCEPTOR_SYMBOL], + clientInterceptorProviders: this[INTERCEPTOR_PROVIDER_SYMBOL], + callInterceptors: (_a = callProperties.callOptions.interceptors) !== null && _a !== void 0 ? _a : [], + callInterceptorProviders: (_b = callProperties.callOptions.interceptor_providers) !== null && _b !== void 0 ? _b : [], + }; + const call = (0, client_interceptors_1.getInterceptingCall)(interceptorArgs, callProperties.methodDefinition, callProperties.callOptions, callProperties.channel); + /* This needs to happen before the emitter is used. Unfortunately we can't + * enforce this with the type system. We need to construct this emitter + * before calling the CallInvocationTransformer, and we need to create the + * call after that. */ + emitter.call = call; + let responseMessage = null; + let receivedStatus = false; + let callerStackError = new Error(); + call.start(callProperties.metadata, { + onReceiveMetadata: metadata => { + emitter.emit('metadata', metadata); + }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + onReceiveMessage(message) { + if (responseMessage !== null) { + call.cancelWithStatus(constants_1.Status.UNIMPLEMENTED, 'Too many responses received'); + } + responseMessage = message; + call.startRead(); + }, + onReceiveStatus(status) { + if (receivedStatus) { + return; + } + receivedStatus = true; + if (status.code === constants_1.Status.OK) { + if (responseMessage === null) { + const callerStack = getErrorStackString(callerStackError); + callProperties.callback((0, call_1.callErrorFromStatus)({ + code: constants_1.Status.UNIMPLEMENTED, + details: 'No message received', + metadata: status.metadata, + }, callerStack)); + } + else { + callProperties.callback(null, responseMessage); + } + } + else { + const callerStack = getErrorStackString(callerStackError); + callProperties.callback((0, call_1.callErrorFromStatus)(status, callerStack)); + } + /* Avoid retaining the callerStackError object in the call context of + * the status event handler. */ + callerStackError = null; + emitter.emit('status', status); + }, + }); + return emitter; + } + checkMetadataAndOptions(arg1, arg2) { + let metadata; + let options; + if (arg1 instanceof metadata_1.Metadata) { + metadata = arg1; + if (arg2) { + options = arg2; + } + else { + options = {}; + } + } + else { + if (arg1) { + options = arg1; + } + else { + options = {}; + } + metadata = new metadata_1.Metadata(); + } + return { metadata, options }; + } + makeServerStreamRequest(method, serialize, deserialize, argument, metadata, options) { + var _a, _b; + const checkedArguments = this.checkMetadataAndOptions(metadata, options); + const methodDefinition = { + path: method, + requestStream: false, + responseStream: true, + requestSerialize: serialize, + responseDeserialize: deserialize, + }; + let callProperties = { + argument: argument, + metadata: checkedArguments.metadata, + call: new call_1.ClientReadableStreamImpl(deserialize), + channel: this[CHANNEL_SYMBOL], + methodDefinition: methodDefinition, + callOptions: checkedArguments.options, + }; + if (this[CALL_INVOCATION_TRANSFORMER_SYMBOL]) { + callProperties = this[CALL_INVOCATION_TRANSFORMER_SYMBOL](callProperties); + } + const stream = callProperties.call; + const interceptorArgs = { + clientInterceptors: this[INTERCEPTOR_SYMBOL], + clientInterceptorProviders: this[INTERCEPTOR_PROVIDER_SYMBOL], + callInterceptors: (_a = callProperties.callOptions.interceptors) !== null && _a !== void 0 ? _a : [], + callInterceptorProviders: (_b = callProperties.callOptions.interceptor_providers) !== null && _b !== void 0 ? _b : [], + }; + const call = (0, client_interceptors_1.getInterceptingCall)(interceptorArgs, callProperties.methodDefinition, callProperties.callOptions, callProperties.channel); + /* This needs to happen before the emitter is used. Unfortunately we can't + * enforce this with the type system. We need to construct this emitter + * before calling the CallInvocationTransformer, and we need to create the + * call after that. */ + stream.call = call; + let receivedStatus = false; + let callerStackError = new Error(); + call.start(callProperties.metadata, { + onReceiveMetadata(metadata) { + stream.emit('metadata', metadata); + }, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + onReceiveMessage(message) { + stream.push(message); + }, + onReceiveStatus(status) { + if (receivedStatus) { + return; + } + receivedStatus = true; + stream.push(null); + if (status.code !== constants_1.Status.OK) { + const callerStack = getErrorStackString(callerStackError); + stream.emit('error', (0, call_1.callErrorFromStatus)(status, callerStack)); + } + /* Avoid retaining the callerStackError object in the call context of + * the status event handler. */ + callerStackError = null; + stream.emit('status', status); + }, + }); + call.sendMessage(argument); + call.halfClose(); + return stream; + } + makeBidiStreamRequest(method, serialize, deserialize, metadata, options) { + var _a, _b; + const checkedArguments = this.checkMetadataAndOptions(metadata, options); + const methodDefinition = { + path: method, + requestStream: true, + responseStream: true, + requestSerialize: serialize, + responseDeserialize: deserialize, + }; + let callProperties = { + metadata: checkedArguments.metadata, + call: new call_1.ClientDuplexStreamImpl(serialize, deserialize), + channel: this[CHANNEL_SYMBOL], + methodDefinition: methodDefinition, + callOptions: checkedArguments.options, + }; + if (this[CALL_INVOCATION_TRANSFORMER_SYMBOL]) { + callProperties = this[CALL_INVOCATION_TRANSFORMER_SYMBOL](callProperties); + } + const stream = callProperties.call; + const interceptorArgs = { + clientInterceptors: this[INTERCEPTOR_SYMBOL], + clientInterceptorProviders: this[INTERCEPTOR_PROVIDER_SYMBOL], + callInterceptors: (_a = callProperties.callOptions.interceptors) !== null && _a !== void 0 ? _a : [], + callInterceptorProviders: (_b = callProperties.callOptions.interceptor_providers) !== null && _b !== void 0 ? _b : [], + }; + const call = (0, client_interceptors_1.getInterceptingCall)(interceptorArgs, callProperties.methodDefinition, callProperties.callOptions, callProperties.channel); + /* This needs to happen before the emitter is used. Unfortunately we can't + * enforce this with the type system. We need to construct this emitter + * before calling the CallInvocationTransformer, and we need to create the + * call after that. */ + stream.call = call; + let receivedStatus = false; + let callerStackError = new Error(); + call.start(callProperties.metadata, { + onReceiveMetadata(metadata) { + stream.emit('metadata', metadata); + }, + onReceiveMessage(message) { + stream.push(message); + }, + onReceiveStatus(status) { + if (receivedStatus) { + return; + } + receivedStatus = true; + stream.push(null); + if (status.code !== constants_1.Status.OK) { + const callerStack = getErrorStackString(callerStackError); + stream.emit('error', (0, call_1.callErrorFromStatus)(status, callerStack)); + } + /* Avoid retaining the callerStackError object in the call context of + * the status event handler. */ + callerStackError = null; + stream.emit('status', status); + }, + }); + return stream; + } +} +exports.Client = Client; +//# sourceMappingURL=client.js.map + +/***/ }), + +/***/ 24130: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright 2021 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.CompressionAlgorithms = void 0; +var CompressionAlgorithms; +(function (CompressionAlgorithms) { + CompressionAlgorithms[CompressionAlgorithms["identity"] = 0] = "identity"; + CompressionAlgorithms[CompressionAlgorithms["deflate"] = 1] = "deflate"; + CompressionAlgorithms[CompressionAlgorithms["gzip"] = 2] = "gzip"; +})(CompressionAlgorithms || (exports.CompressionAlgorithms = CompressionAlgorithms = {})); +//# sourceMappingURL=compression-algorithms.js.map + +/***/ }), + +/***/ 43430: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.CompressionFilterFactory = exports.CompressionFilter = void 0; +const zlib = __nccwpck_require__(43106); +const compression_algorithms_1 = __nccwpck_require__(24130); +const constants_1 = __nccwpck_require__(68288); +const filter_1 = __nccwpck_require__(81467); +const logging = __nccwpck_require__(8536); +const isCompressionAlgorithmKey = (key) => { + return (typeof key === 'number' && typeof compression_algorithms_1.CompressionAlgorithms[key] === 'string'); +}; +class CompressionHandler { + /** + * @param message Raw uncompressed message bytes + * @param compress Indicates whether the message should be compressed + * @return Framed message, compressed if applicable + */ + async writeMessage(message, compress) { + let messageBuffer = message; + if (compress) { + messageBuffer = await this.compressMessage(messageBuffer); + } + const output = Buffer.allocUnsafe(messageBuffer.length + 5); + output.writeUInt8(compress ? 1 : 0, 0); + output.writeUInt32BE(messageBuffer.length, 1); + messageBuffer.copy(output, 5); + return output; + } + /** + * @param data Framed message, possibly compressed + * @return Uncompressed message + */ + async readMessage(data) { + const compressed = data.readUInt8(0) === 1; + let messageBuffer = data.slice(5); + if (compressed) { + messageBuffer = await this.decompressMessage(messageBuffer); + } + return messageBuffer; + } +} +class IdentityHandler extends CompressionHandler { + async compressMessage(message) { + return message; + } + async writeMessage(message, compress) { + const output = Buffer.allocUnsafe(message.length + 5); + /* With "identity" compression, messages should always be marked as + * uncompressed */ + output.writeUInt8(0, 0); + output.writeUInt32BE(message.length, 1); + message.copy(output, 5); + return output; + } + decompressMessage(message) { + return Promise.reject(new Error('Received compressed message but "grpc-encoding" header was identity')); + } +} +class DeflateHandler extends CompressionHandler { + constructor(maxRecvMessageLength) { + super(); + this.maxRecvMessageLength = maxRecvMessageLength; + } + compressMessage(message) { + return new Promise((resolve, reject) => { + zlib.deflate(message, (err, output) => { + if (err) { + reject(err); + } + else { + resolve(output); + } + }); + }); + } + decompressMessage(message) { + return new Promise((resolve, reject) => { + let totalLength = 0; + const messageParts = []; + const decompresser = zlib.createInflate(); + decompresser.on('data', (chunk) => { + messageParts.push(chunk); + totalLength += chunk.byteLength; + if (this.maxRecvMessageLength !== -1 && totalLength > this.maxRecvMessageLength) { + decompresser.destroy(); + reject({ + code: constants_1.Status.RESOURCE_EXHAUSTED, + details: `Received message that decompresses to a size larger than ${this.maxRecvMessageLength}` + }); + } + }); + decompresser.on('end', () => { + resolve(Buffer.concat(messageParts)); + }); + decompresser.write(message); + decompresser.end(); + }); + } +} +class GzipHandler extends CompressionHandler { + constructor(maxRecvMessageLength) { + super(); + this.maxRecvMessageLength = maxRecvMessageLength; + } + compressMessage(message) { + return new Promise((resolve, reject) => { + zlib.gzip(message, (err, output) => { + if (err) { + reject(err); + } + else { + resolve(output); + } + }); + }); + } + decompressMessage(message) { + return new Promise((resolve, reject) => { + let totalLength = 0; + const messageParts = []; + const decompresser = zlib.createGunzip(); + decompresser.on('data', (chunk) => { + messageParts.push(chunk); + totalLength += chunk.byteLength; + if (this.maxRecvMessageLength !== -1 && totalLength > this.maxRecvMessageLength) { + decompresser.destroy(); + reject({ + code: constants_1.Status.RESOURCE_EXHAUSTED, + details: `Received message that decompresses to a size larger than ${this.maxRecvMessageLength}` + }); + } + }); + decompresser.on('end', () => { + resolve(Buffer.concat(messageParts)); + }); + decompresser.write(message); + decompresser.end(); + }); + } +} +class UnknownHandler extends CompressionHandler { + constructor(compressionName) { + super(); + this.compressionName = compressionName; + } + compressMessage(message) { + return Promise.reject(new Error(`Received message compressed with unsupported compression method ${this.compressionName}`)); + } + decompressMessage(message) { + // This should be unreachable + return Promise.reject(new Error(`Compression method not supported: ${this.compressionName}`)); + } +} +function getCompressionHandler(compressionName, maxReceiveMessageSize) { + switch (compressionName) { + case 'identity': + return new IdentityHandler(); + case 'deflate': + return new DeflateHandler(maxReceiveMessageSize); + case 'gzip': + return new GzipHandler(maxReceiveMessageSize); + default: + return new UnknownHandler(compressionName); + } +} +class CompressionFilter extends filter_1.BaseFilter { + constructor(channelOptions, sharedFilterConfig) { + var _a, _b, _c; + super(); + this.sharedFilterConfig = sharedFilterConfig; + this.sendCompression = new IdentityHandler(); + this.receiveCompression = new IdentityHandler(); + this.currentCompressionAlgorithm = 'identity'; + const compressionAlgorithmKey = channelOptions['grpc.default_compression_algorithm']; + this.maxReceiveMessageLength = (_a = channelOptions['grpc.max_receive_message_length']) !== null && _a !== void 0 ? _a : constants_1.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH; + this.maxSendMessageLength = (_b = channelOptions['grpc.max_send_message_length']) !== null && _b !== void 0 ? _b : constants_1.DEFAULT_MAX_SEND_MESSAGE_LENGTH; + if (compressionAlgorithmKey !== undefined) { + if (isCompressionAlgorithmKey(compressionAlgorithmKey)) { + const clientSelectedEncoding = compression_algorithms_1.CompressionAlgorithms[compressionAlgorithmKey]; + const serverSupportedEncodings = (_c = sharedFilterConfig.serverSupportedEncodingHeader) === null || _c === void 0 ? void 0 : _c.split(','); + /** + * There are two possible situations here: + * 1) We don't have any info yet from the server about what compression it supports + * In that case we should just use what the client tells us to use + * 2) We've previously received a response from the server including a grpc-accept-encoding header + * In that case we only want to use the encoding chosen by the client if the server supports it + */ + if (!serverSupportedEncodings || + serverSupportedEncodings.includes(clientSelectedEncoding)) { + this.currentCompressionAlgorithm = clientSelectedEncoding; + this.sendCompression = getCompressionHandler(this.currentCompressionAlgorithm, -1); + } + } + else { + logging.log(constants_1.LogVerbosity.ERROR, `Invalid value provided for grpc.default_compression_algorithm option: ${compressionAlgorithmKey}`); + } + } + } + async sendMetadata(metadata) { + const headers = await metadata; + headers.set('grpc-accept-encoding', 'identity,deflate,gzip'); + headers.set('accept-encoding', 'identity'); + // No need to send the header if it's "identity" - behavior is identical; save the bandwidth + if (this.currentCompressionAlgorithm === 'identity') { + headers.remove('grpc-encoding'); + } + else { + headers.set('grpc-encoding', this.currentCompressionAlgorithm); + } + return headers; + } + receiveMetadata(metadata) { + const receiveEncoding = metadata.get('grpc-encoding'); + if (receiveEncoding.length > 0) { + const encoding = receiveEncoding[0]; + if (typeof encoding === 'string') { + this.receiveCompression = getCompressionHandler(encoding, this.maxReceiveMessageLength); + } + } + metadata.remove('grpc-encoding'); + /* Check to see if the compression we're using to send messages is supported by the server + * If not, reset the sendCompression filter and have it use the default IdentityHandler */ + const serverSupportedEncodingsHeader = metadata.get('grpc-accept-encoding')[0]; + if (serverSupportedEncodingsHeader) { + this.sharedFilterConfig.serverSupportedEncodingHeader = + serverSupportedEncodingsHeader; + const serverSupportedEncodings = serverSupportedEncodingsHeader.split(','); + if (!serverSupportedEncodings.includes(this.currentCompressionAlgorithm)) { + this.sendCompression = new IdentityHandler(); + this.currentCompressionAlgorithm = 'identity'; + } + } + metadata.remove('grpc-accept-encoding'); + return metadata; + } + async sendMessage(message) { + var _a; + /* This filter is special. The input message is the bare message bytes, + * and the output is a framed and possibly compressed message. For this + * reason, this filter should be at the bottom of the filter stack */ + const resolvedMessage = await message; + if (this.maxSendMessageLength !== -1 && resolvedMessage.message.length > this.maxSendMessageLength) { + throw { + code: constants_1.Status.RESOURCE_EXHAUSTED, + details: `Attempted to send message with a size larger than ${this.maxSendMessageLength}` + }; + } + let compress; + if (this.sendCompression instanceof IdentityHandler) { + compress = false; + } + else { + compress = (((_a = resolvedMessage.flags) !== null && _a !== void 0 ? _a : 0) & 2 /* WriteFlags.NoCompress */) === 0; + } + return { + message: await this.sendCompression.writeMessage(resolvedMessage.message, compress), + flags: resolvedMessage.flags, + }; + } + async receiveMessage(message) { + /* This filter is also special. The input message is framed and possibly + * compressed, and the output message is deframed and uncompressed. So + * this is another reason that this filter should be at the bottom of the + * filter stack. */ + return this.receiveCompression.readMessage(await message); + } +} +exports.CompressionFilter = CompressionFilter; +class CompressionFilterFactory { + constructor(channel, options) { + this.options = options; + this.sharedFilterConfig = {}; + } + createFilter() { + return new CompressionFilter(this.options, this.sharedFilterConfig); + } +} +exports.CompressionFilterFactory = CompressionFilterFactory; +//# sourceMappingURL=compression-filter.js.map + +/***/ }), + +/***/ 60778: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright 2021 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ConnectivityState = void 0; +var ConnectivityState; +(function (ConnectivityState) { + ConnectivityState[ConnectivityState["IDLE"] = 0] = "IDLE"; + ConnectivityState[ConnectivityState["CONNECTING"] = 1] = "CONNECTING"; + ConnectivityState[ConnectivityState["READY"] = 2] = "READY"; + ConnectivityState[ConnectivityState["TRANSIENT_FAILURE"] = 3] = "TRANSIENT_FAILURE"; + ConnectivityState[ConnectivityState["SHUTDOWN"] = 4] = "SHUTDOWN"; +})(ConnectivityState || (exports.ConnectivityState = ConnectivityState = {})); +//# sourceMappingURL=connectivity-state.js.map + +/***/ }), + +/***/ 68288: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH = exports.DEFAULT_MAX_SEND_MESSAGE_LENGTH = exports.Propagate = exports.LogVerbosity = exports.Status = void 0; +var Status; +(function (Status) { + Status[Status["OK"] = 0] = "OK"; + Status[Status["CANCELLED"] = 1] = "CANCELLED"; + Status[Status["UNKNOWN"] = 2] = "UNKNOWN"; + Status[Status["INVALID_ARGUMENT"] = 3] = "INVALID_ARGUMENT"; + Status[Status["DEADLINE_EXCEEDED"] = 4] = "DEADLINE_EXCEEDED"; + Status[Status["NOT_FOUND"] = 5] = "NOT_FOUND"; + Status[Status["ALREADY_EXISTS"] = 6] = "ALREADY_EXISTS"; + Status[Status["PERMISSION_DENIED"] = 7] = "PERMISSION_DENIED"; + Status[Status["RESOURCE_EXHAUSTED"] = 8] = "RESOURCE_EXHAUSTED"; + Status[Status["FAILED_PRECONDITION"] = 9] = "FAILED_PRECONDITION"; + Status[Status["ABORTED"] = 10] = "ABORTED"; + Status[Status["OUT_OF_RANGE"] = 11] = "OUT_OF_RANGE"; + Status[Status["UNIMPLEMENTED"] = 12] = "UNIMPLEMENTED"; + Status[Status["INTERNAL"] = 13] = "INTERNAL"; + Status[Status["UNAVAILABLE"] = 14] = "UNAVAILABLE"; + Status[Status["DATA_LOSS"] = 15] = "DATA_LOSS"; + Status[Status["UNAUTHENTICATED"] = 16] = "UNAUTHENTICATED"; +})(Status || (exports.Status = Status = {})); +var LogVerbosity; +(function (LogVerbosity) { + LogVerbosity[LogVerbosity["DEBUG"] = 0] = "DEBUG"; + LogVerbosity[LogVerbosity["INFO"] = 1] = "INFO"; + LogVerbosity[LogVerbosity["ERROR"] = 2] = "ERROR"; + LogVerbosity[LogVerbosity["NONE"] = 3] = "NONE"; +})(LogVerbosity || (exports.LogVerbosity = LogVerbosity = {})); +/** + * NOTE: This enum is not currently used in any implemented API in this + * library. It is included only for type parity with the other implementation. + */ +var Propagate; +(function (Propagate) { + Propagate[Propagate["DEADLINE"] = 1] = "DEADLINE"; + Propagate[Propagate["CENSUS_STATS_CONTEXT"] = 2] = "CENSUS_STATS_CONTEXT"; + Propagate[Propagate["CENSUS_TRACING_CONTEXT"] = 4] = "CENSUS_TRACING_CONTEXT"; + Propagate[Propagate["CANCELLATION"] = 8] = "CANCELLATION"; + // https://github.com/grpc/grpc/blob/master/include/grpc/impl/codegen/propagation_bits.h#L43 + Propagate[Propagate["DEFAULTS"] = 65535] = "DEFAULTS"; +})(Propagate || (exports.Propagate = Propagate = {})); +// -1 means unlimited +exports.DEFAULT_MAX_SEND_MESSAGE_LENGTH = -1; +// 4 MB default +exports.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH = 4 * 1024 * 1024; +//# sourceMappingURL=constants.js.map + +/***/ }), + +/***/ 39962: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2022 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.restrictControlPlaneStatusCode = restrictControlPlaneStatusCode; +const constants_1 = __nccwpck_require__(68288); +const INAPPROPRIATE_CONTROL_PLANE_CODES = [ + constants_1.Status.OK, + constants_1.Status.INVALID_ARGUMENT, + constants_1.Status.NOT_FOUND, + constants_1.Status.ALREADY_EXISTS, + constants_1.Status.FAILED_PRECONDITION, + constants_1.Status.ABORTED, + constants_1.Status.OUT_OF_RANGE, + constants_1.Status.DATA_LOSS, +]; +function restrictControlPlaneStatusCode(code, details) { + if (INAPPROPRIATE_CONTROL_PLANE_CODES.includes(code)) { + return { + code: constants_1.Status.INTERNAL, + details: `Invalid status from control plane: ${code} ${constants_1.Status[code]} ${details}`, + }; + } + else { + return { code, details }; + } +} +//# sourceMappingURL=control-plane-status.js.map + +/***/ }), + +/***/ 52173: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.minDeadline = minDeadline; +exports.getDeadlineTimeoutString = getDeadlineTimeoutString; +exports.getRelativeTimeout = getRelativeTimeout; +exports.deadlineToString = deadlineToString; +exports.formatDateDifference = formatDateDifference; +function minDeadline(...deadlineList) { + let minValue = Infinity; + for (const deadline of deadlineList) { + const deadlineMsecs = deadline instanceof Date ? deadline.getTime() : deadline; + if (deadlineMsecs < minValue) { + minValue = deadlineMsecs; + } + } + return minValue; +} +const units = [ + ['m', 1], + ['S', 1000], + ['M', 60 * 1000], + ['H', 60 * 60 * 1000], +]; +function getDeadlineTimeoutString(deadline) { + const now = new Date().getTime(); + if (deadline instanceof Date) { + deadline = deadline.getTime(); + } + const timeoutMs = Math.max(deadline - now, 0); + for (const [unit, factor] of units) { + const amount = timeoutMs / factor; + if (amount < 1e8) { + return String(Math.ceil(amount)) + unit; + } + } + throw new Error('Deadline is too far in the future'); +} +/** + * See https://nodejs.org/api/timers.html#settimeoutcallback-delay-args + * In particular, "When delay is larger than 2147483647 or less than 1, the + * delay will be set to 1. Non-integer delays are truncated to an integer." + * This number of milliseconds is almost 25 days. + */ +const MAX_TIMEOUT_TIME = 2147483647; +/** + * Get the timeout value that should be passed to setTimeout now for the timer + * to end at the deadline. For any deadline before now, the timer should end + * immediately, represented by a value of 0. For any deadline more than + * MAX_TIMEOUT_TIME milliseconds in the future, a timer cannot be set that will + * end at that time, so it is treated as infinitely far in the future. + * @param deadline + * @returns + */ +function getRelativeTimeout(deadline) { + const deadlineMs = deadline instanceof Date ? deadline.getTime() : deadline; + const now = new Date().getTime(); + const timeout = deadlineMs - now; + if (timeout < 0) { + return 0; + } + else if (timeout > MAX_TIMEOUT_TIME) { + return Infinity; + } + else { + return timeout; + } +} +function deadlineToString(deadline) { + if (deadline instanceof Date) { + return deadline.toISOString(); + } + else { + const dateDeadline = new Date(deadline); + if (Number.isNaN(dateDeadline.getTime())) { + return '' + deadline; + } + else { + return dateDeadline.toISOString(); + } + } +} +/** + * Calculate the difference between two dates as a number of seconds and format + * it as a string. + * @param startDate + * @param endDate + * @returns + */ +function formatDateDifference(startDate, endDate) { + return ((endDate.getTime() - startDate.getTime()) / 1000).toFixed(3) + 's'; +} +//# sourceMappingURL=deadline.js.map + +/***/ }), + +/***/ 63929: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright 2022 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.durationMessageToDuration = durationMessageToDuration; +exports.msToDuration = msToDuration; +exports.durationToMs = durationToMs; +exports.isDuration = isDuration; +exports.isDurationMessage = isDurationMessage; +exports.parseDuration = parseDuration; +exports.durationToString = durationToString; +function durationMessageToDuration(message) { + return { + seconds: Number.parseInt(message.seconds), + nanos: message.nanos + }; +} +function msToDuration(millis) { + return { + seconds: (millis / 1000) | 0, + nanos: ((millis % 1000) * 1000000) | 0, + }; +} +function durationToMs(duration) { + return (duration.seconds * 1000 + duration.nanos / 1000000) | 0; +} +function isDuration(value) { + return typeof value.seconds === 'number' && typeof value.nanos === 'number'; +} +function isDurationMessage(value) { + return typeof value.seconds === 'string' && typeof value.nanos === 'number'; +} +const durationRegex = /^(\d+)(?:\.(\d+))?s$/; +function parseDuration(value) { + const match = value.match(durationRegex); + if (!match) { + return null; + } + return { + seconds: Number.parseInt(match[1], 10), + nanos: match[2] ? Number.parseInt(match[2].padEnd(9, '0'), 10) : 0 + }; +} +function durationToString(duration) { + if (duration.nanos === 0) { + return `${duration.seconds}s`; + } + let scaleFactor; + if (duration.nanos % 1000000 === 0) { + scaleFactor = 1000000; + } + else if (duration.nanos % 1000 === 0) { + scaleFactor = 1000; + } + else { + scaleFactor = 1; + } + return `${duration.seconds}.${duration.nanos / scaleFactor}s`; +} +//# sourceMappingURL=duration.js.map + +/***/ }), + +/***/ 16964: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright 2024 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +var _a; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.GRPC_NODE_USE_ALTERNATIVE_RESOLVER = void 0; +exports.GRPC_NODE_USE_ALTERNATIVE_RESOLVER = ((_a = process.env.GRPC_NODE_USE_ALTERNATIVE_RESOLVER) !== null && _a !== void 0 ? _a : 'false') === 'true'; +//# sourceMappingURL=environment.js.map + +/***/ }), + +/***/ 98219: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright 2022 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getErrorMessage = getErrorMessage; +exports.getErrorCode = getErrorCode; +function getErrorMessage(error) { + if (error instanceof Error) { + return error.message; + } + else { + return String(error); + } +} +function getErrorCode(error) { + if (typeof error === 'object' && + error !== null && + 'code' in error && + typeof error.code === 'number') { + return error.code; + } + else { + return null; + } +} +//# sourceMappingURL=error.js.map + +/***/ }), + +/***/ 20079: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX = exports.createCertificateProviderChannelCredentials = exports.FileWatcherCertificateProvider = exports.createCertificateProviderServerCredentials = exports.createServerCredentialsWithInterceptors = exports.BaseSubchannelWrapper = exports.registerAdminService = exports.FilterStackFactory = exports.BaseFilter = exports.statusOrFromError = exports.statusOrFromValue = exports.PickResultType = exports.QueuePicker = exports.UnavailablePicker = exports.ChildLoadBalancerHandler = exports.EndpointMap = exports.endpointHasAddress = exports.endpointToString = exports.subchannelAddressToString = exports.LeafLoadBalancer = exports.isLoadBalancerNameRegistered = exports.parseLoadBalancingConfig = exports.selectLbConfigFromList = exports.registerLoadBalancerType = exports.createChildChannelControlHelper = exports.BackoffTimeout = exports.parseDuration = exports.durationToMs = exports.splitHostPort = exports.uriToString = exports.CHANNEL_ARGS_CONFIG_SELECTOR_KEY = exports.createResolver = exports.registerResolver = exports.log = exports.trace = void 0; +var logging_1 = __nccwpck_require__(8536); +Object.defineProperty(exports, "trace", ({ enumerable: true, get: function () { return logging_1.trace; } })); +Object.defineProperty(exports, "log", ({ enumerable: true, get: function () { return logging_1.log; } })); +var resolver_1 = __nccwpck_require__(76255); +Object.defineProperty(exports, "registerResolver", ({ enumerable: true, get: function () { return resolver_1.registerResolver; } })); +Object.defineProperty(exports, "createResolver", ({ enumerable: true, get: function () { return resolver_1.createResolver; } })); +Object.defineProperty(exports, "CHANNEL_ARGS_CONFIG_SELECTOR_KEY", ({ enumerable: true, get: function () { return resolver_1.CHANNEL_ARGS_CONFIG_SELECTOR_KEY; } })); +var uri_parser_1 = __nccwpck_require__(56027); +Object.defineProperty(exports, "uriToString", ({ enumerable: true, get: function () { return uri_parser_1.uriToString; } })); +Object.defineProperty(exports, "splitHostPort", ({ enumerable: true, get: function () { return uri_parser_1.splitHostPort; } })); +var duration_1 = __nccwpck_require__(63929); +Object.defineProperty(exports, "durationToMs", ({ enumerable: true, get: function () { return duration_1.durationToMs; } })); +Object.defineProperty(exports, "parseDuration", ({ enumerable: true, get: function () { return duration_1.parseDuration; } })); +var backoff_timeout_1 = __nccwpck_require__(14643); +Object.defineProperty(exports, "BackoffTimeout", ({ enumerable: true, get: function () { return backoff_timeout_1.BackoffTimeout; } })); +var load_balancer_1 = __nccwpck_require__(7000); +Object.defineProperty(exports, "createChildChannelControlHelper", ({ enumerable: true, get: function () { return load_balancer_1.createChildChannelControlHelper; } })); +Object.defineProperty(exports, "registerLoadBalancerType", ({ enumerable: true, get: function () { return load_balancer_1.registerLoadBalancerType; } })); +Object.defineProperty(exports, "selectLbConfigFromList", ({ enumerable: true, get: function () { return load_balancer_1.selectLbConfigFromList; } })); +Object.defineProperty(exports, "parseLoadBalancingConfig", ({ enumerable: true, get: function () { return load_balancer_1.parseLoadBalancingConfig; } })); +Object.defineProperty(exports, "isLoadBalancerNameRegistered", ({ enumerable: true, get: function () { return load_balancer_1.isLoadBalancerNameRegistered; } })); +var load_balancer_pick_first_1 = __nccwpck_require__(78639); +Object.defineProperty(exports, "LeafLoadBalancer", ({ enumerable: true, get: function () { return load_balancer_pick_first_1.LeafLoadBalancer; } })); +var subchannel_address_1 = __nccwpck_require__(97021); +Object.defineProperty(exports, "subchannelAddressToString", ({ enumerable: true, get: function () { return subchannel_address_1.subchannelAddressToString; } })); +Object.defineProperty(exports, "endpointToString", ({ enumerable: true, get: function () { return subchannel_address_1.endpointToString; } })); +Object.defineProperty(exports, "endpointHasAddress", ({ enumerable: true, get: function () { return subchannel_address_1.endpointHasAddress; } })); +Object.defineProperty(exports, "EndpointMap", ({ enumerable: true, get: function () { return subchannel_address_1.EndpointMap; } })); +var load_balancer_child_handler_1 = __nccwpck_require__(21450); +Object.defineProperty(exports, "ChildLoadBalancerHandler", ({ enumerable: true, get: function () { return load_balancer_child_handler_1.ChildLoadBalancerHandler; } })); +var picker_1 = __nccwpck_require__(71663); +Object.defineProperty(exports, "UnavailablePicker", ({ enumerable: true, get: function () { return picker_1.UnavailablePicker; } })); +Object.defineProperty(exports, "QueuePicker", ({ enumerable: true, get: function () { return picker_1.QueuePicker; } })); +Object.defineProperty(exports, "PickResultType", ({ enumerable: true, get: function () { return picker_1.PickResultType; } })); +var call_interface_1 = __nccwpck_require__(61803); +Object.defineProperty(exports, "statusOrFromValue", ({ enumerable: true, get: function () { return call_interface_1.statusOrFromValue; } })); +Object.defineProperty(exports, "statusOrFromError", ({ enumerable: true, get: function () { return call_interface_1.statusOrFromError; } })); +var filter_1 = __nccwpck_require__(81467); +Object.defineProperty(exports, "BaseFilter", ({ enumerable: true, get: function () { return filter_1.BaseFilter; } })); +var filter_stack_1 = __nccwpck_require__(95726); +Object.defineProperty(exports, "FilterStackFactory", ({ enumerable: true, get: function () { return filter_stack_1.FilterStackFactory; } })); +var admin_1 = __nccwpck_require__(52914); +Object.defineProperty(exports, "registerAdminService", ({ enumerable: true, get: function () { return admin_1.registerAdminService; } })); +var subchannel_interface_1 = __nccwpck_require__(70098); +Object.defineProperty(exports, "BaseSubchannelWrapper", ({ enumerable: true, get: function () { return subchannel_interface_1.BaseSubchannelWrapper; } })); +var server_credentials_1 = __nccwpck_require__(36545); +Object.defineProperty(exports, "createServerCredentialsWithInterceptors", ({ enumerable: true, get: function () { return server_credentials_1.createServerCredentialsWithInterceptors; } })); +Object.defineProperty(exports, "createCertificateProviderServerCredentials", ({ enumerable: true, get: function () { return server_credentials_1.createCertificateProviderServerCredentials; } })); +var certificate_provider_1 = __nccwpck_require__(27974); +Object.defineProperty(exports, "FileWatcherCertificateProvider", ({ enumerable: true, get: function () { return certificate_provider_1.FileWatcherCertificateProvider; } })); +var channel_credentials_1 = __nccwpck_require__(32257); +Object.defineProperty(exports, "createCertificateProviderChannelCredentials", ({ enumerable: true, get: function () { return channel_credentials_1.createCertificateProviderChannelCredentials; } })); +var internal_channel_1 = __nccwpck_require__(40114); +Object.defineProperty(exports, "SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX", ({ enumerable: true, get: function () { return internal_channel_1.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX; } })); +//# sourceMappingURL=experimental.js.map + +/***/ }), + +/***/ 95726: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.FilterStackFactory = exports.FilterStack = void 0; +class FilterStack { + constructor(filters) { + this.filters = filters; + } + sendMetadata(metadata) { + let result = metadata; + for (let i = 0; i < this.filters.length; i++) { + result = this.filters[i].sendMetadata(result); + } + return result; + } + receiveMetadata(metadata) { + let result = metadata; + for (let i = this.filters.length - 1; i >= 0; i--) { + result = this.filters[i].receiveMetadata(result); + } + return result; + } + sendMessage(message) { + let result = message; + for (let i = 0; i < this.filters.length; i++) { + result = this.filters[i].sendMessage(result); + } + return result; + } + receiveMessage(message) { + let result = message; + for (let i = this.filters.length - 1; i >= 0; i--) { + result = this.filters[i].receiveMessage(result); + } + return result; + } + receiveTrailers(status) { + let result = status; + for (let i = this.filters.length - 1; i >= 0; i--) { + result = this.filters[i].receiveTrailers(result); + } + return result; + } + push(filters) { + this.filters.unshift(...filters); + } + getFilters() { + return this.filters; + } +} +exports.FilterStack = FilterStack; +class FilterStackFactory { + constructor(factories) { + this.factories = factories; + } + push(filterFactories) { + this.factories.unshift(...filterFactories); + } + clone() { + return new FilterStackFactory([...this.factories]); + } + createFilter() { + return new FilterStack(this.factories.map(factory => factory.createFilter())); + } +} +exports.FilterStackFactory = FilterStackFactory; +//# sourceMappingURL=filter-stack.js.map + +/***/ }), + +/***/ 81467: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.BaseFilter = void 0; +class BaseFilter { + async sendMetadata(metadata) { + return metadata; + } + receiveMetadata(metadata) { + return metadata; + } + async sendMessage(message) { + return message; + } + async receiveMessage(message) { + return message; + } + receiveTrailers(status) { + return status; + } +} +exports.BaseFilter = BaseFilter; +//# sourceMappingURL=filter.js.map + +/***/ }), + +/***/ 18954: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.parseCIDR = parseCIDR; +exports.mapProxyName = mapProxyName; +exports.getProxiedConnection = getProxiedConnection; +const logging_1 = __nccwpck_require__(8536); +const constants_1 = __nccwpck_require__(68288); +const net_1 = __nccwpck_require__(69278); +const http = __nccwpck_require__(58611); +const logging = __nccwpck_require__(8536); +const subchannel_address_1 = __nccwpck_require__(97021); +const uri_parser_1 = __nccwpck_require__(56027); +const url_1 = __nccwpck_require__(87016); +const resolver_dns_1 = __nccwpck_require__(51149); +const TRACER_NAME = 'proxy'; +function trace(text) { + logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text); +} +function getProxyInfo() { + let proxyEnv = ''; + let envVar = ''; + /* Prefer using 'grpc_proxy'. Fallback on 'http_proxy' if it is not set. + * Also prefer using 'https_proxy' with fallback on 'http_proxy'. The + * fallback behavior can be removed if there's a demand for it. + */ + if (process.env.grpc_proxy) { + envVar = 'grpc_proxy'; + proxyEnv = process.env.grpc_proxy; + } + else if (process.env.https_proxy) { + envVar = 'https_proxy'; + proxyEnv = process.env.https_proxy; + } + else if (process.env.http_proxy) { + envVar = 'http_proxy'; + proxyEnv = process.env.http_proxy; + } + else { + return {}; + } + let proxyUrl; + try { + proxyUrl = new url_1.URL(proxyEnv); + } + catch (e) { + (0, logging_1.log)(constants_1.LogVerbosity.ERROR, `cannot parse value of "${envVar}" env var`); + return {}; + } + if (proxyUrl.protocol !== 'http:') { + (0, logging_1.log)(constants_1.LogVerbosity.ERROR, `"${proxyUrl.protocol}" scheme not supported in proxy URI`); + return {}; + } + let userCred = null; + if (proxyUrl.username) { + if (proxyUrl.password) { + (0, logging_1.log)(constants_1.LogVerbosity.INFO, 'userinfo found in proxy URI'); + userCred = decodeURIComponent(`${proxyUrl.username}:${proxyUrl.password}`); + } + else { + userCred = proxyUrl.username; + } + } + const hostname = proxyUrl.hostname; + let port = proxyUrl.port; + /* The proxy URL uses the scheme "http:", which has a default port number of + * 80. We need to set that explicitly here if it is omitted because otherwise + * it will use gRPC's default port 443. */ + if (port === '') { + port = '80'; + } + const result = { + address: `${hostname}:${port}`, + }; + if (userCred) { + result.creds = userCred; + } + trace('Proxy server ' + result.address + ' set by environment variable ' + envVar); + return result; +} +function getNoProxyHostList() { + /* Prefer using 'no_grpc_proxy'. Fallback on 'no_proxy' if it is not set. */ + let noProxyStr = process.env.no_grpc_proxy; + let envVar = 'no_grpc_proxy'; + if (!noProxyStr) { + noProxyStr = process.env.no_proxy; + envVar = 'no_proxy'; + } + if (noProxyStr) { + trace('No proxy server list set by environment variable ' + envVar); + return noProxyStr.split(','); + } + else { + return []; + } +} +/* + * The groups correspond to CIDR parts as follows: + * 1. ip + * 2. prefixLength + */ +function parseCIDR(cidrString) { + const splitRange = cidrString.split('/'); + if (splitRange.length !== 2) { + return null; + } + const prefixLength = parseInt(splitRange[1], 10); + if (!(0, net_1.isIPv4)(splitRange[0]) || Number.isNaN(prefixLength) || prefixLength < 0 || prefixLength > 32) { + return null; + } + return { + ip: ipToInt(splitRange[0]), + prefixLength: prefixLength + }; +} +function ipToInt(ip) { + return ip.split(".").reduce((acc, octet) => (acc << 8) + parseInt(octet, 10), 0); +} +function isIpInCIDR(cidr, serverHost) { + const ip = cidr.ip; + const mask = -1 << (32 - cidr.prefixLength); + const hostIP = ipToInt(serverHost); + return (hostIP & mask) === (ip & mask); +} +function hostMatchesNoProxyList(serverHost) { + for (const host of getNoProxyHostList()) { + const parsedCIDR = parseCIDR(host); + // host is a CIDR and serverHost is an IP address + if ((0, net_1.isIPv4)(serverHost) && parsedCIDR && isIpInCIDR(parsedCIDR, serverHost)) { + return true; + } + else if (serverHost.endsWith(host)) { + // host is a single IP or a domain name suffix + return true; + } + } + return false; +} +function mapProxyName(target, options) { + var _a; + const noProxyResult = { + target: target, + extraOptions: {}, + }; + if (((_a = options['grpc.enable_http_proxy']) !== null && _a !== void 0 ? _a : 1) === 0) { + return noProxyResult; + } + if (target.scheme === 'unix') { + return noProxyResult; + } + const proxyInfo = getProxyInfo(); + if (!proxyInfo.address) { + return noProxyResult; + } + const hostPort = (0, uri_parser_1.splitHostPort)(target.path); + if (!hostPort) { + return noProxyResult; + } + const serverHost = hostPort.host; + if (hostMatchesNoProxyList(serverHost)) { + trace('Not using proxy for target in no_proxy list: ' + (0, uri_parser_1.uriToString)(target)); + return noProxyResult; + } + const extraOptions = { + 'grpc.http_connect_target': (0, uri_parser_1.uriToString)(target), + }; + if (proxyInfo.creds) { + extraOptions['grpc.http_connect_creds'] = proxyInfo.creds; + } + return { + target: { + scheme: 'dns', + path: proxyInfo.address, + }, + extraOptions: extraOptions, + }; +} +function getProxiedConnection(address, channelOptions) { + var _a; + if (!('grpc.http_connect_target' in channelOptions)) { + return Promise.resolve(null); + } + const realTarget = channelOptions['grpc.http_connect_target']; + const parsedTarget = (0, uri_parser_1.parseUri)(realTarget); + if (parsedTarget === null) { + return Promise.resolve(null); + } + const splitHostPost = (0, uri_parser_1.splitHostPort)(parsedTarget.path); + if (splitHostPost === null) { + return Promise.resolve(null); + } + const hostPort = `${splitHostPost.host}:${(_a = splitHostPost.port) !== null && _a !== void 0 ? _a : resolver_dns_1.DEFAULT_PORT}`; + const options = { + method: 'CONNECT', + path: hostPort, + }; + const headers = { + Host: hostPort, + }; + // Connect to the subchannel address as a proxy + if ((0, subchannel_address_1.isTcpSubchannelAddress)(address)) { + options.host = address.host; + options.port = address.port; + } + else { + options.socketPath = address.path; + } + if ('grpc.http_connect_creds' in channelOptions) { + headers['Proxy-Authorization'] = + 'Basic ' + + Buffer.from(channelOptions['grpc.http_connect_creds']).toString('base64'); + } + options.headers = headers; + const proxyAddressString = (0, subchannel_address_1.subchannelAddressToString)(address); + trace('Using proxy ' + proxyAddressString + ' to connect to ' + options.path); + return new Promise((resolve, reject) => { + const request = http.request(options); + request.once('connect', (res, socket, head) => { + request.removeAllListeners(); + socket.removeAllListeners(); + if (res.statusCode === 200) { + trace('Successfully connected to ' + + options.path + + ' through proxy ' + + proxyAddressString); + // The HTTP client may have already read a few bytes of the proxied + // connection. If that's the case, put them back into the socket. + // See https://github.com/grpc/grpc-node/issues/2744. + if (head.length > 0) { + socket.unshift(head); + } + trace('Successfully established a plaintext connection to ' + + options.path + + ' through proxy ' + + proxyAddressString); + resolve(socket); + } + else { + (0, logging_1.log)(constants_1.LogVerbosity.ERROR, 'Failed to connect to ' + + options.path + + ' through proxy ' + + proxyAddressString + + ' with status ' + + res.statusCode); + reject(); + } + }); + request.once('error', err => { + request.removeAllListeners(); + (0, logging_1.log)(constants_1.LogVerbosity.ERROR, 'Failed to connect to proxy ' + + proxyAddressString + + ' with error ' + + err.message); + reject(); + }); + request.end(); + }); +} +//# sourceMappingURL=http_proxy.js.map + +/***/ }), + +/***/ 83033: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.experimental = exports.ServerMetricRecorder = exports.ServerInterceptingCall = exports.ResponderBuilder = exports.ServerListenerBuilder = exports.addAdminServicesToServer = exports.getChannelzHandlers = exports.getChannelzServiceDefinition = exports.InterceptorConfigurationError = exports.InterceptingCall = exports.RequesterBuilder = exports.ListenerBuilder = exports.StatusBuilder = exports.getClientChannel = exports.ServerCredentials = exports.Server = exports.setLogVerbosity = exports.setLogger = exports.load = exports.loadObject = exports.CallCredentials = exports.ChannelCredentials = exports.waitForClientReady = exports.closeClient = exports.Channel = exports.makeGenericClientConstructor = exports.makeClientConstructor = exports.loadPackageDefinition = exports.Client = exports.compressionAlgorithms = exports.propagate = exports.connectivityState = exports.status = exports.logVerbosity = exports.Metadata = exports.credentials = void 0; +const call_credentials_1 = __nccwpck_require__(79190); +Object.defineProperty(exports, "CallCredentials", ({ enumerable: true, get: function () { return call_credentials_1.CallCredentials; } })); +const channel_1 = __nccwpck_require__(86918); +Object.defineProperty(exports, "Channel", ({ enumerable: true, get: function () { return channel_1.ChannelImplementation; } })); +const compression_algorithms_1 = __nccwpck_require__(24130); +Object.defineProperty(exports, "compressionAlgorithms", ({ enumerable: true, get: function () { return compression_algorithms_1.CompressionAlgorithms; } })); +const connectivity_state_1 = __nccwpck_require__(60778); +Object.defineProperty(exports, "connectivityState", ({ enumerable: true, get: function () { return connectivity_state_1.ConnectivityState; } })); +const channel_credentials_1 = __nccwpck_require__(32257); +Object.defineProperty(exports, "ChannelCredentials", ({ enumerable: true, get: function () { return channel_credentials_1.ChannelCredentials; } })); +const client_1 = __nccwpck_require__(54210); +Object.defineProperty(exports, "Client", ({ enumerable: true, get: function () { return client_1.Client; } })); +const constants_1 = __nccwpck_require__(68288); +Object.defineProperty(exports, "logVerbosity", ({ enumerable: true, get: function () { return constants_1.LogVerbosity; } })); +Object.defineProperty(exports, "status", ({ enumerable: true, get: function () { return constants_1.Status; } })); +Object.defineProperty(exports, "propagate", ({ enumerable: true, get: function () { return constants_1.Propagate; } })); +const logging = __nccwpck_require__(8536); +const make_client_1 = __nccwpck_require__(76983); +Object.defineProperty(exports, "loadPackageDefinition", ({ enumerable: true, get: function () { return make_client_1.loadPackageDefinition; } })); +Object.defineProperty(exports, "makeClientConstructor", ({ enumerable: true, get: function () { return make_client_1.makeClientConstructor; } })); +Object.defineProperty(exports, "makeGenericClientConstructor", ({ enumerable: true, get: function () { return make_client_1.makeClientConstructor; } })); +const metadata_1 = __nccwpck_require__(36100); +Object.defineProperty(exports, "Metadata", ({ enumerable: true, get: function () { return metadata_1.Metadata; } })); +const server_1 = __nccwpck_require__(12390); +Object.defineProperty(exports, "Server", ({ enumerable: true, get: function () { return server_1.Server; } })); +const server_credentials_1 = __nccwpck_require__(36545); +Object.defineProperty(exports, "ServerCredentials", ({ enumerable: true, get: function () { return server_credentials_1.ServerCredentials; } })); +const status_builder_1 = __nccwpck_require__(7901); +Object.defineProperty(exports, "StatusBuilder", ({ enumerable: true, get: function () { return status_builder_1.StatusBuilder; } })); +/**** Client Credentials ****/ +// Using assign only copies enumerable properties, which is what we want +exports.credentials = { + /** + * Combine a ChannelCredentials with any number of CallCredentials into a + * single ChannelCredentials object. + * @param channelCredentials The ChannelCredentials object. + * @param callCredentials Any number of CallCredentials objects. + * @return The resulting ChannelCredentials object. + */ + combineChannelCredentials: (channelCredentials, ...callCredentials) => { + return callCredentials.reduce((acc, other) => acc.compose(other), channelCredentials); + }, + /** + * Combine any number of CallCredentials into a single CallCredentials + * object. + * @param first The first CallCredentials object. + * @param additional Any number of additional CallCredentials objects. + * @return The resulting CallCredentials object. + */ + combineCallCredentials: (first, ...additional) => { + return additional.reduce((acc, other) => acc.compose(other), first); + }, + // from channel-credentials.ts + createInsecure: channel_credentials_1.ChannelCredentials.createInsecure, + createSsl: channel_credentials_1.ChannelCredentials.createSsl, + createFromSecureContext: channel_credentials_1.ChannelCredentials.createFromSecureContext, + // from call-credentials.ts + createFromMetadataGenerator: call_credentials_1.CallCredentials.createFromMetadataGenerator, + createFromGoogleCredential: call_credentials_1.CallCredentials.createFromGoogleCredential, + createEmpty: call_credentials_1.CallCredentials.createEmpty, +}; +/** + * Close a Client object. + * @param client The client to close. + */ +const closeClient = (client) => client.close(); +exports.closeClient = closeClient; +const waitForClientReady = (client, deadline, callback) => client.waitForReady(deadline, callback); +exports.waitForClientReady = waitForClientReady; +/* eslint-enable @typescript-eslint/no-explicit-any */ +/**** Unimplemented function stubs ****/ +/* eslint-disable @typescript-eslint/no-explicit-any */ +const loadObject = (value, options) => { + throw new Error('Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead'); +}; +exports.loadObject = loadObject; +const load = (filename, format, options) => { + throw new Error('Not available in this library. Use @grpc/proto-loader and loadPackageDefinition instead'); +}; +exports.load = load; +const setLogger = (logger) => { + logging.setLogger(logger); +}; +exports.setLogger = setLogger; +const setLogVerbosity = (verbosity) => { + logging.setLoggerVerbosity(verbosity); +}; +exports.setLogVerbosity = setLogVerbosity; +const getClientChannel = (client) => { + return client_1.Client.prototype.getChannel.call(client); +}; +exports.getClientChannel = getClientChannel; +var client_interceptors_1 = __nccwpck_require__(82451); +Object.defineProperty(exports, "ListenerBuilder", ({ enumerable: true, get: function () { return client_interceptors_1.ListenerBuilder; } })); +Object.defineProperty(exports, "RequesterBuilder", ({ enumerable: true, get: function () { return client_interceptors_1.RequesterBuilder; } })); +Object.defineProperty(exports, "InterceptingCall", ({ enumerable: true, get: function () { return client_interceptors_1.InterceptingCall; } })); +Object.defineProperty(exports, "InterceptorConfigurationError", ({ enumerable: true, get: function () { return client_interceptors_1.InterceptorConfigurationError; } })); +var channelz_1 = __nccwpck_require__(68198); +Object.defineProperty(exports, "getChannelzServiceDefinition", ({ enumerable: true, get: function () { return channelz_1.getChannelzServiceDefinition; } })); +Object.defineProperty(exports, "getChannelzHandlers", ({ enumerable: true, get: function () { return channelz_1.getChannelzHandlers; } })); +var admin_1 = __nccwpck_require__(52914); +Object.defineProperty(exports, "addAdminServicesToServer", ({ enumerable: true, get: function () { return admin_1.addAdminServicesToServer; } })); +var server_interceptors_1 = __nccwpck_require__(42151); +Object.defineProperty(exports, "ServerListenerBuilder", ({ enumerable: true, get: function () { return server_interceptors_1.ServerListenerBuilder; } })); +Object.defineProperty(exports, "ResponderBuilder", ({ enumerable: true, get: function () { return server_interceptors_1.ResponderBuilder; } })); +Object.defineProperty(exports, "ServerInterceptingCall", ({ enumerable: true, get: function () { return server_interceptors_1.ServerInterceptingCall; } })); +var orca_1 = __nccwpck_require__(82124); +Object.defineProperty(exports, "ServerMetricRecorder", ({ enumerable: true, get: function () { return orca_1.ServerMetricRecorder; } })); +const experimental = __nccwpck_require__(20079); +exports.experimental = experimental; +const resolver_dns = __nccwpck_require__(51149); +const resolver_uds = __nccwpck_require__(69252); +const resolver_ip = __nccwpck_require__(52617); +const load_balancer_pick_first = __nccwpck_require__(78639); +const load_balancer_round_robin = __nccwpck_require__(71936); +const load_balancer_outlier_detection = __nccwpck_require__(95343); +const load_balancer_weighted_round_robin = __nccwpck_require__(47616); +const channelz = __nccwpck_require__(68198); +(() => { + resolver_dns.setup(); + resolver_uds.setup(); + resolver_ip.setup(); + load_balancer_pick_first.setup(); + load_balancer_round_robin.setup(); + load_balancer_outlier_detection.setup(); + load_balancer_weighted_round_robin.setup(); + channelz.setup(); +})(); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 40114: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.InternalChannel = exports.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX = void 0; +const channel_credentials_1 = __nccwpck_require__(32257); +const resolving_load_balancer_1 = __nccwpck_require__(63962); +const subchannel_pool_1 = __nccwpck_require__(48695); +const picker_1 = __nccwpck_require__(71663); +const metadata_1 = __nccwpck_require__(36100); +const constants_1 = __nccwpck_require__(68288); +const filter_stack_1 = __nccwpck_require__(95726); +const compression_filter_1 = __nccwpck_require__(43430); +const resolver_1 = __nccwpck_require__(76255); +const logging_1 = __nccwpck_require__(8536); +const http_proxy_1 = __nccwpck_require__(18954); +const uri_parser_1 = __nccwpck_require__(56027); +const connectivity_state_1 = __nccwpck_require__(60778); +const channelz_1 = __nccwpck_require__(68198); +const load_balancing_call_1 = __nccwpck_require__(58944); +const deadline_1 = __nccwpck_require__(52173); +const resolving_call_1 = __nccwpck_require__(8023); +const call_number_1 = __nccwpck_require__(35675); +const control_plane_status_1 = __nccwpck_require__(39962); +const retrying_call_1 = __nccwpck_require__(2532); +const subchannel_interface_1 = __nccwpck_require__(70098); +/** + * See https://nodejs.org/api/timers.html#timers_setinterval_callback_delay_args + */ +const MAX_TIMEOUT_TIME = 2147483647; +const MIN_IDLE_TIMEOUT_MS = 1000; +// 30 minutes +const DEFAULT_IDLE_TIMEOUT_MS = 30 * 60 * 1000; +const RETRY_THROTTLER_MAP = new Map(); +const DEFAULT_RETRY_BUFFER_SIZE_BYTES = 1 << 24; // 16 MB +const DEFAULT_PER_RPC_RETRY_BUFFER_SIZE_BYTES = 1 << 20; // 1 MB +class ChannelSubchannelWrapper extends subchannel_interface_1.BaseSubchannelWrapper { + constructor(childSubchannel, channel) { + super(childSubchannel); + this.channel = channel; + this.refCount = 0; + this.subchannelStateListener = (subchannel, previousState, newState, keepaliveTime) => { + channel.throttleKeepalive(keepaliveTime); + }; + } + ref() { + if (this.refCount === 0) { + this.child.addConnectivityStateListener(this.subchannelStateListener); + this.channel.addWrappedSubchannel(this); + } + this.child.ref(); + this.refCount += 1; + } + unref() { + this.child.unref(); + this.refCount -= 1; + if (this.refCount <= 0) { + this.child.removeConnectivityStateListener(this.subchannelStateListener); + this.channel.removeWrappedSubchannel(this); + } + } +} +class ShutdownPicker { + pick(pickArgs) { + return { + pickResultType: picker_1.PickResultType.DROP, + status: { + code: constants_1.Status.UNAVAILABLE, + details: 'Channel closed before call started', + metadata: new metadata_1.Metadata() + }, + subchannel: null, + onCallStarted: null, + onCallEnded: null + }; + } +} +exports.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX = 'grpc.internal.no_subchannel'; +class ChannelzInfoTracker { + constructor(target) { + this.target = target; + this.trace = new channelz_1.ChannelzTrace(); + this.callTracker = new channelz_1.ChannelzCallTracker(); + this.childrenTracker = new channelz_1.ChannelzChildrenTracker(); + this.state = connectivity_state_1.ConnectivityState.IDLE; + } + getChannelzInfoCallback() { + return () => { + return { + target: this.target, + state: this.state, + trace: this.trace, + callTracker: this.callTracker, + children: this.childrenTracker.getChildLists() + }; + }; + } +} +class InternalChannel { + constructor(target, credentials, options) { + var _a, _b, _c, _d, _e, _f; + this.credentials = credentials; + this.options = options; + this.connectivityState = connectivity_state_1.ConnectivityState.IDLE; + this.currentPicker = new picker_1.UnavailablePicker(); + /** + * Calls queued up to get a call config. Should only be populated before the + * first time the resolver returns a result, which includes the ConfigSelector. + */ + this.configSelectionQueue = []; + this.pickQueue = []; + this.connectivityStateWatchers = []; + /** + * This timer does not do anything on its own. Its purpose is to hold the + * event loop open while there are any pending calls for the channel that + * have not yet been assigned to specific subchannels. In other words, + * the invariant is that callRefTimer is reffed if and only if pickQueue + * is non-empty. In addition, the timer is null while the state is IDLE or + * SHUTDOWN and there are no pending calls. + */ + this.callRefTimer = null; + this.configSelector = null; + /** + * This is the error from the name resolver if it failed most recently. It + * is only used to end calls that start while there is no config selector + * and the name resolver is in backoff, so it should be nulled if + * configSelector becomes set or the channel state becomes anything other + * than TRANSIENT_FAILURE. + */ + this.currentResolutionError = null; + this.wrappedSubchannels = new Set(); + this.callCount = 0; + this.idleTimer = null; + // Channelz info + this.channelzEnabled = true; + /** + * Randomly generated ID to be passed to the config selector, for use by + * ring_hash in xDS. An integer distributed approximately uniformly between + * 0 and MAX_SAFE_INTEGER. + */ + this.randomChannelId = Math.floor(Math.random() * Number.MAX_SAFE_INTEGER); + if (typeof target !== 'string') { + throw new TypeError('Channel target must be a string'); + } + if (!(credentials instanceof channel_credentials_1.ChannelCredentials)) { + throw new TypeError('Channel credentials must be a ChannelCredentials object'); + } + if (options) { + if (typeof options !== 'object') { + throw new TypeError('Channel options must be an object'); + } + } + this.channelzInfoTracker = new ChannelzInfoTracker(target); + const originalTargetUri = (0, uri_parser_1.parseUri)(target); + if (originalTargetUri === null) { + throw new Error(`Could not parse target name "${target}"`); + } + /* This ensures that the target has a scheme that is registered with the + * resolver */ + const defaultSchemeMapResult = (0, resolver_1.mapUriDefaultScheme)(originalTargetUri); + if (defaultSchemeMapResult === null) { + throw new Error(`Could not find a default scheme for target name "${target}"`); + } + if (this.options['grpc.enable_channelz'] === 0) { + this.channelzEnabled = false; + } + this.channelzRef = (0, channelz_1.registerChannelzChannel)(target, this.channelzInfoTracker.getChannelzInfoCallback(), this.channelzEnabled); + if (this.channelzEnabled) { + this.channelzInfoTracker.trace.addTrace('CT_INFO', 'Channel created'); + } + if (this.options['grpc.default_authority']) { + this.defaultAuthority = this.options['grpc.default_authority']; + } + else { + this.defaultAuthority = (0, resolver_1.getDefaultAuthority)(defaultSchemeMapResult); + } + const proxyMapResult = (0, http_proxy_1.mapProxyName)(defaultSchemeMapResult, options); + this.target = proxyMapResult.target; + this.options = Object.assign({}, this.options, proxyMapResult.extraOptions); + /* The global boolean parameter to getSubchannelPool has the inverse meaning to what + * the grpc.use_local_subchannel_pool channel option means. */ + this.subchannelPool = (0, subchannel_pool_1.getSubchannelPool)(((_a = this.options['grpc.use_local_subchannel_pool']) !== null && _a !== void 0 ? _a : 0) === 0); + this.retryBufferTracker = new retrying_call_1.MessageBufferTracker((_b = this.options['grpc.retry_buffer_size']) !== null && _b !== void 0 ? _b : DEFAULT_RETRY_BUFFER_SIZE_BYTES, (_c = this.options['grpc.per_rpc_retry_buffer_size']) !== null && _c !== void 0 ? _c : DEFAULT_PER_RPC_RETRY_BUFFER_SIZE_BYTES); + this.keepaliveTime = (_d = this.options['grpc.keepalive_time_ms']) !== null && _d !== void 0 ? _d : -1; + this.idleTimeoutMs = Math.max((_e = this.options['grpc.client_idle_timeout_ms']) !== null && _e !== void 0 ? _e : DEFAULT_IDLE_TIMEOUT_MS, MIN_IDLE_TIMEOUT_MS); + const channelControlHelper = { + createSubchannel: (subchannelAddress, subchannelArgs) => { + const finalSubchannelArgs = {}; + for (const [key, value] of Object.entries(subchannelArgs)) { + if (!key.startsWith(exports.SUBCHANNEL_ARGS_EXCLUDE_KEY_PREFIX)) { + finalSubchannelArgs[key] = value; + } + } + const subchannel = this.subchannelPool.getOrCreateSubchannel(this.target, subchannelAddress, finalSubchannelArgs, this.credentials); + subchannel.throttleKeepalive(this.keepaliveTime); + if (this.channelzEnabled) { + this.channelzInfoTracker.trace.addTrace('CT_INFO', 'Created subchannel or used existing subchannel', subchannel.getChannelzRef()); + } + const wrappedSubchannel = new ChannelSubchannelWrapper(subchannel, this); + return wrappedSubchannel; + }, + updateState: (connectivityState, picker) => { + this.currentPicker = picker; + const queueCopy = this.pickQueue.slice(); + this.pickQueue = []; + if (queueCopy.length > 0) { + this.callRefTimerUnref(); + } + for (const call of queueCopy) { + call.doPick(); + } + this.updateState(connectivityState); + }, + requestReresolution: () => { + // This should never be called. + throw new Error('Resolving load balancer should never call requestReresolution'); + }, + addChannelzChild: (child) => { + if (this.channelzEnabled) { + this.channelzInfoTracker.childrenTracker.refChild(child); + } + }, + removeChannelzChild: (child) => { + if (this.channelzEnabled) { + this.channelzInfoTracker.childrenTracker.unrefChild(child); + } + }, + }; + this.resolvingLoadBalancer = new resolving_load_balancer_1.ResolvingLoadBalancer(this.target, channelControlHelper, this.options, (serviceConfig, configSelector) => { + var _a; + if (serviceConfig.retryThrottling) { + RETRY_THROTTLER_MAP.set(this.getTarget(), new retrying_call_1.RetryThrottler(serviceConfig.retryThrottling.maxTokens, serviceConfig.retryThrottling.tokenRatio, RETRY_THROTTLER_MAP.get(this.getTarget()))); + } + else { + RETRY_THROTTLER_MAP.delete(this.getTarget()); + } + if (this.channelzEnabled) { + this.channelzInfoTracker.trace.addTrace('CT_INFO', 'Address resolution succeeded'); + } + (_a = this.configSelector) === null || _a === void 0 ? void 0 : _a.unref(); + this.configSelector = configSelector; + this.currentResolutionError = null; + /* We process the queue asynchronously to ensure that the corresponding + * load balancer update has completed. */ + process.nextTick(() => { + const localQueue = this.configSelectionQueue; + this.configSelectionQueue = []; + if (localQueue.length > 0) { + this.callRefTimerUnref(); + } + for (const call of localQueue) { + call.getConfig(); + } + }); + }, status => { + if (this.channelzEnabled) { + this.channelzInfoTracker.trace.addTrace('CT_WARNING', 'Address resolution failed with code ' + + status.code + + ' and details "' + + status.details + + '"'); + } + if (this.configSelectionQueue.length > 0) { + this.trace('Name resolution failed with calls queued for config selection'); + } + if (this.configSelector === null) { + this.currentResolutionError = Object.assign(Object.assign({}, (0, control_plane_status_1.restrictControlPlaneStatusCode)(status.code, status.details)), { metadata: status.metadata }); + } + const localQueue = this.configSelectionQueue; + this.configSelectionQueue = []; + if (localQueue.length > 0) { + this.callRefTimerUnref(); + } + for (const call of localQueue) { + call.reportResolverError(status); + } + }); + this.filterStackFactory = new filter_stack_1.FilterStackFactory([ + new compression_filter_1.CompressionFilterFactory(this, this.options), + ]); + this.trace('Channel constructed with options ' + + JSON.stringify(options, undefined, 2)); + const error = new Error(); + if ((0, logging_1.isTracerEnabled)('channel_stacktrace')) { + (0, logging_1.trace)(constants_1.LogVerbosity.DEBUG, 'channel_stacktrace', '(' + + this.channelzRef.id + + ') ' + + 'Channel constructed \n' + + ((_f = error.stack) === null || _f === void 0 ? void 0 : _f.substring(error.stack.indexOf('\n') + 1))); + } + this.lastActivityTimestamp = new Date(); + } + trace(text, verbosityOverride) { + (0, logging_1.trace)(verbosityOverride !== null && verbosityOverride !== void 0 ? verbosityOverride : constants_1.LogVerbosity.DEBUG, 'channel', '(' + this.channelzRef.id + ') ' + (0, uri_parser_1.uriToString)(this.target) + ' ' + text); + } + callRefTimerRef() { + var _a, _b, _c, _d; + if (!this.callRefTimer) { + this.callRefTimer = setInterval(() => { }, MAX_TIMEOUT_TIME); + } + // If the hasRef function does not exist, always run the code + if (!((_b = (_a = this.callRefTimer).hasRef) === null || _b === void 0 ? void 0 : _b.call(_a))) { + this.trace('callRefTimer.ref | configSelectionQueue.length=' + + this.configSelectionQueue.length + + ' pickQueue.length=' + + this.pickQueue.length); + (_d = (_c = this.callRefTimer).ref) === null || _d === void 0 ? void 0 : _d.call(_c); + } + } + callRefTimerUnref() { + var _a, _b, _c; + // If the timer or the hasRef function does not exist, always run the code + if (!((_a = this.callRefTimer) === null || _a === void 0 ? void 0 : _a.hasRef) || this.callRefTimer.hasRef()) { + this.trace('callRefTimer.unref | configSelectionQueue.length=' + + this.configSelectionQueue.length + + ' pickQueue.length=' + + this.pickQueue.length); + (_c = (_b = this.callRefTimer) === null || _b === void 0 ? void 0 : _b.unref) === null || _c === void 0 ? void 0 : _c.call(_b); + } + } + removeConnectivityStateWatcher(watcherObject) { + const watcherIndex = this.connectivityStateWatchers.findIndex(value => value === watcherObject); + if (watcherIndex >= 0) { + this.connectivityStateWatchers.splice(watcherIndex, 1); + } + } + updateState(newState) { + (0, logging_1.trace)(constants_1.LogVerbosity.DEBUG, 'connectivity_state', '(' + + this.channelzRef.id + + ') ' + + (0, uri_parser_1.uriToString)(this.target) + + ' ' + + connectivity_state_1.ConnectivityState[this.connectivityState] + + ' -> ' + + connectivity_state_1.ConnectivityState[newState]); + if (this.channelzEnabled) { + this.channelzInfoTracker.trace.addTrace('CT_INFO', 'Connectivity state change to ' + connectivity_state_1.ConnectivityState[newState]); + } + this.connectivityState = newState; + this.channelzInfoTracker.state = newState; + const watchersCopy = this.connectivityStateWatchers.slice(); + for (const watcherObject of watchersCopy) { + if (newState !== watcherObject.currentState) { + if (watcherObject.timer) { + clearTimeout(watcherObject.timer); + } + this.removeConnectivityStateWatcher(watcherObject); + watcherObject.callback(); + } + } + if (newState !== connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE) { + this.currentResolutionError = null; + } + } + throttleKeepalive(newKeepaliveTime) { + if (newKeepaliveTime > this.keepaliveTime) { + this.keepaliveTime = newKeepaliveTime; + for (const wrappedSubchannel of this.wrappedSubchannels) { + wrappedSubchannel.throttleKeepalive(newKeepaliveTime); + } + } + } + addWrappedSubchannel(wrappedSubchannel) { + this.wrappedSubchannels.add(wrappedSubchannel); + } + removeWrappedSubchannel(wrappedSubchannel) { + this.wrappedSubchannels.delete(wrappedSubchannel); + } + doPick(metadata, extraPickInfo) { + return this.currentPicker.pick({ + metadata: metadata, + extraPickInfo: extraPickInfo, + }); + } + queueCallForPick(call) { + this.pickQueue.push(call); + this.callRefTimerRef(); + } + getConfig(method, metadata) { + if (this.connectivityState !== connectivity_state_1.ConnectivityState.SHUTDOWN) { + this.resolvingLoadBalancer.exitIdle(); + } + if (this.configSelector) { + return { + type: 'SUCCESS', + config: this.configSelector.invoke(method, metadata, this.randomChannelId), + }; + } + else { + if (this.currentResolutionError) { + return { + type: 'ERROR', + error: this.currentResolutionError, + }; + } + else { + return { + type: 'NONE', + }; + } + } + } + queueCallForConfig(call) { + this.configSelectionQueue.push(call); + this.callRefTimerRef(); + } + enterIdle() { + this.resolvingLoadBalancer.destroy(); + this.updateState(connectivity_state_1.ConnectivityState.IDLE); + this.currentPicker = new picker_1.QueuePicker(this.resolvingLoadBalancer); + if (this.idleTimer) { + clearTimeout(this.idleTimer); + this.idleTimer = null; + } + if (this.callRefTimer) { + clearInterval(this.callRefTimer); + this.callRefTimer = null; + } + } + startIdleTimeout(timeoutMs) { + var _a, _b; + this.idleTimer = setTimeout(() => { + if (this.callCount > 0) { + /* If there is currently a call, the channel will not go idle for a + * period of at least idleTimeoutMs, so check again after that time. + */ + this.startIdleTimeout(this.idleTimeoutMs); + return; + } + const now = new Date(); + const timeSinceLastActivity = now.valueOf() - this.lastActivityTimestamp.valueOf(); + if (timeSinceLastActivity >= this.idleTimeoutMs) { + this.trace('Idle timer triggered after ' + + this.idleTimeoutMs + + 'ms of inactivity'); + this.enterIdle(); + } + else { + /* Whenever the timer fires with the latest activity being too recent, + * set the timer again for the time when the time since the last + * activity is equal to the timeout. This should result in the timer + * firing no more than once every idleTimeoutMs/2 on average. */ + this.startIdleTimeout(this.idleTimeoutMs - timeSinceLastActivity); + } + }, timeoutMs); + (_b = (_a = this.idleTimer).unref) === null || _b === void 0 ? void 0 : _b.call(_a); + } + maybeStartIdleTimer() { + if (this.connectivityState !== connectivity_state_1.ConnectivityState.SHUTDOWN && + !this.idleTimer) { + this.startIdleTimeout(this.idleTimeoutMs); + } + } + onCallStart() { + if (this.channelzEnabled) { + this.channelzInfoTracker.callTracker.addCallStarted(); + } + this.callCount += 1; + } + onCallEnd(status) { + if (this.channelzEnabled) { + if (status.code === constants_1.Status.OK) { + this.channelzInfoTracker.callTracker.addCallSucceeded(); + } + else { + this.channelzInfoTracker.callTracker.addCallFailed(); + } + } + this.callCount -= 1; + this.lastActivityTimestamp = new Date(); + this.maybeStartIdleTimer(); + } + createLoadBalancingCall(callConfig, method, host, credentials, deadline) { + const callNumber = (0, call_number_1.getNextCallNumber)(); + this.trace('createLoadBalancingCall [' + callNumber + '] method="' + method + '"'); + return new load_balancing_call_1.LoadBalancingCall(this, callConfig, method, host, credentials, deadline, callNumber); + } + createRetryingCall(callConfig, method, host, credentials, deadline) { + const callNumber = (0, call_number_1.getNextCallNumber)(); + this.trace('createRetryingCall [' + callNumber + '] method="' + method + '"'); + return new retrying_call_1.RetryingCall(this, callConfig, method, host, credentials, deadline, callNumber, this.retryBufferTracker, RETRY_THROTTLER_MAP.get(this.getTarget())); + } + createResolvingCall(method, deadline, host, parentCall, propagateFlags) { + const callNumber = (0, call_number_1.getNextCallNumber)(); + this.trace('createResolvingCall [' + + callNumber + + '] method="' + + method + + '", deadline=' + + (0, deadline_1.deadlineToString)(deadline)); + const finalOptions = { + deadline: deadline, + flags: propagateFlags !== null && propagateFlags !== void 0 ? propagateFlags : constants_1.Propagate.DEFAULTS, + host: host !== null && host !== void 0 ? host : this.defaultAuthority, + parentCall: parentCall, + }; + const call = new resolving_call_1.ResolvingCall(this, method, finalOptions, this.filterStackFactory.clone(), callNumber); + this.onCallStart(); + call.addStatusWatcher(status => { + this.onCallEnd(status); + }); + return call; + } + close() { + var _a; + this.resolvingLoadBalancer.destroy(); + this.updateState(connectivity_state_1.ConnectivityState.SHUTDOWN); + this.currentPicker = new ShutdownPicker(); + for (const call of this.configSelectionQueue) { + call.cancelWithStatus(constants_1.Status.UNAVAILABLE, 'Channel closed before call started'); + } + this.configSelectionQueue = []; + for (const call of this.pickQueue) { + call.cancelWithStatus(constants_1.Status.UNAVAILABLE, 'Channel closed before call started'); + } + this.pickQueue = []; + if (this.callRefTimer) { + clearInterval(this.callRefTimer); + } + if (this.idleTimer) { + clearTimeout(this.idleTimer); + } + if (this.channelzEnabled) { + (0, channelz_1.unregisterChannelzRef)(this.channelzRef); + } + this.subchannelPool.unrefUnusedSubchannels(); + (_a = this.configSelector) === null || _a === void 0 ? void 0 : _a.unref(); + this.configSelector = null; + } + getTarget() { + return (0, uri_parser_1.uriToString)(this.target); + } + getConnectivityState(tryToConnect) { + const connectivityState = this.connectivityState; + if (tryToConnect) { + this.resolvingLoadBalancer.exitIdle(); + this.lastActivityTimestamp = new Date(); + this.maybeStartIdleTimer(); + } + return connectivityState; + } + watchConnectivityState(currentState, deadline, callback) { + if (this.connectivityState === connectivity_state_1.ConnectivityState.SHUTDOWN) { + throw new Error('Channel has been shut down'); + } + let timer = null; + if (deadline !== Infinity) { + const deadlineDate = deadline instanceof Date ? deadline : new Date(deadline); + const now = new Date(); + if (deadline === -Infinity || deadlineDate <= now) { + process.nextTick(callback, new Error('Deadline passed without connectivity state change')); + return; + } + timer = setTimeout(() => { + this.removeConnectivityStateWatcher(watcherObject); + callback(new Error('Deadline passed without connectivity state change')); + }, deadlineDate.getTime() - now.getTime()); + } + const watcherObject = { + currentState, + callback, + timer, + }; + this.connectivityStateWatchers.push(watcherObject); + } + /** + * Get the channelz reference object for this channel. The returned value is + * garbage if channelz is disabled for this channel. + * @returns + */ + getChannelzRef() { + return this.channelzRef; + } + createCall(method, deadline, host, parentCall, propagateFlags) { + if (typeof method !== 'string') { + throw new TypeError('Channel#createCall: method must be a string'); + } + if (!(typeof deadline === 'number' || deadline instanceof Date)) { + throw new TypeError('Channel#createCall: deadline must be a number or Date'); + } + if (this.connectivityState === connectivity_state_1.ConnectivityState.SHUTDOWN) { + throw new Error('Channel has been shut down'); + } + return this.createResolvingCall(method, deadline, host, parentCall, propagateFlags); + } + getOptions() { + return this.options; + } +} +exports.InternalChannel = InternalChannel; +//# sourceMappingURL=internal-channel.js.map + +/***/ }), + +/***/ 21450: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2020 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ChildLoadBalancerHandler = void 0; +const load_balancer_1 = __nccwpck_require__(7000); +const connectivity_state_1 = __nccwpck_require__(60778); +const TYPE_NAME = 'child_load_balancer_helper'; +class ChildLoadBalancerHandler { + constructor(channelControlHelper) { + this.channelControlHelper = channelControlHelper; + this.currentChild = null; + this.pendingChild = null; + this.latestConfig = null; + this.ChildPolicyHelper = class { + constructor(parent) { + this.parent = parent; + this.child = null; + } + createSubchannel(subchannelAddress, subchannelArgs) { + return this.parent.channelControlHelper.createSubchannel(subchannelAddress, subchannelArgs); + } + updateState(connectivityState, picker, errorMessage) { + var _a; + if (this.calledByPendingChild()) { + if (connectivityState === connectivity_state_1.ConnectivityState.CONNECTING) { + return; + } + (_a = this.parent.currentChild) === null || _a === void 0 ? void 0 : _a.destroy(); + this.parent.currentChild = this.parent.pendingChild; + this.parent.pendingChild = null; + } + else if (!this.calledByCurrentChild()) { + return; + } + this.parent.channelControlHelper.updateState(connectivityState, picker, errorMessage); + } + requestReresolution() { + var _a; + const latestChild = (_a = this.parent.pendingChild) !== null && _a !== void 0 ? _a : this.parent.currentChild; + if (this.child === latestChild) { + this.parent.channelControlHelper.requestReresolution(); + } + } + setChild(newChild) { + this.child = newChild; + } + addChannelzChild(child) { + this.parent.channelControlHelper.addChannelzChild(child); + } + removeChannelzChild(child) { + this.parent.channelControlHelper.removeChannelzChild(child); + } + calledByPendingChild() { + return this.child === this.parent.pendingChild; + } + calledByCurrentChild() { + return this.child === this.parent.currentChild; + } + }; + } + configUpdateRequiresNewPolicyInstance(oldConfig, newConfig) { + return oldConfig.getLoadBalancerName() !== newConfig.getLoadBalancerName(); + } + /** + * Prerequisites: lbConfig !== null and lbConfig.name is registered + * @param endpointList + * @param lbConfig + * @param attributes + */ + updateAddressList(endpointList, lbConfig, options, resolutionNote) { + let childToUpdate; + if (this.currentChild === null || + this.latestConfig === null || + this.configUpdateRequiresNewPolicyInstance(this.latestConfig, lbConfig)) { + const newHelper = new this.ChildPolicyHelper(this); + const newChild = (0, load_balancer_1.createLoadBalancer)(lbConfig, newHelper); + newHelper.setChild(newChild); + if (this.currentChild === null) { + this.currentChild = newChild; + childToUpdate = this.currentChild; + } + else { + if (this.pendingChild) { + this.pendingChild.destroy(); + } + this.pendingChild = newChild; + childToUpdate = this.pendingChild; + } + } + else { + if (this.pendingChild === null) { + childToUpdate = this.currentChild; + } + else { + childToUpdate = this.pendingChild; + } + } + this.latestConfig = lbConfig; + return childToUpdate.updateAddressList(endpointList, lbConfig, options, resolutionNote); + } + exitIdle() { + if (this.currentChild) { + this.currentChild.exitIdle(); + if (this.pendingChild) { + this.pendingChild.exitIdle(); + } + } + } + resetBackoff() { + if (this.currentChild) { + this.currentChild.resetBackoff(); + if (this.pendingChild) { + this.pendingChild.resetBackoff(); + } + } + } + destroy() { + /* Note: state updates are only propagated from the child balancer if that + * object is equal to this.currentChild or this.pendingChild. Since this + * function sets both of those to null, no further state updates will + * occur after this function returns. */ + if (this.currentChild) { + this.currentChild.destroy(); + this.currentChild = null; + } + if (this.pendingChild) { + this.pendingChild.destroy(); + this.pendingChild = null; + } + } + getTypeName() { + return TYPE_NAME; + } +} +exports.ChildLoadBalancerHandler = ChildLoadBalancerHandler; +//# sourceMappingURL=load-balancer-child-handler.js.map + +/***/ }), + +/***/ 95343: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2022 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +var _a; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.OutlierDetectionLoadBalancer = exports.OutlierDetectionLoadBalancingConfig = void 0; +exports.setup = setup; +const connectivity_state_1 = __nccwpck_require__(60778); +const constants_1 = __nccwpck_require__(68288); +const duration_1 = __nccwpck_require__(63929); +const experimental_1 = __nccwpck_require__(20079); +const load_balancer_1 = __nccwpck_require__(7000); +const load_balancer_child_handler_1 = __nccwpck_require__(21450); +const picker_1 = __nccwpck_require__(71663); +const subchannel_address_1 = __nccwpck_require__(97021); +const subchannel_interface_1 = __nccwpck_require__(70098); +const logging = __nccwpck_require__(8536); +const TRACER_NAME = 'outlier_detection'; +function trace(text) { + logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text); +} +const TYPE_NAME = 'outlier_detection'; +const OUTLIER_DETECTION_ENABLED = ((_a = process.env.GRPC_EXPERIMENTAL_ENABLE_OUTLIER_DETECTION) !== null && _a !== void 0 ? _a : 'true') === 'true'; +const defaultSuccessRateEjectionConfig = { + stdev_factor: 1900, + enforcement_percentage: 100, + minimum_hosts: 5, + request_volume: 100, +}; +const defaultFailurePercentageEjectionConfig = { + threshold: 85, + enforcement_percentage: 100, + minimum_hosts: 5, + request_volume: 50, +}; +function validateFieldType(obj, fieldName, expectedType, objectName) { + if (fieldName in obj && + obj[fieldName] !== undefined && + typeof obj[fieldName] !== expectedType) { + const fullFieldName = objectName ? `${objectName}.${fieldName}` : fieldName; + throw new Error(`outlier detection config ${fullFieldName} parse error: expected ${expectedType}, got ${typeof obj[fieldName]}`); + } +} +function validatePositiveDuration(obj, fieldName, objectName) { + const fullFieldName = objectName ? `${objectName}.${fieldName}` : fieldName; + if (fieldName in obj && obj[fieldName] !== undefined) { + if (!(0, duration_1.isDuration)(obj[fieldName])) { + throw new Error(`outlier detection config ${fullFieldName} parse error: expected Duration, got ${typeof obj[fieldName]}`); + } + if (!(obj[fieldName].seconds >= 0 && + obj[fieldName].seconds <= 315576000000 && + obj[fieldName].nanos >= 0 && + obj[fieldName].nanos <= 999999999)) { + throw new Error(`outlier detection config ${fullFieldName} parse error: values out of range for non-negative Duaration`); + } + } +} +function validatePercentage(obj, fieldName, objectName) { + const fullFieldName = objectName ? `${objectName}.${fieldName}` : fieldName; + validateFieldType(obj, fieldName, 'number', objectName); + if (fieldName in obj && + obj[fieldName] !== undefined && + !(obj[fieldName] >= 0 && obj[fieldName] <= 100)) { + throw new Error(`outlier detection config ${fullFieldName} parse error: value out of range for percentage (0-100)`); + } +} +class OutlierDetectionLoadBalancingConfig { + constructor(intervalMs, baseEjectionTimeMs, maxEjectionTimeMs, maxEjectionPercent, successRateEjection, failurePercentageEjection, childPolicy) { + this.childPolicy = childPolicy; + if (childPolicy.getLoadBalancerName() === 'pick_first') { + throw new Error('outlier_detection LB policy cannot have a pick_first child policy'); + } + this.intervalMs = intervalMs !== null && intervalMs !== void 0 ? intervalMs : 10000; + this.baseEjectionTimeMs = baseEjectionTimeMs !== null && baseEjectionTimeMs !== void 0 ? baseEjectionTimeMs : 30000; + this.maxEjectionTimeMs = maxEjectionTimeMs !== null && maxEjectionTimeMs !== void 0 ? maxEjectionTimeMs : 300000; + this.maxEjectionPercent = maxEjectionPercent !== null && maxEjectionPercent !== void 0 ? maxEjectionPercent : 10; + this.successRateEjection = successRateEjection + ? Object.assign(Object.assign({}, defaultSuccessRateEjectionConfig), successRateEjection) : null; + this.failurePercentageEjection = failurePercentageEjection + ? Object.assign(Object.assign({}, defaultFailurePercentageEjectionConfig), failurePercentageEjection) : null; + } + getLoadBalancerName() { + return TYPE_NAME; + } + toJsonObject() { + var _a, _b; + return { + outlier_detection: { + interval: (0, duration_1.msToDuration)(this.intervalMs), + base_ejection_time: (0, duration_1.msToDuration)(this.baseEjectionTimeMs), + max_ejection_time: (0, duration_1.msToDuration)(this.maxEjectionTimeMs), + max_ejection_percent: this.maxEjectionPercent, + success_rate_ejection: (_a = this.successRateEjection) !== null && _a !== void 0 ? _a : undefined, + failure_percentage_ejection: (_b = this.failurePercentageEjection) !== null && _b !== void 0 ? _b : undefined, + child_policy: [this.childPolicy.toJsonObject()], + }, + }; + } + getIntervalMs() { + return this.intervalMs; + } + getBaseEjectionTimeMs() { + return this.baseEjectionTimeMs; + } + getMaxEjectionTimeMs() { + return this.maxEjectionTimeMs; + } + getMaxEjectionPercent() { + return this.maxEjectionPercent; + } + getSuccessRateEjectionConfig() { + return this.successRateEjection; + } + getFailurePercentageEjectionConfig() { + return this.failurePercentageEjection; + } + getChildPolicy() { + return this.childPolicy; + } + static createFromJson(obj) { + var _a; + validatePositiveDuration(obj, 'interval'); + validatePositiveDuration(obj, 'base_ejection_time'); + validatePositiveDuration(obj, 'max_ejection_time'); + validatePercentage(obj, 'max_ejection_percent'); + if ('success_rate_ejection' in obj && + obj.success_rate_ejection !== undefined) { + if (typeof obj.success_rate_ejection !== 'object') { + throw new Error('outlier detection config success_rate_ejection must be an object'); + } + validateFieldType(obj.success_rate_ejection, 'stdev_factor', 'number', 'success_rate_ejection'); + validatePercentage(obj.success_rate_ejection, 'enforcement_percentage', 'success_rate_ejection'); + validateFieldType(obj.success_rate_ejection, 'minimum_hosts', 'number', 'success_rate_ejection'); + validateFieldType(obj.success_rate_ejection, 'request_volume', 'number', 'success_rate_ejection'); + } + if ('failure_percentage_ejection' in obj && + obj.failure_percentage_ejection !== undefined) { + if (typeof obj.failure_percentage_ejection !== 'object') { + throw new Error('outlier detection config failure_percentage_ejection must be an object'); + } + validatePercentage(obj.failure_percentage_ejection, 'threshold', 'failure_percentage_ejection'); + validatePercentage(obj.failure_percentage_ejection, 'enforcement_percentage', 'failure_percentage_ejection'); + validateFieldType(obj.failure_percentage_ejection, 'minimum_hosts', 'number', 'failure_percentage_ejection'); + validateFieldType(obj.failure_percentage_ejection, 'request_volume', 'number', 'failure_percentage_ejection'); + } + if (!('child_policy' in obj) || !Array.isArray(obj.child_policy)) { + throw new Error('outlier detection config child_policy must be an array'); + } + const childPolicy = (0, load_balancer_1.selectLbConfigFromList)(obj.child_policy); + if (!childPolicy) { + throw new Error('outlier detection config child_policy: no valid recognized policy found'); + } + return new OutlierDetectionLoadBalancingConfig(obj.interval ? (0, duration_1.durationToMs)(obj.interval) : null, obj.base_ejection_time ? (0, duration_1.durationToMs)(obj.base_ejection_time) : null, obj.max_ejection_time ? (0, duration_1.durationToMs)(obj.max_ejection_time) : null, (_a = obj.max_ejection_percent) !== null && _a !== void 0 ? _a : null, obj.success_rate_ejection, obj.failure_percentage_ejection, childPolicy); + } +} +exports.OutlierDetectionLoadBalancingConfig = OutlierDetectionLoadBalancingConfig; +class OutlierDetectionSubchannelWrapper extends subchannel_interface_1.BaseSubchannelWrapper { + constructor(childSubchannel, mapEntry) { + super(childSubchannel); + this.mapEntry = mapEntry; + this.refCount = 0; + } + ref() { + this.child.ref(); + this.refCount += 1; + } + unref() { + this.child.unref(); + this.refCount -= 1; + if (this.refCount <= 0) { + if (this.mapEntry) { + const index = this.mapEntry.subchannelWrappers.indexOf(this); + if (index >= 0) { + this.mapEntry.subchannelWrappers.splice(index, 1); + } + } + } + } + eject() { + this.setHealthy(false); + } + uneject() { + this.setHealthy(true); + } + getMapEntry() { + return this.mapEntry; + } + getWrappedSubchannel() { + return this.child; + } +} +function createEmptyBucket() { + return { + success: 0, + failure: 0, + }; +} +class CallCounter { + constructor() { + this.activeBucket = createEmptyBucket(); + this.inactiveBucket = createEmptyBucket(); + } + addSuccess() { + this.activeBucket.success += 1; + } + addFailure() { + this.activeBucket.failure += 1; + } + switchBuckets() { + this.inactiveBucket = this.activeBucket; + this.activeBucket = createEmptyBucket(); + } + getLastSuccesses() { + return this.inactiveBucket.success; + } + getLastFailures() { + return this.inactiveBucket.failure; + } +} +class OutlierDetectionPicker { + constructor(wrappedPicker, countCalls) { + this.wrappedPicker = wrappedPicker; + this.countCalls = countCalls; + } + pick(pickArgs) { + const wrappedPick = this.wrappedPicker.pick(pickArgs); + if (wrappedPick.pickResultType === picker_1.PickResultType.COMPLETE) { + const subchannelWrapper = wrappedPick.subchannel; + const mapEntry = subchannelWrapper.getMapEntry(); + if (mapEntry) { + let onCallEnded = wrappedPick.onCallEnded; + if (this.countCalls) { + onCallEnded = (statusCode, details, metadata) => { + var _a; + if (statusCode === constants_1.Status.OK) { + mapEntry.counter.addSuccess(); + } + else { + mapEntry.counter.addFailure(); + } + (_a = wrappedPick.onCallEnded) === null || _a === void 0 ? void 0 : _a.call(wrappedPick, statusCode, details, metadata); + }; + } + return Object.assign(Object.assign({}, wrappedPick), { subchannel: subchannelWrapper.getWrappedSubchannel(), onCallEnded: onCallEnded }); + } + else { + return Object.assign(Object.assign({}, wrappedPick), { subchannel: subchannelWrapper.getWrappedSubchannel() }); + } + } + else { + return wrappedPick; + } + } +} +class OutlierDetectionLoadBalancer { + constructor(channelControlHelper) { + this.entryMap = new subchannel_address_1.EndpointMap(); + this.latestConfig = null; + this.timerStartTime = null; + this.childBalancer = new load_balancer_child_handler_1.ChildLoadBalancerHandler((0, experimental_1.createChildChannelControlHelper)(channelControlHelper, { + createSubchannel: (subchannelAddress, subchannelArgs) => { + const originalSubchannel = channelControlHelper.createSubchannel(subchannelAddress, subchannelArgs); + const mapEntry = this.entryMap.getForSubchannelAddress(subchannelAddress); + const subchannelWrapper = new OutlierDetectionSubchannelWrapper(originalSubchannel, mapEntry); + if ((mapEntry === null || mapEntry === void 0 ? void 0 : mapEntry.currentEjectionTimestamp) !== null) { + // If the address is ejected, propagate that to the new subchannel wrapper + subchannelWrapper.eject(); + } + mapEntry === null || mapEntry === void 0 ? void 0 : mapEntry.subchannelWrappers.push(subchannelWrapper); + return subchannelWrapper; + }, + updateState: (connectivityState, picker, errorMessage) => { + if (connectivityState === connectivity_state_1.ConnectivityState.READY) { + channelControlHelper.updateState(connectivityState, new OutlierDetectionPicker(picker, this.isCountingEnabled()), errorMessage); + } + else { + channelControlHelper.updateState(connectivityState, picker, errorMessage); + } + }, + })); + this.ejectionTimer = setInterval(() => { }, 0); + clearInterval(this.ejectionTimer); + } + isCountingEnabled() { + return (this.latestConfig !== null && + (this.latestConfig.getSuccessRateEjectionConfig() !== null || + this.latestConfig.getFailurePercentageEjectionConfig() !== null)); + } + getCurrentEjectionPercent() { + let ejectionCount = 0; + for (const mapEntry of this.entryMap.values()) { + if (mapEntry.currentEjectionTimestamp !== null) { + ejectionCount += 1; + } + } + return (ejectionCount * 100) / this.entryMap.size; + } + runSuccessRateCheck(ejectionTimestamp) { + if (!this.latestConfig) { + return; + } + const successRateConfig = this.latestConfig.getSuccessRateEjectionConfig(); + if (!successRateConfig) { + return; + } + trace('Running success rate check'); + // Step 1 + const targetRequestVolume = successRateConfig.request_volume; + let addresesWithTargetVolume = 0; + const successRates = []; + for (const [endpoint, mapEntry] of this.entryMap.entries()) { + const successes = mapEntry.counter.getLastSuccesses(); + const failures = mapEntry.counter.getLastFailures(); + trace('Stats for ' + + (0, subchannel_address_1.endpointToString)(endpoint) + + ': successes=' + + successes + + ' failures=' + + failures + + ' targetRequestVolume=' + + targetRequestVolume); + if (successes + failures >= targetRequestVolume) { + addresesWithTargetVolume += 1; + successRates.push(successes / (successes + failures)); + } + } + trace('Found ' + + addresesWithTargetVolume + + ' success rate candidates; currentEjectionPercent=' + + this.getCurrentEjectionPercent() + + ' successRates=[' + + successRates + + ']'); + if (addresesWithTargetVolume < successRateConfig.minimum_hosts) { + return; + } + // Step 2 + const successRateMean = successRates.reduce((a, b) => a + b) / successRates.length; + let successRateDeviationSum = 0; + for (const rate of successRates) { + const deviation = rate - successRateMean; + successRateDeviationSum += deviation * deviation; + } + const successRateVariance = successRateDeviationSum / successRates.length; + const successRateStdev = Math.sqrt(successRateVariance); + const ejectionThreshold = successRateMean - + successRateStdev * (successRateConfig.stdev_factor / 1000); + trace('stdev=' + successRateStdev + ' ejectionThreshold=' + ejectionThreshold); + // Step 3 + for (const [address, mapEntry] of this.entryMap.entries()) { + // Step 3.i + if (this.getCurrentEjectionPercent() >= + this.latestConfig.getMaxEjectionPercent()) { + break; + } + // Step 3.ii + const successes = mapEntry.counter.getLastSuccesses(); + const failures = mapEntry.counter.getLastFailures(); + if (successes + failures < targetRequestVolume) { + continue; + } + // Step 3.iii + const successRate = successes / (successes + failures); + trace('Checking candidate ' + address + ' successRate=' + successRate); + if (successRate < ejectionThreshold) { + const randomNumber = Math.random() * 100; + trace('Candidate ' + + address + + ' randomNumber=' + + randomNumber + + ' enforcement_percentage=' + + successRateConfig.enforcement_percentage); + if (randomNumber < successRateConfig.enforcement_percentage) { + trace('Ejecting candidate ' + address); + this.eject(mapEntry, ejectionTimestamp); + } + } + } + } + runFailurePercentageCheck(ejectionTimestamp) { + if (!this.latestConfig) { + return; + } + const failurePercentageConfig = this.latestConfig.getFailurePercentageEjectionConfig(); + if (!failurePercentageConfig) { + return; + } + trace('Running failure percentage check. threshold=' + + failurePercentageConfig.threshold + + ' request volume threshold=' + + failurePercentageConfig.request_volume); + // Step 1 + let addressesWithTargetVolume = 0; + for (const mapEntry of this.entryMap.values()) { + const successes = mapEntry.counter.getLastSuccesses(); + const failures = mapEntry.counter.getLastFailures(); + if (successes + failures >= failurePercentageConfig.request_volume) { + addressesWithTargetVolume += 1; + } + } + if (addressesWithTargetVolume < failurePercentageConfig.minimum_hosts) { + return; + } + // Step 2 + for (const [address, mapEntry] of this.entryMap.entries()) { + // Step 2.i + if (this.getCurrentEjectionPercent() >= + this.latestConfig.getMaxEjectionPercent()) { + break; + } + // Step 2.ii + const successes = mapEntry.counter.getLastSuccesses(); + const failures = mapEntry.counter.getLastFailures(); + trace('Candidate successes=' + successes + ' failures=' + failures); + if (successes + failures < failurePercentageConfig.request_volume) { + continue; + } + // Step 2.iii + const failurePercentage = (failures * 100) / (failures + successes); + if (failurePercentage > failurePercentageConfig.threshold) { + const randomNumber = Math.random() * 100; + trace('Candidate ' + + address + + ' randomNumber=' + + randomNumber + + ' enforcement_percentage=' + + failurePercentageConfig.enforcement_percentage); + if (randomNumber < failurePercentageConfig.enforcement_percentage) { + trace('Ejecting candidate ' + address); + this.eject(mapEntry, ejectionTimestamp); + } + } + } + } + eject(mapEntry, ejectionTimestamp) { + mapEntry.currentEjectionTimestamp = new Date(); + mapEntry.ejectionTimeMultiplier += 1; + for (const subchannelWrapper of mapEntry.subchannelWrappers) { + subchannelWrapper.eject(); + } + } + uneject(mapEntry) { + mapEntry.currentEjectionTimestamp = null; + for (const subchannelWrapper of mapEntry.subchannelWrappers) { + subchannelWrapper.uneject(); + } + } + switchAllBuckets() { + for (const mapEntry of this.entryMap.values()) { + mapEntry.counter.switchBuckets(); + } + } + startTimer(delayMs) { + var _a, _b; + this.ejectionTimer = setTimeout(() => this.runChecks(), delayMs); + (_b = (_a = this.ejectionTimer).unref) === null || _b === void 0 ? void 0 : _b.call(_a); + } + runChecks() { + const ejectionTimestamp = new Date(); + trace('Ejection timer running'); + this.switchAllBuckets(); + if (!this.latestConfig) { + return; + } + this.timerStartTime = ejectionTimestamp; + this.startTimer(this.latestConfig.getIntervalMs()); + this.runSuccessRateCheck(ejectionTimestamp); + this.runFailurePercentageCheck(ejectionTimestamp); + for (const [address, mapEntry] of this.entryMap.entries()) { + if (mapEntry.currentEjectionTimestamp === null) { + if (mapEntry.ejectionTimeMultiplier > 0) { + mapEntry.ejectionTimeMultiplier -= 1; + } + } + else { + const baseEjectionTimeMs = this.latestConfig.getBaseEjectionTimeMs(); + const maxEjectionTimeMs = this.latestConfig.getMaxEjectionTimeMs(); + const returnTime = new Date(mapEntry.currentEjectionTimestamp.getTime()); + returnTime.setMilliseconds(returnTime.getMilliseconds() + + Math.min(baseEjectionTimeMs * mapEntry.ejectionTimeMultiplier, Math.max(baseEjectionTimeMs, maxEjectionTimeMs))); + if (returnTime < new Date()) { + trace('Unejecting ' + address); + this.uneject(mapEntry); + } + } + } + } + updateAddressList(endpointList, lbConfig, options, resolutionNote) { + if (!(lbConfig instanceof OutlierDetectionLoadBalancingConfig)) { + return false; + } + trace('Received update with config: ' + JSON.stringify(lbConfig.toJsonObject(), undefined, 2)); + if (endpointList.ok) { + for (const endpoint of endpointList.value) { + if (!this.entryMap.has(endpoint)) { + trace('Adding map entry for ' + (0, subchannel_address_1.endpointToString)(endpoint)); + this.entryMap.set(endpoint, { + counter: new CallCounter(), + currentEjectionTimestamp: null, + ejectionTimeMultiplier: 0, + subchannelWrappers: [], + }); + } + } + this.entryMap.deleteMissing(endpointList.value); + } + const childPolicy = lbConfig.getChildPolicy(); + this.childBalancer.updateAddressList(endpointList, childPolicy, options, resolutionNote); + if (lbConfig.getSuccessRateEjectionConfig() || + lbConfig.getFailurePercentageEjectionConfig()) { + if (this.timerStartTime) { + trace('Previous timer existed. Replacing timer'); + clearTimeout(this.ejectionTimer); + const remainingDelay = lbConfig.getIntervalMs() - + (new Date().getTime() - this.timerStartTime.getTime()); + this.startTimer(remainingDelay); + } + else { + trace('Starting new timer'); + this.timerStartTime = new Date(); + this.startTimer(lbConfig.getIntervalMs()); + this.switchAllBuckets(); + } + } + else { + trace('Counting disabled. Cancelling timer.'); + this.timerStartTime = null; + clearTimeout(this.ejectionTimer); + for (const mapEntry of this.entryMap.values()) { + this.uneject(mapEntry); + mapEntry.ejectionTimeMultiplier = 0; + } + } + this.latestConfig = lbConfig; + return true; + } + exitIdle() { + this.childBalancer.exitIdle(); + } + resetBackoff() { + this.childBalancer.resetBackoff(); + } + destroy() { + clearTimeout(this.ejectionTimer); + this.childBalancer.destroy(); + } + getTypeName() { + return TYPE_NAME; + } +} +exports.OutlierDetectionLoadBalancer = OutlierDetectionLoadBalancer; +function setup() { + if (OUTLIER_DETECTION_ENABLED) { + (0, experimental_1.registerLoadBalancerType)(TYPE_NAME, OutlierDetectionLoadBalancer, OutlierDetectionLoadBalancingConfig); + } +} +//# sourceMappingURL=load-balancer-outlier-detection.js.map + +/***/ }), + +/***/ 78639: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.LeafLoadBalancer = exports.PickFirstLoadBalancer = exports.PickFirstLoadBalancingConfig = void 0; +exports.shuffled = shuffled; +exports.setup = setup; +const load_balancer_1 = __nccwpck_require__(7000); +const connectivity_state_1 = __nccwpck_require__(60778); +const picker_1 = __nccwpck_require__(71663); +const subchannel_address_1 = __nccwpck_require__(97021); +const logging = __nccwpck_require__(8536); +const constants_1 = __nccwpck_require__(68288); +const subchannel_address_2 = __nccwpck_require__(97021); +const net_1 = __nccwpck_require__(69278); +const call_interface_1 = __nccwpck_require__(61803); +const TRACER_NAME = 'pick_first'; +function trace(text) { + logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text); +} +const TYPE_NAME = 'pick_first'; +/** + * Delay after starting a connection on a subchannel before starting a + * connection on the next subchannel in the list, for Happy Eyeballs algorithm. + */ +const CONNECTION_DELAY_INTERVAL_MS = 250; +class PickFirstLoadBalancingConfig { + constructor(shuffleAddressList) { + this.shuffleAddressList = shuffleAddressList; + } + getLoadBalancerName() { + return TYPE_NAME; + } + toJsonObject() { + return { + [TYPE_NAME]: { + shuffleAddressList: this.shuffleAddressList, + }, + }; + } + getShuffleAddressList() { + return this.shuffleAddressList; + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any + static createFromJson(obj) { + if ('shuffleAddressList' in obj && + !(typeof obj.shuffleAddressList === 'boolean')) { + throw new Error('pick_first config field shuffleAddressList must be a boolean if provided'); + } + return new PickFirstLoadBalancingConfig(obj.shuffleAddressList === true); + } +} +exports.PickFirstLoadBalancingConfig = PickFirstLoadBalancingConfig; +/** + * Picker for a `PickFirstLoadBalancer` in the READY state. Always returns the + * picked subchannel. + */ +class PickFirstPicker { + constructor(subchannel) { + this.subchannel = subchannel; + } + pick(pickArgs) { + return { + pickResultType: picker_1.PickResultType.COMPLETE, + subchannel: this.subchannel, + status: null, + onCallStarted: null, + onCallEnded: null, + }; + } +} +/** + * Return a new array with the elements of the input array in a random order + * @param list The input array + * @returns A shuffled array of the elements of list + */ +function shuffled(list) { + const result = list.slice(); + for (let i = result.length - 1; i > 1; i--) { + const j = Math.floor(Math.random() * (i + 1)); + const temp = result[i]; + result[i] = result[j]; + result[j] = temp; + } + return result; +} +/** + * Interleave addresses in addressList by family in accordance with RFC-8304 section 4 + * @param addressList + * @returns + */ +function interleaveAddressFamilies(addressList) { + if (addressList.length === 0) { + return []; + } + const result = []; + const ipv6Addresses = []; + const ipv4Addresses = []; + const ipv6First = (0, subchannel_address_2.isTcpSubchannelAddress)(addressList[0]) && (0, net_1.isIPv6)(addressList[0].host); + for (const address of addressList) { + if ((0, subchannel_address_2.isTcpSubchannelAddress)(address) && (0, net_1.isIPv6)(address.host)) { + ipv6Addresses.push(address); + } + else { + ipv4Addresses.push(address); + } + } + const firstList = ipv6First ? ipv6Addresses : ipv4Addresses; + const secondList = ipv6First ? ipv4Addresses : ipv6Addresses; + for (let i = 0; i < Math.max(firstList.length, secondList.length); i++) { + if (i < firstList.length) { + result.push(firstList[i]); + } + if (i < secondList.length) { + result.push(secondList[i]); + } + } + return result; +} +const REPORT_HEALTH_STATUS_OPTION_NAME = 'grpc-node.internal.pick-first.report_health_status'; +class PickFirstLoadBalancer { + /** + * Load balancer that attempts to connect to each backend in the address list + * in order, and picks the first one that connects, using it for every + * request. + * @param channelControlHelper `ChannelControlHelper` instance provided by + * this load balancer's owner. + */ + constructor(channelControlHelper) { + this.channelControlHelper = channelControlHelper; + /** + * The list of subchannels this load balancer is currently attempting to + * connect to. + */ + this.children = []; + /** + * The current connectivity state of the load balancer. + */ + this.currentState = connectivity_state_1.ConnectivityState.IDLE; + /** + * The index within the `subchannels` array of the subchannel with the most + * recently started connection attempt. + */ + this.currentSubchannelIndex = 0; + /** + * The currently picked subchannel used for making calls. Populated if + * and only if the load balancer's current state is READY. In that case, + * the subchannel's current state is also READY. + */ + this.currentPick = null; + /** + * Listener callback attached to each subchannel in the `subchannels` list + * while establishing a connection. + */ + this.subchannelStateListener = (subchannel, previousState, newState, keepaliveTime, errorMessage) => { + this.onSubchannelStateUpdate(subchannel, previousState, newState, errorMessage); + }; + this.pickedSubchannelHealthListener = () => this.calculateAndReportNewState(); + /** + * The LB policy enters sticky TRANSIENT_FAILURE mode when all + * subchannels have failed to connect at least once, and it stays in that + * mode until a connection attempt is successful. While in sticky TF mode, + * the LB policy continuously attempts to connect to all of its subchannels. + */ + this.stickyTransientFailureMode = false; + this.reportHealthStatus = false; + /** + * The most recent error reported by any subchannel as it transitioned to + * TRANSIENT_FAILURE. + */ + this.lastError = null; + this.latestAddressList = null; + this.latestOptions = {}; + this.latestResolutionNote = ''; + this.connectionDelayTimeout = setTimeout(() => { }, 0); + clearTimeout(this.connectionDelayTimeout); + } + allChildrenHaveReportedTF() { + return this.children.every(child => child.hasReportedTransientFailure); + } + resetChildrenReportedTF() { + this.children.every(child => child.hasReportedTransientFailure = false); + } + calculateAndReportNewState() { + var _a; + if (this.currentPick) { + if (this.reportHealthStatus && !this.currentPick.isHealthy()) { + const errorMessage = `Picked subchannel ${this.currentPick.getAddress()} is unhealthy`; + this.updateState(connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE, new picker_1.UnavailablePicker({ + details: errorMessage, + }), errorMessage); + } + else { + this.updateState(connectivity_state_1.ConnectivityState.READY, new PickFirstPicker(this.currentPick), null); + } + } + else if (((_a = this.latestAddressList) === null || _a === void 0 ? void 0 : _a.length) === 0) { + const errorMessage = `No connection established. Last error: ${this.lastError}. Resolution note: ${this.latestResolutionNote}`; + this.updateState(connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE, new picker_1.UnavailablePicker({ + details: errorMessage, + }), errorMessage); + } + else if (this.children.length === 0) { + this.updateState(connectivity_state_1.ConnectivityState.IDLE, new picker_1.QueuePicker(this), null); + } + else { + if (this.stickyTransientFailureMode) { + const errorMessage = `No connection established. Last error: ${this.lastError}. Resolution note: ${this.latestResolutionNote}`; + this.updateState(connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE, new picker_1.UnavailablePicker({ + details: errorMessage, + }), errorMessage); + } + else { + this.updateState(connectivity_state_1.ConnectivityState.CONNECTING, new picker_1.QueuePicker(this), null); + } + } + } + requestReresolution() { + this.channelControlHelper.requestReresolution(); + } + maybeEnterStickyTransientFailureMode() { + if (!this.allChildrenHaveReportedTF()) { + return; + } + this.requestReresolution(); + this.resetChildrenReportedTF(); + if (this.stickyTransientFailureMode) { + this.calculateAndReportNewState(); + return; + } + this.stickyTransientFailureMode = true; + for (const { subchannel } of this.children) { + subchannel.startConnecting(); + } + this.calculateAndReportNewState(); + } + removeCurrentPick() { + if (this.currentPick !== null) { + this.currentPick.removeConnectivityStateListener(this.subchannelStateListener); + this.channelControlHelper.removeChannelzChild(this.currentPick.getChannelzRef()); + this.currentPick.removeHealthStateWatcher(this.pickedSubchannelHealthListener); + // Unref last, to avoid triggering listeners + this.currentPick.unref(); + this.currentPick = null; + } + } + onSubchannelStateUpdate(subchannel, previousState, newState, errorMessage) { + var _a; + if ((_a = this.currentPick) === null || _a === void 0 ? void 0 : _a.realSubchannelEquals(subchannel)) { + if (newState !== connectivity_state_1.ConnectivityState.READY) { + this.removeCurrentPick(); + this.calculateAndReportNewState(); + } + return; + } + for (const [index, child] of this.children.entries()) { + if (subchannel.realSubchannelEquals(child.subchannel)) { + if (newState === connectivity_state_1.ConnectivityState.READY) { + this.pickSubchannel(child.subchannel); + } + if (newState === connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE) { + child.hasReportedTransientFailure = true; + if (errorMessage) { + this.lastError = errorMessage; + } + this.maybeEnterStickyTransientFailureMode(); + if (index === this.currentSubchannelIndex) { + this.startNextSubchannelConnecting(index + 1); + } + } + child.subchannel.startConnecting(); + return; + } + } + } + startNextSubchannelConnecting(startIndex) { + clearTimeout(this.connectionDelayTimeout); + for (const [index, child] of this.children.entries()) { + if (index >= startIndex) { + const subchannelState = child.subchannel.getConnectivityState(); + if (subchannelState === connectivity_state_1.ConnectivityState.IDLE || + subchannelState === connectivity_state_1.ConnectivityState.CONNECTING) { + this.startConnecting(index); + return; + } + } + } + this.maybeEnterStickyTransientFailureMode(); + } + /** + * Have a single subchannel in the `subchannels` list start connecting. + * @param subchannelIndex The index into the `subchannels` list. + */ + startConnecting(subchannelIndex) { + var _a, _b; + clearTimeout(this.connectionDelayTimeout); + this.currentSubchannelIndex = subchannelIndex; + if (this.children[subchannelIndex].subchannel.getConnectivityState() === + connectivity_state_1.ConnectivityState.IDLE) { + trace('Start connecting to subchannel with address ' + + this.children[subchannelIndex].subchannel.getAddress()); + process.nextTick(() => { + var _a; + (_a = this.children[subchannelIndex]) === null || _a === void 0 ? void 0 : _a.subchannel.startConnecting(); + }); + } + this.connectionDelayTimeout = setTimeout(() => { + this.startNextSubchannelConnecting(subchannelIndex + 1); + }, CONNECTION_DELAY_INTERVAL_MS); + (_b = (_a = this.connectionDelayTimeout).unref) === null || _b === void 0 ? void 0 : _b.call(_a); + } + /** + * Declare that the specified subchannel should be used to make requests. + * This functions the same independent of whether subchannel is a member of + * this.children and whether it is equal to this.currentPick. + * Prerequisite: subchannel.getConnectivityState() === READY. + * @param subchannel + */ + pickSubchannel(subchannel) { + trace('Pick subchannel with address ' + subchannel.getAddress()); + this.stickyTransientFailureMode = false; + /* Ref before removeCurrentPick and resetSubchannelList to avoid the + * refcount dropping to 0 during this process. */ + subchannel.ref(); + this.channelControlHelper.addChannelzChild(subchannel.getChannelzRef()); + this.removeCurrentPick(); + this.resetSubchannelList(); + subchannel.addConnectivityStateListener(this.subchannelStateListener); + subchannel.addHealthStateWatcher(this.pickedSubchannelHealthListener); + this.currentPick = subchannel; + clearTimeout(this.connectionDelayTimeout); + this.calculateAndReportNewState(); + } + updateState(newState, picker, errorMessage) { + trace(connectivity_state_1.ConnectivityState[this.currentState] + + ' -> ' + + connectivity_state_1.ConnectivityState[newState]); + this.currentState = newState; + this.channelControlHelper.updateState(newState, picker, errorMessage); + } + resetSubchannelList() { + for (const child of this.children) { + /* Always remoev the connectivity state listener. If the subchannel is + getting picked, it will be re-added then. */ + child.subchannel.removeConnectivityStateListener(this.subchannelStateListener); + /* Refs are counted independently for the children list and the + * currentPick, so we call unref whether or not the child is the + * currentPick. Channelz child references are also refcounted, so + * removeChannelzChild can be handled the same way. */ + child.subchannel.unref(); + this.channelControlHelper.removeChannelzChild(child.subchannel.getChannelzRef()); + } + this.currentSubchannelIndex = 0; + this.children = []; + } + connectToAddressList(addressList, options) { + trace('connectToAddressList([' + addressList.map(address => (0, subchannel_address_1.subchannelAddressToString)(address)) + '])'); + const newChildrenList = addressList.map(address => ({ + subchannel: this.channelControlHelper.createSubchannel(address, options), + hasReportedTransientFailure: false, + })); + for (const { subchannel } of newChildrenList) { + if (subchannel.getConnectivityState() === connectivity_state_1.ConnectivityState.READY) { + this.pickSubchannel(subchannel); + return; + } + } + /* Ref each subchannel before resetting the list, to ensure that + * subchannels shared between the list don't drop to 0 refs during the + * transition. */ + for (const { subchannel } of newChildrenList) { + subchannel.ref(); + this.channelControlHelper.addChannelzChild(subchannel.getChannelzRef()); + } + this.resetSubchannelList(); + this.children = newChildrenList; + for (const { subchannel } of this.children) { + subchannel.addConnectivityStateListener(this.subchannelStateListener); + } + for (const child of this.children) { + if (child.subchannel.getConnectivityState() === + connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE) { + child.hasReportedTransientFailure = true; + } + } + this.startNextSubchannelConnecting(0); + this.calculateAndReportNewState(); + } + updateAddressList(maybeEndpointList, lbConfig, options, resolutionNote) { + if (!(lbConfig instanceof PickFirstLoadBalancingConfig)) { + return false; + } + if (!maybeEndpointList.ok) { + if (this.children.length === 0 && this.currentPick === null) { + this.channelControlHelper.updateState(connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE, new picker_1.UnavailablePicker(maybeEndpointList.error), maybeEndpointList.error.details); + } + return true; + } + let endpointList = maybeEndpointList.value; + this.reportHealthStatus = options[REPORT_HEALTH_STATUS_OPTION_NAME]; + /* Previously, an update would be discarded if it was identical to the + * previous update, to minimize churn. Now the DNS resolver is + * rate-limited, so that is less of a concern. */ + if (lbConfig.getShuffleAddressList()) { + endpointList = shuffled(endpointList); + } + const rawAddressList = [].concat(...endpointList.map(endpoint => endpoint.addresses)); + trace('updateAddressList([' + rawAddressList.map(address => (0, subchannel_address_1.subchannelAddressToString)(address)) + '])'); + const addressList = interleaveAddressFamilies(rawAddressList); + this.latestAddressList = addressList; + this.latestOptions = options; + this.connectToAddressList(addressList, options); + this.latestResolutionNote = resolutionNote; + if (rawAddressList.length > 0) { + return true; + } + else { + this.lastError = 'No addresses resolved'; + return false; + } + } + exitIdle() { + if (this.currentState === connectivity_state_1.ConnectivityState.IDLE && + this.latestAddressList) { + this.connectToAddressList(this.latestAddressList, this.latestOptions); + } + } + resetBackoff() { + /* The pick first load balancer does not have a connection backoff, so this + * does nothing */ + } + destroy() { + this.resetSubchannelList(); + this.removeCurrentPick(); + } + getTypeName() { + return TYPE_NAME; + } +} +exports.PickFirstLoadBalancer = PickFirstLoadBalancer; +const LEAF_CONFIG = new PickFirstLoadBalancingConfig(false); +/** + * This class handles the leaf load balancing operations for a single endpoint. + * It is a thin wrapper around a PickFirstLoadBalancer with a different API + * that more closely reflects how it will be used as a leaf balancer. + */ +class LeafLoadBalancer { + constructor(endpoint, channelControlHelper, options, resolutionNote) { + this.endpoint = endpoint; + this.options = options; + this.resolutionNote = resolutionNote; + this.latestState = connectivity_state_1.ConnectivityState.IDLE; + const childChannelControlHelper = (0, load_balancer_1.createChildChannelControlHelper)(channelControlHelper, { + updateState: (connectivityState, picker, errorMessage) => { + this.latestState = connectivityState; + this.latestPicker = picker; + channelControlHelper.updateState(connectivityState, picker, errorMessage); + }, + }); + this.pickFirstBalancer = new PickFirstLoadBalancer(childChannelControlHelper); + this.latestPicker = new picker_1.QueuePicker(this.pickFirstBalancer); + } + startConnecting() { + this.pickFirstBalancer.updateAddressList((0, call_interface_1.statusOrFromValue)([this.endpoint]), LEAF_CONFIG, Object.assign(Object.assign({}, this.options), { [REPORT_HEALTH_STATUS_OPTION_NAME]: true }), this.resolutionNote); + } + /** + * Update the endpoint associated with this LeafLoadBalancer to a new + * endpoint. Does not trigger connection establishment if a connection + * attempt is not already in progress. + * @param newEndpoint + */ + updateEndpoint(newEndpoint, newOptions) { + this.options = newOptions; + this.endpoint = newEndpoint; + if (this.latestState !== connectivity_state_1.ConnectivityState.IDLE) { + this.startConnecting(); + } + } + getConnectivityState() { + return this.latestState; + } + getPicker() { + return this.latestPicker; + } + getEndpoint() { + return this.endpoint; + } + exitIdle() { + this.pickFirstBalancer.exitIdle(); + } + destroy() { + this.pickFirstBalancer.destroy(); + } +} +exports.LeafLoadBalancer = LeafLoadBalancer; +function setup() { + (0, load_balancer_1.registerLoadBalancerType)(TYPE_NAME, PickFirstLoadBalancer, PickFirstLoadBalancingConfig); + (0, load_balancer_1.registerDefaultLoadBalancerType)(TYPE_NAME); +} +//# sourceMappingURL=load-balancer-pick-first.js.map + +/***/ }), + +/***/ 71936: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.RoundRobinLoadBalancer = void 0; +exports.setup = setup; +const load_balancer_1 = __nccwpck_require__(7000); +const connectivity_state_1 = __nccwpck_require__(60778); +const picker_1 = __nccwpck_require__(71663); +const logging = __nccwpck_require__(8536); +const constants_1 = __nccwpck_require__(68288); +const subchannel_address_1 = __nccwpck_require__(97021); +const load_balancer_pick_first_1 = __nccwpck_require__(78639); +const TRACER_NAME = 'round_robin'; +function trace(text) { + logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text); +} +const TYPE_NAME = 'round_robin'; +class RoundRobinLoadBalancingConfig { + getLoadBalancerName() { + return TYPE_NAME; + } + constructor() { } + toJsonObject() { + return { + [TYPE_NAME]: {}, + }; + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any + static createFromJson(obj) { + return new RoundRobinLoadBalancingConfig(); + } +} +class RoundRobinPicker { + constructor(children, nextIndex = 0) { + this.children = children; + this.nextIndex = nextIndex; + } + pick(pickArgs) { + const childPicker = this.children[this.nextIndex].picker; + this.nextIndex = (this.nextIndex + 1) % this.children.length; + return childPicker.pick(pickArgs); + } + /** + * Check what the next subchannel returned would be. Used by the load + * balancer implementation to preserve this part of the picker state if + * possible when a subchannel connects or disconnects. + */ + peekNextEndpoint() { + return this.children[this.nextIndex].endpoint; + } +} +function rotateArray(list, startIndex) { + return [...list.slice(startIndex), ...list.slice(0, startIndex)]; +} +class RoundRobinLoadBalancer { + constructor(channelControlHelper) { + this.channelControlHelper = channelControlHelper; + this.children = []; + this.currentState = connectivity_state_1.ConnectivityState.IDLE; + this.currentReadyPicker = null; + this.updatesPaused = false; + this.lastError = null; + this.childChannelControlHelper = (0, load_balancer_1.createChildChannelControlHelper)(channelControlHelper, { + updateState: (connectivityState, picker, errorMessage) => { + /* Ensure that name resolution is requested again after active + * connections are dropped. This is more aggressive than necessary to + * accomplish that, so we are counting on resolvers to have + * reasonable rate limits. */ + if (this.currentState === connectivity_state_1.ConnectivityState.READY && connectivityState !== connectivity_state_1.ConnectivityState.READY) { + this.channelControlHelper.requestReresolution(); + } + if (errorMessage) { + this.lastError = errorMessage; + } + this.calculateAndUpdateState(); + }, + }); + } + countChildrenWithState(state) { + return this.children.filter(child => child.getConnectivityState() === state) + .length; + } + calculateAndUpdateState() { + if (this.updatesPaused) { + return; + } + if (this.countChildrenWithState(connectivity_state_1.ConnectivityState.READY) > 0) { + const readyChildren = this.children.filter(child => child.getConnectivityState() === connectivity_state_1.ConnectivityState.READY); + let index = 0; + if (this.currentReadyPicker !== null) { + const nextPickedEndpoint = this.currentReadyPicker.peekNextEndpoint(); + index = readyChildren.findIndex(child => (0, subchannel_address_1.endpointEqual)(child.getEndpoint(), nextPickedEndpoint)); + if (index < 0) { + index = 0; + } + } + this.updateState(connectivity_state_1.ConnectivityState.READY, new RoundRobinPicker(readyChildren.map(child => ({ + endpoint: child.getEndpoint(), + picker: child.getPicker(), + })), index), null); + } + else if (this.countChildrenWithState(connectivity_state_1.ConnectivityState.CONNECTING) > 0) { + this.updateState(connectivity_state_1.ConnectivityState.CONNECTING, new picker_1.QueuePicker(this), null); + } + else if (this.countChildrenWithState(connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE) > 0) { + const errorMessage = `round_robin: No connection established. Last error: ${this.lastError}`; + this.updateState(connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE, new picker_1.UnavailablePicker({ + details: errorMessage, + }), errorMessage); + } + else { + this.updateState(connectivity_state_1.ConnectivityState.IDLE, new picker_1.QueuePicker(this), null); + } + /* round_robin should keep all children connected, this is how we do that. + * We can't do this more efficiently in the individual child's updateState + * callback because that doesn't have a reference to which child the state + * change is associated with. */ + for (const child of this.children) { + if (child.getConnectivityState() === connectivity_state_1.ConnectivityState.IDLE) { + child.exitIdle(); + } + } + } + updateState(newState, picker, errorMessage) { + trace(connectivity_state_1.ConnectivityState[this.currentState] + + ' -> ' + + connectivity_state_1.ConnectivityState[newState]); + if (newState === connectivity_state_1.ConnectivityState.READY) { + this.currentReadyPicker = picker; + } + else { + this.currentReadyPicker = null; + } + this.currentState = newState; + this.channelControlHelper.updateState(newState, picker, errorMessage); + } + resetSubchannelList() { + for (const child of this.children) { + child.destroy(); + } + this.children = []; + } + updateAddressList(maybeEndpointList, lbConfig, options, resolutionNote) { + if (!(lbConfig instanceof RoundRobinLoadBalancingConfig)) { + return false; + } + if (!maybeEndpointList.ok) { + if (this.children.length === 0) { + this.updateState(connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE, new picker_1.UnavailablePicker(maybeEndpointList.error), maybeEndpointList.error.details); + } + return true; + } + const startIndex = (Math.random() * maybeEndpointList.value.length) | 0; + const endpointList = rotateArray(maybeEndpointList.value, startIndex); + this.resetSubchannelList(); + if (endpointList.length === 0) { + const errorMessage = `No addresses resolved. Resolution note: ${resolutionNote}`; + this.updateState(connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE, new picker_1.UnavailablePicker({ details: errorMessage }), errorMessage); + } + trace('Connect to endpoint list ' + endpointList.map(subchannel_address_1.endpointToString)); + this.updatesPaused = true; + this.children = endpointList.map(endpoint => new load_balancer_pick_first_1.LeafLoadBalancer(endpoint, this.childChannelControlHelper, options, resolutionNote)); + for (const child of this.children) { + child.startConnecting(); + } + this.updatesPaused = false; + this.calculateAndUpdateState(); + return true; + } + exitIdle() { + /* The round_robin LB policy is only in the IDLE state if it has no + * addresses to try to connect to and it has no picked subchannel. + * In that case, there is no meaningful action that can be taken here. */ + } + resetBackoff() { + // This LB policy has no backoff to reset + } + destroy() { + this.resetSubchannelList(); + } + getTypeName() { + return TYPE_NAME; + } +} +exports.RoundRobinLoadBalancer = RoundRobinLoadBalancer; +function setup() { + (0, load_balancer_1.registerLoadBalancerType)(TYPE_NAME, RoundRobinLoadBalancer, RoundRobinLoadBalancingConfig); +} +//# sourceMappingURL=load-balancer-round-robin.js.map + +/***/ }), + +/***/ 47616: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2025 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.WeightedRoundRobinLoadBalancingConfig = void 0; +exports.setup = setup; +const connectivity_state_1 = __nccwpck_require__(60778); +const constants_1 = __nccwpck_require__(68288); +const duration_1 = __nccwpck_require__(63929); +const load_balancer_1 = __nccwpck_require__(7000); +const load_balancer_pick_first_1 = __nccwpck_require__(78639); +const logging = __nccwpck_require__(8536); +const orca_1 = __nccwpck_require__(82124); +const picker_1 = __nccwpck_require__(71663); +const priority_queue_1 = __nccwpck_require__(58291); +const subchannel_address_1 = __nccwpck_require__(97021); +const TRACER_NAME = 'weighted_round_robin'; +function trace(text) { + logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text); +} +const TYPE_NAME = 'weighted_round_robin'; +const DEFAULT_OOB_REPORTING_PERIOD_MS = 10000; +const DEFAULT_BLACKOUT_PERIOD_MS = 10000; +const DEFAULT_WEIGHT_EXPIRATION_PERIOD_MS = 3 * 60000; +const DEFAULT_WEIGHT_UPDATE_PERIOD_MS = 1000; +const DEFAULT_ERROR_UTILIZATION_PENALTY = 1; +function validateFieldType(obj, fieldName, expectedType) { + if (fieldName in obj && + obj[fieldName] !== undefined && + typeof obj[fieldName] !== expectedType) { + throw new Error(`weighted round robin config ${fieldName} parse error: expected ${expectedType}, got ${typeof obj[fieldName]}`); + } +} +function parseDurationField(obj, fieldName) { + if (fieldName in obj && obj[fieldName] !== undefined && obj[fieldName] !== null) { + let durationObject; + if ((0, duration_1.isDuration)(obj[fieldName])) { + durationObject = obj[fieldName]; + } + else if ((0, duration_1.isDurationMessage)(obj[fieldName])) { + durationObject = (0, duration_1.durationMessageToDuration)(obj[fieldName]); + } + else if (typeof obj[fieldName] === 'string') { + const parsedDuration = (0, duration_1.parseDuration)(obj[fieldName]); + if (!parsedDuration) { + throw new Error(`weighted round robin config ${fieldName}: failed to parse duration string ${obj[fieldName]}`); + } + durationObject = parsedDuration; + } + else { + throw new Error(`weighted round robin config ${fieldName}: expected duration, got ${typeof obj[fieldName]}`); + } + return (0, duration_1.durationToMs)(durationObject); + } + return null; +} +class WeightedRoundRobinLoadBalancingConfig { + constructor(enableOobLoadReport, oobLoadReportingPeriodMs, blackoutPeriodMs, weightExpirationPeriodMs, weightUpdatePeriodMs, errorUtilizationPenalty) { + this.enableOobLoadReport = enableOobLoadReport !== null && enableOobLoadReport !== void 0 ? enableOobLoadReport : false; + this.oobLoadReportingPeriodMs = oobLoadReportingPeriodMs !== null && oobLoadReportingPeriodMs !== void 0 ? oobLoadReportingPeriodMs : DEFAULT_OOB_REPORTING_PERIOD_MS; + this.blackoutPeriodMs = blackoutPeriodMs !== null && blackoutPeriodMs !== void 0 ? blackoutPeriodMs : DEFAULT_BLACKOUT_PERIOD_MS; + this.weightExpirationPeriodMs = weightExpirationPeriodMs !== null && weightExpirationPeriodMs !== void 0 ? weightExpirationPeriodMs : DEFAULT_WEIGHT_EXPIRATION_PERIOD_MS; + this.weightUpdatePeriodMs = Math.max(weightUpdatePeriodMs !== null && weightUpdatePeriodMs !== void 0 ? weightUpdatePeriodMs : DEFAULT_WEIGHT_UPDATE_PERIOD_MS, 100); + this.errorUtilizationPenalty = errorUtilizationPenalty !== null && errorUtilizationPenalty !== void 0 ? errorUtilizationPenalty : DEFAULT_ERROR_UTILIZATION_PENALTY; + } + getLoadBalancerName() { + return TYPE_NAME; + } + toJsonObject() { + return { + enable_oob_load_report: this.enableOobLoadReport, + oob_load_reporting_period: (0, duration_1.durationToString)((0, duration_1.msToDuration)(this.oobLoadReportingPeriodMs)), + blackout_period: (0, duration_1.durationToString)((0, duration_1.msToDuration)(this.blackoutPeriodMs)), + weight_expiration_period: (0, duration_1.durationToString)((0, duration_1.msToDuration)(this.weightExpirationPeriodMs)), + weight_update_period: (0, duration_1.durationToString)((0, duration_1.msToDuration)(this.weightUpdatePeriodMs)), + error_utilization_penalty: this.errorUtilizationPenalty + }; + } + static createFromJson(obj) { + validateFieldType(obj, 'enable_oob_load_report', 'boolean'); + validateFieldType(obj, 'error_utilization_penalty', 'number'); + if (obj.error_utilization_penalty < 0) { + throw new Error('weighted round robin config error_utilization_penalty < 0'); + } + return new WeightedRoundRobinLoadBalancingConfig(obj.enable_oob_load_report, parseDurationField(obj, 'oob_load_reporting_period'), parseDurationField(obj, 'blackout_period'), parseDurationField(obj, 'weight_expiration_period'), parseDurationField(obj, 'weight_update_period'), obj.error_utilization_penalty); + } + getEnableOobLoadReport() { + return this.enableOobLoadReport; + } + getOobLoadReportingPeriodMs() { + return this.oobLoadReportingPeriodMs; + } + getBlackoutPeriodMs() { + return this.blackoutPeriodMs; + } + getWeightExpirationPeriodMs() { + return this.weightExpirationPeriodMs; + } + getWeightUpdatePeriodMs() { + return this.weightUpdatePeriodMs; + } + getErrorUtilizationPenalty() { + return this.errorUtilizationPenalty; + } +} +exports.WeightedRoundRobinLoadBalancingConfig = WeightedRoundRobinLoadBalancingConfig; +class WeightedRoundRobinPicker { + constructor(children, metricsHandler) { + this.metricsHandler = metricsHandler; + this.queue = new priority_queue_1.PriorityQueue((a, b) => a.deadline < b.deadline); + const positiveWeight = children.filter(picker => picker.weight > 0); + let averageWeight; + if (positiveWeight.length < 2) { + averageWeight = 1; + } + else { + let weightSum = 0; + for (const { weight } of positiveWeight) { + weightSum += weight; + } + averageWeight = weightSum / positiveWeight.length; + } + for (const child of children) { + const period = child.weight > 0 ? 1 / child.weight : averageWeight; + this.queue.push({ + endpointName: child.endpointName, + picker: child.picker, + period: period, + deadline: Math.random() * period + }); + } + } + pick(pickArgs) { + const entry = this.queue.pop(); + this.queue.push(Object.assign(Object.assign({}, entry), { deadline: entry.deadline + entry.period })); + const childPick = entry.picker.pick(pickArgs); + if (childPick.pickResultType === picker_1.PickResultType.COMPLETE) { + if (this.metricsHandler) { + return Object.assign(Object.assign({}, childPick), { onCallEnded: (0, orca_1.createMetricsReader)(loadReport => this.metricsHandler(loadReport, entry.endpointName), childPick.onCallEnded) }); + } + else { + const subchannelWrapper = childPick.subchannel; + return Object.assign(Object.assign({}, childPick), { subchannel: subchannelWrapper.getWrappedSubchannel() }); + } + } + else { + return childPick; + } + } +} +class WeightedRoundRobinLoadBalancer { + constructor(channelControlHelper) { + this.channelControlHelper = channelControlHelper; + this.latestConfig = null; + this.children = new Map(); + this.currentState = connectivity_state_1.ConnectivityState.IDLE; + this.updatesPaused = false; + this.lastError = null; + this.weightUpdateTimer = null; + } + countChildrenWithState(state) { + let count = 0; + for (const entry of this.children.values()) { + if (entry.child.getConnectivityState() === state) { + count += 1; + } + } + return count; + } + updateWeight(entry, loadReport) { + var _a, _b; + const qps = loadReport.rps_fractional; + let utilization = loadReport.application_utilization; + if (utilization > 0 && qps > 0) { + utilization += (loadReport.eps / qps) * ((_b = (_a = this.latestConfig) === null || _a === void 0 ? void 0 : _a.getErrorUtilizationPenalty()) !== null && _b !== void 0 ? _b : 0); + } + const newWeight = utilization === 0 ? 0 : qps / utilization; + if (newWeight === 0) { + return; + } + const now = new Date(); + if (entry.nonEmptySince === null) { + entry.nonEmptySince = now; + } + entry.lastUpdated = now; + entry.weight = newWeight; + } + getWeight(entry) { + if (!this.latestConfig) { + return 0; + } + const now = new Date().getTime(); + if (now - entry.lastUpdated.getTime() >= this.latestConfig.getWeightExpirationPeriodMs()) { + entry.nonEmptySince = null; + return 0; + } + const blackoutPeriod = this.latestConfig.getBlackoutPeriodMs(); + if (blackoutPeriod > 0 && (entry.nonEmptySince === null || now - entry.nonEmptySince.getTime() < blackoutPeriod)) { + return 0; + } + return entry.weight; + } + calculateAndUpdateState() { + if (this.updatesPaused || !this.latestConfig) { + return; + } + if (this.countChildrenWithState(connectivity_state_1.ConnectivityState.READY) > 0) { + const weightedPickers = []; + for (const [endpoint, entry] of this.children) { + if (entry.child.getConnectivityState() !== connectivity_state_1.ConnectivityState.READY) { + continue; + } + weightedPickers.push({ + endpointName: endpoint, + picker: entry.child.getPicker(), + weight: this.getWeight(entry) + }); + } + trace('Created picker with weights: ' + weightedPickers.map(entry => entry.endpointName + ':' + entry.weight).join(',')); + let metricsHandler; + if (!this.latestConfig.getEnableOobLoadReport()) { + metricsHandler = (loadReport, endpointName) => { + const childEntry = this.children.get(endpointName); + if (childEntry) { + this.updateWeight(childEntry, loadReport); + } + }; + } + else { + metricsHandler = null; + } + this.updateState(connectivity_state_1.ConnectivityState.READY, new WeightedRoundRobinPicker(weightedPickers, metricsHandler), null); + } + else if (this.countChildrenWithState(connectivity_state_1.ConnectivityState.CONNECTING) > 0) { + this.updateState(connectivity_state_1.ConnectivityState.CONNECTING, new picker_1.QueuePicker(this), null); + } + else if (this.countChildrenWithState(connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE) > 0) { + const errorMessage = `weighted_round_robin: No connection established. Last error: ${this.lastError}`; + this.updateState(connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE, new picker_1.UnavailablePicker({ + details: errorMessage, + }), errorMessage); + } + else { + this.updateState(connectivity_state_1.ConnectivityState.IDLE, new picker_1.QueuePicker(this), null); + } + /* round_robin should keep all children connected, this is how we do that. + * We can't do this more efficiently in the individual child's updateState + * callback because that doesn't have a reference to which child the state + * change is associated with. */ + for (const { child } of this.children.values()) { + if (child.getConnectivityState() === connectivity_state_1.ConnectivityState.IDLE) { + child.exitIdle(); + } + } + } + updateState(newState, picker, errorMessage) { + trace(connectivity_state_1.ConnectivityState[this.currentState] + + ' -> ' + + connectivity_state_1.ConnectivityState[newState]); + this.currentState = newState; + this.channelControlHelper.updateState(newState, picker, errorMessage); + } + updateAddressList(maybeEndpointList, lbConfig, options, resolutionNote) { + var _a, _b; + if (!(lbConfig instanceof WeightedRoundRobinLoadBalancingConfig)) { + return false; + } + if (!maybeEndpointList.ok) { + if (this.children.size === 0) { + this.updateState(connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE, new picker_1.UnavailablePicker(maybeEndpointList.error), maybeEndpointList.error.details); + } + return true; + } + if (maybeEndpointList.value.length === 0) { + const errorMessage = `No addresses resolved. Resolution note: ${resolutionNote}`; + this.updateState(connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE, new picker_1.UnavailablePicker({ details: errorMessage }), errorMessage); + return false; + } + trace('Connect to endpoint list ' + maybeEndpointList.value.map(subchannel_address_1.endpointToString)); + const now = new Date(); + const seenEndpointNames = new Set(); + this.updatesPaused = true; + this.latestConfig = lbConfig; + for (const endpoint of maybeEndpointList.value) { + const name = (0, subchannel_address_1.endpointToString)(endpoint); + seenEndpointNames.add(name); + let entry = this.children.get(name); + if (!entry) { + entry = { + child: new load_balancer_pick_first_1.LeafLoadBalancer(endpoint, (0, load_balancer_1.createChildChannelControlHelper)(this.channelControlHelper, { + updateState: (connectivityState, picker, errorMessage) => { + /* Ensure that name resolution is requested again after active + * connections are dropped. This is more aggressive than necessary to + * accomplish that, so we are counting on resolvers to have + * reasonable rate limits. */ + if (this.currentState === connectivity_state_1.ConnectivityState.READY && connectivityState !== connectivity_state_1.ConnectivityState.READY) { + this.channelControlHelper.requestReresolution(); + } + if (connectivityState === connectivity_state_1.ConnectivityState.READY) { + entry.nonEmptySince = null; + } + if (errorMessage) { + this.lastError = errorMessage; + } + this.calculateAndUpdateState(); + }, + createSubchannel: (subchannelAddress, subchannelArgs) => { + const subchannel = this.channelControlHelper.createSubchannel(subchannelAddress, subchannelArgs); + if (entry === null || entry === void 0 ? void 0 : entry.oobMetricsListener) { + return new orca_1.OrcaOobMetricsSubchannelWrapper(subchannel, entry.oobMetricsListener, this.latestConfig.getOobLoadReportingPeriodMs()); + } + else { + return subchannel; + } + } + }), options, resolutionNote), + lastUpdated: now, + nonEmptySince: null, + weight: 0, + oobMetricsListener: null + }; + this.children.set(name, entry); + } + if (lbConfig.getEnableOobLoadReport()) { + entry.oobMetricsListener = loadReport => { + this.updateWeight(entry, loadReport); + }; + } + else { + entry.oobMetricsListener = null; + } + } + for (const [endpointName, entry] of this.children) { + if (seenEndpointNames.has(endpointName)) { + entry.child.startConnecting(); + } + else { + entry.child.destroy(); + this.children.delete(endpointName); + } + } + this.updatesPaused = false; + this.calculateAndUpdateState(); + if (this.weightUpdateTimer) { + clearInterval(this.weightUpdateTimer); + } + this.weightUpdateTimer = (_b = (_a = setInterval(() => { + if (this.currentState === connectivity_state_1.ConnectivityState.READY) { + this.calculateAndUpdateState(); + } + }, lbConfig.getWeightUpdatePeriodMs())).unref) === null || _b === void 0 ? void 0 : _b.call(_a); + return true; + } + exitIdle() { + /* The weighted_round_robin LB policy is only in the IDLE state if it has + * no addresses to try to connect to and it has no picked subchannel. + * In that case, there is no meaningful action that can be taken here. */ + } + resetBackoff() { + // This LB policy has no backoff to reset + } + destroy() { + for (const entry of this.children.values()) { + entry.child.destroy(); + } + this.children.clear(); + if (this.weightUpdateTimer) { + clearInterval(this.weightUpdateTimer); + } + } + getTypeName() { + return TYPE_NAME; + } +} +function setup() { + (0, load_balancer_1.registerLoadBalancerType)(TYPE_NAME, WeightedRoundRobinLoadBalancer, WeightedRoundRobinLoadBalancingConfig); +} +//# sourceMappingURL=load-balancer-weighted-round-robin.js.map + +/***/ }), + +/***/ 7000: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createChildChannelControlHelper = createChildChannelControlHelper; +exports.registerLoadBalancerType = registerLoadBalancerType; +exports.registerDefaultLoadBalancerType = registerDefaultLoadBalancerType; +exports.createLoadBalancer = createLoadBalancer; +exports.isLoadBalancerNameRegistered = isLoadBalancerNameRegistered; +exports.parseLoadBalancingConfig = parseLoadBalancingConfig; +exports.getDefaultConfig = getDefaultConfig; +exports.selectLbConfigFromList = selectLbConfigFromList; +const logging_1 = __nccwpck_require__(8536); +const constants_1 = __nccwpck_require__(68288); +/** + * Create a child ChannelControlHelper that overrides some methods of the + * parent while letting others pass through to the parent unmodified. This + * allows other code to create these children without needing to know about + * all of the methods to be passed through. + * @param parent + * @param overrides + */ +function createChildChannelControlHelper(parent, overrides) { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k; + return { + createSubchannel: (_b = (_a = overrides.createSubchannel) === null || _a === void 0 ? void 0 : _a.bind(overrides)) !== null && _b !== void 0 ? _b : parent.createSubchannel.bind(parent), + updateState: (_d = (_c = overrides.updateState) === null || _c === void 0 ? void 0 : _c.bind(overrides)) !== null && _d !== void 0 ? _d : parent.updateState.bind(parent), + requestReresolution: (_f = (_e = overrides.requestReresolution) === null || _e === void 0 ? void 0 : _e.bind(overrides)) !== null && _f !== void 0 ? _f : parent.requestReresolution.bind(parent), + addChannelzChild: (_h = (_g = overrides.addChannelzChild) === null || _g === void 0 ? void 0 : _g.bind(overrides)) !== null && _h !== void 0 ? _h : parent.addChannelzChild.bind(parent), + removeChannelzChild: (_k = (_j = overrides.removeChannelzChild) === null || _j === void 0 ? void 0 : _j.bind(overrides)) !== null && _k !== void 0 ? _k : parent.removeChannelzChild.bind(parent), + }; +} +const registeredLoadBalancerTypes = {}; +let defaultLoadBalancerType = null; +function registerLoadBalancerType(typeName, loadBalancerType, loadBalancingConfigType) { + registeredLoadBalancerTypes[typeName] = { + LoadBalancer: loadBalancerType, + LoadBalancingConfig: loadBalancingConfigType, + }; +} +function registerDefaultLoadBalancerType(typeName) { + defaultLoadBalancerType = typeName; +} +function createLoadBalancer(config, channelControlHelper) { + const typeName = config.getLoadBalancerName(); + if (typeName in registeredLoadBalancerTypes) { + return new registeredLoadBalancerTypes[typeName].LoadBalancer(channelControlHelper); + } + else { + return null; + } +} +function isLoadBalancerNameRegistered(typeName) { + return typeName in registeredLoadBalancerTypes; +} +function parseLoadBalancingConfig(rawConfig) { + const keys = Object.keys(rawConfig); + if (keys.length !== 1) { + throw new Error('Provided load balancing config has multiple conflicting entries'); + } + const typeName = keys[0]; + if (typeName in registeredLoadBalancerTypes) { + try { + return registeredLoadBalancerTypes[typeName].LoadBalancingConfig.createFromJson(rawConfig[typeName]); + } + catch (e) { + throw new Error(`${typeName}: ${e.message}`); + } + } + else { + throw new Error(`Unrecognized load balancing config name ${typeName}`); + } +} +function getDefaultConfig() { + if (!defaultLoadBalancerType) { + throw new Error('No default load balancer type registered'); + } + return new registeredLoadBalancerTypes[defaultLoadBalancerType].LoadBalancingConfig(); +} +function selectLbConfigFromList(configs, fallbackTodefault = false) { + for (const config of configs) { + try { + return parseLoadBalancingConfig(config); + } + catch (e) { + (0, logging_1.log)(constants_1.LogVerbosity.DEBUG, 'Config parsing failed with error', e.message); + continue; + } + } + if (fallbackTodefault) { + if (defaultLoadBalancerType) { + return new registeredLoadBalancerTypes[defaultLoadBalancerType].LoadBalancingConfig(); + } + else { + return null; + } + } + else { + return null; + } +} +//# sourceMappingURL=load-balancer.js.map + +/***/ }), + +/***/ 58944: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2022 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.LoadBalancingCall = void 0; +const connectivity_state_1 = __nccwpck_require__(60778); +const constants_1 = __nccwpck_require__(68288); +const deadline_1 = __nccwpck_require__(52173); +const metadata_1 = __nccwpck_require__(36100); +const picker_1 = __nccwpck_require__(71663); +const uri_parser_1 = __nccwpck_require__(56027); +const logging = __nccwpck_require__(8536); +const control_plane_status_1 = __nccwpck_require__(39962); +const http2 = __nccwpck_require__(85675); +const TRACER_NAME = 'load_balancing_call'; +class LoadBalancingCall { + constructor(channel, callConfig, methodName, host, credentials, deadline, callNumber) { + var _a, _b; + this.channel = channel; + this.callConfig = callConfig; + this.methodName = methodName; + this.host = host; + this.credentials = credentials; + this.deadline = deadline; + this.callNumber = callNumber; + this.child = null; + this.readPending = false; + this.pendingMessage = null; + this.pendingHalfClose = false; + this.ended = false; + this.metadata = null; + this.listener = null; + this.onCallEnded = null; + this.childStartTime = null; + const splitPath = this.methodName.split('/'); + let serviceName = ''; + /* The standard path format is "/{serviceName}/{methodName}", so if we split + * by '/', the first item should be empty and the second should be the + * service name */ + if (splitPath.length >= 2) { + serviceName = splitPath[1]; + } + const hostname = (_b = (_a = (0, uri_parser_1.splitHostPort)(this.host)) === null || _a === void 0 ? void 0 : _a.host) !== null && _b !== void 0 ? _b : 'localhost'; + /* Currently, call credentials are only allowed on HTTPS connections, so we + * can assume that the scheme is "https" */ + this.serviceUrl = `https://${hostname}/${serviceName}`; + this.startTime = new Date(); + } + getDeadlineInfo() { + var _a, _b; + const deadlineInfo = []; + if (this.childStartTime) { + if (this.childStartTime > this.startTime) { + if ((_a = this.metadata) === null || _a === void 0 ? void 0 : _a.getOptions().waitForReady) { + deadlineInfo.push('wait_for_ready'); + } + deadlineInfo.push(`LB pick: ${(0, deadline_1.formatDateDifference)(this.startTime, this.childStartTime)}`); + } + deadlineInfo.push(...this.child.getDeadlineInfo()); + return deadlineInfo; + } + else { + if ((_b = this.metadata) === null || _b === void 0 ? void 0 : _b.getOptions().waitForReady) { + deadlineInfo.push('wait_for_ready'); + } + deadlineInfo.push('Waiting for LB pick'); + } + return deadlineInfo; + } + trace(text) { + logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, '[' + this.callNumber + '] ' + text); + } + outputStatus(status, progress) { + var _a, _b; + if (!this.ended) { + this.ended = true; + this.trace('ended with status: code=' + + status.code + + ' details="' + + status.details + + '" start time=' + + this.startTime.toISOString()); + const finalStatus = Object.assign(Object.assign({}, status), { progress }); + (_a = this.listener) === null || _a === void 0 ? void 0 : _a.onReceiveStatus(finalStatus); + (_b = this.onCallEnded) === null || _b === void 0 ? void 0 : _b.call(this, finalStatus.code, finalStatus.details, finalStatus.metadata); + } + } + doPick() { + var _a, _b; + if (this.ended) { + return; + } + if (!this.metadata) { + throw new Error('doPick called before start'); + } + this.trace('Pick called'); + const finalMetadata = this.metadata.clone(); + const pickResult = this.channel.doPick(finalMetadata, this.callConfig.pickInformation); + const subchannelString = pickResult.subchannel + ? '(' + + pickResult.subchannel.getChannelzRef().id + + ') ' + + pickResult.subchannel.getAddress() + : '' + pickResult.subchannel; + this.trace('Pick result: ' + + picker_1.PickResultType[pickResult.pickResultType] + + ' subchannel: ' + + subchannelString + + ' status: ' + + ((_a = pickResult.status) === null || _a === void 0 ? void 0 : _a.code) + + ' ' + + ((_b = pickResult.status) === null || _b === void 0 ? void 0 : _b.details)); + switch (pickResult.pickResultType) { + case picker_1.PickResultType.COMPLETE: + const combinedCallCredentials = this.credentials.compose(pickResult.subchannel.getCallCredentials()); + combinedCallCredentials + .generateMetadata({ method_name: this.methodName, service_url: this.serviceUrl }) + .then(credsMetadata => { + var _a; + /* If this call was cancelled (e.g. by the deadline) before + * metadata generation finished, we shouldn't do anything with + * it. */ + if (this.ended) { + this.trace('Credentials metadata generation finished after call ended'); + return; + } + finalMetadata.merge(credsMetadata); + if (finalMetadata.get('authorization').length > 1) { + this.outputStatus({ + code: constants_1.Status.INTERNAL, + details: '"authorization" metadata cannot have multiple values', + metadata: new metadata_1.Metadata(), + }, 'PROCESSED'); + } + if (pickResult.subchannel.getConnectivityState() !== + connectivity_state_1.ConnectivityState.READY) { + this.trace('Picked subchannel ' + + subchannelString + + ' has state ' + + connectivity_state_1.ConnectivityState[pickResult.subchannel.getConnectivityState()] + + ' after getting credentials metadata. Retrying pick'); + this.doPick(); + return; + } + if (this.deadline !== Infinity) { + finalMetadata.set('grpc-timeout', (0, deadline_1.getDeadlineTimeoutString)(this.deadline)); + } + try { + this.child = pickResult + .subchannel.getRealSubchannel() + .createCall(finalMetadata, this.host, this.methodName, { + onReceiveMetadata: metadata => { + this.trace('Received metadata'); + this.listener.onReceiveMetadata(metadata); + }, + onReceiveMessage: message => { + this.trace('Received message'); + this.listener.onReceiveMessage(message); + }, + onReceiveStatus: status => { + this.trace('Received status'); + if (status.rstCode === + http2.constants.NGHTTP2_REFUSED_STREAM) { + this.outputStatus(status, 'REFUSED'); + } + else { + this.outputStatus(status, 'PROCESSED'); + } + }, + }); + this.childStartTime = new Date(); + } + catch (error) { + this.trace('Failed to start call on picked subchannel ' + + subchannelString + + ' with error ' + + error.message); + this.outputStatus({ + code: constants_1.Status.INTERNAL, + details: 'Failed to start HTTP/2 stream with error ' + + error.message, + metadata: new metadata_1.Metadata(), + }, 'NOT_STARTED'); + return; + } + (_a = pickResult.onCallStarted) === null || _a === void 0 ? void 0 : _a.call(pickResult); + this.onCallEnded = pickResult.onCallEnded; + this.trace('Created child call [' + this.child.getCallNumber() + ']'); + if (this.readPending) { + this.child.startRead(); + } + if (this.pendingMessage) { + this.child.sendMessageWithContext(this.pendingMessage.context, this.pendingMessage.message); + } + if (this.pendingHalfClose) { + this.child.halfClose(); + } + }, (error) => { + // We assume the error code isn't 0 (Status.OK) + const { code, details } = (0, control_plane_status_1.restrictControlPlaneStatusCode)(typeof error.code === 'number' ? error.code : constants_1.Status.UNKNOWN, `Getting metadata from plugin failed with error: ${error.message}`); + this.outputStatus({ + code: code, + details: details, + metadata: new metadata_1.Metadata(), + }, 'PROCESSED'); + }); + break; + case picker_1.PickResultType.DROP: + const { code, details } = (0, control_plane_status_1.restrictControlPlaneStatusCode)(pickResult.status.code, pickResult.status.details); + setImmediate(() => { + this.outputStatus({ code, details, metadata: pickResult.status.metadata }, 'DROP'); + }); + break; + case picker_1.PickResultType.TRANSIENT_FAILURE: + if (this.metadata.getOptions().waitForReady) { + this.channel.queueCallForPick(this); + } + else { + const { code, details } = (0, control_plane_status_1.restrictControlPlaneStatusCode)(pickResult.status.code, pickResult.status.details); + setImmediate(() => { + this.outputStatus({ code, details, metadata: pickResult.status.metadata }, 'PROCESSED'); + }); + } + break; + case picker_1.PickResultType.QUEUE: + this.channel.queueCallForPick(this); + } + } + cancelWithStatus(status, details) { + var _a; + this.trace('cancelWithStatus code: ' + status + ' details: "' + details + '"'); + (_a = this.child) === null || _a === void 0 ? void 0 : _a.cancelWithStatus(status, details); + this.outputStatus({ code: status, details: details, metadata: new metadata_1.Metadata() }, 'PROCESSED'); + } + getPeer() { + var _a, _b; + return (_b = (_a = this.child) === null || _a === void 0 ? void 0 : _a.getPeer()) !== null && _b !== void 0 ? _b : this.channel.getTarget(); + } + start(metadata, listener) { + this.trace('start called'); + this.listener = listener; + this.metadata = metadata; + this.doPick(); + } + sendMessageWithContext(context, message) { + this.trace('write() called with message of length ' + message.length); + if (this.child) { + this.child.sendMessageWithContext(context, message); + } + else { + this.pendingMessage = { context, message }; + } + } + startRead() { + this.trace('startRead called'); + if (this.child) { + this.child.startRead(); + } + else { + this.readPending = true; + } + } + halfClose() { + this.trace('halfClose called'); + if (this.child) { + this.child.halfClose(); + } + else { + this.pendingHalfClose = true; + } + } + setCredentials(credentials) { + throw new Error('Method not implemented.'); + } + getCallNumber() { + return this.callNumber; + } + getAuthContext() { + if (this.child) { + return this.child.getAuthContext(); + } + else { + return null; + } + } +} +exports.LoadBalancingCall = LoadBalancingCall; +//# sourceMappingURL=load-balancing-call.js.map + +/***/ }), + +/***/ 8536: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +var _a, _b, _c, _d; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.log = exports.setLoggerVerbosity = exports.setLogger = exports.getLogger = void 0; +exports.trace = trace; +exports.isTracerEnabled = isTracerEnabled; +const constants_1 = __nccwpck_require__(68288); +const process_1 = __nccwpck_require__(932); +const clientVersion = (__nccwpck_require__(9943)/* .version */ .rE); +const DEFAULT_LOGGER = { + error: (message, ...optionalParams) => { + console.error('E ' + message, ...optionalParams); + }, + info: (message, ...optionalParams) => { + console.error('I ' + message, ...optionalParams); + }, + debug: (message, ...optionalParams) => { + console.error('D ' + message, ...optionalParams); + }, +}; +let _logger = DEFAULT_LOGGER; +let _logVerbosity = constants_1.LogVerbosity.ERROR; +const verbosityString = (_b = (_a = process.env.GRPC_NODE_VERBOSITY) !== null && _a !== void 0 ? _a : process.env.GRPC_VERBOSITY) !== null && _b !== void 0 ? _b : ''; +switch (verbosityString.toUpperCase()) { + case 'DEBUG': + _logVerbosity = constants_1.LogVerbosity.DEBUG; + break; + case 'INFO': + _logVerbosity = constants_1.LogVerbosity.INFO; + break; + case 'ERROR': + _logVerbosity = constants_1.LogVerbosity.ERROR; + break; + case 'NONE': + _logVerbosity = constants_1.LogVerbosity.NONE; + break; + default: + // Ignore any other values +} +const getLogger = () => { + return _logger; +}; +exports.getLogger = getLogger; +const setLogger = (logger) => { + _logger = logger; +}; +exports.setLogger = setLogger; +const setLoggerVerbosity = (verbosity) => { + _logVerbosity = verbosity; +}; +exports.setLoggerVerbosity = setLoggerVerbosity; +// eslint-disable-next-line @typescript-eslint/no-explicit-any +const log = (severity, ...args) => { + let logFunction; + if (severity >= _logVerbosity) { + switch (severity) { + case constants_1.LogVerbosity.DEBUG: + logFunction = _logger.debug; + break; + case constants_1.LogVerbosity.INFO: + logFunction = _logger.info; + break; + case constants_1.LogVerbosity.ERROR: + logFunction = _logger.error; + break; + } + /* Fall back to _logger.error when other methods are not available for + * compatiblity with older behavior that always logged to _logger.error */ + if (!logFunction) { + logFunction = _logger.error; + } + if (logFunction) { + logFunction.bind(_logger)(...args); + } + } +}; +exports.log = log; +const tracersString = (_d = (_c = process.env.GRPC_NODE_TRACE) !== null && _c !== void 0 ? _c : process.env.GRPC_TRACE) !== null && _d !== void 0 ? _d : ''; +const enabledTracers = new Set(); +const disabledTracers = new Set(); +for (const tracerName of tracersString.split(',')) { + if (tracerName.startsWith('-')) { + disabledTracers.add(tracerName.substring(1)); + } + else { + enabledTracers.add(tracerName); + } +} +const allEnabled = enabledTracers.has('all'); +function trace(severity, tracer, text) { + if (isTracerEnabled(tracer)) { + (0, exports.log)(severity, new Date().toISOString() + + ' | v' + + clientVersion + + ' ' + + process_1.pid + + ' | ' + + tracer + + ' | ' + + text); + } +} +function isTracerEnabled(tracer) { + return (!disabledTracers.has(tracer) && (allEnabled || enabledTracers.has(tracer))); +} +//# sourceMappingURL=logging.js.map + +/***/ }), + +/***/ 76983: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.makeClientConstructor = makeClientConstructor; +exports.loadPackageDefinition = loadPackageDefinition; +const client_1 = __nccwpck_require__(54210); +/** + * Map with short names for each of the requester maker functions. Used in + * makeClientConstructor + * @private + */ +const requesterFuncs = { + unary: client_1.Client.prototype.makeUnaryRequest, + server_stream: client_1.Client.prototype.makeServerStreamRequest, + client_stream: client_1.Client.prototype.makeClientStreamRequest, + bidi: client_1.Client.prototype.makeBidiStreamRequest, +}; +/** + * Returns true, if given key is included in the blacklisted + * keys. + * @param key key for check, string. + */ +function isPrototypePolluted(key) { + return ['__proto__', 'prototype', 'constructor'].includes(key); +} +/** + * Creates a constructor for a client with the given methods, as specified in + * the methods argument. The resulting class will have an instance method for + * each method in the service, which is a partial application of one of the + * [Client]{@link grpc.Client} request methods, depending on `requestSerialize` + * and `responseSerialize`, with the `method`, `serialize`, and `deserialize` + * arguments predefined. + * @param methods An object mapping method names to + * method attributes + * @param serviceName The fully qualified name of the service + * @param classOptions An options object. + * @return New client constructor, which is a subclass of + * {@link grpc.Client}, and has the same arguments as that constructor. + */ +function makeClientConstructor(methods, serviceName, classOptions) { + if (!classOptions) { + classOptions = {}; + } + class ServiceClientImpl extends client_1.Client { + } + Object.keys(methods).forEach(name => { + if (isPrototypePolluted(name)) { + return; + } + const attrs = methods[name]; + let methodType; + // TODO(murgatroid99): Verify that we don't need this anymore + if (typeof name === 'string' && name.charAt(0) === '$') { + throw new Error('Method names cannot start with $'); + } + if (attrs.requestStream) { + if (attrs.responseStream) { + methodType = 'bidi'; + } + else { + methodType = 'client_stream'; + } + } + else { + if (attrs.responseStream) { + methodType = 'server_stream'; + } + else { + methodType = 'unary'; + } + } + const serialize = attrs.requestSerialize; + const deserialize = attrs.responseDeserialize; + const methodFunc = partial(requesterFuncs[methodType], attrs.path, serialize, deserialize); + ServiceClientImpl.prototype[name] = methodFunc; + // Associate all provided attributes with the method + Object.assign(ServiceClientImpl.prototype[name], attrs); + if (attrs.originalName && !isPrototypePolluted(attrs.originalName)) { + ServiceClientImpl.prototype[attrs.originalName] = + ServiceClientImpl.prototype[name]; + } + }); + ServiceClientImpl.service = methods; + ServiceClientImpl.serviceName = serviceName; + return ServiceClientImpl; +} +function partial(fn, path, serialize, deserialize) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + return function (...args) { + return fn.call(this, path, serialize, deserialize, ...args); + }; +} +function isProtobufTypeDefinition(obj) { + return 'format' in obj; +} +/** + * Load a gRPC package definition as a gRPC object hierarchy. + * @param packageDef The package definition object. + * @return The resulting gRPC object. + */ +function loadPackageDefinition(packageDef) { + const result = {}; + for (const serviceFqn in packageDef) { + if (Object.prototype.hasOwnProperty.call(packageDef, serviceFqn)) { + const service = packageDef[serviceFqn]; + const nameComponents = serviceFqn.split('.'); + if (nameComponents.some((comp) => isPrototypePolluted(comp))) { + continue; + } + const serviceName = nameComponents[nameComponents.length - 1]; + let current = result; + for (const packageName of nameComponents.slice(0, -1)) { + if (!current[packageName]) { + current[packageName] = {}; + } + current = current[packageName]; + } + if (isProtobufTypeDefinition(service)) { + current[serviceName] = service; + } + else { + current[serviceName] = makeClientConstructor(service, serviceName, {}); + } + } + } + return result; +} +//# sourceMappingURL=make-client.js.map + +/***/ }), + +/***/ 36100: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Metadata = void 0; +const logging_1 = __nccwpck_require__(8536); +const constants_1 = __nccwpck_require__(68288); +const error_1 = __nccwpck_require__(98219); +const LEGAL_KEY_REGEX = /^[:0-9a-z_.-]+$/; +const LEGAL_NON_BINARY_VALUE_REGEX = /^[ -~]*$/; +function isLegalKey(key) { + return LEGAL_KEY_REGEX.test(key); +} +function isLegalNonBinaryValue(value) { + return LEGAL_NON_BINARY_VALUE_REGEX.test(value); +} +function isBinaryKey(key) { + return key.endsWith('-bin'); +} +function isCustomMetadata(key) { + return !key.startsWith('grpc-'); +} +function normalizeKey(key) { + return key.toLowerCase(); +} +function validate(key, value) { + if (!isLegalKey(key)) { + throw new Error('Metadata key "' + key + '" contains illegal characters'); + } + if (value !== null && value !== undefined) { + if (isBinaryKey(key)) { + if (!Buffer.isBuffer(value)) { + throw new Error("keys that end with '-bin' must have Buffer values"); + } + } + else { + if (Buffer.isBuffer(value)) { + throw new Error("keys that don't end with '-bin' must have String values"); + } + if (!isLegalNonBinaryValue(value)) { + throw new Error('Metadata string value "' + value + '" contains illegal characters'); + } + } + } +} +/** + * A class for storing metadata. Keys are normalized to lowercase ASCII. + */ +class Metadata { + constructor(options = {}) { + this.internalRepr = new Map(); + this.opaqueData = new Map(); + this.options = options; + } + /** + * Sets the given value for the given key by replacing any other values + * associated with that key. Normalizes the key. + * @param key The key to whose value should be set. + * @param value The value to set. Must be a buffer if and only + * if the normalized key ends with '-bin'. + */ + set(key, value) { + key = normalizeKey(key); + validate(key, value); + this.internalRepr.set(key, [value]); + } + /** + * Adds the given value for the given key by appending to a list of previous + * values associated with that key. Normalizes the key. + * @param key The key for which a new value should be appended. + * @param value The value to add. Must be a buffer if and only + * if the normalized key ends with '-bin'. + */ + add(key, value) { + key = normalizeKey(key); + validate(key, value); + const existingValue = this.internalRepr.get(key); + if (existingValue === undefined) { + this.internalRepr.set(key, [value]); + } + else { + existingValue.push(value); + } + } + /** + * Removes the given key and any associated values. Normalizes the key. + * @param key The key whose values should be removed. + */ + remove(key) { + key = normalizeKey(key); + // validate(key); + this.internalRepr.delete(key); + } + /** + * Gets a list of all values associated with the key. Normalizes the key. + * @param key The key whose value should be retrieved. + * @return A list of values associated with the given key. + */ + get(key) { + key = normalizeKey(key); + // validate(key); + return this.internalRepr.get(key) || []; + } + /** + * Gets a plain object mapping each key to the first value associated with it. + * This reflects the most common way that people will want to see metadata. + * @return A key/value mapping of the metadata. + */ + getMap() { + const result = {}; + for (const [key, values] of this.internalRepr) { + if (values.length > 0) { + const v = values[0]; + result[key] = Buffer.isBuffer(v) ? Buffer.from(v) : v; + } + } + return result; + } + /** + * Clones the metadata object. + * @return The newly cloned object. + */ + clone() { + const newMetadata = new Metadata(this.options); + const newInternalRepr = newMetadata.internalRepr; + for (const [key, value] of this.internalRepr) { + const clonedValue = value.map(v => { + if (Buffer.isBuffer(v)) { + return Buffer.from(v); + } + else { + return v; + } + }); + newInternalRepr.set(key, clonedValue); + } + return newMetadata; + } + /** + * Merges all key-value pairs from a given Metadata object into this one. + * If both this object and the given object have values in the same key, + * values from the other Metadata object will be appended to this object's + * values. + * @param other A Metadata object. + */ + merge(other) { + for (const [key, values] of other.internalRepr) { + const mergedValue = (this.internalRepr.get(key) || []).concat(values); + this.internalRepr.set(key, mergedValue); + } + } + setOptions(options) { + this.options = options; + } + getOptions() { + return this.options; + } + /** + * Creates an OutgoingHttpHeaders object that can be used with the http2 API. + */ + toHttp2Headers() { + // NOTE: Node <8.9 formats http2 headers incorrectly. + const result = {}; + for (const [key, values] of this.internalRepr) { + if (key.startsWith(':')) { + continue; + } + // We assume that the user's interaction with this object is limited to + // through its public API (i.e. keys and values are already validated). + result[key] = values.map(bufToString); + } + return result; + } + /** + * This modifies the behavior of JSON.stringify to show an object + * representation of the metadata map. + */ + toJSON() { + const result = {}; + for (const [key, values] of this.internalRepr) { + result[key] = values; + } + return result; + } + /** + * Attach additional data of any type to the metadata object, which will not + * be included when sending headers. The data can later be retrieved with + * `getOpaque`. Keys with the prefix `grpc` are reserved for use by this + * library. + * @param key + * @param value + */ + setOpaque(key, value) { + this.opaqueData.set(key, value); + } + /** + * Retrieve data previously added with `setOpaque`. + * @param key + * @returns + */ + getOpaque(key) { + return this.opaqueData.get(key); + } + /** + * Returns a new Metadata object based fields in a given IncomingHttpHeaders + * object. + * @param headers An IncomingHttpHeaders object. + */ + static fromHttp2Headers(headers) { + const result = new Metadata(); + for (const key of Object.keys(headers)) { + // Reserved headers (beginning with `:`) are not valid keys. + if (key.charAt(0) === ':') { + continue; + } + const values = headers[key]; + try { + if (isBinaryKey(key)) { + if (Array.isArray(values)) { + values.forEach(value => { + result.add(key, Buffer.from(value, 'base64')); + }); + } + else if (values !== undefined) { + if (isCustomMetadata(key)) { + values.split(',').forEach(v => { + result.add(key, Buffer.from(v.trim(), 'base64')); + }); + } + else { + result.add(key, Buffer.from(values, 'base64')); + } + } + } + else { + if (Array.isArray(values)) { + values.forEach(value => { + result.add(key, value); + }); + } + else if (values !== undefined) { + result.add(key, values); + } + } + } + catch (error) { + const message = `Failed to add metadata entry ${key}: ${values}. ${(0, error_1.getErrorMessage)(error)}. For more information see https://github.com/grpc/grpc-node/issues/1173`; + (0, logging_1.log)(constants_1.LogVerbosity.ERROR, message); + } + } + return result; + } +} +exports.Metadata = Metadata; +const bufToString = (val) => { + return Buffer.isBuffer(val) ? val.toString('base64') : val; +}; +//# sourceMappingURL=metadata.js.map + +/***/ }), + +/***/ 82124: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2025 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.OrcaOobMetricsSubchannelWrapper = exports.GRPC_METRICS_HEADER = exports.ServerMetricRecorder = exports.PerRequestMetricRecorder = void 0; +exports.createOrcaClient = createOrcaClient; +exports.createMetricsReader = createMetricsReader; +const make_client_1 = __nccwpck_require__(76983); +const duration_1 = __nccwpck_require__(63929); +const channel_credentials_1 = __nccwpck_require__(32257); +const subchannel_interface_1 = __nccwpck_require__(70098); +const constants_1 = __nccwpck_require__(68288); +const backoff_timeout_1 = __nccwpck_require__(14643); +const connectivity_state_1 = __nccwpck_require__(60778); +const loadedOrcaProto = null; +function loadOrcaProto() { + if (loadedOrcaProto) { + return loadedOrcaProto; + } + /* The purpose of this complexity is to avoid loading @grpc/proto-loader at + * runtime for users who will not use/enable ORCA. */ + const loaderLoadSync = (__nccwpck_require__(73066)/* .loadSync */ .Yi); + const loadedProto = loaderLoadSync('xds/service/orca/v3/orca.proto', { + keepCase: true, + longs: String, + enums: String, + defaults: true, + oneofs: true, + includeDirs: [ + __nccwpck_require__.ab + "xds", + __nccwpck_require__.ab + "protoc-gen-validate" + ], + }); + return (0, make_client_1.loadPackageDefinition)(loadedProto); +} +/** + * ORCA metrics recorder for a single request + */ +class PerRequestMetricRecorder { + constructor() { + this.message = {}; + } + /** + * Records a request cost metric measurement for the call. + * @param name + * @param value + */ + recordRequestCostMetric(name, value) { + if (!this.message.request_cost) { + this.message.request_cost = {}; + } + this.message.request_cost[name] = value; + } + /** + * Records a request cost metric measurement for the call. + * @param name + * @param value + */ + recordUtilizationMetric(name, value) { + if (!this.message.utilization) { + this.message.utilization = {}; + } + this.message.utilization[name] = value; + } + /** + * Records an opaque named metric measurement for the call. + * @param name + * @param value + */ + recordNamedMetric(name, value) { + if (!this.message.named_metrics) { + this.message.named_metrics = {}; + } + this.message.named_metrics[name] = value; + } + /** + * Records the CPU utilization metric measurement for the call. + * @param value + */ + recordCPUUtilizationMetric(value) { + this.message.cpu_utilization = value; + } + /** + * Records the memory utilization metric measurement for the call. + * @param value + */ + recordMemoryUtilizationMetric(value) { + this.message.mem_utilization = value; + } + /** + * Records the memory utilization metric measurement for the call. + * @param value + */ + recordApplicationUtilizationMetric(value) { + this.message.application_utilization = value; + } + /** + * Records the queries per second measurement. + * @param value + */ + recordQpsMetric(value) { + this.message.rps_fractional = value; + } + /** + * Records the errors per second measurement. + * @param value + */ + recordEpsMetric(value) { + this.message.eps = value; + } + serialize() { + const orcaProto = loadOrcaProto(); + return orcaProto.xds.data.orca.v3.OrcaLoadReport.serialize(this.message); + } +} +exports.PerRequestMetricRecorder = PerRequestMetricRecorder; +const DEFAULT_REPORT_INTERVAL_MS = 30000; +class ServerMetricRecorder { + constructor() { + this.message = {}; + this.serviceImplementation = { + StreamCoreMetrics: call => { + const reportInterval = call.request.report_interval ? + (0, duration_1.durationToMs)((0, duration_1.durationMessageToDuration)(call.request.report_interval)) : + DEFAULT_REPORT_INTERVAL_MS; + const reportTimer = setInterval(() => { + call.write(this.message); + }, reportInterval); + call.on('cancelled', () => { + clearInterval(reportTimer); + }); + } + }; + } + putUtilizationMetric(name, value) { + if (!this.message.utilization) { + this.message.utilization = {}; + } + this.message.utilization[name] = value; + } + setAllUtilizationMetrics(metrics) { + this.message.utilization = Object.assign({}, metrics); + } + deleteUtilizationMetric(name) { + var _a; + (_a = this.message.utilization) === null || _a === void 0 ? true : delete _a[name]; + } + setCpuUtilizationMetric(value) { + this.message.cpu_utilization = value; + } + deleteCpuUtilizationMetric() { + delete this.message.cpu_utilization; + } + setApplicationUtilizationMetric(value) { + this.message.application_utilization = value; + } + deleteApplicationUtilizationMetric() { + delete this.message.application_utilization; + } + setQpsMetric(value) { + this.message.rps_fractional = value; + } + deleteQpsMetric() { + delete this.message.rps_fractional; + } + setEpsMetric(value) { + this.message.eps = value; + } + deleteEpsMetric() { + delete this.message.eps; + } + addToServer(server) { + const serviceDefinition = loadOrcaProto().xds.service.orca.v3.OpenRcaService.service; + server.addService(serviceDefinition, this.serviceImplementation); + } +} +exports.ServerMetricRecorder = ServerMetricRecorder; +function createOrcaClient(channel) { + const ClientClass = loadOrcaProto().xds.service.orca.v3.OpenRcaService; + return new ClientClass('unused', channel_credentials_1.ChannelCredentials.createInsecure(), { channelOverride: channel }); +} +exports.GRPC_METRICS_HEADER = 'endpoint-load-metrics-bin'; +const PARSED_LOAD_REPORT_KEY = 'grpc_orca_load_report'; +/** + * Create an onCallEnded callback for use in a picker. + * @param listener The listener to handle metrics, whenever they are provided. + * @param previousOnCallEnded The previous onCallEnded callback to propagate + * to, if applicable. + * @returns + */ +function createMetricsReader(listener, previousOnCallEnded) { + return (code, details, metadata) => { + let parsedLoadReport = metadata.getOpaque(PARSED_LOAD_REPORT_KEY); + if (parsedLoadReport) { + listener(parsedLoadReport); + } + else { + const serializedLoadReport = metadata.get(exports.GRPC_METRICS_HEADER); + if (serializedLoadReport.length > 0) { + const orcaProto = loadOrcaProto(); + parsedLoadReport = orcaProto.xds.data.orca.v3.OrcaLoadReport.deserialize(serializedLoadReport[0]); + listener(parsedLoadReport); + metadata.setOpaque(PARSED_LOAD_REPORT_KEY, parsedLoadReport); + } + } + if (previousOnCallEnded) { + previousOnCallEnded(code, details, metadata); + } + }; +} +const DATA_PRODUCER_KEY = 'orca_oob_metrics'; +class OobMetricsDataWatcher { + constructor(metricsListener, intervalMs) { + this.metricsListener = metricsListener; + this.intervalMs = intervalMs; + this.dataProducer = null; + } + setSubchannel(subchannel) { + const producer = subchannel.getOrCreateDataProducer(DATA_PRODUCER_KEY, createOobMetricsDataProducer); + this.dataProducer = producer; + producer.addDataWatcher(this); + } + destroy() { + var _a; + (_a = this.dataProducer) === null || _a === void 0 ? void 0 : _a.removeDataWatcher(this); + } + getInterval() { + return this.intervalMs; + } + onMetricsUpdate(metrics) { + this.metricsListener(metrics); + } +} +class OobMetricsDataProducer { + constructor(subchannel) { + this.subchannel = subchannel; + this.dataWatchers = new Set(); + this.orcaSupported = true; + this.metricsCall = null; + this.currentInterval = Infinity; + this.backoffTimer = new backoff_timeout_1.BackoffTimeout(() => this.updateMetricsSubscription()); + this.subchannelStateListener = () => this.updateMetricsSubscription(); + const channel = subchannel.getChannel(); + this.client = createOrcaClient(channel); + subchannel.addConnectivityStateListener(this.subchannelStateListener); + } + addDataWatcher(dataWatcher) { + this.dataWatchers.add(dataWatcher); + this.updateMetricsSubscription(); + } + removeDataWatcher(dataWatcher) { + var _a; + this.dataWatchers.delete(dataWatcher); + if (this.dataWatchers.size === 0) { + this.subchannel.removeDataProducer(DATA_PRODUCER_KEY); + (_a = this.metricsCall) === null || _a === void 0 ? void 0 : _a.cancel(); + this.metricsCall = null; + this.client.close(); + this.subchannel.removeConnectivityStateListener(this.subchannelStateListener); + } + else { + this.updateMetricsSubscription(); + } + } + updateMetricsSubscription() { + var _a; + if (this.dataWatchers.size === 0 || !this.orcaSupported || this.subchannel.getConnectivityState() !== connectivity_state_1.ConnectivityState.READY) { + return; + } + const newInterval = Math.min(...Array.from(this.dataWatchers).map(watcher => watcher.getInterval())); + if (!this.metricsCall || newInterval !== this.currentInterval) { + (_a = this.metricsCall) === null || _a === void 0 ? void 0 : _a.cancel(); + this.currentInterval = newInterval; + const metricsCall = this.client.streamCoreMetrics({ report_interval: (0, duration_1.msToDuration)(newInterval) }); + this.metricsCall = metricsCall; + metricsCall.on('data', (report) => { + this.dataWatchers.forEach(watcher => { + watcher.onMetricsUpdate(report); + }); + }); + metricsCall.on('error', (error) => { + this.metricsCall = null; + if (error.code === constants_1.Status.UNIMPLEMENTED) { + this.orcaSupported = false; + return; + } + if (error.code === constants_1.Status.CANCELLED) { + return; + } + this.backoffTimer.runOnce(); + }); + } + } +} +class OrcaOobMetricsSubchannelWrapper extends subchannel_interface_1.BaseSubchannelWrapper { + constructor(child, metricsListener, intervalMs) { + super(child); + this.addDataWatcher(new OobMetricsDataWatcher(metricsListener, intervalMs)); + } + getWrappedSubchannel() { + return this.child; + } +} +exports.OrcaOobMetricsSubchannelWrapper = OrcaOobMetricsSubchannelWrapper; +function createOobMetricsDataProducer(subchannel) { + return new OobMetricsDataProducer(subchannel); +} +//# sourceMappingURL=orca.js.map + +/***/ }), + +/***/ 71663: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.QueuePicker = exports.UnavailablePicker = exports.PickResultType = void 0; +const metadata_1 = __nccwpck_require__(36100); +const constants_1 = __nccwpck_require__(68288); +var PickResultType; +(function (PickResultType) { + PickResultType[PickResultType["COMPLETE"] = 0] = "COMPLETE"; + PickResultType[PickResultType["QUEUE"] = 1] = "QUEUE"; + PickResultType[PickResultType["TRANSIENT_FAILURE"] = 2] = "TRANSIENT_FAILURE"; + PickResultType[PickResultType["DROP"] = 3] = "DROP"; +})(PickResultType || (exports.PickResultType = PickResultType = {})); +/** + * A standard picker representing a load balancer in the TRANSIENT_FAILURE + * state. Always responds to every pick request with an UNAVAILABLE status. + */ +class UnavailablePicker { + constructor(status) { + this.status = Object.assign({ code: constants_1.Status.UNAVAILABLE, details: 'No connection established', metadata: new metadata_1.Metadata() }, status); + } + pick(pickArgs) { + return { + pickResultType: PickResultType.TRANSIENT_FAILURE, + subchannel: null, + status: this.status, + onCallStarted: null, + onCallEnded: null, + }; + } +} +exports.UnavailablePicker = UnavailablePicker; +/** + * A standard picker representing a load balancer in the IDLE or CONNECTING + * state. Always responds to every pick request with a QUEUE pick result + * indicating that the pick should be tried again with the next `Picker`. Also + * reports back to the load balancer that a connection should be established + * once any pick is attempted. + * If the childPicker is provided, delegate to it instead of returning the + * hardcoded QUEUE pick result, but still calls exitIdle. + */ +class QueuePicker { + // Constructed with a load balancer. Calls exitIdle on it the first time pick is called + constructor(loadBalancer, childPicker) { + this.loadBalancer = loadBalancer; + this.childPicker = childPicker; + this.calledExitIdle = false; + } + pick(pickArgs) { + if (!this.calledExitIdle) { + process.nextTick(() => { + this.loadBalancer.exitIdle(); + }); + this.calledExitIdle = true; + } + if (this.childPicker) { + return this.childPicker.pick(pickArgs); + } + else { + return { + pickResultType: PickResultType.QUEUE, + subchannel: null, + status: null, + onCallStarted: null, + onCallEnded: null, + }; + } + } +} +exports.QueuePicker = QueuePicker; +//# sourceMappingURL=picker.js.map + +/***/ }), + +/***/ 58291: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright 2025 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.PriorityQueue = void 0; +const top = 0; +const parent = (i) => Math.floor(i / 2); +const left = (i) => i * 2 + 1; +const right = (i) => i * 2 + 2; +/** + * A generic priority queue implemented as an array-based binary heap. + * Adapted from https://stackoverflow.com/a/42919752/159388 + */ +class PriorityQueue { + /** + * + * @param comparator Returns true if the first argument should precede the + * second in the queue. Defaults to `(a, b) => a > b` + */ + constructor(comparator = (a, b) => a > b) { + this.comparator = comparator; + this.heap = []; + } + /** + * @returns The number of items currently in the queue + */ + size() { + return this.heap.length; + } + /** + * @returns True if there are no items in the queue, false otherwise + */ + isEmpty() { + return this.size() == 0; + } + /** + * Look at the front item that would be popped, without modifying the contents + * of the queue + * @returns The front item in the queue, or undefined if the queue is empty + */ + peek() { + return this.heap[top]; + } + /** + * Add the items to the queue + * @param values The items to add + * @returns The new size of the queue after adding the items + */ + push(...values) { + values.forEach(value => { + this.heap.push(value); + this.siftUp(); + }); + return this.size(); + } + /** + * Remove the front item in the queue and return it + * @returns The front item in the queue, or undefined if the queue is empty + */ + pop() { + const poppedValue = this.peek(); + const bottom = this.size() - 1; + if (bottom > top) { + this.swap(top, bottom); + } + this.heap.pop(); + this.siftDown(); + return poppedValue; + } + /** + * Simultaneously remove the front item in the queue and add the provided + * item. + * @param value The item to add + * @returns The front item in the queue, or undefined if the queue is empty + */ + replace(value) { + const replacedValue = this.peek(); + this.heap[top] = value; + this.siftDown(); + return replacedValue; + } + greater(i, j) { + return this.comparator(this.heap[i], this.heap[j]); + } + swap(i, j) { + [this.heap[i], this.heap[j]] = [this.heap[j], this.heap[i]]; + } + siftUp() { + let node = this.size() - 1; + while (node > top && this.greater(node, parent(node))) { + this.swap(node, parent(node)); + node = parent(node); + } + } + siftDown() { + let node = top; + while ((left(node) < this.size() && this.greater(left(node), node)) || + (right(node) < this.size() && this.greater(right(node), node))) { + let maxChild = (right(node) < this.size() && this.greater(right(node), left(node))) ? right(node) : left(node); + this.swap(node, maxChild); + node = maxChild; + } + } +} +exports.PriorityQueue = PriorityQueue; +//# sourceMappingURL=priority-queue.js.map + +/***/ }), + +/***/ 51149: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.DEFAULT_PORT = void 0; +exports.setup = setup; +const resolver_1 = __nccwpck_require__(76255); +const dns_1 = __nccwpck_require__(72250); +const service_config_1 = __nccwpck_require__(70005); +const constants_1 = __nccwpck_require__(68288); +const call_interface_1 = __nccwpck_require__(61803); +const metadata_1 = __nccwpck_require__(36100); +const logging = __nccwpck_require__(8536); +const constants_2 = __nccwpck_require__(68288); +const uri_parser_1 = __nccwpck_require__(56027); +const net_1 = __nccwpck_require__(69278); +const backoff_timeout_1 = __nccwpck_require__(14643); +const environment_1 = __nccwpck_require__(16964); +const TRACER_NAME = 'dns_resolver'; +function trace(text) { + logging.trace(constants_2.LogVerbosity.DEBUG, TRACER_NAME, text); +} +/** + * The default TCP port to connect to if not explicitly specified in the target. + */ +exports.DEFAULT_PORT = 443; +const DEFAULT_MIN_TIME_BETWEEN_RESOLUTIONS_MS = 30000; +/** + * Resolver implementation that handles DNS names and IP addresses. + */ +class DnsResolver { + constructor(target, listener, channelOptions) { + var _a, _b, _c; + this.target = target; + this.listener = listener; + this.pendingLookupPromise = null; + this.pendingTxtPromise = null; + this.latestLookupResult = null; + this.latestServiceConfigResult = null; + this.continueResolving = false; + this.isNextResolutionTimerRunning = false; + this.isServiceConfigEnabled = true; + this.returnedIpResult = false; + this.alternativeResolver = new dns_1.promises.Resolver(); + trace('Resolver constructed for target ' + (0, uri_parser_1.uriToString)(target)); + if (target.authority) { + this.alternativeResolver.setServers([target.authority]); + } + const hostPort = (0, uri_parser_1.splitHostPort)(target.path); + if (hostPort === null) { + this.ipResult = null; + this.dnsHostname = null; + this.port = null; + } + else { + if ((0, net_1.isIPv4)(hostPort.host) || (0, net_1.isIPv6)(hostPort.host)) { + this.ipResult = [ + { + addresses: [ + { + host: hostPort.host, + port: (_a = hostPort.port) !== null && _a !== void 0 ? _a : exports.DEFAULT_PORT, + }, + ], + }, + ]; + this.dnsHostname = null; + this.port = null; + } + else { + this.ipResult = null; + this.dnsHostname = hostPort.host; + this.port = (_b = hostPort.port) !== null && _b !== void 0 ? _b : exports.DEFAULT_PORT; + } + } + this.percentage = Math.random() * 100; + if (channelOptions['grpc.service_config_disable_resolution'] === 1) { + this.isServiceConfigEnabled = false; + } + this.defaultResolutionError = { + code: constants_1.Status.UNAVAILABLE, + details: `Name resolution failed for target ${(0, uri_parser_1.uriToString)(this.target)}`, + metadata: new metadata_1.Metadata(), + }; + const backoffOptions = { + initialDelay: channelOptions['grpc.initial_reconnect_backoff_ms'], + maxDelay: channelOptions['grpc.max_reconnect_backoff_ms'], + }; + this.backoff = new backoff_timeout_1.BackoffTimeout(() => { + if (this.continueResolving) { + this.startResolutionWithBackoff(); + } + }, backoffOptions); + this.backoff.unref(); + this.minTimeBetweenResolutionsMs = + (_c = channelOptions['grpc.dns_min_time_between_resolutions_ms']) !== null && _c !== void 0 ? _c : DEFAULT_MIN_TIME_BETWEEN_RESOLUTIONS_MS; + this.nextResolutionTimer = setTimeout(() => { }, 0); + clearTimeout(this.nextResolutionTimer); + } + /** + * If the target is an IP address, just provide that address as a result. + * Otherwise, initiate A, AAAA, and TXT lookups + */ + startResolution() { + if (this.ipResult !== null) { + if (!this.returnedIpResult) { + trace('Returning IP address for target ' + (0, uri_parser_1.uriToString)(this.target)); + setImmediate(() => { + this.listener((0, call_interface_1.statusOrFromValue)(this.ipResult), {}, null, ''); + }); + this.returnedIpResult = true; + } + this.backoff.stop(); + this.backoff.reset(); + this.stopNextResolutionTimer(); + return; + } + if (this.dnsHostname === null) { + trace('Failed to parse DNS address ' + (0, uri_parser_1.uriToString)(this.target)); + setImmediate(() => { + this.listener((0, call_interface_1.statusOrFromError)({ + code: constants_1.Status.UNAVAILABLE, + details: `Failed to parse DNS address ${(0, uri_parser_1.uriToString)(this.target)}` + }), {}, null, ''); + }); + this.stopNextResolutionTimer(); + } + else { + if (this.pendingLookupPromise !== null) { + return; + } + trace('Looking up DNS hostname ' + this.dnsHostname); + /* We clear out latestLookupResult here to ensure that it contains the + * latest result since the last time we started resolving. That way, the + * TXT resolution handler can use it, but only if it finishes second. We + * don't clear out any previous service config results because it's + * better to use a service config that's slightly out of date than to + * revert to an effectively blank one. */ + this.latestLookupResult = null; + const hostname = this.dnsHostname; + this.pendingLookupPromise = this.lookup(hostname); + this.pendingLookupPromise.then(addressList => { + if (this.pendingLookupPromise === null) { + return; + } + this.pendingLookupPromise = null; + this.latestLookupResult = (0, call_interface_1.statusOrFromValue)(addressList.map(address => ({ + addresses: [address], + }))); + const allAddressesString = '[' + + addressList.map(addr => addr.host + ':' + addr.port).join(',') + + ']'; + trace('Resolved addresses for target ' + + (0, uri_parser_1.uriToString)(this.target) + + ': ' + + allAddressesString); + /* If the TXT lookup has not yet finished, both of the last two + * arguments will be null, which is the equivalent of getting an + * empty TXT response. When the TXT lookup does finish, its handler + * can update the service config by using the same address list */ + const healthStatus = this.listener(this.latestLookupResult, {}, this.latestServiceConfigResult, ''); + this.handleHealthStatus(healthStatus); + }, err => { + if (this.pendingLookupPromise === null) { + return; + } + trace('Resolution error for target ' + + (0, uri_parser_1.uriToString)(this.target) + + ': ' + + err.message); + this.pendingLookupPromise = null; + this.stopNextResolutionTimer(); + this.listener((0, call_interface_1.statusOrFromError)(this.defaultResolutionError), {}, this.latestServiceConfigResult, ''); + }); + /* If there already is a still-pending TXT resolution, we can just use + * that result when it comes in */ + if (this.isServiceConfigEnabled && this.pendingTxtPromise === null) { + /* We handle the TXT query promise differently than the others because + * the name resolution attempt as a whole is a success even if the TXT + * lookup fails */ + this.pendingTxtPromise = this.resolveTxt(hostname); + this.pendingTxtPromise.then(txtRecord => { + if (this.pendingTxtPromise === null) { + return; + } + this.pendingTxtPromise = null; + let serviceConfig; + try { + serviceConfig = (0, service_config_1.extractAndSelectServiceConfig)(txtRecord, this.percentage); + if (serviceConfig) { + this.latestServiceConfigResult = (0, call_interface_1.statusOrFromValue)(serviceConfig); + } + else { + this.latestServiceConfigResult = null; + } + } + catch (err) { + this.latestServiceConfigResult = (0, call_interface_1.statusOrFromError)({ + code: constants_1.Status.UNAVAILABLE, + details: `Parsing service config failed with error ${err.message}` + }); + } + if (this.latestLookupResult !== null) { + /* We rely here on the assumption that calling this function with + * identical parameters will be essentialy idempotent, and calling + * it with the same address list and a different service config + * should result in a fast and seamless switchover. */ + this.listener(this.latestLookupResult, {}, this.latestServiceConfigResult, ''); + } + }, err => { + /* If TXT lookup fails we should do nothing, which means that we + * continue to use the result of the most recent successful lookup, + * or the default null config object if there has never been a + * successful lookup. We do not set the latestServiceConfigError + * here because that is specifically used for response validation + * errors. We still need to handle this error so that it does not + * bubble up as an unhandled promise rejection. */ + }); + } + } + } + /** + * The ResolverListener returns a boolean indicating whether the LB policy + * accepted the resolution result. A false result on an otherwise successful + * resolution should be treated as a resolution failure. + * @param healthStatus + */ + handleHealthStatus(healthStatus) { + if (healthStatus) { + this.backoff.stop(); + this.backoff.reset(); + } + else { + this.continueResolving = true; + } + } + async lookup(hostname) { + if (environment_1.GRPC_NODE_USE_ALTERNATIVE_RESOLVER) { + trace('Using alternative DNS resolver.'); + const records = await Promise.allSettled([ + this.alternativeResolver.resolve4(hostname), + this.alternativeResolver.resolve6(hostname), + ]); + if (records.every(result => result.status === 'rejected')) { + throw new Error(records[0].reason); + } + return records + .reduce((acc, result) => { + return result.status === 'fulfilled' + ? [...acc, ...result.value] + : acc; + }, []) + .map(addr => ({ + host: addr, + port: +this.port, + })); + } + /* We lookup both address families here and then split them up later + * because when looking up a single family, dns.lookup outputs an error + * if the name exists but there are no records for that family, and that + * error is indistinguishable from other kinds of errors */ + const addressList = await dns_1.promises.lookup(hostname, { all: true }); + return addressList.map(addr => ({ host: addr.address, port: +this.port })); + } + async resolveTxt(hostname) { + if (environment_1.GRPC_NODE_USE_ALTERNATIVE_RESOLVER) { + trace('Using alternative DNS resolver.'); + return this.alternativeResolver.resolveTxt(hostname); + } + return dns_1.promises.resolveTxt(hostname); + } + startNextResolutionTimer() { + var _a, _b; + clearTimeout(this.nextResolutionTimer); + this.nextResolutionTimer = setTimeout(() => { + this.stopNextResolutionTimer(); + if (this.continueResolving) { + this.startResolutionWithBackoff(); + } + }, this.minTimeBetweenResolutionsMs); + (_b = (_a = this.nextResolutionTimer).unref) === null || _b === void 0 ? void 0 : _b.call(_a); + this.isNextResolutionTimerRunning = true; + } + stopNextResolutionTimer() { + clearTimeout(this.nextResolutionTimer); + this.isNextResolutionTimerRunning = false; + } + startResolutionWithBackoff() { + if (this.pendingLookupPromise === null) { + this.continueResolving = false; + this.backoff.runOnce(); + this.startNextResolutionTimer(); + this.startResolution(); + } + } + updateResolution() { + /* If there is a pending lookup, just let it finish. Otherwise, if the + * nextResolutionTimer or backoff timer is running, set the + * continueResolving flag to resolve when whichever of those timers + * fires. Otherwise, start resolving immediately. */ + if (this.pendingLookupPromise === null) { + if (this.isNextResolutionTimerRunning || this.backoff.isRunning()) { + if (this.isNextResolutionTimerRunning) { + trace('resolution update delayed by "min time between resolutions" rate limit'); + } + else { + trace('resolution update delayed by backoff timer until ' + + this.backoff.getEndTime().toISOString()); + } + this.continueResolving = true; + } + else { + this.startResolutionWithBackoff(); + } + } + } + /** + * Reset the resolver to the same state it had when it was created. In-flight + * DNS requests cannot be cancelled, but they are discarded and their results + * will be ignored. + */ + destroy() { + this.continueResolving = false; + this.backoff.reset(); + this.backoff.stop(); + this.stopNextResolutionTimer(); + this.pendingLookupPromise = null; + this.pendingTxtPromise = null; + this.latestLookupResult = null; + this.latestServiceConfigResult = null; + this.returnedIpResult = false; + } + /** + * Get the default authority for the given target. For IP targets, that is + * the IP address. For DNS targets, it is the hostname. + * @param target + */ + static getDefaultAuthority(target) { + return target.path; + } +} +/** + * Set up the DNS resolver class by registering it as the handler for the + * "dns:" prefix and as the default resolver. + */ +function setup() { + (0, resolver_1.registerResolver)('dns', DnsResolver); + (0, resolver_1.registerDefaultScheme)('dns'); +} +//# sourceMappingURL=resolver-dns.js.map + +/***/ }), + +/***/ 52617: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2021 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.setup = setup; +const net_1 = __nccwpck_require__(69278); +const call_interface_1 = __nccwpck_require__(61803); +const constants_1 = __nccwpck_require__(68288); +const metadata_1 = __nccwpck_require__(36100); +const resolver_1 = __nccwpck_require__(76255); +const subchannel_address_1 = __nccwpck_require__(97021); +const uri_parser_1 = __nccwpck_require__(56027); +const logging = __nccwpck_require__(8536); +const TRACER_NAME = 'ip_resolver'; +function trace(text) { + logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text); +} +const IPV4_SCHEME = 'ipv4'; +const IPV6_SCHEME = 'ipv6'; +/** + * The default TCP port to connect to if not explicitly specified in the target. + */ +const DEFAULT_PORT = 443; +class IpResolver { + constructor(target, listener, channelOptions) { + var _a; + this.listener = listener; + this.endpoints = []; + this.error = null; + this.hasReturnedResult = false; + trace('Resolver constructed for target ' + (0, uri_parser_1.uriToString)(target)); + const addresses = []; + if (!(target.scheme === IPV4_SCHEME || target.scheme === IPV6_SCHEME)) { + this.error = { + code: constants_1.Status.UNAVAILABLE, + details: `Unrecognized scheme ${target.scheme} in IP resolver`, + metadata: new metadata_1.Metadata(), + }; + return; + } + const pathList = target.path.split(','); + for (const path of pathList) { + const hostPort = (0, uri_parser_1.splitHostPort)(path); + if (hostPort === null) { + this.error = { + code: constants_1.Status.UNAVAILABLE, + details: `Failed to parse ${target.scheme} address ${path}`, + metadata: new metadata_1.Metadata(), + }; + return; + } + if ((target.scheme === IPV4_SCHEME && !(0, net_1.isIPv4)(hostPort.host)) || + (target.scheme === IPV6_SCHEME && !(0, net_1.isIPv6)(hostPort.host))) { + this.error = { + code: constants_1.Status.UNAVAILABLE, + details: `Failed to parse ${target.scheme} address ${path}`, + metadata: new metadata_1.Metadata(), + }; + return; + } + addresses.push({ + host: hostPort.host, + port: (_a = hostPort.port) !== null && _a !== void 0 ? _a : DEFAULT_PORT, + }); + } + this.endpoints = addresses.map(address => ({ addresses: [address] })); + trace('Parsed ' + target.scheme + ' address list ' + addresses.map(subchannel_address_1.subchannelAddressToString)); + } + updateResolution() { + if (!this.hasReturnedResult) { + this.hasReturnedResult = true; + process.nextTick(() => { + if (this.error) { + this.listener((0, call_interface_1.statusOrFromError)(this.error), {}, null, ''); + } + else { + this.listener((0, call_interface_1.statusOrFromValue)(this.endpoints), {}, null, ''); + } + }); + } + } + destroy() { + this.hasReturnedResult = false; + } + static getDefaultAuthority(target) { + return target.path.split(',')[0]; + } +} +function setup() { + (0, resolver_1.registerResolver)(IPV4_SCHEME, IpResolver); + (0, resolver_1.registerResolver)(IPV6_SCHEME, IpResolver); +} +//# sourceMappingURL=resolver-ip.js.map + +/***/ }), + +/***/ 69252: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.setup = setup; +const resolver_1 = __nccwpck_require__(76255); +const call_interface_1 = __nccwpck_require__(61803); +class UdsResolver { + constructor(target, listener, channelOptions) { + this.listener = listener; + this.hasReturnedResult = false; + this.endpoints = []; + let path; + if (target.authority === '') { + path = '/' + target.path; + } + else { + path = target.path; + } + this.endpoints = [{ addresses: [{ path }] }]; + } + updateResolution() { + if (!this.hasReturnedResult) { + this.hasReturnedResult = true; + process.nextTick(this.listener, (0, call_interface_1.statusOrFromValue)(this.endpoints), {}, null, ''); + } + } + destroy() { + this.hasReturnedResult = false; + } + static getDefaultAuthority(target) { + return 'localhost'; + } +} +function setup() { + (0, resolver_1.registerResolver)('unix', UdsResolver); +} +//# sourceMappingURL=resolver-uds.js.map + +/***/ }), + +/***/ 76255: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.CHANNEL_ARGS_CONFIG_SELECTOR_KEY = void 0; +exports.registerResolver = registerResolver; +exports.registerDefaultScheme = registerDefaultScheme; +exports.createResolver = createResolver; +exports.getDefaultAuthority = getDefaultAuthority; +exports.mapUriDefaultScheme = mapUriDefaultScheme; +const uri_parser_1 = __nccwpck_require__(56027); +exports.CHANNEL_ARGS_CONFIG_SELECTOR_KEY = 'grpc.internal.config_selector'; +const registeredResolvers = {}; +let defaultScheme = null; +/** + * Register a resolver class to handle target names prefixed with the `prefix` + * string. This prefix should correspond to a URI scheme name listed in the + * [gRPC Name Resolution document](https://github.com/grpc/grpc/blob/master/doc/naming.md) + * @param prefix + * @param resolverClass + */ +function registerResolver(scheme, resolverClass) { + registeredResolvers[scheme] = resolverClass; +} +/** + * Register a default resolver to handle target names that do not start with + * any registered prefix. + * @param resolverClass + */ +function registerDefaultScheme(scheme) { + defaultScheme = scheme; +} +/** + * Create a name resolver for the specified target, if possible. Throws an + * error if no such name resolver can be created. + * @param target + * @param listener + */ +function createResolver(target, listener, options) { + if (target.scheme !== undefined && target.scheme in registeredResolvers) { + return new registeredResolvers[target.scheme](target, listener, options); + } + else { + throw new Error(`No resolver could be created for target ${(0, uri_parser_1.uriToString)(target)}`); + } +} +/** + * Get the default authority for the specified target, if possible. Throws an + * error if no registered name resolver can parse that target string. + * @param target + */ +function getDefaultAuthority(target) { + if (target.scheme !== undefined && target.scheme in registeredResolvers) { + return registeredResolvers[target.scheme].getDefaultAuthority(target); + } + else { + throw new Error(`Invalid target ${(0, uri_parser_1.uriToString)(target)}`); + } +} +function mapUriDefaultScheme(target) { + if (target.scheme === undefined || !(target.scheme in registeredResolvers)) { + if (defaultScheme !== null) { + return { + scheme: defaultScheme, + authority: undefined, + path: (0, uri_parser_1.uriToString)(target), + }; + } + else { + return null; + } + } + return target; +} +//# sourceMappingURL=resolver.js.map + +/***/ }), + +/***/ 8023: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2022 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ResolvingCall = void 0; +const call_credentials_1 = __nccwpck_require__(79190); +const constants_1 = __nccwpck_require__(68288); +const deadline_1 = __nccwpck_require__(52173); +const metadata_1 = __nccwpck_require__(36100); +const logging = __nccwpck_require__(8536); +const control_plane_status_1 = __nccwpck_require__(39962); +const TRACER_NAME = 'resolving_call'; +class ResolvingCall { + constructor(channel, method, options, filterStackFactory, callNumber) { + this.channel = channel; + this.method = method; + this.filterStackFactory = filterStackFactory; + this.callNumber = callNumber; + this.child = null; + this.readPending = false; + this.pendingMessage = null; + this.pendingHalfClose = false; + this.ended = false; + this.readFilterPending = false; + this.writeFilterPending = false; + this.pendingChildStatus = null; + this.metadata = null; + this.listener = null; + this.statusWatchers = []; + this.deadlineTimer = setTimeout(() => { }, 0); + this.filterStack = null; + this.deadlineStartTime = null; + this.configReceivedTime = null; + this.childStartTime = null; + /** + * Credentials configured for this specific call. Does not include + * call credentials associated with the channel credentials used to create + * the channel. + */ + this.credentials = call_credentials_1.CallCredentials.createEmpty(); + this.deadline = options.deadline; + this.host = options.host; + if (options.parentCall) { + if (options.flags & constants_1.Propagate.CANCELLATION) { + options.parentCall.on('cancelled', () => { + this.cancelWithStatus(constants_1.Status.CANCELLED, 'Cancelled by parent call'); + }); + } + if (options.flags & constants_1.Propagate.DEADLINE) { + this.trace('Propagating deadline from parent: ' + + options.parentCall.getDeadline()); + this.deadline = (0, deadline_1.minDeadline)(this.deadline, options.parentCall.getDeadline()); + } + } + this.trace('Created'); + this.runDeadlineTimer(); + } + trace(text) { + logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, '[' + this.callNumber + '] ' + text); + } + runDeadlineTimer() { + clearTimeout(this.deadlineTimer); + this.deadlineStartTime = new Date(); + this.trace('Deadline: ' + (0, deadline_1.deadlineToString)(this.deadline)); + const timeout = (0, deadline_1.getRelativeTimeout)(this.deadline); + if (timeout !== Infinity) { + this.trace('Deadline will be reached in ' + timeout + 'ms'); + const handleDeadline = () => { + if (!this.deadlineStartTime) { + this.cancelWithStatus(constants_1.Status.DEADLINE_EXCEEDED, 'Deadline exceeded'); + return; + } + const deadlineInfo = []; + const deadlineEndTime = new Date(); + deadlineInfo.push(`Deadline exceeded after ${(0, deadline_1.formatDateDifference)(this.deadlineStartTime, deadlineEndTime)}`); + if (this.configReceivedTime) { + if (this.configReceivedTime > this.deadlineStartTime) { + deadlineInfo.push(`name resolution: ${(0, deadline_1.formatDateDifference)(this.deadlineStartTime, this.configReceivedTime)}`); + } + if (this.childStartTime) { + if (this.childStartTime > this.configReceivedTime) { + deadlineInfo.push(`metadata filters: ${(0, deadline_1.formatDateDifference)(this.configReceivedTime, this.childStartTime)}`); + } + } + else { + deadlineInfo.push('waiting for metadata filters'); + } + } + else { + deadlineInfo.push('waiting for name resolution'); + } + if (this.child) { + deadlineInfo.push(...this.child.getDeadlineInfo()); + } + this.cancelWithStatus(constants_1.Status.DEADLINE_EXCEEDED, deadlineInfo.join(',')); + }; + if (timeout <= 0) { + process.nextTick(handleDeadline); + } + else { + this.deadlineTimer = setTimeout(handleDeadline, timeout); + } + } + } + outputStatus(status) { + if (!this.ended) { + this.ended = true; + if (!this.filterStack) { + this.filterStack = this.filterStackFactory.createFilter(); + } + clearTimeout(this.deadlineTimer); + const filteredStatus = this.filterStack.receiveTrailers(status); + this.trace('ended with status: code=' + + filteredStatus.code + + ' details="' + + filteredStatus.details + + '"'); + this.statusWatchers.forEach(watcher => watcher(filteredStatus)); + process.nextTick(() => { + var _a; + (_a = this.listener) === null || _a === void 0 ? void 0 : _a.onReceiveStatus(filteredStatus); + }); + } + } + sendMessageOnChild(context, message) { + if (!this.child) { + throw new Error('sendMessageonChild called with child not populated'); + } + const child = this.child; + this.writeFilterPending = true; + this.filterStack.sendMessage(Promise.resolve({ message: message, flags: context.flags })).then(filteredMessage => { + this.writeFilterPending = false; + child.sendMessageWithContext(context, filteredMessage.message); + if (this.pendingHalfClose) { + child.halfClose(); + } + }, (status) => { + this.cancelWithStatus(status.code, status.details); + }); + } + getConfig() { + if (this.ended) { + return; + } + if (!this.metadata || !this.listener) { + throw new Error('getConfig called before start'); + } + const configResult = this.channel.getConfig(this.method, this.metadata); + if (configResult.type === 'NONE') { + this.channel.queueCallForConfig(this); + return; + } + else if (configResult.type === 'ERROR') { + if (this.metadata.getOptions().waitForReady) { + this.channel.queueCallForConfig(this); + } + else { + this.outputStatus(configResult.error); + } + return; + } + // configResult.type === 'SUCCESS' + this.configReceivedTime = new Date(); + const config = configResult.config; + if (config.status !== constants_1.Status.OK) { + const { code, details } = (0, control_plane_status_1.restrictControlPlaneStatusCode)(config.status, 'Failed to route call to method ' + this.method); + this.outputStatus({ + code: code, + details: details, + metadata: new metadata_1.Metadata(), + }); + return; + } + if (config.methodConfig.timeout) { + const configDeadline = new Date(); + configDeadline.setSeconds(configDeadline.getSeconds() + config.methodConfig.timeout.seconds); + configDeadline.setMilliseconds(configDeadline.getMilliseconds() + + config.methodConfig.timeout.nanos / 1000000); + this.deadline = (0, deadline_1.minDeadline)(this.deadline, configDeadline); + this.runDeadlineTimer(); + } + this.filterStackFactory.push(config.dynamicFilterFactories); + this.filterStack = this.filterStackFactory.createFilter(); + this.filterStack.sendMetadata(Promise.resolve(this.metadata)).then(filteredMetadata => { + this.child = this.channel.createRetryingCall(config, this.method, this.host, this.credentials, this.deadline); + this.trace('Created child [' + this.child.getCallNumber() + ']'); + this.childStartTime = new Date(); + this.child.start(filteredMetadata, { + onReceiveMetadata: metadata => { + this.trace('Received metadata'); + this.listener.onReceiveMetadata(this.filterStack.receiveMetadata(metadata)); + }, + onReceiveMessage: message => { + this.trace('Received message'); + this.readFilterPending = true; + this.filterStack.receiveMessage(message).then(filteredMesssage => { + this.trace('Finished filtering received message'); + this.readFilterPending = false; + this.listener.onReceiveMessage(filteredMesssage); + if (this.pendingChildStatus) { + this.outputStatus(this.pendingChildStatus); + } + }, (status) => { + this.cancelWithStatus(status.code, status.details); + }); + }, + onReceiveStatus: status => { + this.trace('Received status'); + if (this.readFilterPending) { + this.pendingChildStatus = status; + } + else { + this.outputStatus(status); + } + }, + }); + if (this.readPending) { + this.child.startRead(); + } + if (this.pendingMessage) { + this.sendMessageOnChild(this.pendingMessage.context, this.pendingMessage.message); + } + else if (this.pendingHalfClose) { + this.child.halfClose(); + } + }, (status) => { + this.outputStatus(status); + }); + } + reportResolverError(status) { + var _a; + if ((_a = this.metadata) === null || _a === void 0 ? void 0 : _a.getOptions().waitForReady) { + this.channel.queueCallForConfig(this); + } + else { + this.outputStatus(status); + } + } + cancelWithStatus(status, details) { + var _a; + this.trace('cancelWithStatus code: ' + status + ' details: "' + details + '"'); + (_a = this.child) === null || _a === void 0 ? void 0 : _a.cancelWithStatus(status, details); + this.outputStatus({ + code: status, + details: details, + metadata: new metadata_1.Metadata(), + }); + } + getPeer() { + var _a, _b; + return (_b = (_a = this.child) === null || _a === void 0 ? void 0 : _a.getPeer()) !== null && _b !== void 0 ? _b : this.channel.getTarget(); + } + start(metadata, listener) { + this.trace('start called'); + this.metadata = metadata.clone(); + this.listener = listener; + this.getConfig(); + } + sendMessageWithContext(context, message) { + this.trace('write() called with message of length ' + message.length); + if (this.child) { + this.sendMessageOnChild(context, message); + } + else { + this.pendingMessage = { context, message }; + } + } + startRead() { + this.trace('startRead called'); + if (this.child) { + this.child.startRead(); + } + else { + this.readPending = true; + } + } + halfClose() { + this.trace('halfClose called'); + if (this.child && !this.writeFilterPending) { + this.child.halfClose(); + } + else { + this.pendingHalfClose = true; + } + } + setCredentials(credentials) { + this.credentials = credentials; + } + addStatusWatcher(watcher) { + this.statusWatchers.push(watcher); + } + getCallNumber() { + return this.callNumber; + } + getAuthContext() { + if (this.child) { + return this.child.getAuthContext(); + } + else { + return null; + } + } +} +exports.ResolvingCall = ResolvingCall; +//# sourceMappingURL=resolving-call.js.map + +/***/ }), + +/***/ 63962: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ResolvingLoadBalancer = void 0; +const load_balancer_1 = __nccwpck_require__(7000); +const service_config_1 = __nccwpck_require__(70005); +const connectivity_state_1 = __nccwpck_require__(60778); +const resolver_1 = __nccwpck_require__(76255); +const picker_1 = __nccwpck_require__(71663); +const backoff_timeout_1 = __nccwpck_require__(14643); +const constants_1 = __nccwpck_require__(68288); +const metadata_1 = __nccwpck_require__(36100); +const logging = __nccwpck_require__(8536); +const constants_2 = __nccwpck_require__(68288); +const uri_parser_1 = __nccwpck_require__(56027); +const load_balancer_child_handler_1 = __nccwpck_require__(21450); +const TRACER_NAME = 'resolving_load_balancer'; +function trace(text) { + logging.trace(constants_2.LogVerbosity.DEBUG, TRACER_NAME, text); +} +/** + * Name match levels in order from most to least specific. This is the order in + * which searches will be performed. + */ +const NAME_MATCH_LEVEL_ORDER = [ + 'SERVICE_AND_METHOD', + 'SERVICE', + 'EMPTY', +]; +function hasMatchingName(service, method, methodConfig, matchLevel) { + for (const name of methodConfig.name) { + switch (matchLevel) { + case 'EMPTY': + if (!name.service && !name.method) { + return true; + } + break; + case 'SERVICE': + if (name.service === service && !name.method) { + return true; + } + break; + case 'SERVICE_AND_METHOD': + if (name.service === service && name.method === method) { + return true; + } + } + } + return false; +} +function findMatchingConfig(service, method, methodConfigs, matchLevel) { + for (const config of methodConfigs) { + if (hasMatchingName(service, method, config, matchLevel)) { + return config; + } + } + return null; +} +function getDefaultConfigSelector(serviceConfig) { + return { + invoke(methodName, metadata) { + var _a, _b; + const splitName = methodName.split('/').filter(x => x.length > 0); + const service = (_a = splitName[0]) !== null && _a !== void 0 ? _a : ''; + const method = (_b = splitName[1]) !== null && _b !== void 0 ? _b : ''; + if (serviceConfig && serviceConfig.methodConfig) { + /* Check for the following in order, and return the first method + * config that matches: + * 1. A name that exactly matches the service and method + * 2. A name with no method set that matches the service + * 3. An empty name + */ + for (const matchLevel of NAME_MATCH_LEVEL_ORDER) { + const matchingConfig = findMatchingConfig(service, method, serviceConfig.methodConfig, matchLevel); + if (matchingConfig) { + return { + methodConfig: matchingConfig, + pickInformation: {}, + status: constants_1.Status.OK, + dynamicFilterFactories: [], + }; + } + } + } + return { + methodConfig: { name: [] }, + pickInformation: {}, + status: constants_1.Status.OK, + dynamicFilterFactories: [], + }; + }, + unref() { } + }; +} +class ResolvingLoadBalancer { + /** + * Wrapper class that behaves like a `LoadBalancer` and also handles name + * resolution internally. + * @param target The address of the backend to connect to. + * @param channelControlHelper `ChannelControlHelper` instance provided by + * this load balancer's owner. + * @param defaultServiceConfig The default service configuration to be used + * if none is provided by the name resolver. A `null` value indicates + * that the default behavior should be the default unconfigured behavior. + * In practice, that means using the "pick first" load balancer + * implmentation + */ + constructor(target, channelControlHelper, channelOptions, onSuccessfulResolution, onFailedResolution) { + this.target = target; + this.channelControlHelper = channelControlHelper; + this.channelOptions = channelOptions; + this.onSuccessfulResolution = onSuccessfulResolution; + this.onFailedResolution = onFailedResolution; + this.latestChildState = connectivity_state_1.ConnectivityState.IDLE; + this.latestChildPicker = new picker_1.QueuePicker(this); + this.latestChildErrorMessage = null; + /** + * This resolving load balancer's current connectivity state. + */ + this.currentState = connectivity_state_1.ConnectivityState.IDLE; + /** + * The service config object from the last successful resolution, if + * available. A value of null indicates that we have not yet received a valid + * service config from the resolver. + */ + this.previousServiceConfig = null; + /** + * Indicates whether we should attempt to resolve again after the backoff + * timer runs out. + */ + this.continueResolving = false; + if (channelOptions['grpc.service_config']) { + this.defaultServiceConfig = (0, service_config_1.validateServiceConfig)(JSON.parse(channelOptions['grpc.service_config'])); + } + else { + this.defaultServiceConfig = { + loadBalancingConfig: [], + methodConfig: [], + }; + } + this.updateState(connectivity_state_1.ConnectivityState.IDLE, new picker_1.QueuePicker(this), null); + this.childLoadBalancer = new load_balancer_child_handler_1.ChildLoadBalancerHandler({ + createSubchannel: channelControlHelper.createSubchannel.bind(channelControlHelper), + requestReresolution: () => { + /* If the backoffTimeout is running, we're still backing off from + * making resolve requests, so we shouldn't make another one here. + * In that case, the backoff timer callback will call + * updateResolution */ + if (this.backoffTimeout.isRunning()) { + trace('requestReresolution delayed by backoff timer until ' + + this.backoffTimeout.getEndTime().toISOString()); + this.continueResolving = true; + } + else { + this.updateResolution(); + } + }, + updateState: (newState, picker, errorMessage) => { + this.latestChildState = newState; + this.latestChildPicker = picker; + this.latestChildErrorMessage = errorMessage; + this.updateState(newState, picker, errorMessage); + }, + addChannelzChild: channelControlHelper.addChannelzChild.bind(channelControlHelper), + removeChannelzChild: channelControlHelper.removeChannelzChild.bind(channelControlHelper), + }); + this.innerResolver = (0, resolver_1.createResolver)(target, this.handleResolverResult.bind(this), channelOptions); + const backoffOptions = { + initialDelay: channelOptions['grpc.initial_reconnect_backoff_ms'], + maxDelay: channelOptions['grpc.max_reconnect_backoff_ms'], + }; + this.backoffTimeout = new backoff_timeout_1.BackoffTimeout(() => { + if (this.continueResolving) { + this.updateResolution(); + this.continueResolving = false; + } + else { + this.updateState(this.latestChildState, this.latestChildPicker, this.latestChildErrorMessage); + } + }, backoffOptions); + this.backoffTimeout.unref(); + } + handleResolverResult(endpointList, attributes, serviceConfig, resolutionNote) { + var _a, _b; + this.backoffTimeout.stop(); + this.backoffTimeout.reset(); + let resultAccepted = true; + let workingServiceConfig = null; + if (serviceConfig === null) { + workingServiceConfig = this.defaultServiceConfig; + } + else if (serviceConfig.ok) { + workingServiceConfig = serviceConfig.value; + } + else { + if (this.previousServiceConfig !== null) { + workingServiceConfig = this.previousServiceConfig; + } + else { + resultAccepted = false; + this.handleResolutionFailure(serviceConfig.error); + } + } + if (workingServiceConfig !== null) { + const workingConfigList = (_a = workingServiceConfig === null || workingServiceConfig === void 0 ? void 0 : workingServiceConfig.loadBalancingConfig) !== null && _a !== void 0 ? _a : []; + const loadBalancingConfig = (0, load_balancer_1.selectLbConfigFromList)(workingConfigList, true); + if (loadBalancingConfig === null) { + resultAccepted = false; + this.handleResolutionFailure({ + code: constants_1.Status.UNAVAILABLE, + details: 'All load balancer options in service config are not compatible', + metadata: new metadata_1.Metadata(), + }); + } + else { + resultAccepted = this.childLoadBalancer.updateAddressList(endpointList, loadBalancingConfig, Object.assign(Object.assign({}, this.channelOptions), attributes), resolutionNote); + } + } + if (resultAccepted) { + this.onSuccessfulResolution(workingServiceConfig, (_b = attributes[resolver_1.CHANNEL_ARGS_CONFIG_SELECTOR_KEY]) !== null && _b !== void 0 ? _b : getDefaultConfigSelector(workingServiceConfig)); + } + return resultAccepted; + } + updateResolution() { + this.innerResolver.updateResolution(); + if (this.currentState === connectivity_state_1.ConnectivityState.IDLE) { + /* this.latestChildPicker is initialized as new QueuePicker(this), which + * is an appropriate value here if the child LB policy is unset. + * Otherwise, we want to delegate to the child here, in case that + * triggers something. */ + this.updateState(connectivity_state_1.ConnectivityState.CONNECTING, this.latestChildPicker, this.latestChildErrorMessage); + } + this.backoffTimeout.runOnce(); + } + updateState(connectivityState, picker, errorMessage) { + trace((0, uri_parser_1.uriToString)(this.target) + + ' ' + + connectivity_state_1.ConnectivityState[this.currentState] + + ' -> ' + + connectivity_state_1.ConnectivityState[connectivityState]); + // Ensure that this.exitIdle() is called by the picker + if (connectivityState === connectivity_state_1.ConnectivityState.IDLE) { + picker = new picker_1.QueuePicker(this, picker); + } + this.currentState = connectivityState; + this.channelControlHelper.updateState(connectivityState, picker, errorMessage); + } + handleResolutionFailure(error) { + if (this.latestChildState === connectivity_state_1.ConnectivityState.IDLE) { + this.updateState(connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE, new picker_1.UnavailablePicker(error), error.details); + this.onFailedResolution(error); + } + } + exitIdle() { + if (this.currentState === connectivity_state_1.ConnectivityState.IDLE || + this.currentState === connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE) { + if (this.backoffTimeout.isRunning()) { + this.continueResolving = true; + } + else { + this.updateResolution(); + } + } + this.childLoadBalancer.exitIdle(); + } + updateAddressList(endpointList, lbConfig) { + throw new Error('updateAddressList not supported on ResolvingLoadBalancer'); + } + resetBackoff() { + this.backoffTimeout.reset(); + this.childLoadBalancer.resetBackoff(); + } + destroy() { + this.childLoadBalancer.destroy(); + this.innerResolver.destroy(); + this.backoffTimeout.reset(); + this.backoffTimeout.stop(); + this.latestChildState = connectivity_state_1.ConnectivityState.IDLE; + this.latestChildPicker = new picker_1.QueuePicker(this); + this.currentState = connectivity_state_1.ConnectivityState.IDLE; + this.previousServiceConfig = null; + this.continueResolving = false; + } + getTypeName() { + return 'resolving_load_balancer'; + } +} +exports.ResolvingLoadBalancer = ResolvingLoadBalancer; +//# sourceMappingURL=resolving-load-balancer.js.map + +/***/ }), + +/***/ 2532: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2022 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.RetryingCall = exports.MessageBufferTracker = exports.RetryThrottler = void 0; +const constants_1 = __nccwpck_require__(68288); +const deadline_1 = __nccwpck_require__(52173); +const metadata_1 = __nccwpck_require__(36100); +const logging = __nccwpck_require__(8536); +const TRACER_NAME = 'retrying_call'; +class RetryThrottler { + constructor(maxTokens, tokenRatio, previousRetryThrottler) { + this.maxTokens = maxTokens; + this.tokenRatio = tokenRatio; + if (previousRetryThrottler) { + /* When carrying over tokens from a previous config, rescale them to the + * new max value */ + this.tokens = + previousRetryThrottler.tokens * + (maxTokens / previousRetryThrottler.maxTokens); + } + else { + this.tokens = maxTokens; + } + } + addCallSucceeded() { + this.tokens = Math.min(this.tokens + this.tokenRatio, this.maxTokens); + } + addCallFailed() { + this.tokens = Math.max(this.tokens - 1, 0); + } + canRetryCall() { + return this.tokens > (this.maxTokens / 2); + } +} +exports.RetryThrottler = RetryThrottler; +class MessageBufferTracker { + constructor(totalLimit, limitPerCall) { + this.totalLimit = totalLimit; + this.limitPerCall = limitPerCall; + this.totalAllocated = 0; + this.allocatedPerCall = new Map(); + } + allocate(size, callId) { + var _a; + const currentPerCall = (_a = this.allocatedPerCall.get(callId)) !== null && _a !== void 0 ? _a : 0; + if (this.limitPerCall - currentPerCall < size || + this.totalLimit - this.totalAllocated < size) { + return false; + } + this.allocatedPerCall.set(callId, currentPerCall + size); + this.totalAllocated += size; + return true; + } + free(size, callId) { + var _a; + if (this.totalAllocated < size) { + throw new Error(`Invalid buffer allocation state: call ${callId} freed ${size} > total allocated ${this.totalAllocated}`); + } + this.totalAllocated -= size; + const currentPerCall = (_a = this.allocatedPerCall.get(callId)) !== null && _a !== void 0 ? _a : 0; + if (currentPerCall < size) { + throw new Error(`Invalid buffer allocation state: call ${callId} freed ${size} > allocated for call ${currentPerCall}`); + } + this.allocatedPerCall.set(callId, currentPerCall - size); + } + freeAll(callId) { + var _a; + const currentPerCall = (_a = this.allocatedPerCall.get(callId)) !== null && _a !== void 0 ? _a : 0; + if (this.totalAllocated < currentPerCall) { + throw new Error(`Invalid buffer allocation state: call ${callId} allocated ${currentPerCall} > total allocated ${this.totalAllocated}`); + } + this.totalAllocated -= currentPerCall; + this.allocatedPerCall.delete(callId); + } +} +exports.MessageBufferTracker = MessageBufferTracker; +const PREVIONS_RPC_ATTEMPTS_METADATA_KEY = 'grpc-previous-rpc-attempts'; +const DEFAULT_MAX_ATTEMPTS_LIMIT = 5; +class RetryingCall { + constructor(channel, callConfig, methodName, host, credentials, deadline, callNumber, bufferTracker, retryThrottler) { + var _a; + this.channel = channel; + this.callConfig = callConfig; + this.methodName = methodName; + this.host = host; + this.credentials = credentials; + this.deadline = deadline; + this.callNumber = callNumber; + this.bufferTracker = bufferTracker; + this.retryThrottler = retryThrottler; + this.listener = null; + this.initialMetadata = null; + this.underlyingCalls = []; + this.writeBuffer = []; + /** + * The offset of message indices in the writeBuffer. For example, if + * writeBufferOffset is 10, message 10 is in writeBuffer[0] and message 15 + * is in writeBuffer[5]. + */ + this.writeBufferOffset = 0; + /** + * Tracks whether a read has been started, so that we know whether to start + * reads on new child calls. This only matters for the first read, because + * once a message comes in the child call becomes committed and there will + * be no new child calls. + */ + this.readStarted = false; + this.transparentRetryUsed = false; + /** + * Number of attempts so far + */ + this.attempts = 0; + this.hedgingTimer = null; + this.committedCallIndex = null; + this.initialRetryBackoffSec = 0; + this.nextRetryBackoffSec = 0; + const maxAttemptsLimit = (_a = channel.getOptions()['grpc-node.retry_max_attempts_limit']) !== null && _a !== void 0 ? _a : DEFAULT_MAX_ATTEMPTS_LIMIT; + if (channel.getOptions()['grpc.enable_retries'] === 0) { + this.state = 'NO_RETRY'; + this.maxAttempts = 1; + } + else if (callConfig.methodConfig.retryPolicy) { + this.state = 'RETRY'; + const retryPolicy = callConfig.methodConfig.retryPolicy; + this.nextRetryBackoffSec = this.initialRetryBackoffSec = Number(retryPolicy.initialBackoff.substring(0, retryPolicy.initialBackoff.length - 1)); + this.maxAttempts = Math.min(retryPolicy.maxAttempts, maxAttemptsLimit); + } + else if (callConfig.methodConfig.hedgingPolicy) { + this.state = 'HEDGING'; + this.maxAttempts = Math.min(callConfig.methodConfig.hedgingPolicy.maxAttempts, maxAttemptsLimit); + } + else { + this.state = 'TRANSPARENT_ONLY'; + this.maxAttempts = 1; + } + this.startTime = new Date(); + } + getDeadlineInfo() { + if (this.underlyingCalls.length === 0) { + return []; + } + const deadlineInfo = []; + const latestCall = this.underlyingCalls[this.underlyingCalls.length - 1]; + if (this.underlyingCalls.length > 1) { + deadlineInfo.push(`previous attempts: ${this.underlyingCalls.length - 1}`); + } + if (latestCall.startTime > this.startTime) { + deadlineInfo.push(`time to current attempt start: ${(0, deadline_1.formatDateDifference)(this.startTime, latestCall.startTime)}`); + } + deadlineInfo.push(...latestCall.call.getDeadlineInfo()); + return deadlineInfo; + } + getCallNumber() { + return this.callNumber; + } + trace(text) { + logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, '[' + this.callNumber + '] ' + text); + } + reportStatus(statusObject) { + this.trace('ended with status: code=' + + statusObject.code + + ' details="' + + statusObject.details + + '" start time=' + + this.startTime.toISOString()); + this.bufferTracker.freeAll(this.callNumber); + this.writeBufferOffset = this.writeBufferOffset + this.writeBuffer.length; + this.writeBuffer = []; + process.nextTick(() => { + var _a; + // Explicitly construct status object to remove progress field + (_a = this.listener) === null || _a === void 0 ? void 0 : _a.onReceiveStatus({ + code: statusObject.code, + details: statusObject.details, + metadata: statusObject.metadata, + }); + }); + } + cancelWithStatus(status, details) { + this.trace('cancelWithStatus code: ' + status + ' details: "' + details + '"'); + this.reportStatus({ code: status, details, metadata: new metadata_1.Metadata() }); + for (const { call } of this.underlyingCalls) { + call.cancelWithStatus(status, details); + } + } + getPeer() { + if (this.committedCallIndex !== null) { + return this.underlyingCalls[this.committedCallIndex].call.getPeer(); + } + else { + return 'unknown'; + } + } + getBufferEntry(messageIndex) { + var _a; + return ((_a = this.writeBuffer[messageIndex - this.writeBufferOffset]) !== null && _a !== void 0 ? _a : { + entryType: 'FREED', + allocated: false, + }); + } + getNextBufferIndex() { + return this.writeBufferOffset + this.writeBuffer.length; + } + clearSentMessages() { + if (this.state !== 'COMMITTED') { + return; + } + let earliestNeededMessageIndex; + if (this.underlyingCalls[this.committedCallIndex].state === 'COMPLETED') { + /* If the committed call is completed, clear all messages, even if some + * have not been sent. */ + earliestNeededMessageIndex = this.getNextBufferIndex(); + } + else { + earliestNeededMessageIndex = + this.underlyingCalls[this.committedCallIndex].nextMessageToSend; + } + for (let messageIndex = this.writeBufferOffset; messageIndex < earliestNeededMessageIndex; messageIndex++) { + const bufferEntry = this.getBufferEntry(messageIndex); + if (bufferEntry.allocated) { + this.bufferTracker.free(bufferEntry.message.message.length, this.callNumber); + } + } + this.writeBuffer = this.writeBuffer.slice(earliestNeededMessageIndex - this.writeBufferOffset); + this.writeBufferOffset = earliestNeededMessageIndex; + } + commitCall(index) { + var _a, _b; + if (this.state === 'COMMITTED') { + return; + } + this.trace('Committing call [' + + this.underlyingCalls[index].call.getCallNumber() + + '] at index ' + + index); + this.state = 'COMMITTED'; + (_b = (_a = this.callConfig).onCommitted) === null || _b === void 0 ? void 0 : _b.call(_a); + this.committedCallIndex = index; + for (let i = 0; i < this.underlyingCalls.length; i++) { + if (i === index) { + continue; + } + if (this.underlyingCalls[i].state === 'COMPLETED') { + continue; + } + this.underlyingCalls[i].state = 'COMPLETED'; + this.underlyingCalls[i].call.cancelWithStatus(constants_1.Status.CANCELLED, 'Discarded in favor of other hedged attempt'); + } + this.clearSentMessages(); + } + commitCallWithMostMessages() { + if (this.state === 'COMMITTED') { + return; + } + let mostMessages = -1; + let callWithMostMessages = -1; + for (const [index, childCall] of this.underlyingCalls.entries()) { + if (childCall.state === 'ACTIVE' && + childCall.nextMessageToSend > mostMessages) { + mostMessages = childCall.nextMessageToSend; + callWithMostMessages = index; + } + } + if (callWithMostMessages === -1) { + /* There are no active calls, disable retries to force the next call that + * is started to be committed. */ + this.state = 'TRANSPARENT_ONLY'; + } + else { + this.commitCall(callWithMostMessages); + } + } + isStatusCodeInList(list, code) { + return list.some(value => { + var _a; + return value === code || + value.toString().toLowerCase() === ((_a = constants_1.Status[code]) === null || _a === void 0 ? void 0 : _a.toLowerCase()); + }); + } + getNextRetryJitter() { + /* Jitter of +-20% is applied: https://github.com/grpc/proposal/blob/master/A6-client-retries.md#exponential-backoff */ + return Math.random() * (1.2 - 0.8) + 0.8; + } + getNextRetryBackoffMs() { + var _a; + const retryPolicy = (_a = this.callConfig) === null || _a === void 0 ? void 0 : _a.methodConfig.retryPolicy; + if (!retryPolicy) { + return 0; + } + const jitter = this.getNextRetryJitter(); + const nextBackoffMs = jitter * this.nextRetryBackoffSec * 1000; + const maxBackoffSec = Number(retryPolicy.maxBackoff.substring(0, retryPolicy.maxBackoff.length - 1)); + this.nextRetryBackoffSec = Math.min(this.nextRetryBackoffSec * retryPolicy.backoffMultiplier, maxBackoffSec); + return nextBackoffMs; + } + maybeRetryCall(pushback, callback) { + if (this.state !== 'RETRY') { + callback(false); + return; + } + if (this.attempts >= this.maxAttempts) { + callback(false); + return; + } + let retryDelayMs; + if (pushback === null) { + retryDelayMs = this.getNextRetryBackoffMs(); + } + else if (pushback < 0) { + this.state = 'TRANSPARENT_ONLY'; + callback(false); + return; + } + else { + retryDelayMs = pushback; + this.nextRetryBackoffSec = this.initialRetryBackoffSec; + } + setTimeout(() => { + var _a, _b; + if (this.state !== 'RETRY') { + callback(false); + return; + } + if ((_b = (_a = this.retryThrottler) === null || _a === void 0 ? void 0 : _a.canRetryCall()) !== null && _b !== void 0 ? _b : true) { + callback(true); + this.attempts += 1; + this.startNewAttempt(); + } + else { + this.trace('Retry attempt denied by throttling policy'); + callback(false); + } + }, retryDelayMs); + } + countActiveCalls() { + let count = 0; + for (const call of this.underlyingCalls) { + if ((call === null || call === void 0 ? void 0 : call.state) === 'ACTIVE') { + count += 1; + } + } + return count; + } + handleProcessedStatus(status, callIndex, pushback) { + var _a, _b, _c; + switch (this.state) { + case 'COMMITTED': + case 'NO_RETRY': + case 'TRANSPARENT_ONLY': + this.commitCall(callIndex); + this.reportStatus(status); + break; + case 'HEDGING': + if (this.isStatusCodeInList((_a = this.callConfig.methodConfig.hedgingPolicy.nonFatalStatusCodes) !== null && _a !== void 0 ? _a : [], status.code)) { + (_b = this.retryThrottler) === null || _b === void 0 ? void 0 : _b.addCallFailed(); + let delayMs; + if (pushback === null) { + delayMs = 0; + } + else if (pushback < 0) { + this.state = 'TRANSPARENT_ONLY'; + this.commitCall(callIndex); + this.reportStatus(status); + return; + } + else { + delayMs = pushback; + } + setTimeout(() => { + this.maybeStartHedgingAttempt(); + // If after trying to start a call there are no active calls, this was the last one + if (this.countActiveCalls() === 0) { + this.commitCall(callIndex); + this.reportStatus(status); + } + }, delayMs); + } + else { + this.commitCall(callIndex); + this.reportStatus(status); + } + break; + case 'RETRY': + if (this.isStatusCodeInList(this.callConfig.methodConfig.retryPolicy.retryableStatusCodes, status.code)) { + (_c = this.retryThrottler) === null || _c === void 0 ? void 0 : _c.addCallFailed(); + this.maybeRetryCall(pushback, retried => { + if (!retried) { + this.commitCall(callIndex); + this.reportStatus(status); + } + }); + } + else { + this.commitCall(callIndex); + this.reportStatus(status); + } + break; + } + } + getPushback(metadata) { + const mdValue = metadata.get('grpc-retry-pushback-ms'); + if (mdValue.length === 0) { + return null; + } + try { + return parseInt(mdValue[0]); + } + catch (e) { + return -1; + } + } + handleChildStatus(status, callIndex) { + var _a; + if (this.underlyingCalls[callIndex].state === 'COMPLETED') { + return; + } + this.trace('state=' + + this.state + + ' handling status with progress ' + + status.progress + + ' from child [' + + this.underlyingCalls[callIndex].call.getCallNumber() + + '] in state ' + + this.underlyingCalls[callIndex].state); + this.underlyingCalls[callIndex].state = 'COMPLETED'; + if (status.code === constants_1.Status.OK) { + (_a = this.retryThrottler) === null || _a === void 0 ? void 0 : _a.addCallSucceeded(); + this.commitCall(callIndex); + this.reportStatus(status); + return; + } + if (this.state === 'NO_RETRY') { + this.commitCall(callIndex); + this.reportStatus(status); + return; + } + if (this.state === 'COMMITTED') { + this.reportStatus(status); + return; + } + const pushback = this.getPushback(status.metadata); + switch (status.progress) { + case 'NOT_STARTED': + // RPC never leaves the client, always safe to retry + this.startNewAttempt(); + break; + case 'REFUSED': + // RPC reaches the server library, but not the server application logic + if (this.transparentRetryUsed) { + this.handleProcessedStatus(status, callIndex, pushback); + } + else { + this.transparentRetryUsed = true; + this.startNewAttempt(); + } + break; + case 'DROP': + this.commitCall(callIndex); + this.reportStatus(status); + break; + case 'PROCESSED': + this.handleProcessedStatus(status, callIndex, pushback); + break; + } + } + maybeStartHedgingAttempt() { + if (this.state !== 'HEDGING') { + return; + } + if (!this.callConfig.methodConfig.hedgingPolicy) { + return; + } + if (this.attempts >= this.maxAttempts) { + return; + } + this.attempts += 1; + this.startNewAttempt(); + this.maybeStartHedgingTimer(); + } + maybeStartHedgingTimer() { + var _a, _b, _c; + if (this.hedgingTimer) { + clearTimeout(this.hedgingTimer); + } + if (this.state !== 'HEDGING') { + return; + } + if (!this.callConfig.methodConfig.hedgingPolicy) { + return; + } + const hedgingPolicy = this.callConfig.methodConfig.hedgingPolicy; + if (this.attempts >= this.maxAttempts) { + return; + } + const hedgingDelayString = (_a = hedgingPolicy.hedgingDelay) !== null && _a !== void 0 ? _a : '0s'; + const hedgingDelaySec = Number(hedgingDelayString.substring(0, hedgingDelayString.length - 1)); + this.hedgingTimer = setTimeout(() => { + this.maybeStartHedgingAttempt(); + }, hedgingDelaySec * 1000); + (_c = (_b = this.hedgingTimer).unref) === null || _c === void 0 ? void 0 : _c.call(_b); + } + startNewAttempt() { + const child = this.channel.createLoadBalancingCall(this.callConfig, this.methodName, this.host, this.credentials, this.deadline); + this.trace('Created child call [' + + child.getCallNumber() + + '] for attempt ' + + this.attempts); + const index = this.underlyingCalls.length; + this.underlyingCalls.push({ + state: 'ACTIVE', + call: child, + nextMessageToSend: 0, + startTime: new Date(), + }); + const previousAttempts = this.attempts - 1; + const initialMetadata = this.initialMetadata.clone(); + if (previousAttempts > 0) { + initialMetadata.set(PREVIONS_RPC_ATTEMPTS_METADATA_KEY, `${previousAttempts}`); + } + let receivedMetadata = false; + child.start(initialMetadata, { + onReceiveMetadata: metadata => { + this.trace('Received metadata from child [' + child.getCallNumber() + ']'); + this.commitCall(index); + receivedMetadata = true; + if (previousAttempts > 0) { + metadata.set(PREVIONS_RPC_ATTEMPTS_METADATA_KEY, `${previousAttempts}`); + } + if (this.underlyingCalls[index].state === 'ACTIVE') { + this.listener.onReceiveMetadata(metadata); + } + }, + onReceiveMessage: message => { + this.trace('Received message from child [' + child.getCallNumber() + ']'); + this.commitCall(index); + if (this.underlyingCalls[index].state === 'ACTIVE') { + this.listener.onReceiveMessage(message); + } + }, + onReceiveStatus: status => { + this.trace('Received status from child [' + child.getCallNumber() + ']'); + if (!receivedMetadata && previousAttempts > 0) { + status.metadata.set(PREVIONS_RPC_ATTEMPTS_METADATA_KEY, `${previousAttempts}`); + } + this.handleChildStatus(status, index); + }, + }); + this.sendNextChildMessage(index); + if (this.readStarted) { + child.startRead(); + } + } + start(metadata, listener) { + this.trace('start called'); + this.listener = listener; + this.initialMetadata = metadata; + this.attempts += 1; + this.startNewAttempt(); + this.maybeStartHedgingTimer(); + } + handleChildWriteCompleted(childIndex) { + var _a, _b; + const childCall = this.underlyingCalls[childIndex]; + const messageIndex = childCall.nextMessageToSend; + (_b = (_a = this.getBufferEntry(messageIndex)).callback) === null || _b === void 0 ? void 0 : _b.call(_a); + this.clearSentMessages(); + childCall.nextMessageToSend += 1; + this.sendNextChildMessage(childIndex); + } + sendNextChildMessage(childIndex) { + const childCall = this.underlyingCalls[childIndex]; + if (childCall.state === 'COMPLETED') { + return; + } + if (this.getBufferEntry(childCall.nextMessageToSend)) { + const bufferEntry = this.getBufferEntry(childCall.nextMessageToSend); + switch (bufferEntry.entryType) { + case 'MESSAGE': + childCall.call.sendMessageWithContext({ + callback: error => { + // Ignore error + this.handleChildWriteCompleted(childIndex); + }, + }, bufferEntry.message.message); + break; + case 'HALF_CLOSE': + childCall.nextMessageToSend += 1; + childCall.call.halfClose(); + break; + case 'FREED': + // Should not be possible + break; + } + } + } + sendMessageWithContext(context, message) { + var _a; + this.trace('write() called with message of length ' + message.length); + const writeObj = { + message, + flags: context.flags, + }; + const messageIndex = this.getNextBufferIndex(); + const bufferEntry = { + entryType: 'MESSAGE', + message: writeObj, + allocated: this.bufferTracker.allocate(message.length, this.callNumber), + }; + this.writeBuffer.push(bufferEntry); + if (bufferEntry.allocated) { + (_a = context.callback) === null || _a === void 0 ? void 0 : _a.call(context); + for (const [callIndex, call] of this.underlyingCalls.entries()) { + if (call.state === 'ACTIVE' && + call.nextMessageToSend === messageIndex) { + call.call.sendMessageWithContext({ + callback: error => { + // Ignore error + this.handleChildWriteCompleted(callIndex); + }, + }, message); + } + } + } + else { + this.commitCallWithMostMessages(); + // commitCallWithMostMessages can fail if we are between ping attempts + if (this.committedCallIndex === null) { + return; + } + const call = this.underlyingCalls[this.committedCallIndex]; + bufferEntry.callback = context.callback; + if (call.state === 'ACTIVE' && call.nextMessageToSend === messageIndex) { + call.call.sendMessageWithContext({ + callback: error => { + // Ignore error + this.handleChildWriteCompleted(this.committedCallIndex); + }, + }, message); + } + } + } + startRead() { + this.trace('startRead called'); + this.readStarted = true; + for (const underlyingCall of this.underlyingCalls) { + if ((underlyingCall === null || underlyingCall === void 0 ? void 0 : underlyingCall.state) === 'ACTIVE') { + underlyingCall.call.startRead(); + } + } + } + halfClose() { + this.trace('halfClose called'); + const halfCloseIndex = this.getNextBufferIndex(); + this.writeBuffer.push({ + entryType: 'HALF_CLOSE', + allocated: false, + }); + for (const call of this.underlyingCalls) { + if ((call === null || call === void 0 ? void 0 : call.state) === 'ACTIVE' && + call.nextMessageToSend === halfCloseIndex) { + call.nextMessageToSend += 1; + call.call.halfClose(); + } + } + } + setCredentials(newCredentials) { + throw new Error('Method not implemented.'); + } + getMethod() { + return this.methodName; + } + getHost() { + return this.host; + } + getAuthContext() { + if (this.committedCallIndex !== null) { + return this.underlyingCalls[this.committedCallIndex].call.getAuthContext(); + } + else { + return null; + } + } +} +exports.RetryingCall = RetryingCall; +//# sourceMappingURL=retrying-call.js.map + +/***/ }), + +/***/ 34615: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ServerDuplexStreamImpl = exports.ServerWritableStreamImpl = exports.ServerReadableStreamImpl = exports.ServerUnaryCallImpl = void 0; +exports.serverErrorToStatus = serverErrorToStatus; +const events_1 = __nccwpck_require__(24434); +const stream_1 = __nccwpck_require__(2203); +const constants_1 = __nccwpck_require__(68288); +const metadata_1 = __nccwpck_require__(36100); +function serverErrorToStatus(error, overrideTrailers) { + var _a; + const status = { + code: constants_1.Status.UNKNOWN, + details: 'message' in error ? error.message : 'Unknown Error', + metadata: (_a = overrideTrailers !== null && overrideTrailers !== void 0 ? overrideTrailers : error.metadata) !== null && _a !== void 0 ? _a : null, + }; + if ('code' in error && + typeof error.code === 'number' && + Number.isInteger(error.code)) { + status.code = error.code; + if ('details' in error && typeof error.details === 'string') { + status.details = error.details; + } + } + return status; +} +class ServerUnaryCallImpl extends events_1.EventEmitter { + constructor(path, call, metadata, request) { + super(); + this.path = path; + this.call = call; + this.metadata = metadata; + this.request = request; + this.cancelled = false; + } + getPeer() { + return this.call.getPeer(); + } + sendMetadata(responseMetadata) { + this.call.sendMetadata(responseMetadata); + } + getDeadline() { + return this.call.getDeadline(); + } + getPath() { + return this.path; + } + getHost() { + return this.call.getHost(); + } + getAuthContext() { + return this.call.getAuthContext(); + } + getMetricsRecorder() { + return this.call.getMetricsRecorder(); + } +} +exports.ServerUnaryCallImpl = ServerUnaryCallImpl; +class ServerReadableStreamImpl extends stream_1.Readable { + constructor(path, call, metadata) { + super({ objectMode: true }); + this.path = path; + this.call = call; + this.metadata = metadata; + this.cancelled = false; + } + _read(size) { + this.call.startRead(); + } + getPeer() { + return this.call.getPeer(); + } + sendMetadata(responseMetadata) { + this.call.sendMetadata(responseMetadata); + } + getDeadline() { + return this.call.getDeadline(); + } + getPath() { + return this.path; + } + getHost() { + return this.call.getHost(); + } + getAuthContext() { + return this.call.getAuthContext(); + } + getMetricsRecorder() { + return this.call.getMetricsRecorder(); + } +} +exports.ServerReadableStreamImpl = ServerReadableStreamImpl; +class ServerWritableStreamImpl extends stream_1.Writable { + constructor(path, call, metadata, request) { + super({ objectMode: true }); + this.path = path; + this.call = call; + this.metadata = metadata; + this.request = request; + this.pendingStatus = { + code: constants_1.Status.OK, + details: 'OK', + }; + this.cancelled = false; + this.trailingMetadata = new metadata_1.Metadata(); + this.on('error', err => { + this.pendingStatus = serverErrorToStatus(err); + this.end(); + }); + } + getPeer() { + return this.call.getPeer(); + } + sendMetadata(responseMetadata) { + this.call.sendMetadata(responseMetadata); + } + getDeadline() { + return this.call.getDeadline(); + } + getPath() { + return this.path; + } + getHost() { + return this.call.getHost(); + } + getAuthContext() { + return this.call.getAuthContext(); + } + getMetricsRecorder() { + return this.call.getMetricsRecorder(); + } + _write(chunk, encoding, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + callback) { + this.call.sendMessage(chunk, callback); + } + _final(callback) { + var _a; + callback(null); + this.call.sendStatus(Object.assign(Object.assign({}, this.pendingStatus), { metadata: (_a = this.pendingStatus.metadata) !== null && _a !== void 0 ? _a : this.trailingMetadata })); + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any + end(metadata) { + if (metadata) { + this.trailingMetadata = metadata; + } + return super.end(); + } +} +exports.ServerWritableStreamImpl = ServerWritableStreamImpl; +class ServerDuplexStreamImpl extends stream_1.Duplex { + constructor(path, call, metadata) { + super({ objectMode: true }); + this.path = path; + this.call = call; + this.metadata = metadata; + this.pendingStatus = { + code: constants_1.Status.OK, + details: 'OK', + }; + this.cancelled = false; + this.trailingMetadata = new metadata_1.Metadata(); + this.on('error', err => { + this.pendingStatus = serverErrorToStatus(err); + this.end(); + }); + } + getPeer() { + return this.call.getPeer(); + } + sendMetadata(responseMetadata) { + this.call.sendMetadata(responseMetadata); + } + getDeadline() { + return this.call.getDeadline(); + } + getPath() { + return this.path; + } + getHost() { + return this.call.getHost(); + } + getAuthContext() { + return this.call.getAuthContext(); + } + getMetricsRecorder() { + return this.call.getMetricsRecorder(); + } + _read(size) { + this.call.startRead(); + } + _write(chunk, encoding, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + callback) { + this.call.sendMessage(chunk, callback); + } + _final(callback) { + var _a; + callback(null); + this.call.sendStatus(Object.assign(Object.assign({}, this.pendingStatus), { metadata: (_a = this.pendingStatus.metadata) !== null && _a !== void 0 ? _a : this.trailingMetadata })); + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any + end(metadata) { + if (metadata) { + this.trailingMetadata = metadata; + } + return super.end(); + } +} +exports.ServerDuplexStreamImpl = ServerDuplexStreamImpl; +//# sourceMappingURL=server-call.js.map + +/***/ }), + +/***/ 36545: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ServerCredentials = void 0; +exports.createCertificateProviderServerCredentials = createCertificateProviderServerCredentials; +exports.createServerCredentialsWithInterceptors = createServerCredentialsWithInterceptors; +const tls_helpers_1 = __nccwpck_require__(68876); +class ServerCredentials { + constructor(serverConstructorOptions, contextOptions) { + this.serverConstructorOptions = serverConstructorOptions; + this.watchers = new Set(); + this.latestContextOptions = null; + this.latestContextOptions = contextOptions !== null && contextOptions !== void 0 ? contextOptions : null; + } + _addWatcher(watcher) { + this.watchers.add(watcher); + } + _removeWatcher(watcher) { + this.watchers.delete(watcher); + } + getWatcherCount() { + return this.watchers.size; + } + updateSecureContextOptions(options) { + this.latestContextOptions = options; + for (const watcher of this.watchers) { + watcher(this.latestContextOptions); + } + } + _isSecure() { + return this.serverConstructorOptions !== null; + } + _getSecureContextOptions() { + return this.latestContextOptions; + } + _getConstructorOptions() { + return this.serverConstructorOptions; + } + _getInterceptors() { + return []; + } + static createInsecure() { + return new InsecureServerCredentials(); + } + static createSsl(rootCerts, keyCertPairs, checkClientCertificate = false) { + var _a; + if (rootCerts !== null && !Buffer.isBuffer(rootCerts)) { + throw new TypeError('rootCerts must be null or a Buffer'); + } + if (!Array.isArray(keyCertPairs)) { + throw new TypeError('keyCertPairs must be an array'); + } + if (typeof checkClientCertificate !== 'boolean') { + throw new TypeError('checkClientCertificate must be a boolean'); + } + const cert = []; + const key = []; + for (let i = 0; i < keyCertPairs.length; i++) { + const pair = keyCertPairs[i]; + if (pair === null || typeof pair !== 'object') { + throw new TypeError(`keyCertPair[${i}] must be an object`); + } + if (!Buffer.isBuffer(pair.private_key)) { + throw new TypeError(`keyCertPair[${i}].private_key must be a Buffer`); + } + if (!Buffer.isBuffer(pair.cert_chain)) { + throw new TypeError(`keyCertPair[${i}].cert_chain must be a Buffer`); + } + cert.push(pair.cert_chain); + key.push(pair.private_key); + } + return new SecureServerCredentials({ + requestCert: checkClientCertificate, + ciphers: tls_helpers_1.CIPHER_SUITES, + }, { + ca: (_a = rootCerts !== null && rootCerts !== void 0 ? rootCerts : (0, tls_helpers_1.getDefaultRootsData)()) !== null && _a !== void 0 ? _a : undefined, + cert, + key, + }); + } +} +exports.ServerCredentials = ServerCredentials; +class InsecureServerCredentials extends ServerCredentials { + constructor() { + super(null); + } + _getSettings() { + return null; + } + _equals(other) { + return other instanceof InsecureServerCredentials; + } +} +class SecureServerCredentials extends ServerCredentials { + constructor(constructorOptions, contextOptions) { + super(constructorOptions, contextOptions); + this.options = Object.assign(Object.assign({}, constructorOptions), contextOptions); + } + /** + * Checks equality by checking the options that are actually set by + * createSsl. + * @param other + * @returns + */ + _equals(other) { + if (this === other) { + return true; + } + if (!(other instanceof SecureServerCredentials)) { + return false; + } + // options.ca equality check + if (Buffer.isBuffer(this.options.ca) && Buffer.isBuffer(other.options.ca)) { + if (!this.options.ca.equals(other.options.ca)) { + return false; + } + } + else { + if (this.options.ca !== other.options.ca) { + return false; + } + } + // options.cert equality check + if (Array.isArray(this.options.cert) && Array.isArray(other.options.cert)) { + if (this.options.cert.length !== other.options.cert.length) { + return false; + } + for (let i = 0; i < this.options.cert.length; i++) { + const thisCert = this.options.cert[i]; + const otherCert = other.options.cert[i]; + if (Buffer.isBuffer(thisCert) && Buffer.isBuffer(otherCert)) { + if (!thisCert.equals(otherCert)) { + return false; + } + } + else { + if (thisCert !== otherCert) { + return false; + } + } + } + } + else { + if (this.options.cert !== other.options.cert) { + return false; + } + } + // options.key equality check + if (Array.isArray(this.options.key) && Array.isArray(other.options.key)) { + if (this.options.key.length !== other.options.key.length) { + return false; + } + for (let i = 0; i < this.options.key.length; i++) { + const thisKey = this.options.key[i]; + const otherKey = other.options.key[i]; + if (Buffer.isBuffer(thisKey) && Buffer.isBuffer(otherKey)) { + if (!thisKey.equals(otherKey)) { + return false; + } + } + else { + if (thisKey !== otherKey) { + return false; + } + } + } + } + else { + if (this.options.key !== other.options.key) { + return false; + } + } + // options.requestCert equality check + if (this.options.requestCert !== other.options.requestCert) { + return false; + } + /* ciphers is derived from a value that is constant for the process, so no + * equality check is needed. */ + return true; + } +} +class CertificateProviderServerCredentials extends ServerCredentials { + constructor(identityCertificateProvider, caCertificateProvider, requireClientCertificate) { + super({ + requestCert: caCertificateProvider !== null, + rejectUnauthorized: requireClientCertificate, + ciphers: tls_helpers_1.CIPHER_SUITES + }); + this.identityCertificateProvider = identityCertificateProvider; + this.caCertificateProvider = caCertificateProvider; + this.requireClientCertificate = requireClientCertificate; + this.latestCaUpdate = null; + this.latestIdentityUpdate = null; + this.caCertificateUpdateListener = this.handleCaCertificateUpdate.bind(this); + this.identityCertificateUpdateListener = this.handleIdentityCertitificateUpdate.bind(this); + } + _addWatcher(watcher) { + var _a; + if (this.getWatcherCount() === 0) { + (_a = this.caCertificateProvider) === null || _a === void 0 ? void 0 : _a.addCaCertificateListener(this.caCertificateUpdateListener); + this.identityCertificateProvider.addIdentityCertificateListener(this.identityCertificateUpdateListener); + } + super._addWatcher(watcher); + } + _removeWatcher(watcher) { + var _a; + super._removeWatcher(watcher); + if (this.getWatcherCount() === 0) { + (_a = this.caCertificateProvider) === null || _a === void 0 ? void 0 : _a.removeCaCertificateListener(this.caCertificateUpdateListener); + this.identityCertificateProvider.removeIdentityCertificateListener(this.identityCertificateUpdateListener); + } + } + _equals(other) { + if (this === other) { + return true; + } + if (!(other instanceof CertificateProviderServerCredentials)) { + return false; + } + return (this.caCertificateProvider === other.caCertificateProvider && + this.identityCertificateProvider === other.identityCertificateProvider && + this.requireClientCertificate === other.requireClientCertificate); + } + calculateSecureContextOptions() { + var _a; + if (this.latestIdentityUpdate === null) { + return null; + } + if (this.caCertificateProvider !== null && this.latestCaUpdate === null) { + return null; + } + return { + ca: (_a = this.latestCaUpdate) === null || _a === void 0 ? void 0 : _a.caCertificate, + cert: [this.latestIdentityUpdate.certificate], + key: [this.latestIdentityUpdate.privateKey], + }; + } + finalizeUpdate() { + const secureContextOptions = this.calculateSecureContextOptions(); + this.updateSecureContextOptions(secureContextOptions); + } + handleCaCertificateUpdate(update) { + this.latestCaUpdate = update; + this.finalizeUpdate(); + } + handleIdentityCertitificateUpdate(update) { + this.latestIdentityUpdate = update; + this.finalizeUpdate(); + } +} +function createCertificateProviderServerCredentials(caCertificateProvider, identityCertificateProvider, requireClientCertificate) { + return new CertificateProviderServerCredentials(caCertificateProvider, identityCertificateProvider, requireClientCertificate); +} +class InterceptorServerCredentials extends ServerCredentials { + constructor(childCredentials, interceptors) { + super({}); + this.childCredentials = childCredentials; + this.interceptors = interceptors; + } + _isSecure() { + return this.childCredentials._isSecure(); + } + _equals(other) { + if (!(other instanceof InterceptorServerCredentials)) { + return false; + } + if (!(this.childCredentials._equals(other.childCredentials))) { + return false; + } + if (this.interceptors.length !== other.interceptors.length) { + return false; + } + for (let i = 0; i < this.interceptors.length; i++) { + if (this.interceptors[i] !== other.interceptors[i]) { + return false; + } + } + return true; + } + _getInterceptors() { + return this.interceptors; + } + _addWatcher(watcher) { + this.childCredentials._addWatcher(watcher); + } + _removeWatcher(watcher) { + this.childCredentials._removeWatcher(watcher); + } + _getConstructorOptions() { + return this.childCredentials._getConstructorOptions(); + } + _getSecureContextOptions() { + return this.childCredentials._getSecureContextOptions(); + } +} +function createServerCredentialsWithInterceptors(credentials, interceptors) { + return new InterceptorServerCredentials(credentials, interceptors); +} +//# sourceMappingURL=server-credentials.js.map + +/***/ }), + +/***/ 42151: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2024 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.BaseServerInterceptingCall = exports.ServerInterceptingCall = exports.ResponderBuilder = exports.ServerListenerBuilder = void 0; +exports.isInterceptingServerListener = isInterceptingServerListener; +exports.getServerInterceptingCall = getServerInterceptingCall; +const metadata_1 = __nccwpck_require__(36100); +const constants_1 = __nccwpck_require__(68288); +const http2 = __nccwpck_require__(85675); +const error_1 = __nccwpck_require__(98219); +const zlib = __nccwpck_require__(43106); +const stream_decoder_1 = __nccwpck_require__(47956); +const logging = __nccwpck_require__(8536); +const tls_1 = __nccwpck_require__(64756); +const orca_1 = __nccwpck_require__(82124); +const TRACER_NAME = 'server_call'; +function trace(text) { + logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, text); +} +class ServerListenerBuilder { + constructor() { + this.metadata = undefined; + this.message = undefined; + this.halfClose = undefined; + this.cancel = undefined; + } + withOnReceiveMetadata(onReceiveMetadata) { + this.metadata = onReceiveMetadata; + return this; + } + withOnReceiveMessage(onReceiveMessage) { + this.message = onReceiveMessage; + return this; + } + withOnReceiveHalfClose(onReceiveHalfClose) { + this.halfClose = onReceiveHalfClose; + return this; + } + withOnCancel(onCancel) { + this.cancel = onCancel; + return this; + } + build() { + return { + onReceiveMetadata: this.metadata, + onReceiveMessage: this.message, + onReceiveHalfClose: this.halfClose, + onCancel: this.cancel, + }; + } +} +exports.ServerListenerBuilder = ServerListenerBuilder; +function isInterceptingServerListener(listener) { + return (listener.onReceiveMetadata !== undefined && + listener.onReceiveMetadata.length === 1); +} +class InterceptingServerListenerImpl { + constructor(listener, nextListener) { + this.listener = listener; + this.nextListener = nextListener; + /** + * Once the call is cancelled, ignore all other events. + */ + this.cancelled = false; + this.processingMetadata = false; + this.hasPendingMessage = false; + this.pendingMessage = null; + this.processingMessage = false; + this.hasPendingHalfClose = false; + } + processPendingMessage() { + if (this.hasPendingMessage) { + this.nextListener.onReceiveMessage(this.pendingMessage); + this.pendingMessage = null; + this.hasPendingMessage = false; + } + } + processPendingHalfClose() { + if (this.hasPendingHalfClose) { + this.nextListener.onReceiveHalfClose(); + this.hasPendingHalfClose = false; + } + } + onReceiveMetadata(metadata) { + if (this.cancelled) { + return; + } + this.processingMetadata = true; + this.listener.onReceiveMetadata(metadata, interceptedMetadata => { + this.processingMetadata = false; + if (this.cancelled) { + return; + } + this.nextListener.onReceiveMetadata(interceptedMetadata); + this.processPendingMessage(); + this.processPendingHalfClose(); + }); + } + onReceiveMessage(message) { + if (this.cancelled) { + return; + } + this.processingMessage = true; + this.listener.onReceiveMessage(message, msg => { + this.processingMessage = false; + if (this.cancelled) { + return; + } + if (this.processingMetadata) { + this.pendingMessage = msg; + this.hasPendingMessage = true; + } + else { + this.nextListener.onReceiveMessage(msg); + this.processPendingHalfClose(); + } + }); + } + onReceiveHalfClose() { + if (this.cancelled) { + return; + } + this.listener.onReceiveHalfClose(() => { + if (this.cancelled) { + return; + } + if (this.processingMetadata || this.processingMessage) { + this.hasPendingHalfClose = true; + } + else { + this.nextListener.onReceiveHalfClose(); + } + }); + } + onCancel() { + this.cancelled = true; + this.listener.onCancel(); + this.nextListener.onCancel(); + } +} +class ResponderBuilder { + constructor() { + this.start = undefined; + this.metadata = undefined; + this.message = undefined; + this.status = undefined; + } + withStart(start) { + this.start = start; + return this; + } + withSendMetadata(sendMetadata) { + this.metadata = sendMetadata; + return this; + } + withSendMessage(sendMessage) { + this.message = sendMessage; + return this; + } + withSendStatus(sendStatus) { + this.status = sendStatus; + return this; + } + build() { + return { + start: this.start, + sendMetadata: this.metadata, + sendMessage: this.message, + sendStatus: this.status, + }; + } +} +exports.ResponderBuilder = ResponderBuilder; +const defaultServerListener = { + onReceiveMetadata: (metadata, next) => { + next(metadata); + }, + onReceiveMessage: (message, next) => { + next(message); + }, + onReceiveHalfClose: next => { + next(); + }, + onCancel: () => { }, +}; +const defaultResponder = { + start: next => { + next(); + }, + sendMetadata: (metadata, next) => { + next(metadata); + }, + sendMessage: (message, next) => { + next(message); + }, + sendStatus: (status, next) => { + next(status); + }, +}; +class ServerInterceptingCall { + constructor(nextCall, responder) { + var _a, _b, _c, _d; + this.nextCall = nextCall; + this.processingMetadata = false; + this.sentMetadata = false; + this.processingMessage = false; + this.pendingMessage = null; + this.pendingMessageCallback = null; + this.pendingStatus = null; + this.responder = { + start: (_a = responder === null || responder === void 0 ? void 0 : responder.start) !== null && _a !== void 0 ? _a : defaultResponder.start, + sendMetadata: (_b = responder === null || responder === void 0 ? void 0 : responder.sendMetadata) !== null && _b !== void 0 ? _b : defaultResponder.sendMetadata, + sendMessage: (_c = responder === null || responder === void 0 ? void 0 : responder.sendMessage) !== null && _c !== void 0 ? _c : defaultResponder.sendMessage, + sendStatus: (_d = responder === null || responder === void 0 ? void 0 : responder.sendStatus) !== null && _d !== void 0 ? _d : defaultResponder.sendStatus, + }; + } + processPendingMessage() { + if (this.pendingMessageCallback) { + this.nextCall.sendMessage(this.pendingMessage, this.pendingMessageCallback); + this.pendingMessage = null; + this.pendingMessageCallback = null; + } + } + processPendingStatus() { + if (this.pendingStatus) { + this.nextCall.sendStatus(this.pendingStatus); + this.pendingStatus = null; + } + } + start(listener) { + this.responder.start(interceptedListener => { + var _a, _b, _c, _d; + const fullInterceptedListener = { + onReceiveMetadata: (_a = interceptedListener === null || interceptedListener === void 0 ? void 0 : interceptedListener.onReceiveMetadata) !== null && _a !== void 0 ? _a : defaultServerListener.onReceiveMetadata, + onReceiveMessage: (_b = interceptedListener === null || interceptedListener === void 0 ? void 0 : interceptedListener.onReceiveMessage) !== null && _b !== void 0 ? _b : defaultServerListener.onReceiveMessage, + onReceiveHalfClose: (_c = interceptedListener === null || interceptedListener === void 0 ? void 0 : interceptedListener.onReceiveHalfClose) !== null && _c !== void 0 ? _c : defaultServerListener.onReceiveHalfClose, + onCancel: (_d = interceptedListener === null || interceptedListener === void 0 ? void 0 : interceptedListener.onCancel) !== null && _d !== void 0 ? _d : defaultServerListener.onCancel, + }; + const finalInterceptingListener = new InterceptingServerListenerImpl(fullInterceptedListener, listener); + this.nextCall.start(finalInterceptingListener); + }); + } + sendMetadata(metadata) { + this.processingMetadata = true; + this.sentMetadata = true; + this.responder.sendMetadata(metadata, interceptedMetadata => { + this.processingMetadata = false; + this.nextCall.sendMetadata(interceptedMetadata); + this.processPendingMessage(); + this.processPendingStatus(); + }); + } + sendMessage(message, callback) { + this.processingMessage = true; + if (!this.sentMetadata) { + this.sendMetadata(new metadata_1.Metadata()); + } + this.responder.sendMessage(message, interceptedMessage => { + this.processingMessage = false; + if (this.processingMetadata) { + this.pendingMessage = interceptedMessage; + this.pendingMessageCallback = callback; + } + else { + this.nextCall.sendMessage(interceptedMessage, callback); + } + }); + } + sendStatus(status) { + this.responder.sendStatus(status, interceptedStatus => { + if (this.processingMetadata || this.processingMessage) { + this.pendingStatus = interceptedStatus; + } + else { + this.nextCall.sendStatus(interceptedStatus); + } + }); + } + startRead() { + this.nextCall.startRead(); + } + getPeer() { + return this.nextCall.getPeer(); + } + getDeadline() { + return this.nextCall.getDeadline(); + } + getHost() { + return this.nextCall.getHost(); + } + getAuthContext() { + return this.nextCall.getAuthContext(); + } + getConnectionInfo() { + return this.nextCall.getConnectionInfo(); + } + getMetricsRecorder() { + return this.nextCall.getMetricsRecorder(); + } +} +exports.ServerInterceptingCall = ServerInterceptingCall; +const GRPC_ACCEPT_ENCODING_HEADER = 'grpc-accept-encoding'; +const GRPC_ENCODING_HEADER = 'grpc-encoding'; +const GRPC_MESSAGE_HEADER = 'grpc-message'; +const GRPC_STATUS_HEADER = 'grpc-status'; +const GRPC_TIMEOUT_HEADER = 'grpc-timeout'; +const DEADLINE_REGEX = /(\d{1,8})\s*([HMSmun])/; +const deadlineUnitsToMs = { + H: 3600000, + M: 60000, + S: 1000, + m: 1, + u: 0.001, + n: 0.000001, +}; +const defaultCompressionHeaders = { + // TODO(cjihrig): Remove these encoding headers from the default response + // once compression is integrated. + [GRPC_ACCEPT_ENCODING_HEADER]: 'identity,deflate,gzip', + [GRPC_ENCODING_HEADER]: 'identity', +}; +const defaultResponseHeaders = { + [http2.constants.HTTP2_HEADER_STATUS]: http2.constants.HTTP_STATUS_OK, + [http2.constants.HTTP2_HEADER_CONTENT_TYPE]: 'application/grpc+proto', +}; +const defaultResponseOptions = { + waitForTrailers: true, +}; +class BaseServerInterceptingCall { + constructor(stream, headers, callEventTracker, handler, options) { + var _a, _b; + this.stream = stream; + this.callEventTracker = callEventTracker; + this.handler = handler; + this.listener = null; + this.deadlineTimer = null; + this.deadline = Infinity; + this.maxSendMessageSize = constants_1.DEFAULT_MAX_SEND_MESSAGE_LENGTH; + this.maxReceiveMessageSize = constants_1.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH; + this.cancelled = false; + this.metadataSent = false; + this.wantTrailers = false; + this.cancelNotified = false; + this.incomingEncoding = 'identity'; + this.readQueue = []; + this.isReadPending = false; + this.receivedHalfClose = false; + this.streamEnded = false; + this.metricsRecorder = new orca_1.PerRequestMetricRecorder(); + this.stream.once('error', (err) => { + /* We need an error handler to avoid uncaught error event exceptions, but + * there is nothing we can reasonably do here. Any error event should + * have a corresponding close event, which handles emitting the cancelled + * event. And the stream is now in a bad state, so we can't reasonably + * expect to be able to send an error over it. */ + }); + this.stream.once('close', () => { + var _a; + trace('Request to method ' + + ((_a = this.handler) === null || _a === void 0 ? void 0 : _a.path) + + ' stream closed with rstCode ' + + this.stream.rstCode); + if (this.callEventTracker && !this.streamEnded) { + this.streamEnded = true; + this.callEventTracker.onStreamEnd(false); + this.callEventTracker.onCallEnd({ + code: constants_1.Status.CANCELLED, + details: 'Stream closed before sending status', + metadata: null, + }); + } + this.notifyOnCancel(); + }); + this.stream.on('data', (data) => { + this.handleDataFrame(data); + }); + this.stream.pause(); + this.stream.on('end', () => { + this.handleEndEvent(); + }); + if ('grpc.max_send_message_length' in options) { + this.maxSendMessageSize = options['grpc.max_send_message_length']; + } + if ('grpc.max_receive_message_length' in options) { + this.maxReceiveMessageSize = options['grpc.max_receive_message_length']; + } + this.host = (_a = headers[':authority']) !== null && _a !== void 0 ? _a : headers.host; + this.decoder = new stream_decoder_1.StreamDecoder(this.maxReceiveMessageSize); + const metadata = metadata_1.Metadata.fromHttp2Headers(headers); + if (logging.isTracerEnabled(TRACER_NAME)) { + trace('Request to ' + + this.handler.path + + ' received headers ' + + JSON.stringify(metadata.toJSON())); + } + const timeoutHeader = metadata.get(GRPC_TIMEOUT_HEADER); + if (timeoutHeader.length > 0) { + this.handleTimeoutHeader(timeoutHeader[0]); + } + const encodingHeader = metadata.get(GRPC_ENCODING_HEADER); + if (encodingHeader.length > 0) { + this.incomingEncoding = encodingHeader[0]; + } + // Remove several headers that should not be propagated to the application + metadata.remove(GRPC_TIMEOUT_HEADER); + metadata.remove(GRPC_ENCODING_HEADER); + metadata.remove(GRPC_ACCEPT_ENCODING_HEADER); + metadata.remove(http2.constants.HTTP2_HEADER_ACCEPT_ENCODING); + metadata.remove(http2.constants.HTTP2_HEADER_TE); + metadata.remove(http2.constants.HTTP2_HEADER_CONTENT_TYPE); + this.metadata = metadata; + const socket = (_b = stream.session) === null || _b === void 0 ? void 0 : _b.socket; + this.connectionInfo = { + localAddress: socket === null || socket === void 0 ? void 0 : socket.localAddress, + localPort: socket === null || socket === void 0 ? void 0 : socket.localPort, + remoteAddress: socket === null || socket === void 0 ? void 0 : socket.remoteAddress, + remotePort: socket === null || socket === void 0 ? void 0 : socket.remotePort + }; + this.shouldSendMetrics = !!options['grpc.server_call_metric_recording']; + } + handleTimeoutHeader(timeoutHeader) { + const match = timeoutHeader.toString().match(DEADLINE_REGEX); + if (match === null) { + const status = { + code: constants_1.Status.INTERNAL, + details: `Invalid ${GRPC_TIMEOUT_HEADER} value "${timeoutHeader}"`, + metadata: null, + }; + // Wait for the constructor to complete before sending the error. + process.nextTick(() => { + this.sendStatus(status); + }); + return; + } + const timeout = (+match[1] * deadlineUnitsToMs[match[2]]) | 0; + const now = new Date(); + this.deadline = now.setMilliseconds(now.getMilliseconds() + timeout); + this.deadlineTimer = setTimeout(() => { + const status = { + code: constants_1.Status.DEADLINE_EXCEEDED, + details: 'Deadline exceeded', + metadata: null, + }; + this.sendStatus(status); + }, timeout); + } + checkCancelled() { + /* In some cases the stream can become destroyed before the close event + * fires. That creates a race condition that this check works around */ + if (!this.cancelled && (this.stream.destroyed || this.stream.closed)) { + this.notifyOnCancel(); + this.cancelled = true; + } + return this.cancelled; + } + notifyOnCancel() { + if (this.cancelNotified) { + return; + } + this.cancelNotified = true; + this.cancelled = true; + process.nextTick(() => { + var _a; + (_a = this.listener) === null || _a === void 0 ? void 0 : _a.onCancel(); + }); + if (this.deadlineTimer) { + clearTimeout(this.deadlineTimer); + } + // Flush incoming data frames + this.stream.resume(); + } + /** + * A server handler can start sending messages without explicitly sending + * metadata. In that case, we need to send headers before sending any + * messages. This function does that if necessary. + */ + maybeSendMetadata() { + if (!this.metadataSent) { + this.sendMetadata(new metadata_1.Metadata()); + } + } + /** + * Serialize a message to a length-delimited byte string. + * @param value + * @returns + */ + serializeMessage(value) { + const messageBuffer = this.handler.serialize(value); + const byteLength = messageBuffer.byteLength; + const output = Buffer.allocUnsafe(byteLength + 5); + /* Note: response compression is currently not supported, so this + * compressed bit is always 0. */ + output.writeUInt8(0, 0); + output.writeUInt32BE(byteLength, 1); + messageBuffer.copy(output, 5); + return output; + } + decompressMessage(message, encoding) { + const messageContents = message.subarray(5); + if (encoding === 'identity') { + return messageContents; + } + else if (encoding === 'deflate' || encoding === 'gzip') { + let decompresser; + if (encoding === 'deflate') { + decompresser = zlib.createInflate(); + } + else { + decompresser = zlib.createGunzip(); + } + return new Promise((resolve, reject) => { + let totalLength = 0; + const messageParts = []; + decompresser.on('data', (chunk) => { + messageParts.push(chunk); + totalLength += chunk.byteLength; + if (this.maxReceiveMessageSize !== -1 && totalLength > this.maxReceiveMessageSize) { + decompresser.destroy(); + reject({ + code: constants_1.Status.RESOURCE_EXHAUSTED, + details: `Received message that decompresses to a size larger than ${this.maxReceiveMessageSize}` + }); + } + }); + decompresser.on('end', () => { + resolve(Buffer.concat(messageParts)); + }); + decompresser.write(messageContents); + decompresser.end(); + }); + } + else { + return Promise.reject({ + code: constants_1.Status.UNIMPLEMENTED, + details: `Received message compressed with unsupported encoding "${encoding}"`, + }); + } + } + async decompressAndMaybePush(queueEntry) { + if (queueEntry.type !== 'COMPRESSED') { + throw new Error(`Invalid queue entry type: ${queueEntry.type}`); + } + const compressed = queueEntry.compressedMessage.readUInt8(0) === 1; + const compressedMessageEncoding = compressed + ? this.incomingEncoding + : 'identity'; + let decompressedMessage; + try { + decompressedMessage = await this.decompressMessage(queueEntry.compressedMessage, compressedMessageEncoding); + } + catch (err) { + this.sendStatus(err); + return; + } + try { + queueEntry.parsedMessage = this.handler.deserialize(decompressedMessage); + } + catch (err) { + this.sendStatus({ + code: constants_1.Status.INTERNAL, + details: `Error deserializing request: ${err.message}`, + }); + return; + } + queueEntry.type = 'READABLE'; + this.maybePushNextMessage(); + } + maybePushNextMessage() { + if (this.listener && + this.isReadPending && + this.readQueue.length > 0 && + this.readQueue[0].type !== 'COMPRESSED') { + this.isReadPending = false; + const nextQueueEntry = this.readQueue.shift(); + if (nextQueueEntry.type === 'READABLE') { + this.listener.onReceiveMessage(nextQueueEntry.parsedMessage); + } + else { + // nextQueueEntry.type === 'HALF_CLOSE' + this.listener.onReceiveHalfClose(); + } + } + } + handleDataFrame(data) { + var _a; + if (this.checkCancelled()) { + return; + } + trace('Request to ' + + this.handler.path + + ' received data frame of size ' + + data.length); + let rawMessages; + try { + rawMessages = this.decoder.write(data); + } + catch (e) { + this.sendStatus({ code: constants_1.Status.RESOURCE_EXHAUSTED, details: e.message }); + return; + } + for (const messageBytes of rawMessages) { + this.stream.pause(); + const queueEntry = { + type: 'COMPRESSED', + compressedMessage: messageBytes, + parsedMessage: null, + }; + this.readQueue.push(queueEntry); + this.decompressAndMaybePush(queueEntry); + (_a = this.callEventTracker) === null || _a === void 0 ? void 0 : _a.addMessageReceived(); + } + } + handleEndEvent() { + this.readQueue.push({ + type: 'HALF_CLOSE', + compressedMessage: null, + parsedMessage: null, + }); + this.receivedHalfClose = true; + this.maybePushNextMessage(); + } + start(listener) { + trace('Request to ' + this.handler.path + ' start called'); + if (this.checkCancelled()) { + return; + } + this.listener = listener; + listener.onReceiveMetadata(this.metadata); + } + sendMetadata(metadata) { + if (this.checkCancelled()) { + return; + } + if (this.metadataSent) { + return; + } + this.metadataSent = true; + const custom = metadata ? metadata.toHttp2Headers() : null; + const headers = Object.assign(Object.assign(Object.assign({}, defaultResponseHeaders), defaultCompressionHeaders), custom); + this.stream.respond(headers, defaultResponseOptions); + } + sendMessage(message, callback) { + if (this.checkCancelled()) { + return; + } + let response; + try { + response = this.serializeMessage(message); + } + catch (e) { + this.sendStatus({ + code: constants_1.Status.INTERNAL, + details: `Error serializing response: ${(0, error_1.getErrorMessage)(e)}`, + metadata: null, + }); + return; + } + if (this.maxSendMessageSize !== -1 && + response.length - 5 > this.maxSendMessageSize) { + this.sendStatus({ + code: constants_1.Status.RESOURCE_EXHAUSTED, + details: `Sent message larger than max (${response.length} vs. ${this.maxSendMessageSize})`, + metadata: null, + }); + return; + } + this.maybeSendMetadata(); + trace('Request to ' + + this.handler.path + + ' sent data frame of size ' + + response.length); + this.stream.write(response, error => { + var _a; + if (error) { + this.sendStatus({ + code: constants_1.Status.INTERNAL, + details: `Error writing message: ${(0, error_1.getErrorMessage)(error)}`, + metadata: null, + }); + return; + } + (_a = this.callEventTracker) === null || _a === void 0 ? void 0 : _a.addMessageSent(); + callback(); + }); + } + sendStatus(status) { + var _a, _b, _c; + if (this.checkCancelled()) { + return; + } + trace('Request to method ' + + ((_a = this.handler) === null || _a === void 0 ? void 0 : _a.path) + + ' ended with status code: ' + + constants_1.Status[status.code] + + ' details: ' + + status.details); + const statusMetadata = (_c = (_b = status.metadata) === null || _b === void 0 ? void 0 : _b.clone()) !== null && _c !== void 0 ? _c : new metadata_1.Metadata(); + if (this.shouldSendMetrics) { + statusMetadata.set(orca_1.GRPC_METRICS_HEADER, this.metricsRecorder.serialize()); + } + if (this.metadataSent) { + if (!this.wantTrailers) { + this.wantTrailers = true; + this.stream.once('wantTrailers', () => { + if (this.callEventTracker && !this.streamEnded) { + this.streamEnded = true; + this.callEventTracker.onStreamEnd(true); + this.callEventTracker.onCallEnd(status); + } + const trailersToSend = Object.assign({ [GRPC_STATUS_HEADER]: status.code, [GRPC_MESSAGE_HEADER]: encodeURI(status.details) }, statusMetadata.toHttp2Headers()); + this.stream.sendTrailers(trailersToSend); + this.notifyOnCancel(); + }); + this.stream.end(); + } + else { + this.notifyOnCancel(); + } + } + else { + if (this.callEventTracker && !this.streamEnded) { + this.streamEnded = true; + this.callEventTracker.onStreamEnd(true); + this.callEventTracker.onCallEnd(status); + } + // Trailers-only response + const trailersToSend = Object.assign(Object.assign({ [GRPC_STATUS_HEADER]: status.code, [GRPC_MESSAGE_HEADER]: encodeURI(status.details) }, defaultResponseHeaders), statusMetadata.toHttp2Headers()); + this.stream.respond(trailersToSend, { endStream: true }); + this.notifyOnCancel(); + } + } + startRead() { + trace('Request to ' + this.handler.path + ' startRead called'); + if (this.checkCancelled()) { + return; + } + this.isReadPending = true; + if (this.readQueue.length === 0) { + if (!this.receivedHalfClose) { + this.stream.resume(); + } + } + else { + this.maybePushNextMessage(); + } + } + getPeer() { + var _a; + const socket = (_a = this.stream.session) === null || _a === void 0 ? void 0 : _a.socket; + if (socket === null || socket === void 0 ? void 0 : socket.remoteAddress) { + if (socket.remotePort) { + return `${socket.remoteAddress}:${socket.remotePort}`; + } + else { + return socket.remoteAddress; + } + } + else { + return 'unknown'; + } + } + getDeadline() { + return this.deadline; + } + getHost() { + return this.host; + } + getAuthContext() { + var _a; + if (((_a = this.stream.session) === null || _a === void 0 ? void 0 : _a.socket) instanceof tls_1.TLSSocket) { + const peerCertificate = this.stream.session.socket.getPeerCertificate(); + return { + transportSecurityType: 'ssl', + sslPeerCertificate: peerCertificate.raw ? peerCertificate : undefined + }; + } + else { + return {}; + } + } + getConnectionInfo() { + return this.connectionInfo; + } + getMetricsRecorder() { + return this.metricsRecorder; + } +} +exports.BaseServerInterceptingCall = BaseServerInterceptingCall; +function getServerInterceptingCall(interceptors, stream, headers, callEventTracker, handler, options) { + const methodDefinition = { + path: handler.path, + requestStream: handler.type === 'clientStream' || handler.type === 'bidi', + responseStream: handler.type === 'serverStream' || handler.type === 'bidi', + requestDeserialize: handler.deserialize, + responseSerialize: handler.serialize, + }; + const baseCall = new BaseServerInterceptingCall(stream, headers, callEventTracker, handler, options); + return interceptors.reduce((call, interceptor) => { + return interceptor(methodDefinition, call); + }, baseCall); +} +//# sourceMappingURL=server-interceptors.js.map + +/***/ }), + +/***/ 12390: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +var __runInitializers = (this && this.__runInitializers) || function (thisArg, initializers, value) { + var useValue = arguments.length > 2; + for (var i = 0; i < initializers.length; i++) { + value = useValue ? initializers[i].call(thisArg, value) : initializers[i].call(thisArg); + } + return useValue ? value : void 0; +}; +var __esDecorate = (this && this.__esDecorate) || function (ctor, descriptorIn, decorators, contextIn, initializers, extraInitializers) { + function accept(f) { if (f !== void 0 && typeof f !== "function") throw new TypeError("Function expected"); return f; } + var kind = contextIn.kind, key = kind === "getter" ? "get" : kind === "setter" ? "set" : "value"; + var target = !descriptorIn && ctor ? contextIn["static"] ? ctor : ctor.prototype : null; + var descriptor = descriptorIn || (target ? Object.getOwnPropertyDescriptor(target, contextIn.name) : {}); + var _, done = false; + for (var i = decorators.length - 1; i >= 0; i--) { + var context = {}; + for (var p in contextIn) context[p] = p === "access" ? {} : contextIn[p]; + for (var p in contextIn.access) context.access[p] = contextIn.access[p]; + context.addInitializer = function (f) { if (done) throw new TypeError("Cannot add initializers after decoration has completed"); extraInitializers.push(accept(f || null)); }; + var result = (0, decorators[i])(kind === "accessor" ? { get: descriptor.get, set: descriptor.set } : descriptor[key], context); + if (kind === "accessor") { + if (result === void 0) continue; + if (result === null || typeof result !== "object") throw new TypeError("Object expected"); + if (_ = accept(result.get)) descriptor.get = _; + if (_ = accept(result.set)) descriptor.set = _; + if (_ = accept(result.init)) initializers.unshift(_); + } + else if (_ = accept(result)) { + if (kind === "field") initializers.unshift(_); + else descriptor[key] = _; + } + } + if (target) Object.defineProperty(target, contextIn.name, descriptor); + done = true; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Server = void 0; +const http2 = __nccwpck_require__(85675); +const util = __nccwpck_require__(39023); +const constants_1 = __nccwpck_require__(68288); +const server_call_1 = __nccwpck_require__(34615); +const server_credentials_1 = __nccwpck_require__(36545); +const resolver_1 = __nccwpck_require__(76255); +const logging = __nccwpck_require__(8536); +const subchannel_address_1 = __nccwpck_require__(97021); +const uri_parser_1 = __nccwpck_require__(56027); +const channelz_1 = __nccwpck_require__(68198); +const server_interceptors_1 = __nccwpck_require__(42151); +const UNLIMITED_CONNECTION_AGE_MS = ~(1 << 31); +const KEEPALIVE_MAX_TIME_MS = ~(1 << 31); +const KEEPALIVE_TIMEOUT_MS = 20000; +const MAX_CONNECTION_IDLE_MS = ~(1 << 31); +const { HTTP2_HEADER_PATH } = http2.constants; +const TRACER_NAME = 'server'; +const kMaxAge = Buffer.from('max_age'); +function serverCallTrace(text) { + logging.trace(constants_1.LogVerbosity.DEBUG, 'server_call', text); +} +function noop() { } +/** + * Decorator to wrap a class method with util.deprecate + * @param message The message to output if the deprecated method is called + * @returns + */ +function deprecate(message) { + return function (target, context) { + return util.deprecate(target, message); + }; +} +function getUnimplementedStatusResponse(methodName) { + return { + code: constants_1.Status.UNIMPLEMENTED, + details: `The server does not implement the method ${methodName}`, + }; +} +function getDefaultHandler(handlerType, methodName) { + const unimplementedStatusResponse = getUnimplementedStatusResponse(methodName); + switch (handlerType) { + case 'unary': + return (call, callback) => { + callback(unimplementedStatusResponse, null); + }; + case 'clientStream': + return (call, callback) => { + callback(unimplementedStatusResponse, null); + }; + case 'serverStream': + return (call) => { + call.emit('error', unimplementedStatusResponse); + }; + case 'bidi': + return (call) => { + call.emit('error', unimplementedStatusResponse); + }; + default: + throw new Error(`Invalid handlerType ${handlerType}`); + } +} +let Server = (() => { + var _a; + let _instanceExtraInitializers = []; + let _start_decorators; + return _a = class Server { + constructor(options) { + var _b, _c, _d, _e, _f, _g; + this.boundPorts = (__runInitializers(this, _instanceExtraInitializers), new Map()); + this.http2Servers = new Map(); + this.sessionIdleTimeouts = new Map(); + this.handlers = new Map(); + this.sessions = new Map(); + /** + * This field only exists to ensure that the start method throws an error if + * it is called twice, as it did previously. + */ + this.started = false; + this.shutdown = false; + this.serverAddressString = 'null'; + // Channelz Info + this.channelzEnabled = true; + this.options = options !== null && options !== void 0 ? options : {}; + if (this.options['grpc.enable_channelz'] === 0) { + this.channelzEnabled = false; + this.channelzTrace = new channelz_1.ChannelzTraceStub(); + this.callTracker = new channelz_1.ChannelzCallTrackerStub(); + this.listenerChildrenTracker = new channelz_1.ChannelzChildrenTrackerStub(); + this.sessionChildrenTracker = new channelz_1.ChannelzChildrenTrackerStub(); + } + else { + this.channelzTrace = new channelz_1.ChannelzTrace(); + this.callTracker = new channelz_1.ChannelzCallTracker(); + this.listenerChildrenTracker = new channelz_1.ChannelzChildrenTracker(); + this.sessionChildrenTracker = new channelz_1.ChannelzChildrenTracker(); + } + this.channelzRef = (0, channelz_1.registerChannelzServer)('server', () => this.getChannelzInfo(), this.channelzEnabled); + this.channelzTrace.addTrace('CT_INFO', 'Server created'); + this.maxConnectionAgeMs = + (_b = this.options['grpc.max_connection_age_ms']) !== null && _b !== void 0 ? _b : UNLIMITED_CONNECTION_AGE_MS; + this.maxConnectionAgeGraceMs = + (_c = this.options['grpc.max_connection_age_grace_ms']) !== null && _c !== void 0 ? _c : UNLIMITED_CONNECTION_AGE_MS; + this.keepaliveTimeMs = + (_d = this.options['grpc.keepalive_time_ms']) !== null && _d !== void 0 ? _d : KEEPALIVE_MAX_TIME_MS; + this.keepaliveTimeoutMs = + (_e = this.options['grpc.keepalive_timeout_ms']) !== null && _e !== void 0 ? _e : KEEPALIVE_TIMEOUT_MS; + this.sessionIdleTimeout = + (_f = this.options['grpc.max_connection_idle_ms']) !== null && _f !== void 0 ? _f : MAX_CONNECTION_IDLE_MS; + this.commonServerOptions = { + maxSendHeaderBlockLength: Number.MAX_SAFE_INTEGER, + }; + if ('grpc-node.max_session_memory' in this.options) { + this.commonServerOptions.maxSessionMemory = + this.options['grpc-node.max_session_memory']; + } + else { + /* By default, set a very large max session memory limit, to effectively + * disable enforcement of the limit. Some testing indicates that Node's + * behavior degrades badly when this limit is reached, so we solve that + * by disabling the check entirely. */ + this.commonServerOptions.maxSessionMemory = Number.MAX_SAFE_INTEGER; + } + if ('grpc.max_concurrent_streams' in this.options) { + this.commonServerOptions.settings = { + maxConcurrentStreams: this.options['grpc.max_concurrent_streams'], + }; + } + this.interceptors = (_g = this.options.interceptors) !== null && _g !== void 0 ? _g : []; + this.trace('Server constructed'); + } + getChannelzInfo() { + return { + trace: this.channelzTrace, + callTracker: this.callTracker, + listenerChildren: this.listenerChildrenTracker.getChildLists(), + sessionChildren: this.sessionChildrenTracker.getChildLists(), + }; + } + getChannelzSessionInfo(session) { + var _b, _c, _d; + const sessionInfo = this.sessions.get(session); + const sessionSocket = session.socket; + const remoteAddress = sessionSocket.remoteAddress + ? (0, subchannel_address_1.stringToSubchannelAddress)(sessionSocket.remoteAddress, sessionSocket.remotePort) + : null; + const localAddress = sessionSocket.localAddress + ? (0, subchannel_address_1.stringToSubchannelAddress)(sessionSocket.localAddress, sessionSocket.localPort) + : null; + let tlsInfo; + if (session.encrypted) { + const tlsSocket = sessionSocket; + const cipherInfo = tlsSocket.getCipher(); + const certificate = tlsSocket.getCertificate(); + const peerCertificate = tlsSocket.getPeerCertificate(); + tlsInfo = { + cipherSuiteStandardName: (_b = cipherInfo.standardName) !== null && _b !== void 0 ? _b : null, + cipherSuiteOtherName: cipherInfo.standardName ? null : cipherInfo.name, + localCertificate: certificate && 'raw' in certificate ? certificate.raw : null, + remoteCertificate: peerCertificate && 'raw' in peerCertificate + ? peerCertificate.raw + : null, + }; + } + else { + tlsInfo = null; + } + const socketInfo = { + remoteAddress: remoteAddress, + localAddress: localAddress, + security: tlsInfo, + remoteName: null, + streamsStarted: sessionInfo.streamTracker.callsStarted, + streamsSucceeded: sessionInfo.streamTracker.callsSucceeded, + streamsFailed: sessionInfo.streamTracker.callsFailed, + messagesSent: sessionInfo.messagesSent, + messagesReceived: sessionInfo.messagesReceived, + keepAlivesSent: sessionInfo.keepAlivesSent, + lastLocalStreamCreatedTimestamp: null, + lastRemoteStreamCreatedTimestamp: sessionInfo.streamTracker.lastCallStartedTimestamp, + lastMessageSentTimestamp: sessionInfo.lastMessageSentTimestamp, + lastMessageReceivedTimestamp: sessionInfo.lastMessageReceivedTimestamp, + localFlowControlWindow: (_c = session.state.localWindowSize) !== null && _c !== void 0 ? _c : null, + remoteFlowControlWindow: (_d = session.state.remoteWindowSize) !== null && _d !== void 0 ? _d : null, + }; + return socketInfo; + } + trace(text) { + logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, '(' + this.channelzRef.id + ') ' + text); + } + keepaliveTrace(text) { + logging.trace(constants_1.LogVerbosity.DEBUG, 'keepalive', '(' + this.channelzRef.id + ') ' + text); + } + addProtoService() { + throw new Error('Not implemented. Use addService() instead'); + } + addService(service, implementation) { + if (service === null || + typeof service !== 'object' || + implementation === null || + typeof implementation !== 'object') { + throw new Error('addService() requires two objects as arguments'); + } + const serviceKeys = Object.keys(service); + if (serviceKeys.length === 0) { + throw new Error('Cannot add an empty service to a server'); + } + serviceKeys.forEach(name => { + const attrs = service[name]; + let methodType; + if (attrs.requestStream) { + if (attrs.responseStream) { + methodType = 'bidi'; + } + else { + methodType = 'clientStream'; + } + } + else { + if (attrs.responseStream) { + methodType = 'serverStream'; + } + else { + methodType = 'unary'; + } + } + let implFn = implementation[name]; + let impl; + if (implFn === undefined && typeof attrs.originalName === 'string') { + implFn = implementation[attrs.originalName]; + } + if (implFn !== undefined) { + impl = implFn.bind(implementation); + } + else { + impl = getDefaultHandler(methodType, name); + } + const success = this.register(attrs.path, impl, attrs.responseSerialize, attrs.requestDeserialize, methodType); + if (success === false) { + throw new Error(`Method handler for ${attrs.path} already provided.`); + } + }); + } + removeService(service) { + if (service === null || typeof service !== 'object') { + throw new Error('removeService() requires object as argument'); + } + const serviceKeys = Object.keys(service); + serviceKeys.forEach(name => { + const attrs = service[name]; + this.unregister(attrs.path); + }); + } + bind(port, creds) { + throw new Error('Not implemented. Use bindAsync() instead'); + } + /** + * This API is experimental, so API stability is not guaranteed across minor versions. + * @param boundAddress + * @returns + */ + experimentalRegisterListenerToChannelz(boundAddress) { + return (0, channelz_1.registerChannelzSocket)((0, subchannel_address_1.subchannelAddressToString)(boundAddress), () => { + return { + localAddress: boundAddress, + remoteAddress: null, + security: null, + remoteName: null, + streamsStarted: 0, + streamsSucceeded: 0, + streamsFailed: 0, + messagesSent: 0, + messagesReceived: 0, + keepAlivesSent: 0, + lastLocalStreamCreatedTimestamp: null, + lastRemoteStreamCreatedTimestamp: null, + lastMessageSentTimestamp: null, + lastMessageReceivedTimestamp: null, + localFlowControlWindow: null, + remoteFlowControlWindow: null, + }; + }, this.channelzEnabled); + } + experimentalUnregisterListenerFromChannelz(channelzRef) { + (0, channelz_1.unregisterChannelzRef)(channelzRef); + } + createHttp2Server(credentials) { + let http2Server; + if (credentials._isSecure()) { + const constructorOptions = credentials._getConstructorOptions(); + const contextOptions = credentials._getSecureContextOptions(); + const secureServerOptions = Object.assign(Object.assign(Object.assign(Object.assign({}, this.commonServerOptions), constructorOptions), contextOptions), { enableTrace: this.options['grpc-node.tls_enable_trace'] === 1 }); + let areCredentialsValid = contextOptions !== null; + this.trace('Initial credentials valid: ' + areCredentialsValid); + http2Server = http2.createSecureServer(secureServerOptions); + http2Server.prependListener('connection', (socket) => { + if (!areCredentialsValid) { + this.trace('Dropped connection from ' + JSON.stringify(socket.address()) + ' due to unloaded credentials'); + socket.destroy(); + } + }); + http2Server.on('secureConnection', (socket) => { + /* These errors need to be handled by the user of Http2SecureServer, + * according to https://github.com/nodejs/node/issues/35824 */ + socket.on('error', (e) => { + this.trace('An incoming TLS connection closed with error: ' + e.message); + }); + }); + const credsWatcher = options => { + if (options) { + const secureServer = http2Server; + try { + secureServer.setSecureContext(options); + } + catch (e) { + logging.log(constants_1.LogVerbosity.ERROR, 'Failed to set secure context with error ' + e.message); + options = null; + } + } + areCredentialsValid = options !== null; + this.trace('Post-update credentials valid: ' + areCredentialsValid); + }; + credentials._addWatcher(credsWatcher); + http2Server.on('close', () => { + credentials._removeWatcher(credsWatcher); + }); + } + else { + http2Server = http2.createServer(this.commonServerOptions); + } + http2Server.setTimeout(0, noop); + this._setupHandlers(http2Server, credentials._getInterceptors()); + return http2Server; + } + bindOneAddress(address, boundPortObject) { + this.trace('Attempting to bind ' + (0, subchannel_address_1.subchannelAddressToString)(address)); + const http2Server = this.createHttp2Server(boundPortObject.credentials); + return new Promise((resolve, reject) => { + const onError = (err) => { + this.trace('Failed to bind ' + + (0, subchannel_address_1.subchannelAddressToString)(address) + + ' with error ' + + err.message); + resolve({ + port: 'port' in address ? address.port : 1, + error: err.message, + }); + }; + http2Server.once('error', onError); + http2Server.listen(address, () => { + const boundAddress = http2Server.address(); + let boundSubchannelAddress; + if (typeof boundAddress === 'string') { + boundSubchannelAddress = { + path: boundAddress, + }; + } + else { + boundSubchannelAddress = { + host: boundAddress.address, + port: boundAddress.port, + }; + } + const channelzRef = this.experimentalRegisterListenerToChannelz(boundSubchannelAddress); + this.listenerChildrenTracker.refChild(channelzRef); + this.http2Servers.set(http2Server, { + channelzRef: channelzRef, + sessions: new Set(), + ownsChannelzRef: true + }); + boundPortObject.listeningServers.add(http2Server); + this.trace('Successfully bound ' + + (0, subchannel_address_1.subchannelAddressToString)(boundSubchannelAddress)); + resolve({ + port: 'port' in boundSubchannelAddress ? boundSubchannelAddress.port : 1, + }); + http2Server.removeListener('error', onError); + }); + }); + } + async bindManyPorts(addressList, boundPortObject) { + if (addressList.length === 0) { + return { + count: 0, + port: 0, + errors: [], + }; + } + if ((0, subchannel_address_1.isTcpSubchannelAddress)(addressList[0]) && addressList[0].port === 0) { + /* If binding to port 0, first try to bind the first address, then bind + * the rest of the address list to the specific port that it binds. */ + const firstAddressResult = await this.bindOneAddress(addressList[0], boundPortObject); + if (firstAddressResult.error) { + /* If the first address fails to bind, try the same operation starting + * from the second item in the list. */ + const restAddressResult = await this.bindManyPorts(addressList.slice(1), boundPortObject); + return Object.assign(Object.assign({}, restAddressResult), { errors: [firstAddressResult.error, ...restAddressResult.errors] }); + } + else { + const restAddresses = addressList + .slice(1) + .map(address => (0, subchannel_address_1.isTcpSubchannelAddress)(address) + ? { host: address.host, port: firstAddressResult.port } + : address); + const restAddressResult = await Promise.all(restAddresses.map(address => this.bindOneAddress(address, boundPortObject))); + const allResults = [firstAddressResult, ...restAddressResult]; + return { + count: allResults.filter(result => result.error === undefined).length, + port: firstAddressResult.port, + errors: allResults + .filter(result => result.error) + .map(result => result.error), + }; + } + } + else { + const allResults = await Promise.all(addressList.map(address => this.bindOneAddress(address, boundPortObject))); + return { + count: allResults.filter(result => result.error === undefined).length, + port: allResults[0].port, + errors: allResults + .filter(result => result.error) + .map(result => result.error), + }; + } + } + async bindAddressList(addressList, boundPortObject) { + const bindResult = await this.bindManyPorts(addressList, boundPortObject); + if (bindResult.count > 0) { + if (bindResult.count < addressList.length) { + logging.log(constants_1.LogVerbosity.INFO, `WARNING Only ${bindResult.count} addresses added out of total ${addressList.length} resolved`); + } + return bindResult.port; + } + else { + const errorString = `No address added out of total ${addressList.length} resolved`; + logging.log(constants_1.LogVerbosity.ERROR, errorString); + throw new Error(`${errorString} errors: [${bindResult.errors.join(',')}]`); + } + } + resolvePort(port) { + return new Promise((resolve, reject) => { + let seenResolution = false; + const resolverListener = (endpointList, attributes, serviceConfig, resolutionNote) => { + if (seenResolution) { + return true; + } + seenResolution = true; + if (!endpointList.ok) { + reject(new Error(endpointList.error.details)); + return true; + } + const addressList = [].concat(...endpointList.value.map(endpoint => endpoint.addresses)); + if (addressList.length === 0) { + reject(new Error(`No addresses resolved for port ${port}`)); + return true; + } + resolve(addressList); + return true; + }; + const resolver = (0, resolver_1.createResolver)(port, resolverListener, this.options); + resolver.updateResolution(); + }); + } + async bindPort(port, boundPortObject) { + const addressList = await this.resolvePort(port); + if (boundPortObject.cancelled) { + this.completeUnbind(boundPortObject); + throw new Error('bindAsync operation cancelled by unbind call'); + } + const portNumber = await this.bindAddressList(addressList, boundPortObject); + if (boundPortObject.cancelled) { + this.completeUnbind(boundPortObject); + throw new Error('bindAsync operation cancelled by unbind call'); + } + return portNumber; + } + normalizePort(port) { + const initialPortUri = (0, uri_parser_1.parseUri)(port); + if (initialPortUri === null) { + throw new Error(`Could not parse port "${port}"`); + } + const portUri = (0, resolver_1.mapUriDefaultScheme)(initialPortUri); + if (portUri === null) { + throw new Error(`Could not get a default scheme for port "${port}"`); + } + return portUri; + } + bindAsync(port, creds, callback) { + if (this.shutdown) { + throw new Error('bindAsync called after shutdown'); + } + if (typeof port !== 'string') { + throw new TypeError('port must be a string'); + } + if (creds === null || !(creds instanceof server_credentials_1.ServerCredentials)) { + throw new TypeError('creds must be a ServerCredentials object'); + } + if (typeof callback !== 'function') { + throw new TypeError('callback must be a function'); + } + this.trace('bindAsync port=' + port); + const portUri = this.normalizePort(port); + const deferredCallback = (error, port) => { + process.nextTick(() => callback(error, port)); + }; + /* First, if this port is already bound or that bind operation is in + * progress, use that result. */ + let boundPortObject = this.boundPorts.get((0, uri_parser_1.uriToString)(portUri)); + if (boundPortObject) { + if (!creds._equals(boundPortObject.credentials)) { + deferredCallback(new Error(`${port} already bound with incompatible credentials`), 0); + return; + } + /* If that operation has previously been cancelled by an unbind call, + * uncancel it. */ + boundPortObject.cancelled = false; + if (boundPortObject.completionPromise) { + boundPortObject.completionPromise.then(portNum => callback(null, portNum), error => callback(error, 0)); + } + else { + deferredCallback(null, boundPortObject.portNumber); + } + return; + } + boundPortObject = { + mapKey: (0, uri_parser_1.uriToString)(portUri), + originalUri: portUri, + completionPromise: null, + cancelled: false, + portNumber: 0, + credentials: creds, + listeningServers: new Set(), + }; + const splitPort = (0, uri_parser_1.splitHostPort)(portUri.path); + const completionPromise = this.bindPort(portUri, boundPortObject); + boundPortObject.completionPromise = completionPromise; + /* If the port number is 0, defer populating the map entry until after the + * bind operation completes and we have a specific port number. Otherwise, + * populate it immediately. */ + if ((splitPort === null || splitPort === void 0 ? void 0 : splitPort.port) === 0) { + completionPromise.then(portNum => { + const finalUri = { + scheme: portUri.scheme, + authority: portUri.authority, + path: (0, uri_parser_1.combineHostPort)({ host: splitPort.host, port: portNum }), + }; + boundPortObject.mapKey = (0, uri_parser_1.uriToString)(finalUri); + boundPortObject.completionPromise = null; + boundPortObject.portNumber = portNum; + this.boundPorts.set(boundPortObject.mapKey, boundPortObject); + callback(null, portNum); + }, error => { + callback(error, 0); + }); + } + else { + this.boundPorts.set(boundPortObject.mapKey, boundPortObject); + completionPromise.then(portNum => { + boundPortObject.completionPromise = null; + boundPortObject.portNumber = portNum; + callback(null, portNum); + }, error => { + callback(error, 0); + }); + } + } + registerInjectorToChannelz() { + return (0, channelz_1.registerChannelzSocket)('injector', () => { + return { + localAddress: null, + remoteAddress: null, + security: null, + remoteName: null, + streamsStarted: 0, + streamsSucceeded: 0, + streamsFailed: 0, + messagesSent: 0, + messagesReceived: 0, + keepAlivesSent: 0, + lastLocalStreamCreatedTimestamp: null, + lastRemoteStreamCreatedTimestamp: null, + lastMessageSentTimestamp: null, + lastMessageReceivedTimestamp: null, + localFlowControlWindow: null, + remoteFlowControlWindow: null, + }; + }, this.channelzEnabled); + } + /** + * This API is experimental, so API stability is not guaranteed across minor versions. + * @param credentials + * @param channelzRef + * @returns + */ + experimentalCreateConnectionInjectorWithChannelzRef(credentials, channelzRef, ownsChannelzRef = false) { + if (credentials === null || !(credentials instanceof server_credentials_1.ServerCredentials)) { + throw new TypeError('creds must be a ServerCredentials object'); + } + if (this.channelzEnabled) { + this.listenerChildrenTracker.refChild(channelzRef); + } + const server = this.createHttp2Server(credentials); + const sessionsSet = new Set(); + this.http2Servers.set(server, { + channelzRef: channelzRef, + sessions: sessionsSet, + ownsChannelzRef + }); + return { + injectConnection: (connection) => { + server.emit('connection', connection); + }, + drain: (graceTimeMs) => { + var _b, _c; + for (const session of sessionsSet) { + this.closeSession(session); + } + (_c = (_b = setTimeout(() => { + for (const session of sessionsSet) { + session.destroy(http2.constants.NGHTTP2_CANCEL); + } + }, graceTimeMs)).unref) === null || _c === void 0 ? void 0 : _c.call(_b); + }, + destroy: () => { + this.closeServer(server); + for (const session of sessionsSet) { + this.closeSession(session); + } + } + }; + } + createConnectionInjector(credentials) { + if (credentials === null || !(credentials instanceof server_credentials_1.ServerCredentials)) { + throw new TypeError('creds must be a ServerCredentials object'); + } + const channelzRef = this.registerInjectorToChannelz(); + return this.experimentalCreateConnectionInjectorWithChannelzRef(credentials, channelzRef, true); + } + closeServer(server, callback) { + this.trace('Closing server with address ' + JSON.stringify(server.address())); + const serverInfo = this.http2Servers.get(server); + server.close(() => { + if (serverInfo && serverInfo.ownsChannelzRef) { + this.listenerChildrenTracker.unrefChild(serverInfo.channelzRef); + (0, channelz_1.unregisterChannelzRef)(serverInfo.channelzRef); + } + this.http2Servers.delete(server); + callback === null || callback === void 0 ? void 0 : callback(); + }); + } + closeSession(session, callback) { + var _b; + this.trace('Closing session initiated by ' + ((_b = session.socket) === null || _b === void 0 ? void 0 : _b.remoteAddress)); + const sessionInfo = this.sessions.get(session); + const closeCallback = () => { + if (sessionInfo) { + this.sessionChildrenTracker.unrefChild(sessionInfo.ref); + (0, channelz_1.unregisterChannelzRef)(sessionInfo.ref); + } + callback === null || callback === void 0 ? void 0 : callback(); + }; + if (session.closed) { + queueMicrotask(closeCallback); + } + else { + session.close(closeCallback); + } + } + completeUnbind(boundPortObject) { + for (const server of boundPortObject.listeningServers) { + const serverInfo = this.http2Servers.get(server); + this.closeServer(server, () => { + boundPortObject.listeningServers.delete(server); + }); + if (serverInfo) { + for (const session of serverInfo.sessions) { + this.closeSession(session); + } + } + } + this.boundPorts.delete(boundPortObject.mapKey); + } + /** + * Unbind a previously bound port, or cancel an in-progress bindAsync + * operation. If port 0 was bound, only the actual bound port can be + * unbound. For example, if bindAsync was called with "localhost:0" and the + * bound port result was 54321, it can be unbound as "localhost:54321". + * @param port + */ + unbind(port) { + this.trace('unbind port=' + port); + const portUri = this.normalizePort(port); + const splitPort = (0, uri_parser_1.splitHostPort)(portUri.path); + if ((splitPort === null || splitPort === void 0 ? void 0 : splitPort.port) === 0) { + throw new Error('Cannot unbind port 0'); + } + const boundPortObject = this.boundPorts.get((0, uri_parser_1.uriToString)(portUri)); + if (boundPortObject) { + this.trace('unbinding ' + + boundPortObject.mapKey + + ' originally bound as ' + + (0, uri_parser_1.uriToString)(boundPortObject.originalUri)); + /* If the bind operation is pending, the cancelled flag will trigger + * the unbind operation later. */ + if (boundPortObject.completionPromise) { + boundPortObject.cancelled = true; + } + else { + this.completeUnbind(boundPortObject); + } + } + } + /** + * Gracefully close all connections associated with a previously bound port. + * After the grace time, forcefully close all remaining open connections. + * + * If port 0 was bound, only the actual bound port can be + * drained. For example, if bindAsync was called with "localhost:0" and the + * bound port result was 54321, it can be drained as "localhost:54321". + * @param port + * @param graceTimeMs + * @returns + */ + drain(port, graceTimeMs) { + var _b, _c; + this.trace('drain port=' + port + ' graceTimeMs=' + graceTimeMs); + const portUri = this.normalizePort(port); + const splitPort = (0, uri_parser_1.splitHostPort)(portUri.path); + if ((splitPort === null || splitPort === void 0 ? void 0 : splitPort.port) === 0) { + throw new Error('Cannot drain port 0'); + } + const boundPortObject = this.boundPorts.get((0, uri_parser_1.uriToString)(portUri)); + if (!boundPortObject) { + return; + } + const allSessions = new Set(); + for (const http2Server of boundPortObject.listeningServers) { + const serverEntry = this.http2Servers.get(http2Server); + if (serverEntry) { + for (const session of serverEntry.sessions) { + allSessions.add(session); + this.closeSession(session, () => { + allSessions.delete(session); + }); + } + } + } + /* After the grace time ends, send another goaway to all remaining sessions + * with the CANCEL code. */ + (_c = (_b = setTimeout(() => { + for (const session of allSessions) { + session.destroy(http2.constants.NGHTTP2_CANCEL); + } + }, graceTimeMs)).unref) === null || _c === void 0 ? void 0 : _c.call(_b); + } + forceShutdown() { + for (const boundPortObject of this.boundPorts.values()) { + boundPortObject.cancelled = true; + } + this.boundPorts.clear(); + // Close the server if it is still running. + for (const server of this.http2Servers.keys()) { + this.closeServer(server); + } + // Always destroy any available sessions. It's possible that one or more + // tryShutdown() calls are in progress. Don't wait on them to finish. + this.sessions.forEach((channelzInfo, session) => { + this.closeSession(session); + // Cast NGHTTP2_CANCEL to any because TypeScript doesn't seem to + // recognize destroy(code) as a valid signature. + // eslint-disable-next-line @typescript-eslint/no-explicit-any + session.destroy(http2.constants.NGHTTP2_CANCEL); + }); + this.sessions.clear(); + (0, channelz_1.unregisterChannelzRef)(this.channelzRef); + this.shutdown = true; + } + register(name, handler, serialize, deserialize, type) { + if (this.handlers.has(name)) { + return false; + } + this.handlers.set(name, { + func: handler, + serialize, + deserialize, + type, + path: name, + }); + return true; + } + unregister(name) { + return this.handlers.delete(name); + } + /** + * @deprecated No longer needed as of version 1.10.x + */ + start() { + if (this.http2Servers.size === 0 || + [...this.http2Servers.keys()].every(server => !server.listening)) { + throw new Error('server must be bound in order to start'); + } + if (this.started === true) { + throw new Error('server is already started'); + } + this.started = true; + } + tryShutdown(callback) { + var _b; + const wrappedCallback = (error) => { + (0, channelz_1.unregisterChannelzRef)(this.channelzRef); + callback(error); + }; + let pendingChecks = 0; + function maybeCallback() { + pendingChecks--; + if (pendingChecks === 0) { + wrappedCallback(); + } + } + this.shutdown = true; + for (const [serverKey, server] of this.http2Servers.entries()) { + pendingChecks++; + const serverString = server.channelzRef.name; + this.trace('Waiting for server ' + serverString + ' to close'); + this.closeServer(serverKey, () => { + this.trace('Server ' + serverString + ' finished closing'); + maybeCallback(); + }); + for (const session of server.sessions.keys()) { + pendingChecks++; + const sessionString = (_b = session.socket) === null || _b === void 0 ? void 0 : _b.remoteAddress; + this.trace('Waiting for session ' + sessionString + ' to close'); + this.closeSession(session, () => { + this.trace('Session ' + sessionString + ' finished closing'); + maybeCallback(); + }); + } + } + if (pendingChecks === 0) { + wrappedCallback(); + } + } + addHttp2Port() { + throw new Error('Not yet implemented'); + } + /** + * Get the channelz reference object for this server. The returned value is + * garbage if channelz is disabled for this server. + * @returns + */ + getChannelzRef() { + return this.channelzRef; + } + _verifyContentType(stream, headers) { + const contentType = headers[http2.constants.HTTP2_HEADER_CONTENT_TYPE]; + if (typeof contentType !== 'string' || + !contentType.startsWith('application/grpc')) { + stream.respond({ + [http2.constants.HTTP2_HEADER_STATUS]: http2.constants.HTTP_STATUS_UNSUPPORTED_MEDIA_TYPE, + }, { endStream: true }); + return false; + } + return true; + } + _retrieveHandler(path) { + serverCallTrace('Received call to method ' + + path + + ' at address ' + + this.serverAddressString); + const handler = this.handlers.get(path); + if (handler === undefined) { + serverCallTrace('No handler registered for method ' + + path + + '. Sending UNIMPLEMENTED status.'); + return null; + } + return handler; + } + _respondWithError(err, stream, channelzSessionInfo = null) { + var _b, _c; + const trailersToSend = Object.assign({ 'grpc-status': (_b = err.code) !== null && _b !== void 0 ? _b : constants_1.Status.INTERNAL, 'grpc-message': err.details, [http2.constants.HTTP2_HEADER_STATUS]: http2.constants.HTTP_STATUS_OK, [http2.constants.HTTP2_HEADER_CONTENT_TYPE]: 'application/grpc+proto' }, (_c = err.metadata) === null || _c === void 0 ? void 0 : _c.toHttp2Headers()); + stream.respond(trailersToSend, { endStream: true }); + this.callTracker.addCallFailed(); + channelzSessionInfo === null || channelzSessionInfo === void 0 ? void 0 : channelzSessionInfo.streamTracker.addCallFailed(); + } + _channelzHandler(extraInterceptors, stream, headers) { + // for handling idle timeout + this.onStreamOpened(stream); + const channelzSessionInfo = this.sessions.get(stream.session); + this.callTracker.addCallStarted(); + channelzSessionInfo === null || channelzSessionInfo === void 0 ? void 0 : channelzSessionInfo.streamTracker.addCallStarted(); + if (!this._verifyContentType(stream, headers)) { + this.callTracker.addCallFailed(); + channelzSessionInfo === null || channelzSessionInfo === void 0 ? void 0 : channelzSessionInfo.streamTracker.addCallFailed(); + return; + } + const path = headers[HTTP2_HEADER_PATH]; + const handler = this._retrieveHandler(path); + if (!handler) { + this._respondWithError(getUnimplementedStatusResponse(path), stream, channelzSessionInfo); + return; + } + const callEventTracker = { + addMessageSent: () => { + if (channelzSessionInfo) { + channelzSessionInfo.messagesSent += 1; + channelzSessionInfo.lastMessageSentTimestamp = new Date(); + } + }, + addMessageReceived: () => { + if (channelzSessionInfo) { + channelzSessionInfo.messagesReceived += 1; + channelzSessionInfo.lastMessageReceivedTimestamp = new Date(); + } + }, + onCallEnd: status => { + if (status.code === constants_1.Status.OK) { + this.callTracker.addCallSucceeded(); + } + else { + this.callTracker.addCallFailed(); + } + }, + onStreamEnd: success => { + if (channelzSessionInfo) { + if (success) { + channelzSessionInfo.streamTracker.addCallSucceeded(); + } + else { + channelzSessionInfo.streamTracker.addCallFailed(); + } + } + }, + }; + const call = (0, server_interceptors_1.getServerInterceptingCall)([...extraInterceptors, ...this.interceptors], stream, headers, callEventTracker, handler, this.options); + if (!this._runHandlerForCall(call, handler)) { + this.callTracker.addCallFailed(); + channelzSessionInfo === null || channelzSessionInfo === void 0 ? void 0 : channelzSessionInfo.streamTracker.addCallFailed(); + call.sendStatus({ + code: constants_1.Status.INTERNAL, + details: `Unknown handler type: ${handler.type}`, + }); + } + } + _streamHandler(extraInterceptors, stream, headers) { + // for handling idle timeout + this.onStreamOpened(stream); + if (this._verifyContentType(stream, headers) !== true) { + return; + } + const path = headers[HTTP2_HEADER_PATH]; + const handler = this._retrieveHandler(path); + if (!handler) { + this._respondWithError(getUnimplementedStatusResponse(path), stream, null); + return; + } + const call = (0, server_interceptors_1.getServerInterceptingCall)([...extraInterceptors, ...this.interceptors], stream, headers, null, handler, this.options); + if (!this._runHandlerForCall(call, handler)) { + call.sendStatus({ + code: constants_1.Status.INTERNAL, + details: `Unknown handler type: ${handler.type}`, + }); + } + } + _runHandlerForCall(call, handler) { + const { type } = handler; + if (type === 'unary') { + handleUnary(call, handler); + } + else if (type === 'clientStream') { + handleClientStreaming(call, handler); + } + else if (type === 'serverStream') { + handleServerStreaming(call, handler); + } + else if (type === 'bidi') { + handleBidiStreaming(call, handler); + } + else { + return false; + } + return true; + } + _setupHandlers(http2Server, extraInterceptors) { + if (http2Server === null) { + return; + } + const serverAddress = http2Server.address(); + let serverAddressString = 'null'; + if (serverAddress) { + if (typeof serverAddress === 'string') { + serverAddressString = serverAddress; + } + else { + serverAddressString = serverAddress.address + ':' + serverAddress.port; + } + } + this.serverAddressString = serverAddressString; + const handler = this.channelzEnabled + ? this._channelzHandler + : this._streamHandler; + const sessionHandler = this.channelzEnabled + ? this._channelzSessionHandler(http2Server) + : this._sessionHandler(http2Server); + http2Server.on('stream', handler.bind(this, extraInterceptors)); + http2Server.on('session', sessionHandler); + } + _sessionHandler(http2Server) { + return (session) => { + var _b, _c; + (_b = this.http2Servers.get(http2Server)) === null || _b === void 0 ? void 0 : _b.sessions.add(session); + let connectionAgeTimer = null; + let connectionAgeGraceTimer = null; + let keepaliveTimer = null; + let sessionClosedByServer = false; + const idleTimeoutObj = this.enableIdleTimeout(session); + if (this.maxConnectionAgeMs !== UNLIMITED_CONNECTION_AGE_MS) { + // Apply a random jitter within a +/-10% range + const jitterMagnitude = this.maxConnectionAgeMs / 10; + const jitter = Math.random() * jitterMagnitude * 2 - jitterMagnitude; + connectionAgeTimer = setTimeout(() => { + var _b, _c; + sessionClosedByServer = true; + this.trace('Connection dropped by max connection age: ' + + ((_b = session.socket) === null || _b === void 0 ? void 0 : _b.remoteAddress)); + try { + session.goaway(http2.constants.NGHTTP2_NO_ERROR, ~(1 << 31), kMaxAge); + } + catch (e) { + // The goaway can't be sent because the session is already closed + session.destroy(); + return; + } + session.close(); + /* Allow a grace period after sending the GOAWAY before forcibly + * closing the connection. */ + if (this.maxConnectionAgeGraceMs !== UNLIMITED_CONNECTION_AGE_MS) { + connectionAgeGraceTimer = setTimeout(() => { + session.destroy(); + }, this.maxConnectionAgeGraceMs); + (_c = connectionAgeGraceTimer.unref) === null || _c === void 0 ? void 0 : _c.call(connectionAgeGraceTimer); + } + }, this.maxConnectionAgeMs + jitter); + (_c = connectionAgeTimer.unref) === null || _c === void 0 ? void 0 : _c.call(connectionAgeTimer); + } + const clearKeepaliveTimeout = () => { + if (keepaliveTimer) { + clearTimeout(keepaliveTimer); + keepaliveTimer = null; + } + }; + const canSendPing = () => { + return (!session.destroyed && + this.keepaliveTimeMs < KEEPALIVE_MAX_TIME_MS && + this.keepaliveTimeMs > 0); + }; + /* eslint-disable-next-line prefer-const */ + let sendPing; // hoisted for use in maybeStartKeepalivePingTimer + const maybeStartKeepalivePingTimer = () => { + var _b; + if (!canSendPing()) { + return; + } + this.keepaliveTrace('Starting keepalive timer for ' + this.keepaliveTimeMs + 'ms'); + keepaliveTimer = setTimeout(() => { + clearKeepaliveTimeout(); + sendPing(); + }, this.keepaliveTimeMs); + (_b = keepaliveTimer.unref) === null || _b === void 0 ? void 0 : _b.call(keepaliveTimer); + }; + sendPing = () => { + var _b; + if (!canSendPing()) { + return; + } + this.keepaliveTrace('Sending ping with timeout ' + this.keepaliveTimeoutMs + 'ms'); + let pingSendError = ''; + try { + const pingSentSuccessfully = session.ping((err, duration, payload) => { + clearKeepaliveTimeout(); + if (err) { + this.keepaliveTrace('Ping failed with error: ' + err.message); + sessionClosedByServer = true; + session.close(); + } + else { + this.keepaliveTrace('Received ping response'); + maybeStartKeepalivePingTimer(); + } + }); + if (!pingSentSuccessfully) { + pingSendError = 'Ping returned false'; + } + } + catch (e) { + // grpc/grpc-node#2139 + pingSendError = + (e instanceof Error ? e.message : '') || 'Unknown error'; + } + if (pingSendError) { + this.keepaliveTrace('Ping send failed: ' + pingSendError); + this.trace('Connection dropped due to ping send error: ' + pingSendError); + sessionClosedByServer = true; + session.close(); + return; + } + keepaliveTimer = setTimeout(() => { + clearKeepaliveTimeout(); + this.keepaliveTrace('Ping timeout passed without response'); + this.trace('Connection dropped by keepalive timeout'); + sessionClosedByServer = true; + session.close(); + }, this.keepaliveTimeoutMs); + (_b = keepaliveTimer.unref) === null || _b === void 0 ? void 0 : _b.call(keepaliveTimer); + }; + maybeStartKeepalivePingTimer(); + session.on('close', () => { + var _b, _c; + if (!sessionClosedByServer) { + this.trace(`Connection dropped by client ${(_b = session.socket) === null || _b === void 0 ? void 0 : _b.remoteAddress}`); + } + if (connectionAgeTimer) { + clearTimeout(connectionAgeTimer); + } + if (connectionAgeGraceTimer) { + clearTimeout(connectionAgeGraceTimer); + } + clearKeepaliveTimeout(); + if (idleTimeoutObj !== null) { + clearTimeout(idleTimeoutObj.timeout); + this.sessionIdleTimeouts.delete(session); + } + (_c = this.http2Servers.get(http2Server)) === null || _c === void 0 ? void 0 : _c.sessions.delete(session); + }); + }; + } + _channelzSessionHandler(http2Server) { + return (session) => { + var _b, _c, _d, _e; + const channelzRef = (0, channelz_1.registerChannelzSocket)((_c = (_b = session.socket) === null || _b === void 0 ? void 0 : _b.remoteAddress) !== null && _c !== void 0 ? _c : 'unknown', this.getChannelzSessionInfo.bind(this, session), this.channelzEnabled); + const channelzSessionInfo = { + ref: channelzRef, + streamTracker: new channelz_1.ChannelzCallTracker(), + messagesSent: 0, + messagesReceived: 0, + keepAlivesSent: 0, + lastMessageSentTimestamp: null, + lastMessageReceivedTimestamp: null, + }; + (_d = this.http2Servers.get(http2Server)) === null || _d === void 0 ? void 0 : _d.sessions.add(session); + this.sessions.set(session, channelzSessionInfo); + const clientAddress = `${session.socket.remoteAddress}:${session.socket.remotePort}`; + this.channelzTrace.addTrace('CT_INFO', 'Connection established by client ' + clientAddress); + this.trace('Connection established by client ' + clientAddress); + this.sessionChildrenTracker.refChild(channelzRef); + let connectionAgeTimer = null; + let connectionAgeGraceTimer = null; + let keepaliveTimeout = null; + let sessionClosedByServer = false; + const idleTimeoutObj = this.enableIdleTimeout(session); + if (this.maxConnectionAgeMs !== UNLIMITED_CONNECTION_AGE_MS) { + // Apply a random jitter within a +/-10% range + const jitterMagnitude = this.maxConnectionAgeMs / 10; + const jitter = Math.random() * jitterMagnitude * 2 - jitterMagnitude; + connectionAgeTimer = setTimeout(() => { + var _b; + sessionClosedByServer = true; + this.channelzTrace.addTrace('CT_INFO', 'Connection dropped by max connection age from ' + clientAddress); + try { + session.goaway(http2.constants.NGHTTP2_NO_ERROR, ~(1 << 31), kMaxAge); + } + catch (e) { + // The goaway can't be sent because the session is already closed + session.destroy(); + return; + } + session.close(); + /* Allow a grace period after sending the GOAWAY before forcibly + * closing the connection. */ + if (this.maxConnectionAgeGraceMs !== UNLIMITED_CONNECTION_AGE_MS) { + connectionAgeGraceTimer = setTimeout(() => { + session.destroy(); + }, this.maxConnectionAgeGraceMs); + (_b = connectionAgeGraceTimer.unref) === null || _b === void 0 ? void 0 : _b.call(connectionAgeGraceTimer); + } + }, this.maxConnectionAgeMs + jitter); + (_e = connectionAgeTimer.unref) === null || _e === void 0 ? void 0 : _e.call(connectionAgeTimer); + } + const clearKeepaliveTimeout = () => { + if (keepaliveTimeout) { + clearTimeout(keepaliveTimeout); + keepaliveTimeout = null; + } + }; + const canSendPing = () => { + return (!session.destroyed && + this.keepaliveTimeMs < KEEPALIVE_MAX_TIME_MS && + this.keepaliveTimeMs > 0); + }; + /* eslint-disable-next-line prefer-const */ + let sendPing; // hoisted for use in maybeStartKeepalivePingTimer + const maybeStartKeepalivePingTimer = () => { + var _b; + if (!canSendPing()) { + return; + } + this.keepaliveTrace('Starting keepalive timer for ' + this.keepaliveTimeMs + 'ms'); + keepaliveTimeout = setTimeout(() => { + clearKeepaliveTimeout(); + sendPing(); + }, this.keepaliveTimeMs); + (_b = keepaliveTimeout.unref) === null || _b === void 0 ? void 0 : _b.call(keepaliveTimeout); + }; + sendPing = () => { + var _b; + if (!canSendPing()) { + return; + } + this.keepaliveTrace('Sending ping with timeout ' + this.keepaliveTimeoutMs + 'ms'); + let pingSendError = ''; + try { + const pingSentSuccessfully = session.ping((err, duration, payload) => { + clearKeepaliveTimeout(); + if (err) { + this.keepaliveTrace('Ping failed with error: ' + err.message); + this.channelzTrace.addTrace('CT_INFO', 'Connection dropped due to error of a ping frame ' + + err.message + + ' return in ' + + duration); + sessionClosedByServer = true; + session.close(); + } + else { + this.keepaliveTrace('Received ping response'); + maybeStartKeepalivePingTimer(); + } + }); + if (!pingSentSuccessfully) { + pingSendError = 'Ping returned false'; + } + } + catch (e) { + // grpc/grpc-node#2139 + pingSendError = + (e instanceof Error ? e.message : '') || 'Unknown error'; + } + if (pingSendError) { + this.keepaliveTrace('Ping send failed: ' + pingSendError); + this.channelzTrace.addTrace('CT_INFO', 'Connection dropped due to ping send error: ' + pingSendError); + sessionClosedByServer = true; + session.close(); + return; + } + channelzSessionInfo.keepAlivesSent += 1; + keepaliveTimeout = setTimeout(() => { + clearKeepaliveTimeout(); + this.keepaliveTrace('Ping timeout passed without response'); + this.channelzTrace.addTrace('CT_INFO', 'Connection dropped by keepalive timeout from ' + clientAddress); + sessionClosedByServer = true; + session.close(); + }, this.keepaliveTimeoutMs); + (_b = keepaliveTimeout.unref) === null || _b === void 0 ? void 0 : _b.call(keepaliveTimeout); + }; + maybeStartKeepalivePingTimer(); + session.on('close', () => { + var _b; + if (!sessionClosedByServer) { + this.channelzTrace.addTrace('CT_INFO', 'Connection dropped by client ' + clientAddress); + } + this.sessionChildrenTracker.unrefChild(channelzRef); + (0, channelz_1.unregisterChannelzRef)(channelzRef); + if (connectionAgeTimer) { + clearTimeout(connectionAgeTimer); + } + if (connectionAgeGraceTimer) { + clearTimeout(connectionAgeGraceTimer); + } + clearKeepaliveTimeout(); + if (idleTimeoutObj !== null) { + clearTimeout(idleTimeoutObj.timeout); + this.sessionIdleTimeouts.delete(session); + } + (_b = this.http2Servers.get(http2Server)) === null || _b === void 0 ? void 0 : _b.sessions.delete(session); + this.sessions.delete(session); + }); + }; + } + enableIdleTimeout(session) { + var _b, _c; + if (this.sessionIdleTimeout >= MAX_CONNECTION_IDLE_MS) { + return null; + } + const idleTimeoutObj = { + activeStreams: 0, + lastIdle: Date.now(), + onClose: this.onStreamClose.bind(this, session), + timeout: setTimeout(this.onIdleTimeout, this.sessionIdleTimeout, this, session), + }; + (_c = (_b = idleTimeoutObj.timeout).unref) === null || _c === void 0 ? void 0 : _c.call(_b); + this.sessionIdleTimeouts.set(session, idleTimeoutObj); + const { socket } = session; + this.trace('Enable idle timeout for ' + + socket.remoteAddress + + ':' + + socket.remotePort); + return idleTimeoutObj; + } + onIdleTimeout(ctx, session) { + const { socket } = session; + const sessionInfo = ctx.sessionIdleTimeouts.get(session); + // if it is called while we have activeStreams - timer will not be rescheduled + // until last active stream is closed, then it will call .refresh() on the timer + // important part is to not clearTimeout(timer) or it becomes unusable + // for future refreshes + if (sessionInfo !== undefined && + sessionInfo.activeStreams === 0) { + if (Date.now() - sessionInfo.lastIdle >= ctx.sessionIdleTimeout) { + ctx.trace('Session idle timeout triggered for ' + + (socket === null || socket === void 0 ? void 0 : socket.remoteAddress) + + ':' + + (socket === null || socket === void 0 ? void 0 : socket.remotePort) + + ' last idle at ' + + sessionInfo.lastIdle); + ctx.closeSession(session); + } + else { + sessionInfo.timeout.refresh(); + } + } + } + onStreamOpened(stream) { + const session = stream.session; + const idleTimeoutObj = this.sessionIdleTimeouts.get(session); + if (idleTimeoutObj) { + idleTimeoutObj.activeStreams += 1; + stream.once('close', idleTimeoutObj.onClose); + } + } + onStreamClose(session) { + var _b, _c; + const idleTimeoutObj = this.sessionIdleTimeouts.get(session); + if (idleTimeoutObj) { + idleTimeoutObj.activeStreams -= 1; + if (idleTimeoutObj.activeStreams === 0) { + idleTimeoutObj.lastIdle = Date.now(); + idleTimeoutObj.timeout.refresh(); + this.trace('Session onStreamClose' + + ((_b = session.socket) === null || _b === void 0 ? void 0 : _b.remoteAddress) + + ':' + + ((_c = session.socket) === null || _c === void 0 ? void 0 : _c.remotePort) + + ' at ' + + idleTimeoutObj.lastIdle); + } + } + } + }, + (() => { + const _metadata = typeof Symbol === "function" && Symbol.metadata ? Object.create(null) : void 0; + _start_decorators = [deprecate('Calling start() is no longer necessary. It can be safely omitted.')]; + __esDecorate(_a, null, _start_decorators, { kind: "method", name: "start", static: false, private: false, access: { has: obj => "start" in obj, get: obj => obj.start }, metadata: _metadata }, null, _instanceExtraInitializers); + if (_metadata) Object.defineProperty(_a, Symbol.metadata, { enumerable: true, configurable: true, writable: true, value: _metadata }); + })(), + _a; +})(); +exports.Server = Server; +async function handleUnary(call, handler) { + let stream; + function respond(err, value, trailer, flags) { + if (err) { + call.sendStatus((0, server_call_1.serverErrorToStatus)(err, trailer)); + return; + } + call.sendMessage(value, () => { + call.sendStatus({ + code: constants_1.Status.OK, + details: 'OK', + metadata: trailer !== null && trailer !== void 0 ? trailer : null, + }); + }); + } + let requestMetadata; + let requestMessage = null; + call.start({ + onReceiveMetadata(metadata) { + requestMetadata = metadata; + call.startRead(); + }, + onReceiveMessage(message) { + if (requestMessage) { + call.sendStatus({ + code: constants_1.Status.UNIMPLEMENTED, + details: `Received a second request message for server streaming method ${handler.path}`, + metadata: null, + }); + return; + } + requestMessage = message; + call.startRead(); + }, + onReceiveHalfClose() { + if (!requestMessage) { + call.sendStatus({ + code: constants_1.Status.UNIMPLEMENTED, + details: `Received no request message for server streaming method ${handler.path}`, + metadata: null, + }); + return; + } + stream = new server_call_1.ServerWritableStreamImpl(handler.path, call, requestMetadata, requestMessage); + try { + handler.func(stream, respond); + } + catch (err) { + call.sendStatus({ + code: constants_1.Status.UNKNOWN, + details: `Server method handler threw error ${err.message}`, + metadata: null, + }); + } + }, + onCancel() { + if (stream) { + stream.cancelled = true; + stream.emit('cancelled', 'cancelled'); + } + }, + }); +} +function handleClientStreaming(call, handler) { + let stream; + function respond(err, value, trailer, flags) { + if (err) { + call.sendStatus((0, server_call_1.serverErrorToStatus)(err, trailer)); + return; + } + call.sendMessage(value, () => { + call.sendStatus({ + code: constants_1.Status.OK, + details: 'OK', + metadata: trailer !== null && trailer !== void 0 ? trailer : null, + }); + }); + } + call.start({ + onReceiveMetadata(metadata) { + stream = new server_call_1.ServerDuplexStreamImpl(handler.path, call, metadata); + try { + handler.func(stream, respond); + } + catch (err) { + call.sendStatus({ + code: constants_1.Status.UNKNOWN, + details: `Server method handler threw error ${err.message}`, + metadata: null, + }); + } + }, + onReceiveMessage(message) { + stream.push(message); + }, + onReceiveHalfClose() { + stream.push(null); + }, + onCancel() { + if (stream) { + stream.cancelled = true; + stream.emit('cancelled', 'cancelled'); + stream.destroy(); + } + }, + }); +} +function handleServerStreaming(call, handler) { + let stream; + let requestMetadata; + let requestMessage = null; + call.start({ + onReceiveMetadata(metadata) { + requestMetadata = metadata; + call.startRead(); + }, + onReceiveMessage(message) { + if (requestMessage) { + call.sendStatus({ + code: constants_1.Status.UNIMPLEMENTED, + details: `Received a second request message for server streaming method ${handler.path}`, + metadata: null, + }); + return; + } + requestMessage = message; + call.startRead(); + }, + onReceiveHalfClose() { + if (!requestMessage) { + call.sendStatus({ + code: constants_1.Status.UNIMPLEMENTED, + details: `Received no request message for server streaming method ${handler.path}`, + metadata: null, + }); + return; + } + stream = new server_call_1.ServerWritableStreamImpl(handler.path, call, requestMetadata, requestMessage); + try { + handler.func(stream); + } + catch (err) { + call.sendStatus({ + code: constants_1.Status.UNKNOWN, + details: `Server method handler threw error ${err.message}`, + metadata: null, + }); + } + }, + onCancel() { + if (stream) { + stream.cancelled = true; + stream.emit('cancelled', 'cancelled'); + stream.destroy(); + } + }, + }); +} +function handleBidiStreaming(call, handler) { + let stream; + call.start({ + onReceiveMetadata(metadata) { + stream = new server_call_1.ServerDuplexStreamImpl(handler.path, call, metadata); + try { + handler.func(stream); + } + catch (err) { + call.sendStatus({ + code: constants_1.Status.UNKNOWN, + details: `Server method handler threw error ${err.message}`, + metadata: null, + }); + } + }, + onReceiveMessage(message) { + stream.push(message); + }, + onReceiveHalfClose() { + stream.push(null); + }, + onCancel() { + if (stream) { + stream.cancelled = true; + stream.emit('cancelled', 'cancelled'); + stream.destroy(); + } + }, + }); +} +//# sourceMappingURL=server.js.map + +/***/ }), + +/***/ 70005: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.validateRetryThrottling = validateRetryThrottling; +exports.validateServiceConfig = validateServiceConfig; +exports.extractAndSelectServiceConfig = extractAndSelectServiceConfig; +/* This file implements gRFC A2 and the service config spec: + * https://github.com/grpc/proposal/blob/master/A2-service-configs-in-dns.md + * https://github.com/grpc/grpc/blob/master/doc/service_config.md. Each + * function here takes an object with unknown structure and returns its + * specific object type if the input has the right structure, and throws an + * error otherwise. */ +/* The any type is purposely used here. All functions validate their input at + * runtime */ +/* eslint-disable @typescript-eslint/no-explicit-any */ +const os = __nccwpck_require__(70857); +const constants_1 = __nccwpck_require__(68288); +/** + * Recognizes a number with up to 9 digits after the decimal point, followed by + * an "s", representing a number of seconds. + */ +const DURATION_REGEX = /^\d+(\.\d{1,9})?s$/; +/** + * Client language name used for determining whether this client matches a + * `ServiceConfigCanaryConfig`'s `clientLanguage` list. + */ +const CLIENT_LANGUAGE_STRING = 'node'; +function validateName(obj) { + // In this context, and unset field and '' are considered the same + if ('service' in obj && obj.service !== '') { + if (typeof obj.service !== 'string') { + throw new Error(`Invalid method config name: invalid service: expected type string, got ${typeof obj.service}`); + } + if ('method' in obj && obj.method !== '') { + if (typeof obj.method !== 'string') { + throw new Error(`Invalid method config name: invalid method: expected type string, got ${typeof obj.service}`); + } + return { + service: obj.service, + method: obj.method, + }; + } + else { + return { + service: obj.service, + }; + } + } + else { + if ('method' in obj && obj.method !== undefined) { + throw new Error(`Invalid method config name: method set with empty or unset service`); + } + return {}; + } +} +function validateRetryPolicy(obj) { + if (!('maxAttempts' in obj) || + !Number.isInteger(obj.maxAttempts) || + obj.maxAttempts < 2) { + throw new Error('Invalid method config retry policy: maxAttempts must be an integer at least 2'); + } + if (!('initialBackoff' in obj) || + typeof obj.initialBackoff !== 'string' || + !DURATION_REGEX.test(obj.initialBackoff)) { + throw new Error('Invalid method config retry policy: initialBackoff must be a string consisting of a positive integer or decimal followed by s'); + } + if (!('maxBackoff' in obj) || + typeof obj.maxBackoff !== 'string' || + !DURATION_REGEX.test(obj.maxBackoff)) { + throw new Error('Invalid method config retry policy: maxBackoff must be a string consisting of a positive integer or decimal followed by s'); + } + if (!('backoffMultiplier' in obj) || + typeof obj.backoffMultiplier !== 'number' || + obj.backoffMultiplier <= 0) { + throw new Error('Invalid method config retry policy: backoffMultiplier must be a number greater than 0'); + } + if (!('retryableStatusCodes' in obj && Array.isArray(obj.retryableStatusCodes))) { + throw new Error('Invalid method config retry policy: retryableStatusCodes is required'); + } + if (obj.retryableStatusCodes.length === 0) { + throw new Error('Invalid method config retry policy: retryableStatusCodes must be non-empty'); + } + for (const value of obj.retryableStatusCodes) { + if (typeof value === 'number') { + if (!Object.values(constants_1.Status).includes(value)) { + throw new Error('Invalid method config retry policy: retryableStatusCodes value not in status code range'); + } + } + else if (typeof value === 'string') { + if (!Object.values(constants_1.Status).includes(value.toUpperCase())) { + throw new Error('Invalid method config retry policy: retryableStatusCodes value not a status code name'); + } + } + else { + throw new Error('Invalid method config retry policy: retryableStatusCodes value must be a string or number'); + } + } + return { + maxAttempts: obj.maxAttempts, + initialBackoff: obj.initialBackoff, + maxBackoff: obj.maxBackoff, + backoffMultiplier: obj.backoffMultiplier, + retryableStatusCodes: obj.retryableStatusCodes, + }; +} +function validateHedgingPolicy(obj) { + if (!('maxAttempts' in obj) || + !Number.isInteger(obj.maxAttempts) || + obj.maxAttempts < 2) { + throw new Error('Invalid method config hedging policy: maxAttempts must be an integer at least 2'); + } + if ('hedgingDelay' in obj && + (typeof obj.hedgingDelay !== 'string' || + !DURATION_REGEX.test(obj.hedgingDelay))) { + throw new Error('Invalid method config hedging policy: hedgingDelay must be a string consisting of a positive integer followed by s'); + } + if ('nonFatalStatusCodes' in obj && Array.isArray(obj.nonFatalStatusCodes)) { + for (const value of obj.nonFatalStatusCodes) { + if (typeof value === 'number') { + if (!Object.values(constants_1.Status).includes(value)) { + throw new Error('Invalid method config hedging policy: nonFatalStatusCodes value not in status code range'); + } + } + else if (typeof value === 'string') { + if (!Object.values(constants_1.Status).includes(value.toUpperCase())) { + throw new Error('Invalid method config hedging policy: nonFatalStatusCodes value not a status code name'); + } + } + else { + throw new Error('Invalid method config hedging policy: nonFatalStatusCodes value must be a string or number'); + } + } + } + const result = { + maxAttempts: obj.maxAttempts, + }; + if (obj.hedgingDelay) { + result.hedgingDelay = obj.hedgingDelay; + } + if (obj.nonFatalStatusCodes) { + result.nonFatalStatusCodes = obj.nonFatalStatusCodes; + } + return result; +} +function validateMethodConfig(obj) { + var _a; + const result = { + name: [], + }; + if (!('name' in obj) || !Array.isArray(obj.name)) { + throw new Error('Invalid method config: invalid name array'); + } + for (const name of obj.name) { + result.name.push(validateName(name)); + } + if ('waitForReady' in obj) { + if (typeof obj.waitForReady !== 'boolean') { + throw new Error('Invalid method config: invalid waitForReady'); + } + result.waitForReady = obj.waitForReady; + } + if ('timeout' in obj) { + if (typeof obj.timeout === 'object') { + if (!('seconds' in obj.timeout) || + !(typeof obj.timeout.seconds === 'number')) { + throw new Error('Invalid method config: invalid timeout.seconds'); + } + if (!('nanos' in obj.timeout) || + !(typeof obj.timeout.nanos === 'number')) { + throw new Error('Invalid method config: invalid timeout.nanos'); + } + result.timeout = obj.timeout; + } + else if (typeof obj.timeout === 'string' && + DURATION_REGEX.test(obj.timeout)) { + const timeoutParts = obj.timeout + .substring(0, obj.timeout.length - 1) + .split('.'); + result.timeout = { + seconds: timeoutParts[0] | 0, + nanos: ((_a = timeoutParts[1]) !== null && _a !== void 0 ? _a : 0) | 0, + }; + } + else { + throw new Error('Invalid method config: invalid timeout'); + } + } + if ('maxRequestBytes' in obj) { + if (typeof obj.maxRequestBytes !== 'number') { + throw new Error('Invalid method config: invalid maxRequestBytes'); + } + result.maxRequestBytes = obj.maxRequestBytes; + } + if ('maxResponseBytes' in obj) { + if (typeof obj.maxResponseBytes !== 'number') { + throw new Error('Invalid method config: invalid maxRequestBytes'); + } + result.maxResponseBytes = obj.maxResponseBytes; + } + if ('retryPolicy' in obj) { + if ('hedgingPolicy' in obj) { + throw new Error('Invalid method config: retryPolicy and hedgingPolicy cannot both be specified'); + } + else { + result.retryPolicy = validateRetryPolicy(obj.retryPolicy); + } + } + else if ('hedgingPolicy' in obj) { + result.hedgingPolicy = validateHedgingPolicy(obj.hedgingPolicy); + } + return result; +} +function validateRetryThrottling(obj) { + if (!('maxTokens' in obj) || + typeof obj.maxTokens !== 'number' || + obj.maxTokens <= 0 || + obj.maxTokens > 1000) { + throw new Error('Invalid retryThrottling: maxTokens must be a number in (0, 1000]'); + } + if (!('tokenRatio' in obj) || + typeof obj.tokenRatio !== 'number' || + obj.tokenRatio <= 0) { + throw new Error('Invalid retryThrottling: tokenRatio must be a number greater than 0'); + } + return { + maxTokens: +obj.maxTokens.toFixed(3), + tokenRatio: +obj.tokenRatio.toFixed(3), + }; +} +function validateLoadBalancingConfig(obj) { + if (!(typeof obj === 'object' && obj !== null)) { + throw new Error(`Invalid loadBalancingConfig: unexpected type ${typeof obj}`); + } + const keys = Object.keys(obj); + if (keys.length > 1) { + throw new Error(`Invalid loadBalancingConfig: unexpected multiple keys ${keys}`); + } + if (keys.length === 0) { + throw new Error('Invalid loadBalancingConfig: load balancing policy name required'); + } + return { + [keys[0]]: obj[keys[0]], + }; +} +function validateServiceConfig(obj) { + const result = { + loadBalancingConfig: [], + methodConfig: [], + }; + if ('loadBalancingPolicy' in obj) { + if (typeof obj.loadBalancingPolicy === 'string') { + result.loadBalancingPolicy = obj.loadBalancingPolicy; + } + else { + throw new Error('Invalid service config: invalid loadBalancingPolicy'); + } + } + if ('loadBalancingConfig' in obj) { + if (Array.isArray(obj.loadBalancingConfig)) { + for (const config of obj.loadBalancingConfig) { + result.loadBalancingConfig.push(validateLoadBalancingConfig(config)); + } + } + else { + throw new Error('Invalid service config: invalid loadBalancingConfig'); + } + } + if ('methodConfig' in obj) { + if (Array.isArray(obj.methodConfig)) { + for (const methodConfig of obj.methodConfig) { + result.methodConfig.push(validateMethodConfig(methodConfig)); + } + } + } + if ('retryThrottling' in obj) { + result.retryThrottling = validateRetryThrottling(obj.retryThrottling); + } + // Validate method name uniqueness + const seenMethodNames = []; + for (const methodConfig of result.methodConfig) { + for (const name of methodConfig.name) { + for (const seenName of seenMethodNames) { + if (name.service === seenName.service && + name.method === seenName.method) { + throw new Error(`Invalid service config: duplicate name ${name.service}/${name.method}`); + } + } + seenMethodNames.push(name); + } + } + return result; +} +function validateCanaryConfig(obj) { + if (!('serviceConfig' in obj)) { + throw new Error('Invalid service config choice: missing service config'); + } + const result = { + serviceConfig: validateServiceConfig(obj.serviceConfig), + }; + if ('clientLanguage' in obj) { + if (Array.isArray(obj.clientLanguage)) { + result.clientLanguage = []; + for (const lang of obj.clientLanguage) { + if (typeof lang === 'string') { + result.clientLanguage.push(lang); + } + else { + throw new Error('Invalid service config choice: invalid clientLanguage'); + } + } + } + else { + throw new Error('Invalid service config choice: invalid clientLanguage'); + } + } + if ('clientHostname' in obj) { + if (Array.isArray(obj.clientHostname)) { + result.clientHostname = []; + for (const lang of obj.clientHostname) { + if (typeof lang === 'string') { + result.clientHostname.push(lang); + } + else { + throw new Error('Invalid service config choice: invalid clientHostname'); + } + } + } + else { + throw new Error('Invalid service config choice: invalid clientHostname'); + } + } + if ('percentage' in obj) { + if (typeof obj.percentage === 'number' && + 0 <= obj.percentage && + obj.percentage <= 100) { + result.percentage = obj.percentage; + } + else { + throw new Error('Invalid service config choice: invalid percentage'); + } + } + // Validate that no unexpected fields are present + const allowedFields = [ + 'clientLanguage', + 'percentage', + 'clientHostname', + 'serviceConfig', + ]; + for (const field in obj) { + if (!allowedFields.includes(field)) { + throw new Error(`Invalid service config choice: unexpected field ${field}`); + } + } + return result; +} +function validateAndSelectCanaryConfig(obj, percentage) { + if (!Array.isArray(obj)) { + throw new Error('Invalid service config list'); + } + for (const config of obj) { + const validatedConfig = validateCanaryConfig(config); + /* For each field, we check if it is present, then only discard the + * config if the field value does not match the current client */ + if (typeof validatedConfig.percentage === 'number' && + percentage > validatedConfig.percentage) { + continue; + } + if (Array.isArray(validatedConfig.clientHostname)) { + let hostnameMatched = false; + for (const hostname of validatedConfig.clientHostname) { + if (hostname === os.hostname()) { + hostnameMatched = true; + } + } + if (!hostnameMatched) { + continue; + } + } + if (Array.isArray(validatedConfig.clientLanguage)) { + let languageMatched = false; + for (const language of validatedConfig.clientLanguage) { + if (language === CLIENT_LANGUAGE_STRING) { + languageMatched = true; + } + } + if (!languageMatched) { + continue; + } + } + return validatedConfig.serviceConfig; + } + throw new Error('No matching service config found'); +} +/** + * Find the "grpc_config" record among the TXT records, parse its value as JSON, validate its contents, + * and select a service config with selection fields that all match this client. Most of these steps + * can fail with an error; the caller must handle any errors thrown this way. + * @param txtRecord The TXT record array that is output from a successful call to dns.resolveTxt + * @param percentage A number chosen from the range [0, 100) that is used to select which config to use + * @return The service configuration to use, given the percentage value, or null if the service config + * data has a valid format but none of the options match the current client. + */ +function extractAndSelectServiceConfig(txtRecord, percentage) { + for (const record of txtRecord) { + if (record.length > 0 && record[0].startsWith('grpc_config=')) { + /* Treat the list of strings in this record as a single string and remove + * "grpc_config=" from the beginning. The rest should be a JSON string */ + const recordString = record.join('').substring('grpc_config='.length); + const recordJson = JSON.parse(recordString); + return validateAndSelectCanaryConfig(recordJson, percentage); + } + } + return null; +} +//# sourceMappingURL=service-config.js.map + +/***/ }), + +/***/ 40701: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2025 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.SingleSubchannelChannel = void 0; +const call_number_1 = __nccwpck_require__(35675); +const channelz_1 = __nccwpck_require__(68198); +const compression_filter_1 = __nccwpck_require__(43430); +const connectivity_state_1 = __nccwpck_require__(60778); +const constants_1 = __nccwpck_require__(68288); +const control_plane_status_1 = __nccwpck_require__(39962); +const deadline_1 = __nccwpck_require__(52173); +const filter_stack_1 = __nccwpck_require__(95726); +const metadata_1 = __nccwpck_require__(36100); +const resolver_1 = __nccwpck_require__(76255); +const uri_parser_1 = __nccwpck_require__(56027); +class SubchannelCallWrapper { + constructor(subchannel, method, filterStackFactory, options, callNumber) { + var _a, _b; + this.subchannel = subchannel; + this.method = method; + this.options = options; + this.callNumber = callNumber; + this.childCall = null; + this.pendingMessage = null; + this.readPending = false; + this.halfClosePending = false; + this.pendingStatus = null; + this.readFilterPending = false; + this.writeFilterPending = false; + const splitPath = this.method.split('/'); + let serviceName = ''; + /* The standard path format is "/{serviceName}/{methodName}", so if we split + * by '/', the first item should be empty and the second should be the + * service name */ + if (splitPath.length >= 2) { + serviceName = splitPath[1]; + } + const hostname = (_b = (_a = (0, uri_parser_1.splitHostPort)(this.options.host)) === null || _a === void 0 ? void 0 : _a.host) !== null && _b !== void 0 ? _b : 'localhost'; + /* Currently, call credentials are only allowed on HTTPS connections, so we + * can assume that the scheme is "https" */ + this.serviceUrl = `https://${hostname}/${serviceName}`; + const timeout = (0, deadline_1.getRelativeTimeout)(options.deadline); + if (timeout !== Infinity) { + if (timeout <= 0) { + this.cancelWithStatus(constants_1.Status.DEADLINE_EXCEEDED, 'Deadline exceeded'); + } + else { + setTimeout(() => { + this.cancelWithStatus(constants_1.Status.DEADLINE_EXCEEDED, 'Deadline exceeded'); + }, timeout); + } + } + this.filterStack = filterStackFactory.createFilter(); + } + cancelWithStatus(status, details) { + if (this.childCall) { + this.childCall.cancelWithStatus(status, details); + } + else { + this.pendingStatus = { + code: status, + details: details, + metadata: new metadata_1.Metadata() + }; + } + } + getPeer() { + var _a, _b; + return (_b = (_a = this.childCall) === null || _a === void 0 ? void 0 : _a.getPeer()) !== null && _b !== void 0 ? _b : this.subchannel.getAddress(); + } + async start(metadata, listener) { + if (this.pendingStatus) { + listener.onReceiveStatus(this.pendingStatus); + return; + } + if (this.subchannel.getConnectivityState() !== connectivity_state_1.ConnectivityState.READY) { + listener.onReceiveStatus({ + code: constants_1.Status.UNAVAILABLE, + details: 'Subchannel not ready', + metadata: new metadata_1.Metadata() + }); + return; + } + const filteredMetadata = await this.filterStack.sendMetadata(Promise.resolve(metadata)); + let credsMetadata; + try { + credsMetadata = await this.subchannel.getCallCredentials() + .generateMetadata({ method_name: this.method, service_url: this.serviceUrl }); + } + catch (e) { + const error = e; + const { code, details } = (0, control_plane_status_1.restrictControlPlaneStatusCode)(typeof error.code === 'number' ? error.code : constants_1.Status.UNKNOWN, `Getting metadata from plugin failed with error: ${error.message}`); + listener.onReceiveStatus({ + code: code, + details: details, + metadata: new metadata_1.Metadata(), + }); + return; + } + credsMetadata.merge(filteredMetadata); + const childListener = { + onReceiveMetadata: async (metadata) => { + listener.onReceiveMetadata(await this.filterStack.receiveMetadata(metadata)); + }, + onReceiveMessage: async (message) => { + this.readFilterPending = true; + const filteredMessage = await this.filterStack.receiveMessage(message); + this.readFilterPending = false; + listener.onReceiveMessage(filteredMessage); + if (this.pendingStatus) { + listener.onReceiveStatus(this.pendingStatus); + } + }, + onReceiveStatus: async (status) => { + const filteredStatus = await this.filterStack.receiveTrailers(status); + if (this.readFilterPending) { + this.pendingStatus = filteredStatus; + } + else { + listener.onReceiveStatus(filteredStatus); + } + } + }; + this.childCall = this.subchannel.createCall(credsMetadata, this.options.host, this.method, childListener); + if (this.readPending) { + this.childCall.startRead(); + } + if (this.pendingMessage) { + this.childCall.sendMessageWithContext(this.pendingMessage.context, this.pendingMessage.message); + } + if (this.halfClosePending && !this.writeFilterPending) { + this.childCall.halfClose(); + } + } + async sendMessageWithContext(context, message) { + this.writeFilterPending = true; + const filteredMessage = await this.filterStack.sendMessage(Promise.resolve({ message: message, flags: context.flags })); + this.writeFilterPending = false; + if (this.childCall) { + this.childCall.sendMessageWithContext(context, filteredMessage.message); + if (this.halfClosePending) { + this.childCall.halfClose(); + } + } + else { + this.pendingMessage = { context, message: filteredMessage.message }; + } + } + startRead() { + if (this.childCall) { + this.childCall.startRead(); + } + else { + this.readPending = true; + } + } + halfClose() { + if (this.childCall && !this.writeFilterPending) { + this.childCall.halfClose(); + } + else { + this.halfClosePending = true; + } + } + getCallNumber() { + return this.callNumber; + } + setCredentials(credentials) { + throw new Error("Method not implemented."); + } + getAuthContext() { + if (this.childCall) { + return this.childCall.getAuthContext(); + } + else { + return null; + } + } +} +class SingleSubchannelChannel { + constructor(subchannel, target, options) { + this.subchannel = subchannel; + this.target = target; + this.channelzEnabled = false; + this.channelzTrace = new channelz_1.ChannelzTrace(); + this.callTracker = new channelz_1.ChannelzCallTracker(); + this.childrenTracker = new channelz_1.ChannelzChildrenTracker(); + this.channelzEnabled = options['grpc.enable_channelz'] !== 0; + this.channelzRef = (0, channelz_1.registerChannelzChannel)((0, uri_parser_1.uriToString)(target), () => ({ + target: `${(0, uri_parser_1.uriToString)(target)} (${subchannel.getAddress()})`, + state: this.subchannel.getConnectivityState(), + trace: this.channelzTrace, + callTracker: this.callTracker, + children: this.childrenTracker.getChildLists() + }), this.channelzEnabled); + if (this.channelzEnabled) { + this.childrenTracker.refChild(subchannel.getChannelzRef()); + } + this.filterStackFactory = new filter_stack_1.FilterStackFactory([new compression_filter_1.CompressionFilterFactory(this, options)]); + } + close() { + if (this.channelzEnabled) { + this.childrenTracker.unrefChild(this.subchannel.getChannelzRef()); + } + (0, channelz_1.unregisterChannelzRef)(this.channelzRef); + } + getTarget() { + return (0, uri_parser_1.uriToString)(this.target); + } + getConnectivityState(tryToConnect) { + throw new Error("Method not implemented."); + } + watchConnectivityState(currentState, deadline, callback) { + throw new Error("Method not implemented."); + } + getChannelzRef() { + return this.channelzRef; + } + createCall(method, deadline) { + const callOptions = { + deadline: deadline, + host: (0, resolver_1.getDefaultAuthority)(this.target), + flags: constants_1.Propagate.DEFAULTS, + parentCall: null + }; + return new SubchannelCallWrapper(this.subchannel, method, this.filterStackFactory, callOptions, (0, call_number_1.getNextCallNumber)()); + } +} +exports.SingleSubchannelChannel = SingleSubchannelChannel; +//# sourceMappingURL=single-subchannel-channel.js.map + +/***/ }), + +/***/ 7901: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.StatusBuilder = void 0; +/** + * A builder for gRPC status objects. + */ +class StatusBuilder { + constructor() { + this.code = null; + this.details = null; + this.metadata = null; + } + /** + * Adds a status code to the builder. + */ + withCode(code) { + this.code = code; + return this; + } + /** + * Adds details to the builder. + */ + withDetails(details) { + this.details = details; + return this; + } + /** + * Adds metadata to the builder. + */ + withMetadata(metadata) { + this.metadata = metadata; + return this; + } + /** + * Builds the status object. + */ + build() { + const status = {}; + if (this.code !== null) { + status.code = this.code; + } + if (this.details !== null) { + status.details = this.details; + } + if (this.metadata !== null) { + status.metadata = this.metadata; + } + return status; + } +} +exports.StatusBuilder = StatusBuilder; +//# sourceMappingURL=status-builder.js.map + +/***/ }), + +/***/ 47956: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.StreamDecoder = void 0; +var ReadState; +(function (ReadState) { + ReadState[ReadState["NO_DATA"] = 0] = "NO_DATA"; + ReadState[ReadState["READING_SIZE"] = 1] = "READING_SIZE"; + ReadState[ReadState["READING_MESSAGE"] = 2] = "READING_MESSAGE"; +})(ReadState || (ReadState = {})); +class StreamDecoder { + constructor(maxReadMessageLength) { + this.maxReadMessageLength = maxReadMessageLength; + this.readState = ReadState.NO_DATA; + this.readCompressFlag = Buffer.alloc(1); + this.readPartialSize = Buffer.alloc(4); + this.readSizeRemaining = 4; + this.readMessageSize = 0; + this.readPartialMessage = []; + this.readMessageRemaining = 0; + } + write(data) { + let readHead = 0; + let toRead; + const result = []; + while (readHead < data.length) { + switch (this.readState) { + case ReadState.NO_DATA: + this.readCompressFlag = data.slice(readHead, readHead + 1); + readHead += 1; + this.readState = ReadState.READING_SIZE; + this.readPartialSize.fill(0); + this.readSizeRemaining = 4; + this.readMessageSize = 0; + this.readMessageRemaining = 0; + this.readPartialMessage = []; + break; + case ReadState.READING_SIZE: + toRead = Math.min(data.length - readHead, this.readSizeRemaining); + data.copy(this.readPartialSize, 4 - this.readSizeRemaining, readHead, readHead + toRead); + this.readSizeRemaining -= toRead; + readHead += toRead; + // readSizeRemaining >=0 here + if (this.readSizeRemaining === 0) { + this.readMessageSize = this.readPartialSize.readUInt32BE(0); + if (this.maxReadMessageLength !== -1 && this.readMessageSize > this.maxReadMessageLength) { + throw new Error(`Received message larger than max (${this.readMessageSize} vs ${this.maxReadMessageLength})`); + } + this.readMessageRemaining = this.readMessageSize; + if (this.readMessageRemaining > 0) { + this.readState = ReadState.READING_MESSAGE; + } + else { + const message = Buffer.concat([this.readCompressFlag, this.readPartialSize], 5); + this.readState = ReadState.NO_DATA; + result.push(message); + } + } + break; + case ReadState.READING_MESSAGE: + toRead = Math.min(data.length - readHead, this.readMessageRemaining); + this.readPartialMessage.push(data.slice(readHead, readHead + toRead)); + this.readMessageRemaining -= toRead; + readHead += toRead; + // readMessageRemaining >=0 here + if (this.readMessageRemaining === 0) { + // At this point, we have read a full message + const framedMessageBuffers = [ + this.readCompressFlag, + this.readPartialSize, + ].concat(this.readPartialMessage); + const framedMessage = Buffer.concat(framedMessageBuffers, this.readMessageSize + 5); + this.readState = ReadState.NO_DATA; + result.push(framedMessage); + } + break; + default: + throw new Error('Unexpected read state'); + } + } + return result; + } +} +exports.StreamDecoder = StreamDecoder; +//# sourceMappingURL=stream-decoder.js.map + +/***/ }), + +/***/ 97021: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2021 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.EndpointMap = void 0; +exports.isTcpSubchannelAddress = isTcpSubchannelAddress; +exports.subchannelAddressEqual = subchannelAddressEqual; +exports.subchannelAddressToString = subchannelAddressToString; +exports.stringToSubchannelAddress = stringToSubchannelAddress; +exports.endpointEqual = endpointEqual; +exports.endpointToString = endpointToString; +exports.endpointHasAddress = endpointHasAddress; +const net_1 = __nccwpck_require__(69278); +function isTcpSubchannelAddress(address) { + return 'port' in address; +} +function subchannelAddressEqual(address1, address2) { + if (!address1 && !address2) { + return true; + } + if (!address1 || !address2) { + return false; + } + if (isTcpSubchannelAddress(address1)) { + return (isTcpSubchannelAddress(address2) && + address1.host === address2.host && + address1.port === address2.port); + } + else { + return !isTcpSubchannelAddress(address2) && address1.path === address2.path; + } +} +function subchannelAddressToString(address) { + if (isTcpSubchannelAddress(address)) { + if ((0, net_1.isIPv6)(address.host)) { + return '[' + address.host + ']:' + address.port; + } + else { + return address.host + ':' + address.port; + } + } + else { + return address.path; + } +} +const DEFAULT_PORT = 443; +function stringToSubchannelAddress(addressString, port) { + if ((0, net_1.isIP)(addressString)) { + return { + host: addressString, + port: port !== null && port !== void 0 ? port : DEFAULT_PORT, + }; + } + else { + return { + path: addressString, + }; + } +} +function endpointEqual(endpoint1, endpoint2) { + if (endpoint1.addresses.length !== endpoint2.addresses.length) { + return false; + } + for (let i = 0; i < endpoint1.addresses.length; i++) { + if (!subchannelAddressEqual(endpoint1.addresses[i], endpoint2.addresses[i])) { + return false; + } + } + return true; +} +function endpointToString(endpoint) { + return ('[' + endpoint.addresses.map(subchannelAddressToString).join(', ') + ']'); +} +function endpointHasAddress(endpoint, expectedAddress) { + for (const address of endpoint.addresses) { + if (subchannelAddressEqual(address, expectedAddress)) { + return true; + } + } + return false; +} +function endpointEqualUnordered(endpoint1, endpoint2) { + if (endpoint1.addresses.length !== endpoint2.addresses.length) { + return false; + } + for (const address1 of endpoint1.addresses) { + let matchFound = false; + for (const address2 of endpoint2.addresses) { + if (subchannelAddressEqual(address1, address2)) { + matchFound = true; + break; + } + } + if (!matchFound) { + return false; + } + } + return true; +} +class EndpointMap { + constructor() { + this.map = new Set(); + } + get size() { + return this.map.size; + } + getForSubchannelAddress(address) { + for (const entry of this.map) { + if (endpointHasAddress(entry.key, address)) { + return entry.value; + } + } + return undefined; + } + /** + * Delete any entries in this map with keys that are not in endpoints + * @param endpoints + */ + deleteMissing(endpoints) { + const removedValues = []; + for (const entry of this.map) { + let foundEntry = false; + for (const endpoint of endpoints) { + if (endpointEqualUnordered(endpoint, entry.key)) { + foundEntry = true; + } + } + if (!foundEntry) { + removedValues.push(entry.value); + this.map.delete(entry); + } + } + return removedValues; + } + get(endpoint) { + for (const entry of this.map) { + if (endpointEqualUnordered(endpoint, entry.key)) { + return entry.value; + } + } + return undefined; + } + set(endpoint, mapEntry) { + for (const entry of this.map) { + if (endpointEqualUnordered(endpoint, entry.key)) { + entry.value = mapEntry; + return; + } + } + this.map.add({ key: endpoint, value: mapEntry }); + } + delete(endpoint) { + for (const entry of this.map) { + if (endpointEqualUnordered(endpoint, entry.key)) { + this.map.delete(entry); + return; + } + } + } + has(endpoint) { + for (const entry of this.map) { + if (endpointEqualUnordered(endpoint, entry.key)) { + return true; + } + } + return false; + } + clear() { + this.map.clear(); + } + *keys() { + for (const entry of this.map) { + yield entry.key; + } + } + *values() { + for (const entry of this.map) { + yield entry.value; + } + } + *entries() { + for (const entry of this.map) { + yield [entry.key, entry.value]; + } + } +} +exports.EndpointMap = EndpointMap; +//# sourceMappingURL=subchannel-address.js.map + +/***/ }), + +/***/ 17953: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Http2SubchannelCall = void 0; +const http2 = __nccwpck_require__(85675); +const os = __nccwpck_require__(70857); +const constants_1 = __nccwpck_require__(68288); +const metadata_1 = __nccwpck_require__(36100); +const stream_decoder_1 = __nccwpck_require__(47956); +const logging = __nccwpck_require__(8536); +const constants_2 = __nccwpck_require__(68288); +const TRACER_NAME = 'subchannel_call'; +/** + * Should do approximately the same thing as util.getSystemErrorName but the + * TypeScript types don't have that function for some reason so I just made my + * own. + * @param errno + */ +function getSystemErrorName(errno) { + for (const [name, num] of Object.entries(os.constants.errno)) { + if (num === errno) { + return name; + } + } + return 'Unknown system error ' + errno; +} +function mapHttpStatusCode(code) { + const details = `Received HTTP status code ${code}`; + let mappedStatusCode; + switch (code) { + // TODO(murgatroid99): handle 100 and 101 + case 400: + mappedStatusCode = constants_1.Status.INTERNAL; + break; + case 401: + mappedStatusCode = constants_1.Status.UNAUTHENTICATED; + break; + case 403: + mappedStatusCode = constants_1.Status.PERMISSION_DENIED; + break; + case 404: + mappedStatusCode = constants_1.Status.UNIMPLEMENTED; + break; + case 429: + case 502: + case 503: + case 504: + mappedStatusCode = constants_1.Status.UNAVAILABLE; + break; + default: + mappedStatusCode = constants_1.Status.UNKNOWN; + } + return { + code: mappedStatusCode, + details: details, + metadata: new metadata_1.Metadata() + }; +} +class Http2SubchannelCall { + constructor(http2Stream, callEventTracker, listener, transport, callId) { + var _a; + this.http2Stream = http2Stream; + this.callEventTracker = callEventTracker; + this.listener = listener; + this.transport = transport; + this.callId = callId; + this.isReadFilterPending = false; + this.isPushPending = false; + this.canPush = false; + /** + * Indicates that an 'end' event has come from the http2 stream, so there + * will be no more data events. + */ + this.readsClosed = false; + this.statusOutput = false; + this.unpushedReadMessages = []; + // This is populated (non-null) if and only if the call has ended + this.finalStatus = null; + this.internalError = null; + this.serverEndedCall = false; + this.connectionDropped = false; + const maxReceiveMessageLength = (_a = transport.getOptions()['grpc.max_receive_message_length']) !== null && _a !== void 0 ? _a : constants_1.DEFAULT_MAX_RECEIVE_MESSAGE_LENGTH; + this.decoder = new stream_decoder_1.StreamDecoder(maxReceiveMessageLength); + http2Stream.on('response', (headers, flags) => { + let headersString = ''; + for (const header of Object.keys(headers)) { + headersString += '\t\t' + header + ': ' + headers[header] + '\n'; + } + this.trace('Received server headers:\n' + headersString); + this.httpStatusCode = headers[':status']; + if (flags & http2.constants.NGHTTP2_FLAG_END_STREAM) { + this.handleTrailers(headers); + } + else { + let metadata; + try { + metadata = metadata_1.Metadata.fromHttp2Headers(headers); + } + catch (error) { + this.endCall({ + code: constants_1.Status.UNKNOWN, + details: error.message, + metadata: new metadata_1.Metadata(), + }); + return; + } + this.listener.onReceiveMetadata(metadata); + } + }); + http2Stream.on('trailers', (headers) => { + this.handleTrailers(headers); + }); + http2Stream.on('data', (data) => { + /* If the status has already been output, allow the http2 stream to + * drain without processing the data. */ + if (this.statusOutput) { + return; + } + this.trace('receive HTTP/2 data frame of length ' + data.length); + let messages; + try { + messages = this.decoder.write(data); + } + catch (e) { + /* Some servers send HTML error pages along with HTTP status codes. + * When the client attempts to parse this as a length-delimited + * message, the parsed message size is greater than the default limit, + * resulting in a message decoding error. In that situation, the HTTP + * error code information is more useful to the user than the + * RESOURCE_EXHAUSTED error is, so we report that instead. Normally, + * we delay processing the HTTP status until after the stream ends, to + * prioritize reporting the gRPC status from trailers if it is present, + * but when there is a message parsing error we end the stream early + * before processing trailers. */ + if (this.httpStatusCode !== undefined && this.httpStatusCode !== 200) { + const mappedStatus = mapHttpStatusCode(this.httpStatusCode); + this.cancelWithStatus(mappedStatus.code, mappedStatus.details); + } + else { + this.cancelWithStatus(constants_1.Status.RESOURCE_EXHAUSTED, e.message); + } + return; + } + for (const message of messages) { + this.trace('parsed message of length ' + message.length); + this.callEventTracker.addMessageReceived(); + this.tryPush(message); + } + }); + http2Stream.on('end', () => { + this.readsClosed = true; + this.maybeOutputStatus(); + }); + http2Stream.on('close', () => { + this.serverEndedCall = true; + /* Use process.next tick to ensure that this code happens after any + * "error" event that may be emitted at about the same time, so that + * we can bubble up the error message from that event. */ + process.nextTick(() => { + var _a; + this.trace('HTTP/2 stream closed with code ' + http2Stream.rstCode); + /* If we have a final status with an OK status code, that means that + * we have received all of the messages and we have processed the + * trailers and the call completed successfully, so it doesn't matter + * how the stream ends after that */ + if (((_a = this.finalStatus) === null || _a === void 0 ? void 0 : _a.code) === constants_1.Status.OK) { + return; + } + let code; + let details = ''; + switch (http2Stream.rstCode) { + case http2.constants.NGHTTP2_NO_ERROR: + /* If we get a NO_ERROR code and we already have a status, the + * stream completed properly and we just haven't fully processed + * it yet */ + if (this.finalStatus !== null) { + return; + } + if (this.httpStatusCode && this.httpStatusCode !== 200) { + const mappedStatus = mapHttpStatusCode(this.httpStatusCode); + code = mappedStatus.code; + details = mappedStatus.details; + } + else { + code = constants_1.Status.INTERNAL; + details = `Received RST_STREAM with code ${http2Stream.rstCode} (Call ended without gRPC status)`; + } + break; + case http2.constants.NGHTTP2_REFUSED_STREAM: + code = constants_1.Status.UNAVAILABLE; + details = 'Stream refused by server'; + break; + case http2.constants.NGHTTP2_CANCEL: + /* Bug reports indicate that Node synthesizes a NGHTTP2_CANCEL + * code from connection drops. We want to prioritize reporting + * an unavailable status when that happens. */ + if (this.connectionDropped) { + code = constants_1.Status.UNAVAILABLE; + details = 'Connection dropped'; + } + else { + code = constants_1.Status.CANCELLED; + details = 'Call cancelled'; + } + break; + case http2.constants.NGHTTP2_ENHANCE_YOUR_CALM: + code = constants_1.Status.RESOURCE_EXHAUSTED; + details = 'Bandwidth exhausted or memory limit exceeded'; + break; + case http2.constants.NGHTTP2_INADEQUATE_SECURITY: + code = constants_1.Status.PERMISSION_DENIED; + details = 'Protocol not secure enough'; + break; + case http2.constants.NGHTTP2_INTERNAL_ERROR: + code = constants_1.Status.INTERNAL; + if (this.internalError === null) { + /* This error code was previously handled in the default case, and + * there are several instances of it online, so I wanted to + * preserve the original error message so that people find existing + * information in searches, but also include the more recognizable + * "Internal server error" message. */ + details = `Received RST_STREAM with code ${http2Stream.rstCode} (Internal server error)`; + } + else { + if (this.internalError.code === 'ECONNRESET' || + this.internalError.code === 'ETIMEDOUT') { + code = constants_1.Status.UNAVAILABLE; + details = this.internalError.message; + } + else { + /* The "Received RST_STREAM with code ..." error is preserved + * here for continuity with errors reported online, but the + * error message at the end will probably be more relevant in + * most cases. */ + details = `Received RST_STREAM with code ${http2Stream.rstCode} triggered by internal client error: ${this.internalError.message}`; + } + } + break; + default: + code = constants_1.Status.INTERNAL; + details = `Received RST_STREAM with code ${http2Stream.rstCode}`; + } + // This is a no-op if trailers were received at all. + // This is OK, because status codes emitted here correspond to more + // catastrophic issues that prevent us from receiving trailers in the + // first place. + this.endCall({ + code, + details, + metadata: new metadata_1.Metadata(), + rstCode: http2Stream.rstCode, + }); + }); + }); + http2Stream.on('error', (err) => { + /* We need an error handler here to stop "Uncaught Error" exceptions + * from bubbling up. However, errors here should all correspond to + * "close" events, where we will handle the error more granularly */ + /* Specifically looking for stream errors that were *not* constructed + * from a RST_STREAM response here: + * https://github.com/nodejs/node/blob/8b8620d580314050175983402dfddf2674e8e22a/lib/internal/http2/core.js#L2267 + */ + if (err.code !== 'ERR_HTTP2_STREAM_ERROR') { + this.trace('Node error event: message=' + + err.message + + ' code=' + + err.code + + ' errno=' + + getSystemErrorName(err.errno) + + ' syscall=' + + err.syscall); + this.internalError = err; + } + this.callEventTracker.onStreamEnd(false); + }); + } + getDeadlineInfo() { + return [`remote_addr=${this.getPeer()}`]; + } + onDisconnect() { + this.connectionDropped = true; + /* Give the call an event loop cycle to finish naturally before reporting + * the disconnection as an error. */ + setImmediate(() => { + this.endCall({ + code: constants_1.Status.UNAVAILABLE, + details: 'Connection dropped', + metadata: new metadata_1.Metadata(), + }); + }); + } + outputStatus() { + /* Precondition: this.finalStatus !== null */ + if (!this.statusOutput) { + this.statusOutput = true; + this.trace('ended with status: code=' + + this.finalStatus.code + + ' details="' + + this.finalStatus.details + + '"'); + this.callEventTracker.onCallEnd(this.finalStatus); + /* We delay the actual action of bubbling up the status to insulate the + * cleanup code in this class from any errors that may be thrown in the + * upper layers as a result of bubbling up the status. In particular, + * if the status is not OK, the "error" event may be emitted + * synchronously at the top level, which will result in a thrown error if + * the user does not handle that event. */ + process.nextTick(() => { + this.listener.onReceiveStatus(this.finalStatus); + }); + /* Leave the http2 stream in flowing state to drain incoming messages, to + * ensure that the stream closure completes. The call stream already does + * not push more messages after the status is output, so the messages go + * nowhere either way. */ + this.http2Stream.resume(); + } + } + trace(text) { + logging.trace(constants_2.LogVerbosity.DEBUG, TRACER_NAME, '[' + this.callId + '] ' + text); + } + /** + * On first call, emits a 'status' event with the given StatusObject. + * Subsequent calls are no-ops. + * @param status The status of the call. + */ + endCall(status) { + /* If the status is OK and a new status comes in (e.g. from a + * deserialization failure), that new status takes priority */ + if (this.finalStatus === null || this.finalStatus.code === constants_1.Status.OK) { + this.finalStatus = status; + this.maybeOutputStatus(); + } + this.destroyHttp2Stream(); + } + maybeOutputStatus() { + if (this.finalStatus !== null) { + /* The combination check of readsClosed and that the two message buffer + * arrays are empty checks that there all incoming data has been fully + * processed */ + if (this.finalStatus.code !== constants_1.Status.OK || + (this.readsClosed && + this.unpushedReadMessages.length === 0 && + !this.isReadFilterPending && + !this.isPushPending)) { + this.outputStatus(); + } + } + } + push(message) { + this.trace('pushing to reader message of length ' + + (message instanceof Buffer ? message.length : null)); + this.canPush = false; + this.isPushPending = true; + process.nextTick(() => { + this.isPushPending = false; + /* If we have already output the status any later messages should be + * ignored, and can cause out-of-order operation errors higher up in the + * stack. Checking as late as possible here to avoid any race conditions. + */ + if (this.statusOutput) { + return; + } + this.listener.onReceiveMessage(message); + this.maybeOutputStatus(); + }); + } + tryPush(messageBytes) { + if (this.canPush) { + this.http2Stream.pause(); + this.push(messageBytes); + } + else { + this.trace('unpushedReadMessages.push message of length ' + messageBytes.length); + this.unpushedReadMessages.push(messageBytes); + } + } + handleTrailers(headers) { + this.serverEndedCall = true; + this.callEventTracker.onStreamEnd(true); + let headersString = ''; + for (const header of Object.keys(headers)) { + headersString += '\t\t' + header + ': ' + headers[header] + '\n'; + } + this.trace('Received server trailers:\n' + headersString); + let metadata; + try { + metadata = metadata_1.Metadata.fromHttp2Headers(headers); + } + catch (e) { + metadata = new metadata_1.Metadata(); + } + const metadataMap = metadata.getMap(); + let status; + if (typeof metadataMap['grpc-status'] === 'string') { + const receivedStatus = Number(metadataMap['grpc-status']); + this.trace('received status code ' + receivedStatus + ' from server'); + metadata.remove('grpc-status'); + let details = ''; + if (typeof metadataMap['grpc-message'] === 'string') { + try { + details = decodeURI(metadataMap['grpc-message']); + } + catch (e) { + details = metadataMap['grpc-message']; + } + metadata.remove('grpc-message'); + this.trace('received status details string "' + details + '" from server'); + } + status = { + code: receivedStatus, + details: details, + metadata: metadata + }; + } + else if (this.httpStatusCode) { + status = mapHttpStatusCode(this.httpStatusCode); + status.metadata = metadata; + } + else { + status = { + code: constants_1.Status.UNKNOWN, + details: 'No status information received', + metadata: metadata + }; + } + // This is a no-op if the call was already ended when handling headers. + this.endCall(status); + } + destroyHttp2Stream() { + var _a; + // The http2 stream could already have been destroyed if cancelWithStatus + // is called in response to an internal http2 error. + if (this.http2Stream.destroyed) { + return; + } + /* If the server ended the call, sending an RST_STREAM is redundant, so we + * just half close on the client side instead to finish closing the stream. + */ + if (this.serverEndedCall) { + this.http2Stream.end(); + } + else { + /* If the call has ended with an OK status, communicate that when closing + * the stream, partly to avoid a situation in which we detect an error + * RST_STREAM as a result after we have the status */ + let code; + if (((_a = this.finalStatus) === null || _a === void 0 ? void 0 : _a.code) === constants_1.Status.OK) { + code = http2.constants.NGHTTP2_NO_ERROR; + } + else { + code = http2.constants.NGHTTP2_CANCEL; + } + this.trace('close http2 stream with code ' + code); + this.http2Stream.close(code); + } + } + cancelWithStatus(status, details) { + this.trace('cancelWithStatus code: ' + status + ' details: "' + details + '"'); + this.endCall({ code: status, details, metadata: new metadata_1.Metadata() }); + } + getStatus() { + return this.finalStatus; + } + getPeer() { + return this.transport.getPeerName(); + } + getCallNumber() { + return this.callId; + } + getAuthContext() { + return this.transport.getAuthContext(); + } + startRead() { + /* If the stream has ended with an error, we should not emit any more + * messages and we should communicate that the stream has ended */ + if (this.finalStatus !== null && this.finalStatus.code !== constants_1.Status.OK) { + this.readsClosed = true; + this.maybeOutputStatus(); + return; + } + this.canPush = true; + if (this.unpushedReadMessages.length > 0) { + const nextMessage = this.unpushedReadMessages.shift(); + this.push(nextMessage); + return; + } + /* Only resume reading from the http2Stream if we don't have any pending + * messages to emit */ + this.http2Stream.resume(); + } + sendMessageWithContext(context, message) { + this.trace('write() called with message of length ' + message.length); + const cb = (error) => { + /* nextTick here ensures that no stream action can be taken in the call + * stack of the write callback, in order to hopefully work around + * https://github.com/nodejs/node/issues/49147 */ + process.nextTick(() => { + var _a; + let code = constants_1.Status.UNAVAILABLE; + if ((error === null || error === void 0 ? void 0 : error.code) === + 'ERR_STREAM_WRITE_AFTER_END') { + code = constants_1.Status.INTERNAL; + } + if (error) { + this.cancelWithStatus(code, `Write error: ${error.message}`); + } + (_a = context.callback) === null || _a === void 0 ? void 0 : _a.call(context); + }); + }; + this.trace('sending data chunk of length ' + message.length); + this.callEventTracker.addMessageSent(); + try { + this.http2Stream.write(message, cb); + } + catch (error) { + this.endCall({ + code: constants_1.Status.UNAVAILABLE, + details: `Write failed with error ${error.message}`, + metadata: new metadata_1.Metadata(), + }); + } + } + halfClose() { + this.trace('end() called'); + this.trace('calling end() on HTTP/2 stream'); + this.http2Stream.end(); + } +} +exports.Http2SubchannelCall = Http2SubchannelCall; +//# sourceMappingURL=subchannel-call.js.map + +/***/ }), + +/***/ 70098: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright 2022 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.BaseSubchannelWrapper = void 0; +class BaseSubchannelWrapper { + constructor(child) { + this.child = child; + this.healthy = true; + this.healthListeners = new Set(); + this.refcount = 0; + this.dataWatchers = new Set(); + child.addHealthStateWatcher(childHealthy => { + /* A change to the child health state only affects this wrapper's overall + * health state if this wrapper is reporting healthy. */ + if (this.healthy) { + this.updateHealthListeners(); + } + }); + } + updateHealthListeners() { + for (const listener of this.healthListeners) { + listener(this.isHealthy()); + } + } + getConnectivityState() { + return this.child.getConnectivityState(); + } + addConnectivityStateListener(listener) { + this.child.addConnectivityStateListener(listener); + } + removeConnectivityStateListener(listener) { + this.child.removeConnectivityStateListener(listener); + } + startConnecting() { + this.child.startConnecting(); + } + getAddress() { + return this.child.getAddress(); + } + throttleKeepalive(newKeepaliveTime) { + this.child.throttleKeepalive(newKeepaliveTime); + } + ref() { + this.child.ref(); + this.refcount += 1; + } + unref() { + this.child.unref(); + this.refcount -= 1; + if (this.refcount === 0) { + this.destroy(); + } + } + destroy() { + for (const watcher of this.dataWatchers) { + watcher.destroy(); + } + } + getChannelzRef() { + return this.child.getChannelzRef(); + } + isHealthy() { + return this.healthy && this.child.isHealthy(); + } + addHealthStateWatcher(listener) { + this.healthListeners.add(listener); + } + removeHealthStateWatcher(listener) { + this.healthListeners.delete(listener); + } + addDataWatcher(dataWatcher) { + dataWatcher.setSubchannel(this.getRealSubchannel()); + this.dataWatchers.add(dataWatcher); + } + setHealthy(healthy) { + if (healthy !== this.healthy) { + this.healthy = healthy; + /* A change to this wrapper's health state only affects the overall + * reported health state if the child is healthy. */ + if (this.child.isHealthy()) { + this.updateHealthListeners(); + } + } + } + getRealSubchannel() { + return this.child.getRealSubchannel(); + } + realSubchannelEquals(other) { + return this.getRealSubchannel() === other.getRealSubchannel(); + } + getCallCredentials() { + return this.child.getCallCredentials(); + } + getChannel() { + return this.child.getChannel(); + } +} +exports.BaseSubchannelWrapper = BaseSubchannelWrapper; +//# sourceMappingURL=subchannel-interface.js.map + +/***/ }), + +/***/ 48695: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.SubchannelPool = void 0; +exports.getSubchannelPool = getSubchannelPool; +const channel_options_1 = __nccwpck_require__(86793); +const subchannel_1 = __nccwpck_require__(68416); +const subchannel_address_1 = __nccwpck_require__(97021); +const uri_parser_1 = __nccwpck_require__(56027); +const transport_1 = __nccwpck_require__(33860); +// 10 seconds in milliseconds. This value is arbitrary. +/** + * The amount of time in between checks for dropping subchannels that have no + * other references + */ +const REF_CHECK_INTERVAL = 10000; +class SubchannelPool { + /** + * A pool of subchannels use for making connections. Subchannels with the + * exact same parameters will be reused. + */ + constructor() { + this.pool = Object.create(null); + /** + * A timer of a task performing a periodic subchannel cleanup. + */ + this.cleanupTimer = null; + } + /** + * Unrefs all unused subchannels and cancels the cleanup task if all + * subchannels have been unrefed. + */ + unrefUnusedSubchannels() { + let allSubchannelsUnrefed = true; + /* These objects are created with Object.create(null), so they do not + * have a prototype, which means that for (... in ...) loops over them + * do not need to be filtered */ + // eslint-disable-disable-next-line:forin + for (const channelTarget in this.pool) { + const subchannelObjArray = this.pool[channelTarget]; + const refedSubchannels = subchannelObjArray.filter(value => !value.subchannel.unrefIfOneRef()); + if (refedSubchannels.length > 0) { + allSubchannelsUnrefed = false; + } + /* For each subchannel in the pool, try to unref it if it has + * exactly one ref (which is the ref from the pool itself). If that + * does happen, remove the subchannel from the pool */ + this.pool[channelTarget] = refedSubchannels; + } + /* Currently we do not delete keys with empty values. If that results + * in significant memory usage we should change it. */ + // Cancel the cleanup task if all subchannels have been unrefed. + if (allSubchannelsUnrefed && this.cleanupTimer !== null) { + clearInterval(this.cleanupTimer); + this.cleanupTimer = null; + } + } + /** + * Ensures that the cleanup task is spawned. + */ + ensureCleanupTask() { + var _a, _b; + if (this.cleanupTimer === null) { + this.cleanupTimer = setInterval(() => { + this.unrefUnusedSubchannels(); + }, REF_CHECK_INTERVAL); + // Unref because this timer should not keep the event loop running. + // Call unref only if it exists to address electron/electron#21162 + (_b = (_a = this.cleanupTimer).unref) === null || _b === void 0 ? void 0 : _b.call(_a); + } + } + /** + * Get a subchannel if one already exists with exactly matching parameters. + * Otherwise, create and save a subchannel with those parameters. + * @param channelTarget + * @param subchannelTarget + * @param channelArguments + * @param channelCredentials + */ + getOrCreateSubchannel(channelTargetUri, subchannelTarget, channelArguments, channelCredentials) { + this.ensureCleanupTask(); + const channelTarget = (0, uri_parser_1.uriToString)(channelTargetUri); + if (channelTarget in this.pool) { + const subchannelObjArray = this.pool[channelTarget]; + for (const subchannelObj of subchannelObjArray) { + if ((0, subchannel_address_1.subchannelAddressEqual)(subchannelTarget, subchannelObj.subchannelAddress) && + (0, channel_options_1.channelOptionsEqual)(channelArguments, subchannelObj.channelArguments) && + channelCredentials._equals(subchannelObj.channelCredentials)) { + return subchannelObj.subchannel; + } + } + } + // If we get here, no matching subchannel was found + const subchannel = new subchannel_1.Subchannel(channelTargetUri, subchannelTarget, channelArguments, channelCredentials, new transport_1.Http2SubchannelConnector(channelTargetUri)); + if (!(channelTarget in this.pool)) { + this.pool[channelTarget] = []; + } + this.pool[channelTarget].push({ + subchannelAddress: subchannelTarget, + channelArguments, + channelCredentials, + subchannel, + }); + subchannel.ref(); + return subchannel; + } +} +exports.SubchannelPool = SubchannelPool; +const globalSubchannelPool = new SubchannelPool(); +/** + * Get either the global subchannel pool, or a new subchannel pool. + * @param global + */ +function getSubchannelPool(global) { + if (global) { + return globalSubchannelPool; + } + else { + return new SubchannelPool(); + } +} +//# sourceMappingURL=subchannel-pool.js.map + +/***/ }), + +/***/ 68416: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Subchannel = void 0; +const connectivity_state_1 = __nccwpck_require__(60778); +const backoff_timeout_1 = __nccwpck_require__(14643); +const logging = __nccwpck_require__(8536); +const constants_1 = __nccwpck_require__(68288); +const uri_parser_1 = __nccwpck_require__(56027); +const subchannel_address_1 = __nccwpck_require__(97021); +const channelz_1 = __nccwpck_require__(68198); +const single_subchannel_channel_1 = __nccwpck_require__(40701); +const TRACER_NAME = 'subchannel'; +/* setInterval and setTimeout only accept signed 32 bit integers. JS doesn't + * have a constant for the max signed 32 bit integer, so this is a simple way + * to calculate it */ +const KEEPALIVE_MAX_TIME_MS = ~(1 << 31); +class Subchannel { + /** + * A class representing a connection to a single backend. + * @param channelTarget The target string for the channel as a whole + * @param subchannelAddress The address for the backend that this subchannel + * will connect to + * @param options The channel options, plus any specific subchannel options + * for this subchannel + * @param credentials The channel credentials used to establish this + * connection + */ + constructor(channelTarget, subchannelAddress, options, credentials, connector) { + var _a; + this.channelTarget = channelTarget; + this.subchannelAddress = subchannelAddress; + this.options = options; + this.connector = connector; + /** + * The subchannel's current connectivity state. Invariant: `session` === `null` + * if and only if `connectivityState` is IDLE or TRANSIENT_FAILURE. + */ + this.connectivityState = connectivity_state_1.ConnectivityState.IDLE; + /** + * The underlying http2 session used to make requests. + */ + this.transport = null; + /** + * Indicates that the subchannel should transition from TRANSIENT_FAILURE to + * CONNECTING instead of IDLE when the backoff timeout ends. + */ + this.continueConnecting = false; + /** + * A list of listener functions that will be called whenever the connectivity + * state changes. Will be modified by `addConnectivityStateListener` and + * `removeConnectivityStateListener` + */ + this.stateListeners = new Set(); + /** + * Tracks channels and subchannel pools with references to this subchannel + */ + this.refcount = 0; + // Channelz info + this.channelzEnabled = true; + this.dataProducers = new Map(); + this.subchannelChannel = null; + const backoffOptions = { + initialDelay: options['grpc.initial_reconnect_backoff_ms'], + maxDelay: options['grpc.max_reconnect_backoff_ms'], + }; + this.backoffTimeout = new backoff_timeout_1.BackoffTimeout(() => { + this.handleBackoffTimer(); + }, backoffOptions); + this.backoffTimeout.unref(); + this.subchannelAddressString = (0, subchannel_address_1.subchannelAddressToString)(subchannelAddress); + this.keepaliveTime = (_a = options['grpc.keepalive_time_ms']) !== null && _a !== void 0 ? _a : -1; + if (options['grpc.enable_channelz'] === 0) { + this.channelzEnabled = false; + this.channelzTrace = new channelz_1.ChannelzTraceStub(); + this.callTracker = new channelz_1.ChannelzCallTrackerStub(); + this.childrenTracker = new channelz_1.ChannelzChildrenTrackerStub(); + this.streamTracker = new channelz_1.ChannelzCallTrackerStub(); + } + else { + this.channelzTrace = new channelz_1.ChannelzTrace(); + this.callTracker = new channelz_1.ChannelzCallTracker(); + this.childrenTracker = new channelz_1.ChannelzChildrenTracker(); + this.streamTracker = new channelz_1.ChannelzCallTracker(); + } + this.channelzRef = (0, channelz_1.registerChannelzSubchannel)(this.subchannelAddressString, () => this.getChannelzInfo(), this.channelzEnabled); + this.channelzTrace.addTrace('CT_INFO', 'Subchannel created'); + this.trace('Subchannel constructed with options ' + + JSON.stringify(options, undefined, 2)); + this.secureConnector = credentials._createSecureConnector(channelTarget, options); + } + getChannelzInfo() { + return { + state: this.connectivityState, + trace: this.channelzTrace, + callTracker: this.callTracker, + children: this.childrenTracker.getChildLists(), + target: this.subchannelAddressString, + }; + } + trace(text) { + logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, '(' + + this.channelzRef.id + + ') ' + + this.subchannelAddressString + + ' ' + + text); + } + refTrace(text) { + logging.trace(constants_1.LogVerbosity.DEBUG, 'subchannel_refcount', '(' + + this.channelzRef.id + + ') ' + + this.subchannelAddressString + + ' ' + + text); + } + handleBackoffTimer() { + if (this.continueConnecting) { + this.transitionToState([connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE], connectivity_state_1.ConnectivityState.CONNECTING); + } + else { + this.transitionToState([connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE], connectivity_state_1.ConnectivityState.IDLE); + } + } + /** + * Start a backoff timer with the current nextBackoff timeout + */ + startBackoff() { + this.backoffTimeout.runOnce(); + } + stopBackoff() { + this.backoffTimeout.stop(); + this.backoffTimeout.reset(); + } + startConnectingInternal() { + let options = this.options; + if (options['grpc.keepalive_time_ms']) { + const adjustedKeepaliveTime = Math.min(this.keepaliveTime, KEEPALIVE_MAX_TIME_MS); + options = Object.assign(Object.assign({}, options), { 'grpc.keepalive_time_ms': adjustedKeepaliveTime }); + } + this.connector + .connect(this.subchannelAddress, this.secureConnector, options) + .then(transport => { + if (this.transitionToState([connectivity_state_1.ConnectivityState.CONNECTING], connectivity_state_1.ConnectivityState.READY)) { + this.transport = transport; + if (this.channelzEnabled) { + this.childrenTracker.refChild(transport.getChannelzRef()); + } + transport.addDisconnectListener(tooManyPings => { + this.transitionToState([connectivity_state_1.ConnectivityState.READY], connectivity_state_1.ConnectivityState.IDLE); + if (tooManyPings && this.keepaliveTime > 0) { + this.keepaliveTime *= 2; + logging.log(constants_1.LogVerbosity.ERROR, `Connection to ${(0, uri_parser_1.uriToString)(this.channelTarget)} at ${this.subchannelAddressString} rejected by server because of excess pings. Increasing ping interval to ${this.keepaliveTime} ms`); + } + }); + } + else { + /* If we can't transition from CONNECTING to READY here, we will + * not be using this transport, so release its resources. */ + transport.shutdown(); + } + }, error => { + this.transitionToState([connectivity_state_1.ConnectivityState.CONNECTING], connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE, `${error}`); + }); + } + /** + * Initiate a state transition from any element of oldStates to the new + * state. If the current connectivityState is not in oldStates, do nothing. + * @param oldStates The set of states to transition from + * @param newState The state to transition to + * @returns True if the state changed, false otherwise + */ + transitionToState(oldStates, newState, errorMessage) { + var _a, _b; + if (oldStates.indexOf(this.connectivityState) === -1) { + return false; + } + if (errorMessage) { + this.trace(connectivity_state_1.ConnectivityState[this.connectivityState] + + ' -> ' + + connectivity_state_1.ConnectivityState[newState] + + ' with error "' + errorMessage + '"'); + } + else { + this.trace(connectivity_state_1.ConnectivityState[this.connectivityState] + + ' -> ' + + connectivity_state_1.ConnectivityState[newState]); + } + if (this.channelzEnabled) { + this.channelzTrace.addTrace('CT_INFO', 'Connectivity state change to ' + connectivity_state_1.ConnectivityState[newState]); + } + const previousState = this.connectivityState; + this.connectivityState = newState; + switch (newState) { + case connectivity_state_1.ConnectivityState.READY: + this.stopBackoff(); + break; + case connectivity_state_1.ConnectivityState.CONNECTING: + this.startBackoff(); + this.startConnectingInternal(); + this.continueConnecting = false; + break; + case connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE: + if (this.channelzEnabled && this.transport) { + this.childrenTracker.unrefChild(this.transport.getChannelzRef()); + } + (_a = this.transport) === null || _a === void 0 ? void 0 : _a.shutdown(); + this.transport = null; + /* If the backoff timer has already ended by the time we get to the + * TRANSIENT_FAILURE state, we want to immediately transition out of + * TRANSIENT_FAILURE as though the backoff timer is ending right now */ + if (!this.backoffTimeout.isRunning()) { + process.nextTick(() => { + this.handleBackoffTimer(); + }); + } + break; + case connectivity_state_1.ConnectivityState.IDLE: + if (this.channelzEnabled && this.transport) { + this.childrenTracker.unrefChild(this.transport.getChannelzRef()); + } + (_b = this.transport) === null || _b === void 0 ? void 0 : _b.shutdown(); + this.transport = null; + break; + default: + throw new Error(`Invalid state: unknown ConnectivityState ${newState}`); + } + for (const listener of this.stateListeners) { + listener(this, previousState, newState, this.keepaliveTime, errorMessage); + } + return true; + } + ref() { + this.refTrace('refcount ' + this.refcount + ' -> ' + (this.refcount + 1)); + this.refcount += 1; + } + unref() { + this.refTrace('refcount ' + this.refcount + ' -> ' + (this.refcount - 1)); + this.refcount -= 1; + if (this.refcount === 0) { + this.channelzTrace.addTrace('CT_INFO', 'Shutting down'); + (0, channelz_1.unregisterChannelzRef)(this.channelzRef); + this.secureConnector.destroy(); + process.nextTick(() => { + this.transitionToState([connectivity_state_1.ConnectivityState.CONNECTING, connectivity_state_1.ConnectivityState.READY], connectivity_state_1.ConnectivityState.IDLE); + }); + } + } + unrefIfOneRef() { + if (this.refcount === 1) { + this.unref(); + return true; + } + return false; + } + createCall(metadata, host, method, listener) { + if (!this.transport) { + throw new Error('Cannot create call, subchannel not READY'); + } + let statsTracker; + if (this.channelzEnabled) { + this.callTracker.addCallStarted(); + this.streamTracker.addCallStarted(); + statsTracker = { + onCallEnd: status => { + if (status.code === constants_1.Status.OK) { + this.callTracker.addCallSucceeded(); + } + else { + this.callTracker.addCallFailed(); + } + }, + }; + } + else { + statsTracker = {}; + } + return this.transport.createCall(metadata, host, method, listener, statsTracker); + } + /** + * If the subchannel is currently IDLE, start connecting and switch to the + * CONNECTING state. If the subchannel is current in TRANSIENT_FAILURE, + * the next time it would transition to IDLE, start connecting again instead. + * Otherwise, do nothing. + */ + startConnecting() { + process.nextTick(() => { + /* First, try to transition from IDLE to connecting. If that doesn't happen + * because the state is not currently IDLE, check if it is + * TRANSIENT_FAILURE, and if so indicate that it should go back to + * connecting after the backoff timer ends. Otherwise do nothing */ + if (!this.transitionToState([connectivity_state_1.ConnectivityState.IDLE], connectivity_state_1.ConnectivityState.CONNECTING)) { + if (this.connectivityState === connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE) { + this.continueConnecting = true; + } + } + }); + } + /** + * Get the subchannel's current connectivity state. + */ + getConnectivityState() { + return this.connectivityState; + } + /** + * Add a listener function to be called whenever the subchannel's + * connectivity state changes. + * @param listener + */ + addConnectivityStateListener(listener) { + this.stateListeners.add(listener); + } + /** + * Remove a listener previously added with `addConnectivityStateListener` + * @param listener A reference to a function previously passed to + * `addConnectivityStateListener` + */ + removeConnectivityStateListener(listener) { + this.stateListeners.delete(listener); + } + /** + * Reset the backoff timeout, and immediately start connecting if in backoff. + */ + resetBackoff() { + process.nextTick(() => { + this.backoffTimeout.reset(); + this.transitionToState([connectivity_state_1.ConnectivityState.TRANSIENT_FAILURE], connectivity_state_1.ConnectivityState.CONNECTING); + }); + } + getAddress() { + return this.subchannelAddressString; + } + getChannelzRef() { + return this.channelzRef; + } + isHealthy() { + return true; + } + addHealthStateWatcher(listener) { + // Do nothing with the listener + } + removeHealthStateWatcher(listener) { + // Do nothing with the listener + } + getRealSubchannel() { + return this; + } + realSubchannelEquals(other) { + return other.getRealSubchannel() === this; + } + throttleKeepalive(newKeepaliveTime) { + if (newKeepaliveTime > this.keepaliveTime) { + this.keepaliveTime = newKeepaliveTime; + } + } + getCallCredentials() { + return this.secureConnector.getCallCredentials(); + } + getChannel() { + if (!this.subchannelChannel) { + this.subchannelChannel = new single_subchannel_channel_1.SingleSubchannelChannel(this, this.channelTarget, this.options); + } + return this.subchannelChannel; + } + addDataWatcher(dataWatcher) { + throw new Error('Not implemented'); + } + getOrCreateDataProducer(name, createDataProducer) { + const existingProducer = this.dataProducers.get(name); + if (existingProducer) { + return existingProducer; + } + const newProducer = createDataProducer(this); + this.dataProducers.set(name, newProducer); + return newProducer; + } + removeDataProducer(name) { + this.dataProducers.delete(name); + } +} +exports.Subchannel = Subchannel; +//# sourceMappingURL=subchannel.js.map + +/***/ }), + +/***/ 68876: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2019 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.CIPHER_SUITES = void 0; +exports.getDefaultRootsData = getDefaultRootsData; +const fs = __nccwpck_require__(79896); +exports.CIPHER_SUITES = process.env.GRPC_SSL_CIPHER_SUITES; +const DEFAULT_ROOTS_FILE_PATH = process.env.GRPC_DEFAULT_SSL_ROOTS_FILE_PATH; +let defaultRootsData = null; +function getDefaultRootsData() { + if (DEFAULT_ROOTS_FILE_PATH) { + if (defaultRootsData === null) { + defaultRootsData = fs.readFileSync(DEFAULT_ROOTS_FILE_PATH); + } + return defaultRootsData; + } + return null; +} +//# sourceMappingURL=tls-helpers.js.map + +/***/ }), + +/***/ 33860: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright 2023 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Http2SubchannelConnector = void 0; +const http2 = __nccwpck_require__(85675); +const tls_1 = __nccwpck_require__(64756); +const channelz_1 = __nccwpck_require__(68198); +const constants_1 = __nccwpck_require__(68288); +const http_proxy_1 = __nccwpck_require__(18954); +const logging = __nccwpck_require__(8536); +const resolver_1 = __nccwpck_require__(76255); +const subchannel_address_1 = __nccwpck_require__(97021); +const uri_parser_1 = __nccwpck_require__(56027); +const net = __nccwpck_require__(69278); +const subchannel_call_1 = __nccwpck_require__(17953); +const call_number_1 = __nccwpck_require__(35675); +const TRACER_NAME = 'transport'; +const FLOW_CONTROL_TRACER_NAME = 'transport_flowctrl'; +const clientVersion = (__nccwpck_require__(9943)/* .version */ .rE); +const { HTTP2_HEADER_AUTHORITY, HTTP2_HEADER_CONTENT_TYPE, HTTP2_HEADER_METHOD, HTTP2_HEADER_PATH, HTTP2_HEADER_TE, HTTP2_HEADER_USER_AGENT, } = http2.constants; +const KEEPALIVE_TIMEOUT_MS = 20000; +const tooManyPingsData = Buffer.from('too_many_pings', 'ascii'); +class Http2Transport { + constructor(session, subchannelAddress, options, + /** + * Name of the remote server, if it is not the same as the subchannel + * address, i.e. if connecting through an HTTP CONNECT proxy. + */ + remoteName) { + this.session = session; + this.options = options; + this.remoteName = remoteName; + /** + * Timer reference indicating when to send the next ping or when the most recent ping will be considered lost. + */ + this.keepaliveTimer = null; + /** + * Indicates that the keepalive timer ran out while there were no active + * calls, and a ping should be sent the next time a call starts. + */ + this.pendingSendKeepalivePing = false; + this.activeCalls = new Set(); + this.disconnectListeners = []; + this.disconnectHandled = false; + this.channelzEnabled = true; + this.keepalivesSent = 0; + this.messagesSent = 0; + this.messagesReceived = 0; + this.lastMessageSentTimestamp = null; + this.lastMessageReceivedTimestamp = null; + /* Populate subchannelAddressString and channelzRef before doing anything + * else, because they are used in the trace methods. */ + this.subchannelAddressString = (0, subchannel_address_1.subchannelAddressToString)(subchannelAddress); + if (options['grpc.enable_channelz'] === 0) { + this.channelzEnabled = false; + this.streamTracker = new channelz_1.ChannelzCallTrackerStub(); + } + else { + this.streamTracker = new channelz_1.ChannelzCallTracker(); + } + this.channelzRef = (0, channelz_1.registerChannelzSocket)(this.subchannelAddressString, () => this.getChannelzInfo(), this.channelzEnabled); + // Build user-agent string. + this.userAgent = [ + options['grpc.primary_user_agent'], + `grpc-node-js/${clientVersion}`, + options['grpc.secondary_user_agent'], + ] + .filter(e => e) + .join(' '); // remove falsey values first + if ('grpc.keepalive_time_ms' in options) { + this.keepaliveTimeMs = options['grpc.keepalive_time_ms']; + } + else { + this.keepaliveTimeMs = -1; + } + if ('grpc.keepalive_timeout_ms' in options) { + this.keepaliveTimeoutMs = options['grpc.keepalive_timeout_ms']; + } + else { + this.keepaliveTimeoutMs = KEEPALIVE_TIMEOUT_MS; + } + if ('grpc.keepalive_permit_without_calls' in options) { + this.keepaliveWithoutCalls = + options['grpc.keepalive_permit_without_calls'] === 1; + } + else { + this.keepaliveWithoutCalls = false; + } + session.once('close', () => { + this.trace('session closed'); + this.handleDisconnect(); + }); + session.once('goaway', (errorCode, lastStreamID, opaqueData) => { + let tooManyPings = false; + /* See the last paragraph of + * https://github.com/grpc/proposal/blob/master/A8-client-side-keepalive.md#basic-keepalive */ + if (errorCode === http2.constants.NGHTTP2_ENHANCE_YOUR_CALM && + opaqueData && + opaqueData.equals(tooManyPingsData)) { + tooManyPings = true; + } + this.trace('connection closed by GOAWAY with code ' + + errorCode + + ' and data ' + + (opaqueData === null || opaqueData === void 0 ? void 0 : opaqueData.toString())); + this.reportDisconnectToOwner(tooManyPings); + }); + session.once('error', error => { + this.trace('connection closed with error ' + error.message); + this.handleDisconnect(); + }); + session.socket.once('close', (hadError) => { + this.trace('connection closed. hadError=' + hadError); + this.handleDisconnect(); + }); + if (logging.isTracerEnabled(TRACER_NAME)) { + session.on('remoteSettings', (settings) => { + this.trace('new settings received' + + (this.session !== session ? ' on the old connection' : '') + + ': ' + + JSON.stringify(settings)); + }); + session.on('localSettings', (settings) => { + this.trace('local settings acknowledged by remote' + + (this.session !== session ? ' on the old connection' : '') + + ': ' + + JSON.stringify(settings)); + }); + } + /* Start the keepalive timer last, because this can trigger trace logs, + * which should only happen after everything else is set up. */ + if (this.keepaliveWithoutCalls) { + this.maybeStartKeepalivePingTimer(); + } + if (session.socket instanceof tls_1.TLSSocket) { + this.authContext = { + transportSecurityType: 'ssl', + sslPeerCertificate: session.socket.getPeerCertificate() + }; + } + else { + this.authContext = {}; + } + } + getChannelzInfo() { + var _a, _b, _c; + const sessionSocket = this.session.socket; + const remoteAddress = sessionSocket.remoteAddress + ? (0, subchannel_address_1.stringToSubchannelAddress)(sessionSocket.remoteAddress, sessionSocket.remotePort) + : null; + const localAddress = sessionSocket.localAddress + ? (0, subchannel_address_1.stringToSubchannelAddress)(sessionSocket.localAddress, sessionSocket.localPort) + : null; + let tlsInfo; + if (this.session.encrypted) { + const tlsSocket = sessionSocket; + const cipherInfo = tlsSocket.getCipher(); + const certificate = tlsSocket.getCertificate(); + const peerCertificate = tlsSocket.getPeerCertificate(); + tlsInfo = { + cipherSuiteStandardName: (_a = cipherInfo.standardName) !== null && _a !== void 0 ? _a : null, + cipherSuiteOtherName: cipherInfo.standardName ? null : cipherInfo.name, + localCertificate: certificate && 'raw' in certificate ? certificate.raw : null, + remoteCertificate: peerCertificate && 'raw' in peerCertificate + ? peerCertificate.raw + : null, + }; + } + else { + tlsInfo = null; + } + const socketInfo = { + remoteAddress: remoteAddress, + localAddress: localAddress, + security: tlsInfo, + remoteName: this.remoteName, + streamsStarted: this.streamTracker.callsStarted, + streamsSucceeded: this.streamTracker.callsSucceeded, + streamsFailed: this.streamTracker.callsFailed, + messagesSent: this.messagesSent, + messagesReceived: this.messagesReceived, + keepAlivesSent: this.keepalivesSent, + lastLocalStreamCreatedTimestamp: this.streamTracker.lastCallStartedTimestamp, + lastRemoteStreamCreatedTimestamp: null, + lastMessageSentTimestamp: this.lastMessageSentTimestamp, + lastMessageReceivedTimestamp: this.lastMessageReceivedTimestamp, + localFlowControlWindow: (_b = this.session.state.localWindowSize) !== null && _b !== void 0 ? _b : null, + remoteFlowControlWindow: (_c = this.session.state.remoteWindowSize) !== null && _c !== void 0 ? _c : null, + }; + return socketInfo; + } + trace(text) { + logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, '(' + + this.channelzRef.id + + ') ' + + this.subchannelAddressString + + ' ' + + text); + } + keepaliveTrace(text) { + logging.trace(constants_1.LogVerbosity.DEBUG, 'keepalive', '(' + + this.channelzRef.id + + ') ' + + this.subchannelAddressString + + ' ' + + text); + } + flowControlTrace(text) { + logging.trace(constants_1.LogVerbosity.DEBUG, FLOW_CONTROL_TRACER_NAME, '(' + + this.channelzRef.id + + ') ' + + this.subchannelAddressString + + ' ' + + text); + } + internalsTrace(text) { + logging.trace(constants_1.LogVerbosity.DEBUG, 'transport_internals', '(' + + this.channelzRef.id + + ') ' + + this.subchannelAddressString + + ' ' + + text); + } + /** + * Indicate to the owner of this object that this transport should no longer + * be used. That happens if the connection drops, or if the server sends a + * GOAWAY. + * @param tooManyPings If true, this was triggered by a GOAWAY with data + * indicating that the session was closed becaues the client sent too many + * pings. + * @returns + */ + reportDisconnectToOwner(tooManyPings) { + if (this.disconnectHandled) { + return; + } + this.disconnectHandled = true; + this.disconnectListeners.forEach(listener => listener(tooManyPings)); + } + /** + * Handle connection drops, but not GOAWAYs. + */ + handleDisconnect() { + this.clearKeepaliveTimeout(); + this.reportDisconnectToOwner(false); + for (const call of this.activeCalls) { + call.onDisconnect(); + } + // Wait an event loop cycle before destroying the connection + setImmediate(() => { + this.session.destroy(); + }); + } + addDisconnectListener(listener) { + this.disconnectListeners.push(listener); + } + canSendPing() { + return (!this.session.destroyed && + this.keepaliveTimeMs > 0 && + (this.keepaliveWithoutCalls || this.activeCalls.size > 0)); + } + maybeSendPing() { + var _a, _b; + if (!this.canSendPing()) { + this.pendingSendKeepalivePing = true; + return; + } + if (this.keepaliveTimer) { + console.error('keepaliveTimeout is not null'); + return; + } + if (this.channelzEnabled) { + this.keepalivesSent += 1; + } + this.keepaliveTrace('Sending ping with timeout ' + this.keepaliveTimeoutMs + 'ms'); + this.keepaliveTimer = setTimeout(() => { + this.keepaliveTimer = null; + this.keepaliveTrace('Ping timeout passed without response'); + this.handleDisconnect(); + }, this.keepaliveTimeoutMs); + (_b = (_a = this.keepaliveTimer).unref) === null || _b === void 0 ? void 0 : _b.call(_a); + let pingSendError = ''; + try { + const pingSentSuccessfully = this.session.ping((err, duration, payload) => { + this.clearKeepaliveTimeout(); + if (err) { + this.keepaliveTrace('Ping failed with error ' + err.message); + this.handleDisconnect(); + } + else { + this.keepaliveTrace('Received ping response'); + this.maybeStartKeepalivePingTimer(); + } + }); + if (!pingSentSuccessfully) { + pingSendError = 'Ping returned false'; + } + } + catch (e) { + // grpc/grpc-node#2139 + pingSendError = (e instanceof Error ? e.message : '') || 'Unknown error'; + } + if (pingSendError) { + this.keepaliveTrace('Ping send failed: ' + pingSendError); + this.handleDisconnect(); + } + } + /** + * Starts the keepalive ping timer if appropriate. If the timer already ran + * out while there were no active requests, instead send a ping immediately. + * If the ping timer is already running or a ping is currently in flight, + * instead do nothing and wait for them to resolve. + */ + maybeStartKeepalivePingTimer() { + var _a, _b; + if (!this.canSendPing()) { + return; + } + if (this.pendingSendKeepalivePing) { + this.pendingSendKeepalivePing = false; + this.maybeSendPing(); + } + else if (!this.keepaliveTimer) { + this.keepaliveTrace('Starting keepalive timer for ' + this.keepaliveTimeMs + 'ms'); + this.keepaliveTimer = setTimeout(() => { + this.keepaliveTimer = null; + this.maybeSendPing(); + }, this.keepaliveTimeMs); + (_b = (_a = this.keepaliveTimer).unref) === null || _b === void 0 ? void 0 : _b.call(_a); + } + /* Otherwise, there is already either a keepalive timer or a ping pending, + * wait for those to resolve. */ + } + /** + * Clears whichever keepalive timeout is currently active, if any. + */ + clearKeepaliveTimeout() { + if (this.keepaliveTimer) { + clearTimeout(this.keepaliveTimer); + this.keepaliveTimer = null; + } + } + removeActiveCall(call) { + this.activeCalls.delete(call); + if (this.activeCalls.size === 0) { + this.session.unref(); + } + } + addActiveCall(call) { + this.activeCalls.add(call); + if (this.activeCalls.size === 1) { + this.session.ref(); + if (!this.keepaliveWithoutCalls) { + this.maybeStartKeepalivePingTimer(); + } + } + } + createCall(metadata, host, method, listener, subchannelCallStatsTracker) { + const headers = metadata.toHttp2Headers(); + headers[HTTP2_HEADER_AUTHORITY] = host; + headers[HTTP2_HEADER_USER_AGENT] = this.userAgent; + headers[HTTP2_HEADER_CONTENT_TYPE] = 'application/grpc'; + headers[HTTP2_HEADER_METHOD] = 'POST'; + headers[HTTP2_HEADER_PATH] = method; + headers[HTTP2_HEADER_TE] = 'trailers'; + let http2Stream; + /* In theory, if an error is thrown by session.request because session has + * become unusable (e.g. because it has received a goaway), this subchannel + * should soon see the corresponding close or goaway event anyway and leave + * READY. But we have seen reports that this does not happen + * (https://github.com/googleapis/nodejs-firestore/issues/1023#issuecomment-653204096) + * so for defense in depth, we just discard the session when we see an + * error here. + */ + try { + http2Stream = this.session.request(headers); + } + catch (e) { + this.handleDisconnect(); + throw e; + } + this.flowControlTrace('local window size: ' + + this.session.state.localWindowSize + + ' remote window size: ' + + this.session.state.remoteWindowSize); + this.internalsTrace('session.closed=' + + this.session.closed + + ' session.destroyed=' + + this.session.destroyed + + ' session.socket.destroyed=' + + this.session.socket.destroyed); + let eventTracker; + // eslint-disable-next-line prefer-const + let call; + if (this.channelzEnabled) { + this.streamTracker.addCallStarted(); + eventTracker = { + addMessageSent: () => { + var _a; + this.messagesSent += 1; + this.lastMessageSentTimestamp = new Date(); + (_a = subchannelCallStatsTracker.addMessageSent) === null || _a === void 0 ? void 0 : _a.call(subchannelCallStatsTracker); + }, + addMessageReceived: () => { + var _a; + this.messagesReceived += 1; + this.lastMessageReceivedTimestamp = new Date(); + (_a = subchannelCallStatsTracker.addMessageReceived) === null || _a === void 0 ? void 0 : _a.call(subchannelCallStatsTracker); + }, + onCallEnd: status => { + var _a; + (_a = subchannelCallStatsTracker.onCallEnd) === null || _a === void 0 ? void 0 : _a.call(subchannelCallStatsTracker, status); + this.removeActiveCall(call); + }, + onStreamEnd: success => { + var _a; + if (success) { + this.streamTracker.addCallSucceeded(); + } + else { + this.streamTracker.addCallFailed(); + } + (_a = subchannelCallStatsTracker.onStreamEnd) === null || _a === void 0 ? void 0 : _a.call(subchannelCallStatsTracker, success); + }, + }; + } + else { + eventTracker = { + addMessageSent: () => { + var _a; + (_a = subchannelCallStatsTracker.addMessageSent) === null || _a === void 0 ? void 0 : _a.call(subchannelCallStatsTracker); + }, + addMessageReceived: () => { + var _a; + (_a = subchannelCallStatsTracker.addMessageReceived) === null || _a === void 0 ? void 0 : _a.call(subchannelCallStatsTracker); + }, + onCallEnd: status => { + var _a; + (_a = subchannelCallStatsTracker.onCallEnd) === null || _a === void 0 ? void 0 : _a.call(subchannelCallStatsTracker, status); + this.removeActiveCall(call); + }, + onStreamEnd: success => { + var _a; + (_a = subchannelCallStatsTracker.onStreamEnd) === null || _a === void 0 ? void 0 : _a.call(subchannelCallStatsTracker, success); + }, + }; + } + call = new subchannel_call_1.Http2SubchannelCall(http2Stream, eventTracker, listener, this, (0, call_number_1.getNextCallNumber)()); + this.addActiveCall(call); + return call; + } + getChannelzRef() { + return this.channelzRef; + } + getPeerName() { + return this.subchannelAddressString; + } + getOptions() { + return this.options; + } + getAuthContext() { + return this.authContext; + } + shutdown() { + this.session.close(); + (0, channelz_1.unregisterChannelzRef)(this.channelzRef); + } +} +class Http2SubchannelConnector { + constructor(channelTarget) { + this.channelTarget = channelTarget; + this.session = null; + this.isShutdown = false; + } + trace(text) { + logging.trace(constants_1.LogVerbosity.DEBUG, TRACER_NAME, (0, uri_parser_1.uriToString)(this.channelTarget) + ' ' + text); + } + createSession(secureConnectResult, address, options) { + if (this.isShutdown) { + return Promise.reject(); + } + if (secureConnectResult.socket.closed) { + return Promise.reject('Connection closed before starting HTTP/2 handshake'); + } + return new Promise((resolve, reject) => { + var _a, _b, _c, _d, _e, _f, _g; + let remoteName = null; + let realTarget = this.channelTarget; + if ('grpc.http_connect_target' in options) { + const parsedTarget = (0, uri_parser_1.parseUri)(options['grpc.http_connect_target']); + if (parsedTarget) { + realTarget = parsedTarget; + remoteName = (0, uri_parser_1.uriToString)(parsedTarget); + } + } + const scheme = secureConnectResult.secure ? 'https' : 'http'; + const targetPath = (0, resolver_1.getDefaultAuthority)(realTarget); + const closeHandler = () => { + var _a; + (_a = this.session) === null || _a === void 0 ? void 0 : _a.destroy(); + this.session = null; + // Leave time for error event to happen before rejecting + setImmediate(() => { + if (!reportedError) { + reportedError = true; + reject(`${errorMessage.trim()} (${new Date().toISOString()})`); + } + }); + }; + const errorHandler = (error) => { + var _a; + (_a = this.session) === null || _a === void 0 ? void 0 : _a.destroy(); + errorMessage = error.message; + this.trace('connection failed with error ' + errorMessage); + if (!reportedError) { + reportedError = true; + reject(`${errorMessage} (${new Date().toISOString()})`); + } + }; + const sessionOptions = { + createConnection: (authority, option) => { + return secureConnectResult.socket; + }, + settings: { + initialWindowSize: (_d = (_a = options['grpc-node.flow_control_window']) !== null && _a !== void 0 ? _a : (_c = (_b = http2.getDefaultSettings) === null || _b === void 0 ? void 0 : _b.call(http2)) === null || _c === void 0 ? void 0 : _c.initialWindowSize) !== null && _d !== void 0 ? _d : 65535, + } + }; + const session = http2.connect(`${scheme}://${targetPath}`, sessionOptions); + // Prepare window size configuration for remoteSettings handler + const defaultWin = (_g = (_f = (_e = http2.getDefaultSettings) === null || _e === void 0 ? void 0 : _e.call(http2)) === null || _f === void 0 ? void 0 : _f.initialWindowSize) !== null && _g !== void 0 ? _g : 65535; // 65 535 B + const connWin = options['grpc-node.flow_control_window']; + this.session = session; + let errorMessage = 'Failed to connect'; + let reportedError = false; + session.unref(); + session.once('remoteSettings', () => { + var _a; + // Send WINDOW_UPDATE now to avoid 65 KB start-window stall. + if (connWin && connWin > defaultWin) { + try { + // Node â‰Ĩ 14.18 + session.setLocalWindowSize(connWin); + } + catch (_b) { + // Older Node: bump by the delta + const delta = connWin - ((_a = session.state.localWindowSize) !== null && _a !== void 0 ? _a : defaultWin); + if (delta > 0) + session.incrementWindowSize(delta); + } + } + session.removeAllListeners(); + secureConnectResult.socket.removeListener('close', closeHandler); + secureConnectResult.socket.removeListener('error', errorHandler); + resolve(new Http2Transport(session, address, options, remoteName)); + this.session = null; + }); + session.once('close', closeHandler); + session.once('error', errorHandler); + secureConnectResult.socket.once('close', closeHandler); + secureConnectResult.socket.once('error', errorHandler); + }); + } + tcpConnect(address, options) { + return (0, http_proxy_1.getProxiedConnection)(address, options).then(proxiedSocket => { + if (proxiedSocket) { + return proxiedSocket; + } + else { + return new Promise((resolve, reject) => { + const closeCallback = () => { + reject(new Error('Socket closed')); + }; + const errorCallback = (error) => { + reject(error); + }; + const socket = net.connect(address, () => { + socket.removeListener('close', closeCallback); + socket.removeListener('error', errorCallback); + resolve(socket); + }); + socket.once('close', closeCallback); + socket.once('error', errorCallback); + }); + } + }); + } + async connect(address, secureConnector, options) { + if (this.isShutdown) { + return Promise.reject(); + } + let tcpConnection = null; + let secureConnectResult = null; + const addressString = (0, subchannel_address_1.subchannelAddressToString)(address); + try { + this.trace(addressString + ' Waiting for secureConnector to be ready'); + await secureConnector.waitForReady(); + this.trace(addressString + ' secureConnector is ready'); + tcpConnection = await this.tcpConnect(address, options); + tcpConnection.setNoDelay(); + this.trace(addressString + ' Established TCP connection'); + secureConnectResult = await secureConnector.connect(tcpConnection); + this.trace(addressString + ' Established secure connection'); + return this.createSession(secureConnectResult, address, options); + } + catch (e) { + tcpConnection === null || tcpConnection === void 0 ? void 0 : tcpConnection.destroy(); + secureConnectResult === null || secureConnectResult === void 0 ? void 0 : secureConnectResult.socket.destroy(); + throw e; + } + } + shutdown() { + var _a; + this.isShutdown = true; + (_a = this.session) === null || _a === void 0 ? void 0 : _a.close(); + this.session = null; + } +} +exports.Http2SubchannelConnector = Http2SubchannelConnector; +//# sourceMappingURL=transport.js.map + +/***/ }), + +/***/ 56027: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright 2020 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.parseUri = parseUri; +exports.splitHostPort = splitHostPort; +exports.combineHostPort = combineHostPort; +exports.uriToString = uriToString; +/* + * The groups correspond to URI parts as follows: + * 1. scheme + * 2. authority + * 3. path + */ +const URI_REGEX = /^(?:([A-Za-z0-9+.-]+):)?(?:\/\/([^/]*)\/)?(.+)$/; +function parseUri(uriString) { + const parsedUri = URI_REGEX.exec(uriString); + if (parsedUri === null) { + return null; + } + return { + scheme: parsedUri[1], + authority: parsedUri[2], + path: parsedUri[3], + }; +} +const NUMBER_REGEX = /^\d+$/; +function splitHostPort(path) { + if (path.startsWith('[')) { + const hostEnd = path.indexOf(']'); + if (hostEnd === -1) { + return null; + } + const host = path.substring(1, hostEnd); + /* Only an IPv6 address should be in bracketed notation, and an IPv6 + * address should have at least one colon */ + if (host.indexOf(':') === -1) { + return null; + } + if (path.length > hostEnd + 1) { + if (path[hostEnd + 1] === ':') { + const portString = path.substring(hostEnd + 2); + if (NUMBER_REGEX.test(portString)) { + return { + host: host, + port: +portString, + }; + } + else { + return null; + } + } + else { + return null; + } + } + else { + return { + host, + }; + } + } + else { + const splitPath = path.split(':'); + /* Exactly one colon means that this is host:port. Zero colons means that + * there is no port. And multiple colons means that this is a bare IPv6 + * address with no port */ + if (splitPath.length === 2) { + if (NUMBER_REGEX.test(splitPath[1])) { + return { + host: splitPath[0], + port: +splitPath[1], + }; + } + else { + return null; + } + } + else { + return { + host: path, + }; + } + } +} +function combineHostPort(hostPort) { + if (hostPort.port === undefined) { + return hostPort.host; + } + else { + // Only an IPv6 host should include a colon + if (hostPort.host.includes(':')) { + return `[${hostPort.host}]:${hostPort.port}`; + } + else { + return `${hostPort.host}:${hostPort.port}`; + } + } +} +function uriToString(uri) { + let result = ''; + if (uri.scheme !== undefined) { + result += uri.scheme + ':'; + } + if (uri.authority !== undefined) { + result += '//' + uri.authority + '/'; + } + result += uri.path; + return result; +} +//# sourceMappingURL=uri-parser.js.map + +/***/ }), + +/***/ 73066: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; +var __webpack_unused_export__; + +/** + * @license + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +__webpack_unused_export__ = ({ value: true }); +__webpack_unused_export__ = __webpack_unused_export__ = __webpack_unused_export__ = exports.Yi = __webpack_unused_export__ = exports.Ib = __webpack_unused_export__ = __webpack_unused_export__ = void 0; +const camelCase = __nccwpck_require__(14277); +const Protobuf = __nccwpck_require__(23928); +const descriptor = __nccwpck_require__(6412); +const util_1 = __nccwpck_require__(25972); +const Long = __nccwpck_require__(66390); +__webpack_unused_export__ = Long; +function isAnyExtension(obj) { + return ('@type' in obj) && (typeof obj['@type'] === 'string'); +} +__webpack_unused_export__ = isAnyExtension; +var IdempotencyLevel; +(function (IdempotencyLevel) { + IdempotencyLevel["IDEMPOTENCY_UNKNOWN"] = "IDEMPOTENCY_UNKNOWN"; + IdempotencyLevel["NO_SIDE_EFFECTS"] = "NO_SIDE_EFFECTS"; + IdempotencyLevel["IDEMPOTENT"] = "IDEMPOTENT"; +})(IdempotencyLevel = exports.Ib || (exports.Ib = {})); +const descriptorOptions = { + longs: String, + enums: String, + bytes: String, + defaults: true, + oneofs: true, + json: true, +}; +function joinName(baseName, name) { + if (baseName === '') { + return name; + } + else { + return baseName + '.' + name; + } +} +function isHandledReflectionObject(obj) { + return (obj instanceof Protobuf.Service || + obj instanceof Protobuf.Type || + obj instanceof Protobuf.Enum); +} +function isNamespaceBase(obj) { + return obj instanceof Protobuf.Namespace || obj instanceof Protobuf.Root; +} +function getAllHandledReflectionObjects(obj, parentName) { + const objName = joinName(parentName, obj.name); + if (isHandledReflectionObject(obj)) { + return [[objName, obj]]; + } + else { + if (isNamespaceBase(obj) && typeof obj.nested !== 'undefined') { + return Object.keys(obj.nested) + .map(name => { + return getAllHandledReflectionObjects(obj.nested[name], objName); + }) + .reduce((accumulator, currentValue) => accumulator.concat(currentValue), []); + } + } + return []; +} +function createDeserializer(cls, options) { + return function deserialize(argBuf) { + return cls.toObject(cls.decode(argBuf), options); + }; +} +function createSerializer(cls) { + return function serialize(arg) { + if (Array.isArray(arg)) { + throw new Error(`Failed to serialize message: expected object with ${cls.name} structure, got array instead`); + } + const message = cls.fromObject(arg); + return cls.encode(message).finish(); + }; +} +function mapMethodOptions(options) { + return (options || []).reduce((obj, item) => { + for (const [key, value] of Object.entries(item)) { + switch (key) { + case 'uninterpreted_option': + obj.uninterpreted_option.push(item.uninterpreted_option); + break; + default: + obj[key] = value; + } + } + return obj; + }, { + deprecated: false, + idempotency_level: IdempotencyLevel.IDEMPOTENCY_UNKNOWN, + uninterpreted_option: [], + }); +} +function createMethodDefinition(method, serviceName, options, fileDescriptors) { + /* This is only ever called after the corresponding root.resolveAll(), so we + * can assume that the resolved request and response types are non-null */ + const requestType = method.resolvedRequestType; + const responseType = method.resolvedResponseType; + return { + path: '/' + serviceName + '/' + method.name, + requestStream: !!method.requestStream, + responseStream: !!method.responseStream, + requestSerialize: createSerializer(requestType), + requestDeserialize: createDeserializer(requestType, options), + responseSerialize: createSerializer(responseType), + responseDeserialize: createDeserializer(responseType, options), + // TODO(murgatroid99): Find a better way to handle this + originalName: camelCase(method.name), + requestType: createMessageDefinition(requestType, options, fileDescriptors), + responseType: createMessageDefinition(responseType, options, fileDescriptors), + options: mapMethodOptions(method.parsedOptions), + }; +} +function createServiceDefinition(service, name, options, fileDescriptors) { + const def = {}; + for (const method of service.methodsArray) { + def[method.name] = createMethodDefinition(method, name, options, fileDescriptors); + } + return def; +} +function createMessageDefinition(message, options, fileDescriptors) { + const messageDescriptor = message.toDescriptor('proto3'); + return { + format: 'Protocol Buffer 3 DescriptorProto', + type: messageDescriptor.$type.toObject(messageDescriptor, descriptorOptions), + fileDescriptorProtos: fileDescriptors, + serialize: createSerializer(message), + deserialize: createDeserializer(message, options) + }; +} +function createEnumDefinition(enumType, fileDescriptors) { + const enumDescriptor = enumType.toDescriptor('proto3'); + return { + format: 'Protocol Buffer 3 EnumDescriptorProto', + type: enumDescriptor.$type.toObject(enumDescriptor, descriptorOptions), + fileDescriptorProtos: fileDescriptors, + }; +} +/** + * function createDefinition(obj: Protobuf.Service, name: string, options: + * Options): ServiceDefinition; function createDefinition(obj: Protobuf.Type, + * name: string, options: Options): MessageTypeDefinition; function + * createDefinition(obj: Protobuf.Enum, name: string, options: Options): + * EnumTypeDefinition; + */ +function createDefinition(obj, name, options, fileDescriptors) { + if (obj instanceof Protobuf.Service) { + return createServiceDefinition(obj, name, options, fileDescriptors); + } + else if (obj instanceof Protobuf.Type) { + return createMessageDefinition(obj, options, fileDescriptors); + } + else if (obj instanceof Protobuf.Enum) { + return createEnumDefinition(obj, fileDescriptors); + } + else { + throw new Error('Type mismatch in reflection object handling'); + } +} +function createPackageDefinition(root, options) { + const def = {}; + root.resolveAll(); + const descriptorList = root.toDescriptor('proto3').file; + const bufferList = descriptorList.map(value => Buffer.from(descriptor.FileDescriptorProto.encode(value).finish())); + for (const [name, obj] of getAllHandledReflectionObjects(root, '')) { + def[name] = createDefinition(obj, name, options, bufferList); + } + return def; +} +function createPackageDefinitionFromDescriptorSet(decodedDescriptorSet, options) { + options = options || {}; + const root = Protobuf.Root.fromDescriptor(decodedDescriptorSet); + root.resolveAll(); + return createPackageDefinition(root, options); +} +/** + * Load a .proto file with the specified options. + * @param filename One or multiple file paths to load. Can be an absolute path + * or relative to an include path. + * @param options.keepCase Preserve field names. The default is to change them + * to camel case. + * @param options.longs The type that should be used to represent `long` values. + * Valid options are `Number` and `String`. Defaults to a `Long` object type + * from a library. + * @param options.enums The type that should be used to represent `enum` values. + * The only valid option is `String`. Defaults to the numeric value. + * @param options.bytes The type that should be used to represent `bytes` + * values. Valid options are `Array` and `String`. The default is to use + * `Buffer`. + * @param options.defaults Set default values on output objects. Defaults to + * `false`. + * @param options.arrays Set empty arrays for missing array values even if + * `defaults` is `false`. Defaults to `false`. + * @param options.objects Set empty objects for missing object values even if + * `defaults` is `false`. Defaults to `false`. + * @param options.oneofs Set virtual oneof properties to the present field's + * name + * @param options.json Represent Infinity and NaN as strings in float fields, + * and automatically decode google.protobuf.Any values. + * @param options.includeDirs Paths to search for imported `.proto` files. + */ +function load(filename, options) { + return (0, util_1.loadProtosWithOptions)(filename, options).then(loadedRoot => { + return createPackageDefinition(loadedRoot, options); + }); +} +__webpack_unused_export__ = load; +function loadSync(filename, options) { + const loadedRoot = (0, util_1.loadProtosWithOptionsSync)(filename, options); + return createPackageDefinition(loadedRoot, options); +} +exports.Yi = loadSync; +function fromJSON(json, options) { + options = options || {}; + const loadedRoot = Protobuf.Root.fromJSON(json); + loadedRoot.resolveAll(); + return createPackageDefinition(loadedRoot, options); +} +__webpack_unused_export__ = fromJSON; +function loadFileDescriptorSetFromBuffer(descriptorSet, options) { + const decodedDescriptorSet = descriptor.FileDescriptorSet.decode(descriptorSet); + return createPackageDefinitionFromDescriptorSet(decodedDescriptorSet, options); +} +__webpack_unused_export__ = loadFileDescriptorSetFromBuffer; +function loadFileDescriptorSetFromObject(descriptorSet, options) { + const decodedDescriptorSet = descriptor.FileDescriptorSet.fromObject(descriptorSet); + return createPackageDefinitionFromDescriptorSet(decodedDescriptorSet, options); +} +__webpack_unused_export__ = loadFileDescriptorSetFromObject; +(0, util_1.addCommonProtos)(); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 25972: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/** + * @license + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.addCommonProtos = exports.loadProtosWithOptionsSync = exports.loadProtosWithOptions = void 0; +const fs = __nccwpck_require__(79896); +const path = __nccwpck_require__(16928); +const Protobuf = __nccwpck_require__(23928); +function addIncludePathResolver(root, includePaths) { + const originalResolvePath = root.resolvePath; + root.resolvePath = (origin, target) => { + if (path.isAbsolute(target)) { + return target; + } + for (const directory of includePaths) { + const fullPath = path.join(directory, target); + try { + fs.accessSync(fullPath, fs.constants.R_OK); + return fullPath; + } + catch (err) { + continue; + } + } + process.emitWarning(`${target} not found in any of the include paths ${includePaths}`); + return originalResolvePath(origin, target); + }; +} +async function loadProtosWithOptions(filename, options) { + const root = new Protobuf.Root(); + options = options || {}; + if (!!options.includeDirs) { + if (!Array.isArray(options.includeDirs)) { + return Promise.reject(new Error('The includeDirs option must be an array')); + } + addIncludePathResolver(root, options.includeDirs); + } + const loadedRoot = await root.load(filename, options); + loadedRoot.resolveAll(); + return loadedRoot; +} +exports.loadProtosWithOptions = loadProtosWithOptions; +function loadProtosWithOptionsSync(filename, options) { + const root = new Protobuf.Root(); + options = options || {}; + if (!!options.includeDirs) { + if (!Array.isArray(options.includeDirs)) { + throw new Error('The includeDirs option must be an array'); + } + addIncludePathResolver(root, options.includeDirs); + } + const loadedRoot = root.loadSync(filename, options); + loadedRoot.resolveAll(); + return loadedRoot; +} +exports.loadProtosWithOptionsSync = loadProtosWithOptionsSync; +/** + * Load Google's well-known proto files that aren't exposed by Protobuf.js. + */ +function addCommonProtos() { + // Protobuf.js exposes: any, duration, empty, field_mask, struct, timestamp, + // and wrappers. compiler/plugin is excluded in Protobuf.js and here. + // Using constant strings for compatibility with tools like Webpack + const apiDescriptor = __nccwpck_require__(15434); + const descriptorDescriptor = __nccwpck_require__(93951); + const sourceContextDescriptor = __nccwpck_require__(92939); + const typeDescriptor = __nccwpck_require__(36710); + Protobuf.common('api', apiDescriptor.nested.google.nested.protobuf.nested); + Protobuf.common('descriptor', descriptorDescriptor.nested.google.nested.protobuf.nested); + Protobuf.common('source_context', sourceContextDescriptor.nested.google.nested.protobuf.nested); + Protobuf.common('type', typeDescriptor.nested.google.nested.protobuf.nested); +} +exports.addCommonProtos = addCommonProtos; +//# sourceMappingURL=util.js.map + +/***/ }), + +/***/ 76081: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/** + * @license + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.loadFileDescriptorSetFromObject = exports.loadFileDescriptorSetFromBuffer = exports.fromJSON = exports.loadSync = exports.load = exports.IdempotencyLevel = exports.isAnyExtension = exports.Long = void 0; +const camelCase = __nccwpck_require__(14277); +const Protobuf = __nccwpck_require__(23928); +const descriptor = __nccwpck_require__(6412); +const util_1 = __nccwpck_require__(48057); +const Long = __nccwpck_require__(66390); +exports.Long = Long; +function isAnyExtension(obj) { + return ('@type' in obj) && (typeof obj['@type'] === 'string'); +} +exports.isAnyExtension = isAnyExtension; +var IdempotencyLevel; +(function (IdempotencyLevel) { + IdempotencyLevel["IDEMPOTENCY_UNKNOWN"] = "IDEMPOTENCY_UNKNOWN"; + IdempotencyLevel["NO_SIDE_EFFECTS"] = "NO_SIDE_EFFECTS"; + IdempotencyLevel["IDEMPOTENT"] = "IDEMPOTENT"; +})(IdempotencyLevel = exports.IdempotencyLevel || (exports.IdempotencyLevel = {})); +const descriptorOptions = { + longs: String, + enums: String, + bytes: String, + defaults: true, + oneofs: true, + json: true, +}; +function joinName(baseName, name) { + if (baseName === '') { + return name; + } + else { + return baseName + '.' + name; + } +} +function isHandledReflectionObject(obj) { + return (obj instanceof Protobuf.Service || + obj instanceof Protobuf.Type || + obj instanceof Protobuf.Enum); +} +function isNamespaceBase(obj) { + return obj instanceof Protobuf.Namespace || obj instanceof Protobuf.Root; +} +function getAllHandledReflectionObjects(obj, parentName) { + const objName = joinName(parentName, obj.name); + if (isHandledReflectionObject(obj)) { + return [[objName, obj]]; + } + else { + if (isNamespaceBase(obj) && typeof obj.nested !== 'undefined') { + return Object.keys(obj.nested) + .map(name => { + return getAllHandledReflectionObjects(obj.nested[name], objName); + }) + .reduce((accumulator, currentValue) => accumulator.concat(currentValue), []); + } + } + return []; +} +function createDeserializer(cls, options) { + return function deserialize(argBuf) { + return cls.toObject(cls.decode(argBuf), options); + }; +} +function createSerializer(cls) { + return function serialize(arg) { + if (Array.isArray(arg)) { + throw new Error(`Failed to serialize message: expected object with ${cls.name} structure, got array instead`); + } + const message = cls.fromObject(arg); + return cls.encode(message).finish(); + }; +} +function mapMethodOptions(options) { + return (options || []).reduce((obj, item) => { + for (const [key, value] of Object.entries(item)) { + switch (key) { + case 'uninterpreted_option': + obj.uninterpreted_option.push(item.uninterpreted_option); + break; + default: + obj[key] = value; + } + } + return obj; + }, { + deprecated: false, + idempotency_level: IdempotencyLevel.IDEMPOTENCY_UNKNOWN, + uninterpreted_option: [], + }); +} +function createMethodDefinition(method, serviceName, options, fileDescriptors) { + /* This is only ever called after the corresponding root.resolveAll(), so we + * can assume that the resolved request and response types are non-null */ + const requestType = method.resolvedRequestType; + const responseType = method.resolvedResponseType; + return { + path: '/' + serviceName + '/' + method.name, + requestStream: !!method.requestStream, + responseStream: !!method.responseStream, + requestSerialize: createSerializer(requestType), + requestDeserialize: createDeserializer(requestType, options), + responseSerialize: createSerializer(responseType), + responseDeserialize: createDeserializer(responseType, options), + // TODO(murgatroid99): Find a better way to handle this + originalName: camelCase(method.name), + requestType: createMessageDefinition(requestType, fileDescriptors), + responseType: createMessageDefinition(responseType, fileDescriptors), + options: mapMethodOptions(method.parsedOptions), + }; +} +function createServiceDefinition(service, name, options, fileDescriptors) { + const def = {}; + for (const method of service.methodsArray) { + def[method.name] = createMethodDefinition(method, name, options, fileDescriptors); + } + return def; +} +function createMessageDefinition(message, fileDescriptors) { + const messageDescriptor = message.toDescriptor('proto3'); + return { + format: 'Protocol Buffer 3 DescriptorProto', + type: messageDescriptor.$type.toObject(messageDescriptor, descriptorOptions), + fileDescriptorProtos: fileDescriptors, + }; +} +function createEnumDefinition(enumType, fileDescriptors) { + const enumDescriptor = enumType.toDescriptor('proto3'); + return { + format: 'Protocol Buffer 3 EnumDescriptorProto', + type: enumDescriptor.$type.toObject(enumDescriptor, descriptorOptions), + fileDescriptorProtos: fileDescriptors, + }; +} +/** + * function createDefinition(obj: Protobuf.Service, name: string, options: + * Options): ServiceDefinition; function createDefinition(obj: Protobuf.Type, + * name: string, options: Options): MessageTypeDefinition; function + * createDefinition(obj: Protobuf.Enum, name: string, options: Options): + * EnumTypeDefinition; + */ +function createDefinition(obj, name, options, fileDescriptors) { + if (obj instanceof Protobuf.Service) { + return createServiceDefinition(obj, name, options, fileDescriptors); + } + else if (obj instanceof Protobuf.Type) { + return createMessageDefinition(obj, fileDescriptors); + } + else if (obj instanceof Protobuf.Enum) { + return createEnumDefinition(obj, fileDescriptors); + } + else { + throw new Error('Type mismatch in reflection object handling'); + } +} +function createPackageDefinition(root, options) { + const def = {}; + root.resolveAll(); + const descriptorList = root.toDescriptor('proto3').file; + const bufferList = descriptorList.map(value => Buffer.from(descriptor.FileDescriptorProto.encode(value).finish())); + for (const [name, obj] of getAllHandledReflectionObjects(root, '')) { + def[name] = createDefinition(obj, name, options, bufferList); + } + return def; +} +function createPackageDefinitionFromDescriptorSet(decodedDescriptorSet, options) { + options = options || {}; + const root = Protobuf.Root.fromDescriptor(decodedDescriptorSet); + root.resolveAll(); + return createPackageDefinition(root, options); +} +/** + * Load a .proto file with the specified options. + * @param filename One or multiple file paths to load. Can be an absolute path + * or relative to an include path. + * @param options.keepCase Preserve field names. The default is to change them + * to camel case. + * @param options.longs The type that should be used to represent `long` values. + * Valid options are `Number` and `String`. Defaults to a `Long` object type + * from a library. + * @param options.enums The type that should be used to represent `enum` values. + * The only valid option is `String`. Defaults to the numeric value. + * @param options.bytes The type that should be used to represent `bytes` + * values. Valid options are `Array` and `String`. The default is to use + * `Buffer`. + * @param options.defaults Set default values on output objects. Defaults to + * `false`. + * @param options.arrays Set empty arrays for missing array values even if + * `defaults` is `false`. Defaults to `false`. + * @param options.objects Set empty objects for missing object values even if + * `defaults` is `false`. Defaults to `false`. + * @param options.oneofs Set virtual oneof properties to the present field's + * name + * @param options.json Represent Infinity and NaN as strings in float fields, + * and automatically decode google.protobuf.Any values. + * @param options.includeDirs Paths to search for imported `.proto` files. + */ +function load(filename, options) { + return (0, util_1.loadProtosWithOptions)(filename, options).then(loadedRoot => { + return createPackageDefinition(loadedRoot, options); + }); +} +exports.load = load; +function loadSync(filename, options) { + const loadedRoot = (0, util_1.loadProtosWithOptionsSync)(filename, options); + return createPackageDefinition(loadedRoot, options); +} +exports.loadSync = loadSync; +function fromJSON(json, options) { + options = options || {}; + const loadedRoot = Protobuf.Root.fromJSON(json); + loadedRoot.resolveAll(); + return createPackageDefinition(loadedRoot, options); +} +exports.fromJSON = fromJSON; +function loadFileDescriptorSetFromBuffer(descriptorSet, options) { + const decodedDescriptorSet = descriptor.FileDescriptorSet.decode(descriptorSet); + return createPackageDefinitionFromDescriptorSet(decodedDescriptorSet, options); +} +exports.loadFileDescriptorSetFromBuffer = loadFileDescriptorSetFromBuffer; +function loadFileDescriptorSetFromObject(descriptorSet, options) { + const decodedDescriptorSet = descriptor.FileDescriptorSet.fromObject(descriptorSet); + return createPackageDefinitionFromDescriptorSet(decodedDescriptorSet, options); +} +exports.loadFileDescriptorSetFromObject = loadFileDescriptorSetFromObject; +(0, util_1.addCommonProtos)(); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 48057: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/** + * @license + * Copyright 2018 gRPC authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.addCommonProtos = exports.loadProtosWithOptionsSync = exports.loadProtosWithOptions = void 0; +const fs = __nccwpck_require__(79896); +const path = __nccwpck_require__(16928); +const Protobuf = __nccwpck_require__(23928); +function addIncludePathResolver(root, includePaths) { + const originalResolvePath = root.resolvePath; + root.resolvePath = (origin, target) => { + if (path.isAbsolute(target)) { + return target; + } + for (const directory of includePaths) { + const fullPath = path.join(directory, target); + try { + fs.accessSync(fullPath, fs.constants.R_OK); + return fullPath; + } + catch (err) { + continue; + } + } + process.emitWarning(`${target} not found in any of the include paths ${includePaths}`); + return originalResolvePath(origin, target); + }; +} +async function loadProtosWithOptions(filename, options) { + const root = new Protobuf.Root(); + options = options || {}; + if (!!options.includeDirs) { + if (!Array.isArray(options.includeDirs)) { + return Promise.reject(new Error('The includeDirs option must be an array')); + } + addIncludePathResolver(root, options.includeDirs); + } + const loadedRoot = await root.load(filename, options); + loadedRoot.resolveAll(); + return loadedRoot; +} +exports.loadProtosWithOptions = loadProtosWithOptions; +function loadProtosWithOptionsSync(filename, options) { + const root = new Protobuf.Root(); + options = options || {}; + if (!!options.includeDirs) { + if (!Array.isArray(options.includeDirs)) { + throw new Error('The includeDirs option must be an array'); + } + addIncludePathResolver(root, options.includeDirs); + } + const loadedRoot = root.loadSync(filename, options); + loadedRoot.resolveAll(); + return loadedRoot; +} +exports.loadProtosWithOptionsSync = loadProtosWithOptionsSync; +/** + * Load Google's well-known proto files that aren't exposed by Protobuf.js. + */ +function addCommonProtos() { + // Protobuf.js exposes: any, duration, empty, field_mask, struct, timestamp, + // and wrappers. compiler/plugin is excluded in Protobuf.js and here. + // Using constant strings for compatibility with tools like Webpack + const apiDescriptor = __nccwpck_require__(15434); + const descriptorDescriptor = __nccwpck_require__(93951); + const sourceContextDescriptor = __nccwpck_require__(92939); + const typeDescriptor = __nccwpck_require__(36710); + Protobuf.common('api', apiDescriptor.nested.google.nested.protobuf.nested); + Protobuf.common('descriptor', descriptorDescriptor.nested.google.nested.protobuf.nested); + Protobuf.common('source_context', sourceContextDescriptor.nested.google.nested.protobuf.nested); + Protobuf.common('type', typeDescriptor.nested.google.nested.protobuf.nested); +} +exports.addCommonProtos = addCommonProtos; +//# sourceMappingURL=util.js.map + +/***/ }), + +/***/ 60137: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "t", ({ + value: true +})); + +class TreeNode { + constructor(t, e, s = 1) { + this.i = undefined; + this.h = undefined; + this.o = undefined; + this.u = t; + this.l = e; + this.p = s; + } + I() { + let t = this; + const e = t.o.o === t; + if (e && t.p === 1) { + t = t.h; + } else if (t.i) { + t = t.i; + while (t.h) { + t = t.h; + } + } else { + if (e) { + return t.o; + } + let s = t.o; + while (s.i === t) { + t = s; + s = t.o; + } + t = s; + } + return t; + } + B() { + let t = this; + if (t.h) { + t = t.h; + while (t.i) { + t = t.i; + } + return t; + } else { + let e = t.o; + while (e.h === t) { + t = e; + e = t.o; + } + if (t.h !== e) { + return e; + } else return t; + } + } + _() { + const t = this.o; + const e = this.h; + const s = e.i; + if (t.o === this) t.o = e; else if (t.i === this) t.i = e; else t.h = e; + e.o = t; + e.i = this; + this.o = e; + this.h = s; + if (s) s.o = this; + return e; + } + g() { + const t = this.o; + const e = this.i; + const s = e.h; + if (t.o === this) t.o = e; else if (t.i === this) t.i = e; else t.h = e; + e.o = t; + e.h = this; + this.o = e; + this.i = s; + if (s) s.o = this; + return e; + } +} + +class TreeNodeEnableIndex extends TreeNode { + constructor() { + super(...arguments); + this.M = 1; + } + _() { + const t = super._(); + this.O(); + t.O(); + return t; + } + g() { + const t = super.g(); + this.O(); + t.O(); + return t; + } + O() { + this.M = 1; + if (this.i) { + this.M += this.i.M; + } + if (this.h) { + this.M += this.h.M; + } + } +} + +class ContainerIterator { + constructor(t = 0) { + this.iteratorType = t; + } + equals(t) { + return this.T === t.T; + } +} + +class Base { + constructor() { + this.m = 0; + } + get length() { + return this.m; + } + size() { + return this.m; + } + empty() { + return this.m === 0; + } +} + +class Container extends Base {} + +function throwIteratorAccessError() { + throw new RangeError("Iterator access denied!"); +} + +class TreeContainer extends Container { + constructor(t = function(t, e) { + if (t < e) return -1; + if (t > e) return 1; + return 0; + }, e = false) { + super(); + this.v = undefined; + this.A = t; + this.enableIndex = e; + this.N = e ? TreeNodeEnableIndex : TreeNode; + this.C = new this.N; + } + R(t, e) { + let s = this.C; + while (t) { + const i = this.A(t.u, e); + if (i < 0) { + t = t.h; + } else if (i > 0) { + s = t; + t = t.i; + } else return t; + } + return s; + } + K(t, e) { + let s = this.C; + while (t) { + const i = this.A(t.u, e); + if (i <= 0) { + t = t.h; + } else { + s = t; + t = t.i; + } + } + return s; + } + L(t, e) { + let s = this.C; + while (t) { + const i = this.A(t.u, e); + if (i < 0) { + s = t; + t = t.h; + } else if (i > 0) { + t = t.i; + } else return t; + } + return s; + } + k(t, e) { + let s = this.C; + while (t) { + const i = this.A(t.u, e); + if (i < 0) { + s = t; + t = t.h; + } else { + t = t.i; + } + } + return s; + } + P(t) { + while (true) { + const e = t.o; + if (e === this.C) return; + if (t.p === 1) { + t.p = 0; + return; + } + if (t === e.i) { + const s = e.h; + if (s.p === 1) { + s.p = 0; + e.p = 1; + if (e === this.v) { + this.v = e._(); + } else e._(); + } else { + if (s.h && s.h.p === 1) { + s.p = e.p; + e.p = 0; + s.h.p = 0; + if (e === this.v) { + this.v = e._(); + } else e._(); + return; + } else if (s.i && s.i.p === 1) { + s.p = 1; + s.i.p = 0; + s.g(); + } else { + s.p = 1; + t = e; + } + } + } else { + const s = e.i; + if (s.p === 1) { + s.p = 0; + e.p = 1; + if (e === this.v) { + this.v = e.g(); + } else e.g(); + } else { + if (s.i && s.i.p === 1) { + s.p = e.p; + e.p = 0; + s.i.p = 0; + if (e === this.v) { + this.v = e.g(); + } else e.g(); + return; + } else if (s.h && s.h.p === 1) { + s.p = 1; + s.h.p = 0; + s._(); + } else { + s.p = 1; + t = e; + } + } + } + } + } + S(t) { + if (this.m === 1) { + this.clear(); + return; + } + let e = t; + while (e.i || e.h) { + if (e.h) { + e = e.h; + while (e.i) e = e.i; + } else { + e = e.i; + } + const s = t.u; + t.u = e.u; + e.u = s; + const i = t.l; + t.l = e.l; + e.l = i; + t = e; + } + if (this.C.i === e) { + this.C.i = e.o; + } else if (this.C.h === e) { + this.C.h = e.o; + } + this.P(e); + let s = e.o; + if (e === s.i) { + s.i = undefined; + } else s.h = undefined; + this.m -= 1; + this.v.p = 0; + if (this.enableIndex) { + while (s !== this.C) { + s.M -= 1; + s = s.o; + } + } + } + U(t) { + const e = typeof t === "number" ? t : undefined; + const s = typeof t === "function" ? t : undefined; + const i = typeof t === "undefined" ? [] : undefined; + let r = 0; + let n = this.v; + const h = []; + while (h.length || n) { + if (n) { + h.push(n); + n = n.i; + } else { + n = h.pop(); + if (r === e) return n; + i && i.push(n); + s && s(n, r, this); + r += 1; + n = n.h; + } + } + return i; + } + j(t) { + while (true) { + const e = t.o; + if (e.p === 0) return; + const s = e.o; + if (e === s.i) { + const i = s.h; + if (i && i.p === 1) { + i.p = e.p = 0; + if (s === this.v) return; + s.p = 1; + t = s; + continue; + } else if (t === e.h) { + t.p = 0; + if (t.i) { + t.i.o = e; + } + if (t.h) { + t.h.o = s; + } + e.h = t.i; + s.i = t.h; + t.i = e; + t.h = s; + if (s === this.v) { + this.v = t; + this.C.o = t; + } else { + const e = s.o; + if (e.i === s) { + e.i = t; + } else e.h = t; + } + t.o = s.o; + e.o = t; + s.o = t; + s.p = 1; + } else { + e.p = 0; + if (s === this.v) { + this.v = s.g(); + } else s.g(); + s.p = 1; + return; + } + } else { + const i = s.i; + if (i && i.p === 1) { + i.p = e.p = 0; + if (s === this.v) return; + s.p = 1; + t = s; + continue; + } else if (t === e.i) { + t.p = 0; + if (t.i) { + t.i.o = s; + } + if (t.h) { + t.h.o = e; + } + s.h = t.i; + e.i = t.h; + t.i = s; + t.h = e; + if (s === this.v) { + this.v = t; + this.C.o = t; + } else { + const e = s.o; + if (e.i === s) { + e.i = t; + } else e.h = t; + } + t.o = s.o; + e.o = t; + s.o = t; + s.p = 1; + } else { + e.p = 0; + if (s === this.v) { + this.v = s._(); + } else s._(); + s.p = 1; + return; + } + } + if (this.enableIndex) { + e.O(); + s.O(); + t.O(); + } + return; + } + } + q(t, e, s) { + if (this.v === undefined) { + this.m += 1; + this.v = new this.N(t, e, 0); + this.v.o = this.C; + this.C.o = this.C.i = this.C.h = this.v; + return this.m; + } + let i; + const r = this.C.i; + const n = this.A(r.u, t); + if (n === 0) { + r.l = e; + return this.m; + } else if (n > 0) { + r.i = new this.N(t, e); + r.i.o = r; + i = r.i; + this.C.i = i; + } else { + const r = this.C.h; + const n = this.A(r.u, t); + if (n === 0) { + r.l = e; + return this.m; + } else if (n < 0) { + r.h = new this.N(t, e); + r.h.o = r; + i = r.h; + this.C.h = i; + } else { + if (s !== undefined) { + const r = s.T; + if (r !== this.C) { + const s = this.A(r.u, t); + if (s === 0) { + r.l = e; + return this.m; + } else if (s > 0) { + const s = r.I(); + const n = this.A(s.u, t); + if (n === 0) { + s.l = e; + return this.m; + } else if (n < 0) { + i = new this.N(t, e); + if (s.h === undefined) { + s.h = i; + i.o = s; + } else { + r.i = i; + i.o = r; + } + } + } + } + } + if (i === undefined) { + i = this.v; + while (true) { + const s = this.A(i.u, t); + if (s > 0) { + if (i.i === undefined) { + i.i = new this.N(t, e); + i.i.o = i; + i = i.i; + break; + } + i = i.i; + } else if (s < 0) { + if (i.h === undefined) { + i.h = new this.N(t, e); + i.h.o = i; + i = i.h; + break; + } + i = i.h; + } else { + i.l = e; + return this.m; + } + } + } + } + } + if (this.enableIndex) { + let t = i.o; + while (t !== this.C) { + t.M += 1; + t = t.o; + } + } + this.j(i); + this.m += 1; + return this.m; + } + H(t, e) { + while (t) { + const s = this.A(t.u, e); + if (s < 0) { + t = t.h; + } else if (s > 0) { + t = t.i; + } else return t; + } + return t || this.C; + } + clear() { + this.m = 0; + this.v = undefined; + this.C.o = undefined; + this.C.i = this.C.h = undefined; + } + updateKeyByIterator(t, e) { + const s = t.T; + if (s === this.C) { + throwIteratorAccessError(); + } + if (this.m === 1) { + s.u = e; + return true; + } + const i = s.B().u; + if (s === this.C.i) { + if (this.A(i, e) > 0) { + s.u = e; + return true; + } + return false; + } + const r = s.I().u; + if (s === this.C.h) { + if (this.A(r, e) < 0) { + s.u = e; + return true; + } + return false; + } + if (this.A(r, e) >= 0 || this.A(i, e) <= 0) return false; + s.u = e; + return true; + } + eraseElementByPos(t) { + if (t < 0 || t > this.m - 1) { + throw new RangeError; + } + const e = this.U(t); + this.S(e); + return this.m; + } + eraseElementByKey(t) { + if (this.m === 0) return false; + const e = this.H(this.v, t); + if (e === this.C) return false; + this.S(e); + return true; + } + eraseElementByIterator(t) { + const e = t.T; + if (e === this.C) { + throwIteratorAccessError(); + } + const s = e.h === undefined; + const i = t.iteratorType === 0; + if (i) { + if (s) t.next(); + } else { + if (!s || e.i === undefined) t.next(); + } + this.S(e); + return t; + } + getHeight() { + if (this.m === 0) return 0; + function traversal(t) { + if (!t) return 0; + return Math.max(traversal(t.i), traversal(t.h)) + 1; + } + return traversal(this.v); + } +} + +class TreeIterator extends ContainerIterator { + constructor(t, e, s) { + super(s); + this.T = t; + this.C = e; + if (this.iteratorType === 0) { + this.pre = function() { + if (this.T === this.C.i) { + throwIteratorAccessError(); + } + this.T = this.T.I(); + return this; + }; + this.next = function() { + if (this.T === this.C) { + throwIteratorAccessError(); + } + this.T = this.T.B(); + return this; + }; + } else { + this.pre = function() { + if (this.T === this.C.h) { + throwIteratorAccessError(); + } + this.T = this.T.B(); + return this; + }; + this.next = function() { + if (this.T === this.C) { + throwIteratorAccessError(); + } + this.T = this.T.I(); + return this; + }; + } + } + get index() { + let t = this.T; + const e = this.C.o; + if (t === this.C) { + if (e) { + return e.M - 1; + } + return 0; + } + let s = 0; + if (t.i) { + s += t.i.M; + } + while (t !== e) { + const e = t.o; + if (t === e.h) { + s += 1; + if (e.i) { + s += e.i.M; + } + } + t = e; + } + return s; + } + isAccessible() { + return this.T !== this.C; + } +} + +class OrderedMapIterator extends TreeIterator { + constructor(t, e, s, i) { + super(t, e, i); + this.container = s; + } + get pointer() { + if (this.T === this.C) { + throwIteratorAccessError(); + } + const t = this; + return new Proxy([], { + get(e, s) { + if (s === "0") return t.T.u; else if (s === "1") return t.T.l; + e[0] = t.T.u; + e[1] = t.T.l; + return e[s]; + }, + set(e, s, i) { + if (s !== "1") { + throw new TypeError("prop must be 1"); + } + t.T.l = i; + return true; + } + }); + } + copy() { + return new OrderedMapIterator(this.T, this.C, this.container, this.iteratorType); + } +} + +class OrderedMap extends TreeContainer { + constructor(t = [], e, s) { + super(e, s); + const i = this; + t.forEach((function(t) { + i.setElement(t[0], t[1]); + })); + } + begin() { + return new OrderedMapIterator(this.C.i || this.C, this.C, this); + } + end() { + return new OrderedMapIterator(this.C, this.C, this); + } + rBegin() { + return new OrderedMapIterator(this.C.h || this.C, this.C, this, 1); + } + rEnd() { + return new OrderedMapIterator(this.C, this.C, this, 1); + } + front() { + if (this.m === 0) return; + const t = this.C.i; + return [ t.u, t.l ]; + } + back() { + if (this.m === 0) return; + const t = this.C.h; + return [ t.u, t.l ]; + } + lowerBound(t) { + const e = this.R(this.v, t); + return new OrderedMapIterator(e, this.C, this); + } + upperBound(t) { + const e = this.K(this.v, t); + return new OrderedMapIterator(e, this.C, this); + } + reverseLowerBound(t) { + const e = this.L(this.v, t); + return new OrderedMapIterator(e, this.C, this); + } + reverseUpperBound(t) { + const e = this.k(this.v, t); + return new OrderedMapIterator(e, this.C, this); + } + forEach(t) { + this.U((function(e, s, i) { + t([ e.u, e.l ], s, i); + })); + } + setElement(t, e, s) { + return this.q(t, e, s); + } + getElementByPos(t) { + if (t < 0 || t > this.m - 1) { + throw new RangeError; + } + const e = this.U(t); + return [ e.u, e.l ]; + } + find(t) { + const e = this.H(this.v, t); + return new OrderedMapIterator(e, this.C, this); + } + getElementByKey(t) { + const e = this.H(this.v, t); + return e.l; + } + union(t) { + const e = this; + t.forEach((function(t) { + e.setElement(t[0], t[1]); + })); + return this.m; + } + * [Symbol.iterator]() { + const t = this.m; + const e = this.U(); + for (let s = 0; s < t; ++s) { + const t = e[s]; + yield [ t.u, t.l ]; + } + } +} + +exports.OrderedMap = OrderedMap; +//# sourceMappingURL=index.js.map + + /***/ }), /***/ 77864: @@ -31110,6 +111288,6686 @@ exports.ViewRegistry = ViewRegistry; /***/ }), +/***/ 32594: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.BasicTracerProvider = exports.ForceFlushState = void 0; +const api_1 = __nccwpck_require__(63914); +const core_1 = __nccwpck_require__(24637); +const resources_1 = __nccwpck_require__(75647); +const Tracer_1 = __nccwpck_require__(56259); +const config_1 = __nccwpck_require__(29884); +const MultiSpanProcessor_1 = __nccwpck_require__(35369); +const NoopSpanProcessor_1 = __nccwpck_require__(44943); +const platform_1 = __nccwpck_require__(58942); +const utility_1 = __nccwpck_require__(29228); +var ForceFlushState; +(function (ForceFlushState) { + ForceFlushState[ForceFlushState["resolved"] = 0] = "resolved"; + ForceFlushState[ForceFlushState["timeout"] = 1] = "timeout"; + ForceFlushState[ForceFlushState["error"] = 2] = "error"; + ForceFlushState[ForceFlushState["unresolved"] = 3] = "unresolved"; +})(ForceFlushState = exports.ForceFlushState || (exports.ForceFlushState = {})); +/** + * This class represents a basic tracer provider which platform libraries can extend + */ +class BasicTracerProvider { + constructor(config = {}) { + var _a, _b; + this._registeredSpanProcessors = []; + this._tracers = new Map(); + const mergedConfig = (0, core_1.merge)({}, (0, config_1.loadDefaultConfig)(), (0, utility_1.reconfigureLimits)(config)); + this.resource = (_a = mergedConfig.resource) !== null && _a !== void 0 ? _a : resources_1.Resource.empty(); + if (mergedConfig.mergeResourceWithDefaults) { + this.resource = resources_1.Resource.default().merge(this.resource); + } + this._config = Object.assign({}, mergedConfig, { + resource: this.resource, + }); + if ((_b = config.spanProcessors) === null || _b === void 0 ? void 0 : _b.length) { + this._registeredSpanProcessors = [...config.spanProcessors]; + this.activeSpanProcessor = new MultiSpanProcessor_1.MultiSpanProcessor(this._registeredSpanProcessors); + } + else { + const defaultExporter = this._buildExporterFromEnv(); + if (defaultExporter !== undefined) { + const batchProcessor = new platform_1.BatchSpanProcessor(defaultExporter); + this.activeSpanProcessor = batchProcessor; + } + else { + this.activeSpanProcessor = new NoopSpanProcessor_1.NoopSpanProcessor(); + } + } + } + getTracer(name, version, options) { + const key = `${name}@${version || ''}:${(options === null || options === void 0 ? void 0 : options.schemaUrl) || ''}`; + if (!this._tracers.has(key)) { + this._tracers.set(key, new Tracer_1.Tracer({ name, version, schemaUrl: options === null || options === void 0 ? void 0 : options.schemaUrl }, this._config, this)); + } + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + return this._tracers.get(key); + } + /** + * @deprecated please use {@link TracerConfig} spanProcessors property + * Adds a new {@link SpanProcessor} to this tracer. + * @param spanProcessor the new SpanProcessor to be added. + */ + addSpanProcessor(spanProcessor) { + if (this._registeredSpanProcessors.length === 0) { + // since we might have enabled by default a batchProcessor, we disable it + // before adding the new one + this.activeSpanProcessor + .shutdown() + .catch(err => api_1.diag.error('Error while trying to shutdown current span processor', err)); + } + this._registeredSpanProcessors.push(spanProcessor); + this.activeSpanProcessor = new MultiSpanProcessor_1.MultiSpanProcessor(this._registeredSpanProcessors); + } + getActiveSpanProcessor() { + return this.activeSpanProcessor; + } + /** + * Register this TracerProvider for use with the OpenTelemetry API. + * Undefined values may be replaced with defaults, and + * null values will be skipped. + * + * @param config Configuration object for SDK registration + */ + register(config = {}) { + api_1.trace.setGlobalTracerProvider(this); + if (config.propagator === undefined) { + config.propagator = this._buildPropagatorFromEnv(); + } + if (config.contextManager) { + api_1.context.setGlobalContextManager(config.contextManager); + } + if (config.propagator) { + api_1.propagation.setGlobalPropagator(config.propagator); + } + } + forceFlush() { + const timeout = this._config.forceFlushTimeoutMillis; + const promises = this._registeredSpanProcessors.map((spanProcessor) => { + return new Promise(resolve => { + let state; + const timeoutInterval = setTimeout(() => { + resolve(new Error(`Span processor did not completed within timeout period of ${timeout} ms`)); + state = ForceFlushState.timeout; + }, timeout); + spanProcessor + .forceFlush() + .then(() => { + clearTimeout(timeoutInterval); + if (state !== ForceFlushState.timeout) { + state = ForceFlushState.resolved; + resolve(state); + } + }) + .catch(error => { + clearTimeout(timeoutInterval); + state = ForceFlushState.error; + resolve(error); + }); + }); + }); + return new Promise((resolve, reject) => { + Promise.all(promises) + .then(results => { + const errors = results.filter(result => result !== ForceFlushState.resolved); + if (errors.length > 0) { + reject(errors); + } + else { + resolve(); + } + }) + .catch(error => reject([error])); + }); + } + shutdown() { + return this.activeSpanProcessor.shutdown(); + } + /** + * TS cannot yet infer the type of this.constructor: + * https://github.com/Microsoft/TypeScript/issues/3841#issuecomment-337560146 + * There is no need to override either of the getters in your child class. + * The type of the registered component maps should be the same across all + * classes in the inheritance tree. + */ + _getPropagator(name) { + var _a; + return (_a = this.constructor._registeredPropagators.get(name)) === null || _a === void 0 ? void 0 : _a(); + } + _getSpanExporter(name) { + var _a; + return (_a = this.constructor._registeredExporters.get(name)) === null || _a === void 0 ? void 0 : _a(); + } + _buildPropagatorFromEnv() { + // per spec, propagators from env must be deduplicated + const uniquePropagatorNames = Array.from(new Set((0, core_1.getEnv)().OTEL_PROPAGATORS)); + const propagators = uniquePropagatorNames.map(name => { + const propagator = this._getPropagator(name); + if (!propagator) { + api_1.diag.warn(`Propagator "${name}" requested through environment variable is unavailable.`); + } + return propagator; + }); + const validPropagators = propagators.reduce((list, item) => { + if (item) { + list.push(item); + } + return list; + }, []); + if (validPropagators.length === 0) { + return; + } + else if (uniquePropagatorNames.length === 1) { + return validPropagators[0]; + } + else { + return new core_1.CompositePropagator({ + propagators: validPropagators, + }); + } + } + _buildExporterFromEnv() { + const exporterName = (0, core_1.getEnv)().OTEL_TRACES_EXPORTER; + if (exporterName === 'none' || exporterName === '') + return; + const exporter = this._getSpanExporter(exporterName); + if (!exporter) { + api_1.diag.error(`Exporter "${exporterName}" requested through environment variable is unavailable.`); + } + return exporter; + } +} +exports.BasicTracerProvider = BasicTracerProvider; +BasicTracerProvider._registeredPropagators = new Map([ + ['tracecontext', () => new core_1.W3CTraceContextPropagator()], + ['baggage', () => new core_1.W3CBaggagePropagator()], +]); +BasicTracerProvider._registeredExporters = new Map(); +//# sourceMappingURL=BasicTracerProvider.js.map + +/***/ }), + +/***/ 35369: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.MultiSpanProcessor = void 0; +const core_1 = __nccwpck_require__(24637); +/** + * Implementation of the {@link SpanProcessor} that simply forwards all + * received events to a list of {@link SpanProcessor}s. + */ +class MultiSpanProcessor { + constructor(_spanProcessors) { + this._spanProcessors = _spanProcessors; + } + forceFlush() { + const promises = []; + for (const spanProcessor of this._spanProcessors) { + promises.push(spanProcessor.forceFlush()); + } + return new Promise(resolve => { + Promise.all(promises) + .then(() => { + resolve(); + }) + .catch(error => { + (0, core_1.globalErrorHandler)(error || new Error('MultiSpanProcessor: forceFlush failed')); + resolve(); + }); + }); + } + onStart(span, context) { + for (const spanProcessor of this._spanProcessors) { + spanProcessor.onStart(span, context); + } + } + onEnd(span) { + for (const spanProcessor of this._spanProcessors) { + spanProcessor.onEnd(span); + } + } + shutdown() { + const promises = []; + for (const spanProcessor of this._spanProcessors) { + promises.push(spanProcessor.shutdown()); + } + return new Promise((resolve, reject) => { + Promise.all(promises).then(() => { + resolve(); + }, reject); + }); + } +} +exports.MultiSpanProcessor = MultiSpanProcessor; +//# sourceMappingURL=MultiSpanProcessor.js.map + +/***/ }), + +/***/ 56148: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.SamplingDecision = void 0; +/** + * A sampling decision that determines how a {@link Span} will be recorded + * and collected. + */ +var SamplingDecision; +(function (SamplingDecision) { + /** + * `Span.isRecording() === false`, span will not be recorded and all events + * and attributes will be dropped. + */ + SamplingDecision[SamplingDecision["NOT_RECORD"] = 0] = "NOT_RECORD"; + /** + * `Span.isRecording() === true`, but `Sampled` flag in {@link TraceFlags} + * MUST NOT be set. + */ + SamplingDecision[SamplingDecision["RECORD"] = 1] = "RECORD"; + /** + * `Span.isRecording() === true` AND `Sampled` flag in {@link TraceFlags} + * MUST be set. + */ + SamplingDecision[SamplingDecision["RECORD_AND_SAMPLED"] = 2] = "RECORD_AND_SAMPLED"; +})(SamplingDecision = exports.SamplingDecision || (exports.SamplingDecision = {})); +//# sourceMappingURL=Sampler.js.map + +/***/ }), + +/***/ 65994: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Span = void 0; +const api_1 = __nccwpck_require__(63914); +const core_1 = __nccwpck_require__(24637); +const semantic_conventions_1 = __nccwpck_require__(61357); +const enums_1 = __nccwpck_require__(41042); +/** + * This class represents a span. + */ +class Span { + /** + * Constructs a new Span instance. + * + * @deprecated calling Span constructor directly is not supported. Please use tracer.startSpan. + * */ + constructor(parentTracer, context, spanName, spanContext, kind, parentSpanId, links = [], startTime, _deprecatedClock, // keeping this argument even though it is unused to ensure backwards compatibility + attributes) { + this.attributes = {}; + this.links = []; + this.events = []; + this._droppedAttributesCount = 0; + this._droppedEventsCount = 0; + this._droppedLinksCount = 0; + this.status = { + code: api_1.SpanStatusCode.UNSET, + }; + this.endTime = [0, 0]; + this._ended = false; + this._duration = [-1, -1]; + this.name = spanName; + this._spanContext = spanContext; + this.parentSpanId = parentSpanId; + this.kind = kind; + this.links = links; + const now = Date.now(); + this._performanceStartTime = core_1.otperformance.now(); + this._performanceOffset = + now - (this._performanceStartTime + (0, core_1.getTimeOrigin)()); + this._startTimeProvided = startTime != null; + this.startTime = this._getTime(startTime !== null && startTime !== void 0 ? startTime : now); + this.resource = parentTracer.resource; + this.instrumentationLibrary = parentTracer.instrumentationLibrary; + this._spanLimits = parentTracer.getSpanLimits(); + this._attributeValueLengthLimit = + this._spanLimits.attributeValueLengthLimit || 0; + if (attributes != null) { + this.setAttributes(attributes); + } + this._spanProcessor = parentTracer.getActiveSpanProcessor(); + this._spanProcessor.onStart(this, context); + } + spanContext() { + return this._spanContext; + } + setAttribute(key, value) { + if (value == null || this._isSpanEnded()) + return this; + if (key.length === 0) { + api_1.diag.warn(`Invalid attribute key: ${key}`); + return this; + } + if (!(0, core_1.isAttributeValue)(value)) { + api_1.diag.warn(`Invalid attribute value set for key: ${key}`); + return this; + } + if (Object.keys(this.attributes).length >= + this._spanLimits.attributeCountLimit && + !Object.prototype.hasOwnProperty.call(this.attributes, key)) { + this._droppedAttributesCount++; + return this; + } + this.attributes[key] = this._truncateToSize(value); + return this; + } + setAttributes(attributes) { + for (const [k, v] of Object.entries(attributes)) { + this.setAttribute(k, v); + } + return this; + } + /** + * + * @param name Span Name + * @param [attributesOrStartTime] Span attributes or start time + * if type is {@type TimeInput} and 3rd param is undefined + * @param [timeStamp] Specified time stamp for the event + */ + addEvent(name, attributesOrStartTime, timeStamp) { + if (this._isSpanEnded()) + return this; + if (this._spanLimits.eventCountLimit === 0) { + api_1.diag.warn('No events allowed.'); + this._droppedEventsCount++; + return this; + } + if (this.events.length >= this._spanLimits.eventCountLimit) { + if (this._droppedEventsCount === 0) { + api_1.diag.debug('Dropping extra events.'); + } + this.events.shift(); + this._droppedEventsCount++; + } + if ((0, core_1.isTimeInput)(attributesOrStartTime)) { + if (!(0, core_1.isTimeInput)(timeStamp)) { + timeStamp = attributesOrStartTime; + } + attributesOrStartTime = undefined; + } + const attributes = (0, core_1.sanitizeAttributes)(attributesOrStartTime); + this.events.push({ + name, + attributes, + time: this._getTime(timeStamp), + droppedAttributesCount: 0, + }); + return this; + } + addLink(link) { + this.links.push(link); + return this; + } + addLinks(links) { + this.links.push(...links); + return this; + } + setStatus(status) { + if (this._isSpanEnded()) + return this; + this.status = Object.assign({}, status); + // When using try-catch, the caught "error" is of type `any`. When then assigning `any` to `status.message`, + // TypeScript will not error. While this can happen during use of any API, it is more common on Span#setStatus() + // as it's likely used in a catch-block. Therefore, we validate if `status.message` is actually a string, null, or + // undefined to avoid an incorrect type causing issues downstream. + if (this.status.message != null && typeof status.message !== 'string') { + api_1.diag.warn(`Dropping invalid status.message of type '${typeof status.message}', expected 'string'`); + delete this.status.message; + } + return this; + } + updateName(name) { + if (this._isSpanEnded()) + return this; + this.name = name; + return this; + } + end(endTime) { + if (this._isSpanEnded()) { + api_1.diag.error(`${this.name} ${this._spanContext.traceId}-${this._spanContext.spanId} - You can only call end() on a span once.`); + return; + } + this._ended = true; + this.endTime = this._getTime(endTime); + this._duration = (0, core_1.hrTimeDuration)(this.startTime, this.endTime); + if (this._duration[0] < 0) { + api_1.diag.warn('Inconsistent start and end time, startTime > endTime. Setting span duration to 0ms.', this.startTime, this.endTime); + this.endTime = this.startTime.slice(); + this._duration = [0, 0]; + } + if (this._droppedEventsCount > 0) { + api_1.diag.warn(`Dropped ${this._droppedEventsCount} events because eventCountLimit reached`); + } + this._spanProcessor.onEnd(this); + } + _getTime(inp) { + if (typeof inp === 'number' && inp <= core_1.otperformance.now()) { + // must be a performance timestamp + // apply correction and convert to hrtime + return (0, core_1.hrTime)(inp + this._performanceOffset); + } + if (typeof inp === 'number') { + return (0, core_1.millisToHrTime)(inp); + } + if (inp instanceof Date) { + return (0, core_1.millisToHrTime)(inp.getTime()); + } + if ((0, core_1.isTimeInputHrTime)(inp)) { + return inp; + } + if (this._startTimeProvided) { + // if user provided a time for the start manually + // we can't use duration to calculate event/end times + return (0, core_1.millisToHrTime)(Date.now()); + } + const msDuration = core_1.otperformance.now() - this._performanceStartTime; + return (0, core_1.addHrTimes)(this.startTime, (0, core_1.millisToHrTime)(msDuration)); + } + isRecording() { + return this._ended === false; + } + recordException(exception, time) { + const attributes = {}; + if (typeof exception === 'string') { + attributes[semantic_conventions_1.SEMATTRS_EXCEPTION_MESSAGE] = exception; + } + else if (exception) { + if (exception.code) { + attributes[semantic_conventions_1.SEMATTRS_EXCEPTION_TYPE] = exception.code.toString(); + } + else if (exception.name) { + attributes[semantic_conventions_1.SEMATTRS_EXCEPTION_TYPE] = exception.name; + } + if (exception.message) { + attributes[semantic_conventions_1.SEMATTRS_EXCEPTION_MESSAGE] = exception.message; + } + if (exception.stack) { + attributes[semantic_conventions_1.SEMATTRS_EXCEPTION_STACKTRACE] = exception.stack; + } + } + // these are minimum requirements from spec + if (attributes[semantic_conventions_1.SEMATTRS_EXCEPTION_TYPE] || + attributes[semantic_conventions_1.SEMATTRS_EXCEPTION_MESSAGE]) { + this.addEvent(enums_1.ExceptionEventName, attributes, time); + } + else { + api_1.diag.warn(`Failed to record an exception ${exception}`); + } + } + get duration() { + return this._duration; + } + get ended() { + return this._ended; + } + get droppedAttributesCount() { + return this._droppedAttributesCount; + } + get droppedEventsCount() { + return this._droppedEventsCount; + } + get droppedLinksCount() { + return this._droppedLinksCount; + } + _isSpanEnded() { + if (this._ended) { + api_1.diag.warn(`Can not execute the operation on ended Span {traceId: ${this._spanContext.traceId}, spanId: ${this._spanContext.spanId}}`); + } + return this._ended; + } + // Utility function to truncate given value within size + // for value type of string, will truncate to given limit + // for type of non-string, will return same value + _truncateToLimitUtil(value, limit) { + if (value.length <= limit) { + return value; + } + return value.substring(0, limit); + } + /** + * If the given attribute value is of type string and has more characters than given {@code attributeValueLengthLimit} then + * return string with truncated to {@code attributeValueLengthLimit} characters + * + * If the given attribute value is array of strings then + * return new array of strings with each element truncated to {@code attributeValueLengthLimit} characters + * + * Otherwise return same Attribute {@code value} + * + * @param value Attribute value + * @returns truncated attribute value if required, otherwise same value + */ + _truncateToSize(value) { + const limit = this._attributeValueLengthLimit; + // Check limit + if (limit <= 0) { + // Negative values are invalid, so do not truncate + api_1.diag.warn(`Attribute value limit must be positive, got ${limit}`); + return value; + } + // String + if (typeof value === 'string') { + return this._truncateToLimitUtil(value, limit); + } + // Array of strings + if (Array.isArray(value)) { + return value.map(val => typeof val === 'string' ? this._truncateToLimitUtil(val, limit) : val); + } + // Other types, no need to apply value length limit + return value; + } +} +exports.Span = Span; +//# sourceMappingURL=Span.js.map + +/***/ }), + +/***/ 56259: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Tracer = void 0; +const api = __nccwpck_require__(63914); +const core_1 = __nccwpck_require__(24637); +const Span_1 = __nccwpck_require__(65994); +const utility_1 = __nccwpck_require__(29228); +const platform_1 = __nccwpck_require__(58942); +/** + * This class represents a basic tracer. + */ +class Tracer { + /** + * Constructs a new Tracer instance. + */ + constructor(instrumentationLibrary, config, _tracerProvider) { + this._tracerProvider = _tracerProvider; + const localConfig = (0, utility_1.mergeConfig)(config); + this._sampler = localConfig.sampler; + this._generalLimits = localConfig.generalLimits; + this._spanLimits = localConfig.spanLimits; + this._idGenerator = config.idGenerator || new platform_1.RandomIdGenerator(); + this.resource = _tracerProvider.resource; + this.instrumentationLibrary = instrumentationLibrary; + } + /** + * Starts a new Span or returns the default NoopSpan based on the sampling + * decision. + */ + startSpan(name, options = {}, context = api.context.active()) { + var _a, _b, _c; + // remove span from context in case a root span is requested via options + if (options.root) { + context = api.trace.deleteSpan(context); + } + const parentSpan = api.trace.getSpan(context); + if ((0, core_1.isTracingSuppressed)(context)) { + api.diag.debug('Instrumentation suppressed, returning Noop Span'); + const nonRecordingSpan = api.trace.wrapSpanContext(api.INVALID_SPAN_CONTEXT); + return nonRecordingSpan; + } + const parentSpanContext = parentSpan === null || parentSpan === void 0 ? void 0 : parentSpan.spanContext(); + const spanId = this._idGenerator.generateSpanId(); + let traceId; + let traceState; + let parentSpanId; + if (!parentSpanContext || + !api.trace.isSpanContextValid(parentSpanContext)) { + // New root span. + traceId = this._idGenerator.generateTraceId(); + } + else { + // New child span. + traceId = parentSpanContext.traceId; + traceState = parentSpanContext.traceState; + parentSpanId = parentSpanContext.spanId; + } + const spanKind = (_a = options.kind) !== null && _a !== void 0 ? _a : api.SpanKind.INTERNAL; + const links = ((_b = options.links) !== null && _b !== void 0 ? _b : []).map(link => { + return { + context: link.context, + attributes: (0, core_1.sanitizeAttributes)(link.attributes), + }; + }); + const attributes = (0, core_1.sanitizeAttributes)(options.attributes); + // make sampling decision + const samplingResult = this._sampler.shouldSample(context, traceId, name, spanKind, attributes, links); + traceState = (_c = samplingResult.traceState) !== null && _c !== void 0 ? _c : traceState; + const traceFlags = samplingResult.decision === api.SamplingDecision.RECORD_AND_SAMPLED + ? api.TraceFlags.SAMPLED + : api.TraceFlags.NONE; + const spanContext = { traceId, spanId, traceFlags, traceState }; + if (samplingResult.decision === api.SamplingDecision.NOT_RECORD) { + api.diag.debug('Recording is off, propagating context in a non-recording span'); + const nonRecordingSpan = api.trace.wrapSpanContext(spanContext); + return nonRecordingSpan; + } + // Set initial span attributes. The attributes object may have been mutated + // by the sampler, so we sanitize the merged attributes before setting them. + const initAttributes = (0, core_1.sanitizeAttributes)(Object.assign(attributes, samplingResult.attributes)); + const span = new Span_1.Span(this, context, name, spanContext, spanKind, parentSpanId, links, options.startTime, undefined, initAttributes); + return span; + } + startActiveSpan(name, arg2, arg3, arg4) { + let opts; + let ctx; + let fn; + if (arguments.length < 2) { + return; + } + else if (arguments.length === 2) { + fn = arg2; + } + else if (arguments.length === 3) { + opts = arg2; + fn = arg3; + } + else { + opts = arg2; + ctx = arg3; + fn = arg4; + } + const parentContext = ctx !== null && ctx !== void 0 ? ctx : api.context.active(); + const span = this.startSpan(name, opts, parentContext); + const contextWithSpanSet = api.trace.setSpan(parentContext, span); + return api.context.with(contextWithSpanSet, fn, undefined, span); + } + /** Returns the active {@link GeneralLimits}. */ + getGeneralLimits() { + return this._generalLimits; + } + /** Returns the active {@link SpanLimits}. */ + getSpanLimits() { + return this._spanLimits; + } + getActiveSpanProcessor() { + return this._tracerProvider.getActiveSpanProcessor(); + } +} +exports.Tracer = Tracer; +//# sourceMappingURL=Tracer.js.map + +/***/ }), + +/***/ 29884: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.buildSamplerFromEnv = exports.loadDefaultConfig = void 0; +const api_1 = __nccwpck_require__(63914); +const core_1 = __nccwpck_require__(24637); +const AlwaysOffSampler_1 = __nccwpck_require__(78897); +const AlwaysOnSampler_1 = __nccwpck_require__(9295); +const ParentBasedSampler_1 = __nccwpck_require__(11266); +const TraceIdRatioBasedSampler_1 = __nccwpck_require__(87481); +const FALLBACK_OTEL_TRACES_SAMPLER = core_1.TracesSamplerValues.AlwaysOn; +const DEFAULT_RATIO = 1; +/** + * Load default configuration. For fields with primitive values, any user-provided + * value will override the corresponding default value. For fields with + * non-primitive values (like `spanLimits`), the user-provided value will be + * used to extend the default value. + */ +// object needs to be wrapped in this function and called when needed otherwise +// envs are parsed before tests are ran - causes tests using these envs to fail +function loadDefaultConfig() { + const env = (0, core_1.getEnv)(); + return { + sampler: buildSamplerFromEnv(env), + forceFlushTimeoutMillis: 30000, + generalLimits: { + attributeValueLengthLimit: env.OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT, + attributeCountLimit: env.OTEL_ATTRIBUTE_COUNT_LIMIT, + }, + spanLimits: { + attributeValueLengthLimit: env.OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT, + attributeCountLimit: env.OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT, + linkCountLimit: env.OTEL_SPAN_LINK_COUNT_LIMIT, + eventCountLimit: env.OTEL_SPAN_EVENT_COUNT_LIMIT, + attributePerEventCountLimit: env.OTEL_SPAN_ATTRIBUTE_PER_EVENT_COUNT_LIMIT, + attributePerLinkCountLimit: env.OTEL_SPAN_ATTRIBUTE_PER_LINK_COUNT_LIMIT, + }, + mergeResourceWithDefaults: true, + }; +} +exports.loadDefaultConfig = loadDefaultConfig; +/** + * Based on environment, builds a sampler, complies with specification. + * @param environment optional, by default uses getEnv(), but allows passing a value to reuse parsed environment + */ +function buildSamplerFromEnv(environment = (0, core_1.getEnv)()) { + switch (environment.OTEL_TRACES_SAMPLER) { + case core_1.TracesSamplerValues.AlwaysOn: + return new AlwaysOnSampler_1.AlwaysOnSampler(); + case core_1.TracesSamplerValues.AlwaysOff: + return new AlwaysOffSampler_1.AlwaysOffSampler(); + case core_1.TracesSamplerValues.ParentBasedAlwaysOn: + return new ParentBasedSampler_1.ParentBasedSampler({ + root: new AlwaysOnSampler_1.AlwaysOnSampler(), + }); + case core_1.TracesSamplerValues.ParentBasedAlwaysOff: + return new ParentBasedSampler_1.ParentBasedSampler({ + root: new AlwaysOffSampler_1.AlwaysOffSampler(), + }); + case core_1.TracesSamplerValues.TraceIdRatio: + return new TraceIdRatioBasedSampler_1.TraceIdRatioBasedSampler(getSamplerProbabilityFromEnv(environment)); + case core_1.TracesSamplerValues.ParentBasedTraceIdRatio: + return new ParentBasedSampler_1.ParentBasedSampler({ + root: new TraceIdRatioBasedSampler_1.TraceIdRatioBasedSampler(getSamplerProbabilityFromEnv(environment)), + }); + default: + api_1.diag.error(`OTEL_TRACES_SAMPLER value "${environment.OTEL_TRACES_SAMPLER} invalid, defaulting to ${FALLBACK_OTEL_TRACES_SAMPLER}".`); + return new AlwaysOnSampler_1.AlwaysOnSampler(); + } +} +exports.buildSamplerFromEnv = buildSamplerFromEnv; +function getSamplerProbabilityFromEnv(environment) { + if (environment.OTEL_TRACES_SAMPLER_ARG === undefined || + environment.OTEL_TRACES_SAMPLER_ARG === '') { + api_1.diag.error(`OTEL_TRACES_SAMPLER_ARG is blank, defaulting to ${DEFAULT_RATIO}.`); + return DEFAULT_RATIO; + } + const probability = Number(environment.OTEL_TRACES_SAMPLER_ARG); + if (isNaN(probability)) { + api_1.diag.error(`OTEL_TRACES_SAMPLER_ARG=${environment.OTEL_TRACES_SAMPLER_ARG} was given, but it is invalid, defaulting to ${DEFAULT_RATIO}.`); + return DEFAULT_RATIO; + } + if (probability < 0 || probability > 1) { + api_1.diag.error(`OTEL_TRACES_SAMPLER_ARG=${environment.OTEL_TRACES_SAMPLER_ARG} was given, but it is out of range ([0..1]), defaulting to ${DEFAULT_RATIO}.`); + return DEFAULT_RATIO; + } + return probability; +} +//# sourceMappingURL=config.js.map + +/***/ }), + +/***/ 41042: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ExceptionEventName = void 0; +// Event name definitions +exports.ExceptionEventName = 'exception'; +//# sourceMappingURL=enums.js.map + +/***/ }), + +/***/ 42118: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.BatchSpanProcessorBase = void 0; +const api_1 = __nccwpck_require__(63914); +const core_1 = __nccwpck_require__(24637); +/** + * Implementation of the {@link SpanProcessor} that batches spans exported by + * the SDK then pushes them to the exporter pipeline. + */ +class BatchSpanProcessorBase { + constructor(_exporter, config) { + this._exporter = _exporter; + this._isExporting = false; + this._finishedSpans = []; + this._droppedSpansCount = 0; + const env = (0, core_1.getEnv)(); + this._maxExportBatchSize = + typeof (config === null || config === void 0 ? void 0 : config.maxExportBatchSize) === 'number' + ? config.maxExportBatchSize + : env.OTEL_BSP_MAX_EXPORT_BATCH_SIZE; + this._maxQueueSize = + typeof (config === null || config === void 0 ? void 0 : config.maxQueueSize) === 'number' + ? config.maxQueueSize + : env.OTEL_BSP_MAX_QUEUE_SIZE; + this._scheduledDelayMillis = + typeof (config === null || config === void 0 ? void 0 : config.scheduledDelayMillis) === 'number' + ? config.scheduledDelayMillis + : env.OTEL_BSP_SCHEDULE_DELAY; + this._exportTimeoutMillis = + typeof (config === null || config === void 0 ? void 0 : config.exportTimeoutMillis) === 'number' + ? config.exportTimeoutMillis + : env.OTEL_BSP_EXPORT_TIMEOUT; + this._shutdownOnce = new core_1.BindOnceFuture(this._shutdown, this); + if (this._maxExportBatchSize > this._maxQueueSize) { + api_1.diag.warn('BatchSpanProcessor: maxExportBatchSize must be smaller or equal to maxQueueSize, setting maxExportBatchSize to match maxQueueSize'); + this._maxExportBatchSize = this._maxQueueSize; + } + } + forceFlush() { + if (this._shutdownOnce.isCalled) { + return this._shutdownOnce.promise; + } + return this._flushAll(); + } + // does nothing. + onStart(_span, _parentContext) { } + onEnd(span) { + if (this._shutdownOnce.isCalled) { + return; + } + if ((span.spanContext().traceFlags & api_1.TraceFlags.SAMPLED) === 0) { + return; + } + this._addToBuffer(span); + } + shutdown() { + return this._shutdownOnce.call(); + } + _shutdown() { + return Promise.resolve() + .then(() => { + return this.onShutdown(); + }) + .then(() => { + return this._flushAll(); + }) + .then(() => { + return this._exporter.shutdown(); + }); + } + /** Add a span in the buffer. */ + _addToBuffer(span) { + if (this._finishedSpans.length >= this._maxQueueSize) { + // limit reached, drop span + if (this._droppedSpansCount === 0) { + api_1.diag.debug('maxQueueSize reached, dropping spans'); + } + this._droppedSpansCount++; + return; + } + if (this._droppedSpansCount > 0) { + // some spans were dropped, log once with count of spans dropped + api_1.diag.warn(`Dropped ${this._droppedSpansCount} spans because maxQueueSize reached`); + this._droppedSpansCount = 0; + } + this._finishedSpans.push(span); + this._maybeStartTimer(); + } + /** + * Send all spans to the exporter respecting the batch size limit + * This function is used only on forceFlush or shutdown, + * for all other cases _flush should be used + * */ + _flushAll() { + return new Promise((resolve, reject) => { + const promises = []; + // calculate number of batches + const count = Math.ceil(this._finishedSpans.length / this._maxExportBatchSize); + for (let i = 0, j = count; i < j; i++) { + promises.push(this._flushOneBatch()); + } + Promise.all(promises) + .then(() => { + resolve(); + }) + .catch(reject); + }); + } + _flushOneBatch() { + this._clearTimer(); + if (this._finishedSpans.length === 0) { + return Promise.resolve(); + } + return new Promise((resolve, reject) => { + const timer = setTimeout(() => { + // don't wait anymore for export, this way the next batch can start + reject(new Error('Timeout')); + }, this._exportTimeoutMillis); + // prevent downstream exporter calls from generating spans + api_1.context.with((0, core_1.suppressTracing)(api_1.context.active()), () => { + // Reset the finished spans buffer here because the next invocations of the _flush method + // could pass the same finished spans to the exporter if the buffer is cleared + // outside the execution of this callback. + let spans; + if (this._finishedSpans.length <= this._maxExportBatchSize) { + spans = this._finishedSpans; + this._finishedSpans = []; + } + else { + spans = this._finishedSpans.splice(0, this._maxExportBatchSize); + } + const doExport = () => this._exporter.export(spans, result => { + var _a; + clearTimeout(timer); + if (result.code === core_1.ExportResultCode.SUCCESS) { + resolve(); + } + else { + reject((_a = result.error) !== null && _a !== void 0 ? _a : new Error('BatchSpanProcessor: span export failed')); + } + }); + let pendingResources = null; + for (let i = 0, len = spans.length; i < len; i++) { + const span = spans[i]; + if (span.resource.asyncAttributesPending && + span.resource.waitForAsyncAttributes) { + pendingResources !== null && pendingResources !== void 0 ? pendingResources : (pendingResources = []); + pendingResources.push(span.resource.waitForAsyncAttributes()); + } + } + // Avoid scheduling a promise to make the behavior more predictable and easier to test + if (pendingResources === null) { + doExport(); + } + else { + Promise.all(pendingResources).then(doExport, err => { + (0, core_1.globalErrorHandler)(err); + reject(err); + }); + } + }); + }); + } + _maybeStartTimer() { + if (this._isExporting) + return; + const flush = () => { + this._isExporting = true; + this._flushOneBatch() + .finally(() => { + this._isExporting = false; + if (this._finishedSpans.length > 0) { + this._clearTimer(); + this._maybeStartTimer(); + } + }) + .catch(e => { + this._isExporting = false; + (0, core_1.globalErrorHandler)(e); + }); + }; + // we only wait if the queue doesn't have enough elements yet + if (this._finishedSpans.length >= this._maxExportBatchSize) { + return flush(); + } + if (this._timer !== undefined) + return; + this._timer = setTimeout(() => flush(), this._scheduledDelayMillis); + (0, core_1.unrefTimer)(this._timer); + } + _clearTimer() { + if (this._timer !== undefined) { + clearTimeout(this._timer); + this._timer = undefined; + } + } +} +exports.BatchSpanProcessorBase = BatchSpanProcessorBase; +//# sourceMappingURL=BatchSpanProcessorBase.js.map + +/***/ }), + +/***/ 34851: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ConsoleSpanExporter = void 0; +const core_1 = __nccwpck_require__(24637); +/** + * This is implementation of {@link SpanExporter} that prints spans to the + * console. This class can be used for diagnostic purposes. + * + * NOTE: This {@link SpanExporter} is intended for diagnostics use only, output rendered to the console may change at any time. + */ +/* eslint-disable no-console */ +class ConsoleSpanExporter { + /** + * Export spans. + * @param spans + * @param resultCallback + */ + export(spans, resultCallback) { + return this._sendSpans(spans, resultCallback); + } + /** + * Shutdown the exporter. + */ + shutdown() { + this._sendSpans([]); + return this.forceFlush(); + } + /** + * Exports any pending spans in exporter + */ + forceFlush() { + return Promise.resolve(); + } + /** + * converts span info into more readable format + * @param span + */ + _exportInfo(span) { + var _a; + return { + resource: { + attributes: span.resource.attributes, + }, + instrumentationScope: span.instrumentationLibrary, + traceId: span.spanContext().traceId, + parentId: span.parentSpanId, + traceState: (_a = span.spanContext().traceState) === null || _a === void 0 ? void 0 : _a.serialize(), + name: span.name, + id: span.spanContext().spanId, + kind: span.kind, + timestamp: (0, core_1.hrTimeToMicroseconds)(span.startTime), + duration: (0, core_1.hrTimeToMicroseconds)(span.duration), + attributes: span.attributes, + status: span.status, + events: span.events, + links: span.links, + }; + } + /** + * Showing spans in console + * @param spans + * @param done + */ + _sendSpans(spans, done) { + for (const span of spans) { + console.dir(this._exportInfo(span), { depth: 3 }); + } + if (done) { + return done({ code: core_1.ExportResultCode.SUCCESS }); + } + } +} +exports.ConsoleSpanExporter = ConsoleSpanExporter; +//# sourceMappingURL=ConsoleSpanExporter.js.map + +/***/ }), + +/***/ 9422: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.InMemorySpanExporter = void 0; +const core_1 = __nccwpck_require__(24637); +/** + * This class can be used for testing purposes. It stores the exported spans + * in a list in memory that can be retrieved using the `getFinishedSpans()` + * method. + */ +class InMemorySpanExporter { + constructor() { + this._finishedSpans = []; + /** + * Indicates if the exporter has been "shutdown." + * When false, exported spans will not be stored in-memory. + */ + this._stopped = false; + } + export(spans, resultCallback) { + if (this._stopped) + return resultCallback({ + code: core_1.ExportResultCode.FAILED, + error: new Error('Exporter has been stopped'), + }); + this._finishedSpans.push(...spans); + setTimeout(() => resultCallback({ code: core_1.ExportResultCode.SUCCESS }), 0); + } + shutdown() { + this._stopped = true; + this._finishedSpans = []; + return this.forceFlush(); + } + /** + * Exports any pending spans in the exporter + */ + forceFlush() { + return Promise.resolve(); + } + reset() { + this._finishedSpans = []; + } + getFinishedSpans() { + return this._finishedSpans; + } +} +exports.InMemorySpanExporter = InMemorySpanExporter; +//# sourceMappingURL=InMemorySpanExporter.js.map + +/***/ }), + +/***/ 44943: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.NoopSpanProcessor = void 0; +/** No-op implementation of SpanProcessor */ +class NoopSpanProcessor { + onStart(_span, _context) { } + onEnd(_span) { } + shutdown() { + return Promise.resolve(); + } + forceFlush() { + return Promise.resolve(); + } +} +exports.NoopSpanProcessor = NoopSpanProcessor; +//# sourceMappingURL=NoopSpanProcessor.js.map + +/***/ }), + +/***/ 73381: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.SimpleSpanProcessor = void 0; +const api_1 = __nccwpck_require__(63914); +const core_1 = __nccwpck_require__(24637); +/** + * An implementation of the {@link SpanProcessor} that converts the {@link Span} + * to {@link ReadableSpan} and passes it to the configured exporter. + * + * Only spans that are sampled are converted. + * + * NOTE: This {@link SpanProcessor} exports every ended span individually instead of batching spans together, which causes significant performance overhead with most exporters. For production use, please consider using the {@link BatchSpanProcessor} instead. + */ +class SimpleSpanProcessor { + constructor(_exporter) { + this._exporter = _exporter; + this._shutdownOnce = new core_1.BindOnceFuture(this._shutdown, this); + this._unresolvedExports = new Set(); + } + async forceFlush() { + // await unresolved resources before resolving + await Promise.all(Array.from(this._unresolvedExports)); + if (this._exporter.forceFlush) { + await this._exporter.forceFlush(); + } + } + onStart(_span, _parentContext) { } + onEnd(span) { + var _a, _b; + if (this._shutdownOnce.isCalled) { + return; + } + if ((span.spanContext().traceFlags & api_1.TraceFlags.SAMPLED) === 0) { + return; + } + const doExport = () => core_1.internal + ._export(this._exporter, [span]) + .then((result) => { + var _a; + if (result.code !== core_1.ExportResultCode.SUCCESS) { + (0, core_1.globalErrorHandler)((_a = result.error) !== null && _a !== void 0 ? _a : new Error(`SimpleSpanProcessor: span export failed (status ${result})`)); + } + }) + .catch(error => { + (0, core_1.globalErrorHandler)(error); + }); + // Avoid scheduling a promise to make the behavior more predictable and easier to test + if (span.resource.asyncAttributesPending) { + const exportPromise = (_b = (_a = span.resource).waitForAsyncAttributes) === null || _b === void 0 ? void 0 : _b.call(_a).then(() => { + if (exportPromise != null) { + this._unresolvedExports.delete(exportPromise); + } + return doExport(); + }, err => (0, core_1.globalErrorHandler)(err)); + // store the unresolved exports + if (exportPromise != null) { + this._unresolvedExports.add(exportPromise); + } + } + else { + void doExport(); + } + } + shutdown() { + return this._shutdownOnce.call(); + } + _shutdown() { + return this._exporter.shutdown(); + } +} +exports.SimpleSpanProcessor = SimpleSpanProcessor; +//# sourceMappingURL=SimpleSpanProcessor.js.map + +/***/ }), + +/***/ 94952: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Span = exports.SamplingDecision = exports.TraceIdRatioBasedSampler = exports.ParentBasedSampler = exports.AlwaysOnSampler = exports.AlwaysOffSampler = exports.NoopSpanProcessor = exports.SimpleSpanProcessor = exports.InMemorySpanExporter = exports.ConsoleSpanExporter = exports.RandomIdGenerator = exports.BatchSpanProcessor = exports.ForceFlushState = exports.BasicTracerProvider = exports.Tracer = void 0; +var Tracer_1 = __nccwpck_require__(56259); +Object.defineProperty(exports, "Tracer", ({ enumerable: true, get: function () { return Tracer_1.Tracer; } })); +var BasicTracerProvider_1 = __nccwpck_require__(32594); +Object.defineProperty(exports, "BasicTracerProvider", ({ enumerable: true, get: function () { return BasicTracerProvider_1.BasicTracerProvider; } })); +Object.defineProperty(exports, "ForceFlushState", ({ enumerable: true, get: function () { return BasicTracerProvider_1.ForceFlushState; } })); +var platform_1 = __nccwpck_require__(58942); +Object.defineProperty(exports, "BatchSpanProcessor", ({ enumerable: true, get: function () { return platform_1.BatchSpanProcessor; } })); +Object.defineProperty(exports, "RandomIdGenerator", ({ enumerable: true, get: function () { return platform_1.RandomIdGenerator; } })); +var ConsoleSpanExporter_1 = __nccwpck_require__(34851); +Object.defineProperty(exports, "ConsoleSpanExporter", ({ enumerable: true, get: function () { return ConsoleSpanExporter_1.ConsoleSpanExporter; } })); +var InMemorySpanExporter_1 = __nccwpck_require__(9422); +Object.defineProperty(exports, "InMemorySpanExporter", ({ enumerable: true, get: function () { return InMemorySpanExporter_1.InMemorySpanExporter; } })); +var SimpleSpanProcessor_1 = __nccwpck_require__(73381); +Object.defineProperty(exports, "SimpleSpanProcessor", ({ enumerable: true, get: function () { return SimpleSpanProcessor_1.SimpleSpanProcessor; } })); +var NoopSpanProcessor_1 = __nccwpck_require__(44943); +Object.defineProperty(exports, "NoopSpanProcessor", ({ enumerable: true, get: function () { return NoopSpanProcessor_1.NoopSpanProcessor; } })); +var AlwaysOffSampler_1 = __nccwpck_require__(78897); +Object.defineProperty(exports, "AlwaysOffSampler", ({ enumerable: true, get: function () { return AlwaysOffSampler_1.AlwaysOffSampler; } })); +var AlwaysOnSampler_1 = __nccwpck_require__(9295); +Object.defineProperty(exports, "AlwaysOnSampler", ({ enumerable: true, get: function () { return AlwaysOnSampler_1.AlwaysOnSampler; } })); +var ParentBasedSampler_1 = __nccwpck_require__(11266); +Object.defineProperty(exports, "ParentBasedSampler", ({ enumerable: true, get: function () { return ParentBasedSampler_1.ParentBasedSampler; } })); +var TraceIdRatioBasedSampler_1 = __nccwpck_require__(87481); +Object.defineProperty(exports, "TraceIdRatioBasedSampler", ({ enumerable: true, get: function () { return TraceIdRatioBasedSampler_1.TraceIdRatioBasedSampler; } })); +var Sampler_1 = __nccwpck_require__(56148); +Object.defineProperty(exports, "SamplingDecision", ({ enumerable: true, get: function () { return Sampler_1.SamplingDecision; } })); +var Span_1 = __nccwpck_require__(65994); +Object.defineProperty(exports, "Span", ({ enumerable: true, get: function () { return Span_1.Span; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 58942: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.RandomIdGenerator = exports.BatchSpanProcessor = void 0; +var node_1 = __nccwpck_require__(51595); +Object.defineProperty(exports, "BatchSpanProcessor", ({ enumerable: true, get: function () { return node_1.BatchSpanProcessor; } })); +Object.defineProperty(exports, "RandomIdGenerator", ({ enumerable: true, get: function () { return node_1.RandomIdGenerator; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 29452: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.RandomIdGenerator = void 0; +const SPAN_ID_BYTES = 8; +const TRACE_ID_BYTES = 16; +class RandomIdGenerator { + constructor() { + /** + * Returns a random 16-byte trace ID formatted/encoded as a 32 lowercase hex + * characters corresponding to 128 bits. + */ + this.generateTraceId = getIdGenerator(TRACE_ID_BYTES); + /** + * Returns a random 8-byte span ID formatted/encoded as a 16 lowercase hex + * characters corresponding to 64 bits. + */ + this.generateSpanId = getIdGenerator(SPAN_ID_BYTES); + } +} +exports.RandomIdGenerator = RandomIdGenerator; +const SHARED_BUFFER = Buffer.allocUnsafe(TRACE_ID_BYTES); +function getIdGenerator(bytes) { + return function generateId() { + for (let i = 0; i < bytes / 4; i++) { + // unsigned right shift drops decimal part of the number + // it is required because if a number between 2**32 and 2**32 - 1 is generated, an out of range error is thrown by writeUInt32BE + SHARED_BUFFER.writeUInt32BE((Math.random() * 2 ** 32) >>> 0, i * 4); + } + // If buffer is all 0, set the last byte to 1 to guarantee a valid w3c id is generated + for (let i = 0; i < bytes; i++) { + if (SHARED_BUFFER[i] > 0) { + break; + } + else if (i === bytes - 1) { + SHARED_BUFFER[bytes - 1] = 1; + } + } + return SHARED_BUFFER.toString('hex', 0, bytes); + }; +} +//# sourceMappingURL=RandomIdGenerator.js.map + +/***/ }), + +/***/ 34584: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.BatchSpanProcessor = void 0; +const BatchSpanProcessorBase_1 = __nccwpck_require__(42118); +class BatchSpanProcessor extends BatchSpanProcessorBase_1.BatchSpanProcessorBase { + onShutdown() { } +} +exports.BatchSpanProcessor = BatchSpanProcessor; +//# sourceMappingURL=BatchSpanProcessor.js.map + +/***/ }), + +/***/ 51595: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.RandomIdGenerator = exports.BatchSpanProcessor = void 0; +var BatchSpanProcessor_1 = __nccwpck_require__(34584); +Object.defineProperty(exports, "BatchSpanProcessor", ({ enumerable: true, get: function () { return BatchSpanProcessor_1.BatchSpanProcessor; } })); +var RandomIdGenerator_1 = __nccwpck_require__(29452); +Object.defineProperty(exports, "RandomIdGenerator", ({ enumerable: true, get: function () { return RandomIdGenerator_1.RandomIdGenerator; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 78897: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.AlwaysOffSampler = void 0; +const Sampler_1 = __nccwpck_require__(56148); +/** Sampler that samples no traces. */ +class AlwaysOffSampler { + shouldSample() { + return { + decision: Sampler_1.SamplingDecision.NOT_RECORD, + }; + } + toString() { + return 'AlwaysOffSampler'; + } +} +exports.AlwaysOffSampler = AlwaysOffSampler; +//# sourceMappingURL=AlwaysOffSampler.js.map + +/***/ }), + +/***/ 9295: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.AlwaysOnSampler = void 0; +const Sampler_1 = __nccwpck_require__(56148); +/** Sampler that samples all traces. */ +class AlwaysOnSampler { + shouldSample() { + return { + decision: Sampler_1.SamplingDecision.RECORD_AND_SAMPLED, + }; + } + toString() { + return 'AlwaysOnSampler'; + } +} +exports.AlwaysOnSampler = AlwaysOnSampler; +//# sourceMappingURL=AlwaysOnSampler.js.map + +/***/ }), + +/***/ 11266: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ParentBasedSampler = void 0; +const api_1 = __nccwpck_require__(63914); +const core_1 = __nccwpck_require__(24637); +const AlwaysOffSampler_1 = __nccwpck_require__(78897); +const AlwaysOnSampler_1 = __nccwpck_require__(9295); +/** + * A composite sampler that either respects the parent span's sampling decision + * or delegates to `delegateSampler` for root spans. + */ +class ParentBasedSampler { + constructor(config) { + var _a, _b, _c, _d; + this._root = config.root; + if (!this._root) { + (0, core_1.globalErrorHandler)(new Error('ParentBasedSampler must have a root sampler configured')); + this._root = new AlwaysOnSampler_1.AlwaysOnSampler(); + } + this._remoteParentSampled = + (_a = config.remoteParentSampled) !== null && _a !== void 0 ? _a : new AlwaysOnSampler_1.AlwaysOnSampler(); + this._remoteParentNotSampled = + (_b = config.remoteParentNotSampled) !== null && _b !== void 0 ? _b : new AlwaysOffSampler_1.AlwaysOffSampler(); + this._localParentSampled = + (_c = config.localParentSampled) !== null && _c !== void 0 ? _c : new AlwaysOnSampler_1.AlwaysOnSampler(); + this._localParentNotSampled = + (_d = config.localParentNotSampled) !== null && _d !== void 0 ? _d : new AlwaysOffSampler_1.AlwaysOffSampler(); + } + shouldSample(context, traceId, spanName, spanKind, attributes, links) { + const parentContext = api_1.trace.getSpanContext(context); + if (!parentContext || !(0, api_1.isSpanContextValid)(parentContext)) { + return this._root.shouldSample(context, traceId, spanName, spanKind, attributes, links); + } + if (parentContext.isRemote) { + if (parentContext.traceFlags & api_1.TraceFlags.SAMPLED) { + return this._remoteParentSampled.shouldSample(context, traceId, spanName, spanKind, attributes, links); + } + return this._remoteParentNotSampled.shouldSample(context, traceId, spanName, spanKind, attributes, links); + } + if (parentContext.traceFlags & api_1.TraceFlags.SAMPLED) { + return this._localParentSampled.shouldSample(context, traceId, spanName, spanKind, attributes, links); + } + return this._localParentNotSampled.shouldSample(context, traceId, spanName, spanKind, attributes, links); + } + toString() { + return `ParentBased{root=${this._root.toString()}, remoteParentSampled=${this._remoteParentSampled.toString()}, remoteParentNotSampled=${this._remoteParentNotSampled.toString()}, localParentSampled=${this._localParentSampled.toString()}, localParentNotSampled=${this._localParentNotSampled.toString()}}`; + } +} +exports.ParentBasedSampler = ParentBasedSampler; +//# sourceMappingURL=ParentBasedSampler.js.map + +/***/ }), + +/***/ 87481: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.TraceIdRatioBasedSampler = void 0; +const api_1 = __nccwpck_require__(63914); +const Sampler_1 = __nccwpck_require__(56148); +/** Sampler that samples a given fraction of traces based of trace id deterministically. */ +class TraceIdRatioBasedSampler { + constructor(_ratio = 0) { + this._ratio = _ratio; + this._ratio = this._normalize(_ratio); + this._upperBound = Math.floor(this._ratio * 0xffffffff); + } + shouldSample(context, traceId) { + return { + decision: (0, api_1.isValidTraceId)(traceId) && this._accumulate(traceId) < this._upperBound + ? Sampler_1.SamplingDecision.RECORD_AND_SAMPLED + : Sampler_1.SamplingDecision.NOT_RECORD, + }; + } + toString() { + return `TraceIdRatioBased{${this._ratio}}`; + } + _normalize(ratio) { + if (typeof ratio !== 'number' || isNaN(ratio)) + return 0; + return ratio >= 1 ? 1 : ratio <= 0 ? 0 : ratio; + } + _accumulate(traceId) { + let accumulation = 0; + for (let i = 0; i < traceId.length / 8; i++) { + const pos = i * 8; + const part = parseInt(traceId.slice(pos, pos + 8), 16); + accumulation = (accumulation ^ part) >>> 0; + } + return accumulation; + } +} +exports.TraceIdRatioBasedSampler = TraceIdRatioBasedSampler; +//# sourceMappingURL=TraceIdRatioBasedSampler.js.map + +/***/ }), + +/***/ 29228: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.reconfigureLimits = exports.mergeConfig = void 0; +const config_1 = __nccwpck_require__(29884); +const core_1 = __nccwpck_require__(24637); +/** + * Function to merge Default configuration (as specified in './config') with + * user provided configurations. + */ +function mergeConfig(userConfig) { + const perInstanceDefaults = { + sampler: (0, config_1.buildSamplerFromEnv)(), + }; + const DEFAULT_CONFIG = (0, config_1.loadDefaultConfig)(); + const target = Object.assign({}, DEFAULT_CONFIG, perInstanceDefaults, userConfig); + target.generalLimits = Object.assign({}, DEFAULT_CONFIG.generalLimits, userConfig.generalLimits || {}); + target.spanLimits = Object.assign({}, DEFAULT_CONFIG.spanLimits, userConfig.spanLimits || {}); + return target; +} +exports.mergeConfig = mergeConfig; +/** + * When general limits are provided and model specific limits are not, + * configures the model specific limits by using the values from the general ones. + * @param userConfig User provided tracer configuration + */ +function reconfigureLimits(userConfig) { + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m; + const spanLimits = Object.assign({}, userConfig.spanLimits); + const parsedEnvConfig = (0, core_1.getEnvWithoutDefaults)(); + /** + * Reassign span attribute count limit to use first non null value defined by user or use default value + */ + spanLimits.attributeCountLimit = + (_f = (_e = (_d = (_b = (_a = userConfig.spanLimits) === null || _a === void 0 ? void 0 : _a.attributeCountLimit) !== null && _b !== void 0 ? _b : (_c = userConfig.generalLimits) === null || _c === void 0 ? void 0 : _c.attributeCountLimit) !== null && _d !== void 0 ? _d : parsedEnvConfig.OTEL_SPAN_ATTRIBUTE_COUNT_LIMIT) !== null && _e !== void 0 ? _e : parsedEnvConfig.OTEL_ATTRIBUTE_COUNT_LIMIT) !== null && _f !== void 0 ? _f : core_1.DEFAULT_ATTRIBUTE_COUNT_LIMIT; + /** + * Reassign span attribute value length limit to use first non null value defined by user or use default value + */ + spanLimits.attributeValueLengthLimit = + (_m = (_l = (_k = (_h = (_g = userConfig.spanLimits) === null || _g === void 0 ? void 0 : _g.attributeValueLengthLimit) !== null && _h !== void 0 ? _h : (_j = userConfig.generalLimits) === null || _j === void 0 ? void 0 : _j.attributeValueLengthLimit) !== null && _k !== void 0 ? _k : parsedEnvConfig.OTEL_SPAN_ATTRIBUTE_VALUE_LENGTH_LIMIT) !== null && _l !== void 0 ? _l : parsedEnvConfig.OTEL_ATTRIBUTE_VALUE_LENGTH_LIMIT) !== null && _m !== void 0 ? _m : core_1.DEFAULT_ATTRIBUTE_VALUE_LENGTH_LIMIT; + return Object.assign({}, userConfig, { spanLimits }); +} +exports.reconfigureLimits = reconfigureLimits; +//# sourceMappingURL=utility.js.map + +/***/ }), + +/***/ 61357: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +/* eslint-disable no-restricted-syntax -- + * These re-exports are only of constants, only two-levels deep, and + * should not cause problems for tree-shakers. + */ +// Deprecated. These are kept around for compatibility purposes +__exportStar(__nccwpck_require__(84351), exports); +__exportStar(__nccwpck_require__(35282), exports); +// Use these instead +__exportStar(__nccwpck_require__(34476), exports); +__exportStar(__nccwpck_require__(26652), exports); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 6346: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createConstMap = void 0; +/** + * Creates a const map from the given values + * @param values - An array of values to be used as keys and values in the map. + * @returns A populated version of the map with the values and keys derived from the values. + */ +/*#__NO_SIDE_EFFECTS__*/ +function createConstMap(values) { + // eslint-disable-next-line prefer-const, @typescript-eslint/no-explicit-any + let res = {}; + const len = values.length; + for (let lp = 0; lp < len; lp++) { + const val = values[lp]; + if (val) { + res[String(val).toUpperCase().replace(/[-.]/g, '_')] = val; + } + } + return res; +} +exports.createConstMap = createConstMap; +//# sourceMappingURL=utils.js.map + +/***/ }), + +/***/ 89933: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.SEMRESATTRS_K8S_STATEFULSET_NAME = exports.SEMRESATTRS_K8S_STATEFULSET_UID = exports.SEMRESATTRS_K8S_DEPLOYMENT_NAME = exports.SEMRESATTRS_K8S_DEPLOYMENT_UID = exports.SEMRESATTRS_K8S_REPLICASET_NAME = exports.SEMRESATTRS_K8S_REPLICASET_UID = exports.SEMRESATTRS_K8S_CONTAINER_NAME = exports.SEMRESATTRS_K8S_POD_NAME = exports.SEMRESATTRS_K8S_POD_UID = exports.SEMRESATTRS_K8S_NAMESPACE_NAME = exports.SEMRESATTRS_K8S_NODE_UID = exports.SEMRESATTRS_K8S_NODE_NAME = exports.SEMRESATTRS_K8S_CLUSTER_NAME = exports.SEMRESATTRS_HOST_IMAGE_VERSION = exports.SEMRESATTRS_HOST_IMAGE_ID = exports.SEMRESATTRS_HOST_IMAGE_NAME = exports.SEMRESATTRS_HOST_ARCH = exports.SEMRESATTRS_HOST_TYPE = exports.SEMRESATTRS_HOST_NAME = exports.SEMRESATTRS_HOST_ID = exports.SEMRESATTRS_FAAS_MAX_MEMORY = exports.SEMRESATTRS_FAAS_INSTANCE = exports.SEMRESATTRS_FAAS_VERSION = exports.SEMRESATTRS_FAAS_ID = exports.SEMRESATTRS_FAAS_NAME = exports.SEMRESATTRS_DEVICE_MODEL_NAME = exports.SEMRESATTRS_DEVICE_MODEL_IDENTIFIER = exports.SEMRESATTRS_DEVICE_ID = exports.SEMRESATTRS_DEPLOYMENT_ENVIRONMENT = exports.SEMRESATTRS_CONTAINER_IMAGE_TAG = exports.SEMRESATTRS_CONTAINER_IMAGE_NAME = exports.SEMRESATTRS_CONTAINER_RUNTIME = exports.SEMRESATTRS_CONTAINER_ID = exports.SEMRESATTRS_CONTAINER_NAME = exports.SEMRESATTRS_AWS_LOG_STREAM_ARNS = exports.SEMRESATTRS_AWS_LOG_STREAM_NAMES = exports.SEMRESATTRS_AWS_LOG_GROUP_ARNS = exports.SEMRESATTRS_AWS_LOG_GROUP_NAMES = exports.SEMRESATTRS_AWS_EKS_CLUSTER_ARN = exports.SEMRESATTRS_AWS_ECS_TASK_REVISION = exports.SEMRESATTRS_AWS_ECS_TASK_FAMILY = exports.SEMRESATTRS_AWS_ECS_TASK_ARN = exports.SEMRESATTRS_AWS_ECS_LAUNCHTYPE = exports.SEMRESATTRS_AWS_ECS_CLUSTER_ARN = exports.SEMRESATTRS_AWS_ECS_CONTAINER_ARN = exports.SEMRESATTRS_CLOUD_PLATFORM = exports.SEMRESATTRS_CLOUD_AVAILABILITY_ZONE = exports.SEMRESATTRS_CLOUD_REGION = exports.SEMRESATTRS_CLOUD_ACCOUNT_ID = exports.SEMRESATTRS_CLOUD_PROVIDER = void 0; +exports.CLOUDPLATFORMVALUES_GCP_COMPUTE_ENGINE = exports.CLOUDPLATFORMVALUES_AZURE_APP_SERVICE = exports.CLOUDPLATFORMVALUES_AZURE_FUNCTIONS = exports.CLOUDPLATFORMVALUES_AZURE_AKS = exports.CLOUDPLATFORMVALUES_AZURE_CONTAINER_INSTANCES = exports.CLOUDPLATFORMVALUES_AZURE_VM = exports.CLOUDPLATFORMVALUES_AWS_ELASTIC_BEANSTALK = exports.CLOUDPLATFORMVALUES_AWS_LAMBDA = exports.CLOUDPLATFORMVALUES_AWS_EKS = exports.CLOUDPLATFORMVALUES_AWS_ECS = exports.CLOUDPLATFORMVALUES_AWS_EC2 = exports.CLOUDPLATFORMVALUES_ALIBABA_CLOUD_FC = exports.CLOUDPLATFORMVALUES_ALIBABA_CLOUD_ECS = exports.CloudProviderValues = exports.CLOUDPROVIDERVALUES_GCP = exports.CLOUDPROVIDERVALUES_AZURE = exports.CLOUDPROVIDERVALUES_AWS = exports.CLOUDPROVIDERVALUES_ALIBABA_CLOUD = exports.SemanticResourceAttributes = exports.SEMRESATTRS_WEBENGINE_DESCRIPTION = exports.SEMRESATTRS_WEBENGINE_VERSION = exports.SEMRESATTRS_WEBENGINE_NAME = exports.SEMRESATTRS_TELEMETRY_AUTO_VERSION = exports.SEMRESATTRS_TELEMETRY_SDK_VERSION = exports.SEMRESATTRS_TELEMETRY_SDK_LANGUAGE = exports.SEMRESATTRS_TELEMETRY_SDK_NAME = exports.SEMRESATTRS_SERVICE_VERSION = exports.SEMRESATTRS_SERVICE_INSTANCE_ID = exports.SEMRESATTRS_SERVICE_NAMESPACE = exports.SEMRESATTRS_SERVICE_NAME = exports.SEMRESATTRS_PROCESS_RUNTIME_DESCRIPTION = exports.SEMRESATTRS_PROCESS_RUNTIME_VERSION = exports.SEMRESATTRS_PROCESS_RUNTIME_NAME = exports.SEMRESATTRS_PROCESS_OWNER = exports.SEMRESATTRS_PROCESS_COMMAND_ARGS = exports.SEMRESATTRS_PROCESS_COMMAND_LINE = exports.SEMRESATTRS_PROCESS_COMMAND = exports.SEMRESATTRS_PROCESS_EXECUTABLE_PATH = exports.SEMRESATTRS_PROCESS_EXECUTABLE_NAME = exports.SEMRESATTRS_PROCESS_PID = exports.SEMRESATTRS_OS_VERSION = exports.SEMRESATTRS_OS_NAME = exports.SEMRESATTRS_OS_DESCRIPTION = exports.SEMRESATTRS_OS_TYPE = exports.SEMRESATTRS_K8S_CRONJOB_NAME = exports.SEMRESATTRS_K8S_CRONJOB_UID = exports.SEMRESATTRS_K8S_JOB_NAME = exports.SEMRESATTRS_K8S_JOB_UID = exports.SEMRESATTRS_K8S_DAEMONSET_NAME = exports.SEMRESATTRS_K8S_DAEMONSET_UID = void 0; +exports.TelemetrySdkLanguageValues = exports.TELEMETRYSDKLANGUAGEVALUES_WEBJS = exports.TELEMETRYSDKLANGUAGEVALUES_RUBY = exports.TELEMETRYSDKLANGUAGEVALUES_PYTHON = exports.TELEMETRYSDKLANGUAGEVALUES_PHP = exports.TELEMETRYSDKLANGUAGEVALUES_NODEJS = exports.TELEMETRYSDKLANGUAGEVALUES_JAVA = exports.TELEMETRYSDKLANGUAGEVALUES_GO = exports.TELEMETRYSDKLANGUAGEVALUES_ERLANG = exports.TELEMETRYSDKLANGUAGEVALUES_DOTNET = exports.TELEMETRYSDKLANGUAGEVALUES_CPP = exports.OsTypeValues = exports.OSTYPEVALUES_Z_OS = exports.OSTYPEVALUES_SOLARIS = exports.OSTYPEVALUES_AIX = exports.OSTYPEVALUES_HPUX = exports.OSTYPEVALUES_DRAGONFLYBSD = exports.OSTYPEVALUES_OPENBSD = exports.OSTYPEVALUES_NETBSD = exports.OSTYPEVALUES_FREEBSD = exports.OSTYPEVALUES_DARWIN = exports.OSTYPEVALUES_LINUX = exports.OSTYPEVALUES_WINDOWS = exports.HostArchValues = exports.HOSTARCHVALUES_X86 = exports.HOSTARCHVALUES_PPC64 = exports.HOSTARCHVALUES_PPC32 = exports.HOSTARCHVALUES_IA64 = exports.HOSTARCHVALUES_ARM64 = exports.HOSTARCHVALUES_ARM32 = exports.HOSTARCHVALUES_AMD64 = exports.AwsEcsLaunchtypeValues = exports.AWSECSLAUNCHTYPEVALUES_FARGATE = exports.AWSECSLAUNCHTYPEVALUES_EC2 = exports.CloudPlatformValues = exports.CLOUDPLATFORMVALUES_GCP_APP_ENGINE = exports.CLOUDPLATFORMVALUES_GCP_CLOUD_FUNCTIONS = exports.CLOUDPLATFORMVALUES_GCP_KUBERNETES_ENGINE = exports.CLOUDPLATFORMVALUES_GCP_CLOUD_RUN = void 0; +const utils_1 = __nccwpck_require__(6346); +//---------------------------------------------------------------------------------------------------------- +// DO NOT EDIT, this is an Auto-generated file from scripts/semconv/templates//templates/SemanticAttributes.ts.j2 +//---------------------------------------------------------------------------------------------------------- +//---------------------------------------------------------------------------------------------------------- +// Constant values for SemanticResourceAttributes +//---------------------------------------------------------------------------------------------------------- +// Temporary local constants to assign to the individual exports and the namespaced version +// Required to avoid the namespace exports using the unminifiable export names for some package types +const TMP_CLOUD_PROVIDER = 'cloud.provider'; +const TMP_CLOUD_ACCOUNT_ID = 'cloud.account.id'; +const TMP_CLOUD_REGION = 'cloud.region'; +const TMP_CLOUD_AVAILABILITY_ZONE = 'cloud.availability_zone'; +const TMP_CLOUD_PLATFORM = 'cloud.platform'; +const TMP_AWS_ECS_CONTAINER_ARN = 'aws.ecs.container.arn'; +const TMP_AWS_ECS_CLUSTER_ARN = 'aws.ecs.cluster.arn'; +const TMP_AWS_ECS_LAUNCHTYPE = 'aws.ecs.launchtype'; +const TMP_AWS_ECS_TASK_ARN = 'aws.ecs.task.arn'; +const TMP_AWS_ECS_TASK_FAMILY = 'aws.ecs.task.family'; +const TMP_AWS_ECS_TASK_REVISION = 'aws.ecs.task.revision'; +const TMP_AWS_EKS_CLUSTER_ARN = 'aws.eks.cluster.arn'; +const TMP_AWS_LOG_GROUP_NAMES = 'aws.log.group.names'; +const TMP_AWS_LOG_GROUP_ARNS = 'aws.log.group.arns'; +const TMP_AWS_LOG_STREAM_NAMES = 'aws.log.stream.names'; +const TMP_AWS_LOG_STREAM_ARNS = 'aws.log.stream.arns'; +const TMP_CONTAINER_NAME = 'container.name'; +const TMP_CONTAINER_ID = 'container.id'; +const TMP_CONTAINER_RUNTIME = 'container.runtime'; +const TMP_CONTAINER_IMAGE_NAME = 'container.image.name'; +const TMP_CONTAINER_IMAGE_TAG = 'container.image.tag'; +const TMP_DEPLOYMENT_ENVIRONMENT = 'deployment.environment'; +const TMP_DEVICE_ID = 'device.id'; +const TMP_DEVICE_MODEL_IDENTIFIER = 'device.model.identifier'; +const TMP_DEVICE_MODEL_NAME = 'device.model.name'; +const TMP_FAAS_NAME = 'faas.name'; +const TMP_FAAS_ID = 'faas.id'; +const TMP_FAAS_VERSION = 'faas.version'; +const TMP_FAAS_INSTANCE = 'faas.instance'; +const TMP_FAAS_MAX_MEMORY = 'faas.max_memory'; +const TMP_HOST_ID = 'host.id'; +const TMP_HOST_NAME = 'host.name'; +const TMP_HOST_TYPE = 'host.type'; +const TMP_HOST_ARCH = 'host.arch'; +const TMP_HOST_IMAGE_NAME = 'host.image.name'; +const TMP_HOST_IMAGE_ID = 'host.image.id'; +const TMP_HOST_IMAGE_VERSION = 'host.image.version'; +const TMP_K8S_CLUSTER_NAME = 'k8s.cluster.name'; +const TMP_K8S_NODE_NAME = 'k8s.node.name'; +const TMP_K8S_NODE_UID = 'k8s.node.uid'; +const TMP_K8S_NAMESPACE_NAME = 'k8s.namespace.name'; +const TMP_K8S_POD_UID = 'k8s.pod.uid'; +const TMP_K8S_POD_NAME = 'k8s.pod.name'; +const TMP_K8S_CONTAINER_NAME = 'k8s.container.name'; +const TMP_K8S_REPLICASET_UID = 'k8s.replicaset.uid'; +const TMP_K8S_REPLICASET_NAME = 'k8s.replicaset.name'; +const TMP_K8S_DEPLOYMENT_UID = 'k8s.deployment.uid'; +const TMP_K8S_DEPLOYMENT_NAME = 'k8s.deployment.name'; +const TMP_K8S_STATEFULSET_UID = 'k8s.statefulset.uid'; +const TMP_K8S_STATEFULSET_NAME = 'k8s.statefulset.name'; +const TMP_K8S_DAEMONSET_UID = 'k8s.daemonset.uid'; +const TMP_K8S_DAEMONSET_NAME = 'k8s.daemonset.name'; +const TMP_K8S_JOB_UID = 'k8s.job.uid'; +const TMP_K8S_JOB_NAME = 'k8s.job.name'; +const TMP_K8S_CRONJOB_UID = 'k8s.cronjob.uid'; +const TMP_K8S_CRONJOB_NAME = 'k8s.cronjob.name'; +const TMP_OS_TYPE = 'os.type'; +const TMP_OS_DESCRIPTION = 'os.description'; +const TMP_OS_NAME = 'os.name'; +const TMP_OS_VERSION = 'os.version'; +const TMP_PROCESS_PID = 'process.pid'; +const TMP_PROCESS_EXECUTABLE_NAME = 'process.executable.name'; +const TMP_PROCESS_EXECUTABLE_PATH = 'process.executable.path'; +const TMP_PROCESS_COMMAND = 'process.command'; +const TMP_PROCESS_COMMAND_LINE = 'process.command_line'; +const TMP_PROCESS_COMMAND_ARGS = 'process.command_args'; +const TMP_PROCESS_OWNER = 'process.owner'; +const TMP_PROCESS_RUNTIME_NAME = 'process.runtime.name'; +const TMP_PROCESS_RUNTIME_VERSION = 'process.runtime.version'; +const TMP_PROCESS_RUNTIME_DESCRIPTION = 'process.runtime.description'; +const TMP_SERVICE_NAME = 'service.name'; +const TMP_SERVICE_NAMESPACE = 'service.namespace'; +const TMP_SERVICE_INSTANCE_ID = 'service.instance.id'; +const TMP_SERVICE_VERSION = 'service.version'; +const TMP_TELEMETRY_SDK_NAME = 'telemetry.sdk.name'; +const TMP_TELEMETRY_SDK_LANGUAGE = 'telemetry.sdk.language'; +const TMP_TELEMETRY_SDK_VERSION = 'telemetry.sdk.version'; +const TMP_TELEMETRY_AUTO_VERSION = 'telemetry.auto.version'; +const TMP_WEBENGINE_NAME = 'webengine.name'; +const TMP_WEBENGINE_VERSION = 'webengine.version'; +const TMP_WEBENGINE_DESCRIPTION = 'webengine.description'; +/** + * Name of the cloud provider. + * + * @deprecated Use ATTR_CLOUD_PROVIDER in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_CLOUD_PROVIDER = TMP_CLOUD_PROVIDER; +/** + * The cloud account ID the resource is assigned to. + * + * @deprecated Use ATTR_CLOUD_ACCOUNT_ID in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_CLOUD_ACCOUNT_ID = TMP_CLOUD_ACCOUNT_ID; +/** + * The geographical region the resource is running. Refer to your provider's docs to see the available regions, for example [Alibaba Cloud regions](https://www.alibabacloud.com/help/doc-detail/40654.htm), [AWS regions](https://aws.amazon.com/about-aws/global-infrastructure/regions_az/), [Azure regions](https://azure.microsoft.com/en-us/global-infrastructure/geographies/), or [Google Cloud regions](https://cloud.google.com/about/locations). + * + * @deprecated Use ATTR_CLOUD_REGION in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_CLOUD_REGION = TMP_CLOUD_REGION; +/** + * Cloud regions often have multiple, isolated locations known as zones to increase availability. Availability zone represents the zone where the resource is running. + * + * Note: Availability zones are called "zones" on Alibaba Cloud and Google Cloud. + * + * @deprecated Use ATTR_CLOUD_AVAILABILITY_ZONE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_CLOUD_AVAILABILITY_ZONE = TMP_CLOUD_AVAILABILITY_ZONE; +/** + * The cloud platform in use. + * + * Note: The prefix of the service SHOULD match the one specified in `cloud.provider`. + * + * @deprecated Use ATTR_CLOUD_PLATFORM in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_CLOUD_PLATFORM = TMP_CLOUD_PLATFORM; +/** + * The Amazon Resource Name (ARN) of an [ECS container instance](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/ECS_instances.html). + * + * @deprecated Use ATTR_AWS_ECS_CONTAINER_ARN in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_AWS_ECS_CONTAINER_ARN = TMP_AWS_ECS_CONTAINER_ARN; +/** + * The ARN of an [ECS cluster](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/clusters.html). + * + * @deprecated Use ATTR_AWS_ECS_CLUSTER_ARN in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_AWS_ECS_CLUSTER_ARN = TMP_AWS_ECS_CLUSTER_ARN; +/** + * The [launch type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) for an ECS task. + * + * @deprecated Use ATTR_AWS_ECS_LAUNCHTYPE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_AWS_ECS_LAUNCHTYPE = TMP_AWS_ECS_LAUNCHTYPE; +/** + * The ARN of an [ECS task definition](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/task_definitions.html). + * + * @deprecated Use ATTR_AWS_ECS_TASK_ARN in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_AWS_ECS_TASK_ARN = TMP_AWS_ECS_TASK_ARN; +/** + * The task definition family this task definition is a member of. + * + * @deprecated Use ATTR_AWS_ECS_TASK_FAMILY in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_AWS_ECS_TASK_FAMILY = TMP_AWS_ECS_TASK_FAMILY; +/** + * The revision for this task definition. + * + * @deprecated Use ATTR_AWS_ECS_TASK_REVISION in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_AWS_ECS_TASK_REVISION = TMP_AWS_ECS_TASK_REVISION; +/** + * The ARN of an EKS cluster. + * + * @deprecated Use ATTR_AWS_EKS_CLUSTER_ARN in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_AWS_EKS_CLUSTER_ARN = TMP_AWS_EKS_CLUSTER_ARN; +/** + * The name(s) of the AWS log group(s) an application is writing to. + * + * Note: Multiple log groups must be supported for cases like multi-container applications, where a single application has sidecar containers, and each write to their own log group. + * + * @deprecated Use ATTR_AWS_LOG_GROUP_NAMES in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_AWS_LOG_GROUP_NAMES = TMP_AWS_LOG_GROUP_NAMES; +/** + * The Amazon Resource Name(s) (ARN) of the AWS log group(s). + * + * Note: See the [log group ARN format documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). + * + * @deprecated Use ATTR_AWS_LOG_GROUP_ARNS in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_AWS_LOG_GROUP_ARNS = TMP_AWS_LOG_GROUP_ARNS; +/** + * The name(s) of the AWS log stream(s) an application is writing to. + * + * @deprecated Use ATTR_AWS_LOG_STREAM_NAMES in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_AWS_LOG_STREAM_NAMES = TMP_AWS_LOG_STREAM_NAMES; +/** + * The ARN(s) of the AWS log stream(s). + * + * Note: See the [log stream ARN format documentation](https://docs.aws.amazon.com/AmazonCloudWatch/latest/logs/iam-access-control-overview-cwl.html#CWL_ARN_Format). One log group can contain several log streams, so these ARNs necessarily identify both a log group and a log stream. + * + * @deprecated Use ATTR_AWS_LOG_STREAM_ARNS in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_AWS_LOG_STREAM_ARNS = TMP_AWS_LOG_STREAM_ARNS; +/** + * Container name. + * + * @deprecated Use ATTR_CONTAINER_NAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_CONTAINER_NAME = TMP_CONTAINER_NAME; +/** + * Container ID. Usually a UUID, as for example used to [identify Docker containers](https://docs.docker.com/engine/reference/run/#container-identification). The UUID might be abbreviated. + * + * @deprecated Use ATTR_CONTAINER_ID in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_CONTAINER_ID = TMP_CONTAINER_ID; +/** + * The container runtime managing this container. + * + * @deprecated Use ATTR_CONTAINER_RUNTIME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_CONTAINER_RUNTIME = TMP_CONTAINER_RUNTIME; +/** + * Name of the image the container was built on. + * + * @deprecated Use ATTR_CONTAINER_IMAGE_NAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_CONTAINER_IMAGE_NAME = TMP_CONTAINER_IMAGE_NAME; +/** + * Container image tag. + * + * @deprecated Use ATTR_CONTAINER_IMAGE_TAGS in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_CONTAINER_IMAGE_TAG = TMP_CONTAINER_IMAGE_TAG; +/** + * Name of the [deployment environment](https://en.wikipedia.org/wiki/Deployment_environment) (aka deployment tier). + * + * @deprecated Use ATTR_DEPLOYMENT_ENVIRONMENT in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_DEPLOYMENT_ENVIRONMENT = TMP_DEPLOYMENT_ENVIRONMENT; +/** + * A unique identifier representing the device. + * + * Note: The device identifier MUST only be defined using the values outlined below. This value is not an advertising identifier and MUST NOT be used as such. On iOS (Swift or Objective-C), this value MUST be equal to the [vendor identifier](https://developer.apple.com/documentation/uikit/uidevice/1620059-identifierforvendor). On Android (Java or Kotlin), this value MUST be equal to the Firebase Installation ID or a globally unique UUID which is persisted across sessions in your application. More information can be found [here](https://developer.android.com/training/articles/user-data-ids) on best practices and exact implementation details. Caution should be taken when storing personal data or anything which can identify a user. GDPR and data protection laws may apply, ensure you do your own due diligence. + * + * @deprecated Use ATTR_DEVICE_ID in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_DEVICE_ID = TMP_DEVICE_ID; +/** + * The model identifier for the device. + * + * Note: It's recommended this value represents a machine readable version of the model identifier rather than the market or consumer-friendly name of the device. + * + * @deprecated Use ATTR_DEVICE_MODEL_IDENTIFIER in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_DEVICE_MODEL_IDENTIFIER = TMP_DEVICE_MODEL_IDENTIFIER; +/** + * The marketing name for the device model. + * + * Note: It's recommended this value represents a human readable version of the device model rather than a machine readable alternative. + * + * @deprecated Use ATTR_DEVICE_MODEL_NAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_DEVICE_MODEL_NAME = TMP_DEVICE_MODEL_NAME; +/** + * The name of the single function that this runtime instance executes. + * + * Note: This is the name of the function as configured/deployed on the FaaS platform and is usually different from the name of the callback function (which may be stored in the [`code.namespace`/`code.function`](../../trace/semantic_conventions/span-general.md#source-code-attributes) span attributes). + * + * @deprecated Use ATTR_FAAS_NAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_FAAS_NAME = TMP_FAAS_NAME; +/** +* The unique ID of the single function that this runtime instance executes. +* +* Note: Depending on the cloud provider, use: + +* **AWS Lambda:** The function [ARN](https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). +Take care not to use the "invoked ARN" directly but replace any +[alias suffix](https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html) with the resolved function version, as the same runtime instance may be invokable with multiple +different aliases. +* **GCP:** The [URI of the resource](https://cloud.google.com/iam/docs/full-resource-names) +* **Azure:** The [Fully Qualified Resource ID](https://docs.microsoft.com/en-us/rest/api/resources/resources/get-by-id). + +On some providers, it may not be possible to determine the full ID at startup, +which is why this field cannot be made required. For example, on AWS the account ID +part of the ARN is not available without calling another AWS API +which may be deemed too slow for a short-running lambda function. +As an alternative, consider setting `faas.id` as a span attribute instead. +* +* @deprecated Use ATTR_CLOUD_RESOURCE_ID in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). +*/ +exports.SEMRESATTRS_FAAS_ID = TMP_FAAS_ID; +/** +* The immutable version of the function being executed. +* +* Note: Depending on the cloud provider and platform, use: + +* **AWS Lambda:** The [function version](https://docs.aws.amazon.com/lambda/latest/dg/configuration-versions.html) + (an integer represented as a decimal string). +* **Google Cloud Run:** The [revision](https://cloud.google.com/run/docs/managing/revisions) + (i.e., the function name plus the revision suffix). +* **Google Cloud Functions:** The value of the + [`K_REVISION` environment variable](https://cloud.google.com/functions/docs/env-var#runtime_environment_variables_set_automatically). +* **Azure Functions:** Not applicable. Do not set this attribute. +* +* @deprecated Use ATTR_FAAS_VERSION in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). +*/ +exports.SEMRESATTRS_FAAS_VERSION = TMP_FAAS_VERSION; +/** + * The execution environment ID as a string, that will be potentially reused for other invocations to the same function/function version. + * + * Note: * **AWS Lambda:** Use the (full) log stream name. + * + * @deprecated Use ATTR_FAAS_INSTANCE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_FAAS_INSTANCE = TMP_FAAS_INSTANCE; +/** + * The amount of memory available to the serverless function in MiB. + * + * Note: It's recommended to set this attribute since e.g. too little memory can easily stop a Java AWS Lambda function from working correctly. On AWS Lambda, the environment variable `AWS_LAMBDA_FUNCTION_MEMORY_SIZE` provides this information. + * + * @deprecated Use ATTR_FAAS_MAX_MEMORY in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_FAAS_MAX_MEMORY = TMP_FAAS_MAX_MEMORY; +/** + * Unique host ID. For Cloud, this must be the instance_id assigned by the cloud provider. + * + * @deprecated Use ATTR_HOST_ID in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_HOST_ID = TMP_HOST_ID; +/** + * Name of the host. On Unix systems, it may contain what the hostname command returns, or the fully qualified hostname, or another name specified by the user. + * + * @deprecated Use ATTR_HOST_NAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_HOST_NAME = TMP_HOST_NAME; +/** + * Type of host. For Cloud, this must be the machine type. + * + * @deprecated Use ATTR_HOST_TYPE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_HOST_TYPE = TMP_HOST_TYPE; +/** + * The CPU architecture the host system is running on. + * + * @deprecated Use ATTR_HOST_ARCH in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_HOST_ARCH = TMP_HOST_ARCH; +/** + * Name of the VM image or OS install the host was instantiated from. + * + * @deprecated Use ATTR_HOST_IMAGE_NAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_HOST_IMAGE_NAME = TMP_HOST_IMAGE_NAME; +/** + * VM image ID. For Cloud, this value is from the provider. + * + * @deprecated Use ATTR_HOST_IMAGE_ID in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_HOST_IMAGE_ID = TMP_HOST_IMAGE_ID; +/** + * The version string of the VM image as defined in [Version Attributes](README.md#version-attributes). + * + * @deprecated Use ATTR_HOST_IMAGE_VERSION in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_HOST_IMAGE_VERSION = TMP_HOST_IMAGE_VERSION; +/** + * The name of the cluster. + * + * @deprecated Use ATTR_K8S_CLUSTER_NAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_K8S_CLUSTER_NAME = TMP_K8S_CLUSTER_NAME; +/** + * The name of the Node. + * + * @deprecated Use ATTR_K8S_NODE_NAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_K8S_NODE_NAME = TMP_K8S_NODE_NAME; +/** + * The UID of the Node. + * + * @deprecated Use ATTR_K8S_NODE_UID in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_K8S_NODE_UID = TMP_K8S_NODE_UID; +/** + * The name of the namespace that the pod is running in. + * + * @deprecated Use ATTR_K8S_NAMESPACE_NAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_K8S_NAMESPACE_NAME = TMP_K8S_NAMESPACE_NAME; +/** + * The UID of the Pod. + * + * @deprecated Use ATTR_K8S_POD_UID in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_K8S_POD_UID = TMP_K8S_POD_UID; +/** + * The name of the Pod. + * + * @deprecated Use ATTR_K8S_POD_NAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_K8S_POD_NAME = TMP_K8S_POD_NAME; +/** + * The name of the Container in a Pod template. + * + * @deprecated Use ATTR_K8S_CONTAINER_NAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_K8S_CONTAINER_NAME = TMP_K8S_CONTAINER_NAME; +/** + * The UID of the ReplicaSet. + * + * @deprecated Use ATTR_K8S_REPLICASET_UID in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_K8S_REPLICASET_UID = TMP_K8S_REPLICASET_UID; +/** + * The name of the ReplicaSet. + * + * @deprecated Use ATTR_K8S_REPLICASET_NAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_K8S_REPLICASET_NAME = TMP_K8S_REPLICASET_NAME; +/** + * The UID of the Deployment. + * + * @deprecated Use ATTR_K8S_DEPLOYMENT_UID in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_K8S_DEPLOYMENT_UID = TMP_K8S_DEPLOYMENT_UID; +/** + * The name of the Deployment. + * + * @deprecated Use ATTR_K8S_DEPLOYMENT_NAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_K8S_DEPLOYMENT_NAME = TMP_K8S_DEPLOYMENT_NAME; +/** + * The UID of the StatefulSet. + * + * @deprecated Use ATTR_K8S_STATEFULSET_UID in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_K8S_STATEFULSET_UID = TMP_K8S_STATEFULSET_UID; +/** + * The name of the StatefulSet. + * + * @deprecated Use ATTR_K8S_STATEFULSET_NAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_K8S_STATEFULSET_NAME = TMP_K8S_STATEFULSET_NAME; +/** + * The UID of the DaemonSet. + * + * @deprecated Use ATTR_K8S_DAEMONSET_UID in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_K8S_DAEMONSET_UID = TMP_K8S_DAEMONSET_UID; +/** + * The name of the DaemonSet. + * + * @deprecated Use ATTR_K8S_DAEMONSET_NAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_K8S_DAEMONSET_NAME = TMP_K8S_DAEMONSET_NAME; +/** + * The UID of the Job. + * + * @deprecated Use ATTR_K8S_JOB_UID in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_K8S_JOB_UID = TMP_K8S_JOB_UID; +/** + * The name of the Job. + * + * @deprecated Use ATTR_K8S_JOB_NAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_K8S_JOB_NAME = TMP_K8S_JOB_NAME; +/** + * The UID of the CronJob. + * + * @deprecated Use ATTR_K8S_CRONJOB_UID in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_K8S_CRONJOB_UID = TMP_K8S_CRONJOB_UID; +/** + * The name of the CronJob. + * + * @deprecated Use ATTR_K8S_CRONJOB_NAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_K8S_CRONJOB_NAME = TMP_K8S_CRONJOB_NAME; +/** + * The operating system type. + * + * @deprecated Use ATTR_OS_TYPE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_OS_TYPE = TMP_OS_TYPE; +/** + * Human readable (not intended to be parsed) OS version information, like e.g. reported by `ver` or `lsb_release -a` commands. + * + * @deprecated Use ATTR_OS_DESCRIPTION in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_OS_DESCRIPTION = TMP_OS_DESCRIPTION; +/** + * Human readable operating system name. + * + * @deprecated Use ATTR_OS_NAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_OS_NAME = TMP_OS_NAME; +/** + * The version string of the operating system as defined in [Version Attributes](../../resource/semantic_conventions/README.md#version-attributes). + * + * @deprecated Use ATTR_OS_VERSION in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_OS_VERSION = TMP_OS_VERSION; +/** + * Process identifier (PID). + * + * @deprecated Use ATTR_PROCESS_PID in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_PROCESS_PID = TMP_PROCESS_PID; +/** + * The name of the process executable. On Linux based systems, can be set to the `Name` in `proc/[pid]/status`. On Windows, can be set to the base name of `GetProcessImageFileNameW`. + * + * @deprecated Use ATTR_PROCESS_EXECUTABLE_NAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_PROCESS_EXECUTABLE_NAME = TMP_PROCESS_EXECUTABLE_NAME; +/** + * The full path to the process executable. On Linux based systems, can be set to the target of `proc/[pid]/exe`. On Windows, can be set to the result of `GetProcessImageFileNameW`. + * + * @deprecated Use ATTR_PROCESS_EXECUTABLE_PATH in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_PROCESS_EXECUTABLE_PATH = TMP_PROCESS_EXECUTABLE_PATH; +/** + * The command used to launch the process (i.e. the command name). On Linux based systems, can be set to the zeroth string in `proc/[pid]/cmdline`. On Windows, can be set to the first parameter extracted from `GetCommandLineW`. + * + * @deprecated Use ATTR_PROCESS_COMMAND in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_PROCESS_COMMAND = TMP_PROCESS_COMMAND; +/** + * The full command used to launch the process as a single string representing the full command. On Windows, can be set to the result of `GetCommandLineW`. Do not set this if you have to assemble it just for monitoring; use `process.command_args` instead. + * + * @deprecated Use ATTR_PROCESS_COMMAND_LINE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_PROCESS_COMMAND_LINE = TMP_PROCESS_COMMAND_LINE; +/** + * All the command arguments (including the command/executable itself) as received by the process. On Linux-based systems (and some other Unixoid systems supporting procfs), can be set according to the list of null-delimited strings extracted from `proc/[pid]/cmdline`. For libc-based executables, this would be the full argv vector passed to `main`. + * + * @deprecated Use ATTR_PROCESS_COMMAND_ARGS in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_PROCESS_COMMAND_ARGS = TMP_PROCESS_COMMAND_ARGS; +/** + * The username of the user that owns the process. + * + * @deprecated Use ATTR_PROCESS_OWNER in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_PROCESS_OWNER = TMP_PROCESS_OWNER; +/** + * The name of the runtime of this process. For compiled native binaries, this SHOULD be the name of the compiler. + * + * @deprecated Use ATTR_PROCESS_RUNTIME_NAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_PROCESS_RUNTIME_NAME = TMP_PROCESS_RUNTIME_NAME; +/** + * The version of the runtime of this process, as returned by the runtime without modification. + * + * @deprecated Use ATTR_PROCESS_RUNTIME_VERSION in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_PROCESS_RUNTIME_VERSION = TMP_PROCESS_RUNTIME_VERSION; +/** + * An additional description about the runtime of the process, for example a specific vendor customization of the runtime environment. + * + * @deprecated Use ATTR_PROCESS_RUNTIME_DESCRIPTION in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_PROCESS_RUNTIME_DESCRIPTION = TMP_PROCESS_RUNTIME_DESCRIPTION; +/** + * Logical name of the service. + * + * Note: MUST be the same for all instances of horizontally scaled services. If the value was not specified, SDKs MUST fallback to `unknown_service:` concatenated with [`process.executable.name`](process.md#process), e.g. `unknown_service:bash`. If `process.executable.name` is not available, the value MUST be set to `unknown_service`. + * + * @deprecated Use ATTR_SERVICE_NAME. + */ +exports.SEMRESATTRS_SERVICE_NAME = TMP_SERVICE_NAME; +/** + * A namespace for `service.name`. + * + * Note: A string value having a meaning that helps to distinguish a group of services, for example the team name that owns a group of services. `service.name` is expected to be unique within the same namespace. If `service.namespace` is not specified in the Resource then `service.name` is expected to be unique for all services that have no explicit namespace defined (so the empty/unspecified namespace is simply one more valid namespace). Zero-length namespace string is assumed equal to unspecified namespace. + * + * @deprecated Use ATTR_SERVICE_NAMESPACE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_SERVICE_NAMESPACE = TMP_SERVICE_NAMESPACE; +/** + * The string ID of the service instance. + * + * Note: MUST be unique for each instance of the same `service.namespace,service.name` pair (in other words `service.namespace,service.name,service.instance.id` triplet MUST be globally unique). The ID helps to distinguish instances of the same service that exist at the same time (e.g. instances of a horizontally scaled service). It is preferable for the ID to be persistent and stay the same for the lifetime of the service instance, however it is acceptable that the ID is ephemeral and changes during important lifetime events for the service (e.g. service restarts). If the service has no inherent unique ID that can be used as the value of this attribute it is recommended to generate a random Version 1 or Version 4 RFC 4122 UUID (services aiming for reproducible UUIDs may also use Version 5, see RFC 4122 for more recommendations). + * + * @deprecated Use ATTR_SERVICE_INSTANCE_ID in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_SERVICE_INSTANCE_ID = TMP_SERVICE_INSTANCE_ID; +/** + * The version string of the service API or implementation. + * + * @deprecated Use ATTR_SERVICE_VERSION. + */ +exports.SEMRESATTRS_SERVICE_VERSION = TMP_SERVICE_VERSION; +/** + * The name of the telemetry SDK as defined above. + * + * @deprecated Use ATTR_TELEMETRY_SDK_NAME. + */ +exports.SEMRESATTRS_TELEMETRY_SDK_NAME = TMP_TELEMETRY_SDK_NAME; +/** + * The language of the telemetry SDK. + * + * @deprecated Use ATTR_TELEMETRY_SDK_LANGUAGE. + */ +exports.SEMRESATTRS_TELEMETRY_SDK_LANGUAGE = TMP_TELEMETRY_SDK_LANGUAGE; +/** + * The version string of the telemetry SDK. + * + * @deprecated Use ATTR_TELEMETRY_SDK_VERSION. + */ +exports.SEMRESATTRS_TELEMETRY_SDK_VERSION = TMP_TELEMETRY_SDK_VERSION; +/** + * The version string of the auto instrumentation agent, if used. + * + * @deprecated Use ATTR_TELEMETRY_DISTRO_VERSION in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_TELEMETRY_AUTO_VERSION = TMP_TELEMETRY_AUTO_VERSION; +/** + * The name of the web engine. + * + * @deprecated Use ATTR_WEBENGINE_NAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_WEBENGINE_NAME = TMP_WEBENGINE_NAME; +/** + * The version of the web engine. + * + * @deprecated Use ATTR_WEBENGINE_VERSION in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_WEBENGINE_VERSION = TMP_WEBENGINE_VERSION; +/** + * Additional description of the web engine (e.g. detailed version and edition information). + * + * @deprecated Use ATTR_WEBENGINE_DESCRIPTION in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMRESATTRS_WEBENGINE_DESCRIPTION = TMP_WEBENGINE_DESCRIPTION; +/** + * Create exported Value Map for SemanticResourceAttributes values + * @deprecated Use the SEMRESATTRS_XXXXX constants rather than the SemanticResourceAttributes.XXXXX for bundle minification + */ +exports.SemanticResourceAttributes = +/*#__PURE__*/ (0, utils_1.createConstMap)([ + TMP_CLOUD_PROVIDER, + TMP_CLOUD_ACCOUNT_ID, + TMP_CLOUD_REGION, + TMP_CLOUD_AVAILABILITY_ZONE, + TMP_CLOUD_PLATFORM, + TMP_AWS_ECS_CONTAINER_ARN, + TMP_AWS_ECS_CLUSTER_ARN, + TMP_AWS_ECS_LAUNCHTYPE, + TMP_AWS_ECS_TASK_ARN, + TMP_AWS_ECS_TASK_FAMILY, + TMP_AWS_ECS_TASK_REVISION, + TMP_AWS_EKS_CLUSTER_ARN, + TMP_AWS_LOG_GROUP_NAMES, + TMP_AWS_LOG_GROUP_ARNS, + TMP_AWS_LOG_STREAM_NAMES, + TMP_AWS_LOG_STREAM_ARNS, + TMP_CONTAINER_NAME, + TMP_CONTAINER_ID, + TMP_CONTAINER_RUNTIME, + TMP_CONTAINER_IMAGE_NAME, + TMP_CONTAINER_IMAGE_TAG, + TMP_DEPLOYMENT_ENVIRONMENT, + TMP_DEVICE_ID, + TMP_DEVICE_MODEL_IDENTIFIER, + TMP_DEVICE_MODEL_NAME, + TMP_FAAS_NAME, + TMP_FAAS_ID, + TMP_FAAS_VERSION, + TMP_FAAS_INSTANCE, + TMP_FAAS_MAX_MEMORY, + TMP_HOST_ID, + TMP_HOST_NAME, + TMP_HOST_TYPE, + TMP_HOST_ARCH, + TMP_HOST_IMAGE_NAME, + TMP_HOST_IMAGE_ID, + TMP_HOST_IMAGE_VERSION, + TMP_K8S_CLUSTER_NAME, + TMP_K8S_NODE_NAME, + TMP_K8S_NODE_UID, + TMP_K8S_NAMESPACE_NAME, + TMP_K8S_POD_UID, + TMP_K8S_POD_NAME, + TMP_K8S_CONTAINER_NAME, + TMP_K8S_REPLICASET_UID, + TMP_K8S_REPLICASET_NAME, + TMP_K8S_DEPLOYMENT_UID, + TMP_K8S_DEPLOYMENT_NAME, + TMP_K8S_STATEFULSET_UID, + TMP_K8S_STATEFULSET_NAME, + TMP_K8S_DAEMONSET_UID, + TMP_K8S_DAEMONSET_NAME, + TMP_K8S_JOB_UID, + TMP_K8S_JOB_NAME, + TMP_K8S_CRONJOB_UID, + TMP_K8S_CRONJOB_NAME, + TMP_OS_TYPE, + TMP_OS_DESCRIPTION, + TMP_OS_NAME, + TMP_OS_VERSION, + TMP_PROCESS_PID, + TMP_PROCESS_EXECUTABLE_NAME, + TMP_PROCESS_EXECUTABLE_PATH, + TMP_PROCESS_COMMAND, + TMP_PROCESS_COMMAND_LINE, + TMP_PROCESS_COMMAND_ARGS, + TMP_PROCESS_OWNER, + TMP_PROCESS_RUNTIME_NAME, + TMP_PROCESS_RUNTIME_VERSION, + TMP_PROCESS_RUNTIME_DESCRIPTION, + TMP_SERVICE_NAME, + TMP_SERVICE_NAMESPACE, + TMP_SERVICE_INSTANCE_ID, + TMP_SERVICE_VERSION, + TMP_TELEMETRY_SDK_NAME, + TMP_TELEMETRY_SDK_LANGUAGE, + TMP_TELEMETRY_SDK_VERSION, + TMP_TELEMETRY_AUTO_VERSION, + TMP_WEBENGINE_NAME, + TMP_WEBENGINE_VERSION, + TMP_WEBENGINE_DESCRIPTION, +]); +/* ---------------------------------------------------------------------------------------------------------- + * Constant values for CloudProviderValues enum definition + * + * Name of the cloud provider. + * ---------------------------------------------------------------------------------------------------------- */ +// Temporary local constants to assign to the individual exports and the namespaced version +// Required to avoid the namespace exports using the unminifiable export names for some package types +const TMP_CLOUDPROVIDERVALUES_ALIBABA_CLOUD = 'alibaba_cloud'; +const TMP_CLOUDPROVIDERVALUES_AWS = 'aws'; +const TMP_CLOUDPROVIDERVALUES_AZURE = 'azure'; +const TMP_CLOUDPROVIDERVALUES_GCP = 'gcp'; +/** + * Name of the cloud provider. + * + * @deprecated Use CLOUD_PROVIDER_VALUE_ALIBABA_CLOUD in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.CLOUDPROVIDERVALUES_ALIBABA_CLOUD = TMP_CLOUDPROVIDERVALUES_ALIBABA_CLOUD; +/** + * Name of the cloud provider. + * + * @deprecated Use CLOUD_PROVIDER_VALUE_AWS in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.CLOUDPROVIDERVALUES_AWS = TMP_CLOUDPROVIDERVALUES_AWS; +/** + * Name of the cloud provider. + * + * @deprecated Use CLOUD_PROVIDER_VALUE_AZURE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.CLOUDPROVIDERVALUES_AZURE = TMP_CLOUDPROVIDERVALUES_AZURE; +/** + * Name of the cloud provider. + * + * @deprecated Use CLOUD_PROVIDER_VALUE_GCP in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.CLOUDPROVIDERVALUES_GCP = TMP_CLOUDPROVIDERVALUES_GCP; +/** + * The constant map of values for CloudProviderValues. + * @deprecated Use the CLOUDPROVIDERVALUES_XXXXX constants rather than the CloudProviderValues.XXXXX for bundle minification. + */ +exports.CloudProviderValues = +/*#__PURE__*/ (0, utils_1.createConstMap)([ + TMP_CLOUDPROVIDERVALUES_ALIBABA_CLOUD, + TMP_CLOUDPROVIDERVALUES_AWS, + TMP_CLOUDPROVIDERVALUES_AZURE, + TMP_CLOUDPROVIDERVALUES_GCP, +]); +/* ---------------------------------------------------------------------------------------------------------- + * Constant values for CloudPlatformValues enum definition + * + * The cloud platform in use. + * + * Note: The prefix of the service SHOULD match the one specified in `cloud.provider`. + * ---------------------------------------------------------------------------------------------------------- */ +// Temporary local constants to assign to the individual exports and the namespaced version +// Required to avoid the namespace exports using the unminifiable export names for some package types +const TMP_CLOUDPLATFORMVALUES_ALIBABA_CLOUD_ECS = 'alibaba_cloud_ecs'; +const TMP_CLOUDPLATFORMVALUES_ALIBABA_CLOUD_FC = 'alibaba_cloud_fc'; +const TMP_CLOUDPLATFORMVALUES_AWS_EC2 = 'aws_ec2'; +const TMP_CLOUDPLATFORMVALUES_AWS_ECS = 'aws_ecs'; +const TMP_CLOUDPLATFORMVALUES_AWS_EKS = 'aws_eks'; +const TMP_CLOUDPLATFORMVALUES_AWS_LAMBDA = 'aws_lambda'; +const TMP_CLOUDPLATFORMVALUES_AWS_ELASTIC_BEANSTALK = 'aws_elastic_beanstalk'; +const TMP_CLOUDPLATFORMVALUES_AZURE_VM = 'azure_vm'; +const TMP_CLOUDPLATFORMVALUES_AZURE_CONTAINER_INSTANCES = 'azure_container_instances'; +const TMP_CLOUDPLATFORMVALUES_AZURE_AKS = 'azure_aks'; +const TMP_CLOUDPLATFORMVALUES_AZURE_FUNCTIONS = 'azure_functions'; +const TMP_CLOUDPLATFORMVALUES_AZURE_APP_SERVICE = 'azure_app_service'; +const TMP_CLOUDPLATFORMVALUES_GCP_COMPUTE_ENGINE = 'gcp_compute_engine'; +const TMP_CLOUDPLATFORMVALUES_GCP_CLOUD_RUN = 'gcp_cloud_run'; +const TMP_CLOUDPLATFORMVALUES_GCP_KUBERNETES_ENGINE = 'gcp_kubernetes_engine'; +const TMP_CLOUDPLATFORMVALUES_GCP_CLOUD_FUNCTIONS = 'gcp_cloud_functions'; +const TMP_CLOUDPLATFORMVALUES_GCP_APP_ENGINE = 'gcp_app_engine'; +/** + * The cloud platform in use. + * + * Note: The prefix of the service SHOULD match the one specified in `cloud.provider`. + * + * @deprecated Use CLOUD_PLATFORM_VALUE_ALIBABA_CLOUD_ECS in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.CLOUDPLATFORMVALUES_ALIBABA_CLOUD_ECS = TMP_CLOUDPLATFORMVALUES_ALIBABA_CLOUD_ECS; +/** + * The cloud platform in use. + * + * Note: The prefix of the service SHOULD match the one specified in `cloud.provider`. + * + * @deprecated Use CLOUD_PLATFORM_VALUE_ALIBABA_CLOUD_FC in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.CLOUDPLATFORMVALUES_ALIBABA_CLOUD_FC = TMP_CLOUDPLATFORMVALUES_ALIBABA_CLOUD_FC; +/** + * The cloud platform in use. + * + * Note: The prefix of the service SHOULD match the one specified in `cloud.provider`. + * + * @deprecated Use CLOUD_PLATFORM_VALUE_AWS_EC2 in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.CLOUDPLATFORMVALUES_AWS_EC2 = TMP_CLOUDPLATFORMVALUES_AWS_EC2; +/** + * The cloud platform in use. + * + * Note: The prefix of the service SHOULD match the one specified in `cloud.provider`. + * + * @deprecated Use CLOUD_PLATFORM_VALUE_AWS_ECS in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.CLOUDPLATFORMVALUES_AWS_ECS = TMP_CLOUDPLATFORMVALUES_AWS_ECS; +/** + * The cloud platform in use. + * + * Note: The prefix of the service SHOULD match the one specified in `cloud.provider`. + * + * @deprecated Use CLOUD_PLATFORM_VALUE_AWS_EKS in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.CLOUDPLATFORMVALUES_AWS_EKS = TMP_CLOUDPLATFORMVALUES_AWS_EKS; +/** + * The cloud platform in use. + * + * Note: The prefix of the service SHOULD match the one specified in `cloud.provider`. + * + * @deprecated Use CLOUD_PLATFORM_VALUE_AWS_LAMBDA in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.CLOUDPLATFORMVALUES_AWS_LAMBDA = TMP_CLOUDPLATFORMVALUES_AWS_LAMBDA; +/** + * The cloud platform in use. + * + * Note: The prefix of the service SHOULD match the one specified in `cloud.provider`. + * + * @deprecated Use CLOUD_PLATFORM_VALUE_AWS_ELASTIC_BEANSTALK in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.CLOUDPLATFORMVALUES_AWS_ELASTIC_BEANSTALK = TMP_CLOUDPLATFORMVALUES_AWS_ELASTIC_BEANSTALK; +/** + * The cloud platform in use. + * + * Note: The prefix of the service SHOULD match the one specified in `cloud.provider`. + * + * @deprecated Use CLOUD_PLATFORM_VALUE_AZURE_VM in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.CLOUDPLATFORMVALUES_AZURE_VM = TMP_CLOUDPLATFORMVALUES_AZURE_VM; +/** + * The cloud platform in use. + * + * Note: The prefix of the service SHOULD match the one specified in `cloud.provider`. + * + * @deprecated Use CLOUD_PLATFORM_VALUE_AZURE_CONTAINER_INSTANCES in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.CLOUDPLATFORMVALUES_AZURE_CONTAINER_INSTANCES = TMP_CLOUDPLATFORMVALUES_AZURE_CONTAINER_INSTANCES; +/** + * The cloud platform in use. + * + * Note: The prefix of the service SHOULD match the one specified in `cloud.provider`. + * + * @deprecated Use CLOUD_PLATFORM_VALUE_AZURE_AKS in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.CLOUDPLATFORMVALUES_AZURE_AKS = TMP_CLOUDPLATFORMVALUES_AZURE_AKS; +/** + * The cloud platform in use. + * + * Note: The prefix of the service SHOULD match the one specified in `cloud.provider`. + * + * @deprecated Use CLOUD_PLATFORM_VALUE_AZURE_FUNCTIONS in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.CLOUDPLATFORMVALUES_AZURE_FUNCTIONS = TMP_CLOUDPLATFORMVALUES_AZURE_FUNCTIONS; +/** + * The cloud platform in use. + * + * Note: The prefix of the service SHOULD match the one specified in `cloud.provider`. + * + * @deprecated Use CLOUD_PLATFORM_VALUE_AZURE_APP_SERVICE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.CLOUDPLATFORMVALUES_AZURE_APP_SERVICE = TMP_CLOUDPLATFORMVALUES_AZURE_APP_SERVICE; +/** + * The cloud platform in use. + * + * Note: The prefix of the service SHOULD match the one specified in `cloud.provider`. + * + * @deprecated Use CLOUD_PLATFORM_VALUE_GCP_COMPUTE_ENGINE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.CLOUDPLATFORMVALUES_GCP_COMPUTE_ENGINE = TMP_CLOUDPLATFORMVALUES_GCP_COMPUTE_ENGINE; +/** + * The cloud platform in use. + * + * Note: The prefix of the service SHOULD match the one specified in `cloud.provider`. + * + * @deprecated Use CLOUD_PLATFORM_VALUE_GCP_CLOUD_RUN in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.CLOUDPLATFORMVALUES_GCP_CLOUD_RUN = TMP_CLOUDPLATFORMVALUES_GCP_CLOUD_RUN; +/** + * The cloud platform in use. + * + * Note: The prefix of the service SHOULD match the one specified in `cloud.provider`. + * + * @deprecated Use CLOUD_PLATFORM_VALUE_GCP_KUBERNETES_ENGINE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.CLOUDPLATFORMVALUES_GCP_KUBERNETES_ENGINE = TMP_CLOUDPLATFORMVALUES_GCP_KUBERNETES_ENGINE; +/** + * The cloud platform in use. + * + * Note: The prefix of the service SHOULD match the one specified in `cloud.provider`. + * + * @deprecated Use CLOUD_PLATFORM_VALUE_GCP_CLOUD_FUNCTIONS in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.CLOUDPLATFORMVALUES_GCP_CLOUD_FUNCTIONS = TMP_CLOUDPLATFORMVALUES_GCP_CLOUD_FUNCTIONS; +/** + * The cloud platform in use. + * + * Note: The prefix of the service SHOULD match the one specified in `cloud.provider`. + * + * @deprecated Use CLOUD_PLATFORM_VALUE_GCP_APP_ENGINE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.CLOUDPLATFORMVALUES_GCP_APP_ENGINE = TMP_CLOUDPLATFORMVALUES_GCP_APP_ENGINE; +/** + * The constant map of values for CloudPlatformValues. + * @deprecated Use the CLOUDPLATFORMVALUES_XXXXX constants rather than the CloudPlatformValues.XXXXX for bundle minification. + */ +exports.CloudPlatformValues = +/*#__PURE__*/ (0, utils_1.createConstMap)([ + TMP_CLOUDPLATFORMVALUES_ALIBABA_CLOUD_ECS, + TMP_CLOUDPLATFORMVALUES_ALIBABA_CLOUD_FC, + TMP_CLOUDPLATFORMVALUES_AWS_EC2, + TMP_CLOUDPLATFORMVALUES_AWS_ECS, + TMP_CLOUDPLATFORMVALUES_AWS_EKS, + TMP_CLOUDPLATFORMVALUES_AWS_LAMBDA, + TMP_CLOUDPLATFORMVALUES_AWS_ELASTIC_BEANSTALK, + TMP_CLOUDPLATFORMVALUES_AZURE_VM, + TMP_CLOUDPLATFORMVALUES_AZURE_CONTAINER_INSTANCES, + TMP_CLOUDPLATFORMVALUES_AZURE_AKS, + TMP_CLOUDPLATFORMVALUES_AZURE_FUNCTIONS, + TMP_CLOUDPLATFORMVALUES_AZURE_APP_SERVICE, + TMP_CLOUDPLATFORMVALUES_GCP_COMPUTE_ENGINE, + TMP_CLOUDPLATFORMVALUES_GCP_CLOUD_RUN, + TMP_CLOUDPLATFORMVALUES_GCP_KUBERNETES_ENGINE, + TMP_CLOUDPLATFORMVALUES_GCP_CLOUD_FUNCTIONS, + TMP_CLOUDPLATFORMVALUES_GCP_APP_ENGINE, +]); +/* ---------------------------------------------------------------------------------------------------------- + * Constant values for AwsEcsLaunchtypeValues enum definition + * + * The [launch type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) for an ECS task. + * ---------------------------------------------------------------------------------------------------------- */ +// Temporary local constants to assign to the individual exports and the namespaced version +// Required to avoid the namespace exports using the unminifiable export names for some package types +const TMP_AWSECSLAUNCHTYPEVALUES_EC2 = 'ec2'; +const TMP_AWSECSLAUNCHTYPEVALUES_FARGATE = 'fargate'; +/** + * The [launch type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) for an ECS task. + * + * @deprecated Use AWS_ECS_LAUNCHTYPE_VALUE_EC2 in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.AWSECSLAUNCHTYPEVALUES_EC2 = TMP_AWSECSLAUNCHTYPEVALUES_EC2; +/** + * The [launch type](https://docs.aws.amazon.com/AmazonECS/latest/developerguide/launch_types.html) for an ECS task. + * + * @deprecated Use AWS_ECS_LAUNCHTYPE_VALUE_FARGATE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.AWSECSLAUNCHTYPEVALUES_FARGATE = TMP_AWSECSLAUNCHTYPEVALUES_FARGATE; +/** + * The constant map of values for AwsEcsLaunchtypeValues. + * @deprecated Use the AWSECSLAUNCHTYPEVALUES_XXXXX constants rather than the AwsEcsLaunchtypeValues.XXXXX for bundle minification. + */ +exports.AwsEcsLaunchtypeValues = +/*#__PURE__*/ (0, utils_1.createConstMap)([ + TMP_AWSECSLAUNCHTYPEVALUES_EC2, + TMP_AWSECSLAUNCHTYPEVALUES_FARGATE, +]); +/* ---------------------------------------------------------------------------------------------------------- + * Constant values for HostArchValues enum definition + * + * The CPU architecture the host system is running on. + * ---------------------------------------------------------------------------------------------------------- */ +// Temporary local constants to assign to the individual exports and the namespaced version +// Required to avoid the namespace exports using the unminifiable export names for some package types +const TMP_HOSTARCHVALUES_AMD64 = 'amd64'; +const TMP_HOSTARCHVALUES_ARM32 = 'arm32'; +const TMP_HOSTARCHVALUES_ARM64 = 'arm64'; +const TMP_HOSTARCHVALUES_IA64 = 'ia64'; +const TMP_HOSTARCHVALUES_PPC32 = 'ppc32'; +const TMP_HOSTARCHVALUES_PPC64 = 'ppc64'; +const TMP_HOSTARCHVALUES_X86 = 'x86'; +/** + * The CPU architecture the host system is running on. + * + * @deprecated Use HOST_ARCH_VALUE_AMD64 in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.HOSTARCHVALUES_AMD64 = TMP_HOSTARCHVALUES_AMD64; +/** + * The CPU architecture the host system is running on. + * + * @deprecated Use HOST_ARCH_VALUE_ARM32 in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.HOSTARCHVALUES_ARM32 = TMP_HOSTARCHVALUES_ARM32; +/** + * The CPU architecture the host system is running on. + * + * @deprecated Use HOST_ARCH_VALUE_ARM64 in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.HOSTARCHVALUES_ARM64 = TMP_HOSTARCHVALUES_ARM64; +/** + * The CPU architecture the host system is running on. + * + * @deprecated Use HOST_ARCH_VALUE_IA64 in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.HOSTARCHVALUES_IA64 = TMP_HOSTARCHVALUES_IA64; +/** + * The CPU architecture the host system is running on. + * + * @deprecated Use HOST_ARCH_VALUE_PPC32 in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.HOSTARCHVALUES_PPC32 = TMP_HOSTARCHVALUES_PPC32; +/** + * The CPU architecture the host system is running on. + * + * @deprecated Use HOST_ARCH_VALUE_PPC64 in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.HOSTARCHVALUES_PPC64 = TMP_HOSTARCHVALUES_PPC64; +/** + * The CPU architecture the host system is running on. + * + * @deprecated Use HOST_ARCH_VALUE_X86 in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.HOSTARCHVALUES_X86 = TMP_HOSTARCHVALUES_X86; +/** + * The constant map of values for HostArchValues. + * @deprecated Use the HOSTARCHVALUES_XXXXX constants rather than the HostArchValues.XXXXX for bundle minification. + */ +exports.HostArchValues = +/*#__PURE__*/ (0, utils_1.createConstMap)([ + TMP_HOSTARCHVALUES_AMD64, + TMP_HOSTARCHVALUES_ARM32, + TMP_HOSTARCHVALUES_ARM64, + TMP_HOSTARCHVALUES_IA64, + TMP_HOSTARCHVALUES_PPC32, + TMP_HOSTARCHVALUES_PPC64, + TMP_HOSTARCHVALUES_X86, +]); +/* ---------------------------------------------------------------------------------------------------------- + * Constant values for OsTypeValues enum definition + * + * The operating system type. + * ---------------------------------------------------------------------------------------------------------- */ +// Temporary local constants to assign to the individual exports and the namespaced version +// Required to avoid the namespace exports using the unminifiable export names for some package types +const TMP_OSTYPEVALUES_WINDOWS = 'windows'; +const TMP_OSTYPEVALUES_LINUX = 'linux'; +const TMP_OSTYPEVALUES_DARWIN = 'darwin'; +const TMP_OSTYPEVALUES_FREEBSD = 'freebsd'; +const TMP_OSTYPEVALUES_NETBSD = 'netbsd'; +const TMP_OSTYPEVALUES_OPENBSD = 'openbsd'; +const TMP_OSTYPEVALUES_DRAGONFLYBSD = 'dragonflybsd'; +const TMP_OSTYPEVALUES_HPUX = 'hpux'; +const TMP_OSTYPEVALUES_AIX = 'aix'; +const TMP_OSTYPEVALUES_SOLARIS = 'solaris'; +const TMP_OSTYPEVALUES_Z_OS = 'z_os'; +/** + * The operating system type. + * + * @deprecated Use OS_TYPE_VALUE_WINDOWS in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.OSTYPEVALUES_WINDOWS = TMP_OSTYPEVALUES_WINDOWS; +/** + * The operating system type. + * + * @deprecated Use OS_TYPE_VALUE_LINUX in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.OSTYPEVALUES_LINUX = TMP_OSTYPEVALUES_LINUX; +/** + * The operating system type. + * + * @deprecated Use OS_TYPE_VALUE_DARWIN in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.OSTYPEVALUES_DARWIN = TMP_OSTYPEVALUES_DARWIN; +/** + * The operating system type. + * + * @deprecated Use OS_TYPE_VALUE_FREEBSD in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.OSTYPEVALUES_FREEBSD = TMP_OSTYPEVALUES_FREEBSD; +/** + * The operating system type. + * + * @deprecated Use OS_TYPE_VALUE_NETBSD in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.OSTYPEVALUES_NETBSD = TMP_OSTYPEVALUES_NETBSD; +/** + * The operating system type. + * + * @deprecated Use OS_TYPE_VALUE_OPENBSD in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.OSTYPEVALUES_OPENBSD = TMP_OSTYPEVALUES_OPENBSD; +/** + * The operating system type. + * + * @deprecated Use OS_TYPE_VALUE_DRAGONFLYBSD in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.OSTYPEVALUES_DRAGONFLYBSD = TMP_OSTYPEVALUES_DRAGONFLYBSD; +/** + * The operating system type. + * + * @deprecated Use OS_TYPE_VALUE_HPUX in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.OSTYPEVALUES_HPUX = TMP_OSTYPEVALUES_HPUX; +/** + * The operating system type. + * + * @deprecated Use OS_TYPE_VALUE_AIX in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.OSTYPEVALUES_AIX = TMP_OSTYPEVALUES_AIX; +/** + * The operating system type. + * + * @deprecated Use OS_TYPE_VALUE_SOLARIS in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.OSTYPEVALUES_SOLARIS = TMP_OSTYPEVALUES_SOLARIS; +/** + * The operating system type. + * + * @deprecated Use OS_TYPE_VALUE_Z_OS in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.OSTYPEVALUES_Z_OS = TMP_OSTYPEVALUES_Z_OS; +/** + * The constant map of values for OsTypeValues. + * @deprecated Use the OSTYPEVALUES_XXXXX constants rather than the OsTypeValues.XXXXX for bundle minification. + */ +exports.OsTypeValues = +/*#__PURE__*/ (0, utils_1.createConstMap)([ + TMP_OSTYPEVALUES_WINDOWS, + TMP_OSTYPEVALUES_LINUX, + TMP_OSTYPEVALUES_DARWIN, + TMP_OSTYPEVALUES_FREEBSD, + TMP_OSTYPEVALUES_NETBSD, + TMP_OSTYPEVALUES_OPENBSD, + TMP_OSTYPEVALUES_DRAGONFLYBSD, + TMP_OSTYPEVALUES_HPUX, + TMP_OSTYPEVALUES_AIX, + TMP_OSTYPEVALUES_SOLARIS, + TMP_OSTYPEVALUES_Z_OS, +]); +/* ---------------------------------------------------------------------------------------------------------- + * Constant values for TelemetrySdkLanguageValues enum definition + * + * The language of the telemetry SDK. + * ---------------------------------------------------------------------------------------------------------- */ +// Temporary local constants to assign to the individual exports and the namespaced version +// Required to avoid the namespace exports using the unminifiable export names for some package types +const TMP_TELEMETRYSDKLANGUAGEVALUES_CPP = 'cpp'; +const TMP_TELEMETRYSDKLANGUAGEVALUES_DOTNET = 'dotnet'; +const TMP_TELEMETRYSDKLANGUAGEVALUES_ERLANG = 'erlang'; +const TMP_TELEMETRYSDKLANGUAGEVALUES_GO = 'go'; +const TMP_TELEMETRYSDKLANGUAGEVALUES_JAVA = 'java'; +const TMP_TELEMETRYSDKLANGUAGEVALUES_NODEJS = 'nodejs'; +const TMP_TELEMETRYSDKLANGUAGEVALUES_PHP = 'php'; +const TMP_TELEMETRYSDKLANGUAGEVALUES_PYTHON = 'python'; +const TMP_TELEMETRYSDKLANGUAGEVALUES_RUBY = 'ruby'; +const TMP_TELEMETRYSDKLANGUAGEVALUES_WEBJS = 'webjs'; +/** + * The language of the telemetry SDK. + * + * @deprecated Use TELEMETRY_SDK_LANGUAGE_VALUE_CPP. + */ +exports.TELEMETRYSDKLANGUAGEVALUES_CPP = TMP_TELEMETRYSDKLANGUAGEVALUES_CPP; +/** + * The language of the telemetry SDK. + * + * @deprecated Use TELEMETRY_SDK_LANGUAGE_VALUE_DOTNET. + */ +exports.TELEMETRYSDKLANGUAGEVALUES_DOTNET = TMP_TELEMETRYSDKLANGUAGEVALUES_DOTNET; +/** + * The language of the telemetry SDK. + * + * @deprecated Use TELEMETRY_SDK_LANGUAGE_VALUE_ERLANG. + */ +exports.TELEMETRYSDKLANGUAGEVALUES_ERLANG = TMP_TELEMETRYSDKLANGUAGEVALUES_ERLANG; +/** + * The language of the telemetry SDK. + * + * @deprecated Use TELEMETRY_SDK_LANGUAGE_VALUE_GO. + */ +exports.TELEMETRYSDKLANGUAGEVALUES_GO = TMP_TELEMETRYSDKLANGUAGEVALUES_GO; +/** + * The language of the telemetry SDK. + * + * @deprecated Use TELEMETRY_SDK_LANGUAGE_VALUE_JAVA. + */ +exports.TELEMETRYSDKLANGUAGEVALUES_JAVA = TMP_TELEMETRYSDKLANGUAGEVALUES_JAVA; +/** + * The language of the telemetry SDK. + * + * @deprecated Use TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS. + */ +exports.TELEMETRYSDKLANGUAGEVALUES_NODEJS = TMP_TELEMETRYSDKLANGUAGEVALUES_NODEJS; +/** + * The language of the telemetry SDK. + * + * @deprecated Use TELEMETRY_SDK_LANGUAGE_VALUE_PHP. + */ +exports.TELEMETRYSDKLANGUAGEVALUES_PHP = TMP_TELEMETRYSDKLANGUAGEVALUES_PHP; +/** + * The language of the telemetry SDK. + * + * @deprecated Use TELEMETRY_SDK_LANGUAGE_VALUE_PYTHON. + */ +exports.TELEMETRYSDKLANGUAGEVALUES_PYTHON = TMP_TELEMETRYSDKLANGUAGEVALUES_PYTHON; +/** + * The language of the telemetry SDK. + * + * @deprecated Use TELEMETRY_SDK_LANGUAGE_VALUE_RUBY. + */ +exports.TELEMETRYSDKLANGUAGEVALUES_RUBY = TMP_TELEMETRYSDKLANGUAGEVALUES_RUBY; +/** + * The language of the telemetry SDK. + * + * @deprecated Use TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS. + */ +exports.TELEMETRYSDKLANGUAGEVALUES_WEBJS = TMP_TELEMETRYSDKLANGUAGEVALUES_WEBJS; +/** + * The constant map of values for TelemetrySdkLanguageValues. + * @deprecated Use the TELEMETRYSDKLANGUAGEVALUES_XXXXX constants rather than the TelemetrySdkLanguageValues.XXXXX for bundle minification. + */ +exports.TelemetrySdkLanguageValues = +/*#__PURE__*/ (0, utils_1.createConstMap)([ + TMP_TELEMETRYSDKLANGUAGEVALUES_CPP, + TMP_TELEMETRYSDKLANGUAGEVALUES_DOTNET, + TMP_TELEMETRYSDKLANGUAGEVALUES_ERLANG, + TMP_TELEMETRYSDKLANGUAGEVALUES_GO, + TMP_TELEMETRYSDKLANGUAGEVALUES_JAVA, + TMP_TELEMETRYSDKLANGUAGEVALUES_NODEJS, + TMP_TELEMETRYSDKLANGUAGEVALUES_PHP, + TMP_TELEMETRYSDKLANGUAGEVALUES_PYTHON, + TMP_TELEMETRYSDKLANGUAGEVALUES_RUBY, + TMP_TELEMETRYSDKLANGUAGEVALUES_WEBJS, +]); +//# sourceMappingURL=SemanticResourceAttributes.js.map + +/***/ }), + +/***/ 35282: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +/* eslint-disable no-restricted-syntax -- + * These re-exports are only of constants, only one-level deep at this point, + * and should not cause problems for tree-shakers. + */ +__exportStar(__nccwpck_require__(89933), exports); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 34476: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.HTTP_REQUEST_METHOD_VALUE_POST = exports.HTTP_REQUEST_METHOD_VALUE_PATCH = exports.HTTP_REQUEST_METHOD_VALUE_OPTIONS = exports.HTTP_REQUEST_METHOD_VALUE_HEAD = exports.HTTP_REQUEST_METHOD_VALUE_GET = exports.HTTP_REQUEST_METHOD_VALUE_DELETE = exports.HTTP_REQUEST_METHOD_VALUE_CONNECT = exports.HTTP_REQUEST_METHOD_VALUE_OTHER = exports.ATTR_HTTP_REQUEST_METHOD = exports.ATTR_HTTP_REQUEST_HEADER = exports.ATTR_EXCEPTION_TYPE = exports.ATTR_EXCEPTION_STACKTRACE = exports.ATTR_EXCEPTION_MESSAGE = exports.ATTR_EXCEPTION_ESCAPED = exports.ERROR_TYPE_VALUE_OTHER = exports.ATTR_ERROR_TYPE = exports.ATTR_CLIENT_PORT = exports.ATTR_CLIENT_ADDRESS = exports.ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_SUCCESS = exports.ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_FAILURE = exports.ATTR_ASPNETCORE_ROUTING_MATCH_STATUS = exports.ATTR_ASPNETCORE_ROUTING_IS_FALLBACK = exports.ATTR_ASPNETCORE_REQUEST_IS_UNHANDLED = exports.ATTR_ASPNETCORE_RATE_LIMITING_POLICY = exports.ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_UNHANDLED = exports.ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_SKIPPED = exports.ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_HANDLED = exports.ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_ABORTED = exports.ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT = exports.ATTR_ASPNETCORE_DIAGNOSTICS_HANDLER_TYPE = exports.ATTR_TELEMETRY_SDK_VERSION = exports.ATTR_TELEMETRY_SDK_NAME = exports.TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS = exports.TELEMETRY_SDK_LANGUAGE_VALUE_SWIFT = exports.TELEMETRY_SDK_LANGUAGE_VALUE_RUST = exports.TELEMETRY_SDK_LANGUAGE_VALUE_RUBY = exports.TELEMETRY_SDK_LANGUAGE_VALUE_PYTHON = exports.TELEMETRY_SDK_LANGUAGE_VALUE_PHP = exports.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS = exports.TELEMETRY_SDK_LANGUAGE_VALUE_JAVA = exports.TELEMETRY_SDK_LANGUAGE_VALUE_GO = exports.TELEMETRY_SDK_LANGUAGE_VALUE_ERLANG = exports.TELEMETRY_SDK_LANGUAGE_VALUE_DOTNET = exports.TELEMETRY_SDK_LANGUAGE_VALUE_CPP = exports.ATTR_TELEMETRY_SDK_LANGUAGE = exports.ASPNETCORE_RATE_LIMITING_RESULT_VALUE_REQUEST_CANCELED = exports.ASPNETCORE_RATE_LIMITING_RESULT_VALUE_GLOBAL_LIMITER = exports.ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ENDPOINT_LIMITER = exports.ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ACQUIRED = exports.ATTR_ASPNETCORE_RATE_LIMITING_RESULT = void 0; +exports.SIGNALR_CONNECTION_STATUS_VALUE_TIMEOUT = exports.SIGNALR_CONNECTION_STATUS_VALUE_NORMAL_CLOSURE = exports.SIGNALR_CONNECTION_STATUS_VALUE_APP_SHUTDOWN = exports.ATTR_SIGNALR_CONNECTION_STATUS = exports.ATTR_SERVICE_VERSION = exports.ATTR_SERVICE_NAME = exports.ATTR_SERVER_PORT = exports.ATTR_SERVER_ADDRESS = exports.ATTR_OTEL_STATUS_DESCRIPTION = exports.OTEL_STATUS_CODE_VALUE_OK = exports.OTEL_STATUS_CODE_VALUE_ERROR = exports.ATTR_OTEL_STATUS_CODE = exports.ATTR_OTEL_SCOPE_VERSION = exports.ATTR_OTEL_SCOPE_NAME = exports.NETWORK_TYPE_VALUE_IPV6 = exports.NETWORK_TYPE_VALUE_IPV4 = exports.ATTR_NETWORK_TYPE = exports.NETWORK_TRANSPORT_VALUE_UNIX = exports.NETWORK_TRANSPORT_VALUE_UDP = exports.NETWORK_TRANSPORT_VALUE_TCP = exports.NETWORK_TRANSPORT_VALUE_QUIC = exports.NETWORK_TRANSPORT_VALUE_PIPE = exports.ATTR_NETWORK_TRANSPORT = exports.ATTR_NETWORK_PROTOCOL_VERSION = exports.ATTR_NETWORK_PROTOCOL_NAME = exports.ATTR_NETWORK_PEER_PORT = exports.ATTR_NETWORK_PEER_ADDRESS = exports.ATTR_NETWORK_LOCAL_PORT = exports.ATTR_NETWORK_LOCAL_ADDRESS = exports.JVM_THREAD_STATE_VALUE_WAITING = exports.JVM_THREAD_STATE_VALUE_TIMED_WAITING = exports.JVM_THREAD_STATE_VALUE_TERMINATED = exports.JVM_THREAD_STATE_VALUE_RUNNABLE = exports.JVM_THREAD_STATE_VALUE_NEW = exports.JVM_THREAD_STATE_VALUE_BLOCKED = exports.ATTR_JVM_THREAD_STATE = exports.ATTR_JVM_THREAD_DAEMON = exports.JVM_MEMORY_TYPE_VALUE_NON_HEAP = exports.JVM_MEMORY_TYPE_VALUE_HEAP = exports.ATTR_JVM_MEMORY_TYPE = exports.ATTR_JVM_MEMORY_POOL_NAME = exports.ATTR_JVM_GC_NAME = exports.ATTR_JVM_GC_ACTION = exports.ATTR_HTTP_ROUTE = exports.ATTR_HTTP_RESPONSE_STATUS_CODE = exports.ATTR_HTTP_RESPONSE_HEADER = exports.ATTR_HTTP_REQUEST_RESEND_COUNT = exports.ATTR_HTTP_REQUEST_METHOD_ORIGINAL = exports.HTTP_REQUEST_METHOD_VALUE_TRACE = exports.HTTP_REQUEST_METHOD_VALUE_PUT = void 0; +exports.ATTR_USER_AGENT_ORIGINAL = exports.ATTR_URL_SCHEME = exports.ATTR_URL_QUERY = exports.ATTR_URL_PATH = exports.ATTR_URL_FULL = exports.ATTR_URL_FRAGMENT = exports.SIGNALR_TRANSPORT_VALUE_WEB_SOCKETS = exports.SIGNALR_TRANSPORT_VALUE_SERVER_SENT_EVENTS = exports.SIGNALR_TRANSPORT_VALUE_LONG_POLLING = exports.ATTR_SIGNALR_TRANSPORT = void 0; +//---------------------------------------------------------------------------------------------------------- +// DO NOT EDIT, this is an Auto-generated file from scripts/semconv/templates/registry/stable/attributes.ts.j2 +//---------------------------------------------------------------------------------------------------------- +/** + * Rate-limiting result, shows whether the lease was acquired or contains a rejection reason + * + * @example acquired + * @example request_canceled + */ +exports.ATTR_ASPNETCORE_RATE_LIMITING_RESULT = 'aspnetcore.rate_limiting.result'; +/** + * Enum value "acquired" for attribute {@link ATTR_ASPNETCORE_RATE_LIMITING_RESULT}. + */ +exports.ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ACQUIRED = "acquired"; +/** + * Enum value "endpoint_limiter" for attribute {@link ATTR_ASPNETCORE_RATE_LIMITING_RESULT}. + */ +exports.ASPNETCORE_RATE_LIMITING_RESULT_VALUE_ENDPOINT_LIMITER = "endpoint_limiter"; +/** + * Enum value "global_limiter" for attribute {@link ATTR_ASPNETCORE_RATE_LIMITING_RESULT}. + */ +exports.ASPNETCORE_RATE_LIMITING_RESULT_VALUE_GLOBAL_LIMITER = "global_limiter"; +/** + * Enum value "request_canceled" for attribute {@link ATTR_ASPNETCORE_RATE_LIMITING_RESULT}. + */ +exports.ASPNETCORE_RATE_LIMITING_RESULT_VALUE_REQUEST_CANCELED = "request_canceled"; +/** + * The language of the telemetry SDK. + */ +exports.ATTR_TELEMETRY_SDK_LANGUAGE = 'telemetry.sdk.language'; +/** + * Enum value "cpp" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}. + */ +exports.TELEMETRY_SDK_LANGUAGE_VALUE_CPP = "cpp"; +/** + * Enum value "dotnet" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}. + */ +exports.TELEMETRY_SDK_LANGUAGE_VALUE_DOTNET = "dotnet"; +/** + * Enum value "erlang" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}. + */ +exports.TELEMETRY_SDK_LANGUAGE_VALUE_ERLANG = "erlang"; +/** + * Enum value "go" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}. + */ +exports.TELEMETRY_SDK_LANGUAGE_VALUE_GO = "go"; +/** + * Enum value "java" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}. + */ +exports.TELEMETRY_SDK_LANGUAGE_VALUE_JAVA = "java"; +/** + * Enum value "nodejs" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}. + */ +exports.TELEMETRY_SDK_LANGUAGE_VALUE_NODEJS = "nodejs"; +/** + * Enum value "php" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}. + */ +exports.TELEMETRY_SDK_LANGUAGE_VALUE_PHP = "php"; +/** + * Enum value "python" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}. + */ +exports.TELEMETRY_SDK_LANGUAGE_VALUE_PYTHON = "python"; +/** + * Enum value "ruby" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}. + */ +exports.TELEMETRY_SDK_LANGUAGE_VALUE_RUBY = "ruby"; +/** + * Enum value "rust" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}. + */ +exports.TELEMETRY_SDK_LANGUAGE_VALUE_RUST = "rust"; +/** + * Enum value "swift" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}. + */ +exports.TELEMETRY_SDK_LANGUAGE_VALUE_SWIFT = "swift"; +/** + * Enum value "webjs" for attribute {@link ATTR_TELEMETRY_SDK_LANGUAGE}. + */ +exports.TELEMETRY_SDK_LANGUAGE_VALUE_WEBJS = "webjs"; +/** + * The name of the telemetry SDK as defined above. + * + * @example opentelemetry + * + * @note The OpenTelemetry SDK **MUST** set the `telemetry.sdk.name` attribute to `opentelemetry`. + * If another SDK, like a fork or a vendor-provided implementation, is used, this SDK **MUST** set the + * `telemetry.sdk.name` attribute to the fully-qualified class or module name of this SDK's main entry point + * or another suitable identifier depending on the language. + * The identifier `opentelemetry` is reserved and **MUST NOT** be used in this case. + * All custom identifiers **SHOULD** be stable across different versions of an implementation. + */ +exports.ATTR_TELEMETRY_SDK_NAME = 'telemetry.sdk.name'; +/** + * The version string of the telemetry SDK. + * + * @example 1.2.3 + */ +exports.ATTR_TELEMETRY_SDK_VERSION = 'telemetry.sdk.version'; +/** + * Full type name of the [`IExceptionHandler`](https://learn.microsoft.com/dotnet/api/microsoft.aspnetcore.diagnostics.iexceptionhandler) implementation that handled the exception. + * + * @example Contoso.MyHandler + */ +exports.ATTR_ASPNETCORE_DIAGNOSTICS_HANDLER_TYPE = 'aspnetcore.diagnostics.handler.type'; +/** + * ASP.NET Core exception middleware handling result + * + * @example handled + * @example unhandled + */ +exports.ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT = 'aspnetcore.diagnostics.exception.result'; +/** + * Enum value "aborted" for attribute {@link ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT}. + */ +exports.ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_ABORTED = "aborted"; +/** + * Enum value "handled" for attribute {@link ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT}. + */ +exports.ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_HANDLED = "handled"; +/** + * Enum value "skipped" for attribute {@link ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT}. + */ +exports.ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_SKIPPED = "skipped"; +/** + * Enum value "unhandled" for attribute {@link ATTR_ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT}. + */ +exports.ASPNETCORE_DIAGNOSTICS_EXCEPTION_RESULT_VALUE_UNHANDLED = "unhandled"; +/** + * Rate limiting policy name. + * + * @example fixed + * @example sliding + * @example token + */ +exports.ATTR_ASPNETCORE_RATE_LIMITING_POLICY = 'aspnetcore.rate_limiting.policy'; +/** + * Flag indicating if request was handled by the application pipeline. + * + * @example true + */ +exports.ATTR_ASPNETCORE_REQUEST_IS_UNHANDLED = 'aspnetcore.request.is_unhandled'; +/** + * A value that indicates whether the matched route is a fallback route. + * + * @example true + */ +exports.ATTR_ASPNETCORE_ROUTING_IS_FALLBACK = 'aspnetcore.routing.is_fallback'; +/** + * Match result - success or failure + * + * @example success + * @example failure + */ +exports.ATTR_ASPNETCORE_ROUTING_MATCH_STATUS = 'aspnetcore.routing.match_status'; +/** + * Enum value "failure" for attribute {@link ATTR_ASPNETCORE_ROUTING_MATCH_STATUS}. + */ +exports.ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_FAILURE = "failure"; +/** + * Enum value "success" for attribute {@link ATTR_ASPNETCORE_ROUTING_MATCH_STATUS}. + */ +exports.ASPNETCORE_ROUTING_MATCH_STATUS_VALUE_SUCCESS = "success"; +/** + * Client address - domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. + * + * @example client.example.com + * @example 10.1.2.80 + * @example /tmp/my.sock + * + * @note When observed from the server side, and when communicating through an intermediary, `client.address` **SHOULD** represent the client address behind any intermediaries, for example proxies, if it's available. + */ +exports.ATTR_CLIENT_ADDRESS = 'client.address'; +/** + * Client port number. + * + * @example 65123 + * + * @note When observed from the server side, and when communicating through an intermediary, `client.port` **SHOULD** represent the client port behind any intermediaries, for example proxies, if it's available. + */ +exports.ATTR_CLIENT_PORT = 'client.port'; +/** + * Describes a class of error the operation ended with. + * + * @example timeout + * @example java.net.UnknownHostException + * @example server_certificate_invalid + * @example 500 + * + * @note The `error.type` **SHOULD** be predictable, and **SHOULD** have low cardinality. + * + * When `error.type` is set to a type (e.g., an exception type), its + * canonical class name identifying the type within the artifact **SHOULD** be used. + * + * Instrumentations **SHOULD** document the list of errors they report. + * + * The cardinality of `error.type` within one instrumentation library **SHOULD** be low. + * Telemetry consumers that aggregate data from multiple instrumentation libraries and applications + * should be prepared for `error.type` to have high cardinality at query time when no + * additional filters are applied. + * + * If the operation has completed successfully, instrumentations **SHOULD NOT** set `error.type`. + * + * If a specific domain defines its own set of error identifiers (such as HTTP or gRPC status codes), + * it's **RECOMMENDED** to: + * + * - Use a domain-specific attribute + * - Set `error.type` to capture all errors, regardless of whether they are defined within the domain-specific set or not. + */ +exports.ATTR_ERROR_TYPE = 'error.type'; +/** + * Enum value "_OTHER" for attribute {@link ATTR_ERROR_TYPE}. + */ +exports.ERROR_TYPE_VALUE_OTHER = "_OTHER"; +/** + * **SHOULD** be set to true if the exception event is recorded at a point where it is known that the exception is escaping the scope of the span. + * + * @note An exception is considered to have escaped (or left) the scope of a span, + * if that span is ended while the exception is still logically "in flight". + * This may be actually "in flight" in some languages (e.g. if the exception + * is passed to a Context manager's `__exit__` method in Python) but will + * usually be caught at the point of recording the exception in most languages. + * + * It is usually not possible to determine at the point where an exception is thrown + * whether it will escape the scope of a span. + * However, it is trivial to know that an exception + * will escape, if one checks for an active exception just before ending the span, + * as done in the [example for recording span exceptions](https://opentelemetry.io/docs/specs/semconv/exceptions/exceptions-spans/#recording-an-exception). + * + * It follows that an exception may still escape the scope of the span + * even if the `exception.escaped` attribute was not set or set to false, + * since the event might have been recorded at a time where it was not + * clear whether the exception will escape. + */ +exports.ATTR_EXCEPTION_ESCAPED = 'exception.escaped'; +/** + * The exception message. + * + * @example Division by zero + * @example Can't convert 'int' object to str implicitly + */ +exports.ATTR_EXCEPTION_MESSAGE = 'exception.message'; +/** + * A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG. + * + * @example "Exception in thread "main" java.lang.RuntimeException: Test exception\\n at com.example.GenerateTrace.methodB(GenerateTrace.java:13)\\n at com.example.GenerateTrace.methodA(GenerateTrace.java:9)\\n at com.example.GenerateTrace.main(GenerateTrace.java:5)\\n" + */ +exports.ATTR_EXCEPTION_STACKTRACE = 'exception.stacktrace'; +/** + * The type of the exception (its fully-qualified class name, if applicable). The dynamic type of the exception should be preferred over the static type in languages that support it. + * + * @example java.net.ConnectException + * @example OSError + */ +exports.ATTR_EXCEPTION_TYPE = 'exception.type'; +/** + * HTTP request headers, `` being the normalized HTTP Header name (lowercase), the value being the header values. + * + * @example http.request.header.content-type=["application/json"] + * @example http.request.header.x-forwarded-for=["1.2.3.4", "1.2.3.5"] + * + * @note Instrumentations **SHOULD** require an explicit configuration of which headers are to be captured. Including all request headers can be a security risk - explicit configuration helps avoid leaking sensitive information. + * The `User-Agent` header is already captured in the `user_agent.original` attribute. Users **MAY** explicitly configure instrumentations to capture them even though it is not recommended. + * The attribute value **MUST** consist of either multiple header values as an array of strings or a single-item array containing a possibly comma-concatenated string, depending on the way the HTTP library provides access to headers. + */ +const ATTR_HTTP_REQUEST_HEADER = (key) => `http.request.header.${key}`; +exports.ATTR_HTTP_REQUEST_HEADER = ATTR_HTTP_REQUEST_HEADER; +/** + * HTTP request method. + * + * @example GET + * @example POST + * @example HEAD + * + * @note HTTP request method value **SHOULD** be "known" to the instrumentation. + * By default, this convention defines "known" methods as the ones listed in [RFC9110](https://www.rfc-editor.org/rfc/rfc9110.html#name-methods) + * and the PATCH method defined in [RFC5789](https://www.rfc-editor.org/rfc/rfc5789.html). + * + * If the HTTP request method is not known to instrumentation, it **MUST** set the `http.request.method` attribute to `_OTHER`. + * + * If the HTTP instrumentation could end up converting valid HTTP request methods to `_OTHER`, then it **MUST** provide a way to override + * the list of known HTTP methods. If this override is done via environment variable, then the environment variable **MUST** be named + * OTEL_INSTRUMENTATION_HTTP_KNOWN_METHODS and support a comma-separated list of case-sensitive known HTTP methods + * (this list **MUST** be a full override of the default known method, it is not a list of known methods in addition to the defaults). + * + * HTTP method names are case-sensitive and `http.request.method` attribute value **MUST** match a known HTTP method name exactly. + * Instrumentations for specific web frameworks that consider HTTP methods to be case insensitive, **SHOULD** populate a canonical equivalent. + * Tracing instrumentations that do so, **MUST** also set `http.request.method_original` to the original value. + */ +exports.ATTR_HTTP_REQUEST_METHOD = 'http.request.method'; +/** + * Enum value "_OTHER" for attribute {@link ATTR_HTTP_REQUEST_METHOD}. + */ +exports.HTTP_REQUEST_METHOD_VALUE_OTHER = "_OTHER"; +/** + * Enum value "CONNECT" for attribute {@link ATTR_HTTP_REQUEST_METHOD}. + */ +exports.HTTP_REQUEST_METHOD_VALUE_CONNECT = "CONNECT"; +/** + * Enum value "DELETE" for attribute {@link ATTR_HTTP_REQUEST_METHOD}. + */ +exports.HTTP_REQUEST_METHOD_VALUE_DELETE = "DELETE"; +/** + * Enum value "GET" for attribute {@link ATTR_HTTP_REQUEST_METHOD}. + */ +exports.HTTP_REQUEST_METHOD_VALUE_GET = "GET"; +/** + * Enum value "HEAD" for attribute {@link ATTR_HTTP_REQUEST_METHOD}. + */ +exports.HTTP_REQUEST_METHOD_VALUE_HEAD = "HEAD"; +/** + * Enum value "OPTIONS" for attribute {@link ATTR_HTTP_REQUEST_METHOD}. + */ +exports.HTTP_REQUEST_METHOD_VALUE_OPTIONS = "OPTIONS"; +/** + * Enum value "PATCH" for attribute {@link ATTR_HTTP_REQUEST_METHOD}. + */ +exports.HTTP_REQUEST_METHOD_VALUE_PATCH = "PATCH"; +/** + * Enum value "POST" for attribute {@link ATTR_HTTP_REQUEST_METHOD}. + */ +exports.HTTP_REQUEST_METHOD_VALUE_POST = "POST"; +/** + * Enum value "PUT" for attribute {@link ATTR_HTTP_REQUEST_METHOD}. + */ +exports.HTTP_REQUEST_METHOD_VALUE_PUT = "PUT"; +/** + * Enum value "TRACE" for attribute {@link ATTR_HTTP_REQUEST_METHOD}. + */ +exports.HTTP_REQUEST_METHOD_VALUE_TRACE = "TRACE"; +/** + * Original HTTP method sent by the client in the request line. + * + * @example GeT + * @example ACL + * @example foo + */ +exports.ATTR_HTTP_REQUEST_METHOD_ORIGINAL = 'http.request.method_original'; +/** + * The ordinal number of request resending attempt (for any reason, including redirects). + * + * @example 3 + * + * @note The resend count **SHOULD** be updated each time an HTTP request gets resent by the client, regardless of what was the cause of the resending (e.g. redirection, authorization failure, 503 Server Unavailable, network issues, or any other). + */ +exports.ATTR_HTTP_REQUEST_RESEND_COUNT = 'http.request.resend_count'; +/** + * HTTP response headers, `` being the normalized HTTP Header name (lowercase), the value being the header values. + * + * @example http.response.header.content-type=["application/json"] + * @example http.response.header.my-custom-header=["abc", "def"] + * + * @note Instrumentations **SHOULD** require an explicit configuration of which headers are to be captured. Including all response headers can be a security risk - explicit configuration helps avoid leaking sensitive information. + * Users **MAY** explicitly configure instrumentations to capture them even though it is not recommended. + * The attribute value **MUST** consist of either multiple header values as an array of strings or a single-item array containing a possibly comma-concatenated string, depending on the way the HTTP library provides access to headers. + */ +const ATTR_HTTP_RESPONSE_HEADER = (key) => `http.response.header.${key}`; +exports.ATTR_HTTP_RESPONSE_HEADER = ATTR_HTTP_RESPONSE_HEADER; +/** + * [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). + * + * @example 200 + */ +exports.ATTR_HTTP_RESPONSE_STATUS_CODE = 'http.response.status_code'; +/** + * The matched route, that is, the path template in the format used by the respective server framework. + * + * @example /users/:userID? + * @example {controller}/{action}/{id?} + * + * @note **MUST NOT** be populated when this is not supported by the HTTP server framework as the route attribute should have low-cardinality and the URI path can NOT substitute it. + * **SHOULD** include the [application root](/docs/http/http-spans.md#http-server-definitions) if there is one. + */ +exports.ATTR_HTTP_ROUTE = 'http.route'; +/** + * Name of the garbage collector action. + * + * @example end of minor GC + * @example end of major GC + * + * @note Garbage collector action is generally obtained via [GarbageCollectionNotificationInfo#getGcAction()](https://docs.oracle.com/en/java/javase/11/docs/api/jdk.management/com/sun/management/GarbageCollectionNotificationInfo.html#getGcAction()). + */ +exports.ATTR_JVM_GC_ACTION = 'jvm.gc.action'; +/** + * Name of the garbage collector. + * + * @example G1 Young Generation + * @example G1 Old Generation + * + * @note Garbage collector name is generally obtained via [GarbageCollectionNotificationInfo#getGcName()](https://docs.oracle.com/en/java/javase/11/docs/api/jdk.management/com/sun/management/GarbageCollectionNotificationInfo.html#getGcName()). + */ +exports.ATTR_JVM_GC_NAME = 'jvm.gc.name'; +/** + * Name of the memory pool. + * + * @example G1 Old Gen + * @example G1 Eden space + * @example G1 Survivor Space + * + * @note Pool names are generally obtained via [MemoryPoolMXBean#getName()](https://docs.oracle.com/en/java/javase/11/docs/api/java.management/java/lang/management/MemoryPoolMXBean.html#getName()). + */ +exports.ATTR_JVM_MEMORY_POOL_NAME = 'jvm.memory.pool.name'; +/** + * The type of memory. + * + * @example heap + * @example non_heap + */ +exports.ATTR_JVM_MEMORY_TYPE = 'jvm.memory.type'; +/** + * Enum value "heap" for attribute {@link ATTR_JVM_MEMORY_TYPE}. + */ +exports.JVM_MEMORY_TYPE_VALUE_HEAP = "heap"; +/** + * Enum value "non_heap" for attribute {@link ATTR_JVM_MEMORY_TYPE}. + */ +exports.JVM_MEMORY_TYPE_VALUE_NON_HEAP = "non_heap"; +/** + * Whether the thread is daemon or not. + */ +exports.ATTR_JVM_THREAD_DAEMON = 'jvm.thread.daemon'; +/** + * State of the thread. + * + * @example runnable + * @example blocked + */ +exports.ATTR_JVM_THREAD_STATE = 'jvm.thread.state'; +/** + * Enum value "blocked" for attribute {@link ATTR_JVM_THREAD_STATE}. + */ +exports.JVM_THREAD_STATE_VALUE_BLOCKED = "blocked"; +/** + * Enum value "new" for attribute {@link ATTR_JVM_THREAD_STATE}. + */ +exports.JVM_THREAD_STATE_VALUE_NEW = "new"; +/** + * Enum value "runnable" for attribute {@link ATTR_JVM_THREAD_STATE}. + */ +exports.JVM_THREAD_STATE_VALUE_RUNNABLE = "runnable"; +/** + * Enum value "terminated" for attribute {@link ATTR_JVM_THREAD_STATE}. + */ +exports.JVM_THREAD_STATE_VALUE_TERMINATED = "terminated"; +/** + * Enum value "timed_waiting" for attribute {@link ATTR_JVM_THREAD_STATE}. + */ +exports.JVM_THREAD_STATE_VALUE_TIMED_WAITING = "timed_waiting"; +/** + * Enum value "waiting" for attribute {@link ATTR_JVM_THREAD_STATE}. + */ +exports.JVM_THREAD_STATE_VALUE_WAITING = "waiting"; +/** + * Local address of the network connection - IP address or Unix domain socket name. + * + * @example 10.1.2.80 + * @example /tmp/my.sock + */ +exports.ATTR_NETWORK_LOCAL_ADDRESS = 'network.local.address'; +/** + * Local port number of the network connection. + * + * @example 65123 + */ +exports.ATTR_NETWORK_LOCAL_PORT = 'network.local.port'; +/** + * Peer address of the network connection - IP address or Unix domain socket name. + * + * @example 10.1.2.80 + * @example /tmp/my.sock + */ +exports.ATTR_NETWORK_PEER_ADDRESS = 'network.peer.address'; +/** + * Peer port number of the network connection. + * + * @example 65123 + */ +exports.ATTR_NETWORK_PEER_PORT = 'network.peer.port'; +/** + * [OSI application layer](https://osi-model.com/application-layer/) or non-OSI equivalent. + * + * @example amqp + * @example http + * @example mqtt + * + * @note The value **SHOULD** be normalized to lowercase. + */ +exports.ATTR_NETWORK_PROTOCOL_NAME = 'network.protocol.name'; +/** + * The actual version of the protocol used for network communication. + * + * @example 1.1 + * @example 2 + * + * @note If protocol version is subject to negotiation (for example using [ALPN](https://www.rfc-editor.org/rfc/rfc7301.html)), this attribute **SHOULD** be set to the negotiated version. If the actual protocol version is not known, this attribute **SHOULD NOT** be set. + */ +exports.ATTR_NETWORK_PROTOCOL_VERSION = 'network.protocol.version'; +/** + * [OSI transport layer](https://osi-model.com/transport-layer/) or [inter-process communication method](https://wikipedia.org/wiki/Inter-process_communication). + * + * @example tcp + * @example udp + * + * @note The value **SHOULD** be normalized to lowercase. + * + * Consider always setting the transport when setting a port number, since + * a port number is ambiguous without knowing the transport. For example + * different processes could be listening on TCP port 12345 and UDP port 12345. + */ +exports.ATTR_NETWORK_TRANSPORT = 'network.transport'; +/** + * Enum value "pipe" for attribute {@link ATTR_NETWORK_TRANSPORT}. + */ +exports.NETWORK_TRANSPORT_VALUE_PIPE = "pipe"; +/** + * Enum value "quic" for attribute {@link ATTR_NETWORK_TRANSPORT}. + */ +exports.NETWORK_TRANSPORT_VALUE_QUIC = "quic"; +/** + * Enum value "tcp" for attribute {@link ATTR_NETWORK_TRANSPORT}. + */ +exports.NETWORK_TRANSPORT_VALUE_TCP = "tcp"; +/** + * Enum value "udp" for attribute {@link ATTR_NETWORK_TRANSPORT}. + */ +exports.NETWORK_TRANSPORT_VALUE_UDP = "udp"; +/** + * Enum value "unix" for attribute {@link ATTR_NETWORK_TRANSPORT}. + */ +exports.NETWORK_TRANSPORT_VALUE_UNIX = "unix"; +/** + * [OSI network layer](https://osi-model.com/network-layer/) or non-OSI equivalent. + * + * @example ipv4 + * @example ipv6 + * + * @note The value **SHOULD** be normalized to lowercase. + */ +exports.ATTR_NETWORK_TYPE = 'network.type'; +/** + * Enum value "ipv4" for attribute {@link ATTR_NETWORK_TYPE}. + */ +exports.NETWORK_TYPE_VALUE_IPV4 = "ipv4"; +/** + * Enum value "ipv6" for attribute {@link ATTR_NETWORK_TYPE}. + */ +exports.NETWORK_TYPE_VALUE_IPV6 = "ipv6"; +/** + * The name of the instrumentation scope - (`InstrumentationScope.Name` in OTLP). + * + * @example io.opentelemetry.contrib.mongodb + */ +exports.ATTR_OTEL_SCOPE_NAME = 'otel.scope.name'; +/** + * The version of the instrumentation scope - (`InstrumentationScope.Version` in OTLP). + * + * @example 1.0.0 + */ +exports.ATTR_OTEL_SCOPE_VERSION = 'otel.scope.version'; +/** + * Name of the code, either "OK" or "ERROR". **MUST NOT** be set if the status code is UNSET. + */ +exports.ATTR_OTEL_STATUS_CODE = 'otel.status_code'; +/** + * Enum value "ERROR" for attribute {@link ATTR_OTEL_STATUS_CODE}. + */ +exports.OTEL_STATUS_CODE_VALUE_ERROR = "ERROR"; +/** + * Enum value "OK" for attribute {@link ATTR_OTEL_STATUS_CODE}. + */ +exports.OTEL_STATUS_CODE_VALUE_OK = "OK"; +/** + * Description of the Status if it has a value, otherwise not set. + * + * @example resource not found + */ +exports.ATTR_OTEL_STATUS_DESCRIPTION = 'otel.status_description'; +/** + * Server domain name if available without reverse DNS lookup; otherwise, IP address or Unix domain socket name. + * + * @example example.com + * @example 10.1.2.80 + * @example /tmp/my.sock + * + * @note When observed from the client side, and when communicating through an intermediary, `server.address` **SHOULD** represent the server address behind any intermediaries, for example proxies, if it's available. + */ +exports.ATTR_SERVER_ADDRESS = 'server.address'; +/** + * Server port number. + * + * @example 80 + * @example 8080 + * @example 443 + * + * @note When observed from the client side, and when communicating through an intermediary, `server.port` **SHOULD** represent the server port behind any intermediaries, for example proxies, if it's available. + */ +exports.ATTR_SERVER_PORT = 'server.port'; +/** + * Logical name of the service. + * + * @example shoppingcart + * + * @note **MUST** be the same for all instances of horizontally scaled services. If the value was not specified, SDKs **MUST** fallback to `unknown_service:` concatenated with [`process.executable.name`](process.md), e.g. `unknown_service:bash`. If `process.executable.name` is not available, the value **MUST** be set to `unknown_service`. + */ +exports.ATTR_SERVICE_NAME = 'service.name'; +/** + * The version string of the service API or implementation. The format is not defined by these conventions. + * + * @example 2.0.0 + * @example a01dbef8a + */ +exports.ATTR_SERVICE_VERSION = 'service.version'; +/** + * SignalR HTTP connection closure status. + * + * @example app_shutdown + * @example timeout + */ +exports.ATTR_SIGNALR_CONNECTION_STATUS = 'signalr.connection.status'; +/** + * Enum value "app_shutdown" for attribute {@link ATTR_SIGNALR_CONNECTION_STATUS}. + */ +exports.SIGNALR_CONNECTION_STATUS_VALUE_APP_SHUTDOWN = "app_shutdown"; +/** + * Enum value "normal_closure" for attribute {@link ATTR_SIGNALR_CONNECTION_STATUS}. + */ +exports.SIGNALR_CONNECTION_STATUS_VALUE_NORMAL_CLOSURE = "normal_closure"; +/** + * Enum value "timeout" for attribute {@link ATTR_SIGNALR_CONNECTION_STATUS}. + */ +exports.SIGNALR_CONNECTION_STATUS_VALUE_TIMEOUT = "timeout"; +/** + * [SignalR transport type](https://github.com/dotnet/aspnetcore/blob/main/src/SignalR/docs/specs/TransportProtocols.md) + * + * @example web_sockets + * @example long_polling + */ +exports.ATTR_SIGNALR_TRANSPORT = 'signalr.transport'; +/** + * Enum value "long_polling" for attribute {@link ATTR_SIGNALR_TRANSPORT}. + */ +exports.SIGNALR_TRANSPORT_VALUE_LONG_POLLING = "long_polling"; +/** + * Enum value "server_sent_events" for attribute {@link ATTR_SIGNALR_TRANSPORT}. + */ +exports.SIGNALR_TRANSPORT_VALUE_SERVER_SENT_EVENTS = "server_sent_events"; +/** + * Enum value "web_sockets" for attribute {@link ATTR_SIGNALR_TRANSPORT}. + */ +exports.SIGNALR_TRANSPORT_VALUE_WEB_SOCKETS = "web_sockets"; +/** + * The [URI fragment](https://www.rfc-editor.org/rfc/rfc3986#section-3.5) component + * + * @example SemConv + */ +exports.ATTR_URL_FRAGMENT = 'url.fragment'; +/** + * Absolute URL describing a network resource according to [RFC3986](https://www.rfc-editor.org/rfc/rfc3986) + * + * @example https://www.foo.bar/search?q=OpenTelemetry#SemConv + * @example //localhost + * + * @note For network calls, URL usually has `scheme://host[:port][path][?query][#fragment]` format, where the fragment is not transmitted over HTTP, but if it is known, it **SHOULD** be included nevertheless. + * `url.full` **MUST NOT** contain credentials passed via URL in form of `https://username:password@www.example.com/`. In such case username and password **SHOULD** be redacted and attribute's value **SHOULD** be `https://REDACTED:REDACTED@www.example.com/`. + * `url.full` **SHOULD** capture the absolute URL when it is available (or can be reconstructed). Sensitive content provided in `url.full` **SHOULD** be scrubbed when instrumentations can identify it. + */ +exports.ATTR_URL_FULL = 'url.full'; +/** + * The [URI path](https://www.rfc-editor.org/rfc/rfc3986#section-3.3) component + * + * @example /search + * + * @note Sensitive content provided in `url.path` **SHOULD** be scrubbed when instrumentations can identify it. + */ +exports.ATTR_URL_PATH = 'url.path'; +/** + * The [URI query](https://www.rfc-editor.org/rfc/rfc3986#section-3.4) component + * + * @example q=OpenTelemetry + * + * @note Sensitive content provided in `url.query` **SHOULD** be scrubbed when instrumentations can identify it. + */ +exports.ATTR_URL_QUERY = 'url.query'; +/** + * The [URI scheme](https://www.rfc-editor.org/rfc/rfc3986#section-3.1) component identifying the used protocol. + * + * @example https + * @example ftp + * @example telnet + */ +exports.ATTR_URL_SCHEME = 'url.scheme'; +/** + * Value of the [HTTP User-Agent](https://www.rfc-editor.org/rfc/rfc9110.html#field.user-agent) header sent by the client. + * + * @example CERN-LineMode/2.15 libwww/2.17b3 + * @example Mozilla/5.0 (iPhone; CPU iPhone OS 14_7_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/14.1.2 Mobile/15E148 Safari/604.1 + * @example YourApp/1.0.0 grpc-java-okhttp/1.27.2 + */ +exports.ATTR_USER_AGENT_ORIGINAL = 'user_agent.original'; +//# sourceMappingURL=stable_attributes.js.map + +/***/ }), + +/***/ 26652: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.METRIC_SIGNALR_SERVER_CONNECTION_DURATION = exports.METRIC_SIGNALR_SERVER_ACTIVE_CONNECTIONS = exports.METRIC_KESTREL_UPGRADED_CONNECTIONS = exports.METRIC_KESTREL_TLS_HANDSHAKE_DURATION = exports.METRIC_KESTREL_REJECTED_CONNECTIONS = exports.METRIC_KESTREL_QUEUED_REQUESTS = exports.METRIC_KESTREL_QUEUED_CONNECTIONS = exports.METRIC_KESTREL_CONNECTION_DURATION = exports.METRIC_KESTREL_ACTIVE_TLS_HANDSHAKES = exports.METRIC_KESTREL_ACTIVE_CONNECTIONS = exports.METRIC_JVM_THREAD_COUNT = exports.METRIC_JVM_MEMORY_USED_AFTER_LAST_GC = exports.METRIC_JVM_MEMORY_USED = exports.METRIC_JVM_MEMORY_LIMIT = exports.METRIC_JVM_MEMORY_COMMITTED = exports.METRIC_JVM_GC_DURATION = exports.METRIC_JVM_CPU_TIME = exports.METRIC_JVM_CPU_RECENT_UTILIZATION = exports.METRIC_JVM_CPU_COUNT = exports.METRIC_JVM_CLASS_UNLOADED = exports.METRIC_JVM_CLASS_LOADED = exports.METRIC_JVM_CLASS_COUNT = exports.METRIC_HTTP_SERVER_REQUEST_DURATION = exports.METRIC_HTTP_CLIENT_REQUEST_DURATION = exports.METRIC_ASPNETCORE_ROUTING_MATCH_ATTEMPTS = exports.METRIC_ASPNETCORE_RATE_LIMITING_REQUESTS = exports.METRIC_ASPNETCORE_RATE_LIMITING_REQUEST_LEASE_DURATION = exports.METRIC_ASPNETCORE_RATE_LIMITING_REQUEST_TIME_IN_QUEUE = exports.METRIC_ASPNETCORE_RATE_LIMITING_QUEUED_REQUESTS = exports.METRIC_ASPNETCORE_RATE_LIMITING_ACTIVE_REQUEST_LEASES = exports.METRIC_ASPNETCORE_DIAGNOSTICS_EXCEPTIONS = void 0; +//---------------------------------------------------------------------------------------------------------- +// DO NOT EDIT, this is an Auto-generated file from scripts/semconv/templates/register/stable/metrics.ts.j2 +//---------------------------------------------------------------------------------------------------------- +/** + * Number of exceptions caught by exception handling middleware. + * + * @note Meter name: `Microsoft.AspNetCore.Diagnostics`; Added in: ASP.NET Core 8.0 + */ +exports.METRIC_ASPNETCORE_DIAGNOSTICS_EXCEPTIONS = 'aspnetcore.diagnostics.exceptions'; +/** + * Number of requests that are currently active on the server that hold a rate limiting lease. + * + * @note Meter name: `Microsoft.AspNetCore.RateLimiting`; Added in: ASP.NET Core 8.0 + */ +exports.METRIC_ASPNETCORE_RATE_LIMITING_ACTIVE_REQUEST_LEASES = 'aspnetcore.rate_limiting.active_request_leases'; +/** + * Number of requests that are currently queued, waiting to acquire a rate limiting lease. + * + * @note Meter name: `Microsoft.AspNetCore.RateLimiting`; Added in: ASP.NET Core 8.0 + */ +exports.METRIC_ASPNETCORE_RATE_LIMITING_QUEUED_REQUESTS = 'aspnetcore.rate_limiting.queued_requests'; +/** + * The time the request spent in a queue waiting to acquire a rate limiting lease. + * + * @note Meter name: `Microsoft.AspNetCore.RateLimiting`; Added in: ASP.NET Core 8.0 + */ +exports.METRIC_ASPNETCORE_RATE_LIMITING_REQUEST_TIME_IN_QUEUE = 'aspnetcore.rate_limiting.request.time_in_queue'; +/** + * The duration of rate limiting lease held by requests on the server. + * + * @note Meter name: `Microsoft.AspNetCore.RateLimiting`; Added in: ASP.NET Core 8.0 + */ +exports.METRIC_ASPNETCORE_RATE_LIMITING_REQUEST_LEASE_DURATION = 'aspnetcore.rate_limiting.request_lease.duration'; +/** + * Number of requests that tried to acquire a rate limiting lease. + * + * @note Requests could be: + * + * - Rejected by global or endpoint rate limiting policies + * - Canceled while waiting for the lease. + * + * Meter name: `Microsoft.AspNetCore.RateLimiting`; Added in: ASP.NET Core 8.0 + */ +exports.METRIC_ASPNETCORE_RATE_LIMITING_REQUESTS = 'aspnetcore.rate_limiting.requests'; +/** + * Number of requests that were attempted to be matched to an endpoint. + * + * @note Meter name: `Microsoft.AspNetCore.Routing`; Added in: ASP.NET Core 8.0 + */ +exports.METRIC_ASPNETCORE_ROUTING_MATCH_ATTEMPTS = 'aspnetcore.routing.match_attempts'; +/** + * Duration of HTTP client requests. + */ +exports.METRIC_HTTP_CLIENT_REQUEST_DURATION = 'http.client.request.duration'; +/** + * Duration of HTTP server requests. + */ +exports.METRIC_HTTP_SERVER_REQUEST_DURATION = 'http.server.request.duration'; +/** + * Number of classes currently loaded. + */ +exports.METRIC_JVM_CLASS_COUNT = 'jvm.class.count'; +/** + * Number of classes loaded since JVM start. + */ +exports.METRIC_JVM_CLASS_LOADED = 'jvm.class.loaded'; +/** + * Number of classes unloaded since JVM start. + */ +exports.METRIC_JVM_CLASS_UNLOADED = 'jvm.class.unloaded'; +/** + * Number of processors available to the Java virtual machine. + */ +exports.METRIC_JVM_CPU_COUNT = 'jvm.cpu.count'; +/** + * Recent CPU utilization for the process as reported by the JVM. + * + * @note The value range is [0.0,1.0]. This utilization is not defined as being for the specific interval since last measurement (unlike `system.cpu.utilization`). [Reference](https://docs.oracle.com/en/java/javase/17/docs/api/jdk.management/com/sun/management/OperatingSystemMXBean.html#getProcessCpuLoad()). + */ +exports.METRIC_JVM_CPU_RECENT_UTILIZATION = 'jvm.cpu.recent_utilization'; +/** + * CPU time used by the process as reported by the JVM. + */ +exports.METRIC_JVM_CPU_TIME = 'jvm.cpu.time'; +/** + * Duration of JVM garbage collection actions. + */ +exports.METRIC_JVM_GC_DURATION = 'jvm.gc.duration'; +/** + * Measure of memory committed. + */ +exports.METRIC_JVM_MEMORY_COMMITTED = 'jvm.memory.committed'; +/** + * Measure of max obtainable memory. + */ +exports.METRIC_JVM_MEMORY_LIMIT = 'jvm.memory.limit'; +/** + * Measure of memory used. + */ +exports.METRIC_JVM_MEMORY_USED = 'jvm.memory.used'; +/** + * Measure of memory used, as measured after the most recent garbage collection event on this pool. + */ +exports.METRIC_JVM_MEMORY_USED_AFTER_LAST_GC = 'jvm.memory.used_after_last_gc'; +/** + * Number of executing platform threads. + */ +exports.METRIC_JVM_THREAD_COUNT = 'jvm.thread.count'; +/** + * Number of connections that are currently active on the server. + * + * @note Meter name: `Microsoft.AspNetCore.Server.Kestrel`; Added in: ASP.NET Core 8.0 + */ +exports.METRIC_KESTREL_ACTIVE_CONNECTIONS = 'kestrel.active_connections'; +/** + * Number of TLS handshakes that are currently in progress on the server. + * + * @note Meter name: `Microsoft.AspNetCore.Server.Kestrel`; Added in: ASP.NET Core 8.0 + */ +exports.METRIC_KESTREL_ACTIVE_TLS_HANDSHAKES = 'kestrel.active_tls_handshakes'; +/** + * The duration of connections on the server. + * + * @note Meter name: `Microsoft.AspNetCore.Server.Kestrel`; Added in: ASP.NET Core 8.0 + */ +exports.METRIC_KESTREL_CONNECTION_DURATION = 'kestrel.connection.duration'; +/** + * Number of connections that are currently queued and are waiting to start. + * + * @note Meter name: `Microsoft.AspNetCore.Server.Kestrel`; Added in: ASP.NET Core 8.0 + */ +exports.METRIC_KESTREL_QUEUED_CONNECTIONS = 'kestrel.queued_connections'; +/** + * Number of HTTP requests on multiplexed connections (HTTP/2 and HTTP/3) that are currently queued and are waiting to start. + * + * @note Meter name: `Microsoft.AspNetCore.Server.Kestrel`; Added in: ASP.NET Core 8.0 + */ +exports.METRIC_KESTREL_QUEUED_REQUESTS = 'kestrel.queued_requests'; +/** + * Number of connections rejected by the server. + * + * @note Connections are rejected when the currently active count exceeds the value configured with `MaxConcurrentConnections`. + * Meter name: `Microsoft.AspNetCore.Server.Kestrel`; Added in: ASP.NET Core 8.0 + */ +exports.METRIC_KESTREL_REJECTED_CONNECTIONS = 'kestrel.rejected_connections'; +/** + * The duration of TLS handshakes on the server. + * + * @note Meter name: `Microsoft.AspNetCore.Server.Kestrel`; Added in: ASP.NET Core 8.0 + */ +exports.METRIC_KESTREL_TLS_HANDSHAKE_DURATION = 'kestrel.tls_handshake.duration'; +/** + * Number of connections that are currently upgraded (WebSockets). . + * + * @note The counter only tracks HTTP/1.1 connections. + * + * Meter name: `Microsoft.AspNetCore.Server.Kestrel`; Added in: ASP.NET Core 8.0 + */ +exports.METRIC_KESTREL_UPGRADED_CONNECTIONS = 'kestrel.upgraded_connections'; +/** + * Number of connections that are currently active on the server. + * + * @note Meter name: `Microsoft.AspNetCore.Http.Connections`; Added in: ASP.NET Core 8.0 + */ +exports.METRIC_SIGNALR_SERVER_ACTIVE_CONNECTIONS = 'signalr.server.active_connections'; +/** + * The duration of connections on the server. + * + * @note Meter name: `Microsoft.AspNetCore.Http.Connections`; Added in: ASP.NET Core 8.0 + */ +exports.METRIC_SIGNALR_SERVER_CONNECTION_DURATION = 'signalr.server.connection.duration'; +//# sourceMappingURL=stable_metrics.js.map + +/***/ }), + +/***/ 33570: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.SEMATTRS_NET_HOST_CARRIER_ICC = exports.SEMATTRS_NET_HOST_CARRIER_MNC = exports.SEMATTRS_NET_HOST_CARRIER_MCC = exports.SEMATTRS_NET_HOST_CARRIER_NAME = exports.SEMATTRS_NET_HOST_CONNECTION_SUBTYPE = exports.SEMATTRS_NET_HOST_CONNECTION_TYPE = exports.SEMATTRS_NET_HOST_NAME = exports.SEMATTRS_NET_HOST_PORT = exports.SEMATTRS_NET_HOST_IP = exports.SEMATTRS_NET_PEER_NAME = exports.SEMATTRS_NET_PEER_PORT = exports.SEMATTRS_NET_PEER_IP = exports.SEMATTRS_NET_TRANSPORT = exports.SEMATTRS_FAAS_INVOKED_REGION = exports.SEMATTRS_FAAS_INVOKED_PROVIDER = exports.SEMATTRS_FAAS_INVOKED_NAME = exports.SEMATTRS_FAAS_COLDSTART = exports.SEMATTRS_FAAS_CRON = exports.SEMATTRS_FAAS_TIME = exports.SEMATTRS_FAAS_DOCUMENT_NAME = exports.SEMATTRS_FAAS_DOCUMENT_TIME = exports.SEMATTRS_FAAS_DOCUMENT_OPERATION = exports.SEMATTRS_FAAS_DOCUMENT_COLLECTION = exports.SEMATTRS_FAAS_EXECUTION = exports.SEMATTRS_FAAS_TRIGGER = exports.SEMATTRS_EXCEPTION_ESCAPED = exports.SEMATTRS_EXCEPTION_STACKTRACE = exports.SEMATTRS_EXCEPTION_MESSAGE = exports.SEMATTRS_EXCEPTION_TYPE = exports.SEMATTRS_DB_SQL_TABLE = exports.SEMATTRS_DB_MONGODB_COLLECTION = exports.SEMATTRS_DB_REDIS_DATABASE_INDEX = exports.SEMATTRS_DB_HBASE_NAMESPACE = exports.SEMATTRS_DB_CASSANDRA_COORDINATOR_DC = exports.SEMATTRS_DB_CASSANDRA_COORDINATOR_ID = exports.SEMATTRS_DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT = exports.SEMATTRS_DB_CASSANDRA_IDEMPOTENCE = exports.SEMATTRS_DB_CASSANDRA_TABLE = exports.SEMATTRS_DB_CASSANDRA_CONSISTENCY_LEVEL = exports.SEMATTRS_DB_CASSANDRA_PAGE_SIZE = exports.SEMATTRS_DB_CASSANDRA_KEYSPACE = exports.SEMATTRS_DB_MSSQL_INSTANCE_NAME = exports.SEMATTRS_DB_OPERATION = exports.SEMATTRS_DB_STATEMENT = exports.SEMATTRS_DB_NAME = exports.SEMATTRS_DB_JDBC_DRIVER_CLASSNAME = exports.SEMATTRS_DB_USER = exports.SEMATTRS_DB_CONNECTION_STRING = exports.SEMATTRS_DB_SYSTEM = exports.SEMATTRS_AWS_LAMBDA_INVOKED_ARN = void 0; +exports.SEMATTRS_MESSAGING_DESTINATION_KIND = exports.SEMATTRS_MESSAGING_DESTINATION = exports.SEMATTRS_MESSAGING_SYSTEM = exports.SEMATTRS_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES = exports.SEMATTRS_AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS = exports.SEMATTRS_AWS_DYNAMODB_SCANNED_COUNT = exports.SEMATTRS_AWS_DYNAMODB_COUNT = exports.SEMATTRS_AWS_DYNAMODB_TOTAL_SEGMENTS = exports.SEMATTRS_AWS_DYNAMODB_SEGMENT = exports.SEMATTRS_AWS_DYNAMODB_SCAN_FORWARD = exports.SEMATTRS_AWS_DYNAMODB_TABLE_COUNT = exports.SEMATTRS_AWS_DYNAMODB_EXCLUSIVE_START_TABLE = exports.SEMATTRS_AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES = exports.SEMATTRS_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES = exports.SEMATTRS_AWS_DYNAMODB_SELECT = exports.SEMATTRS_AWS_DYNAMODB_INDEX_NAME = exports.SEMATTRS_AWS_DYNAMODB_ATTRIBUTES_TO_GET = exports.SEMATTRS_AWS_DYNAMODB_LIMIT = exports.SEMATTRS_AWS_DYNAMODB_PROJECTION = exports.SEMATTRS_AWS_DYNAMODB_CONSISTENT_READ = exports.SEMATTRS_AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY = exports.SEMATTRS_AWS_DYNAMODB_PROVISIONED_READ_CAPACITY = exports.SEMATTRS_AWS_DYNAMODB_ITEM_COLLECTION_METRICS = exports.SEMATTRS_AWS_DYNAMODB_CONSUMED_CAPACITY = exports.SEMATTRS_AWS_DYNAMODB_TABLE_NAMES = exports.SEMATTRS_HTTP_CLIENT_IP = exports.SEMATTRS_HTTP_ROUTE = exports.SEMATTRS_HTTP_SERVER_NAME = exports.SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED = exports.SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH = exports.SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED = exports.SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH = exports.SEMATTRS_HTTP_USER_AGENT = exports.SEMATTRS_HTTP_FLAVOR = exports.SEMATTRS_HTTP_STATUS_CODE = exports.SEMATTRS_HTTP_SCHEME = exports.SEMATTRS_HTTP_HOST = exports.SEMATTRS_HTTP_TARGET = exports.SEMATTRS_HTTP_URL = exports.SEMATTRS_HTTP_METHOD = exports.SEMATTRS_CODE_LINENO = exports.SEMATTRS_CODE_FILEPATH = exports.SEMATTRS_CODE_NAMESPACE = exports.SEMATTRS_CODE_FUNCTION = exports.SEMATTRS_THREAD_NAME = exports.SEMATTRS_THREAD_ID = exports.SEMATTRS_ENDUSER_SCOPE = exports.SEMATTRS_ENDUSER_ROLE = exports.SEMATTRS_ENDUSER_ID = exports.SEMATTRS_PEER_SERVICE = void 0; +exports.DBSYSTEMVALUES_FILEMAKER = exports.DBSYSTEMVALUES_DERBY = exports.DBSYSTEMVALUES_FIREBIRD = exports.DBSYSTEMVALUES_ADABAS = exports.DBSYSTEMVALUES_CACHE = exports.DBSYSTEMVALUES_EDB = exports.DBSYSTEMVALUES_FIRSTSQL = exports.DBSYSTEMVALUES_INGRES = exports.DBSYSTEMVALUES_HANADB = exports.DBSYSTEMVALUES_MAXDB = exports.DBSYSTEMVALUES_PROGRESS = exports.DBSYSTEMVALUES_HSQLDB = exports.DBSYSTEMVALUES_CLOUDSCAPE = exports.DBSYSTEMVALUES_HIVE = exports.DBSYSTEMVALUES_REDSHIFT = exports.DBSYSTEMVALUES_POSTGRESQL = exports.DBSYSTEMVALUES_DB2 = exports.DBSYSTEMVALUES_ORACLE = exports.DBSYSTEMVALUES_MYSQL = exports.DBSYSTEMVALUES_MSSQL = exports.DBSYSTEMVALUES_OTHER_SQL = exports.SemanticAttributes = exports.SEMATTRS_MESSAGE_UNCOMPRESSED_SIZE = exports.SEMATTRS_MESSAGE_COMPRESSED_SIZE = exports.SEMATTRS_MESSAGE_ID = exports.SEMATTRS_MESSAGE_TYPE = exports.SEMATTRS_RPC_JSONRPC_ERROR_MESSAGE = exports.SEMATTRS_RPC_JSONRPC_ERROR_CODE = exports.SEMATTRS_RPC_JSONRPC_REQUEST_ID = exports.SEMATTRS_RPC_JSONRPC_VERSION = exports.SEMATTRS_RPC_GRPC_STATUS_CODE = exports.SEMATTRS_RPC_METHOD = exports.SEMATTRS_RPC_SERVICE = exports.SEMATTRS_RPC_SYSTEM = exports.SEMATTRS_MESSAGING_KAFKA_TOMBSTONE = exports.SEMATTRS_MESSAGING_KAFKA_PARTITION = exports.SEMATTRS_MESSAGING_KAFKA_CLIENT_ID = exports.SEMATTRS_MESSAGING_KAFKA_CONSUMER_GROUP = exports.SEMATTRS_MESSAGING_KAFKA_MESSAGE_KEY = exports.SEMATTRS_MESSAGING_RABBITMQ_ROUTING_KEY = exports.SEMATTRS_MESSAGING_CONSUMER_ID = exports.SEMATTRS_MESSAGING_OPERATION = exports.SEMATTRS_MESSAGING_MESSAGE_PAYLOAD_COMPRESSED_SIZE_BYTES = exports.SEMATTRS_MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES = exports.SEMATTRS_MESSAGING_CONVERSATION_ID = exports.SEMATTRS_MESSAGING_MESSAGE_ID = exports.SEMATTRS_MESSAGING_URL = exports.SEMATTRS_MESSAGING_PROTOCOL_VERSION = exports.SEMATTRS_MESSAGING_PROTOCOL = exports.SEMATTRS_MESSAGING_TEMP_DESTINATION = void 0; +exports.FAASINVOKEDPROVIDERVALUES_ALIBABA_CLOUD = exports.FaasDocumentOperationValues = exports.FAASDOCUMENTOPERATIONVALUES_DELETE = exports.FAASDOCUMENTOPERATIONVALUES_EDIT = exports.FAASDOCUMENTOPERATIONVALUES_INSERT = exports.FaasTriggerValues = exports.FAASTRIGGERVALUES_OTHER = exports.FAASTRIGGERVALUES_TIMER = exports.FAASTRIGGERVALUES_PUBSUB = exports.FAASTRIGGERVALUES_HTTP = exports.FAASTRIGGERVALUES_DATASOURCE = exports.DbCassandraConsistencyLevelValues = exports.DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_SERIAL = exports.DBCASSANDRACONSISTENCYLEVELVALUES_SERIAL = exports.DBCASSANDRACONSISTENCYLEVELVALUES_ANY = exports.DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_ONE = exports.DBCASSANDRACONSISTENCYLEVELVALUES_THREE = exports.DBCASSANDRACONSISTENCYLEVELVALUES_TWO = exports.DBCASSANDRACONSISTENCYLEVELVALUES_ONE = exports.DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_QUORUM = exports.DBCASSANDRACONSISTENCYLEVELVALUES_QUORUM = exports.DBCASSANDRACONSISTENCYLEVELVALUES_EACH_QUORUM = exports.DBCASSANDRACONSISTENCYLEVELVALUES_ALL = exports.DbSystemValues = exports.DBSYSTEMVALUES_COCKROACHDB = exports.DBSYSTEMVALUES_MEMCACHED = exports.DBSYSTEMVALUES_ELASTICSEARCH = exports.DBSYSTEMVALUES_GEODE = exports.DBSYSTEMVALUES_NEO4J = exports.DBSYSTEMVALUES_DYNAMODB = exports.DBSYSTEMVALUES_COSMOSDB = exports.DBSYSTEMVALUES_COUCHDB = exports.DBSYSTEMVALUES_COUCHBASE = exports.DBSYSTEMVALUES_REDIS = exports.DBSYSTEMVALUES_MONGODB = exports.DBSYSTEMVALUES_HBASE = exports.DBSYSTEMVALUES_CASSANDRA = exports.DBSYSTEMVALUES_COLDFUSION = exports.DBSYSTEMVALUES_H2 = exports.DBSYSTEMVALUES_VERTICA = exports.DBSYSTEMVALUES_TERADATA = exports.DBSYSTEMVALUES_SYBASE = exports.DBSYSTEMVALUES_SQLITE = exports.DBSYSTEMVALUES_POINTBASE = exports.DBSYSTEMVALUES_PERVASIVE = exports.DBSYSTEMVALUES_NETEZZA = exports.DBSYSTEMVALUES_MARIADB = exports.DBSYSTEMVALUES_INTERBASE = exports.DBSYSTEMVALUES_INSTANTDB = exports.DBSYSTEMVALUES_INFORMIX = void 0; +exports.MESSAGINGOPERATIONVALUES_RECEIVE = exports.MessagingDestinationKindValues = exports.MESSAGINGDESTINATIONKINDVALUES_TOPIC = exports.MESSAGINGDESTINATIONKINDVALUES_QUEUE = exports.HttpFlavorValues = exports.HTTPFLAVORVALUES_QUIC = exports.HTTPFLAVORVALUES_SPDY = exports.HTTPFLAVORVALUES_HTTP_2_0 = exports.HTTPFLAVORVALUES_HTTP_1_1 = exports.HTTPFLAVORVALUES_HTTP_1_0 = exports.NetHostConnectionSubtypeValues = exports.NETHOSTCONNECTIONSUBTYPEVALUES_LTE_CA = exports.NETHOSTCONNECTIONSUBTYPEVALUES_NRNSA = exports.NETHOSTCONNECTIONSUBTYPEVALUES_NR = exports.NETHOSTCONNECTIONSUBTYPEVALUES_IWLAN = exports.NETHOSTCONNECTIONSUBTYPEVALUES_TD_SCDMA = exports.NETHOSTCONNECTIONSUBTYPEVALUES_GSM = exports.NETHOSTCONNECTIONSUBTYPEVALUES_HSPAP = exports.NETHOSTCONNECTIONSUBTYPEVALUES_EHRPD = exports.NETHOSTCONNECTIONSUBTYPEVALUES_LTE = exports.NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_B = exports.NETHOSTCONNECTIONSUBTYPEVALUES_IDEN = exports.NETHOSTCONNECTIONSUBTYPEVALUES_HSPA = exports.NETHOSTCONNECTIONSUBTYPEVALUES_HSUPA = exports.NETHOSTCONNECTIONSUBTYPEVALUES_HSDPA = exports.NETHOSTCONNECTIONSUBTYPEVALUES_CDMA2000_1XRTT = exports.NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_A = exports.NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_0 = exports.NETHOSTCONNECTIONSUBTYPEVALUES_CDMA = exports.NETHOSTCONNECTIONSUBTYPEVALUES_UMTS = exports.NETHOSTCONNECTIONSUBTYPEVALUES_EDGE = exports.NETHOSTCONNECTIONSUBTYPEVALUES_GPRS = exports.NetHostConnectionTypeValues = exports.NETHOSTCONNECTIONTYPEVALUES_UNKNOWN = exports.NETHOSTCONNECTIONTYPEVALUES_UNAVAILABLE = exports.NETHOSTCONNECTIONTYPEVALUES_CELL = exports.NETHOSTCONNECTIONTYPEVALUES_WIRED = exports.NETHOSTCONNECTIONTYPEVALUES_WIFI = exports.NetTransportValues = exports.NETTRANSPORTVALUES_OTHER = exports.NETTRANSPORTVALUES_INPROC = exports.NETTRANSPORTVALUES_PIPE = exports.NETTRANSPORTVALUES_UNIX = exports.NETTRANSPORTVALUES_IP = exports.NETTRANSPORTVALUES_IP_UDP = exports.NETTRANSPORTVALUES_IP_TCP = exports.FaasInvokedProviderValues = exports.FAASINVOKEDPROVIDERVALUES_GCP = exports.FAASINVOKEDPROVIDERVALUES_AZURE = exports.FAASINVOKEDPROVIDERVALUES_AWS = void 0; +exports.MessageTypeValues = exports.MESSAGETYPEVALUES_RECEIVED = exports.MESSAGETYPEVALUES_SENT = exports.RpcGrpcStatusCodeValues = exports.RPCGRPCSTATUSCODEVALUES_UNAUTHENTICATED = exports.RPCGRPCSTATUSCODEVALUES_DATA_LOSS = exports.RPCGRPCSTATUSCODEVALUES_UNAVAILABLE = exports.RPCGRPCSTATUSCODEVALUES_INTERNAL = exports.RPCGRPCSTATUSCODEVALUES_UNIMPLEMENTED = exports.RPCGRPCSTATUSCODEVALUES_OUT_OF_RANGE = exports.RPCGRPCSTATUSCODEVALUES_ABORTED = exports.RPCGRPCSTATUSCODEVALUES_FAILED_PRECONDITION = exports.RPCGRPCSTATUSCODEVALUES_RESOURCE_EXHAUSTED = exports.RPCGRPCSTATUSCODEVALUES_PERMISSION_DENIED = exports.RPCGRPCSTATUSCODEVALUES_ALREADY_EXISTS = exports.RPCGRPCSTATUSCODEVALUES_NOT_FOUND = exports.RPCGRPCSTATUSCODEVALUES_DEADLINE_EXCEEDED = exports.RPCGRPCSTATUSCODEVALUES_INVALID_ARGUMENT = exports.RPCGRPCSTATUSCODEVALUES_UNKNOWN = exports.RPCGRPCSTATUSCODEVALUES_CANCELLED = exports.RPCGRPCSTATUSCODEVALUES_OK = exports.MessagingOperationValues = exports.MESSAGINGOPERATIONVALUES_PROCESS = void 0; +const utils_1 = __nccwpck_require__(6346); +//---------------------------------------------------------------------------------------------------------- +// DO NOT EDIT, this is an Auto-generated file from scripts/semconv/templates//templates/SemanticAttributes.ts.j2 +//---------------------------------------------------------------------------------------------------------- +//---------------------------------------------------------------------------------------------------------- +// Constant values for SemanticAttributes +//---------------------------------------------------------------------------------------------------------- +// Temporary local constants to assign to the individual exports and the namespaced version +// Required to avoid the namespace exports using the unminifiable export names for some package types +const TMP_AWS_LAMBDA_INVOKED_ARN = 'aws.lambda.invoked_arn'; +const TMP_DB_SYSTEM = 'db.system'; +const TMP_DB_CONNECTION_STRING = 'db.connection_string'; +const TMP_DB_USER = 'db.user'; +const TMP_DB_JDBC_DRIVER_CLASSNAME = 'db.jdbc.driver_classname'; +const TMP_DB_NAME = 'db.name'; +const TMP_DB_STATEMENT = 'db.statement'; +const TMP_DB_OPERATION = 'db.operation'; +const TMP_DB_MSSQL_INSTANCE_NAME = 'db.mssql.instance_name'; +const TMP_DB_CASSANDRA_KEYSPACE = 'db.cassandra.keyspace'; +const TMP_DB_CASSANDRA_PAGE_SIZE = 'db.cassandra.page_size'; +const TMP_DB_CASSANDRA_CONSISTENCY_LEVEL = 'db.cassandra.consistency_level'; +const TMP_DB_CASSANDRA_TABLE = 'db.cassandra.table'; +const TMP_DB_CASSANDRA_IDEMPOTENCE = 'db.cassandra.idempotence'; +const TMP_DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT = 'db.cassandra.speculative_execution_count'; +const TMP_DB_CASSANDRA_COORDINATOR_ID = 'db.cassandra.coordinator.id'; +const TMP_DB_CASSANDRA_COORDINATOR_DC = 'db.cassandra.coordinator.dc'; +const TMP_DB_HBASE_NAMESPACE = 'db.hbase.namespace'; +const TMP_DB_REDIS_DATABASE_INDEX = 'db.redis.database_index'; +const TMP_DB_MONGODB_COLLECTION = 'db.mongodb.collection'; +const TMP_DB_SQL_TABLE = 'db.sql.table'; +const TMP_EXCEPTION_TYPE = 'exception.type'; +const TMP_EXCEPTION_MESSAGE = 'exception.message'; +const TMP_EXCEPTION_STACKTRACE = 'exception.stacktrace'; +const TMP_EXCEPTION_ESCAPED = 'exception.escaped'; +const TMP_FAAS_TRIGGER = 'faas.trigger'; +const TMP_FAAS_EXECUTION = 'faas.execution'; +const TMP_FAAS_DOCUMENT_COLLECTION = 'faas.document.collection'; +const TMP_FAAS_DOCUMENT_OPERATION = 'faas.document.operation'; +const TMP_FAAS_DOCUMENT_TIME = 'faas.document.time'; +const TMP_FAAS_DOCUMENT_NAME = 'faas.document.name'; +const TMP_FAAS_TIME = 'faas.time'; +const TMP_FAAS_CRON = 'faas.cron'; +const TMP_FAAS_COLDSTART = 'faas.coldstart'; +const TMP_FAAS_INVOKED_NAME = 'faas.invoked_name'; +const TMP_FAAS_INVOKED_PROVIDER = 'faas.invoked_provider'; +const TMP_FAAS_INVOKED_REGION = 'faas.invoked_region'; +const TMP_NET_TRANSPORT = 'net.transport'; +const TMP_NET_PEER_IP = 'net.peer.ip'; +const TMP_NET_PEER_PORT = 'net.peer.port'; +const TMP_NET_PEER_NAME = 'net.peer.name'; +const TMP_NET_HOST_IP = 'net.host.ip'; +const TMP_NET_HOST_PORT = 'net.host.port'; +const TMP_NET_HOST_NAME = 'net.host.name'; +const TMP_NET_HOST_CONNECTION_TYPE = 'net.host.connection.type'; +const TMP_NET_HOST_CONNECTION_SUBTYPE = 'net.host.connection.subtype'; +const TMP_NET_HOST_CARRIER_NAME = 'net.host.carrier.name'; +const TMP_NET_HOST_CARRIER_MCC = 'net.host.carrier.mcc'; +const TMP_NET_HOST_CARRIER_MNC = 'net.host.carrier.mnc'; +const TMP_NET_HOST_CARRIER_ICC = 'net.host.carrier.icc'; +const TMP_PEER_SERVICE = 'peer.service'; +const TMP_ENDUSER_ID = 'enduser.id'; +const TMP_ENDUSER_ROLE = 'enduser.role'; +const TMP_ENDUSER_SCOPE = 'enduser.scope'; +const TMP_THREAD_ID = 'thread.id'; +const TMP_THREAD_NAME = 'thread.name'; +const TMP_CODE_FUNCTION = 'code.function'; +const TMP_CODE_NAMESPACE = 'code.namespace'; +const TMP_CODE_FILEPATH = 'code.filepath'; +const TMP_CODE_LINENO = 'code.lineno'; +const TMP_HTTP_METHOD = 'http.method'; +const TMP_HTTP_URL = 'http.url'; +const TMP_HTTP_TARGET = 'http.target'; +const TMP_HTTP_HOST = 'http.host'; +const TMP_HTTP_SCHEME = 'http.scheme'; +const TMP_HTTP_STATUS_CODE = 'http.status_code'; +const TMP_HTTP_FLAVOR = 'http.flavor'; +const TMP_HTTP_USER_AGENT = 'http.user_agent'; +const TMP_HTTP_REQUEST_CONTENT_LENGTH = 'http.request_content_length'; +const TMP_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED = 'http.request_content_length_uncompressed'; +const TMP_HTTP_RESPONSE_CONTENT_LENGTH = 'http.response_content_length'; +const TMP_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED = 'http.response_content_length_uncompressed'; +const TMP_HTTP_SERVER_NAME = 'http.server_name'; +const TMP_HTTP_ROUTE = 'http.route'; +const TMP_HTTP_CLIENT_IP = 'http.client_ip'; +const TMP_AWS_DYNAMODB_TABLE_NAMES = 'aws.dynamodb.table_names'; +const TMP_AWS_DYNAMODB_CONSUMED_CAPACITY = 'aws.dynamodb.consumed_capacity'; +const TMP_AWS_DYNAMODB_ITEM_COLLECTION_METRICS = 'aws.dynamodb.item_collection_metrics'; +const TMP_AWS_DYNAMODB_PROVISIONED_READ_CAPACITY = 'aws.dynamodb.provisioned_read_capacity'; +const TMP_AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY = 'aws.dynamodb.provisioned_write_capacity'; +const TMP_AWS_DYNAMODB_CONSISTENT_READ = 'aws.dynamodb.consistent_read'; +const TMP_AWS_DYNAMODB_PROJECTION = 'aws.dynamodb.projection'; +const TMP_AWS_DYNAMODB_LIMIT = 'aws.dynamodb.limit'; +const TMP_AWS_DYNAMODB_ATTRIBUTES_TO_GET = 'aws.dynamodb.attributes_to_get'; +const TMP_AWS_DYNAMODB_INDEX_NAME = 'aws.dynamodb.index_name'; +const TMP_AWS_DYNAMODB_SELECT = 'aws.dynamodb.select'; +const TMP_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES = 'aws.dynamodb.global_secondary_indexes'; +const TMP_AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES = 'aws.dynamodb.local_secondary_indexes'; +const TMP_AWS_DYNAMODB_EXCLUSIVE_START_TABLE = 'aws.dynamodb.exclusive_start_table'; +const TMP_AWS_DYNAMODB_TABLE_COUNT = 'aws.dynamodb.table_count'; +const TMP_AWS_DYNAMODB_SCAN_FORWARD = 'aws.dynamodb.scan_forward'; +const TMP_AWS_DYNAMODB_SEGMENT = 'aws.dynamodb.segment'; +const TMP_AWS_DYNAMODB_TOTAL_SEGMENTS = 'aws.dynamodb.total_segments'; +const TMP_AWS_DYNAMODB_COUNT = 'aws.dynamodb.count'; +const TMP_AWS_DYNAMODB_SCANNED_COUNT = 'aws.dynamodb.scanned_count'; +const TMP_AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS = 'aws.dynamodb.attribute_definitions'; +const TMP_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES = 'aws.dynamodb.global_secondary_index_updates'; +const TMP_MESSAGING_SYSTEM = 'messaging.system'; +const TMP_MESSAGING_DESTINATION = 'messaging.destination'; +const TMP_MESSAGING_DESTINATION_KIND = 'messaging.destination_kind'; +const TMP_MESSAGING_TEMP_DESTINATION = 'messaging.temp_destination'; +const TMP_MESSAGING_PROTOCOL = 'messaging.protocol'; +const TMP_MESSAGING_PROTOCOL_VERSION = 'messaging.protocol_version'; +const TMP_MESSAGING_URL = 'messaging.url'; +const TMP_MESSAGING_MESSAGE_ID = 'messaging.message_id'; +const TMP_MESSAGING_CONVERSATION_ID = 'messaging.conversation_id'; +const TMP_MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES = 'messaging.message_payload_size_bytes'; +const TMP_MESSAGING_MESSAGE_PAYLOAD_COMPRESSED_SIZE_BYTES = 'messaging.message_payload_compressed_size_bytes'; +const TMP_MESSAGING_OPERATION = 'messaging.operation'; +const TMP_MESSAGING_CONSUMER_ID = 'messaging.consumer_id'; +const TMP_MESSAGING_RABBITMQ_ROUTING_KEY = 'messaging.rabbitmq.routing_key'; +const TMP_MESSAGING_KAFKA_MESSAGE_KEY = 'messaging.kafka.message_key'; +const TMP_MESSAGING_KAFKA_CONSUMER_GROUP = 'messaging.kafka.consumer_group'; +const TMP_MESSAGING_KAFKA_CLIENT_ID = 'messaging.kafka.client_id'; +const TMP_MESSAGING_KAFKA_PARTITION = 'messaging.kafka.partition'; +const TMP_MESSAGING_KAFKA_TOMBSTONE = 'messaging.kafka.tombstone'; +const TMP_RPC_SYSTEM = 'rpc.system'; +const TMP_RPC_SERVICE = 'rpc.service'; +const TMP_RPC_METHOD = 'rpc.method'; +const TMP_RPC_GRPC_STATUS_CODE = 'rpc.grpc.status_code'; +const TMP_RPC_JSONRPC_VERSION = 'rpc.jsonrpc.version'; +const TMP_RPC_JSONRPC_REQUEST_ID = 'rpc.jsonrpc.request_id'; +const TMP_RPC_JSONRPC_ERROR_CODE = 'rpc.jsonrpc.error_code'; +const TMP_RPC_JSONRPC_ERROR_MESSAGE = 'rpc.jsonrpc.error_message'; +const TMP_MESSAGE_TYPE = 'message.type'; +const TMP_MESSAGE_ID = 'message.id'; +const TMP_MESSAGE_COMPRESSED_SIZE = 'message.compressed_size'; +const TMP_MESSAGE_UNCOMPRESSED_SIZE = 'message.uncompressed_size'; +/** + * The full invoked ARN as provided on the `Context` passed to the function (`Lambda-Runtime-Invoked-Function-Arn` header on the `/runtime/invocation/next` applicable). + * + * Note: This may be different from `faas.id` if an alias is involved. + * + * @deprecated Use ATTR_AWS_LAMBDA_INVOKED_ARN in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_AWS_LAMBDA_INVOKED_ARN = TMP_AWS_LAMBDA_INVOKED_ARN; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use ATTR_DB_SYSTEM in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_DB_SYSTEM = TMP_DB_SYSTEM; +/** + * The connection string used to connect to the database. It is recommended to remove embedded credentials. + * + * @deprecated Use ATTR_DB_CONNECTION_STRING in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_DB_CONNECTION_STRING = TMP_DB_CONNECTION_STRING; +/** + * Username for accessing the database. + * + * @deprecated Use ATTR_DB_USER in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_DB_USER = TMP_DB_USER; +/** + * The fully-qualified class name of the [Java Database Connectivity (JDBC)](https://docs.oracle.com/javase/8/docs/technotes/guides/jdbc/) driver used to connect. + * + * @deprecated Use ATTR_DB_JDBC_DRIVER_CLASSNAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_DB_JDBC_DRIVER_CLASSNAME = TMP_DB_JDBC_DRIVER_CLASSNAME; +/** + * If no [tech-specific attribute](#call-level-attributes-for-specific-technologies) is defined, this attribute is used to report the name of the database being accessed. For commands that switch the database, this should be set to the target database (even if the command fails). + * + * Note: In some SQL databases, the database name to be used is called "schema name". + * + * @deprecated Use ATTR_DB_NAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_DB_NAME = TMP_DB_NAME; +/** + * The database statement being executed. + * + * Note: The value may be sanitized to exclude sensitive information. + * + * @deprecated Use ATTR_DB_STATEMENT in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_DB_STATEMENT = TMP_DB_STATEMENT; +/** + * The name of the operation being executed, e.g. the [MongoDB command name](https://docs.mongodb.com/manual/reference/command/#database-operations) such as `findAndModify`, or the SQL keyword. + * + * Note: When setting this to an SQL keyword, it is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if the operation name is provided by the library being instrumented. If the SQL statement has an ambiguous operation, or performs more than one operation, this value may be omitted. + * + * @deprecated Use ATTR_DB_OPERATION in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_DB_OPERATION = TMP_DB_OPERATION; +/** + * The Microsoft SQL Server [instance name](https://docs.microsoft.com/en-us/sql/connect/jdbc/building-the-connection-url?view=sql-server-ver15) connecting to. This name is used to determine the port of a named instance. + * + * Note: If setting a `db.mssql.instance_name`, `net.peer.port` is no longer required (but still recommended if non-standard). + * + * @deprecated Use ATTR_DB_MSSQL_INSTANCE_NAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_DB_MSSQL_INSTANCE_NAME = TMP_DB_MSSQL_INSTANCE_NAME; +/** + * The name of the keyspace being accessed. To be used instead of the generic `db.name` attribute. + * + * @deprecated Use ATTR_DB_NAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_DB_CASSANDRA_KEYSPACE = TMP_DB_CASSANDRA_KEYSPACE; +/** + * The fetch size used for paging, i.e. how many rows will be returned at once. + * + * @deprecated Use ATTR_DB_CASSANDRA_PAGE_SIZE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_DB_CASSANDRA_PAGE_SIZE = TMP_DB_CASSANDRA_PAGE_SIZE; +/** + * The consistency level of the query. Based on consistency values from [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). + * + * @deprecated Use ATTR_DB_CASSANDRA_CONSISTENCY_LEVEL in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_DB_CASSANDRA_CONSISTENCY_LEVEL = TMP_DB_CASSANDRA_CONSISTENCY_LEVEL; +/** + * The name of the primary table that the operation is acting upon, including the schema name (if applicable). + * + * Note: This mirrors the db.sql.table attribute but references cassandra rather than sql. It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set. + * + * @deprecated Use ATTR_DB_CASSANDRA_TABLE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_DB_CASSANDRA_TABLE = TMP_DB_CASSANDRA_TABLE; +/** + * Whether or not the query is idempotent. + * + * @deprecated Use ATTR_DB_CASSANDRA_IDEMPOTENCE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_DB_CASSANDRA_IDEMPOTENCE = TMP_DB_CASSANDRA_IDEMPOTENCE; +/** + * The number of times a query was speculatively executed. Not set or `0` if the query was not executed speculatively. + * + * @deprecated Use ATTR_DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT = TMP_DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT; +/** + * The ID of the coordinating node for a query. + * + * @deprecated Use ATTR_DB_CASSANDRA_COORDINATOR_ID in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_DB_CASSANDRA_COORDINATOR_ID = TMP_DB_CASSANDRA_COORDINATOR_ID; +/** + * The data center of the coordinating node for a query. + * + * @deprecated Use ATTR_DB_CASSANDRA_COORDINATOR_DC in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_DB_CASSANDRA_COORDINATOR_DC = TMP_DB_CASSANDRA_COORDINATOR_DC; +/** + * The [HBase namespace](https://hbase.apache.org/book.html#_namespace) being accessed. To be used instead of the generic `db.name` attribute. + * + * @deprecated Use ATTR_DB_NAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_DB_HBASE_NAMESPACE = TMP_DB_HBASE_NAMESPACE; +/** + * The index of the database being accessed as used in the [`SELECT` command](https://redis.io/commands/select), provided as an integer. To be used instead of the generic `db.name` attribute. + * + * @deprecated Use ATTR_DB_REDIS_DATABASE_INDEX in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_DB_REDIS_DATABASE_INDEX = TMP_DB_REDIS_DATABASE_INDEX; +/** + * The collection being accessed within the database stated in `db.name`. + * + * @deprecated Use ATTR_DB_MONGODB_COLLECTION in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_DB_MONGODB_COLLECTION = TMP_DB_MONGODB_COLLECTION; +/** + * The name of the primary table that the operation is acting upon, including the schema name (if applicable). + * + * Note: It is not recommended to attempt any client-side parsing of `db.statement` just to get this property, but it should be set if it is provided by the library being instrumented. If the operation is acting upon an anonymous table, or more than one table, this value MUST NOT be set. + * + * @deprecated Use ATTR_DB_SQL_TABLE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_DB_SQL_TABLE = TMP_DB_SQL_TABLE; +/** + * The type of the exception (its fully-qualified class name, if applicable). The dynamic type of the exception should be preferred over the static type in languages that support it. + * + * @deprecated Use ATTR_EXCEPTION_TYPE. + */ +exports.SEMATTRS_EXCEPTION_TYPE = TMP_EXCEPTION_TYPE; +/** + * The exception message. + * + * @deprecated Use ATTR_EXCEPTION_MESSAGE. + */ +exports.SEMATTRS_EXCEPTION_MESSAGE = TMP_EXCEPTION_MESSAGE; +/** + * A stacktrace as a string in the natural representation for the language runtime. The representation is to be determined and documented by each language SIG. + * + * @deprecated Use ATTR_EXCEPTION_STACKTRACE. + */ +exports.SEMATTRS_EXCEPTION_STACKTRACE = TMP_EXCEPTION_STACKTRACE; +/** +* SHOULD be set to true if the exception event is recorded at a point where it is known that the exception is escaping the scope of the span. +* +* Note: An exception is considered to have escaped (or left) the scope of a span, +if that span is ended while the exception is still logically "in flight". +This may be actually "in flight" in some languages (e.g. if the exception +is passed to a Context manager's `__exit__` method in Python) but will +usually be caught at the point of recording the exception in most languages. + +It is usually not possible to determine at the point where an exception is thrown +whether it will escape the scope of a span. +However, it is trivial to know that an exception +will escape, if one checks for an active exception just before ending the span, +as done in the [example above](#exception-end-example). + +It follows that an exception may still escape the scope of the span +even if the `exception.escaped` attribute was not set or set to false, +since the event might have been recorded at a time where it was not +clear whether the exception will escape. +* +* @deprecated Use ATTR_EXCEPTION_ESCAPED. +*/ +exports.SEMATTRS_EXCEPTION_ESCAPED = TMP_EXCEPTION_ESCAPED; +/** + * Type of the trigger on which the function is executed. + * + * @deprecated Use ATTR_FAAS_TRIGGER in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_FAAS_TRIGGER = TMP_FAAS_TRIGGER; +/** + * The execution ID of the current function execution. + * + * @deprecated Use ATTR_FAAS_INVOCATION_ID in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_FAAS_EXECUTION = TMP_FAAS_EXECUTION; +/** + * The name of the source on which the triggering operation was performed. For example, in Cloud Storage or S3 corresponds to the bucket name, and in Cosmos DB to the database name. + * + * @deprecated Use ATTR_FAAS_DOCUMENT_COLLECTION in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_FAAS_DOCUMENT_COLLECTION = TMP_FAAS_DOCUMENT_COLLECTION; +/** + * Describes the type of the operation that was performed on the data. + * + * @deprecated Use ATTR_FAAS_DOCUMENT_OPERATION in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_FAAS_DOCUMENT_OPERATION = TMP_FAAS_DOCUMENT_OPERATION; +/** + * A string containing the time when the data was accessed in the [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). + * + * @deprecated Use ATTR_FAAS_DOCUMENT_TIME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_FAAS_DOCUMENT_TIME = TMP_FAAS_DOCUMENT_TIME; +/** + * The document name/table subjected to the operation. For example, in Cloud Storage or S3 is the name of the file, and in Cosmos DB the table name. + * + * @deprecated Use ATTR_FAAS_DOCUMENT_NAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_FAAS_DOCUMENT_NAME = TMP_FAAS_DOCUMENT_NAME; +/** + * A string containing the function invocation time in the [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format expressed in [UTC](https://www.w3.org/TR/NOTE-datetime). + * + * @deprecated Use ATTR_FAAS_TIME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_FAAS_TIME = TMP_FAAS_TIME; +/** + * A string containing the schedule period as [Cron Expression](https://docs.oracle.com/cd/E12058_01/doc/doc.1014/e12030/cron_expressions.htm). + * + * @deprecated Use ATTR_FAAS_CRON in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_FAAS_CRON = TMP_FAAS_CRON; +/** + * A boolean that is true if the serverless function is executed for the first time (aka cold-start). + * + * @deprecated Use ATTR_FAAS_COLDSTART in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_FAAS_COLDSTART = TMP_FAAS_COLDSTART; +/** + * The name of the invoked function. + * + * Note: SHOULD be equal to the `faas.name` resource attribute of the invoked function. + * + * @deprecated Use ATTR_FAAS_INVOKED_NAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_FAAS_INVOKED_NAME = TMP_FAAS_INVOKED_NAME; +/** + * The cloud provider of the invoked function. + * + * Note: SHOULD be equal to the `cloud.provider` resource attribute of the invoked function. + * + * @deprecated Use ATTR_FAAS_INVOKED_PROVIDER in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_FAAS_INVOKED_PROVIDER = TMP_FAAS_INVOKED_PROVIDER; +/** + * The cloud region of the invoked function. + * + * Note: SHOULD be equal to the `cloud.region` resource attribute of the invoked function. + * + * @deprecated Use ATTR_FAAS_INVOKED_REGION in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_FAAS_INVOKED_REGION = TMP_FAAS_INVOKED_REGION; +/** + * Transport protocol used. See note below. + * + * @deprecated Use ATTR_NET_TRANSPORT in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_NET_TRANSPORT = TMP_NET_TRANSPORT; +/** + * Remote address of the peer (dotted decimal for IPv4 or [RFC5952](https://tools.ietf.org/html/rfc5952) for IPv6). + * + * @deprecated Use ATTR_NET_PEER_IP in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_NET_PEER_IP = TMP_NET_PEER_IP; +/** + * Remote port number. + * + * @deprecated Use ATTR_NET_PEER_PORT in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_NET_PEER_PORT = TMP_NET_PEER_PORT; +/** + * Remote hostname or similar, see note below. + * + * @deprecated Use ATTR_NET_PEER_NAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_NET_PEER_NAME = TMP_NET_PEER_NAME; +/** + * Like `net.peer.ip` but for the host IP. Useful in case of a multi-IP host. + * + * @deprecated Use ATTR_NET_HOST_IP in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_NET_HOST_IP = TMP_NET_HOST_IP; +/** + * Like `net.peer.port` but for the host port. + * + * @deprecated Use ATTR_NET_HOST_PORT in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_NET_HOST_PORT = TMP_NET_HOST_PORT; +/** + * Local hostname or similar, see note below. + * + * @deprecated Use ATTR_NET_HOST_NAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_NET_HOST_NAME = TMP_NET_HOST_NAME; +/** + * The internet connection type currently being used by the host. + * + * @deprecated Use ATTR_NETWORK_CONNECTION_TYPE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_NET_HOST_CONNECTION_TYPE = TMP_NET_HOST_CONNECTION_TYPE; +/** + * This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection. + * + * @deprecated Use ATTR_NETWORK_CONNECTION_SUBTYPE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_NET_HOST_CONNECTION_SUBTYPE = TMP_NET_HOST_CONNECTION_SUBTYPE; +/** + * The name of the mobile carrier. + * + * @deprecated Use ATTR_NETWORK_CARRIER_NAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_NET_HOST_CARRIER_NAME = TMP_NET_HOST_CARRIER_NAME; +/** + * The mobile carrier country code. + * + * @deprecated Use ATTR_NETWORK_CARRIER_MCC in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_NET_HOST_CARRIER_MCC = TMP_NET_HOST_CARRIER_MCC; +/** + * The mobile carrier network code. + * + * @deprecated Use ATTR_NETWORK_CARRIER_MNC in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_NET_HOST_CARRIER_MNC = TMP_NET_HOST_CARRIER_MNC; +/** + * The ISO 3166-1 alpha-2 2-character country code associated with the mobile carrier network. + * + * @deprecated Use ATTR_NETWORK_CARRIER_ICC in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_NET_HOST_CARRIER_ICC = TMP_NET_HOST_CARRIER_ICC; +/** + * The [`service.name`](../../resource/semantic_conventions/README.md#service) of the remote service. SHOULD be equal to the actual `service.name` resource attribute of the remote service if any. + * + * @deprecated Use ATTR_PEER_SERVICE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_PEER_SERVICE = TMP_PEER_SERVICE; +/** + * Username or client_id extracted from the access token or [Authorization](https://tools.ietf.org/html/rfc7235#section-4.2) header in the inbound request from outside the system. + * + * @deprecated Use ATTR_ENDUSER_ID in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_ENDUSER_ID = TMP_ENDUSER_ID; +/** + * Actual/assumed role the client is making the request under extracted from token or application security context. + * + * @deprecated Use ATTR_ENDUSER_ROLE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_ENDUSER_ROLE = TMP_ENDUSER_ROLE; +/** + * Scopes or granted authorities the client currently possesses extracted from token or application security context. The value would come from the scope associated with an [OAuth 2.0 Access Token](https://tools.ietf.org/html/rfc6749#section-3.3) or an attribute value in a [SAML 2.0 Assertion](http://docs.oasis-open.org/security/saml/Post2.0/sstc-saml-tech-overview-2.0.html). + * + * @deprecated Use ATTR_ENDUSER_SCOPE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_ENDUSER_SCOPE = TMP_ENDUSER_SCOPE; +/** + * Current "managed" thread ID (as opposed to OS thread ID). + * + * @deprecated Use ATTR_THREAD_ID in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_THREAD_ID = TMP_THREAD_ID; +/** + * Current thread name. + * + * @deprecated Use ATTR_THREAD_NAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_THREAD_NAME = TMP_THREAD_NAME; +/** + * The method or function name, or equivalent (usually rightmost part of the code unit's name). + * + * @deprecated Use ATTR_CODE_FUNCTION in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_CODE_FUNCTION = TMP_CODE_FUNCTION; +/** + * The "namespace" within which `code.function` is defined. Usually the qualified class or module name, such that `code.namespace` + some separator + `code.function` form a unique identifier for the code unit. + * + * @deprecated Use ATTR_CODE_NAMESPACE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_CODE_NAMESPACE = TMP_CODE_NAMESPACE; +/** + * The source code file name that identifies the code unit as uniquely as possible (preferably an absolute file path). + * + * @deprecated Use ATTR_CODE_FILEPATH in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_CODE_FILEPATH = TMP_CODE_FILEPATH; +/** + * The line number in `code.filepath` best representing the operation. It SHOULD point within the code unit named in `code.function`. + * + * @deprecated Use ATTR_CODE_LINENO in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_CODE_LINENO = TMP_CODE_LINENO; +/** + * HTTP request method. + * + * @deprecated Use ATTR_HTTP_METHOD in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_HTTP_METHOD = TMP_HTTP_METHOD; +/** + * Full HTTP request URL in the form `scheme://host[:port]/path?query[#fragment]`. Usually the fragment is not transmitted over HTTP, but if it is known, it should be included nevertheless. + * + * Note: `http.url` MUST NOT contain credentials passed via URL in form of `https://username:password@www.example.com/`. In such case the attribute's value should be `https://www.example.com/`. + * + * @deprecated Use ATTR_HTTP_URL in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_HTTP_URL = TMP_HTTP_URL; +/** + * The full request target as passed in a HTTP request line or equivalent. + * + * @deprecated Use ATTR_HTTP_TARGET in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_HTTP_TARGET = TMP_HTTP_TARGET; +/** + * The value of the [HTTP host header](https://tools.ietf.org/html/rfc7230#section-5.4). An empty Host header should also be reported, see note. + * + * Note: When the header is present but empty the attribute SHOULD be set to the empty string. Note that this is a valid situation that is expected in certain cases, according the aforementioned [section of RFC 7230](https://tools.ietf.org/html/rfc7230#section-5.4). When the header is not set the attribute MUST NOT be set. + * + * @deprecated Use ATTR_HTTP_HOST in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_HTTP_HOST = TMP_HTTP_HOST; +/** + * The URI scheme identifying the used protocol. + * + * @deprecated Use ATTR_HTTP_SCHEME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_HTTP_SCHEME = TMP_HTTP_SCHEME; +/** + * [HTTP response status code](https://tools.ietf.org/html/rfc7231#section-6). + * + * @deprecated Use ATTR_HTTP_STATUS_CODE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_HTTP_STATUS_CODE = TMP_HTTP_STATUS_CODE; +/** + * Kind of HTTP protocol used. + * + * Note: If `net.transport` is not specified, it can be assumed to be `IP.TCP` except if `http.flavor` is `QUIC`, in which case `IP.UDP` is assumed. + * + * @deprecated Use ATTR_HTTP_FLAVOR in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_HTTP_FLAVOR = TMP_HTTP_FLAVOR; +/** + * Value of the [HTTP User-Agent](https://tools.ietf.org/html/rfc7231#section-5.5.3) header sent by the client. + * + * @deprecated Use ATTR_HTTP_USER_AGENT in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_HTTP_USER_AGENT = TMP_HTTP_USER_AGENT; +/** + * The size of the request payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://tools.ietf.org/html/rfc7230#section-3.3.2) header. For requests using transport encoding, this should be the compressed size. + * + * @deprecated Use ATTR_HTTP_REQUEST_CONTENT_LENGTH in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH = TMP_HTTP_REQUEST_CONTENT_LENGTH; +/** + * The size of the uncompressed request payload body after transport decoding. Not set if transport encoding not used. + * + * @deprecated Use ATTR_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED = TMP_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED; +/** + * The size of the response payload body in bytes. This is the number of bytes transferred excluding headers and is often, but not always, present as the [Content-Length](https://tools.ietf.org/html/rfc7230#section-3.3.2) header. For requests using transport encoding, this should be the compressed size. + * + * @deprecated Use ATTR_HTTP_RESPONSE_CONTENT_LENGTH in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH = TMP_HTTP_RESPONSE_CONTENT_LENGTH; +/** + * The size of the uncompressed response payload body after transport decoding. Not set if transport encoding not used. + * + * @deprecated Use ATTR_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED = TMP_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED; +/** + * The primary server name of the matched virtual host. This should be obtained via configuration. If no such configuration can be obtained, this attribute MUST NOT be set ( `net.host.name` should be used instead). + * + * Note: `http.url` is usually not readily available on the server side but would have to be assembled in a cumbersome and sometimes lossy process from other information (see e.g. open-telemetry/opentelemetry-python/pull/148). It is thus preferred to supply the raw data that is available. + * + * @deprecated Use ATTR_HTTP_SERVER_NAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_HTTP_SERVER_NAME = TMP_HTTP_SERVER_NAME; +/** + * The matched route (path template). + * + * @deprecated Use ATTR_HTTP_ROUTE. + */ +exports.SEMATTRS_HTTP_ROUTE = TMP_HTTP_ROUTE; +/** +* The IP address of the original client behind all proxies, if known (e.g. from [X-Forwarded-For](https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Forwarded-For)). +* +* Note: This is not necessarily the same as `net.peer.ip`, which would +identify the network-level peer, which may be a proxy. + +This attribute should be set when a source of information different +from the one used for `net.peer.ip`, is available even if that other +source just confirms the same value as `net.peer.ip`. +Rationale: For `net.peer.ip`, one typically does not know if it +comes from a proxy, reverse proxy, or the actual client. Setting +`http.client_ip` when it's the same as `net.peer.ip` means that +one is at least somewhat confident that the address is not that of +the closest proxy. +* +* @deprecated Use ATTR_HTTP_CLIENT_IP in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). +*/ +exports.SEMATTRS_HTTP_CLIENT_IP = TMP_HTTP_CLIENT_IP; +/** + * The keys in the `RequestItems` object field. + * + * @deprecated Use ATTR_AWS_DYNAMODB_TABLE_NAMES in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_AWS_DYNAMODB_TABLE_NAMES = TMP_AWS_DYNAMODB_TABLE_NAMES; +/** + * The JSON-serialized value of each item in the `ConsumedCapacity` response field. + * + * @deprecated Use ATTR_AWS_DYNAMODB_CONSUMED_CAPACITY in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_AWS_DYNAMODB_CONSUMED_CAPACITY = TMP_AWS_DYNAMODB_CONSUMED_CAPACITY; +/** + * The JSON-serialized value of the `ItemCollectionMetrics` response field. + * + * @deprecated Use ATTR_AWS_DYNAMODB_ITEM_COLLECTION_METRICS in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_AWS_DYNAMODB_ITEM_COLLECTION_METRICS = TMP_AWS_DYNAMODB_ITEM_COLLECTION_METRICS; +/** + * The value of the `ProvisionedThroughput.ReadCapacityUnits` request parameter. + * + * @deprecated Use ATTR_AWS_DYNAMODB_PROVISIONED_READ_CAPACITY in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_AWS_DYNAMODB_PROVISIONED_READ_CAPACITY = TMP_AWS_DYNAMODB_PROVISIONED_READ_CAPACITY; +/** + * The value of the `ProvisionedThroughput.WriteCapacityUnits` request parameter. + * + * @deprecated Use ATTR_AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY = TMP_AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY; +/** + * The value of the `ConsistentRead` request parameter. + * + * @deprecated Use ATTR_AWS_DYNAMODB_CONSISTENT_READ in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_AWS_DYNAMODB_CONSISTENT_READ = TMP_AWS_DYNAMODB_CONSISTENT_READ; +/** + * The value of the `ProjectionExpression` request parameter. + * + * @deprecated Use ATTR_AWS_DYNAMODB_PROJECTION in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_AWS_DYNAMODB_PROJECTION = TMP_AWS_DYNAMODB_PROJECTION; +/** + * The value of the `Limit` request parameter. + * + * @deprecated Use ATTR_AWS_DYNAMODB_LIMIT in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_AWS_DYNAMODB_LIMIT = TMP_AWS_DYNAMODB_LIMIT; +/** + * The value of the `AttributesToGet` request parameter. + * + * @deprecated Use ATTR_AWS_DYNAMODB_ATTRIBUTES_TO_GET in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_AWS_DYNAMODB_ATTRIBUTES_TO_GET = TMP_AWS_DYNAMODB_ATTRIBUTES_TO_GET; +/** + * The value of the `IndexName` request parameter. + * + * @deprecated Use ATTR_AWS_DYNAMODB_INDEX_NAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_AWS_DYNAMODB_INDEX_NAME = TMP_AWS_DYNAMODB_INDEX_NAME; +/** + * The value of the `Select` request parameter. + * + * @deprecated Use ATTR_AWS_DYNAMODB_SELECT in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_AWS_DYNAMODB_SELECT = TMP_AWS_DYNAMODB_SELECT; +/** + * The JSON-serialized value of each item of the `GlobalSecondaryIndexes` request field. + * + * @deprecated Use ATTR_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES = TMP_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES; +/** + * The JSON-serialized value of each item of the `LocalSecondaryIndexes` request field. + * + * @deprecated Use ATTR_AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES = TMP_AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES; +/** + * The value of the `ExclusiveStartTableName` request parameter. + * + * @deprecated Use ATTR_AWS_DYNAMODB_EXCLUSIVE_START_TABLE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_AWS_DYNAMODB_EXCLUSIVE_START_TABLE = TMP_AWS_DYNAMODB_EXCLUSIVE_START_TABLE; +/** + * The the number of items in the `TableNames` response parameter. + * + * @deprecated Use ATTR_AWS_DYNAMODB_TABLE_COUNT in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_AWS_DYNAMODB_TABLE_COUNT = TMP_AWS_DYNAMODB_TABLE_COUNT; +/** + * The value of the `ScanIndexForward` request parameter. + * + * @deprecated Use ATTR_AWS_DYNAMODB_SCAN_FORWARD in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_AWS_DYNAMODB_SCAN_FORWARD = TMP_AWS_DYNAMODB_SCAN_FORWARD; +/** + * The value of the `Segment` request parameter. + * + * @deprecated Use ATTR_AWS_DYNAMODB_SEGMENT in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_AWS_DYNAMODB_SEGMENT = TMP_AWS_DYNAMODB_SEGMENT; +/** + * The value of the `TotalSegments` request parameter. + * + * @deprecated Use ATTR_AWS_DYNAMODB_TOTAL_SEGMENTS in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_AWS_DYNAMODB_TOTAL_SEGMENTS = TMP_AWS_DYNAMODB_TOTAL_SEGMENTS; +/** + * The value of the `Count` response parameter. + * + * @deprecated Use ATTR_AWS_DYNAMODB_COUNT in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_AWS_DYNAMODB_COUNT = TMP_AWS_DYNAMODB_COUNT; +/** + * The value of the `ScannedCount` response parameter. + * + * @deprecated Use ATTR_AWS_DYNAMODB_SCANNED_COUNT in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_AWS_DYNAMODB_SCANNED_COUNT = TMP_AWS_DYNAMODB_SCANNED_COUNT; +/** + * The JSON-serialized value of each item in the `AttributeDefinitions` request field. + * + * @deprecated Use ATTR_AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS = TMP_AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS; +/** + * The JSON-serialized value of each item in the the `GlobalSecondaryIndexUpdates` request field. + * + * @deprecated Use ATTR_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES = TMP_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES; +/** + * A string identifying the messaging system. + * + * @deprecated Use ATTR_MESSAGING_SYSTEM in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_MESSAGING_SYSTEM = TMP_MESSAGING_SYSTEM; +/** + * The message destination name. This might be equal to the span name but is required nevertheless. + * + * @deprecated Use ATTR_MESSAGING_DESTINATION_NAME in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_MESSAGING_DESTINATION = TMP_MESSAGING_DESTINATION; +/** + * The kind of message destination. + * + * @deprecated Removed in semconv v1.20.0. + */ +exports.SEMATTRS_MESSAGING_DESTINATION_KIND = TMP_MESSAGING_DESTINATION_KIND; +/** + * A boolean that is true if the message destination is temporary. + * + * @deprecated Use ATTR_MESSAGING_DESTINATION_TEMPORARY in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_MESSAGING_TEMP_DESTINATION = TMP_MESSAGING_TEMP_DESTINATION; +/** + * The name of the transport protocol. + * + * @deprecated Use ATTR_NETWORK_PROTOCOL_NAME. + */ +exports.SEMATTRS_MESSAGING_PROTOCOL = TMP_MESSAGING_PROTOCOL; +/** + * The version of the transport protocol. + * + * @deprecated Use ATTR_NETWORK_PROTOCOL_VERSION. + */ +exports.SEMATTRS_MESSAGING_PROTOCOL_VERSION = TMP_MESSAGING_PROTOCOL_VERSION; +/** + * Connection string. + * + * @deprecated Removed in semconv v1.17.0. + */ +exports.SEMATTRS_MESSAGING_URL = TMP_MESSAGING_URL; +/** + * A value used by the messaging system as an identifier for the message, represented as a string. + * + * @deprecated Use ATTR_MESSAGING_MESSAGE_ID in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_MESSAGING_MESSAGE_ID = TMP_MESSAGING_MESSAGE_ID; +/** + * The [conversation ID](#conversations) identifying the conversation to which the message belongs, represented as a string. Sometimes called "Correlation ID". + * + * @deprecated Use ATTR_MESSAGING_MESSAGE_CONVERSATION_ID in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_MESSAGING_CONVERSATION_ID = TMP_MESSAGING_CONVERSATION_ID; +/** + * The (uncompressed) size of the message payload in bytes. Also use this attribute if it is unknown whether the compressed or uncompressed payload size is reported. + * + * @deprecated Use ATTR_MESSAGING_MESSAGE_BODY_SIZE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES = TMP_MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES; +/** + * The compressed size of the message payload in bytes. + * + * @deprecated Removed in semconv v1.22.0. + */ +exports.SEMATTRS_MESSAGING_MESSAGE_PAYLOAD_COMPRESSED_SIZE_BYTES = TMP_MESSAGING_MESSAGE_PAYLOAD_COMPRESSED_SIZE_BYTES; +/** + * A string identifying the kind of message consumption as defined in the [Operation names](#operation-names) section above. If the operation is "send", this attribute MUST NOT be set, since the operation can be inferred from the span kind in that case. + * + * @deprecated Use ATTR_MESSAGING_OPERATION in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_MESSAGING_OPERATION = TMP_MESSAGING_OPERATION; +/** + * The identifier for the consumer receiving a message. For Kafka, set it to `{messaging.kafka.consumer_group} - {messaging.kafka.client_id}`, if both are present, or only `messaging.kafka.consumer_group`. For brokers, such as RabbitMQ and Artemis, set it to the `client_id` of the client consuming the message. + * + * @deprecated Removed in semconv v1.21.0. + */ +exports.SEMATTRS_MESSAGING_CONSUMER_ID = TMP_MESSAGING_CONSUMER_ID; +/** + * RabbitMQ message routing key. + * + * @deprecated Use ATTR_MESSAGING_RABBITMQ_DESTINATION_ROUTING_KEY in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_MESSAGING_RABBITMQ_ROUTING_KEY = TMP_MESSAGING_RABBITMQ_ROUTING_KEY; +/** + * Message keys in Kafka are used for grouping alike messages to ensure they're processed on the same partition. They differ from `messaging.message_id` in that they're not unique. If the key is `null`, the attribute MUST NOT be set. + * + * Note: If the key type is not string, it's string representation has to be supplied for the attribute. If the key has no unambiguous, canonical string form, don't include its value. + * + * @deprecated Use ATTR_MESSAGING_KAFKA_MESSAGE_KEY in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_MESSAGING_KAFKA_MESSAGE_KEY = TMP_MESSAGING_KAFKA_MESSAGE_KEY; +/** + * Name of the Kafka Consumer Group that is handling the message. Only applies to consumers, not producers. + * + * @deprecated Use ATTR_MESSAGING_KAFKA_CONSUMER_GROUP in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_MESSAGING_KAFKA_CONSUMER_GROUP = TMP_MESSAGING_KAFKA_CONSUMER_GROUP; +/** + * Client Id for the Consumer or Producer that is handling the message. + * + * @deprecated Use ATTR_MESSAGING_CLIENT_ID in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_MESSAGING_KAFKA_CLIENT_ID = TMP_MESSAGING_KAFKA_CLIENT_ID; +/** + * Partition the message is sent to. + * + * @deprecated Use ATTR_MESSAGING_KAFKA_DESTINATION_PARTITION in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_MESSAGING_KAFKA_PARTITION = TMP_MESSAGING_KAFKA_PARTITION; +/** + * A boolean that is true if the message is a tombstone. + * + * @deprecated Use ATTR_MESSAGING_KAFKA_MESSAGE_TOMBSTONE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_MESSAGING_KAFKA_TOMBSTONE = TMP_MESSAGING_KAFKA_TOMBSTONE; +/** + * A string identifying the remoting system. + * + * @deprecated Use ATTR_RPC_SYSTEM in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_RPC_SYSTEM = TMP_RPC_SYSTEM; +/** + * The full (logical) name of the service being called, including its package name, if applicable. + * + * Note: This is the logical name of the service from the RPC interface perspective, which can be different from the name of any implementing class. The `code.namespace` attribute may be used to store the latter (despite the attribute name, it may include a class name; e.g., class with method actually executing the call on the server side, RPC client stub class on the client side). + * + * @deprecated Use ATTR_RPC_SERVICE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_RPC_SERVICE = TMP_RPC_SERVICE; +/** + * The name of the (logical) method being called, must be equal to the $method part in the span name. + * + * Note: This is the logical name of the method from the RPC interface perspective, which can be different from the name of any implementing method/function. The `code.function` attribute may be used to store the latter (e.g., method actually executing the call on the server side, RPC client stub method on the client side). + * + * @deprecated Use ATTR_RPC_METHOD in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_RPC_METHOD = TMP_RPC_METHOD; +/** + * The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request. + * + * @deprecated Use ATTR_RPC_GRPC_STATUS_CODE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_RPC_GRPC_STATUS_CODE = TMP_RPC_GRPC_STATUS_CODE; +/** + * Protocol version as in `jsonrpc` property of request/response. Since JSON-RPC 1.0 does not specify this, the value can be omitted. + * + * @deprecated Use ATTR_RPC_JSONRPC_VERSION in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_RPC_JSONRPC_VERSION = TMP_RPC_JSONRPC_VERSION; +/** + * `id` property of request or response. Since protocol allows id to be int, string, `null` or missing (for notifications), value is expected to be cast to string for simplicity. Use empty string in case of `null` value. Omit entirely if this is a notification. + * + * @deprecated Use ATTR_RPC_JSONRPC_REQUEST_ID in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_RPC_JSONRPC_REQUEST_ID = TMP_RPC_JSONRPC_REQUEST_ID; +/** + * `error.code` property of response if it is an error response. + * + * @deprecated Use ATTR_RPC_JSONRPC_ERROR_CODE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_RPC_JSONRPC_ERROR_CODE = TMP_RPC_JSONRPC_ERROR_CODE; +/** + * `error.message` property of response if it is an error response. + * + * @deprecated Use ATTR_RPC_JSONRPC_ERROR_MESSAGE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_RPC_JSONRPC_ERROR_MESSAGE = TMP_RPC_JSONRPC_ERROR_MESSAGE; +/** + * Whether this is a received or sent message. + * + * @deprecated Use ATTR_MESSAGE_TYPE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_MESSAGE_TYPE = TMP_MESSAGE_TYPE; +/** + * MUST be calculated as two different counters starting from `1` one for sent messages and one for received message. + * + * Note: This way we guarantee that the values will be consistent between different implementations. + * + * @deprecated Use ATTR_MESSAGE_ID in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_MESSAGE_ID = TMP_MESSAGE_ID; +/** + * Compressed size of the message in bytes. + * + * @deprecated Use ATTR_MESSAGE_COMPRESSED_SIZE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_MESSAGE_COMPRESSED_SIZE = TMP_MESSAGE_COMPRESSED_SIZE; +/** + * Uncompressed size of the message in bytes. + * + * @deprecated Use ATTR_MESSAGE_UNCOMPRESSED_SIZE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.SEMATTRS_MESSAGE_UNCOMPRESSED_SIZE = TMP_MESSAGE_UNCOMPRESSED_SIZE; +/** + * Create exported Value Map for SemanticAttributes values + * @deprecated Use the SEMATTRS_XXXXX constants rather than the SemanticAttributes.XXXXX for bundle minification + */ +exports.SemanticAttributes = +/*#__PURE__*/ (0, utils_1.createConstMap)([ + TMP_AWS_LAMBDA_INVOKED_ARN, + TMP_DB_SYSTEM, + TMP_DB_CONNECTION_STRING, + TMP_DB_USER, + TMP_DB_JDBC_DRIVER_CLASSNAME, + TMP_DB_NAME, + TMP_DB_STATEMENT, + TMP_DB_OPERATION, + TMP_DB_MSSQL_INSTANCE_NAME, + TMP_DB_CASSANDRA_KEYSPACE, + TMP_DB_CASSANDRA_PAGE_SIZE, + TMP_DB_CASSANDRA_CONSISTENCY_LEVEL, + TMP_DB_CASSANDRA_TABLE, + TMP_DB_CASSANDRA_IDEMPOTENCE, + TMP_DB_CASSANDRA_SPECULATIVE_EXECUTION_COUNT, + TMP_DB_CASSANDRA_COORDINATOR_ID, + TMP_DB_CASSANDRA_COORDINATOR_DC, + TMP_DB_HBASE_NAMESPACE, + TMP_DB_REDIS_DATABASE_INDEX, + TMP_DB_MONGODB_COLLECTION, + TMP_DB_SQL_TABLE, + TMP_EXCEPTION_TYPE, + TMP_EXCEPTION_MESSAGE, + TMP_EXCEPTION_STACKTRACE, + TMP_EXCEPTION_ESCAPED, + TMP_FAAS_TRIGGER, + TMP_FAAS_EXECUTION, + TMP_FAAS_DOCUMENT_COLLECTION, + TMP_FAAS_DOCUMENT_OPERATION, + TMP_FAAS_DOCUMENT_TIME, + TMP_FAAS_DOCUMENT_NAME, + TMP_FAAS_TIME, + TMP_FAAS_CRON, + TMP_FAAS_COLDSTART, + TMP_FAAS_INVOKED_NAME, + TMP_FAAS_INVOKED_PROVIDER, + TMP_FAAS_INVOKED_REGION, + TMP_NET_TRANSPORT, + TMP_NET_PEER_IP, + TMP_NET_PEER_PORT, + TMP_NET_PEER_NAME, + TMP_NET_HOST_IP, + TMP_NET_HOST_PORT, + TMP_NET_HOST_NAME, + TMP_NET_HOST_CONNECTION_TYPE, + TMP_NET_HOST_CONNECTION_SUBTYPE, + TMP_NET_HOST_CARRIER_NAME, + TMP_NET_HOST_CARRIER_MCC, + TMP_NET_HOST_CARRIER_MNC, + TMP_NET_HOST_CARRIER_ICC, + TMP_PEER_SERVICE, + TMP_ENDUSER_ID, + TMP_ENDUSER_ROLE, + TMP_ENDUSER_SCOPE, + TMP_THREAD_ID, + TMP_THREAD_NAME, + TMP_CODE_FUNCTION, + TMP_CODE_NAMESPACE, + TMP_CODE_FILEPATH, + TMP_CODE_LINENO, + TMP_HTTP_METHOD, + TMP_HTTP_URL, + TMP_HTTP_TARGET, + TMP_HTTP_HOST, + TMP_HTTP_SCHEME, + TMP_HTTP_STATUS_CODE, + TMP_HTTP_FLAVOR, + TMP_HTTP_USER_AGENT, + TMP_HTTP_REQUEST_CONTENT_LENGTH, + TMP_HTTP_REQUEST_CONTENT_LENGTH_UNCOMPRESSED, + TMP_HTTP_RESPONSE_CONTENT_LENGTH, + TMP_HTTP_RESPONSE_CONTENT_LENGTH_UNCOMPRESSED, + TMP_HTTP_SERVER_NAME, + TMP_HTTP_ROUTE, + TMP_HTTP_CLIENT_IP, + TMP_AWS_DYNAMODB_TABLE_NAMES, + TMP_AWS_DYNAMODB_CONSUMED_CAPACITY, + TMP_AWS_DYNAMODB_ITEM_COLLECTION_METRICS, + TMP_AWS_DYNAMODB_PROVISIONED_READ_CAPACITY, + TMP_AWS_DYNAMODB_PROVISIONED_WRITE_CAPACITY, + TMP_AWS_DYNAMODB_CONSISTENT_READ, + TMP_AWS_DYNAMODB_PROJECTION, + TMP_AWS_DYNAMODB_LIMIT, + TMP_AWS_DYNAMODB_ATTRIBUTES_TO_GET, + TMP_AWS_DYNAMODB_INDEX_NAME, + TMP_AWS_DYNAMODB_SELECT, + TMP_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEXES, + TMP_AWS_DYNAMODB_LOCAL_SECONDARY_INDEXES, + TMP_AWS_DYNAMODB_EXCLUSIVE_START_TABLE, + TMP_AWS_DYNAMODB_TABLE_COUNT, + TMP_AWS_DYNAMODB_SCAN_FORWARD, + TMP_AWS_DYNAMODB_SEGMENT, + TMP_AWS_DYNAMODB_TOTAL_SEGMENTS, + TMP_AWS_DYNAMODB_COUNT, + TMP_AWS_DYNAMODB_SCANNED_COUNT, + TMP_AWS_DYNAMODB_ATTRIBUTE_DEFINITIONS, + TMP_AWS_DYNAMODB_GLOBAL_SECONDARY_INDEX_UPDATES, + TMP_MESSAGING_SYSTEM, + TMP_MESSAGING_DESTINATION, + TMP_MESSAGING_DESTINATION_KIND, + TMP_MESSAGING_TEMP_DESTINATION, + TMP_MESSAGING_PROTOCOL, + TMP_MESSAGING_PROTOCOL_VERSION, + TMP_MESSAGING_URL, + TMP_MESSAGING_MESSAGE_ID, + TMP_MESSAGING_CONVERSATION_ID, + TMP_MESSAGING_MESSAGE_PAYLOAD_SIZE_BYTES, + TMP_MESSAGING_MESSAGE_PAYLOAD_COMPRESSED_SIZE_BYTES, + TMP_MESSAGING_OPERATION, + TMP_MESSAGING_CONSUMER_ID, + TMP_MESSAGING_RABBITMQ_ROUTING_KEY, + TMP_MESSAGING_KAFKA_MESSAGE_KEY, + TMP_MESSAGING_KAFKA_CONSUMER_GROUP, + TMP_MESSAGING_KAFKA_CLIENT_ID, + TMP_MESSAGING_KAFKA_PARTITION, + TMP_MESSAGING_KAFKA_TOMBSTONE, + TMP_RPC_SYSTEM, + TMP_RPC_SERVICE, + TMP_RPC_METHOD, + TMP_RPC_GRPC_STATUS_CODE, + TMP_RPC_JSONRPC_VERSION, + TMP_RPC_JSONRPC_REQUEST_ID, + TMP_RPC_JSONRPC_ERROR_CODE, + TMP_RPC_JSONRPC_ERROR_MESSAGE, + TMP_MESSAGE_TYPE, + TMP_MESSAGE_ID, + TMP_MESSAGE_COMPRESSED_SIZE, + TMP_MESSAGE_UNCOMPRESSED_SIZE, +]); +/* ---------------------------------------------------------------------------------------------------------- + * Constant values for DbSystemValues enum definition + * + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * ---------------------------------------------------------------------------------------------------------- */ +// Temporary local constants to assign to the individual exports and the namespaced version +// Required to avoid the namespace exports using the unminifiable export names for some package types +const TMP_DBSYSTEMVALUES_OTHER_SQL = 'other_sql'; +const TMP_DBSYSTEMVALUES_MSSQL = 'mssql'; +const TMP_DBSYSTEMVALUES_MYSQL = 'mysql'; +const TMP_DBSYSTEMVALUES_ORACLE = 'oracle'; +const TMP_DBSYSTEMVALUES_DB2 = 'db2'; +const TMP_DBSYSTEMVALUES_POSTGRESQL = 'postgresql'; +const TMP_DBSYSTEMVALUES_REDSHIFT = 'redshift'; +const TMP_DBSYSTEMVALUES_HIVE = 'hive'; +const TMP_DBSYSTEMVALUES_CLOUDSCAPE = 'cloudscape'; +const TMP_DBSYSTEMVALUES_HSQLDB = 'hsqldb'; +const TMP_DBSYSTEMVALUES_PROGRESS = 'progress'; +const TMP_DBSYSTEMVALUES_MAXDB = 'maxdb'; +const TMP_DBSYSTEMVALUES_HANADB = 'hanadb'; +const TMP_DBSYSTEMVALUES_INGRES = 'ingres'; +const TMP_DBSYSTEMVALUES_FIRSTSQL = 'firstsql'; +const TMP_DBSYSTEMVALUES_EDB = 'edb'; +const TMP_DBSYSTEMVALUES_CACHE = 'cache'; +const TMP_DBSYSTEMVALUES_ADABAS = 'adabas'; +const TMP_DBSYSTEMVALUES_FIREBIRD = 'firebird'; +const TMP_DBSYSTEMVALUES_DERBY = 'derby'; +const TMP_DBSYSTEMVALUES_FILEMAKER = 'filemaker'; +const TMP_DBSYSTEMVALUES_INFORMIX = 'informix'; +const TMP_DBSYSTEMVALUES_INSTANTDB = 'instantdb'; +const TMP_DBSYSTEMVALUES_INTERBASE = 'interbase'; +const TMP_DBSYSTEMVALUES_MARIADB = 'mariadb'; +const TMP_DBSYSTEMVALUES_NETEZZA = 'netezza'; +const TMP_DBSYSTEMVALUES_PERVASIVE = 'pervasive'; +const TMP_DBSYSTEMVALUES_POINTBASE = 'pointbase'; +const TMP_DBSYSTEMVALUES_SQLITE = 'sqlite'; +const TMP_DBSYSTEMVALUES_SYBASE = 'sybase'; +const TMP_DBSYSTEMVALUES_TERADATA = 'teradata'; +const TMP_DBSYSTEMVALUES_VERTICA = 'vertica'; +const TMP_DBSYSTEMVALUES_H2 = 'h2'; +const TMP_DBSYSTEMVALUES_COLDFUSION = 'coldfusion'; +const TMP_DBSYSTEMVALUES_CASSANDRA = 'cassandra'; +const TMP_DBSYSTEMVALUES_HBASE = 'hbase'; +const TMP_DBSYSTEMVALUES_MONGODB = 'mongodb'; +const TMP_DBSYSTEMVALUES_REDIS = 'redis'; +const TMP_DBSYSTEMVALUES_COUCHBASE = 'couchbase'; +const TMP_DBSYSTEMVALUES_COUCHDB = 'couchdb'; +const TMP_DBSYSTEMVALUES_COSMOSDB = 'cosmosdb'; +const TMP_DBSYSTEMVALUES_DYNAMODB = 'dynamodb'; +const TMP_DBSYSTEMVALUES_NEO4J = 'neo4j'; +const TMP_DBSYSTEMVALUES_GEODE = 'geode'; +const TMP_DBSYSTEMVALUES_ELASTICSEARCH = 'elasticsearch'; +const TMP_DBSYSTEMVALUES_MEMCACHED = 'memcached'; +const TMP_DBSYSTEMVALUES_COCKROACHDB = 'cockroachdb'; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_OTHER_SQL in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_OTHER_SQL = TMP_DBSYSTEMVALUES_OTHER_SQL; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_MSSQL in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_MSSQL = TMP_DBSYSTEMVALUES_MSSQL; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_MYSQL in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_MYSQL = TMP_DBSYSTEMVALUES_MYSQL; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_ORACLE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_ORACLE = TMP_DBSYSTEMVALUES_ORACLE; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_DB2 in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_DB2 = TMP_DBSYSTEMVALUES_DB2; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_POSTGRESQL in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_POSTGRESQL = TMP_DBSYSTEMVALUES_POSTGRESQL; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_REDSHIFT in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_REDSHIFT = TMP_DBSYSTEMVALUES_REDSHIFT; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_HIVE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_HIVE = TMP_DBSYSTEMVALUES_HIVE; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_CLOUDSCAPE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_CLOUDSCAPE = TMP_DBSYSTEMVALUES_CLOUDSCAPE; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_HSQLDB in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_HSQLDB = TMP_DBSYSTEMVALUES_HSQLDB; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_PROGRESS in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_PROGRESS = TMP_DBSYSTEMVALUES_PROGRESS; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_MAXDB in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_MAXDB = TMP_DBSYSTEMVALUES_MAXDB; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_HANADB in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_HANADB = TMP_DBSYSTEMVALUES_HANADB; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_INGRES in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_INGRES = TMP_DBSYSTEMVALUES_INGRES; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_FIRSTSQL in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_FIRSTSQL = TMP_DBSYSTEMVALUES_FIRSTSQL; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_EDB in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_EDB = TMP_DBSYSTEMVALUES_EDB; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_CACHE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_CACHE = TMP_DBSYSTEMVALUES_CACHE; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_ADABAS in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_ADABAS = TMP_DBSYSTEMVALUES_ADABAS; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_FIREBIRD in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_FIREBIRD = TMP_DBSYSTEMVALUES_FIREBIRD; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_DERBY in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_DERBY = TMP_DBSYSTEMVALUES_DERBY; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_FILEMAKER in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_FILEMAKER = TMP_DBSYSTEMVALUES_FILEMAKER; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_INFORMIX in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_INFORMIX = TMP_DBSYSTEMVALUES_INFORMIX; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_INSTANTDB in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_INSTANTDB = TMP_DBSYSTEMVALUES_INSTANTDB; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_INTERBASE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_INTERBASE = TMP_DBSYSTEMVALUES_INTERBASE; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_MARIADB in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_MARIADB = TMP_DBSYSTEMVALUES_MARIADB; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_NETEZZA in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_NETEZZA = TMP_DBSYSTEMVALUES_NETEZZA; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_PERVASIVE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_PERVASIVE = TMP_DBSYSTEMVALUES_PERVASIVE; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_POINTBASE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_POINTBASE = TMP_DBSYSTEMVALUES_POINTBASE; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_SQLITE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_SQLITE = TMP_DBSYSTEMVALUES_SQLITE; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_SYBASE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_SYBASE = TMP_DBSYSTEMVALUES_SYBASE; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_TERADATA in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_TERADATA = TMP_DBSYSTEMVALUES_TERADATA; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_VERTICA in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_VERTICA = TMP_DBSYSTEMVALUES_VERTICA; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_H2 in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_H2 = TMP_DBSYSTEMVALUES_H2; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_COLDFUSION in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_COLDFUSION = TMP_DBSYSTEMVALUES_COLDFUSION; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_CASSANDRA in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_CASSANDRA = TMP_DBSYSTEMVALUES_CASSANDRA; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_HBASE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_HBASE = TMP_DBSYSTEMVALUES_HBASE; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_MONGODB in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_MONGODB = TMP_DBSYSTEMVALUES_MONGODB; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_REDIS in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_REDIS = TMP_DBSYSTEMVALUES_REDIS; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_COUCHBASE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_COUCHBASE = TMP_DBSYSTEMVALUES_COUCHBASE; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_COUCHDB in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_COUCHDB = TMP_DBSYSTEMVALUES_COUCHDB; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_COSMOSDB in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_COSMOSDB = TMP_DBSYSTEMVALUES_COSMOSDB; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_DYNAMODB in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_DYNAMODB = TMP_DBSYSTEMVALUES_DYNAMODB; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_NEO4J in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_NEO4J = TMP_DBSYSTEMVALUES_NEO4J; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_GEODE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_GEODE = TMP_DBSYSTEMVALUES_GEODE; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_ELASTICSEARCH in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_ELASTICSEARCH = TMP_DBSYSTEMVALUES_ELASTICSEARCH; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_MEMCACHED in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_MEMCACHED = TMP_DBSYSTEMVALUES_MEMCACHED; +/** + * An identifier for the database management system (DBMS) product being used. See below for a list of well-known identifiers. + * + * @deprecated Use DB_SYSTEM_VALUE_COCKROACHDB in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBSYSTEMVALUES_COCKROACHDB = TMP_DBSYSTEMVALUES_COCKROACHDB; +/** + * The constant map of values for DbSystemValues. + * @deprecated Use the DBSYSTEMVALUES_XXXXX constants rather than the DbSystemValues.XXXXX for bundle minification. + */ +exports.DbSystemValues = +/*#__PURE__*/ (0, utils_1.createConstMap)([ + TMP_DBSYSTEMVALUES_OTHER_SQL, + TMP_DBSYSTEMVALUES_MSSQL, + TMP_DBSYSTEMVALUES_MYSQL, + TMP_DBSYSTEMVALUES_ORACLE, + TMP_DBSYSTEMVALUES_DB2, + TMP_DBSYSTEMVALUES_POSTGRESQL, + TMP_DBSYSTEMVALUES_REDSHIFT, + TMP_DBSYSTEMVALUES_HIVE, + TMP_DBSYSTEMVALUES_CLOUDSCAPE, + TMP_DBSYSTEMVALUES_HSQLDB, + TMP_DBSYSTEMVALUES_PROGRESS, + TMP_DBSYSTEMVALUES_MAXDB, + TMP_DBSYSTEMVALUES_HANADB, + TMP_DBSYSTEMVALUES_INGRES, + TMP_DBSYSTEMVALUES_FIRSTSQL, + TMP_DBSYSTEMVALUES_EDB, + TMP_DBSYSTEMVALUES_CACHE, + TMP_DBSYSTEMVALUES_ADABAS, + TMP_DBSYSTEMVALUES_FIREBIRD, + TMP_DBSYSTEMVALUES_DERBY, + TMP_DBSYSTEMVALUES_FILEMAKER, + TMP_DBSYSTEMVALUES_INFORMIX, + TMP_DBSYSTEMVALUES_INSTANTDB, + TMP_DBSYSTEMVALUES_INTERBASE, + TMP_DBSYSTEMVALUES_MARIADB, + TMP_DBSYSTEMVALUES_NETEZZA, + TMP_DBSYSTEMVALUES_PERVASIVE, + TMP_DBSYSTEMVALUES_POINTBASE, + TMP_DBSYSTEMVALUES_SQLITE, + TMP_DBSYSTEMVALUES_SYBASE, + TMP_DBSYSTEMVALUES_TERADATA, + TMP_DBSYSTEMVALUES_VERTICA, + TMP_DBSYSTEMVALUES_H2, + TMP_DBSYSTEMVALUES_COLDFUSION, + TMP_DBSYSTEMVALUES_CASSANDRA, + TMP_DBSYSTEMVALUES_HBASE, + TMP_DBSYSTEMVALUES_MONGODB, + TMP_DBSYSTEMVALUES_REDIS, + TMP_DBSYSTEMVALUES_COUCHBASE, + TMP_DBSYSTEMVALUES_COUCHDB, + TMP_DBSYSTEMVALUES_COSMOSDB, + TMP_DBSYSTEMVALUES_DYNAMODB, + TMP_DBSYSTEMVALUES_NEO4J, + TMP_DBSYSTEMVALUES_GEODE, + TMP_DBSYSTEMVALUES_ELASTICSEARCH, + TMP_DBSYSTEMVALUES_MEMCACHED, + TMP_DBSYSTEMVALUES_COCKROACHDB, +]); +/* ---------------------------------------------------------------------------------------------------------- + * Constant values for DbCassandraConsistencyLevelValues enum definition + * + * The consistency level of the query. Based on consistency values from [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). + * ---------------------------------------------------------------------------------------------------------- */ +// Temporary local constants to assign to the individual exports and the namespaced version +// Required to avoid the namespace exports using the unminifiable export names for some package types +const TMP_DBCASSANDRACONSISTENCYLEVELVALUES_ALL = 'all'; +const TMP_DBCASSANDRACONSISTENCYLEVELVALUES_EACH_QUORUM = 'each_quorum'; +const TMP_DBCASSANDRACONSISTENCYLEVELVALUES_QUORUM = 'quorum'; +const TMP_DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_QUORUM = 'local_quorum'; +const TMP_DBCASSANDRACONSISTENCYLEVELVALUES_ONE = 'one'; +const TMP_DBCASSANDRACONSISTENCYLEVELVALUES_TWO = 'two'; +const TMP_DBCASSANDRACONSISTENCYLEVELVALUES_THREE = 'three'; +const TMP_DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_ONE = 'local_one'; +const TMP_DBCASSANDRACONSISTENCYLEVELVALUES_ANY = 'any'; +const TMP_DBCASSANDRACONSISTENCYLEVELVALUES_SERIAL = 'serial'; +const TMP_DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_SERIAL = 'local_serial'; +/** + * The consistency level of the query. Based on consistency values from [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). + * + * @deprecated Use DB_CASSANDRA_CONSISTENCY_LEVEL_VALUE_ALL in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBCASSANDRACONSISTENCYLEVELVALUES_ALL = TMP_DBCASSANDRACONSISTENCYLEVELVALUES_ALL; +/** + * The consistency level of the query. Based on consistency values from [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). + * + * @deprecated Use DB_CASSANDRA_CONSISTENCY_LEVEL_VALUE_EACH_QUORUM in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBCASSANDRACONSISTENCYLEVELVALUES_EACH_QUORUM = TMP_DBCASSANDRACONSISTENCYLEVELVALUES_EACH_QUORUM; +/** + * The consistency level of the query. Based on consistency values from [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). + * + * @deprecated Use DB_CASSANDRA_CONSISTENCY_LEVEL_VALUE_QUORUM in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBCASSANDRACONSISTENCYLEVELVALUES_QUORUM = TMP_DBCASSANDRACONSISTENCYLEVELVALUES_QUORUM; +/** + * The consistency level of the query. Based on consistency values from [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). + * + * @deprecated Use DB_CASSANDRA_CONSISTENCY_LEVEL_VALUE_LOCAL_QUORUM in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_QUORUM = TMP_DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_QUORUM; +/** + * The consistency level of the query. Based on consistency values from [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). + * + * @deprecated Use DB_CASSANDRA_CONSISTENCY_LEVEL_VALUE_ONE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBCASSANDRACONSISTENCYLEVELVALUES_ONE = TMP_DBCASSANDRACONSISTENCYLEVELVALUES_ONE; +/** + * The consistency level of the query. Based on consistency values from [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). + * + * @deprecated Use DB_CASSANDRA_CONSISTENCY_LEVEL_VALUE_TWO in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBCASSANDRACONSISTENCYLEVELVALUES_TWO = TMP_DBCASSANDRACONSISTENCYLEVELVALUES_TWO; +/** + * The consistency level of the query. Based on consistency values from [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). + * + * @deprecated Use DB_CASSANDRA_CONSISTENCY_LEVEL_VALUE_THREE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBCASSANDRACONSISTENCYLEVELVALUES_THREE = TMP_DBCASSANDRACONSISTENCYLEVELVALUES_THREE; +/** + * The consistency level of the query. Based on consistency values from [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). + * + * @deprecated Use DB_CASSANDRA_CONSISTENCY_LEVEL_VALUE_LOCAL_ONE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_ONE = TMP_DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_ONE; +/** + * The consistency level of the query. Based on consistency values from [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). + * + * @deprecated Use DB_CASSANDRA_CONSISTENCY_LEVEL_VALUE_ANY in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBCASSANDRACONSISTENCYLEVELVALUES_ANY = TMP_DBCASSANDRACONSISTENCYLEVELVALUES_ANY; +/** + * The consistency level of the query. Based on consistency values from [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). + * + * @deprecated Use DB_CASSANDRA_CONSISTENCY_LEVEL_VALUE_SERIAL in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBCASSANDRACONSISTENCYLEVELVALUES_SERIAL = TMP_DBCASSANDRACONSISTENCYLEVELVALUES_SERIAL; +/** + * The consistency level of the query. Based on consistency values from [CQL](https://docs.datastax.com/en/cassandra-oss/3.0/cassandra/dml/dmlConfigConsistency.html). + * + * @deprecated Use DB_CASSANDRA_CONSISTENCY_LEVEL_VALUE_LOCAL_SERIAL in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_SERIAL = TMP_DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_SERIAL; +/** + * The constant map of values for DbCassandraConsistencyLevelValues. + * @deprecated Use the DBCASSANDRACONSISTENCYLEVELVALUES_XXXXX constants rather than the DbCassandraConsistencyLevelValues.XXXXX for bundle minification. + */ +exports.DbCassandraConsistencyLevelValues = +/*#__PURE__*/ (0, utils_1.createConstMap)([ + TMP_DBCASSANDRACONSISTENCYLEVELVALUES_ALL, + TMP_DBCASSANDRACONSISTENCYLEVELVALUES_EACH_QUORUM, + TMP_DBCASSANDRACONSISTENCYLEVELVALUES_QUORUM, + TMP_DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_QUORUM, + TMP_DBCASSANDRACONSISTENCYLEVELVALUES_ONE, + TMP_DBCASSANDRACONSISTENCYLEVELVALUES_TWO, + TMP_DBCASSANDRACONSISTENCYLEVELVALUES_THREE, + TMP_DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_ONE, + TMP_DBCASSANDRACONSISTENCYLEVELVALUES_ANY, + TMP_DBCASSANDRACONSISTENCYLEVELVALUES_SERIAL, + TMP_DBCASSANDRACONSISTENCYLEVELVALUES_LOCAL_SERIAL, +]); +/* ---------------------------------------------------------------------------------------------------------- + * Constant values for FaasTriggerValues enum definition + * + * Type of the trigger on which the function is executed. + * ---------------------------------------------------------------------------------------------------------- */ +// Temporary local constants to assign to the individual exports and the namespaced version +// Required to avoid the namespace exports using the unminifiable export names for some package types +const TMP_FAASTRIGGERVALUES_DATASOURCE = 'datasource'; +const TMP_FAASTRIGGERVALUES_HTTP = 'http'; +const TMP_FAASTRIGGERVALUES_PUBSUB = 'pubsub'; +const TMP_FAASTRIGGERVALUES_TIMER = 'timer'; +const TMP_FAASTRIGGERVALUES_OTHER = 'other'; +/** + * Type of the trigger on which the function is executed. + * + * @deprecated Use FAAS_TRIGGER_VALUE_DATASOURCE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.FAASTRIGGERVALUES_DATASOURCE = TMP_FAASTRIGGERVALUES_DATASOURCE; +/** + * Type of the trigger on which the function is executed. + * + * @deprecated Use FAAS_TRIGGER_VALUE_HTTP in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.FAASTRIGGERVALUES_HTTP = TMP_FAASTRIGGERVALUES_HTTP; +/** + * Type of the trigger on which the function is executed. + * + * @deprecated Use FAAS_TRIGGER_VALUE_PUBSUB in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.FAASTRIGGERVALUES_PUBSUB = TMP_FAASTRIGGERVALUES_PUBSUB; +/** + * Type of the trigger on which the function is executed. + * + * @deprecated Use FAAS_TRIGGER_VALUE_TIMER in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.FAASTRIGGERVALUES_TIMER = TMP_FAASTRIGGERVALUES_TIMER; +/** + * Type of the trigger on which the function is executed. + * + * @deprecated Use FAAS_TRIGGER_VALUE_OTHER in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.FAASTRIGGERVALUES_OTHER = TMP_FAASTRIGGERVALUES_OTHER; +/** + * The constant map of values for FaasTriggerValues. + * @deprecated Use the FAASTRIGGERVALUES_XXXXX constants rather than the FaasTriggerValues.XXXXX for bundle minification. + */ +exports.FaasTriggerValues = +/*#__PURE__*/ (0, utils_1.createConstMap)([ + TMP_FAASTRIGGERVALUES_DATASOURCE, + TMP_FAASTRIGGERVALUES_HTTP, + TMP_FAASTRIGGERVALUES_PUBSUB, + TMP_FAASTRIGGERVALUES_TIMER, + TMP_FAASTRIGGERVALUES_OTHER, +]); +/* ---------------------------------------------------------------------------------------------------------- + * Constant values for FaasDocumentOperationValues enum definition + * + * Describes the type of the operation that was performed on the data. + * ---------------------------------------------------------------------------------------------------------- */ +// Temporary local constants to assign to the individual exports and the namespaced version +// Required to avoid the namespace exports using the unminifiable export names for some package types +const TMP_FAASDOCUMENTOPERATIONVALUES_INSERT = 'insert'; +const TMP_FAASDOCUMENTOPERATIONVALUES_EDIT = 'edit'; +const TMP_FAASDOCUMENTOPERATIONVALUES_DELETE = 'delete'; +/** + * Describes the type of the operation that was performed on the data. + * + * @deprecated Use FAAS_DOCUMENT_OPERATION_VALUE_INSERT in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.FAASDOCUMENTOPERATIONVALUES_INSERT = TMP_FAASDOCUMENTOPERATIONVALUES_INSERT; +/** + * Describes the type of the operation that was performed on the data. + * + * @deprecated Use FAAS_DOCUMENT_OPERATION_VALUE_EDIT in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.FAASDOCUMENTOPERATIONVALUES_EDIT = TMP_FAASDOCUMENTOPERATIONVALUES_EDIT; +/** + * Describes the type of the operation that was performed on the data. + * + * @deprecated Use FAAS_DOCUMENT_OPERATION_VALUE_DELETE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.FAASDOCUMENTOPERATIONVALUES_DELETE = TMP_FAASDOCUMENTOPERATIONVALUES_DELETE; +/** + * The constant map of values for FaasDocumentOperationValues. + * @deprecated Use the FAASDOCUMENTOPERATIONVALUES_XXXXX constants rather than the FaasDocumentOperationValues.XXXXX for bundle minification. + */ +exports.FaasDocumentOperationValues = +/*#__PURE__*/ (0, utils_1.createConstMap)([ + TMP_FAASDOCUMENTOPERATIONVALUES_INSERT, + TMP_FAASDOCUMENTOPERATIONVALUES_EDIT, + TMP_FAASDOCUMENTOPERATIONVALUES_DELETE, +]); +/* ---------------------------------------------------------------------------------------------------------- + * Constant values for FaasInvokedProviderValues enum definition + * + * The cloud provider of the invoked function. + * + * Note: SHOULD be equal to the `cloud.provider` resource attribute of the invoked function. + * ---------------------------------------------------------------------------------------------------------- */ +// Temporary local constants to assign to the individual exports and the namespaced version +// Required to avoid the namespace exports using the unminifiable export names for some package types +const TMP_FAASINVOKEDPROVIDERVALUES_ALIBABA_CLOUD = 'alibaba_cloud'; +const TMP_FAASINVOKEDPROVIDERVALUES_AWS = 'aws'; +const TMP_FAASINVOKEDPROVIDERVALUES_AZURE = 'azure'; +const TMP_FAASINVOKEDPROVIDERVALUES_GCP = 'gcp'; +/** + * The cloud provider of the invoked function. + * + * Note: SHOULD be equal to the `cloud.provider` resource attribute of the invoked function. + * + * @deprecated Use FAAS_INVOKED_PROVIDER_VALUE_ALIBABA_CLOUD in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.FAASINVOKEDPROVIDERVALUES_ALIBABA_CLOUD = TMP_FAASINVOKEDPROVIDERVALUES_ALIBABA_CLOUD; +/** + * The cloud provider of the invoked function. + * + * Note: SHOULD be equal to the `cloud.provider` resource attribute of the invoked function. + * + * @deprecated Use FAAS_INVOKED_PROVIDER_VALUE_AWS in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.FAASINVOKEDPROVIDERVALUES_AWS = TMP_FAASINVOKEDPROVIDERVALUES_AWS; +/** + * The cloud provider of the invoked function. + * + * Note: SHOULD be equal to the `cloud.provider` resource attribute of the invoked function. + * + * @deprecated Use FAAS_INVOKED_PROVIDER_VALUE_AZURE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.FAASINVOKEDPROVIDERVALUES_AZURE = TMP_FAASINVOKEDPROVIDERVALUES_AZURE; +/** + * The cloud provider of the invoked function. + * + * Note: SHOULD be equal to the `cloud.provider` resource attribute of the invoked function. + * + * @deprecated Use FAAS_INVOKED_PROVIDER_VALUE_GCP in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.FAASINVOKEDPROVIDERVALUES_GCP = TMP_FAASINVOKEDPROVIDERVALUES_GCP; +/** + * The constant map of values for FaasInvokedProviderValues. + * @deprecated Use the FAASINVOKEDPROVIDERVALUES_XXXXX constants rather than the FaasInvokedProviderValues.XXXXX for bundle minification. + */ +exports.FaasInvokedProviderValues = +/*#__PURE__*/ (0, utils_1.createConstMap)([ + TMP_FAASINVOKEDPROVIDERVALUES_ALIBABA_CLOUD, + TMP_FAASINVOKEDPROVIDERVALUES_AWS, + TMP_FAASINVOKEDPROVIDERVALUES_AZURE, + TMP_FAASINVOKEDPROVIDERVALUES_GCP, +]); +/* ---------------------------------------------------------------------------------------------------------- + * Constant values for NetTransportValues enum definition + * + * Transport protocol used. See note below. + * ---------------------------------------------------------------------------------------------------------- */ +// Temporary local constants to assign to the individual exports and the namespaced version +// Required to avoid the namespace exports using the unminifiable export names for some package types +const TMP_NETTRANSPORTVALUES_IP_TCP = 'ip_tcp'; +const TMP_NETTRANSPORTVALUES_IP_UDP = 'ip_udp'; +const TMP_NETTRANSPORTVALUES_IP = 'ip'; +const TMP_NETTRANSPORTVALUES_UNIX = 'unix'; +const TMP_NETTRANSPORTVALUES_PIPE = 'pipe'; +const TMP_NETTRANSPORTVALUES_INPROC = 'inproc'; +const TMP_NETTRANSPORTVALUES_OTHER = 'other'; +/** + * Transport protocol used. See note below. + * + * @deprecated Use NET_TRANSPORT_VALUE_IP_TCP in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.NETTRANSPORTVALUES_IP_TCP = TMP_NETTRANSPORTVALUES_IP_TCP; +/** + * Transport protocol used. See note below. + * + * @deprecated Use NET_TRANSPORT_VALUE_IP_UDP in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.NETTRANSPORTVALUES_IP_UDP = TMP_NETTRANSPORTVALUES_IP_UDP; +/** + * Transport protocol used. See note below. + * + * @deprecated Removed in v1.21.0. + */ +exports.NETTRANSPORTVALUES_IP = TMP_NETTRANSPORTVALUES_IP; +/** + * Transport protocol used. See note below. + * + * @deprecated Removed in v1.21.0. + */ +exports.NETTRANSPORTVALUES_UNIX = TMP_NETTRANSPORTVALUES_UNIX; +/** + * Transport protocol used. See note below. + * + * @deprecated Use NET_TRANSPORT_VALUE_PIPE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.NETTRANSPORTVALUES_PIPE = TMP_NETTRANSPORTVALUES_PIPE; +/** + * Transport protocol used. See note below. + * + * @deprecated Use NET_TRANSPORT_VALUE_INPROC in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.NETTRANSPORTVALUES_INPROC = TMP_NETTRANSPORTVALUES_INPROC; +/** + * Transport protocol used. See note below. + * + * @deprecated Use NET_TRANSPORT_VALUE_OTHER in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.NETTRANSPORTVALUES_OTHER = TMP_NETTRANSPORTVALUES_OTHER; +/** + * The constant map of values for NetTransportValues. + * @deprecated Use the NETTRANSPORTVALUES_XXXXX constants rather than the NetTransportValues.XXXXX for bundle minification. + */ +exports.NetTransportValues = +/*#__PURE__*/ (0, utils_1.createConstMap)([ + TMP_NETTRANSPORTVALUES_IP_TCP, + TMP_NETTRANSPORTVALUES_IP_UDP, + TMP_NETTRANSPORTVALUES_IP, + TMP_NETTRANSPORTVALUES_UNIX, + TMP_NETTRANSPORTVALUES_PIPE, + TMP_NETTRANSPORTVALUES_INPROC, + TMP_NETTRANSPORTVALUES_OTHER, +]); +/* ---------------------------------------------------------------------------------------------------------- + * Constant values for NetHostConnectionTypeValues enum definition + * + * The internet connection type currently being used by the host. + * ---------------------------------------------------------------------------------------------------------- */ +// Temporary local constants to assign to the individual exports and the namespaced version +// Required to avoid the namespace exports using the unminifiable export names for some package types +const TMP_NETHOSTCONNECTIONTYPEVALUES_WIFI = 'wifi'; +const TMP_NETHOSTCONNECTIONTYPEVALUES_WIRED = 'wired'; +const TMP_NETHOSTCONNECTIONTYPEVALUES_CELL = 'cell'; +const TMP_NETHOSTCONNECTIONTYPEVALUES_UNAVAILABLE = 'unavailable'; +const TMP_NETHOSTCONNECTIONTYPEVALUES_UNKNOWN = 'unknown'; +/** + * The internet connection type currently being used by the host. + * + * @deprecated Use NETWORK_CONNECTION_TYPE_VALUE_WIFI in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.NETHOSTCONNECTIONTYPEVALUES_WIFI = TMP_NETHOSTCONNECTIONTYPEVALUES_WIFI; +/** + * The internet connection type currently being used by the host. + * + * @deprecated Use NETWORK_CONNECTION_TYPE_VALUE_WIRED in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.NETHOSTCONNECTIONTYPEVALUES_WIRED = TMP_NETHOSTCONNECTIONTYPEVALUES_WIRED; +/** + * The internet connection type currently being used by the host. + * + * @deprecated Use NETWORK_CONNECTION_TYPE_VALUE_CELL in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.NETHOSTCONNECTIONTYPEVALUES_CELL = TMP_NETHOSTCONNECTIONTYPEVALUES_CELL; +/** + * The internet connection type currently being used by the host. + * + * @deprecated Use NETWORK_CONNECTION_TYPE_VALUE_UNAVAILABLE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.NETHOSTCONNECTIONTYPEVALUES_UNAVAILABLE = TMP_NETHOSTCONNECTIONTYPEVALUES_UNAVAILABLE; +/** + * The internet connection type currently being used by the host. + * + * @deprecated Use NETWORK_CONNECTION_TYPE_VALUE_UNKNOWN in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.NETHOSTCONNECTIONTYPEVALUES_UNKNOWN = TMP_NETHOSTCONNECTIONTYPEVALUES_UNKNOWN; +/** + * The constant map of values for NetHostConnectionTypeValues. + * @deprecated Use the NETHOSTCONNECTIONTYPEVALUES_XXXXX constants rather than the NetHostConnectionTypeValues.XXXXX for bundle minification. + */ +exports.NetHostConnectionTypeValues = +/*#__PURE__*/ (0, utils_1.createConstMap)([ + TMP_NETHOSTCONNECTIONTYPEVALUES_WIFI, + TMP_NETHOSTCONNECTIONTYPEVALUES_WIRED, + TMP_NETHOSTCONNECTIONTYPEVALUES_CELL, + TMP_NETHOSTCONNECTIONTYPEVALUES_UNAVAILABLE, + TMP_NETHOSTCONNECTIONTYPEVALUES_UNKNOWN, +]); +/* ---------------------------------------------------------------------------------------------------------- + * Constant values for NetHostConnectionSubtypeValues enum definition + * + * This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection. + * ---------------------------------------------------------------------------------------------------------- */ +// Temporary local constants to assign to the individual exports and the namespaced version +// Required to avoid the namespace exports using the unminifiable export names for some package types +const TMP_NETHOSTCONNECTIONSUBTYPEVALUES_GPRS = 'gprs'; +const TMP_NETHOSTCONNECTIONSUBTYPEVALUES_EDGE = 'edge'; +const TMP_NETHOSTCONNECTIONSUBTYPEVALUES_UMTS = 'umts'; +const TMP_NETHOSTCONNECTIONSUBTYPEVALUES_CDMA = 'cdma'; +const TMP_NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_0 = 'evdo_0'; +const TMP_NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_A = 'evdo_a'; +const TMP_NETHOSTCONNECTIONSUBTYPEVALUES_CDMA2000_1XRTT = 'cdma2000_1xrtt'; +const TMP_NETHOSTCONNECTIONSUBTYPEVALUES_HSDPA = 'hsdpa'; +const TMP_NETHOSTCONNECTIONSUBTYPEVALUES_HSUPA = 'hsupa'; +const TMP_NETHOSTCONNECTIONSUBTYPEVALUES_HSPA = 'hspa'; +const TMP_NETHOSTCONNECTIONSUBTYPEVALUES_IDEN = 'iden'; +const TMP_NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_B = 'evdo_b'; +const TMP_NETHOSTCONNECTIONSUBTYPEVALUES_LTE = 'lte'; +const TMP_NETHOSTCONNECTIONSUBTYPEVALUES_EHRPD = 'ehrpd'; +const TMP_NETHOSTCONNECTIONSUBTYPEVALUES_HSPAP = 'hspap'; +const TMP_NETHOSTCONNECTIONSUBTYPEVALUES_GSM = 'gsm'; +const TMP_NETHOSTCONNECTIONSUBTYPEVALUES_TD_SCDMA = 'td_scdma'; +const TMP_NETHOSTCONNECTIONSUBTYPEVALUES_IWLAN = 'iwlan'; +const TMP_NETHOSTCONNECTIONSUBTYPEVALUES_NR = 'nr'; +const TMP_NETHOSTCONNECTIONSUBTYPEVALUES_NRNSA = 'nrnsa'; +const TMP_NETHOSTCONNECTIONSUBTYPEVALUES_LTE_CA = 'lte_ca'; +/** + * This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection. + * + * @deprecated Use NETWORK_CONNECTION_SUBTYPE_VALUE_GPRS in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.NETHOSTCONNECTIONSUBTYPEVALUES_GPRS = TMP_NETHOSTCONNECTIONSUBTYPEVALUES_GPRS; +/** + * This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection. + * + * @deprecated Use NETWORK_CONNECTION_SUBTYPE_VALUE_EDGE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.NETHOSTCONNECTIONSUBTYPEVALUES_EDGE = TMP_NETHOSTCONNECTIONSUBTYPEVALUES_EDGE; +/** + * This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection. + * + * @deprecated Use NETWORK_CONNECTION_SUBTYPE_VALUE_UMTS in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.NETHOSTCONNECTIONSUBTYPEVALUES_UMTS = TMP_NETHOSTCONNECTIONSUBTYPEVALUES_UMTS; +/** + * This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection. + * + * @deprecated Use NETWORK_CONNECTION_SUBTYPE_VALUE_CDMA in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.NETHOSTCONNECTIONSUBTYPEVALUES_CDMA = TMP_NETHOSTCONNECTIONSUBTYPEVALUES_CDMA; +/** + * This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection. + * + * @deprecated Use NETWORK_CONNECTION_SUBTYPE_VALUE_EVDO_0 in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_0 = TMP_NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_0; +/** + * This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection. + * + * @deprecated Use NETWORK_CONNECTION_SUBTYPE_VALUE_EVDO_A in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_A = TMP_NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_A; +/** + * This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection. + * + * @deprecated Use NETWORK_CONNECTION_SUBTYPE_VALUE_CDMA2000_1XRTT in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.NETHOSTCONNECTIONSUBTYPEVALUES_CDMA2000_1XRTT = TMP_NETHOSTCONNECTIONSUBTYPEVALUES_CDMA2000_1XRTT; +/** + * This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection. + * + * @deprecated Use NETWORK_CONNECTION_SUBTYPE_VALUE_HSDPA in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.NETHOSTCONNECTIONSUBTYPEVALUES_HSDPA = TMP_NETHOSTCONNECTIONSUBTYPEVALUES_HSDPA; +/** + * This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection. + * + * @deprecated Use NETWORK_CONNECTION_SUBTYPE_VALUE_HSUPA in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.NETHOSTCONNECTIONSUBTYPEVALUES_HSUPA = TMP_NETHOSTCONNECTIONSUBTYPEVALUES_HSUPA; +/** + * This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection. + * + * @deprecated Use NETWORK_CONNECTION_SUBTYPE_VALUE_HSPA in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.NETHOSTCONNECTIONSUBTYPEVALUES_HSPA = TMP_NETHOSTCONNECTIONSUBTYPEVALUES_HSPA; +/** + * This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection. + * + * @deprecated Use NETWORK_CONNECTION_SUBTYPE_VALUE_IDEN in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.NETHOSTCONNECTIONSUBTYPEVALUES_IDEN = TMP_NETHOSTCONNECTIONSUBTYPEVALUES_IDEN; +/** + * This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection. + * + * @deprecated Use NETWORK_CONNECTION_SUBTYPE_VALUE_EVDO_B in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_B = TMP_NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_B; +/** + * This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection. + * + * @deprecated Use NETWORK_CONNECTION_SUBTYPE_VALUE_LTE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.NETHOSTCONNECTIONSUBTYPEVALUES_LTE = TMP_NETHOSTCONNECTIONSUBTYPEVALUES_LTE; +/** + * This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection. + * + * @deprecated Use NETWORK_CONNECTION_SUBTYPE_VALUE_EHRPD in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.NETHOSTCONNECTIONSUBTYPEVALUES_EHRPD = TMP_NETHOSTCONNECTIONSUBTYPEVALUES_EHRPD; +/** + * This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection. + * + * @deprecated Use NETWORK_CONNECTION_SUBTYPE_VALUE_HSPAP in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.NETHOSTCONNECTIONSUBTYPEVALUES_HSPAP = TMP_NETHOSTCONNECTIONSUBTYPEVALUES_HSPAP; +/** + * This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection. + * + * @deprecated Use NETWORK_CONNECTION_SUBTYPE_VALUE_GSM in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.NETHOSTCONNECTIONSUBTYPEVALUES_GSM = TMP_NETHOSTCONNECTIONSUBTYPEVALUES_GSM; +/** + * This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection. + * + * @deprecated Use NETWORK_CONNECTION_SUBTYPE_VALUE_TD_SCDMA in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.NETHOSTCONNECTIONSUBTYPEVALUES_TD_SCDMA = TMP_NETHOSTCONNECTIONSUBTYPEVALUES_TD_SCDMA; +/** + * This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection. + * + * @deprecated Use NETWORK_CONNECTION_SUBTYPE_VALUE_IWLAN in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.NETHOSTCONNECTIONSUBTYPEVALUES_IWLAN = TMP_NETHOSTCONNECTIONSUBTYPEVALUES_IWLAN; +/** + * This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection. + * + * @deprecated Use NETWORK_CONNECTION_SUBTYPE_VALUE_NR in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.NETHOSTCONNECTIONSUBTYPEVALUES_NR = TMP_NETHOSTCONNECTIONSUBTYPEVALUES_NR; +/** + * This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection. + * + * @deprecated Use NETWORK_CONNECTION_SUBTYPE_VALUE_NRNSA in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.NETHOSTCONNECTIONSUBTYPEVALUES_NRNSA = TMP_NETHOSTCONNECTIONSUBTYPEVALUES_NRNSA; +/** + * This describes more details regarding the connection.type. It may be the type of cell technology connection, but it could be used for describing details about a wifi connection. + * + * @deprecated Use NETWORK_CONNECTION_SUBTYPE_VALUE_LTE_CA in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.NETHOSTCONNECTIONSUBTYPEVALUES_LTE_CA = TMP_NETHOSTCONNECTIONSUBTYPEVALUES_LTE_CA; +/** + * The constant map of values for NetHostConnectionSubtypeValues. + * @deprecated Use the NETHOSTCONNECTIONSUBTYPEVALUES_XXXXX constants rather than the NetHostConnectionSubtypeValues.XXXXX for bundle minification. + */ +exports.NetHostConnectionSubtypeValues = +/*#__PURE__*/ (0, utils_1.createConstMap)([ + TMP_NETHOSTCONNECTIONSUBTYPEVALUES_GPRS, + TMP_NETHOSTCONNECTIONSUBTYPEVALUES_EDGE, + TMP_NETHOSTCONNECTIONSUBTYPEVALUES_UMTS, + TMP_NETHOSTCONNECTIONSUBTYPEVALUES_CDMA, + TMP_NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_0, + TMP_NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_A, + TMP_NETHOSTCONNECTIONSUBTYPEVALUES_CDMA2000_1XRTT, + TMP_NETHOSTCONNECTIONSUBTYPEVALUES_HSDPA, + TMP_NETHOSTCONNECTIONSUBTYPEVALUES_HSUPA, + TMP_NETHOSTCONNECTIONSUBTYPEVALUES_HSPA, + TMP_NETHOSTCONNECTIONSUBTYPEVALUES_IDEN, + TMP_NETHOSTCONNECTIONSUBTYPEVALUES_EVDO_B, + TMP_NETHOSTCONNECTIONSUBTYPEVALUES_LTE, + TMP_NETHOSTCONNECTIONSUBTYPEVALUES_EHRPD, + TMP_NETHOSTCONNECTIONSUBTYPEVALUES_HSPAP, + TMP_NETHOSTCONNECTIONSUBTYPEVALUES_GSM, + TMP_NETHOSTCONNECTIONSUBTYPEVALUES_TD_SCDMA, + TMP_NETHOSTCONNECTIONSUBTYPEVALUES_IWLAN, + TMP_NETHOSTCONNECTIONSUBTYPEVALUES_NR, + TMP_NETHOSTCONNECTIONSUBTYPEVALUES_NRNSA, + TMP_NETHOSTCONNECTIONSUBTYPEVALUES_LTE_CA, +]); +/* ---------------------------------------------------------------------------------------------------------- + * Constant values for HttpFlavorValues enum definition + * + * Kind of HTTP protocol used. + * + * Note: If `net.transport` is not specified, it can be assumed to be `IP.TCP` except if `http.flavor` is `QUIC`, in which case `IP.UDP` is assumed. + * ---------------------------------------------------------------------------------------------------------- */ +// Temporary local constants to assign to the individual exports and the namespaced version +// Required to avoid the namespace exports using the unminifiable export names for some package types +const TMP_HTTPFLAVORVALUES_HTTP_1_0 = '1.0'; +const TMP_HTTPFLAVORVALUES_HTTP_1_1 = '1.1'; +const TMP_HTTPFLAVORVALUES_HTTP_2_0 = '2.0'; +const TMP_HTTPFLAVORVALUES_SPDY = 'SPDY'; +const TMP_HTTPFLAVORVALUES_QUIC = 'QUIC'; +/** + * Kind of HTTP protocol used. + * + * Note: If `net.transport` is not specified, it can be assumed to be `IP.TCP` except if `http.flavor` is `QUIC`, in which case `IP.UDP` is assumed. + * + * @deprecated Use HTTP_FLAVOR_VALUE_HTTP_1_0 in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.HTTPFLAVORVALUES_HTTP_1_0 = TMP_HTTPFLAVORVALUES_HTTP_1_0; +/** + * Kind of HTTP protocol used. + * + * Note: If `net.transport` is not specified, it can be assumed to be `IP.TCP` except if `http.flavor` is `QUIC`, in which case `IP.UDP` is assumed. + * + * @deprecated Use HTTP_FLAVOR_VALUE_HTTP_1_1 in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.HTTPFLAVORVALUES_HTTP_1_1 = TMP_HTTPFLAVORVALUES_HTTP_1_1; +/** + * Kind of HTTP protocol used. + * + * Note: If `net.transport` is not specified, it can be assumed to be `IP.TCP` except if `http.flavor` is `QUIC`, in which case `IP.UDP` is assumed. + * + * @deprecated Use HTTP_FLAVOR_VALUE_HTTP_2_0 in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.HTTPFLAVORVALUES_HTTP_2_0 = TMP_HTTPFLAVORVALUES_HTTP_2_0; +/** + * Kind of HTTP protocol used. + * + * Note: If `net.transport` is not specified, it can be assumed to be `IP.TCP` except if `http.flavor` is `QUIC`, in which case `IP.UDP` is assumed. + * + * @deprecated Use HTTP_FLAVOR_VALUE_SPDY in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.HTTPFLAVORVALUES_SPDY = TMP_HTTPFLAVORVALUES_SPDY; +/** + * Kind of HTTP protocol used. + * + * Note: If `net.transport` is not specified, it can be assumed to be `IP.TCP` except if `http.flavor` is `QUIC`, in which case `IP.UDP` is assumed. + * + * @deprecated Use HTTP_FLAVOR_VALUE_QUIC in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.HTTPFLAVORVALUES_QUIC = TMP_HTTPFLAVORVALUES_QUIC; +/** + * The constant map of values for HttpFlavorValues. + * @deprecated Use the HTTPFLAVORVALUES_XXXXX constants rather than the HttpFlavorValues.XXXXX for bundle minification. + */ +exports.HttpFlavorValues = { + HTTP_1_0: TMP_HTTPFLAVORVALUES_HTTP_1_0, + HTTP_1_1: TMP_HTTPFLAVORVALUES_HTTP_1_1, + HTTP_2_0: TMP_HTTPFLAVORVALUES_HTTP_2_0, + SPDY: TMP_HTTPFLAVORVALUES_SPDY, + QUIC: TMP_HTTPFLAVORVALUES_QUIC, +}; +/* ---------------------------------------------------------------------------------------------------------- + * Constant values for MessagingDestinationKindValues enum definition + * + * The kind of message destination. + * ---------------------------------------------------------------------------------------------------------- */ +// Temporary local constants to assign to the individual exports and the namespaced version +// Required to avoid the namespace exports using the unminifiable export names for some package types +const TMP_MESSAGINGDESTINATIONKINDVALUES_QUEUE = 'queue'; +const TMP_MESSAGINGDESTINATIONKINDVALUES_TOPIC = 'topic'; +/** + * The kind of message destination. + * + * @deprecated Removed in semconv v1.20.0. + */ +exports.MESSAGINGDESTINATIONKINDVALUES_QUEUE = TMP_MESSAGINGDESTINATIONKINDVALUES_QUEUE; +/** + * The kind of message destination. + * + * @deprecated Removed in semconv v1.20.0. + */ +exports.MESSAGINGDESTINATIONKINDVALUES_TOPIC = TMP_MESSAGINGDESTINATIONKINDVALUES_TOPIC; +/** + * The constant map of values for MessagingDestinationKindValues. + * @deprecated Use the MESSAGINGDESTINATIONKINDVALUES_XXXXX constants rather than the MessagingDestinationKindValues.XXXXX for bundle minification. + */ +exports.MessagingDestinationKindValues = +/*#__PURE__*/ (0, utils_1.createConstMap)([ + TMP_MESSAGINGDESTINATIONKINDVALUES_QUEUE, + TMP_MESSAGINGDESTINATIONKINDVALUES_TOPIC, +]); +/* ---------------------------------------------------------------------------------------------------------- + * Constant values for MessagingOperationValues enum definition + * + * A string identifying the kind of message consumption as defined in the [Operation names](#operation-names) section above. If the operation is "send", this attribute MUST NOT be set, since the operation can be inferred from the span kind in that case. + * ---------------------------------------------------------------------------------------------------------- */ +// Temporary local constants to assign to the individual exports and the namespaced version +// Required to avoid the namespace exports using the unminifiable export names for some package types +const TMP_MESSAGINGOPERATIONVALUES_RECEIVE = 'receive'; +const TMP_MESSAGINGOPERATIONVALUES_PROCESS = 'process'; +/** + * A string identifying the kind of message consumption as defined in the [Operation names](#operation-names) section above. If the operation is "send", this attribute MUST NOT be set, since the operation can be inferred from the span kind in that case. + * + * @deprecated Use MESSAGING_OPERATION_TYPE_VALUE_RECEIVE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.MESSAGINGOPERATIONVALUES_RECEIVE = TMP_MESSAGINGOPERATIONVALUES_RECEIVE; +/** + * A string identifying the kind of message consumption as defined in the [Operation names](#operation-names) section above. If the operation is "send", this attribute MUST NOT be set, since the operation can be inferred from the span kind in that case. + * + * @deprecated Use MESSAGING_OPERATION_TYPE_VALUE_PROCESS in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.MESSAGINGOPERATIONVALUES_PROCESS = TMP_MESSAGINGOPERATIONVALUES_PROCESS; +/** + * The constant map of values for MessagingOperationValues. + * @deprecated Use the MESSAGINGOPERATIONVALUES_XXXXX constants rather than the MessagingOperationValues.XXXXX for bundle minification. + */ +exports.MessagingOperationValues = +/*#__PURE__*/ (0, utils_1.createConstMap)([ + TMP_MESSAGINGOPERATIONVALUES_RECEIVE, + TMP_MESSAGINGOPERATIONVALUES_PROCESS, +]); +/* ---------------------------------------------------------------------------------------------------------- + * Constant values for RpcGrpcStatusCodeValues enum definition + * + * The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request. + * ---------------------------------------------------------------------------------------------------------- */ +// Temporary local constants to assign to the individual exports and the namespaced version +// Required to avoid the namespace exports using the unminifiable export names for some package types +const TMP_RPCGRPCSTATUSCODEVALUES_OK = 0; +const TMP_RPCGRPCSTATUSCODEVALUES_CANCELLED = 1; +const TMP_RPCGRPCSTATUSCODEVALUES_UNKNOWN = 2; +const TMP_RPCGRPCSTATUSCODEVALUES_INVALID_ARGUMENT = 3; +const TMP_RPCGRPCSTATUSCODEVALUES_DEADLINE_EXCEEDED = 4; +const TMP_RPCGRPCSTATUSCODEVALUES_NOT_FOUND = 5; +const TMP_RPCGRPCSTATUSCODEVALUES_ALREADY_EXISTS = 6; +const TMP_RPCGRPCSTATUSCODEVALUES_PERMISSION_DENIED = 7; +const TMP_RPCGRPCSTATUSCODEVALUES_RESOURCE_EXHAUSTED = 8; +const TMP_RPCGRPCSTATUSCODEVALUES_FAILED_PRECONDITION = 9; +const TMP_RPCGRPCSTATUSCODEVALUES_ABORTED = 10; +const TMP_RPCGRPCSTATUSCODEVALUES_OUT_OF_RANGE = 11; +const TMP_RPCGRPCSTATUSCODEVALUES_UNIMPLEMENTED = 12; +const TMP_RPCGRPCSTATUSCODEVALUES_INTERNAL = 13; +const TMP_RPCGRPCSTATUSCODEVALUES_UNAVAILABLE = 14; +const TMP_RPCGRPCSTATUSCODEVALUES_DATA_LOSS = 15; +const TMP_RPCGRPCSTATUSCODEVALUES_UNAUTHENTICATED = 16; +/** + * The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request. + * + * @deprecated Use RPC_GRPC_STATUS_CODE_VALUE_OK in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.RPCGRPCSTATUSCODEVALUES_OK = TMP_RPCGRPCSTATUSCODEVALUES_OK; +/** + * The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request. + * + * @deprecated Use RPC_GRPC_STATUS_CODE_VALUE_CANCELLED in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.RPCGRPCSTATUSCODEVALUES_CANCELLED = TMP_RPCGRPCSTATUSCODEVALUES_CANCELLED; +/** + * The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request. + * + * @deprecated Use RPC_GRPC_STATUS_CODE_VALUE_UNKNOWN in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.RPCGRPCSTATUSCODEVALUES_UNKNOWN = TMP_RPCGRPCSTATUSCODEVALUES_UNKNOWN; +/** + * The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request. + * + * @deprecated Use RPC_GRPC_STATUS_CODE_VALUE_INVALID_ARGUMENT in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.RPCGRPCSTATUSCODEVALUES_INVALID_ARGUMENT = TMP_RPCGRPCSTATUSCODEVALUES_INVALID_ARGUMENT; +/** + * The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request. + * + * @deprecated Use RPC_GRPC_STATUS_CODE_VALUE_DEADLINE_EXCEEDED in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.RPCGRPCSTATUSCODEVALUES_DEADLINE_EXCEEDED = TMP_RPCGRPCSTATUSCODEVALUES_DEADLINE_EXCEEDED; +/** + * The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request. + * + * @deprecated Use RPC_GRPC_STATUS_CODE_VALUE_NOT_FOUND in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.RPCGRPCSTATUSCODEVALUES_NOT_FOUND = TMP_RPCGRPCSTATUSCODEVALUES_NOT_FOUND; +/** + * The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request. + * + * @deprecated Use RPC_GRPC_STATUS_CODE_VALUE_ALREADY_EXISTS in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.RPCGRPCSTATUSCODEVALUES_ALREADY_EXISTS = TMP_RPCGRPCSTATUSCODEVALUES_ALREADY_EXISTS; +/** + * The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request. + * + * @deprecated Use RPC_GRPC_STATUS_CODE_VALUE_PERMISSION_DENIED in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.RPCGRPCSTATUSCODEVALUES_PERMISSION_DENIED = TMP_RPCGRPCSTATUSCODEVALUES_PERMISSION_DENIED; +/** + * The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request. + * + * @deprecated Use RPC_GRPC_STATUS_CODE_VALUE_RESOURCE_EXHAUSTED in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.RPCGRPCSTATUSCODEVALUES_RESOURCE_EXHAUSTED = TMP_RPCGRPCSTATUSCODEVALUES_RESOURCE_EXHAUSTED; +/** + * The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request. + * + * @deprecated Use RPC_GRPC_STATUS_CODE_VALUE_FAILED_PRECONDITION in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.RPCGRPCSTATUSCODEVALUES_FAILED_PRECONDITION = TMP_RPCGRPCSTATUSCODEVALUES_FAILED_PRECONDITION; +/** + * The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request. + * + * @deprecated Use RPC_GRPC_STATUS_CODE_VALUE_ABORTED in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.RPCGRPCSTATUSCODEVALUES_ABORTED = TMP_RPCGRPCSTATUSCODEVALUES_ABORTED; +/** + * The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request. + * + * @deprecated Use RPC_GRPC_STATUS_CODE_VALUE_OUT_OF_RANGE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.RPCGRPCSTATUSCODEVALUES_OUT_OF_RANGE = TMP_RPCGRPCSTATUSCODEVALUES_OUT_OF_RANGE; +/** + * The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request. + * + * @deprecated Use RPC_GRPC_STATUS_CODE_VALUE_UNIMPLEMENTED in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.RPCGRPCSTATUSCODEVALUES_UNIMPLEMENTED = TMP_RPCGRPCSTATUSCODEVALUES_UNIMPLEMENTED; +/** + * The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request. + * + * @deprecated Use RPC_GRPC_STATUS_CODE_VALUE_INTERNAL in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.RPCGRPCSTATUSCODEVALUES_INTERNAL = TMP_RPCGRPCSTATUSCODEVALUES_INTERNAL; +/** + * The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request. + * + * @deprecated Use RPC_GRPC_STATUS_CODE_VALUE_UNAVAILABLE in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.RPCGRPCSTATUSCODEVALUES_UNAVAILABLE = TMP_RPCGRPCSTATUSCODEVALUES_UNAVAILABLE; +/** + * The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request. + * + * @deprecated Use RPC_GRPC_STATUS_CODE_VALUE_DATA_LOSS in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.RPCGRPCSTATUSCODEVALUES_DATA_LOSS = TMP_RPCGRPCSTATUSCODEVALUES_DATA_LOSS; +/** + * The [numeric status code](https://github.com/grpc/grpc/blob/v1.33.2/doc/statuscodes.md) of the gRPC request. + * + * @deprecated Use RPC_GRPC_STATUS_CODE_VALUE_UNAUTHENTICATED in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.RPCGRPCSTATUSCODEVALUES_UNAUTHENTICATED = TMP_RPCGRPCSTATUSCODEVALUES_UNAUTHENTICATED; +/** + * The constant map of values for RpcGrpcStatusCodeValues. + * @deprecated Use the RPCGRPCSTATUSCODEVALUES_XXXXX constants rather than the RpcGrpcStatusCodeValues.XXXXX for bundle minification. + */ +exports.RpcGrpcStatusCodeValues = { + OK: TMP_RPCGRPCSTATUSCODEVALUES_OK, + CANCELLED: TMP_RPCGRPCSTATUSCODEVALUES_CANCELLED, + UNKNOWN: TMP_RPCGRPCSTATUSCODEVALUES_UNKNOWN, + INVALID_ARGUMENT: TMP_RPCGRPCSTATUSCODEVALUES_INVALID_ARGUMENT, + DEADLINE_EXCEEDED: TMP_RPCGRPCSTATUSCODEVALUES_DEADLINE_EXCEEDED, + NOT_FOUND: TMP_RPCGRPCSTATUSCODEVALUES_NOT_FOUND, + ALREADY_EXISTS: TMP_RPCGRPCSTATUSCODEVALUES_ALREADY_EXISTS, + PERMISSION_DENIED: TMP_RPCGRPCSTATUSCODEVALUES_PERMISSION_DENIED, + RESOURCE_EXHAUSTED: TMP_RPCGRPCSTATUSCODEVALUES_RESOURCE_EXHAUSTED, + FAILED_PRECONDITION: TMP_RPCGRPCSTATUSCODEVALUES_FAILED_PRECONDITION, + ABORTED: TMP_RPCGRPCSTATUSCODEVALUES_ABORTED, + OUT_OF_RANGE: TMP_RPCGRPCSTATUSCODEVALUES_OUT_OF_RANGE, + UNIMPLEMENTED: TMP_RPCGRPCSTATUSCODEVALUES_UNIMPLEMENTED, + INTERNAL: TMP_RPCGRPCSTATUSCODEVALUES_INTERNAL, + UNAVAILABLE: TMP_RPCGRPCSTATUSCODEVALUES_UNAVAILABLE, + DATA_LOSS: TMP_RPCGRPCSTATUSCODEVALUES_DATA_LOSS, + UNAUTHENTICATED: TMP_RPCGRPCSTATUSCODEVALUES_UNAUTHENTICATED, +}; +/* ---------------------------------------------------------------------------------------------------------- + * Constant values for MessageTypeValues enum definition + * + * Whether this is a received or sent message. + * ---------------------------------------------------------------------------------------------------------- */ +// Temporary local constants to assign to the individual exports and the namespaced version +// Required to avoid the namespace exports using the unminifiable export names for some package types +const TMP_MESSAGETYPEVALUES_SENT = 'SENT'; +const TMP_MESSAGETYPEVALUES_RECEIVED = 'RECEIVED'; +/** + * Whether this is a received or sent message. + * + * @deprecated Use MESSAGE_TYPE_VALUE_SENT in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.MESSAGETYPEVALUES_SENT = TMP_MESSAGETYPEVALUES_SENT; +/** + * Whether this is a received or sent message. + * + * @deprecated Use MESSAGE_TYPE_VALUE_RECEIVED in [incubating entry-point]({@link https://github.com/open-telemetry/opentelemetry-js/blob/main/semantic-conventions/README.md#unstable-semconv}). + */ +exports.MESSAGETYPEVALUES_RECEIVED = TMP_MESSAGETYPEVALUES_RECEIVED; +/** + * The constant map of values for MessageTypeValues. + * @deprecated Use the MESSAGETYPEVALUES_XXXXX constants rather than the MessageTypeValues.XXXXX for bundle minification. + */ +exports.MessageTypeValues = +/*#__PURE__*/ (0, utils_1.createConstMap)([ + TMP_MESSAGETYPEVALUES_SENT, + TMP_MESSAGETYPEVALUES_RECEIVED, +]); +//# sourceMappingURL=SemanticAttributes.js.map + +/***/ }), + +/***/ 84351: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +/* + * Copyright The OpenTelemetry Authors + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * https://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); +}) : (function(o, m, k, k2) { + if (k2 === undefined) k2 = k; + o[k2] = m[k]; +})); +var __exportStar = (this && this.__exportStar) || function(m, exports) { + for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +/* eslint-disable no-restricted-syntax -- + * These re-exports are only of constants, only one-level deep at this point, + * and should not cause problems for tree-shakers. + */ +__exportStar(__nccwpck_require__(33570), exports); +//# sourceMappingURL=index.js.map + +/***/ }), + /***/ 13695: /***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { @@ -36412,6 +123270,1303 @@ Object.defineProperty(exports, "__esModule", ({ value: true })); __exportStar(__nccwpck_require__(21360), exports); //# sourceMappingURL=index.js.map +/***/ }), + +/***/ 92222: +/***/ ((module) => { + +"use strict"; + +module.exports = asPromise; + +/** + * Callback as used by {@link util.asPromise}. + * @typedef asPromiseCallback + * @type {function} + * @param {Error|null} error Error, if any + * @param {...*} params Additional arguments + * @returns {undefined} + */ + +/** + * Returns a promise from a node-style callback function. + * @memberof util + * @param {asPromiseCallback} fn Function to call + * @param {*} ctx Function context + * @param {...*} params Function arguments + * @returns {Promise<*>} Promisified function + */ +function asPromise(fn, ctx/*, varargs */) { + var params = new Array(arguments.length - 1), + offset = 0, + index = 2, + pending = true; + while (index < arguments.length) + params[offset++] = arguments[index++]; + return new Promise(function executor(resolve, reject) { + params[offset] = function callback(err/*, varargs */) { + if (pending) { + pending = false; + if (err) + reject(err); + else { + var params = new Array(arguments.length - 1), + offset = 0; + while (offset < params.length) + params[offset++] = arguments[offset]; + resolve.apply(null, params); + } + } + }; + try { + fn.apply(ctx || null, params); + } catch (err) { + if (pending) { + pending = false; + reject(err); + } + } + }); +} + + +/***/ }), + +/***/ 25478: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +/** + * A minimal base64 implementation for number arrays. + * @memberof util + * @namespace + */ +var base64 = exports; + +/** + * Calculates the byte length of a base64 encoded string. + * @param {string} string Base64 encoded string + * @returns {number} Byte length + */ +base64.length = function length(string) { + var p = string.length; + if (!p) + return 0; + var n = 0; + while (--p % 4 > 1 && string.charAt(p) === "=") + ++n; + return Math.ceil(string.length * 3) / 4 - n; +}; + +// Base64 encoding table +var b64 = new Array(64); + +// Base64 decoding table +var s64 = new Array(123); + +// 65..90, 97..122, 48..57, 43, 47 +for (var i = 0; i < 64;) + s64[b64[i] = i < 26 ? i + 65 : i < 52 ? i + 71 : i < 62 ? i - 4 : i - 59 | 43] = i++; + +/** + * Encodes a buffer to a base64 encoded string. + * @param {Uint8Array} buffer Source buffer + * @param {number} start Source start + * @param {number} end Source end + * @returns {string} Base64 encoded string + */ +base64.encode = function encode(buffer, start, end) { + var parts = null, + chunk = []; + var i = 0, // output index + j = 0, // goto index + t; // temporary + while (start < end) { + var b = buffer[start++]; + switch (j) { + case 0: + chunk[i++] = b64[b >> 2]; + t = (b & 3) << 4; + j = 1; + break; + case 1: + chunk[i++] = b64[t | b >> 4]; + t = (b & 15) << 2; + j = 2; + break; + case 2: + chunk[i++] = b64[t | b >> 6]; + chunk[i++] = b64[b & 63]; + j = 0; + break; + } + if (i > 8191) { + (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk)); + i = 0; + } + } + if (j) { + chunk[i++] = b64[t]; + chunk[i++] = 61; + if (j === 1) + chunk[i++] = 61; + } + if (parts) { + if (i) + parts.push(String.fromCharCode.apply(String, chunk.slice(0, i))); + return parts.join(""); + } + return String.fromCharCode.apply(String, chunk.slice(0, i)); +}; + +var invalidEncoding = "invalid encoding"; + +/** + * Decodes a base64 encoded string to a buffer. + * @param {string} string Source string + * @param {Uint8Array} buffer Destination buffer + * @param {number} offset Destination offset + * @returns {number} Number of bytes written + * @throws {Error} If encoding is invalid + */ +base64.decode = function decode(string, buffer, offset) { + var start = offset; + var j = 0, // goto index + t; // temporary + for (var i = 0; i < string.length;) { + var c = string.charCodeAt(i++); + if (c === 61 && j > 1) + break; + if ((c = s64[c]) === undefined) + throw Error(invalidEncoding); + switch (j) { + case 0: + t = c; + j = 1; + break; + case 1: + buffer[offset++] = t << 2 | (c & 48) >> 4; + t = c; + j = 2; + break; + case 2: + buffer[offset++] = (t & 15) << 4 | (c & 60) >> 2; + t = c; + j = 3; + break; + case 3: + buffer[offset++] = (t & 3) << 6 | c; + j = 0; + break; + } + } + if (j === 1) + throw Error(invalidEncoding); + return offset - start; +}; + +/** + * Tests if the specified string appears to be base64 encoded. + * @param {string} string String to test + * @returns {boolean} `true` if probably base64 encoded, otherwise false + */ +base64.test = function test(string) { + return /^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(string); +}; + + +/***/ }), + +/***/ 25346: +/***/ ((module) => { + +"use strict"; + +module.exports = codegen; + +/** + * Begins generating a function. + * @memberof util + * @param {string[]} functionParams Function parameter names + * @param {string} [functionName] Function name if not anonymous + * @returns {Codegen} Appender that appends code to the function's body + */ +function codegen(functionParams, functionName) { + + /* istanbul ignore if */ + if (typeof functionParams === "string") { + functionName = functionParams; + functionParams = undefined; + } + + var body = []; + + /** + * Appends code to the function's body or finishes generation. + * @typedef Codegen + * @type {function} + * @param {string|Object.} [formatStringOrScope] Format string or, to finish the function, an object of additional scope variables, if any + * @param {...*} [formatParams] Format parameters + * @returns {Codegen|Function} Itself or the generated function if finished + * @throws {Error} If format parameter counts do not match + */ + + function Codegen(formatStringOrScope) { + // note that explicit array handling below makes this ~50% faster + + // finish the function + if (typeof formatStringOrScope !== "string") { + var source = toString(); + if (codegen.verbose) + console.log("codegen: " + source); // eslint-disable-line no-console + source = "return " + source; + if (formatStringOrScope) { + var scopeKeys = Object.keys(formatStringOrScope), + scopeParams = new Array(scopeKeys.length + 1), + scopeValues = new Array(scopeKeys.length), + scopeOffset = 0; + while (scopeOffset < scopeKeys.length) { + scopeParams[scopeOffset] = scopeKeys[scopeOffset]; + scopeValues[scopeOffset] = formatStringOrScope[scopeKeys[scopeOffset++]]; + } + scopeParams[scopeOffset] = source; + return Function.apply(null, scopeParams).apply(null, scopeValues); // eslint-disable-line no-new-func + } + return Function(source)(); // eslint-disable-line no-new-func + } + + // otherwise append to body + var formatParams = new Array(arguments.length - 1), + formatOffset = 0; + while (formatOffset < formatParams.length) + formatParams[formatOffset] = arguments[++formatOffset]; + formatOffset = 0; + formatStringOrScope = formatStringOrScope.replace(/%([%dfijs])/g, function replace($0, $1) { + var value = formatParams[formatOffset++]; + switch ($1) { + case "d": case "f": return String(Number(value)); + case "i": return String(Math.floor(value)); + case "j": return JSON.stringify(value); + case "s": return String(value); + } + return "%"; + }); + if (formatOffset !== formatParams.length) + throw Error("parameter count mismatch"); + body.push(formatStringOrScope); + return Codegen; + } + + function toString(functionNameOverride) { + return "function " + (functionNameOverride || functionName || "") + "(" + (functionParams && functionParams.join(",") || "") + "){\n " + body.join("\n ") + "\n}"; + } + + Codegen.toString = toString; + return Codegen; +} + +/** + * Begins generating a function. + * @memberof util + * @function codegen + * @param {string} [functionName] Function name if not anonymous + * @returns {Codegen} Appender that appends code to the function's body + * @variation 2 + */ + +/** + * When set to `true`, codegen will log generated code to console. Useful for debugging. + * @name util.codegen.verbose + * @type {boolean} + */ +codegen.verbose = false; + + +/***/ }), + +/***/ 32491: +/***/ ((module) => { + +"use strict"; + +module.exports = EventEmitter; + +/** + * Constructs a new event emitter instance. + * @classdesc A minimal event emitter. + * @memberof util + * @constructor + */ +function EventEmitter() { + + /** + * Registered listeners. + * @type {Object.} + * @private + */ + this._listeners = {}; +} + +/** + * Registers an event listener. + * @param {string} evt Event name + * @param {function} fn Listener + * @param {*} [ctx] Listener context + * @returns {util.EventEmitter} `this` + */ +EventEmitter.prototype.on = function on(evt, fn, ctx) { + (this._listeners[evt] || (this._listeners[evt] = [])).push({ + fn : fn, + ctx : ctx || this + }); + return this; +}; + +/** + * Removes an event listener or any matching listeners if arguments are omitted. + * @param {string} [evt] Event name. Removes all listeners if omitted. + * @param {function} [fn] Listener to remove. Removes all listeners of `evt` if omitted. + * @returns {util.EventEmitter} `this` + */ +EventEmitter.prototype.off = function off(evt, fn) { + if (evt === undefined) + this._listeners = {}; + else { + if (fn === undefined) + this._listeners[evt] = []; + else { + var listeners = this._listeners[evt]; + for (var i = 0; i < listeners.length;) + if (listeners[i].fn === fn) + listeners.splice(i, 1); + else + ++i; + } + } + return this; +}; + +/** + * Emits an event by calling its listeners with the specified arguments. + * @param {string} evt Event name + * @param {...*} args Arguments + * @returns {util.EventEmitter} `this` + */ +EventEmitter.prototype.emit = function emit(evt) { + var listeners = this._listeners[evt]; + if (listeners) { + var args = [], + i = 1; + for (; i < arguments.length;) + args.push(arguments[i++]); + for (i = 0; i < listeners.length;) + listeners[i].fn.apply(listeners[i++].ctx, args); + } + return this; +}; + + +/***/ }), + +/***/ 44279: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +module.exports = fetch; + +var asPromise = __nccwpck_require__(92222), + inquire = __nccwpck_require__(77206); + +var fs = inquire("fs"); + +/** + * Node-style callback as used by {@link util.fetch}. + * @typedef FetchCallback + * @type {function} + * @param {?Error} error Error, if any, otherwise `null` + * @param {string} [contents] File contents, if there hasn't been an error + * @returns {undefined} + */ + +/** + * Options as used by {@link util.fetch}. + * @typedef FetchOptions + * @type {Object} + * @property {boolean} [binary=false] Whether expecting a binary response + * @property {boolean} [xhr=false] If `true`, forces the use of XMLHttpRequest + */ + +/** + * Fetches the contents of a file. + * @memberof util + * @param {string} filename File path or url + * @param {FetchOptions} options Fetch options + * @param {FetchCallback} callback Callback function + * @returns {undefined} + */ +function fetch(filename, options, callback) { + if (typeof options === "function") { + callback = options; + options = {}; + } else if (!options) + options = {}; + + if (!callback) + return asPromise(fetch, this, filename, options); // eslint-disable-line no-invalid-this + + // if a node-like filesystem is present, try it first but fall back to XHR if nothing is found. + if (!options.xhr && fs && fs.readFile) + return fs.readFile(filename, function fetchReadFileCallback(err, contents) { + return err && typeof XMLHttpRequest !== "undefined" + ? fetch.xhr(filename, options, callback) + : err + ? callback(err) + : callback(null, options.binary ? contents : contents.toString("utf8")); + }); + + // use the XHR version otherwise. + return fetch.xhr(filename, options, callback); +} + +/** + * Fetches the contents of a file. + * @name util.fetch + * @function + * @param {string} path File path or url + * @param {FetchCallback} callback Callback function + * @returns {undefined} + * @variation 2 + */ + +/** + * Fetches the contents of a file. + * @name util.fetch + * @function + * @param {string} path File path or url + * @param {FetchOptions} [options] Fetch options + * @returns {Promise} Promise + * @variation 3 + */ + +/**/ +fetch.xhr = function fetch_xhr(filename, options, callback) { + var xhr = new XMLHttpRequest(); + xhr.onreadystatechange /* works everywhere */ = function fetchOnReadyStateChange() { + + if (xhr.readyState !== 4) + return undefined; + + // local cors security errors return status 0 / empty string, too. afaik this cannot be + // reliably distinguished from an actually empty file for security reasons. feel free + // to send a pull request if you are aware of a solution. + if (xhr.status !== 0 && xhr.status !== 200) + return callback(Error("status " + xhr.status)); + + // if binary data is expected, make sure that some sort of array is returned, even if + // ArrayBuffers are not supported. the binary string fallback, however, is unsafe. + if (options.binary) { + var buffer = xhr.response; + if (!buffer) { + buffer = []; + for (var i = 0; i < xhr.responseText.length; ++i) + buffer.push(xhr.responseText.charCodeAt(i) & 255); + } + return callback(null, typeof Uint8Array !== "undefined" ? new Uint8Array(buffer) : buffer); + } + return callback(null, xhr.responseText); + }; + + if (options.binary) { + // ref: https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest/Sending_and_Receiving_Binary_Data#Receiving_binary_data_in_older_browsers + if ("overrideMimeType" in xhr) + xhr.overrideMimeType("text/plain; charset=x-user-defined"); + xhr.responseType = "arraybuffer"; + } + + xhr.open("GET", filename); + xhr.send(); +}; + + +/***/ }), + +/***/ 8597: +/***/ ((module) => { + +"use strict"; + + +module.exports = factory(factory); + +/** + * Reads / writes floats / doubles from / to buffers. + * @name util.float + * @namespace + */ + +/** + * Writes a 32 bit float to a buffer using little endian byte order. + * @name util.float.writeFloatLE + * @function + * @param {number} val Value to write + * @param {Uint8Array} buf Target buffer + * @param {number} pos Target buffer offset + * @returns {undefined} + */ + +/** + * Writes a 32 bit float to a buffer using big endian byte order. + * @name util.float.writeFloatBE + * @function + * @param {number} val Value to write + * @param {Uint8Array} buf Target buffer + * @param {number} pos Target buffer offset + * @returns {undefined} + */ + +/** + * Reads a 32 bit float from a buffer using little endian byte order. + * @name util.float.readFloatLE + * @function + * @param {Uint8Array} buf Source buffer + * @param {number} pos Source buffer offset + * @returns {number} Value read + */ + +/** + * Reads a 32 bit float from a buffer using big endian byte order. + * @name util.float.readFloatBE + * @function + * @param {Uint8Array} buf Source buffer + * @param {number} pos Source buffer offset + * @returns {number} Value read + */ + +/** + * Writes a 64 bit double to a buffer using little endian byte order. + * @name util.float.writeDoubleLE + * @function + * @param {number} val Value to write + * @param {Uint8Array} buf Target buffer + * @param {number} pos Target buffer offset + * @returns {undefined} + */ + +/** + * Writes a 64 bit double to a buffer using big endian byte order. + * @name util.float.writeDoubleBE + * @function + * @param {number} val Value to write + * @param {Uint8Array} buf Target buffer + * @param {number} pos Target buffer offset + * @returns {undefined} + */ + +/** + * Reads a 64 bit double from a buffer using little endian byte order. + * @name util.float.readDoubleLE + * @function + * @param {Uint8Array} buf Source buffer + * @param {number} pos Source buffer offset + * @returns {number} Value read + */ + +/** + * Reads a 64 bit double from a buffer using big endian byte order. + * @name util.float.readDoubleBE + * @function + * @param {Uint8Array} buf Source buffer + * @param {number} pos Source buffer offset + * @returns {number} Value read + */ + +// Factory function for the purpose of node-based testing in modified global environments +function factory(exports) { + + // float: typed array + if (typeof Float32Array !== "undefined") (function() { + + var f32 = new Float32Array([ -0 ]), + f8b = new Uint8Array(f32.buffer), + le = f8b[3] === 128; + + function writeFloat_f32_cpy(val, buf, pos) { + f32[0] = val; + buf[pos ] = f8b[0]; + buf[pos + 1] = f8b[1]; + buf[pos + 2] = f8b[2]; + buf[pos + 3] = f8b[3]; + } + + function writeFloat_f32_rev(val, buf, pos) { + f32[0] = val; + buf[pos ] = f8b[3]; + buf[pos + 1] = f8b[2]; + buf[pos + 2] = f8b[1]; + buf[pos + 3] = f8b[0]; + } + + /* istanbul ignore next */ + exports.writeFloatLE = le ? writeFloat_f32_cpy : writeFloat_f32_rev; + /* istanbul ignore next */ + exports.writeFloatBE = le ? writeFloat_f32_rev : writeFloat_f32_cpy; + + function readFloat_f32_cpy(buf, pos) { + f8b[0] = buf[pos ]; + f8b[1] = buf[pos + 1]; + f8b[2] = buf[pos + 2]; + f8b[3] = buf[pos + 3]; + return f32[0]; + } + + function readFloat_f32_rev(buf, pos) { + f8b[3] = buf[pos ]; + f8b[2] = buf[pos + 1]; + f8b[1] = buf[pos + 2]; + f8b[0] = buf[pos + 3]; + return f32[0]; + } + + /* istanbul ignore next */ + exports.readFloatLE = le ? readFloat_f32_cpy : readFloat_f32_rev; + /* istanbul ignore next */ + exports.readFloatBE = le ? readFloat_f32_rev : readFloat_f32_cpy; + + // float: ieee754 + })(); else (function() { + + function writeFloat_ieee754(writeUint, val, buf, pos) { + var sign = val < 0 ? 1 : 0; + if (sign) + val = -val; + if (val === 0) + writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos); + else if (isNaN(val)) + writeUint(2143289344, buf, pos); + else if (val > 3.4028234663852886e+38) // +-Infinity + writeUint((sign << 31 | 2139095040) >>> 0, buf, pos); + else if (val < 1.1754943508222875e-38) // denormal + writeUint((sign << 31 | Math.round(val / 1.401298464324817e-45)) >>> 0, buf, pos); + else { + var exponent = Math.floor(Math.log(val) / Math.LN2), + mantissa = Math.round(val * Math.pow(2, -exponent) * 8388608) & 8388607; + writeUint((sign << 31 | exponent + 127 << 23 | mantissa) >>> 0, buf, pos); + } + } + + exports.writeFloatLE = writeFloat_ieee754.bind(null, writeUintLE); + exports.writeFloatBE = writeFloat_ieee754.bind(null, writeUintBE); + + function readFloat_ieee754(readUint, buf, pos) { + var uint = readUint(buf, pos), + sign = (uint >> 31) * 2 + 1, + exponent = uint >>> 23 & 255, + mantissa = uint & 8388607; + return exponent === 255 + ? mantissa + ? NaN + : sign * Infinity + : exponent === 0 // denormal + ? sign * 1.401298464324817e-45 * mantissa + : sign * Math.pow(2, exponent - 150) * (mantissa + 8388608); + } + + exports.readFloatLE = readFloat_ieee754.bind(null, readUintLE); + exports.readFloatBE = readFloat_ieee754.bind(null, readUintBE); + + })(); + + // double: typed array + if (typeof Float64Array !== "undefined") (function() { + + var f64 = new Float64Array([-0]), + f8b = new Uint8Array(f64.buffer), + le = f8b[7] === 128; + + function writeDouble_f64_cpy(val, buf, pos) { + f64[0] = val; + buf[pos ] = f8b[0]; + buf[pos + 1] = f8b[1]; + buf[pos + 2] = f8b[2]; + buf[pos + 3] = f8b[3]; + buf[pos + 4] = f8b[4]; + buf[pos + 5] = f8b[5]; + buf[pos + 6] = f8b[6]; + buf[pos + 7] = f8b[7]; + } + + function writeDouble_f64_rev(val, buf, pos) { + f64[0] = val; + buf[pos ] = f8b[7]; + buf[pos + 1] = f8b[6]; + buf[pos + 2] = f8b[5]; + buf[pos + 3] = f8b[4]; + buf[pos + 4] = f8b[3]; + buf[pos + 5] = f8b[2]; + buf[pos + 6] = f8b[1]; + buf[pos + 7] = f8b[0]; + } + + /* istanbul ignore next */ + exports.writeDoubleLE = le ? writeDouble_f64_cpy : writeDouble_f64_rev; + /* istanbul ignore next */ + exports.writeDoubleBE = le ? writeDouble_f64_rev : writeDouble_f64_cpy; + + function readDouble_f64_cpy(buf, pos) { + f8b[0] = buf[pos ]; + f8b[1] = buf[pos + 1]; + f8b[2] = buf[pos + 2]; + f8b[3] = buf[pos + 3]; + f8b[4] = buf[pos + 4]; + f8b[5] = buf[pos + 5]; + f8b[6] = buf[pos + 6]; + f8b[7] = buf[pos + 7]; + return f64[0]; + } + + function readDouble_f64_rev(buf, pos) { + f8b[7] = buf[pos ]; + f8b[6] = buf[pos + 1]; + f8b[5] = buf[pos + 2]; + f8b[4] = buf[pos + 3]; + f8b[3] = buf[pos + 4]; + f8b[2] = buf[pos + 5]; + f8b[1] = buf[pos + 6]; + f8b[0] = buf[pos + 7]; + return f64[0]; + } + + /* istanbul ignore next */ + exports.readDoubleLE = le ? readDouble_f64_cpy : readDouble_f64_rev; + /* istanbul ignore next */ + exports.readDoubleBE = le ? readDouble_f64_rev : readDouble_f64_cpy; + + // double: ieee754 + })(); else (function() { + + function writeDouble_ieee754(writeUint, off0, off1, val, buf, pos) { + var sign = val < 0 ? 1 : 0; + if (sign) + val = -val; + if (val === 0) { + writeUint(0, buf, pos + off0); + writeUint(1 / val > 0 ? /* positive */ 0 : /* negative 0 */ 2147483648, buf, pos + off1); + } else if (isNaN(val)) { + writeUint(0, buf, pos + off0); + writeUint(2146959360, buf, pos + off1); + } else if (val > 1.7976931348623157e+308) { // +-Infinity + writeUint(0, buf, pos + off0); + writeUint((sign << 31 | 2146435072) >>> 0, buf, pos + off1); + } else { + var mantissa; + if (val < 2.2250738585072014e-308) { // denormal + mantissa = val / 5e-324; + writeUint(mantissa >>> 0, buf, pos + off0); + writeUint((sign << 31 | mantissa / 4294967296) >>> 0, buf, pos + off1); + } else { + var exponent = Math.floor(Math.log(val) / Math.LN2); + if (exponent === 1024) + exponent = 1023; + mantissa = val * Math.pow(2, -exponent); + writeUint(mantissa * 4503599627370496 >>> 0, buf, pos + off0); + writeUint((sign << 31 | exponent + 1023 << 20 | mantissa * 1048576 & 1048575) >>> 0, buf, pos + off1); + } + } + } + + exports.writeDoubleLE = writeDouble_ieee754.bind(null, writeUintLE, 0, 4); + exports.writeDoubleBE = writeDouble_ieee754.bind(null, writeUintBE, 4, 0); + + function readDouble_ieee754(readUint, off0, off1, buf, pos) { + var lo = readUint(buf, pos + off0), + hi = readUint(buf, pos + off1); + var sign = (hi >> 31) * 2 + 1, + exponent = hi >>> 20 & 2047, + mantissa = 4294967296 * (hi & 1048575) + lo; + return exponent === 2047 + ? mantissa + ? NaN + : sign * Infinity + : exponent === 0 // denormal + ? sign * 5e-324 * mantissa + : sign * Math.pow(2, exponent - 1075) * (mantissa + 4503599627370496); + } + + exports.readDoubleLE = readDouble_ieee754.bind(null, readUintLE, 0, 4); + exports.readDoubleBE = readDouble_ieee754.bind(null, readUintBE, 4, 0); + + })(); + + return exports; +} + +// uint helpers + +function writeUintLE(val, buf, pos) { + buf[pos ] = val & 255; + buf[pos + 1] = val >>> 8 & 255; + buf[pos + 2] = val >>> 16 & 255; + buf[pos + 3] = val >>> 24; +} + +function writeUintBE(val, buf, pos) { + buf[pos ] = val >>> 24; + buf[pos + 1] = val >>> 16 & 255; + buf[pos + 2] = val >>> 8 & 255; + buf[pos + 3] = val & 255; +} + +function readUintLE(buf, pos) { + return (buf[pos ] + | buf[pos + 1] << 8 + | buf[pos + 2] << 16 + | buf[pos + 3] << 24) >>> 0; +} + +function readUintBE(buf, pos) { + return (buf[pos ] << 24 + | buf[pos + 1] << 16 + | buf[pos + 2] << 8 + | buf[pos + 3]) >>> 0; +} + + +/***/ }), + +/***/ 77206: +/***/ ((module) => { + +"use strict"; + +module.exports = inquire; + +/** + * Requires a module only if available. + * @memberof util + * @param {string} moduleName Module to require + * @returns {?Object} Required module if available and not empty, otherwise `null` + */ +function inquire(moduleName) { + try { + var mod = eval("quire".replace(/^/,"re"))(moduleName); // eslint-disable-line no-eval + if (mod && (mod.length || Object.keys(mod).length)) + return mod; + } catch (e) {} // eslint-disable-line no-empty + return null; +} + + +/***/ }), + +/***/ 66090: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +/** + * A minimal path module to resolve Unix, Windows and URL paths alike. + * @memberof util + * @namespace + */ +var path = exports; + +var isAbsolute = +/** + * Tests if the specified path is absolute. + * @param {string} path Path to test + * @returns {boolean} `true` if path is absolute + */ +path.isAbsolute = function isAbsolute(path) { + return /^(?:\/|\w+:)/.test(path); +}; + +var normalize = +/** + * Normalizes the specified path. + * @param {string} path Path to normalize + * @returns {string} Normalized path + */ +path.normalize = function normalize(path) { + path = path.replace(/\\/g, "/") + .replace(/\/{2,}/g, "/"); + var parts = path.split("/"), + absolute = isAbsolute(path), + prefix = ""; + if (absolute) + prefix = parts.shift() + "/"; + for (var i = 0; i < parts.length;) { + if (parts[i] === "..") { + if (i > 0 && parts[i - 1] !== "..") + parts.splice(--i, 2); + else if (absolute) + parts.splice(i, 1); + else + ++i; + } else if (parts[i] === ".") + parts.splice(i, 1); + else + ++i; + } + return prefix + parts.join("/"); +}; + +/** + * Resolves the specified include path against the specified origin path. + * @param {string} originPath Path to the origin file + * @param {string} includePath Include path relative to origin path + * @param {boolean} [alreadyNormalized=false] `true` if both paths are already known to be normalized + * @returns {string} Path to the include file + */ +path.resolve = function resolve(originPath, includePath, alreadyNormalized) { + if (!alreadyNormalized) + includePath = normalize(includePath); + if (isAbsolute(includePath)) + return includePath; + if (!alreadyNormalized) + originPath = normalize(originPath); + return (originPath = originPath.replace(/(?:\/|^)[^/]+$/, "")).length ? normalize(originPath + "/" + includePath) : includePath; +}; + + +/***/ }), + +/***/ 56239: +/***/ ((module) => { + +"use strict"; + +module.exports = pool; + +/** + * An allocator as used by {@link util.pool}. + * @typedef PoolAllocator + * @type {function} + * @param {number} size Buffer size + * @returns {Uint8Array} Buffer + */ + +/** + * A slicer as used by {@link util.pool}. + * @typedef PoolSlicer + * @type {function} + * @param {number} start Start offset + * @param {number} end End offset + * @returns {Uint8Array} Buffer slice + * @this {Uint8Array} + */ + +/** + * A general purpose buffer pool. + * @memberof util + * @function + * @param {PoolAllocator} alloc Allocator + * @param {PoolSlicer} slice Slicer + * @param {number} [size=8192] Slab size + * @returns {PoolAllocator} Pooled allocator + */ +function pool(alloc, slice, size) { + var SIZE = size || 8192; + var MAX = SIZE >>> 1; + var slab = null; + var offset = SIZE; + return function pool_alloc(size) { + if (size < 1 || size > MAX) + return alloc(size); + if (offset + size > SIZE) { + slab = alloc(SIZE); + offset = 0; + } + var buf = slice.call(slab, offset, offset += size); + if (offset & 7) // align to 32 bit + offset = (offset | 7) + 1; + return buf; + }; +} + + +/***/ }), + +/***/ 70958: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +/** + * A minimal UTF8 implementation for number arrays. + * @memberof util + * @namespace + */ +var utf8 = exports; + +/** + * Calculates the UTF8 byte length of a string. + * @param {string} string String + * @returns {number} Byte length + */ +utf8.length = function utf8_length(string) { + var len = 0, + c = 0; + for (var i = 0; i < string.length; ++i) { + c = string.charCodeAt(i); + if (c < 128) + len += 1; + else if (c < 2048) + len += 2; + else if ((c & 0xFC00) === 0xD800 && (string.charCodeAt(i + 1) & 0xFC00) === 0xDC00) { + ++i; + len += 4; + } else + len += 3; + } + return len; +}; + +/** + * Reads UTF8 bytes as a string. + * @param {Uint8Array} buffer Source buffer + * @param {number} start Source start + * @param {number} end Source end + * @returns {string} String read + */ +utf8.read = function utf8_read(buffer, start, end) { + var len = end - start; + if (len < 1) + return ""; + var parts = null, + chunk = [], + i = 0, // char offset + t; // temporary + while (start < end) { + t = buffer[start++]; + if (t < 128) + chunk[i++] = t; + else if (t > 191 && t < 224) + chunk[i++] = (t & 31) << 6 | buffer[start++] & 63; + else if (t > 239 && t < 365) { + t = ((t & 7) << 18 | (buffer[start++] & 63) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63) - 0x10000; + chunk[i++] = 0xD800 + (t >> 10); + chunk[i++] = 0xDC00 + (t & 1023); + } else + chunk[i++] = (t & 15) << 12 | (buffer[start++] & 63) << 6 | buffer[start++] & 63; + if (i > 8191) { + (parts || (parts = [])).push(String.fromCharCode.apply(String, chunk)); + i = 0; + } + } + if (parts) { + if (i) + parts.push(String.fromCharCode.apply(String, chunk.slice(0, i))); + return parts.join(""); + } + return String.fromCharCode.apply(String, chunk.slice(0, i)); +}; + +/** + * Writes a string as UTF8 bytes. + * @param {string} string Source string + * @param {Uint8Array} buffer Destination buffer + * @param {number} offset Destination offset + * @returns {number} Bytes written + */ +utf8.write = function utf8_write(string, buffer, offset) { + var start = offset, + c1, // character 1 + c2; // character 2 + for (var i = 0; i < string.length; ++i) { + c1 = string.charCodeAt(i); + if (c1 < 128) { + buffer[offset++] = c1; + } else if (c1 < 2048) { + buffer[offset++] = c1 >> 6 | 192; + buffer[offset++] = c1 & 63 | 128; + } else if ((c1 & 0xFC00) === 0xD800 && ((c2 = string.charCodeAt(i + 1)) & 0xFC00) === 0xDC00) { + c1 = 0x10000 + ((c1 & 0x03FF) << 10) + (c2 & 0x03FF); + ++i; + buffer[offset++] = c1 >> 18 | 240; + buffer[offset++] = c1 >> 12 & 63 | 128; + buffer[offset++] = c1 >> 6 & 63 | 128; + buffer[offset++] = c1 & 63 | 128; + } else { + buffer[offset++] = c1 >> 12 | 224; + buffer[offset++] = c1 >> 6 & 63 | 128; + buffer[offset++] = c1 & 63 | 128; + } + } + return offset - start; +}; + + +/***/ }), + +/***/ 48662: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +function once(emitter, name, { signal } = {}) { + return new Promise((resolve, reject) => { + function cleanup() { + signal === null || signal === void 0 ? void 0 : signal.removeEventListener('abort', cleanup); + emitter.removeListener(name, onEvent); + emitter.removeListener('error', onError); + } + function onEvent(...args) { + cleanup(); + resolve(args); + } + function onError(err) { + cleanup(); + reject(err); + } + signal === null || signal === void 0 ? void 0 : signal.addEventListener('abort', cleanup); + emitter.on(name, onEvent); + emitter.on('error', onError); + }); +} +exports["default"] = once; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 17413: +/***/ ((module, exports, __nccwpck_require__) => { + +"use strict"; +/** + * @author Toru Nagashima + * See LICENSE file in root directory for full license. + */ + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +var eventTargetShim = __nccwpck_require__(16577); + +/** + * The signal class. + * @see https://dom.spec.whatwg.org/#abortsignal + */ +class AbortSignal extends eventTargetShim.EventTarget { + /** + * AbortSignal cannot be constructed directly. + */ + constructor() { + super(); + throw new TypeError("AbortSignal cannot be constructed directly"); + } + /** + * Returns `true` if this `AbortSignal`'s `AbortController` has signaled to abort, and `false` otherwise. + */ + get aborted() { + const aborted = abortedFlags.get(this); + if (typeof aborted !== "boolean") { + throw new TypeError(`Expected 'this' to be an 'AbortSignal' object, but got ${this === null ? "null" : typeof this}`); + } + return aborted; + } +} +eventTargetShim.defineEventAttribute(AbortSignal.prototype, "abort"); +/** + * Create an AbortSignal object. + */ +function createAbortSignal() { + const signal = Object.create(AbortSignal.prototype); + eventTargetShim.EventTarget.call(signal); + abortedFlags.set(signal, false); + return signal; +} +/** + * Abort a given signal. + */ +function abortSignal(signal) { + if (abortedFlags.get(signal) !== false) { + return; + } + abortedFlags.set(signal, true); + signal.dispatchEvent({ type: "abort" }); +} +/** + * Aborted flag for each instances. + */ +const abortedFlags = new WeakMap(); +// Properties should be enumerable. +Object.defineProperties(AbortSignal.prototype, { + aborted: { enumerable: true }, +}); +// `toString()` should return `"[object AbortSignal]"` +if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") { + Object.defineProperty(AbortSignal.prototype, Symbol.toStringTag, { + configurable: true, + value: "AbortSignal", + }); +} + +/** + * The AbortController. + * @see https://dom.spec.whatwg.org/#abortcontroller + */ +class AbortController { + /** + * Initialize this controller. + */ + constructor() { + signals.set(this, createAbortSignal()); + } + /** + * Returns the `AbortSignal` object associated with this object. + */ + get signal() { + return getSignal(this); + } + /** + * Abort and signal to any observers that the associated activity is to be aborted. + */ + abort() { + abortSignal(getSignal(this)); + } +} +/** + * Associated signals. + */ +const signals = new WeakMap(); +/** + * Get the associated signal of a given controller. + */ +function getSignal(controller) { + const signal = signals.get(controller); + if (signal == null) { + throw new TypeError(`Expected 'this' to be an 'AbortController' object, but got ${controller === null ? "null" : typeof controller}`); + } + return signal; +} +// Properties should be enumerable. +Object.defineProperties(AbortController.prototype, { + signal: { enumerable: true }, + abort: { enumerable: true }, +}); +if (typeof Symbol === "function" && typeof Symbol.toStringTag === "symbol") { + Object.defineProperty(AbortController.prototype, Symbol.toStringTag, { + configurable: true, + value: "AbortController", + }); +} + +exports.AbortController = AbortController; +exports.AbortSignal = AbortSignal; +exports["default"] = AbortController; + +module.exports = AbortController +module.exports.AbortController = module.exports["default"] = AbortController +module.exports.AbortSignal = AbortSignal +//# sourceMappingURL=abort-controller.js.map + + /***/ }), /***/ 15183: @@ -36670,6 +124825,37 @@ class Agent extends http.Agent { exports.Agent = Agent; //# sourceMappingURL=index.js.map +/***/ }), + +/***/ 26251: +/***/ ((module) => { + +"use strict"; + + +const arrify = value => { + if (value === null || value === undefined) { + return []; + } + + if (Array.isArray(value)) { + return value; + } + + if (typeof value === 'string') { + return [value]; + } + + if (typeof value[Symbol.iterator] === 'function') { + return [...value]; + } + + return [value]; +}; + +module.exports = arrify; + + /***/ }), /***/ 38793: @@ -40984,6 +129170,152 @@ class Deprecation extends Error { exports.Deprecation = Deprecation; +/***/ }), + +/***/ 98399: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +const isObj = __nccwpck_require__(75200); + +const disallowedKeys = new Set([ + '__proto__', + 'prototype', + 'constructor' +]); + +const isValidPath = pathSegments => !pathSegments.some(segment => disallowedKeys.has(segment)); + +function getPathSegments(path) { + const pathArray = path.split('.'); + const parts = []; + + for (let i = 0; i < pathArray.length; i++) { + let p = pathArray[i]; + + while (p[p.length - 1] === '\\' && pathArray[i + 1] !== undefined) { + p = p.slice(0, -1) + '.'; + p += pathArray[++i]; + } + + parts.push(p); + } + + if (!isValidPath(parts)) { + return []; + } + + return parts; +} + +module.exports = { + get(object, path, value) { + if (!isObj(object) || typeof path !== 'string') { + return value === undefined ? object : value; + } + + const pathArray = getPathSegments(path); + if (pathArray.length === 0) { + return; + } + + for (let i = 0; i < pathArray.length; i++) { + object = object[pathArray[i]]; + + if (object === undefined || object === null) { + // `object` is either `undefined` or `null` so we want to stop the loop, and + // if this is not the last bit of the path, and + // if it did't return `undefined` + // it would return `null` if `object` is `null` + // but we want `get({foo: null}, 'foo.bar')` to equal `undefined`, or the supplied value, not `null` + if (i !== pathArray.length - 1) { + return value; + } + + break; + } + } + + return object === undefined ? value : object; + }, + + set(object, path, value) { + if (!isObj(object) || typeof path !== 'string') { + return object; + } + + const root = object; + const pathArray = getPathSegments(path); + + for (let i = 0; i < pathArray.length; i++) { + const p = pathArray[i]; + + if (!isObj(object[p])) { + object[p] = {}; + } + + if (i === pathArray.length - 1) { + object[p] = value; + } + + object = object[p]; + } + + return root; + }, + + delete(object, path) { + if (!isObj(object) || typeof path !== 'string') { + return false; + } + + const pathArray = getPathSegments(path); + + for (let i = 0; i < pathArray.length; i++) { + const p = pathArray[i]; + + if (i === pathArray.length - 1) { + delete object[p]; + return true; + } + + object = object[p]; + + if (!isObj(object)) { + return false; + } + } + }, + + has(object, path) { + if (!isObj(object) || typeof path !== 'string') { + return false; + } + + const pathArray = getPathSegments(path); + if (pathArray.length === 0) { + return false; + } + + // eslint-disable-next-line unicorn/no-for-loop + for (let i = 0; i < pathArray.length; i++) { + if (isObj(object)) { + if (!(pathArray[i] in object)) { + return false; + } + + object = object[pathArray[i]]; + } else { + return false; + } + } + + return true; + } +}; + + /***/ }), /***/ 26669: @@ -41022,6 +129354,251 @@ module.exports = desc && typeof desc.get === 'function' : false; +/***/ }), + +/***/ 29112: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var stream = __nccwpck_require__(86131) +var eos = __nccwpck_require__(31424) +var inherits = __nccwpck_require__(39598) +var shift = __nccwpck_require__(34633) + +var SIGNAL_FLUSH = (Buffer.from && Buffer.from !== Uint8Array.from) + ? Buffer.from([0]) + : new Buffer([0]) + +var onuncork = function(self, fn) { + if (self._corked) self.once('uncork', fn) + else fn() +} + +var autoDestroy = function (self, err) { + if (self._autoDestroy) self.destroy(err) +} + +var destroyer = function(self, end) { + return function(err) { + if (err) autoDestroy(self, err.message === 'premature close' ? null : err) + else if (end && !self._ended) self.end() + } +} + +var end = function(ws, fn) { + if (!ws) return fn() + if (ws._writableState && ws._writableState.finished) return fn() + if (ws._writableState) return ws.end(fn) + ws.end() + fn() +} + +var noop = function() {} + +var toStreams2 = function(rs) { + return new (stream.Readable)({objectMode:true, highWaterMark:16}).wrap(rs) +} + +var Duplexify = function(writable, readable, opts) { + if (!(this instanceof Duplexify)) return new Duplexify(writable, readable, opts) + stream.Duplex.call(this, opts) + + this._writable = null + this._readable = null + this._readable2 = null + + this._autoDestroy = !opts || opts.autoDestroy !== false + this._forwardDestroy = !opts || opts.destroy !== false + this._forwardEnd = !opts || opts.end !== false + this._corked = 1 // start corked + this._ondrain = null + this._drained = false + this._forwarding = false + this._unwrite = null + this._unread = null + this._ended = false + + this.destroyed = false + + if (writable) this.setWritable(writable) + if (readable) this.setReadable(readable) +} + +inherits(Duplexify, stream.Duplex) + +Duplexify.obj = function(writable, readable, opts) { + if (!opts) opts = {} + opts.objectMode = true + opts.highWaterMark = 16 + return new Duplexify(writable, readable, opts) +} + +Duplexify.prototype.cork = function() { + if (++this._corked === 1) this.emit('cork') +} + +Duplexify.prototype.uncork = function() { + if (this._corked && --this._corked === 0) this.emit('uncork') +} + +Duplexify.prototype.setWritable = function(writable) { + if (this._unwrite) this._unwrite() + + if (this.destroyed) { + if (writable && writable.destroy) writable.destroy() + return + } + + if (writable === null || writable === false) { + this.end() + return + } + + var self = this + var unend = eos(writable, {writable:true, readable:false}, destroyer(this, this._forwardEnd)) + + var ondrain = function() { + var ondrain = self._ondrain + self._ondrain = null + if (ondrain) ondrain() + } + + var clear = function() { + self._writable.removeListener('drain', ondrain) + unend() + } + + if (this._unwrite) process.nextTick(ondrain) // force a drain on stream reset to avoid livelocks + + this._writable = writable + this._writable.on('drain', ondrain) + this._unwrite = clear + + this.uncork() // always uncork setWritable +} + +Duplexify.prototype.setReadable = function(readable) { + if (this._unread) this._unread() + + if (this.destroyed) { + if (readable && readable.destroy) readable.destroy() + return + } + + if (readable === null || readable === false) { + this.push(null) + this.resume() + return + } + + var self = this + var unend = eos(readable, {writable:false, readable:true}, destroyer(this)) + + var onreadable = function() { + self._forward() + } + + var onend = function() { + self.push(null) + } + + var clear = function() { + self._readable2.removeListener('readable', onreadable) + self._readable2.removeListener('end', onend) + unend() + } + + this._drained = true + this._readable = readable + this._readable2 = readable._readableState ? readable : toStreams2(readable) + this._readable2.on('readable', onreadable) + this._readable2.on('end', onend) + this._unread = clear + + this._forward() +} + +Duplexify.prototype._read = function() { + this._drained = true + this._forward() +} + +Duplexify.prototype._forward = function() { + if (this._forwarding || !this._readable2 || !this._drained) return + this._forwarding = true + + var data + + while (this._drained && (data = shift(this._readable2)) !== null) { + if (this.destroyed) continue + this._drained = this.push(data) + } + + this._forwarding = false +} + +Duplexify.prototype.destroy = function(err, cb) { + if (!cb) cb = noop + if (this.destroyed) return cb(null) + this.destroyed = true + + var self = this + process.nextTick(function() { + self._destroy(err) + cb(null) + }) +} + +Duplexify.prototype._destroy = function(err) { + if (err) { + var ondrain = this._ondrain + this._ondrain = null + if (ondrain) ondrain(err) + else this.emit('error', err) + } + + if (this._forwardDestroy) { + if (this._readable && this._readable.destroy) this._readable.destroy() + if (this._writable && this._writable.destroy) this._writable.destroy() + } + + this.emit('close') +} + +Duplexify.prototype._write = function(data, enc, cb) { + if (this.destroyed) return + if (this._corked) return onuncork(this, this._write.bind(this, data, enc, cb)) + if (data === SIGNAL_FLUSH) return this._finish(cb) + if (!this._writable) return cb() + + if (this._writable.write(data) === false) this._ondrain = cb + else if (!this.destroyed) cb() +} + +Duplexify.prototype._finish = function(cb) { + var self = this + this.emit('preend') + onuncork(this, function() { + end(self._forwardEnd && self._writable, function() { + // haxx to not emit prefinish twice + if (self._writableState.prefinished === false) self._writableState.prefinished = true + self.emit('prefinish') + onuncork(self, cb) + }) + }) +} + +Duplexify.prototype.end = function(data, enc, cb) { + if (typeof data === 'function') return this.end(null, null, data) + if (typeof enc === 'function') return this.end(data, null, enc) + this._ended = true + if (data) this.write(data) + if (!this._writableState.ending && !this._writableState.destroyed) this.write(SIGNAL_FLUSH) + return stream.Writable.prototype.end.call(this, cb) +} + +module.exports = Duplexify + + /***/ }), /***/ 325: @@ -41248,6 +129825,212 @@ function getParamBytesForAlg(alg) { module.exports = getParamBytesForAlg; +/***/ }), + +/***/ 25049: +/***/ ((module) => { + +"use strict"; +/*! + * ee-first + * Copyright(c) 2014 Jonathan Ong + * MIT Licensed + */ + + + +/** + * Module exports. + * @public + */ + +module.exports = first + +/** + * Get the first event in a set of event emitters and event pairs. + * + * @param {array} stuff + * @param {function} done + * @public + */ + +function first(stuff, done) { + if (!Array.isArray(stuff)) + throw new TypeError('arg must be an array of [ee, events...] arrays') + + var cleanups = [] + + for (var i = 0; i < stuff.length; i++) { + var arr = stuff[i] + + if (!Array.isArray(arr) || arr.length < 2) + throw new TypeError('each array member must be [ee, events...]') + + var ee = arr[0] + + for (var j = 1; j < arr.length; j++) { + var event = arr[j] + var fn = listener(event, callback) + + // listen to the event + ee.on(event, fn) + // push this listener to the list of cleanups + cleanups.push({ + ee: ee, + event: event, + fn: fn, + }) + } + } + + function callback() { + cleanup() + done.apply(null, arguments) + } + + function cleanup() { + var x + for (var i = 0; i < cleanups.length; i++) { + x = cleanups[i] + x.ee.removeListener(x.event, x.fn) + } + } + + function thunk(fn) { + done = fn + } + + thunk.cancel = cleanup + + return thunk +} + +/** + * Create the event listener. + * @private + */ + +function listener(event, done) { + return function onevent(arg1) { + var args = new Array(arguments.length) + var ee = this + var err = event === 'error' + ? arg1 + : null + + // copy args to prevent arguments escaping scope + for (var i = 0; i < args.length; i++) { + args[i] = arguments[i] + } + + done(err, ee, event, args) + } +} + + +/***/ }), + +/***/ 31424: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var once = __nccwpck_require__(55560); + +var noop = function() {}; + +var qnt = global.Bare ? queueMicrotask : process.nextTick.bind(process); + +var isRequest = function(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +}; + +var isChildProcess = function(stream) { + return stream.stdio && Array.isArray(stream.stdio) && stream.stdio.length === 3 +}; + +var eos = function(stream, opts, callback) { + if (typeof opts === 'function') return eos(stream, null, opts); + if (!opts) opts = {}; + + callback = once(callback || noop); + + var ws = stream._writableState; + var rs = stream._readableState; + var readable = opts.readable || (opts.readable !== false && stream.readable); + var writable = opts.writable || (opts.writable !== false && stream.writable); + var cancelled = false; + + var onlegacyfinish = function() { + if (!stream.writable) onfinish(); + }; + + var onfinish = function() { + writable = false; + if (!readable) callback.call(stream); + }; + + var onend = function() { + readable = false; + if (!writable) callback.call(stream); + }; + + var onexit = function(exitCode) { + callback.call(stream, exitCode ? new Error('exited with error code: ' + exitCode) : null); + }; + + var onerror = function(err) { + callback.call(stream, err); + }; + + var onclose = function() { + qnt(onclosenexttick); + }; + + var onclosenexttick = function() { + if (cancelled) return; + if (readable && !(rs && (rs.ended && !rs.destroyed))) return callback.call(stream, new Error('premature close')); + if (writable && !(ws && (ws.ended && !ws.destroyed))) return callback.call(stream, new Error('premature close')); + }; + + var onrequest = function() { + stream.req.on('finish', onfinish); + }; + + if (isRequest(stream)) { + stream.on('complete', onfinish); + stream.on('abort', onclose); + if (stream.req) onrequest(); + else stream.on('request', onrequest); + } else if (writable && !ws) { // legacy streams + stream.on('end', onlegacyfinish); + stream.on('close', onlegacyfinish); + } + + if (isChildProcess(stream)) stream.on('exit', onexit); + + stream.on('end', onend); + stream.on('finish', onfinish); + if (opts.error !== false) stream.on('error', onerror); + stream.on('close', onclose); + + return function() { + cancelled = true; + stream.removeListener('complete', onfinish); + stream.removeListener('abort', onclose); + stream.removeListener('request', onrequest); + if (stream.req) stream.req.removeListener('finish', onfinish); + stream.removeListener('end', onlegacyfinish); + stream.removeListener('close', onlegacyfinish); + stream.removeListener('finish', onfinish); + stream.removeListener('exit', onexit); + stream.removeListener('end', onend); + stream.removeListener('error', onerror); + stream.removeListener('close', onclose); + }; +}; + +module.exports = eos; + + /***/ }), /***/ 79094: @@ -41366,6 +130149,1611 @@ module.exports = URIError; module.exports = Object; +/***/ }), + +/***/ 16577: +/***/ ((module, exports) => { + +"use strict"; +/** + * @author Toru Nagashima + * @copyright 2015 Toru Nagashima. All rights reserved. + * See LICENSE file in root directory for full license. + */ + + +Object.defineProperty(exports, "__esModule", ({ value: true })); + +/** + * @typedef {object} PrivateData + * @property {EventTarget} eventTarget The event target. + * @property {{type:string}} event The original event object. + * @property {number} eventPhase The current event phase. + * @property {EventTarget|null} currentTarget The current event target. + * @property {boolean} canceled The flag to prevent default. + * @property {boolean} stopped The flag to stop propagation. + * @property {boolean} immediateStopped The flag to stop propagation immediately. + * @property {Function|null} passiveListener The listener if the current listener is passive. Otherwise this is null. + * @property {number} timeStamp The unix time. + * @private + */ + +/** + * Private data for event wrappers. + * @type {WeakMap} + * @private + */ +const privateData = new WeakMap(); + +/** + * Cache for wrapper classes. + * @type {WeakMap} + * @private + */ +const wrappers = new WeakMap(); + +/** + * Get private data. + * @param {Event} event The event object to get private data. + * @returns {PrivateData} The private data of the event. + * @private + */ +function pd(event) { + const retv = privateData.get(event); + console.assert( + retv != null, + "'this' is expected an Event object, but got", + event + ); + return retv +} + +/** + * https://dom.spec.whatwg.org/#set-the-canceled-flag + * @param data {PrivateData} private data. + */ +function setCancelFlag(data) { + if (data.passiveListener != null) { + if ( + typeof console !== "undefined" && + typeof console.error === "function" + ) { + console.error( + "Unable to preventDefault inside passive event listener invocation.", + data.passiveListener + ); + } + return + } + if (!data.event.cancelable) { + return + } + + data.canceled = true; + if (typeof data.event.preventDefault === "function") { + data.event.preventDefault(); + } +} + +/** + * @see https://dom.spec.whatwg.org/#interface-event + * @private + */ +/** + * The event wrapper. + * @constructor + * @param {EventTarget} eventTarget The event target of this dispatching. + * @param {Event|{type:string}} event The original event to wrap. + */ +function Event(eventTarget, event) { + privateData.set(this, { + eventTarget, + event, + eventPhase: 2, + currentTarget: eventTarget, + canceled: false, + stopped: false, + immediateStopped: false, + passiveListener: null, + timeStamp: event.timeStamp || Date.now(), + }); + + // https://heycam.github.io/webidl/#Unforgeable + Object.defineProperty(this, "isTrusted", { value: false, enumerable: true }); + + // Define accessors + const keys = Object.keys(event); + for (let i = 0; i < keys.length; ++i) { + const key = keys[i]; + if (!(key in this)) { + Object.defineProperty(this, key, defineRedirectDescriptor(key)); + } + } +} + +// Should be enumerable, but class methods are not enumerable. +Event.prototype = { + /** + * The type of this event. + * @type {string} + */ + get type() { + return pd(this).event.type + }, + + /** + * The target of this event. + * @type {EventTarget} + */ + get target() { + return pd(this).eventTarget + }, + + /** + * The target of this event. + * @type {EventTarget} + */ + get currentTarget() { + return pd(this).currentTarget + }, + + /** + * @returns {EventTarget[]} The composed path of this event. + */ + composedPath() { + const currentTarget = pd(this).currentTarget; + if (currentTarget == null) { + return [] + } + return [currentTarget] + }, + + /** + * Constant of NONE. + * @type {number} + */ + get NONE() { + return 0 + }, + + /** + * Constant of CAPTURING_PHASE. + * @type {number} + */ + get CAPTURING_PHASE() { + return 1 + }, + + /** + * Constant of AT_TARGET. + * @type {number} + */ + get AT_TARGET() { + return 2 + }, + + /** + * Constant of BUBBLING_PHASE. + * @type {number} + */ + get BUBBLING_PHASE() { + return 3 + }, + + /** + * The target of this event. + * @type {number} + */ + get eventPhase() { + return pd(this).eventPhase + }, + + /** + * Stop event bubbling. + * @returns {void} + */ + stopPropagation() { + const data = pd(this); + + data.stopped = true; + if (typeof data.event.stopPropagation === "function") { + data.event.stopPropagation(); + } + }, + + /** + * Stop event bubbling. + * @returns {void} + */ + stopImmediatePropagation() { + const data = pd(this); + + data.stopped = true; + data.immediateStopped = true; + if (typeof data.event.stopImmediatePropagation === "function") { + data.event.stopImmediatePropagation(); + } + }, + + /** + * The flag to be bubbling. + * @type {boolean} + */ + get bubbles() { + return Boolean(pd(this).event.bubbles) + }, + + /** + * The flag to be cancelable. + * @type {boolean} + */ + get cancelable() { + return Boolean(pd(this).event.cancelable) + }, + + /** + * Cancel this event. + * @returns {void} + */ + preventDefault() { + setCancelFlag(pd(this)); + }, + + /** + * The flag to indicate cancellation state. + * @type {boolean} + */ + get defaultPrevented() { + return pd(this).canceled + }, + + /** + * The flag to be composed. + * @type {boolean} + */ + get composed() { + return Boolean(pd(this).event.composed) + }, + + /** + * The unix time of this event. + * @type {number} + */ + get timeStamp() { + return pd(this).timeStamp + }, + + /** + * The target of this event. + * @type {EventTarget} + * @deprecated + */ + get srcElement() { + return pd(this).eventTarget + }, + + /** + * The flag to stop event bubbling. + * @type {boolean} + * @deprecated + */ + get cancelBubble() { + return pd(this).stopped + }, + set cancelBubble(value) { + if (!value) { + return + } + const data = pd(this); + + data.stopped = true; + if (typeof data.event.cancelBubble === "boolean") { + data.event.cancelBubble = true; + } + }, + + /** + * The flag to indicate cancellation state. + * @type {boolean} + * @deprecated + */ + get returnValue() { + return !pd(this).canceled + }, + set returnValue(value) { + if (!value) { + setCancelFlag(pd(this)); + } + }, + + /** + * Initialize this event object. But do nothing under event dispatching. + * @param {string} type The event type. + * @param {boolean} [bubbles=false] The flag to be possible to bubble up. + * @param {boolean} [cancelable=false] The flag to be possible to cancel. + * @deprecated + */ + initEvent() { + // Do nothing. + }, +}; + +// `constructor` is not enumerable. +Object.defineProperty(Event.prototype, "constructor", { + value: Event, + configurable: true, + writable: true, +}); + +// Ensure `event instanceof window.Event` is `true`. +if (typeof window !== "undefined" && typeof window.Event !== "undefined") { + Object.setPrototypeOf(Event.prototype, window.Event.prototype); + + // Make association for wrappers. + wrappers.set(window.Event.prototype, Event); +} + +/** + * Get the property descriptor to redirect a given property. + * @param {string} key Property name to define property descriptor. + * @returns {PropertyDescriptor} The property descriptor to redirect the property. + * @private + */ +function defineRedirectDescriptor(key) { + return { + get() { + return pd(this).event[key] + }, + set(value) { + pd(this).event[key] = value; + }, + configurable: true, + enumerable: true, + } +} + +/** + * Get the property descriptor to call a given method property. + * @param {string} key Property name to define property descriptor. + * @returns {PropertyDescriptor} The property descriptor to call the method property. + * @private + */ +function defineCallDescriptor(key) { + return { + value() { + const event = pd(this).event; + return event[key].apply(event, arguments) + }, + configurable: true, + enumerable: true, + } +} + +/** + * Define new wrapper class. + * @param {Function} BaseEvent The base wrapper class. + * @param {Object} proto The prototype of the original event. + * @returns {Function} The defined wrapper class. + * @private + */ +function defineWrapper(BaseEvent, proto) { + const keys = Object.keys(proto); + if (keys.length === 0) { + return BaseEvent + } + + /** CustomEvent */ + function CustomEvent(eventTarget, event) { + BaseEvent.call(this, eventTarget, event); + } + + CustomEvent.prototype = Object.create(BaseEvent.prototype, { + constructor: { value: CustomEvent, configurable: true, writable: true }, + }); + + // Define accessors. + for (let i = 0; i < keys.length; ++i) { + const key = keys[i]; + if (!(key in BaseEvent.prototype)) { + const descriptor = Object.getOwnPropertyDescriptor(proto, key); + const isFunc = typeof descriptor.value === "function"; + Object.defineProperty( + CustomEvent.prototype, + key, + isFunc + ? defineCallDescriptor(key) + : defineRedirectDescriptor(key) + ); + } + } + + return CustomEvent +} + +/** + * Get the wrapper class of a given prototype. + * @param {Object} proto The prototype of the original event to get its wrapper. + * @returns {Function} The wrapper class. + * @private + */ +function getWrapper(proto) { + if (proto == null || proto === Object.prototype) { + return Event + } + + let wrapper = wrappers.get(proto); + if (wrapper == null) { + wrapper = defineWrapper(getWrapper(Object.getPrototypeOf(proto)), proto); + wrappers.set(proto, wrapper); + } + return wrapper +} + +/** + * Wrap a given event to management a dispatching. + * @param {EventTarget} eventTarget The event target of this dispatching. + * @param {Object} event The event to wrap. + * @returns {Event} The wrapper instance. + * @private + */ +function wrapEvent(eventTarget, event) { + const Wrapper = getWrapper(Object.getPrototypeOf(event)); + return new Wrapper(eventTarget, event) +} + +/** + * Get the immediateStopped flag of a given event. + * @param {Event} event The event to get. + * @returns {boolean} The flag to stop propagation immediately. + * @private + */ +function isStopped(event) { + return pd(event).immediateStopped +} + +/** + * Set the current event phase of a given event. + * @param {Event} event The event to set current target. + * @param {number} eventPhase New event phase. + * @returns {void} + * @private + */ +function setEventPhase(event, eventPhase) { + pd(event).eventPhase = eventPhase; +} + +/** + * Set the current target of a given event. + * @param {Event} event The event to set current target. + * @param {EventTarget|null} currentTarget New current target. + * @returns {void} + * @private + */ +function setCurrentTarget(event, currentTarget) { + pd(event).currentTarget = currentTarget; +} + +/** + * Set a passive listener of a given event. + * @param {Event} event The event to set current target. + * @param {Function|null} passiveListener New passive listener. + * @returns {void} + * @private + */ +function setPassiveListener(event, passiveListener) { + pd(event).passiveListener = passiveListener; +} + +/** + * @typedef {object} ListenerNode + * @property {Function} listener + * @property {1|2|3} listenerType + * @property {boolean} passive + * @property {boolean} once + * @property {ListenerNode|null} next + * @private + */ + +/** + * @type {WeakMap>} + * @private + */ +const listenersMap = new WeakMap(); + +// Listener types +const CAPTURE = 1; +const BUBBLE = 2; +const ATTRIBUTE = 3; + +/** + * Check whether a given value is an object or not. + * @param {any} x The value to check. + * @returns {boolean} `true` if the value is an object. + */ +function isObject(x) { + return x !== null && typeof x === "object" //eslint-disable-line no-restricted-syntax +} + +/** + * Get listeners. + * @param {EventTarget} eventTarget The event target to get. + * @returns {Map} The listeners. + * @private + */ +function getListeners(eventTarget) { + const listeners = listenersMap.get(eventTarget); + if (listeners == null) { + throw new TypeError( + "'this' is expected an EventTarget object, but got another value." + ) + } + return listeners +} + +/** + * Get the property descriptor for the event attribute of a given event. + * @param {string} eventName The event name to get property descriptor. + * @returns {PropertyDescriptor} The property descriptor. + * @private + */ +function defineEventAttributeDescriptor(eventName) { + return { + get() { + const listeners = getListeners(this); + let node = listeners.get(eventName); + while (node != null) { + if (node.listenerType === ATTRIBUTE) { + return node.listener + } + node = node.next; + } + return null + }, + + set(listener) { + if (typeof listener !== "function" && !isObject(listener)) { + listener = null; // eslint-disable-line no-param-reassign + } + const listeners = getListeners(this); + + // Traverse to the tail while removing old value. + let prev = null; + let node = listeners.get(eventName); + while (node != null) { + if (node.listenerType === ATTRIBUTE) { + // Remove old value. + if (prev !== null) { + prev.next = node.next; + } else if (node.next !== null) { + listeners.set(eventName, node.next); + } else { + listeners.delete(eventName); + } + } else { + prev = node; + } + + node = node.next; + } + + // Add new value. + if (listener !== null) { + const newNode = { + listener, + listenerType: ATTRIBUTE, + passive: false, + once: false, + next: null, + }; + if (prev === null) { + listeners.set(eventName, newNode); + } else { + prev.next = newNode; + } + } + }, + configurable: true, + enumerable: true, + } +} + +/** + * Define an event attribute (e.g. `eventTarget.onclick`). + * @param {Object} eventTargetPrototype The event target prototype to define an event attrbite. + * @param {string} eventName The event name to define. + * @returns {void} + */ +function defineEventAttribute(eventTargetPrototype, eventName) { + Object.defineProperty( + eventTargetPrototype, + `on${eventName}`, + defineEventAttributeDescriptor(eventName) + ); +} + +/** + * Define a custom EventTarget with event attributes. + * @param {string[]} eventNames Event names for event attributes. + * @returns {EventTarget} The custom EventTarget. + * @private + */ +function defineCustomEventTarget(eventNames) { + /** CustomEventTarget */ + function CustomEventTarget() { + EventTarget.call(this); + } + + CustomEventTarget.prototype = Object.create(EventTarget.prototype, { + constructor: { + value: CustomEventTarget, + configurable: true, + writable: true, + }, + }); + + for (let i = 0; i < eventNames.length; ++i) { + defineEventAttribute(CustomEventTarget.prototype, eventNames[i]); + } + + return CustomEventTarget +} + +/** + * EventTarget. + * + * - This is constructor if no arguments. + * - This is a function which returns a CustomEventTarget constructor if there are arguments. + * + * For example: + * + * class A extends EventTarget {} + * class B extends EventTarget("message") {} + * class C extends EventTarget("message", "error") {} + * class D extends EventTarget(["message", "error"]) {} + */ +function EventTarget() { + /*eslint-disable consistent-return */ + if (this instanceof EventTarget) { + listenersMap.set(this, new Map()); + return + } + if (arguments.length === 1 && Array.isArray(arguments[0])) { + return defineCustomEventTarget(arguments[0]) + } + if (arguments.length > 0) { + const types = new Array(arguments.length); + for (let i = 0; i < arguments.length; ++i) { + types[i] = arguments[i]; + } + return defineCustomEventTarget(types) + } + throw new TypeError("Cannot call a class as a function") + /*eslint-enable consistent-return */ +} + +// Should be enumerable, but class methods are not enumerable. +EventTarget.prototype = { + /** + * Add a given listener to this event target. + * @param {string} eventName The event name to add. + * @param {Function} listener The listener to add. + * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener. + * @returns {void} + */ + addEventListener(eventName, listener, options) { + if (listener == null) { + return + } + if (typeof listener !== "function" && !isObject(listener)) { + throw new TypeError("'listener' should be a function or an object.") + } + + const listeners = getListeners(this); + const optionsIsObj = isObject(options); + const capture = optionsIsObj + ? Boolean(options.capture) + : Boolean(options); + const listenerType = capture ? CAPTURE : BUBBLE; + const newNode = { + listener, + listenerType, + passive: optionsIsObj && Boolean(options.passive), + once: optionsIsObj && Boolean(options.once), + next: null, + }; + + // Set it as the first node if the first node is null. + let node = listeners.get(eventName); + if (node === undefined) { + listeners.set(eventName, newNode); + return + } + + // Traverse to the tail while checking duplication.. + let prev = null; + while (node != null) { + if ( + node.listener === listener && + node.listenerType === listenerType + ) { + // Should ignore duplication. + return + } + prev = node; + node = node.next; + } + + // Add it. + prev.next = newNode; + }, + + /** + * Remove a given listener from this event target. + * @param {string} eventName The event name to remove. + * @param {Function} listener The listener to remove. + * @param {boolean|{capture?:boolean,passive?:boolean,once?:boolean}} [options] The options for this listener. + * @returns {void} + */ + removeEventListener(eventName, listener, options) { + if (listener == null) { + return + } + + const listeners = getListeners(this); + const capture = isObject(options) + ? Boolean(options.capture) + : Boolean(options); + const listenerType = capture ? CAPTURE : BUBBLE; + + let prev = null; + let node = listeners.get(eventName); + while (node != null) { + if ( + node.listener === listener && + node.listenerType === listenerType + ) { + if (prev !== null) { + prev.next = node.next; + } else if (node.next !== null) { + listeners.set(eventName, node.next); + } else { + listeners.delete(eventName); + } + return + } + + prev = node; + node = node.next; + } + }, + + /** + * Dispatch a given event. + * @param {Event|{type:string}} event The event to dispatch. + * @returns {boolean} `false` if canceled. + */ + dispatchEvent(event) { + if (event == null || typeof event.type !== "string") { + throw new TypeError('"event.type" should be a string.') + } + + // If listeners aren't registered, terminate. + const listeners = getListeners(this); + const eventName = event.type; + let node = listeners.get(eventName); + if (node == null) { + return true + } + + // Since we cannot rewrite several properties, so wrap object. + const wrappedEvent = wrapEvent(this, event); + + // This doesn't process capturing phase and bubbling phase. + // This isn't participating in a tree. + let prev = null; + while (node != null) { + // Remove this listener if it's once + if (node.once) { + if (prev !== null) { + prev.next = node.next; + } else if (node.next !== null) { + listeners.set(eventName, node.next); + } else { + listeners.delete(eventName); + } + } else { + prev = node; + } + + // Call this listener + setPassiveListener( + wrappedEvent, + node.passive ? node.listener : null + ); + if (typeof node.listener === "function") { + try { + node.listener.call(this, wrappedEvent); + } catch (err) { + if ( + typeof console !== "undefined" && + typeof console.error === "function" + ) { + console.error(err); + } + } + } else if ( + node.listenerType !== ATTRIBUTE && + typeof node.listener.handleEvent === "function" + ) { + node.listener.handleEvent(wrappedEvent); + } + + // Break if `event.stopImmediatePropagation` was called. + if (isStopped(wrappedEvent)) { + break + } + + node = node.next; + } + setPassiveListener(wrappedEvent, null); + setEventPhase(wrappedEvent, 0); + setCurrentTarget(wrappedEvent, null); + + return !wrappedEvent.defaultPrevented + }, +}; + +// `constructor` is not enumerable. +Object.defineProperty(EventTarget.prototype, "constructor", { + value: EventTarget, + configurable: true, + writable: true, +}); + +// Ensure `eventTarget instanceof window.EventTarget` is `true`. +if ( + typeof window !== "undefined" && + typeof window.EventTarget !== "undefined" +) { + Object.setPrototypeOf(EventTarget.prototype, window.EventTarget.prototype); +} + +exports.defineEventAttribute = defineEventAttribute; +exports.EventTarget = EventTarget; +exports["default"] = EventTarget; + +module.exports = EventTarget +module.exports.EventTarget = module.exports["default"] = EventTarget +module.exports.defineEventAttribute = defineEventAttribute +//# sourceMappingURL=event-target-shim.js.map + + +/***/ }), + +/***/ 19367: +/***/ ((module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright 2017 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.EventId = void 0; +const uuid = __nccwpck_require__(69815); +// This function is pulled directly from the d64 module: +// https://github.com/dominictarr/d64 +// That module hasn't been updated in 8 years, and misuses the Buffer package. +// See issue here: https://github.com/google/eventid-js/issues/160 +const chars = '.PYFGCRLAOEUIDHTNSQJKXBMWVZ_pyfgcrlaoeuidhtnsqjkxbmwvz1234567890' + .split('') + .sort() + .join(''); +function encode(data) { + let s = ''; + const l = data.length; + let hang = 0; + for (let i = 0; i < l; i++) { + const v = data[i]; + switch (i % 3) { + case 0: + s += chars[v >> 2]; + hang = (v & 3) << 4; + break; + case 1: + s += chars[hang | (v >> 4)]; + hang = (v & 0xf) << 2; + break; + case 2: + s += chars[hang | (v >> 6)]; + s += chars[v & 0x3f]; + hang = 0; + break; + } + } + if (l % 3) + s += chars[hang]; + return s; +} +class EventId { + constructor() { + this.b = new Uint8Array(24); + uuid.v4(null, this.b, 8); + } + new() { + for (let i = 7; i >= 0; i--) { + if (this.b[i] !== 255) { + this.b[i]++; + break; + } + this.b[i] = 0; + } + return encode(this.b); + } +} +exports.EventId = EventId; +// preserve `const EventId = require('EventId')` syntax +const existingExports = module.exports; +module.exports = EventId; +module.exports = Object.assign(module.exports, existingExports); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 69815: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +Object.defineProperty(exports, "v1", ({ + enumerable: true, + get: function () { + return _v.default; + } +})); +Object.defineProperty(exports, "v3", ({ + enumerable: true, + get: function () { + return _v2.default; + } +})); +Object.defineProperty(exports, "v4", ({ + enumerable: true, + get: function () { + return _v3.default; + } +})); +Object.defineProperty(exports, "v5", ({ + enumerable: true, + get: function () { + return _v4.default; + } +})); +Object.defineProperty(exports, "NIL", ({ + enumerable: true, + get: function () { + return _nil.default; + } +})); +Object.defineProperty(exports, "version", ({ + enumerable: true, + get: function () { + return _version.default; + } +})); +Object.defineProperty(exports, "validate", ({ + enumerable: true, + get: function () { + return _validate.default; + } +})); +Object.defineProperty(exports, "stringify", ({ + enumerable: true, + get: function () { + return _stringify.default; + } +})); +Object.defineProperty(exports, "parse", ({ + enumerable: true, + get: function () { + return _parse.default; + } +})); + +var _v = _interopRequireDefault(__nccwpck_require__(81206)); + +var _v2 = _interopRequireDefault(__nccwpck_require__(9100)); + +var _v3 = _interopRequireDefault(__nccwpck_require__(9945)); + +var _v4 = _interopRequireDefault(__nccwpck_require__(97162)); + +var _nil = _interopRequireDefault(__nccwpck_require__(640)); + +var _version = _interopRequireDefault(__nccwpck_require__(55623)); + +var _validate = _interopRequireDefault(__nccwpck_require__(93653)); + +var _stringify = _interopRequireDefault(__nccwpck_require__(43886)); + +var _parse = _interopRequireDefault(__nccwpck_require__(62800)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/***/ }), + +/***/ 64111: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; + +var _crypto = _interopRequireDefault(__nccwpck_require__(76982)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function md5(bytes) { + if (Array.isArray(bytes)) { + bytes = Buffer.from(bytes); + } else if (typeof bytes === 'string') { + bytes = Buffer.from(bytes, 'utf8'); + } + + return _crypto.default.createHash('md5').update(bytes).digest(); +} + +var _default = md5; +exports["default"] = _default; + +/***/ }), + +/***/ 640: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; +var _default = '00000000-0000-0000-0000-000000000000'; +exports["default"] = _default; + +/***/ }), + +/***/ 62800: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; + +var _validate = _interopRequireDefault(__nccwpck_require__(93653)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function parse(uuid) { + if (!(0, _validate.default)(uuid)) { + throw TypeError('Invalid UUID'); + } + + let v; + const arr = new Uint8Array(16); // Parse ########-....-....-....-............ + + arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24; + arr[1] = v >>> 16 & 0xff; + arr[2] = v >>> 8 & 0xff; + arr[3] = v & 0xff; // Parse ........-####-....-....-............ + + arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8; + arr[5] = v & 0xff; // Parse ........-....-####-....-............ + + arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8; + arr[7] = v & 0xff; // Parse ........-....-....-####-............ + + arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8; + arr[9] = v & 0xff; // Parse ........-....-....-....-############ + // (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes) + + arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff; + arr[11] = v / 0x100000000 & 0xff; + arr[12] = v >>> 24 & 0xff; + arr[13] = v >>> 16 & 0xff; + arr[14] = v >>> 8 & 0xff; + arr[15] = v & 0xff; + return arr; +} + +var _default = parse; +exports["default"] = _default; + +/***/ }), + +/***/ 77744: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; +var _default = /^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i; +exports["default"] = _default; + +/***/ }), + +/***/ 17426: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = rng; + +var _crypto = _interopRequireDefault(__nccwpck_require__(76982)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const rnds8Pool = new Uint8Array(256); // # of random values to pre-allocate + +let poolPtr = rnds8Pool.length; + +function rng() { + if (poolPtr > rnds8Pool.length - 16) { + _crypto.default.randomFillSync(rnds8Pool); + + poolPtr = 0; + } + + return rnds8Pool.slice(poolPtr, poolPtr += 16); +} + +/***/ }), + +/***/ 58090: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; + +var _crypto = _interopRequireDefault(__nccwpck_require__(76982)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function sha1(bytes) { + if (Array.isArray(bytes)) { + bytes = Buffer.from(bytes); + } else if (typeof bytes === 'string') { + bytes = Buffer.from(bytes, 'utf8'); + } + + return _crypto.default.createHash('sha1').update(bytes).digest(); +} + +var _default = sha1; +exports["default"] = _default; + +/***/ }), + +/***/ 43886: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; + +var _validate = _interopRequireDefault(__nccwpck_require__(93653)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +/** + * Convert array of 16 byte values to UUID string format of the form: + * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX + */ +const byteToHex = []; + +for (let i = 0; i < 256; ++i) { + byteToHex.push((i + 0x100).toString(16).substr(1)); +} + +function stringify(arr, offset = 0) { + // Note: Be careful editing this code! It's been tuned for performance + // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434 + const uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one + // of the following: + // - One or more input array values don't map to a hex octet (leading to + // "undefined" in the uuid) + // - Invalid input values for the RFC `version` or `variant` fields + + if (!(0, _validate.default)(uuid)) { + throw TypeError('Stringified UUID is invalid'); + } + + return uuid; +} + +var _default = stringify; +exports["default"] = _default; + +/***/ }), + +/***/ 81206: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; + +var _rng = _interopRequireDefault(__nccwpck_require__(17426)); + +var _stringify = _interopRequireDefault(__nccwpck_require__(43886)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +// **`v1()` - Generate time-based UUID** +// +// Inspired by https://github.com/LiosK/UUID.js +// and http://docs.python.org/library/uuid.html +let _nodeId; + +let _clockseq; // Previous uuid creation time + + +let _lastMSecs = 0; +let _lastNSecs = 0; // See https://github.com/uuidjs/uuid for API details + +function v1(options, buf, offset) { + let i = buf && offset || 0; + const b = buf || new Array(16); + options = options || {}; + let node = options.node || _nodeId; + let clockseq = options.clockseq !== undefined ? options.clockseq : _clockseq; // node and clockseq need to be initialized to random values if they're not + // specified. We do this lazily to minimize issues related to insufficient + // system entropy. See #189 + + if (node == null || clockseq == null) { + const seedBytes = options.random || (options.rng || _rng.default)(); + + if (node == null) { + // Per 4.5, create and 48-bit node id, (47 random bits + multicast bit = 1) + node = _nodeId = [seedBytes[0] | 0x01, seedBytes[1], seedBytes[2], seedBytes[3], seedBytes[4], seedBytes[5]]; + } + + if (clockseq == null) { + // Per 4.2.2, randomize (14 bit) clockseq + clockseq = _clockseq = (seedBytes[6] << 8 | seedBytes[7]) & 0x3fff; + } + } // UUID timestamps are 100 nano-second units since the Gregorian epoch, + // (1582-10-15 00:00). JSNumbers aren't precise enough for this, so + // time is handled internally as 'msecs' (integer milliseconds) and 'nsecs' + // (100-nanoseconds offset from msecs) since unix epoch, 1970-01-01 00:00. + + + let msecs = options.msecs !== undefined ? options.msecs : Date.now(); // Per 4.2.1.2, use count of uuid's generated during the current clock + // cycle to simulate higher resolution clock + + let nsecs = options.nsecs !== undefined ? options.nsecs : _lastNSecs + 1; // Time since last uuid creation (in msecs) + + const dt = msecs - _lastMSecs + (nsecs - _lastNSecs) / 10000; // Per 4.2.1.2, Bump clockseq on clock regression + + if (dt < 0 && options.clockseq === undefined) { + clockseq = clockseq + 1 & 0x3fff; + } // Reset nsecs if clock regresses (new clockseq) or we've moved onto a new + // time interval + + + if ((dt < 0 || msecs > _lastMSecs) && options.nsecs === undefined) { + nsecs = 0; + } // Per 4.2.1.2 Throw error if too many uuids are requested + + + if (nsecs >= 10000) { + throw new Error("uuid.v1(): Can't create more than 10M uuids/sec"); + } + + _lastMSecs = msecs; + _lastNSecs = nsecs; + _clockseq = clockseq; // Per 4.1.4 - Convert from unix epoch to Gregorian epoch + + msecs += 12219292800000; // `time_low` + + const tl = ((msecs & 0xfffffff) * 10000 + nsecs) % 0x100000000; + b[i++] = tl >>> 24 & 0xff; + b[i++] = tl >>> 16 & 0xff; + b[i++] = tl >>> 8 & 0xff; + b[i++] = tl & 0xff; // `time_mid` + + const tmh = msecs / 0x100000000 * 10000 & 0xfffffff; + b[i++] = tmh >>> 8 & 0xff; + b[i++] = tmh & 0xff; // `time_high_and_version` + + b[i++] = tmh >>> 24 & 0xf | 0x10; // include version + + b[i++] = tmh >>> 16 & 0xff; // `clock_seq_hi_and_reserved` (Per 4.2.2 - include variant) + + b[i++] = clockseq >>> 8 | 0x80; // `clock_seq_low` + + b[i++] = clockseq & 0xff; // `node` + + for (let n = 0; n < 6; ++n) { + b[i + n] = node[n]; + } + + return buf || (0, _stringify.default)(b); +} + +var _default = v1; +exports["default"] = _default; + +/***/ }), + +/***/ 9100: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; + +var _v = _interopRequireDefault(__nccwpck_require__(17321)); + +var _md = _interopRequireDefault(__nccwpck_require__(64111)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const v3 = (0, _v.default)('v3', 0x30, _md.default); +var _default = v3; +exports["default"] = _default; + +/***/ }), + +/***/ 17321: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = _default; +exports.URL = exports.DNS = void 0; + +var _stringify = _interopRequireDefault(__nccwpck_require__(43886)); + +var _parse = _interopRequireDefault(__nccwpck_require__(62800)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function stringToBytes(str) { + str = unescape(encodeURIComponent(str)); // UTF8 escape + + const bytes = []; + + for (let i = 0; i < str.length; ++i) { + bytes.push(str.charCodeAt(i)); + } + + return bytes; +} + +const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8'; +exports.DNS = DNS; +const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8'; +exports.URL = URL; + +function _default(name, version, hashfunc) { + function generateUUID(value, namespace, buf, offset) { + if (typeof value === 'string') { + value = stringToBytes(value); + } + + if (typeof namespace === 'string') { + namespace = (0, _parse.default)(namespace); + } + + if (namespace.length !== 16) { + throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)'); + } // Compute hash of namespace and value, Per 4.3 + // Future: Use spread syntax when supported on all platforms, e.g. `bytes = + // hashfunc([...namespace, ... value])` + + + let bytes = new Uint8Array(16 + value.length); + bytes.set(namespace); + bytes.set(value, namespace.length); + bytes = hashfunc(bytes); + bytes[6] = bytes[6] & 0x0f | version; + bytes[8] = bytes[8] & 0x3f | 0x80; + + if (buf) { + offset = offset || 0; + + for (let i = 0; i < 16; ++i) { + buf[offset + i] = bytes[i]; + } + + return buf; + } + + return (0, _stringify.default)(bytes); + } // Function#name is not settable on some platforms (#270) + + + try { + generateUUID.name = name; // eslint-disable-next-line no-empty + } catch (err) {} // For CommonJS default export support + + + generateUUID.DNS = DNS; + generateUUID.URL = URL; + return generateUUID; +} + +/***/ }), + +/***/ 9945: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; + +var _rng = _interopRequireDefault(__nccwpck_require__(17426)); + +var _stringify = _interopRequireDefault(__nccwpck_require__(43886)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function v4(options, buf, offset) { + options = options || {}; + + const rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved` + + + rnds[6] = rnds[6] & 0x0f | 0x40; + rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided + + if (buf) { + offset = offset || 0; + + for (let i = 0; i < 16; ++i) { + buf[offset + i] = rnds[i]; + } + + return buf; + } + + return (0, _stringify.default)(rnds); +} + +var _default = v4; +exports["default"] = _default; + +/***/ }), + +/***/ 97162: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; + +var _v = _interopRequireDefault(__nccwpck_require__(17321)); + +var _sha = _interopRequireDefault(__nccwpck_require__(58090)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +const v5 = (0, _v.default)('v5', 0x50, _sha.default); +var _default = v5; +exports["default"] = _default; + +/***/ }), + +/***/ 93653: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; + +var _regex = _interopRequireDefault(__nccwpck_require__(77744)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function validate(uuid) { + return typeof uuid === 'string' && _regex.default.test(uuid); +} + +var _default = validate; +exports["default"] = _default; + +/***/ }), + +/***/ 55623: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +Object.defineProperty(exports, "__esModule", ({ + value: true +})); +exports["default"] = void 0; + +var _validate = _interopRequireDefault(__nccwpck_require__(93653)); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function version(uuid) { + if (!(0, _validate.default)(uuid)) { + throw TypeError('Invalid UUID'); + } + + return parseInt(uuid.substr(14, 1), 16); +} + +var _default = version; +exports["default"] = _default; + /***/ }), /***/ 23860: @@ -50050,6 +140438,6782 @@ _LRUCache_cache = new WeakMap(), _LRUCache_instances = new WeakSet(), _LRUCache_ }; +/***/ }), + +/***/ 37312: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +/* module decorator */ module = __nccwpck_require__.nmd(module); +(e=>{"function"==typeof define&&define.amd?define(["protobufjs/minimal"],e): true&&module&&module.exports&&(module.exports=e(__nccwpck_require__(37823)))})(function(o){var e,t,n,r,F,a=o.Reader,i=o.Writer,p=o.util,l=o.roots.iam_protos||(o.roots.iam_protos={});function B(e,t,n){o.rpc.Service.call(this,e,t,n)}function s(e){if(e)for(var t=Object.keys(e),n=0;n>>3){case 1:o.resource=e.string();break;case 2:o.policy=l.google.iam.v1.Policy.decode(e,e.uint32());break;default:e.skipType(7&r)}}return o},s.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},s.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resource&&e.hasOwnProperty("resource")&&!p.isString(e.resource))return"resource: string expected";if(null!=e.policy&&e.hasOwnProperty("policy")){e=l.google.iam.v1.Policy.verify(e.policy);if(e)return"policy."+e}return null},s.fromObject=function(e){if(e instanceof l.google.iam.v1.SetIamPolicyRequest)return e;var t=new l.google.iam.v1.SetIamPolicyRequest;if(null!=e.resource&&(t.resource=String(e.resource)),null!=e.policy){if("object"!=typeof e.policy)throw TypeError(".google.iam.v1.SetIamPolicyRequest.policy: object expected");t.policy=l.google.iam.v1.Policy.fromObject(e.policy)}return t},s.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.resource="",n.policy=null),null!=e.resource&&e.hasOwnProperty("resource")&&(n.resource=e.resource),null!=e.policy&&e.hasOwnProperty("policy")&&(n.policy=l.google.iam.v1.Policy.toObject(e.policy,t)),n},s.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},s),t.GetIamPolicyRequest=(u.prototype.resource="",u.prototype.options=null,u.create=function(e){return new u(e)},u.encode=function(e,t){return t=t||i.create(),null!=e.resource&&Object.hasOwnProperty.call(e,"resource")&&t.uint32(10).string(e.resource),null!=e.options&&Object.hasOwnProperty.call(e,"options")&&l.google.iam.v1.GetPolicyOptions.encode(e.options,t.uint32(18).fork()).ldelim(),t},u.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},u.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new l.google.iam.v1.GetIamPolicyRequest;e.pos>>3){case 1:o.resource=e.string();break;case 2:o.options=l.google.iam.v1.GetPolicyOptions.decode(e,e.uint32());break;default:e.skipType(7&r)}}return o},u.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},u.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resource&&e.hasOwnProperty("resource")&&!p.isString(e.resource))return"resource: string expected";if(null!=e.options&&e.hasOwnProperty("options")){e=l.google.iam.v1.GetPolicyOptions.verify(e.options);if(e)return"options."+e}return null},u.fromObject=function(e){if(e instanceof l.google.iam.v1.GetIamPolicyRequest)return e;var t=new l.google.iam.v1.GetIamPolicyRequest;if(null!=e.resource&&(t.resource=String(e.resource)),null!=e.options){if("object"!=typeof e.options)throw TypeError(".google.iam.v1.GetIamPolicyRequest.options: object expected");t.options=l.google.iam.v1.GetPolicyOptions.fromObject(e.options)}return t},u.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.resource="",n.options=null),null!=e.resource&&e.hasOwnProperty("resource")&&(n.resource=e.resource),null!=e.options&&e.hasOwnProperty("options")&&(n.options=l.google.iam.v1.GetPolicyOptions.toObject(e.options,t)),n},u.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},u),t.TestIamPermissionsRequest=(c.prototype.resource="",c.prototype.permissions=p.emptyArray,c.create=function(e){return new c(e)},c.encode=function(e,t){if(t=t||i.create(),null!=e.resource&&Object.hasOwnProperty.call(e,"resource")&&t.uint32(10).string(e.resource),null!=e.permissions&&e.permissions.length)for(var n=0;n>>3){case 1:o.resource=e.string();break;case 2:o.permissions&&o.permissions.length||(o.permissions=[]),o.permissions.push(e.string());break;default:e.skipType(7&r)}}return o},c.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},c.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.resource&&e.hasOwnProperty("resource")&&!p.isString(e.resource))return"resource: string expected";if(null!=e.permissions&&e.hasOwnProperty("permissions")){if(!Array.isArray(e.permissions))return"permissions: array expected";for(var t=0;t>>3==1?(o.permissions&&o.permissions.length||(o.permissions=[]),o.permissions.push(e.string())):e.skipType(7&r)}return o},G.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},G.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.permissions&&e.hasOwnProperty("permissions")){if(!Array.isArray(e.permissions))return"permissions: array expected";for(var t=0;t>>3==1?o.requestedPolicyVersion=e.int32():e.skipType(7&r)}return o},U.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},U.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.requestedPolicyVersion&&e.hasOwnProperty("requestedPolicyVersion")&&!p.isInteger(e.requestedPolicyVersion)?"requestedPolicyVersion: integer expected":null},U.fromObject=function(e){var t;return e instanceof l.google.iam.v1.GetPolicyOptions?e:(t=new l.google.iam.v1.GetPolicyOptions,null!=e.requestedPolicyVersion&&(t.requestedPolicyVersion=0|e.requestedPolicyVersion),t)},U.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.requestedPolicyVersion=0),null!=e.requestedPolicyVersion&&e.hasOwnProperty("requestedPolicyVersion")&&(n.requestedPolicyVersion=e.requestedPolicyVersion),n},U.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},U),t.Policy=(d.prototype.version=0,d.prototype.bindings=p.emptyArray,d.prototype.etag=p.newBuffer([]),d.create=function(e){return new d(e)},d.encode=function(e,t){if(t=t||i.create(),null!=e.version&&Object.hasOwnProperty.call(e,"version")&&t.uint32(8).int32(e.version),null!=e.etag&&Object.hasOwnProperty.call(e,"etag")&&t.uint32(26).bytes(e.etag),null!=e.bindings&&e.bindings.length)for(var n=0;n>>3){case 1:o.version=e.int32();break;case 4:o.bindings&&o.bindings.length||(o.bindings=[]),o.bindings.push(l.google.iam.v1.Binding.decode(e,e.uint32()));break;case 3:o.etag=e.bytes();break;default:e.skipType(7&r)}}return o},d.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},d.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.version&&e.hasOwnProperty("version")&&!p.isInteger(e.version))return"version: integer expected";if(null!=e.bindings&&e.hasOwnProperty("bindings")){if(!Array.isArray(e.bindings))return"bindings: array expected";for(var t=0;t>>3){case 1:o.role=e.string();break;case 2:o.members&&o.members.length||(o.members=[]),o.members.push(e.string());break;case 3:o.condition=l.google.type.Expr.decode(e,e.uint32());break;default:e.skipType(7&r)}}return o},g.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},g.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.role&&e.hasOwnProperty("role")&&!p.isString(e.role))return"role: string expected";if(null!=e.members&&e.hasOwnProperty("members")){if(!Array.isArray(e.members))return"members: array expected";for(var t=0;t>>3){case 1:o.bindingDeltas&&o.bindingDeltas.length||(o.bindingDeltas=[]),o.bindingDeltas.push(l.google.iam.v1.BindingDelta.decode(e,e.uint32()));break;case 2:o.auditConfigDeltas&&o.auditConfigDeltas.length||(o.auditConfigDeltas=[]),o.auditConfigDeltas.push(l.google.iam.v1.AuditConfigDelta.decode(e,e.uint32()));break;default:e.skipType(7&r)}}return o},M.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},M.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.bindingDeltas&&e.hasOwnProperty("bindingDeltas")){if(!Array.isArray(e.bindingDeltas))return"bindingDeltas: array expected";for(var t=0;t>>3){case 1:o.action=e.int32();break;case 2:o.role=e.string();break;case 3:o.member=e.string();break;case 4:o.condition=l.google.type.Expr.decode(e,e.uint32());break;default:e.skipType(7&r)}}return o},f.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},f.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.action&&e.hasOwnProperty("action"))switch(e.action){default:return"action: enum value expected";case 0:case 1:case 2:}if(null!=e.role&&e.hasOwnProperty("role")&&!p.isString(e.role))return"role: string expected";if(null!=e.member&&e.hasOwnProperty("member")&&!p.isString(e.member))return"member: string expected";if(null!=e.condition&&e.hasOwnProperty("condition")){e=l.google.type.Expr.verify(e.condition);if(e)return"condition."+e}return null},f.fromObject=function(e){if(e instanceof l.google.iam.v1.BindingDelta)return e;var t=new l.google.iam.v1.BindingDelta;switch(e.action){case"ACTION_UNSPECIFIED":case 0:t.action=0;break;case"ADD":case 1:t.action=1;break;case"REMOVE":case 2:t.action=2}if(null!=e.role&&(t.role=String(e.role)),null!=e.member&&(t.member=String(e.member)),null!=e.condition){if("object"!=typeof e.condition)throw TypeError(".google.iam.v1.BindingDelta.condition: object expected");t.condition=l.google.type.Expr.fromObject(e.condition)}return t},f.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.action=t.enums===String?"ACTION_UNSPECIFIED":0,n.role="",n.member="",n.condition=null),null!=e.action&&e.hasOwnProperty("action")&&(n.action=t.enums===String?l.google.iam.v1.BindingDelta.Action[e.action]:e.action),null!=e.role&&e.hasOwnProperty("role")&&(n.role=e.role),null!=e.member&&e.hasOwnProperty("member")&&(n.member=e.member),null!=e.condition&&e.hasOwnProperty("condition")&&(n.condition=l.google.type.Expr.toObject(e.condition,t)),n},f.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},f.Action=(e={},(r=Object.create(e))[e[0]="ACTION_UNSPECIFIED"]=0,r[e[1]="ADD"]=1,r[e[2]="REMOVE"]=2,r),f),t.AuditConfigDelta=(y.prototype.action=0,y.prototype.service="",y.prototype.exemptedMember="",y.prototype.logType="",y.create=function(e){return new y(e)},y.encode=function(e,t){return t=t||i.create(),null!=e.action&&Object.hasOwnProperty.call(e,"action")&&t.uint32(8).int32(e.action),null!=e.service&&Object.hasOwnProperty.call(e,"service")&&t.uint32(18).string(e.service),null!=e.exemptedMember&&Object.hasOwnProperty.call(e,"exemptedMember")&&t.uint32(26).string(e.exemptedMember),null!=e.logType&&Object.hasOwnProperty.call(e,"logType")&&t.uint32(34).string(e.logType),t},y.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},y.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new l.google.iam.v1.AuditConfigDelta;e.pos>>3){case 1:o.action=e.int32();break;case 2:o.service=e.string();break;case 3:o.exemptedMember=e.string();break;case 4:o.logType=e.string();break;default:e.skipType(7&r)}}return o},y.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},y.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.action&&e.hasOwnProperty("action"))switch(e.action){default:return"action: enum value expected";case 0:case 1:case 2:}return null!=e.service&&e.hasOwnProperty("service")&&!p.isString(e.service)?"service: string expected":null!=e.exemptedMember&&e.hasOwnProperty("exemptedMember")&&!p.isString(e.exemptedMember)?"exemptedMember: string expected":null!=e.logType&&e.hasOwnProperty("logType")&&!p.isString(e.logType)?"logType: string expected":null},y.fromObject=function(e){if(e instanceof l.google.iam.v1.AuditConfigDelta)return e;var t=new l.google.iam.v1.AuditConfigDelta;switch(e.action){case"ACTION_UNSPECIFIED":case 0:t.action=0;break;case"ADD":case 1:t.action=1;break;case"REMOVE":case 2:t.action=2}return null!=e.service&&(t.service=String(e.service)),null!=e.exemptedMember&&(t.exemptedMember=String(e.exemptedMember)),null!=e.logType&&(t.logType=String(e.logType)),t},y.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.action=t.enums===String?"ACTION_UNSPECIFIED":0,n.service="",n.exemptedMember="",n.logType=""),null!=e.action&&e.hasOwnProperty("action")&&(n.action=t.enums===String?l.google.iam.v1.AuditConfigDelta.Action[e.action]:e.action),null!=e.service&&e.hasOwnProperty("service")&&(n.service=e.service),null!=e.exemptedMember&&e.hasOwnProperty("exemptedMember")&&(n.exemptedMember=e.exemptedMember),null!=e.logType&&e.hasOwnProperty("logType")&&(n.logType=e.logType),n},y.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},y.Action=(e={},(r=Object.create(e))[e[0]="ACTION_UNSPECIFIED"]=0,r[e[1]="ADD"]=1,r[e[2]="REMOVE"]=2,r),y),t.logging=((e={}).AuditData=(L.prototype.policyDelta=null,L.create=function(e){return new L(e)},L.encode=function(e,t){return t=t||i.create(),null!=e.policyDelta&&Object.hasOwnProperty.call(e,"policyDelta")&&l.google.iam.v1.PolicyDelta.encode(e.policyDelta,t.uint32(18).fork()).ldelim(),t},L.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},L.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new l.google.iam.v1.logging.AuditData;e.pos>>3==2?o.policyDelta=l.google.iam.v1.PolicyDelta.decode(e,e.uint32()):e.skipType(7&r)}return o},L.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},L.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.policyDelta&&e.hasOwnProperty("policyDelta")){e=l.google.iam.v1.PolicyDelta.verify(e.policyDelta);if(e)return"policyDelta."+e}return null},L.fromObject=function(e){if(e instanceof l.google.iam.v1.logging.AuditData)return e;var t=new l.google.iam.v1.logging.AuditData;if(null!=e.policyDelta){if("object"!=typeof e.policyDelta)throw TypeError(".google.iam.v1.logging.AuditData.policyDelta: object expected");t.policyDelta=l.google.iam.v1.PolicyDelta.fromObject(e.policyDelta)}return t},L.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.policyDelta=null),null!=e.policyDelta&&e.hasOwnProperty("policyDelta")&&(n.policyDelta=l.google.iam.v1.PolicyDelta.toObject(e.policyDelta,t)),n},L.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},L),e),t),n),F.api=((r={}).Http=(J.prototype.rules=p.emptyArray,J.prototype.fullyDecodeReservedExpansion=!1,J.create=function(e){return new J(e)},J.encode=function(e,t){if(t=t||i.create(),null!=e.rules&&e.rules.length)for(var n=0;n>>3){case 1:o.rules&&o.rules.length||(o.rules=[]),o.rules.push(l.google.api.HttpRule.decode(e,e.uint32()));break;case 2:o.fullyDecodeReservedExpansion=e.bool();break;default:e.skipType(7&r)}}return o},J.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},J.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.rules&&e.hasOwnProperty("rules")){if(!Array.isArray(e.rules))return"rules: array expected";for(var t=0;t>>3){case 1:o.selector=e.string();break;case 2:o.get=e.string();break;case 3:o.put=e.string();break;case 4:o.post=e.string();break;case 5:o.delete=e.string();break;case 6:o.patch=e.string();break;case 8:o.custom=l.google.api.CustomHttpPattern.decode(e,e.uint32());break;case 7:o.body=e.string();break;case 12:o.responseBody=e.string();break;case 11:o.additionalBindings&&o.additionalBindings.length||(o.additionalBindings=[]),o.additionalBindings.push(l.google.api.HttpRule.decode(e,e.uint32()));break;default:e.skipType(7&r)}}return o},h.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},h.verify=function(e){if("object"!=typeof e||null===e)return"object expected";var t={};if(null!=e.selector&&e.hasOwnProperty("selector")&&!p.isString(e.selector))return"selector: string expected";if(null!=e.get&&e.hasOwnProperty("get")&&(t.pattern=1,!p.isString(e.get)))return"get: string expected";if(null!=e.put&&e.hasOwnProperty("put")){if(1===t.pattern)return"pattern: multiple values";if(t.pattern=1,!p.isString(e.put))return"put: string expected"}if(null!=e.post&&e.hasOwnProperty("post")){if(1===t.pattern)return"pattern: multiple values";if(t.pattern=1,!p.isString(e.post))return"post: string expected"}if(null!=e.delete&&e.hasOwnProperty("delete")){if(1===t.pattern)return"pattern: multiple values";if(t.pattern=1,!p.isString(e.delete))return"delete: string expected"}if(null!=e.patch&&e.hasOwnProperty("patch")){if(1===t.pattern)return"pattern: multiple values";if(t.pattern=1,!p.isString(e.patch))return"patch: string expected"}if(null!=e.custom&&e.hasOwnProperty("custom")){if(1===t.pattern)return"pattern: multiple values";if(t.pattern=1,n=l.google.api.CustomHttpPattern.verify(e.custom))return"custom."+n}if(null!=e.body&&e.hasOwnProperty("body")&&!p.isString(e.body))return"body: string expected";if(null!=e.responseBody&&e.hasOwnProperty("responseBody")&&!p.isString(e.responseBody))return"responseBody: string expected";if(null!=e.additionalBindings&&e.hasOwnProperty("additionalBindings")){if(!Array.isArray(e.additionalBindings))return"additionalBindings: array expected";for(var n,o=0;o>>3){case 1:o.kind=e.string();break;case 2:o.path=e.string();break;default:e.skipType(7&r)}}return o},_.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},_.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.kind&&e.hasOwnProperty("kind")&&!p.isString(e.kind)?"kind: string expected":null!=e.path&&e.hasOwnProperty("path")&&!p.isString(e.path)?"path: string expected":null},_.fromObject=function(e){var t;return e instanceof l.google.api.CustomHttpPattern?e:(t=new l.google.api.CustomHttpPattern,null!=e.kind&&(t.kind=String(e.kind)),null!=e.path&&(t.path=String(e.path)),t)},_.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.kind="",n.path=""),null!=e.kind&&e.hasOwnProperty("kind")&&(n.kind=e.kind),null!=e.path&&e.hasOwnProperty("path")&&(n.path=e.path),n},_.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},_),r.FieldBehavior=(e={},(t=Object.create(e))[e[0]="FIELD_BEHAVIOR_UNSPECIFIED"]=0,t[e[1]="OPTIONAL"]=1,t[e[2]="REQUIRED"]=2,t[e[3]="OUTPUT_ONLY"]=3,t[e[4]="INPUT_ONLY"]=4,t[e[5]="IMMUTABLE"]=5,t),r.ResourceDescriptor=(b.prototype.type="",b.prototype.pattern=p.emptyArray,b.prototype.nameField="",b.prototype.history=0,b.prototype.plural="",b.prototype.singular="",b.create=function(e){return new b(e)},b.encode=function(e,t){if(t=t||i.create(),null!=e.type&&Object.hasOwnProperty.call(e,"type")&&t.uint32(10).string(e.type),null!=e.pattern&&e.pattern.length)for(var n=0;n>>3){case 1:o.type=e.string();break;case 2:o.pattern&&o.pattern.length||(o.pattern=[]),o.pattern.push(e.string());break;case 3:o.nameField=e.string();break;case 4:o.history=e.int32();break;case 5:o.plural=e.string();break;case 6:o.singular=e.string();break;default:e.skipType(7&r)}}return o},b.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},b.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.type&&e.hasOwnProperty("type")&&!p.isString(e.type))return"type: string expected";if(null!=e.pattern&&e.hasOwnProperty("pattern")){if(!Array.isArray(e.pattern))return"pattern: array expected";for(var t=0;t>>3){case 1:o.type=e.string();break;case 2:o.childType=e.string();break;default:e.skipType(7&r)}}return o},H.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},H.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.type&&e.hasOwnProperty("type")&&!p.isString(e.type)?"type: string expected":null!=e.childType&&e.hasOwnProperty("childType")&&!p.isString(e.childType)?"childType: string expected":null},H.fromObject=function(e){var t;return e instanceof l.google.api.ResourceReference?e:(t=new l.google.api.ResourceReference,null!=e.type&&(t.type=String(e.type)),null!=e.childType&&(t.childType=String(e.childType)),t)},H.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.type="",n.childType=""),null!=e.type&&e.hasOwnProperty("type")&&(n.type=e.type),null!=e.childType&&e.hasOwnProperty("childType")&&(n.childType=e.childType),n},H.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},H),r),F.protobuf=((n={}).FileDescriptorSet=(q.prototype.file=p.emptyArray,q.create=function(e){return new q(e)},q.encode=function(e,t){if(t=t||i.create(),null!=e.file&&e.file.length)for(var n=0;n>>3==1?(o.file&&o.file.length||(o.file=[]),o.file.push(l.google.protobuf.FileDescriptorProto.decode(e,e.uint32()))):e.skipType(7&r)}return o},q.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},q.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.file&&e.hasOwnProperty("file")){if(!Array.isArray(e.file))return"file: array expected";for(var t=0;t>>3){case 1:o.name=e.string();break;case 2:o.package=e.string();break;case 3:o.dependency&&o.dependency.length||(o.dependency=[]),o.dependency.push(e.string());break;case 10:if(o.publicDependency&&o.publicDependency.length||(o.publicDependency=[]),2==(7&r))for(var i=e.uint32()+e.pos;e.pos>>3){case 1:o.name=e.string();break;case 2:o.field&&o.field.length||(o.field=[]),o.field.push(l.google.protobuf.FieldDescriptorProto.decode(e,e.uint32()));break;case 6:o.extension&&o.extension.length||(o.extension=[]),o.extension.push(l.google.protobuf.FieldDescriptorProto.decode(e,e.uint32()));break;case 3:o.nestedType&&o.nestedType.length||(o.nestedType=[]),o.nestedType.push(l.google.protobuf.DescriptorProto.decode(e,e.uint32()));break;case 4:o.enumType&&o.enumType.length||(o.enumType=[]),o.enumType.push(l.google.protobuf.EnumDescriptorProto.decode(e,e.uint32()));break;case 5:o.extensionRange&&o.extensionRange.length||(o.extensionRange=[]),o.extensionRange.push(l.google.protobuf.DescriptorProto.ExtensionRange.decode(e,e.uint32()));break;case 8:o.oneofDecl&&o.oneofDecl.length||(o.oneofDecl=[]),o.oneofDecl.push(l.google.protobuf.OneofDescriptorProto.decode(e,e.uint32()));break;case 7:o.options=l.google.protobuf.MessageOptions.decode(e,e.uint32());break;case 9:o.reservedRange&&o.reservedRange.length||(o.reservedRange=[]),o.reservedRange.push(l.google.protobuf.DescriptorProto.ReservedRange.decode(e,e.uint32()));break;case 10:o.reservedName&&o.reservedName.length||(o.reservedName=[]),o.reservedName.push(e.string());break;default:e.skipType(7&r)}}return o},O.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},O.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.name&&e.hasOwnProperty("name")&&!p.isString(e.name))return"name: string expected";if(null!=e.field&&e.hasOwnProperty("field")){if(!Array.isArray(e.field))return"field: array expected";for(var t=0;t>>3){case 1:o.start=e.int32();break;case 2:o.end=e.int32();break;case 3:o.options=l.google.protobuf.ExtensionRangeOptions.decode(e,e.uint32());break;default:e.skipType(7&r)}}return o},v.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},v.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.start&&e.hasOwnProperty("start")&&!p.isInteger(e.start))return"start: integer expected";if(null!=e.end&&e.hasOwnProperty("end")&&!p.isInteger(e.end))return"end: integer expected";if(null!=e.options&&e.hasOwnProperty("options")){e=l.google.protobuf.ExtensionRangeOptions.verify(e.options);if(e)return"options."+e}return null},v.fromObject=function(e){if(e instanceof l.google.protobuf.DescriptorProto.ExtensionRange)return e;var t=new l.google.protobuf.DescriptorProto.ExtensionRange;if(null!=e.start&&(t.start=0|e.start),null!=e.end&&(t.end=0|e.end),null!=e.options){if("object"!=typeof e.options)throw TypeError(".google.protobuf.DescriptorProto.ExtensionRange.options: object expected");t.options=l.google.protobuf.ExtensionRangeOptions.fromObject(e.options)}return t},v.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.start=0,n.end=0,n.options=null),null!=e.start&&e.hasOwnProperty("start")&&(n.start=e.start),null!=e.end&&e.hasOwnProperty("end")&&(n.end=e.end),null!=e.options&&e.hasOwnProperty("options")&&(n.options=l.google.protobuf.ExtensionRangeOptions.toObject(e.options,t)),n},v.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},v),O.ReservedRange=(Y.prototype.start=0,Y.prototype.end=0,Y.create=function(e){return new Y(e)},Y.encode=function(e,t){return t=t||i.create(),null!=e.start&&Object.hasOwnProperty.call(e,"start")&&t.uint32(8).int32(e.start),null!=e.end&&Object.hasOwnProperty.call(e,"end")&&t.uint32(16).int32(e.end),t},Y.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},Y.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new l.google.protobuf.DescriptorProto.ReservedRange;e.pos>>3){case 1:o.start=e.int32();break;case 2:o.end=e.int32();break;default:e.skipType(7&r)}}return o},Y.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},Y.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.start&&e.hasOwnProperty("start")&&!p.isInteger(e.start)?"start: integer expected":null!=e.end&&e.hasOwnProperty("end")&&!p.isInteger(e.end)?"end: integer expected":null},Y.fromObject=function(e){var t;return e instanceof l.google.protobuf.DescriptorProto.ReservedRange?e:(t=new l.google.protobuf.DescriptorProto.ReservedRange,null!=e.start&&(t.start=0|e.start),null!=e.end&&(t.end=0|e.end),t)},Y.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.start=0,n.end=0),null!=e.start&&e.hasOwnProperty("start")&&(n.start=e.start),null!=e.end&&e.hasOwnProperty("end")&&(n.end=e.end),n},Y.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},Y),O),n.ExtensionRangeOptions=(z.prototype.uninterpretedOption=p.emptyArray,z.create=function(e){return new z(e)},z.encode=function(e,t){if(t=t||i.create(),null!=e.uninterpretedOption&&e.uninterpretedOption.length)for(var n=0;n>>3==999?(o.uninterpretedOption&&o.uninterpretedOption.length||(o.uninterpretedOption=[]),o.uninterpretedOption.push(l.google.protobuf.UninterpretedOption.decode(e,e.uint32()))):e.skipType(7&r)}return o},z.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},z.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.uninterpretedOption&&e.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e.uninterpretedOption))return"uninterpretedOption: array expected";for(var t=0;t>>3){case 1:o.name=e.string();break;case 3:o.number=e.int32();break;case 4:o.label=e.int32();break;case 5:o.type=e.int32();break;case 6:o.typeName=e.string();break;case 2:o.extendee=e.string();break;case 7:o.defaultValue=e.string();break;case 9:o.oneofIndex=e.int32();break;case 10:o.jsonName=e.string();break;case 8:o.options=l.google.protobuf.FieldOptions.decode(e,e.uint32());break;case 17:o.proto3Optional=e.bool();break;default:e.skipType(7&r)}}return o},P.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},P.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.name&&e.hasOwnProperty("name")&&!p.isString(e.name))return"name: string expected";if(null!=e.number&&e.hasOwnProperty("number")&&!p.isInteger(e.number))return"number: integer expected";if(null!=e.label&&e.hasOwnProperty("label"))switch(e.label){default:return"label: enum value expected";case 1:case 2:case 3:}if(null!=e.type&&e.hasOwnProperty("type"))switch(e.type){default:return"type: enum value expected";case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:}if(null!=e.typeName&&e.hasOwnProperty("typeName")&&!p.isString(e.typeName))return"typeName: string expected";if(null!=e.extendee&&e.hasOwnProperty("extendee")&&!p.isString(e.extendee))return"extendee: string expected";if(null!=e.defaultValue&&e.hasOwnProperty("defaultValue")&&!p.isString(e.defaultValue))return"defaultValue: string expected";if(null!=e.oneofIndex&&e.hasOwnProperty("oneofIndex")&&!p.isInteger(e.oneofIndex))return"oneofIndex: integer expected";if(null!=e.jsonName&&e.hasOwnProperty("jsonName")&&!p.isString(e.jsonName))return"jsonName: string expected";if(null!=e.options&&e.hasOwnProperty("options")){var t=l.google.protobuf.FieldOptions.verify(e.options);if(t)return"options."+t}return null!=e.proto3Optional&&e.hasOwnProperty("proto3Optional")&&"boolean"!=typeof e.proto3Optional?"proto3Optional: boolean expected":null},P.fromObject=function(e){if(e instanceof l.google.protobuf.FieldDescriptorProto)return e;var t=new l.google.protobuf.FieldDescriptorProto;switch(null!=e.name&&(t.name=String(e.name)),null!=e.number&&(t.number=0|e.number),e.label){case"LABEL_OPTIONAL":case 1:t.label=1;break;case"LABEL_REQUIRED":case 2:t.label=2;break;case"LABEL_REPEATED":case 3:t.label=3}switch(e.type){case"TYPE_DOUBLE":case 1:t.type=1;break;case"TYPE_FLOAT":case 2:t.type=2;break;case"TYPE_INT64":case 3:t.type=3;break;case"TYPE_UINT64":case 4:t.type=4;break;case"TYPE_INT32":case 5:t.type=5;break;case"TYPE_FIXED64":case 6:t.type=6;break;case"TYPE_FIXED32":case 7:t.type=7;break;case"TYPE_BOOL":case 8:t.type=8;break;case"TYPE_STRING":case 9:t.type=9;break;case"TYPE_GROUP":case 10:t.type=10;break;case"TYPE_MESSAGE":case 11:t.type=11;break;case"TYPE_BYTES":case 12:t.type=12;break;case"TYPE_UINT32":case 13:t.type=13;break;case"TYPE_ENUM":case 14:t.type=14;break;case"TYPE_SFIXED32":case 15:t.type=15;break;case"TYPE_SFIXED64":case 16:t.type=16;break;case"TYPE_SINT32":case 17:t.type=17;break;case"TYPE_SINT64":case 18:t.type=18}if(null!=e.typeName&&(t.typeName=String(e.typeName)),null!=e.extendee&&(t.extendee=String(e.extendee)),null!=e.defaultValue&&(t.defaultValue=String(e.defaultValue)),null!=e.oneofIndex&&(t.oneofIndex=0|e.oneofIndex),null!=e.jsonName&&(t.jsonName=String(e.jsonName)),null!=e.options){if("object"!=typeof e.options)throw TypeError(".google.protobuf.FieldDescriptorProto.options: object expected");t.options=l.google.protobuf.FieldOptions.fromObject(e.options)}return null!=e.proto3Optional&&(t.proto3Optional=Boolean(e.proto3Optional)),t},P.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.name="",n.extendee="",n.number=0,n.label=t.enums===String?"LABEL_OPTIONAL":1,n.type=t.enums===String?"TYPE_DOUBLE":1,n.typeName="",n.defaultValue="",n.options=null,n.oneofIndex=0,n.jsonName="",n.proto3Optional=!1),null!=e.name&&e.hasOwnProperty("name")&&(n.name=e.name),null!=e.extendee&&e.hasOwnProperty("extendee")&&(n.extendee=e.extendee),null!=e.number&&e.hasOwnProperty("number")&&(n.number=e.number),null!=e.label&&e.hasOwnProperty("label")&&(n.label=t.enums===String?l.google.protobuf.FieldDescriptorProto.Label[e.label]:e.label),null!=e.type&&e.hasOwnProperty("type")&&(n.type=t.enums===String?l.google.protobuf.FieldDescriptorProto.Type[e.type]:e.type),null!=e.typeName&&e.hasOwnProperty("typeName")&&(n.typeName=e.typeName),null!=e.defaultValue&&e.hasOwnProperty("defaultValue")&&(n.defaultValue=e.defaultValue),null!=e.options&&e.hasOwnProperty("options")&&(n.options=l.google.protobuf.FieldOptions.toObject(e.options,t)),null!=e.oneofIndex&&e.hasOwnProperty("oneofIndex")&&(n.oneofIndex=e.oneofIndex),null!=e.jsonName&&e.hasOwnProperty("jsonName")&&(n.jsonName=e.jsonName),null!=e.proto3Optional&&e.hasOwnProperty("proto3Optional")&&(n.proto3Optional=e.proto3Optional),n},P.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},P.Type=(e={},(t=Object.create(e))[e[1]="TYPE_DOUBLE"]=1,t[e[2]="TYPE_FLOAT"]=2,t[e[3]="TYPE_INT64"]=3,t[e[4]="TYPE_UINT64"]=4,t[e[5]="TYPE_INT32"]=5,t[e[6]="TYPE_FIXED64"]=6,t[e[7]="TYPE_FIXED32"]=7,t[e[8]="TYPE_BOOL"]=8,t[e[9]="TYPE_STRING"]=9,t[e[10]="TYPE_GROUP"]=10,t[e[11]="TYPE_MESSAGE"]=11,t[e[12]="TYPE_BYTES"]=12,t[e[13]="TYPE_UINT32"]=13,t[e[14]="TYPE_ENUM"]=14,t[e[15]="TYPE_SFIXED32"]=15,t[e[16]="TYPE_SFIXED64"]=16,t[e[17]="TYPE_SINT32"]=17,t[e[18]="TYPE_SINT64"]=18,t),P.Label=(e={},(t=Object.create(e))[e[1]="LABEL_OPTIONAL"]=1,t[e[2]="LABEL_REQUIRED"]=2,t[e[3]="LABEL_REPEATED"]=3,t),P),n.OneofDescriptorProto=(W.prototype.name="",W.prototype.options=null,W.create=function(e){return new W(e)},W.encode=function(e,t){return t=t||i.create(),null!=e.name&&Object.hasOwnProperty.call(e,"name")&&t.uint32(10).string(e.name),null!=e.options&&Object.hasOwnProperty.call(e,"options")&&l.google.protobuf.OneofOptions.encode(e.options,t.uint32(18).fork()).ldelim(),t},W.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},W.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new l.google.protobuf.OneofDescriptorProto;e.pos>>3){case 1:o.name=e.string();break;case 2:o.options=l.google.protobuf.OneofOptions.decode(e,e.uint32());break;default:e.skipType(7&r)}}return o},W.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},W.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.name&&e.hasOwnProperty("name")&&!p.isString(e.name))return"name: string expected";if(null!=e.options&&e.hasOwnProperty("options")){e=l.google.protobuf.OneofOptions.verify(e.options);if(e)return"options."+e}return null},W.fromObject=function(e){if(e instanceof l.google.protobuf.OneofDescriptorProto)return e;var t=new l.google.protobuf.OneofDescriptorProto;if(null!=e.name&&(t.name=String(e.name)),null!=e.options){if("object"!=typeof e.options)throw TypeError(".google.protobuf.OneofDescriptorProto.options: object expected");t.options=l.google.protobuf.OneofOptions.fromObject(e.options)}return t},W.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.name="",n.options=null),null!=e.name&&e.hasOwnProperty("name")&&(n.name=e.name),null!=e.options&&e.hasOwnProperty("options")&&(n.options=l.google.protobuf.OneofOptions.toObject(e.options,t)),n},W.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},W),n.EnumDescriptorProto=(w.prototype.name="",w.prototype.value=p.emptyArray,w.prototype.options=null,w.prototype.reservedRange=p.emptyArray,w.prototype.reservedName=p.emptyArray,w.create=function(e){return new w(e)},w.encode=function(e,t){if(t=t||i.create(),null!=e.name&&Object.hasOwnProperty.call(e,"name")&&t.uint32(10).string(e.name),null!=e.value&&e.value.length)for(var n=0;n>>3){case 1:o.name=e.string();break;case 2:o.value&&o.value.length||(o.value=[]),o.value.push(l.google.protobuf.EnumValueDescriptorProto.decode(e,e.uint32()));break;case 3:o.options=l.google.protobuf.EnumOptions.decode(e,e.uint32());break;case 4:o.reservedRange&&o.reservedRange.length||(o.reservedRange=[]),o.reservedRange.push(l.google.protobuf.EnumDescriptorProto.EnumReservedRange.decode(e,e.uint32()));break;case 5:o.reservedName&&o.reservedName.length||(o.reservedName=[]),o.reservedName.push(e.string());break;default:e.skipType(7&r)}}return o},w.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},w.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.name&&e.hasOwnProperty("name")&&!p.isString(e.name))return"name: string expected";if(null!=e.value&&e.hasOwnProperty("value")){if(!Array.isArray(e.value))return"value: array expected";for(var t=0;t>>3){case 1:o.start=e.int32();break;case 2:o.end=e.int32();break;default:e.skipType(7&r)}}return o},X.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},X.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.start&&e.hasOwnProperty("start")&&!p.isInteger(e.start)?"start: integer expected":null!=e.end&&e.hasOwnProperty("end")&&!p.isInteger(e.end)?"end: integer expected":null},X.fromObject=function(e){var t;return e instanceof l.google.protobuf.EnumDescriptorProto.EnumReservedRange?e:(t=new l.google.protobuf.EnumDescriptorProto.EnumReservedRange,null!=e.start&&(t.start=0|e.start),null!=e.end&&(t.end=0|e.end),t)},X.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.start=0,n.end=0),null!=e.start&&e.hasOwnProperty("start")&&(n.start=e.start),null!=e.end&&e.hasOwnProperty("end")&&(n.end=e.end),n},X.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},X),w),n.EnumValueDescriptorProto=(j.prototype.name="",j.prototype.number=0,j.prototype.options=null,j.create=function(e){return new j(e)},j.encode=function(e,t){return t=t||i.create(),null!=e.name&&Object.hasOwnProperty.call(e,"name")&&t.uint32(10).string(e.name),null!=e.number&&Object.hasOwnProperty.call(e,"number")&&t.uint32(16).int32(e.number),null!=e.options&&Object.hasOwnProperty.call(e,"options")&&l.google.protobuf.EnumValueOptions.encode(e.options,t.uint32(26).fork()).ldelim(),t},j.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},j.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new l.google.protobuf.EnumValueDescriptorProto;e.pos>>3){case 1:o.name=e.string();break;case 2:o.number=e.int32();break;case 3:o.options=l.google.protobuf.EnumValueOptions.decode(e,e.uint32());break;default:e.skipType(7&r)}}return o},j.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},j.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.name&&e.hasOwnProperty("name")&&!p.isString(e.name))return"name: string expected";if(null!=e.number&&e.hasOwnProperty("number")&&!p.isInteger(e.number))return"number: integer expected";if(null!=e.options&&e.hasOwnProperty("options")){e=l.google.protobuf.EnumValueOptions.verify(e.options);if(e)return"options."+e}return null},j.fromObject=function(e){if(e instanceof l.google.protobuf.EnumValueDescriptorProto)return e;var t=new l.google.protobuf.EnumValueDescriptorProto;if(null!=e.name&&(t.name=String(e.name)),null!=e.number&&(t.number=0|e.number),null!=e.options){if("object"!=typeof e.options)throw TypeError(".google.protobuf.EnumValueDescriptorProto.options: object expected");t.options=l.google.protobuf.EnumValueOptions.fromObject(e.options)}return t},j.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.name="",n.number=0,n.options=null),null!=e.name&&e.hasOwnProperty("name")&&(n.name=e.name),null!=e.number&&e.hasOwnProperty("number")&&(n.number=e.number),null!=e.options&&e.hasOwnProperty("options")&&(n.options=l.google.protobuf.EnumValueOptions.toObject(e.options,t)),n},j.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},j),n.ServiceDescriptorProto=(D.prototype.name="",D.prototype.method=p.emptyArray,D.prototype.options=null,D.create=function(e){return new D(e)},D.encode=function(e,t){if(t=t||i.create(),null!=e.name&&Object.hasOwnProperty.call(e,"name")&&t.uint32(10).string(e.name),null!=e.method&&e.method.length)for(var n=0;n>>3){case 1:o.name=e.string();break;case 2:o.method&&o.method.length||(o.method=[]),o.method.push(l.google.protobuf.MethodDescriptorProto.decode(e,e.uint32()));break;case 3:o.options=l.google.protobuf.ServiceOptions.decode(e,e.uint32());break;default:e.skipType(7&r)}}return o},D.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},D.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.name&&e.hasOwnProperty("name")&&!p.isString(e.name))return"name: string expected";if(null!=e.method&&e.hasOwnProperty("method")){if(!Array.isArray(e.method))return"method: array expected";for(var t=0;t>>3){case 1:o.name=e.string();break;case 2:o.inputType=e.string();break;case 3:o.outputType=e.string();break;case 4:o.options=l.google.protobuf.MethodOptions.decode(e,e.uint32());break;case 5:o.clientStreaming=e.bool();break;case 6:o.serverStreaming=e.bool();break;default:e.skipType(7&r)}}return o},x.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},x.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.name&&e.hasOwnProperty("name")&&!p.isString(e.name))return"name: string expected";if(null!=e.inputType&&e.hasOwnProperty("inputType")&&!p.isString(e.inputType))return"inputType: string expected";if(null!=e.outputType&&e.hasOwnProperty("outputType")&&!p.isString(e.outputType))return"outputType: string expected";if(null!=e.options&&e.hasOwnProperty("options")){var t=l.google.protobuf.MethodOptions.verify(e.options);if(t)return"options."+t}return null!=e.clientStreaming&&e.hasOwnProperty("clientStreaming")&&"boolean"!=typeof e.clientStreaming?"clientStreaming: boolean expected":null!=e.serverStreaming&&e.hasOwnProperty("serverStreaming")&&"boolean"!=typeof e.serverStreaming?"serverStreaming: boolean expected":null},x.fromObject=function(e){if(e instanceof l.google.protobuf.MethodDescriptorProto)return e;var t=new l.google.protobuf.MethodDescriptorProto;if(null!=e.name&&(t.name=String(e.name)),null!=e.inputType&&(t.inputType=String(e.inputType)),null!=e.outputType&&(t.outputType=String(e.outputType)),null!=e.options){if("object"!=typeof e.options)throw TypeError(".google.protobuf.MethodDescriptorProto.options: object expected");t.options=l.google.protobuf.MethodOptions.fromObject(e.options)}return null!=e.clientStreaming&&(t.clientStreaming=Boolean(e.clientStreaming)),null!=e.serverStreaming&&(t.serverStreaming=Boolean(e.serverStreaming)),t},x.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.name="",n.inputType="",n.outputType="",n.options=null,n.clientStreaming=!1,n.serverStreaming=!1),null!=e.name&&e.hasOwnProperty("name")&&(n.name=e.name),null!=e.inputType&&e.hasOwnProperty("inputType")&&(n.inputType=e.inputType),null!=e.outputType&&e.hasOwnProperty("outputType")&&(n.outputType=e.outputType),null!=e.options&&e.hasOwnProperty("options")&&(n.options=l.google.protobuf.MethodOptions.toObject(e.options,t)),null!=e.clientStreaming&&e.hasOwnProperty("clientStreaming")&&(n.clientStreaming=e.clientStreaming),null!=e.serverStreaming&&e.hasOwnProperty("serverStreaming")&&(n.serverStreaming=e.serverStreaming),n},x.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},x),n.FileOptions=(S.prototype.javaPackage="",S.prototype.javaOuterClassname="",S.prototype.javaMultipleFiles=!1,S.prototype.javaGenerateEqualsAndHash=!1,S.prototype.javaStringCheckUtf8=!1,S.prototype.optimizeFor=1,S.prototype.goPackage="",S.prototype.ccGenericServices=!1,S.prototype.javaGenericServices=!1,S.prototype.pyGenericServices=!1,S.prototype.phpGenericServices=!1,S.prototype.deprecated=!1,S.prototype.ccEnableArenas=!0,S.prototype.objcClassPrefix="",S.prototype.csharpNamespace="",S.prototype.swiftPrefix="",S.prototype.phpClassPrefix="",S.prototype.phpNamespace="",S.prototype.phpMetadataNamespace="",S.prototype.rubyPackage="",S.prototype.uninterpretedOption=p.emptyArray,S.prototype[".google.api.resourceDefinition"]=p.emptyArray,S.create=function(e){return new S(e)},S.encode=function(e,t){if(t=t||i.create(),null!=e.javaPackage&&Object.hasOwnProperty.call(e,"javaPackage")&&t.uint32(10).string(e.javaPackage),null!=e.javaOuterClassname&&Object.hasOwnProperty.call(e,"javaOuterClassname")&&t.uint32(66).string(e.javaOuterClassname),null!=e.optimizeFor&&Object.hasOwnProperty.call(e,"optimizeFor")&&t.uint32(72).int32(e.optimizeFor),null!=e.javaMultipleFiles&&Object.hasOwnProperty.call(e,"javaMultipleFiles")&&t.uint32(80).bool(e.javaMultipleFiles),null!=e.goPackage&&Object.hasOwnProperty.call(e,"goPackage")&&t.uint32(90).string(e.goPackage),null!=e.ccGenericServices&&Object.hasOwnProperty.call(e,"ccGenericServices")&&t.uint32(128).bool(e.ccGenericServices),null!=e.javaGenericServices&&Object.hasOwnProperty.call(e,"javaGenericServices")&&t.uint32(136).bool(e.javaGenericServices),null!=e.pyGenericServices&&Object.hasOwnProperty.call(e,"pyGenericServices")&&t.uint32(144).bool(e.pyGenericServices),null!=e.javaGenerateEqualsAndHash&&Object.hasOwnProperty.call(e,"javaGenerateEqualsAndHash")&&t.uint32(160).bool(e.javaGenerateEqualsAndHash),null!=e.deprecated&&Object.hasOwnProperty.call(e,"deprecated")&&t.uint32(184).bool(e.deprecated),null!=e.javaStringCheckUtf8&&Object.hasOwnProperty.call(e,"javaStringCheckUtf8")&&t.uint32(216).bool(e.javaStringCheckUtf8),null!=e.ccEnableArenas&&Object.hasOwnProperty.call(e,"ccEnableArenas")&&t.uint32(248).bool(e.ccEnableArenas),null!=e.objcClassPrefix&&Object.hasOwnProperty.call(e,"objcClassPrefix")&&t.uint32(290).string(e.objcClassPrefix),null!=e.csharpNamespace&&Object.hasOwnProperty.call(e,"csharpNamespace")&&t.uint32(298).string(e.csharpNamespace),null!=e.swiftPrefix&&Object.hasOwnProperty.call(e,"swiftPrefix")&&t.uint32(314).string(e.swiftPrefix),null!=e.phpClassPrefix&&Object.hasOwnProperty.call(e,"phpClassPrefix")&&t.uint32(322).string(e.phpClassPrefix),null!=e.phpNamespace&&Object.hasOwnProperty.call(e,"phpNamespace")&&t.uint32(330).string(e.phpNamespace),null!=e.phpGenericServices&&Object.hasOwnProperty.call(e,"phpGenericServices")&&t.uint32(336).bool(e.phpGenericServices),null!=e.phpMetadataNamespace&&Object.hasOwnProperty.call(e,"phpMetadataNamespace")&&t.uint32(354).string(e.phpMetadataNamespace),null!=e.rubyPackage&&Object.hasOwnProperty.call(e,"rubyPackage")&&t.uint32(362).string(e.rubyPackage),null!=e.uninterpretedOption&&e.uninterpretedOption.length)for(var n=0;n>>3){case 1:o.javaPackage=e.string();break;case 8:o.javaOuterClassname=e.string();break;case 10:o.javaMultipleFiles=e.bool();break;case 20:o.javaGenerateEqualsAndHash=e.bool();break;case 27:o.javaStringCheckUtf8=e.bool();break;case 9:o.optimizeFor=e.int32();break;case 11:o.goPackage=e.string();break;case 16:o.ccGenericServices=e.bool();break;case 17:o.javaGenericServices=e.bool();break;case 18:o.pyGenericServices=e.bool();break;case 42:o.phpGenericServices=e.bool();break;case 23:o.deprecated=e.bool();break;case 31:o.ccEnableArenas=e.bool();break;case 36:o.objcClassPrefix=e.string();break;case 37:o.csharpNamespace=e.string();break;case 39:o.swiftPrefix=e.string();break;case 40:o.phpClassPrefix=e.string();break;case 41:o.phpNamespace=e.string();break;case 44:o.phpMetadataNamespace=e.string();break;case 45:o.rubyPackage=e.string();break;case 999:o.uninterpretedOption&&o.uninterpretedOption.length||(o.uninterpretedOption=[]),o.uninterpretedOption.push(l.google.protobuf.UninterpretedOption.decode(e,e.uint32()));break;case 1053:o[".google.api.resourceDefinition"]&&o[".google.api.resourceDefinition"].length||(o[".google.api.resourceDefinition"]=[]),o[".google.api.resourceDefinition"].push(l.google.api.ResourceDescriptor.decode(e,e.uint32()));break;default:e.skipType(7&r)}}return o},S.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},S.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.javaPackage&&e.hasOwnProperty("javaPackage")&&!p.isString(e.javaPackage))return"javaPackage: string expected";if(null!=e.javaOuterClassname&&e.hasOwnProperty("javaOuterClassname")&&!p.isString(e.javaOuterClassname))return"javaOuterClassname: string expected";if(null!=e.javaMultipleFiles&&e.hasOwnProperty("javaMultipleFiles")&&"boolean"!=typeof e.javaMultipleFiles)return"javaMultipleFiles: boolean expected";if(null!=e.javaGenerateEqualsAndHash&&e.hasOwnProperty("javaGenerateEqualsAndHash")&&"boolean"!=typeof e.javaGenerateEqualsAndHash)return"javaGenerateEqualsAndHash: boolean expected";if(null!=e.javaStringCheckUtf8&&e.hasOwnProperty("javaStringCheckUtf8")&&"boolean"!=typeof e.javaStringCheckUtf8)return"javaStringCheckUtf8: boolean expected";if(null!=e.optimizeFor&&e.hasOwnProperty("optimizeFor"))switch(e.optimizeFor){default:return"optimizeFor: enum value expected";case 1:case 2:case 3:}if(null!=e.goPackage&&e.hasOwnProperty("goPackage")&&!p.isString(e.goPackage))return"goPackage: string expected";if(null!=e.ccGenericServices&&e.hasOwnProperty("ccGenericServices")&&"boolean"!=typeof e.ccGenericServices)return"ccGenericServices: boolean expected";if(null!=e.javaGenericServices&&e.hasOwnProperty("javaGenericServices")&&"boolean"!=typeof e.javaGenericServices)return"javaGenericServices: boolean expected";if(null!=e.pyGenericServices&&e.hasOwnProperty("pyGenericServices")&&"boolean"!=typeof e.pyGenericServices)return"pyGenericServices: boolean expected";if(null!=e.phpGenericServices&&e.hasOwnProperty("phpGenericServices")&&"boolean"!=typeof e.phpGenericServices)return"phpGenericServices: boolean expected";if(null!=e.deprecated&&e.hasOwnProperty("deprecated")&&"boolean"!=typeof e.deprecated)return"deprecated: boolean expected";if(null!=e.ccEnableArenas&&e.hasOwnProperty("ccEnableArenas")&&"boolean"!=typeof e.ccEnableArenas)return"ccEnableArenas: boolean expected";if(null!=e.objcClassPrefix&&e.hasOwnProperty("objcClassPrefix")&&!p.isString(e.objcClassPrefix))return"objcClassPrefix: string expected";if(null!=e.csharpNamespace&&e.hasOwnProperty("csharpNamespace")&&!p.isString(e.csharpNamespace))return"csharpNamespace: string expected";if(null!=e.swiftPrefix&&e.hasOwnProperty("swiftPrefix")&&!p.isString(e.swiftPrefix))return"swiftPrefix: string expected";if(null!=e.phpClassPrefix&&e.hasOwnProperty("phpClassPrefix")&&!p.isString(e.phpClassPrefix))return"phpClassPrefix: string expected";if(null!=e.phpNamespace&&e.hasOwnProperty("phpNamespace")&&!p.isString(e.phpNamespace))return"phpNamespace: string expected";if(null!=e.phpMetadataNamespace&&e.hasOwnProperty("phpMetadataNamespace")&&!p.isString(e.phpMetadataNamespace))return"phpMetadataNamespace: string expected";if(null!=e.rubyPackage&&e.hasOwnProperty("rubyPackage")&&!p.isString(e.rubyPackage))return"rubyPackage: string expected";if(null!=e.uninterpretedOption&&e.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e.uninterpretedOption))return"uninterpretedOption: array expected";for(var t=0;t>>3){case 1:o.messageSetWireFormat=e.bool();break;case 2:o.noStandardDescriptorAccessor=e.bool();break;case 3:o.deprecated=e.bool();break;case 7:o.mapEntry=e.bool();break;case 999:o.uninterpretedOption&&o.uninterpretedOption.length||(o.uninterpretedOption=[]),o.uninterpretedOption.push(l.google.protobuf.UninterpretedOption.decode(e,e.uint32()));break;case 1053:o[".google.api.resource"]=l.google.api.ResourceDescriptor.decode(e,e.uint32());break;default:e.skipType(7&r)}}return o},k.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},k.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.messageSetWireFormat&&e.hasOwnProperty("messageSetWireFormat")&&"boolean"!=typeof e.messageSetWireFormat)return"messageSetWireFormat: boolean expected";if(null!=e.noStandardDescriptorAccessor&&e.hasOwnProperty("noStandardDescriptorAccessor")&&"boolean"!=typeof e.noStandardDescriptorAccessor)return"noStandardDescriptorAccessor: boolean expected";if(null!=e.deprecated&&e.hasOwnProperty("deprecated")&&"boolean"!=typeof e.deprecated)return"deprecated: boolean expected";if(null!=e.mapEntry&&e.hasOwnProperty("mapEntry")&&"boolean"!=typeof e.mapEntry)return"mapEntry: boolean expected";if(null!=e.uninterpretedOption&&e.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e.uninterpretedOption))return"uninterpretedOption: array expected";for(var t=0;t>>3){case 1:o.ctype=e.int32();break;case 2:o.packed=e.bool();break;case 6:o.jstype=e.int32();break;case 5:o.lazy=e.bool();break;case 3:o.deprecated=e.bool();break;case 10:o.weak=e.bool();break;case 999:o.uninterpretedOption&&o.uninterpretedOption.length||(o.uninterpretedOption=[]),o.uninterpretedOption.push(l.google.protobuf.UninterpretedOption.decode(e,e.uint32()));break;case 1052:if(o[".google.api.fieldBehavior"]&&o[".google.api.fieldBehavior"].length||(o[".google.api.fieldBehavior"]=[]),2==(7&r))for(var i=e.uint32()+e.pos;e.pos>>3==999?(o.uninterpretedOption&&o.uninterpretedOption.length||(o.uninterpretedOption=[]),o.uninterpretedOption.push(l.google.protobuf.UninterpretedOption.decode(e,e.uint32()))):e.skipType(7&r)}return o},Q.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},Q.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.uninterpretedOption&&e.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e.uninterpretedOption))return"uninterpretedOption: array expected";for(var t=0;t>>3){case 2:o.allowAlias=e.bool();break;case 3:o.deprecated=e.bool();break;case 999:o.uninterpretedOption&&o.uninterpretedOption.length||(o.uninterpretedOption=[]),o.uninterpretedOption.push(l.google.protobuf.UninterpretedOption.decode(e,e.uint32()));break;default:e.skipType(7&r)}}return o},E.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},E.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.allowAlias&&e.hasOwnProperty("allowAlias")&&"boolean"!=typeof e.allowAlias)return"allowAlias: boolean expected";if(null!=e.deprecated&&e.hasOwnProperty("deprecated")&&"boolean"!=typeof e.deprecated)return"deprecated: boolean expected";if(null!=e.uninterpretedOption&&e.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e.uninterpretedOption))return"uninterpretedOption: array expected";for(var t=0;t>>3){case 1:o.deprecated=e.bool();break;case 999:o.uninterpretedOption&&o.uninterpretedOption.length||(o.uninterpretedOption=[]),o.uninterpretedOption.push(l.google.protobuf.UninterpretedOption.decode(e,e.uint32()));break;default:e.skipType(7&r)}}return o},K.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},K.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.deprecated&&e.hasOwnProperty("deprecated")&&"boolean"!=typeof e.deprecated)return"deprecated: boolean expected";if(null!=e.uninterpretedOption&&e.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e.uninterpretedOption))return"uninterpretedOption: array expected";for(var t=0;t>>3){case 33:o.deprecated=e.bool();break;case 999:o.uninterpretedOption&&o.uninterpretedOption.length||(o.uninterpretedOption=[]),o.uninterpretedOption.push(l.google.protobuf.UninterpretedOption.decode(e,e.uint32()));break;case 1049:o[".google.api.defaultHost"]=e.string();break;case 1050:o[".google.api.oauthScopes"]=e.string();break;default:e.skipType(7&r)}}return o},A.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},A.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.deprecated&&e.hasOwnProperty("deprecated")&&"boolean"!=typeof e.deprecated)return"deprecated: boolean expected";if(null!=e.uninterpretedOption&&e.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e.uninterpretedOption))return"uninterpretedOption: array expected";for(var t=0;t>>3){case 33:o.deprecated=e.bool();break;case 34:o.idempotencyLevel=e.int32();break;case 999:o.uninterpretedOption&&o.uninterpretedOption.length||(o.uninterpretedOption=[]),o.uninterpretedOption.push(l.google.protobuf.UninterpretedOption.decode(e,e.uint32()));break;case 72295728:o[".google.api.http"]=l.google.api.HttpRule.decode(e,e.uint32());break;case 1051:o[".google.api.methodSignature"]&&o[".google.api.methodSignature"].length||(o[".google.api.methodSignature"]=[]),o[".google.api.methodSignature"].push(e.string());break;default:e.skipType(7&r)}}return o},N.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},N.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.deprecated&&e.hasOwnProperty("deprecated")&&"boolean"!=typeof e.deprecated)return"deprecated: boolean expected";if(null!=e.idempotencyLevel&&e.hasOwnProperty("idempotencyLevel"))switch(e.idempotencyLevel){default:return"idempotencyLevel: enum value expected";case 0:case 1:case 2:}if(null!=e.uninterpretedOption&&e.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e.uninterpretedOption))return"uninterpretedOption: array expected";for(var t=0;t>>3){case 2:o.name&&o.name.length||(o.name=[]),o.name.push(l.google.protobuf.UninterpretedOption.NamePart.decode(e,e.uint32()));break;case 3:o.identifierValue=e.string();break;case 4:o.positiveIntValue=e.uint64();break;case 5:o.negativeIntValue=e.int64();break;case 6:o.doubleValue=e.double();break;case 7:o.stringValue=e.bytes();break;case 8:o.aggregateValue=e.string();break;default:e.skipType(7&r)}}return o},R.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},R.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.name&&e.hasOwnProperty("name")){if(!Array.isArray(e.name))return"name: array expected";for(var t=0;t>>0,e.positiveIntValue.high>>>0).toNumber(!0))),null!=e.negativeIntValue&&(p.Long?(t.negativeIntValue=p.Long.fromValue(e.negativeIntValue)).unsigned=!1:"string"==typeof e.negativeIntValue?t.negativeIntValue=parseInt(e.negativeIntValue,10):"number"==typeof e.negativeIntValue?t.negativeIntValue=e.negativeIntValue:"object"==typeof e.negativeIntValue&&(t.negativeIntValue=new p.LongBits(e.negativeIntValue.low>>>0,e.negativeIntValue.high>>>0).toNumber())),null!=e.doubleValue&&(t.doubleValue=Number(e.doubleValue)),null!=e.stringValue&&("string"==typeof e.stringValue?p.base64.decode(e.stringValue,t.stringValue=p.newBuffer(p.base64.length(e.stringValue)),0):e.stringValue.length&&(t.stringValue=e.stringValue)),null!=e.aggregateValue&&(t.aggregateValue=String(e.aggregateValue)),t},R.toObject=function(e,t){var n,o={};if(((t=t||{}).arrays||t.defaults)&&(o.name=[]),t.defaults&&(o.identifierValue="",p.Long?(n=new p.Long(0,0,!0),o.positiveIntValue=t.longs===String?n.toString():t.longs===Number?n.toNumber():n):o.positiveIntValue=t.longs===String?"0":0,p.Long?(n=new p.Long(0,0,!1),o.negativeIntValue=t.longs===String?n.toString():t.longs===Number?n.toNumber():n):o.negativeIntValue=t.longs===String?"0":0,o.doubleValue=0,t.bytes===String?o.stringValue="":(o.stringValue=[],t.bytes!==Array&&(o.stringValue=p.newBuffer(o.stringValue))),o.aggregateValue=""),e.name&&e.name.length){o.name=[];for(var r=0;r>>0,e.positiveIntValue.high>>>0).toNumber(!0):e.positiveIntValue),null!=e.negativeIntValue&&e.hasOwnProperty("negativeIntValue")&&("number"==typeof e.negativeIntValue?o.negativeIntValue=t.longs===String?String(e.negativeIntValue):e.negativeIntValue:o.negativeIntValue=t.longs===String?p.Long.prototype.toString.call(e.negativeIntValue):t.longs===Number?new p.LongBits(e.negativeIntValue.low>>>0,e.negativeIntValue.high>>>0).toNumber():e.negativeIntValue),null!=e.doubleValue&&e.hasOwnProperty("doubleValue")&&(o.doubleValue=t.json&&!isFinite(e.doubleValue)?String(e.doubleValue):e.doubleValue),null!=e.stringValue&&e.hasOwnProperty("stringValue")&&(o.stringValue=t.bytes===String?p.base64.encode(e.stringValue,0,e.stringValue.length):t.bytes===Array?Array.prototype.slice.call(e.stringValue):e.stringValue),null!=e.aggregateValue&&e.hasOwnProperty("aggregateValue")&&(o.aggregateValue=e.aggregateValue),o},R.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},R.NamePart=(Z.prototype.namePart="",Z.prototype.isExtension=!1,Z.create=function(e){return new Z(e)},Z.encode=function(e,t){return(t=t||i.create()).uint32(10).string(e.namePart),t.uint32(16).bool(e.isExtension),t},Z.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},Z.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new l.google.protobuf.UninterpretedOption.NamePart;e.pos>>3){case 1:o.namePart=e.string();break;case 2:o.isExtension=e.bool();break;default:e.skipType(7&r)}}if(!o.hasOwnProperty("namePart"))throw p.ProtocolError("missing required 'namePart'",{instance:o});if(o.hasOwnProperty("isExtension"))return o;throw p.ProtocolError("missing required 'isExtension'",{instance:o})},Z.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},Z.verify=function(e){return"object"!=typeof e||null===e?"object expected":p.isString(e.namePart)?"boolean"!=typeof e.isExtension?"isExtension: boolean expected":null:"namePart: string expected"},Z.fromObject=function(e){var t;return e instanceof l.google.protobuf.UninterpretedOption.NamePart?e:(t=new l.google.protobuf.UninterpretedOption.NamePart,null!=e.namePart&&(t.namePart=String(e.namePart)),null!=e.isExtension&&(t.isExtension=Boolean(e.isExtension)),t)},Z.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.namePart="",n.isExtension=!1),null!=e.namePart&&e.hasOwnProperty("namePart")&&(n.namePart=e.namePart),null!=e.isExtension&&e.hasOwnProperty("isExtension")&&(n.isExtension=e.isExtension),n},Z.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},Z),R),n.SourceCodeInfo=($.prototype.location=p.emptyArray,$.create=function(e){return new $(e)},$.encode=function(e,t){if(t=t||i.create(),null!=e.location&&e.location.length)for(var n=0;n>>3==1?(o.location&&o.location.length||(o.location=[]),o.location.push(l.google.protobuf.SourceCodeInfo.Location.decode(e,e.uint32()))):e.skipType(7&r)}return o},$.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},$.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.location&&e.hasOwnProperty("location")){if(!Array.isArray(e.location))return"location: array expected";for(var t=0;t>>3){case 1:if(o.path&&o.path.length||(o.path=[]),2==(7&r))for(var i=e.uint32()+e.pos;e.pos>>3==1?(o.annotation&&o.annotation.length||(o.annotation=[]),o.annotation.push(l.google.protobuf.GeneratedCodeInfo.Annotation.decode(e,e.uint32()))):e.skipType(7&r)}return o},ee.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},ee.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.annotation&&e.hasOwnProperty("annotation")){if(!Array.isArray(e.annotation))return"annotation: array expected";for(var t=0;t>>3){case 1:if(o.path&&o.path.length||(o.path=[]),2==(7&r))for(var i=e.uint32()+e.pos;e.pos>>3){case 1:o.expression=e.string();break;case 2:o.title=e.string();break;case 3:o.description=e.string();break;case 4:o.location=e.string();break;default:e.skipType(7&r)}}return o},V.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},V.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.expression&&e.hasOwnProperty("expression")&&!p.isString(e.expression)?"expression: string expected":null!=e.title&&e.hasOwnProperty("title")&&!p.isString(e.title)?"title: string expected":null!=e.description&&e.hasOwnProperty("description")&&!p.isString(e.description)?"description: string expected":null!=e.location&&e.hasOwnProperty("location")&&!p.isString(e.location)?"location: string expected":null},V.fromObject=function(e){var t;return e instanceof l.google.type.Expr?e:(t=new l.google.type.Expr,null!=e.expression&&(t.expression=String(e.expression)),null!=e.title&&(t.title=String(e.title)),null!=e.description&&(t.description=String(e.description)),null!=e.location&&(t.location=String(e.location)),t)},V.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.expression="",n.title="",n.description="",n.location=""),null!=e.expression&&e.hasOwnProperty("expression")&&(n.expression=e.expression),null!=e.title&&e.hasOwnProperty("title")&&(n.title=e.title),null!=e.description&&e.hasOwnProperty("description")&&(n.description=e.description),null!=e.location&&e.hasOwnProperty("location")&&(n.location=e.location),n},V.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},V),r),F),l}); + +/***/ }), + +/***/ 81937: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +/* module decorator */ module = __nccwpck_require__.nmd(module); +(e=>{"function"==typeof define&&define.amd?define(["protobufjs/minimal"],e): true&&module&&module.exports&&(module.exports=e(__nccwpck_require__(37823)))})(function(o){var e,t,n,F,s=o.Reader,r=o.Writer,u=o.util,c=o.roots.locations_protos||(o.roots.locations_protos={});function L(e,t,n){o.rpc.Service.call(this,e,t,n)}function i(e){if(e)for(var t=Object.keys(e),n=0;n>>3){case 1:o.name=e.string();break;case 2:o.filter=e.string();break;case 3:o.pageSize=e.int32();break;case 4:o.pageToken=e.string();break;default:e.skipType(7&r)}}return o},i.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},i.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.name&&e.hasOwnProperty("name")&&!u.isString(e.name)?"name: string expected":null!=e.filter&&e.hasOwnProperty("filter")&&!u.isString(e.filter)?"filter: string expected":null!=e.pageSize&&e.hasOwnProperty("pageSize")&&!u.isInteger(e.pageSize)?"pageSize: integer expected":null!=e.pageToken&&e.hasOwnProperty("pageToken")&&!u.isString(e.pageToken)?"pageToken: string expected":null},i.fromObject=function(e){var t;return e instanceof c.google.cloud.location.ListLocationsRequest?e:(t=new c.google.cloud.location.ListLocationsRequest,null!=e.name&&(t.name=String(e.name)),null!=e.filter&&(t.filter=String(e.filter)),null!=e.pageSize&&(t.pageSize=0|e.pageSize),null!=e.pageToken&&(t.pageToken=String(e.pageToken)),t)},i.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.name="",n.filter="",n.pageSize=0,n.pageToken=""),null!=e.name&&e.hasOwnProperty("name")&&(n.name=e.name),null!=e.filter&&e.hasOwnProperty("filter")&&(n.filter=e.filter),null!=e.pageSize&&e.hasOwnProperty("pageSize")&&(n.pageSize=e.pageSize),null!=e.pageToken&&e.hasOwnProperty("pageToken")&&(n.pageToken=e.pageToken),n},i.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},i),e.ListLocationsResponse=(a.prototype.locations=u.emptyArray,a.prototype.nextPageToken="",a.create=function(e){return new a(e)},a.encode=function(e,t){if(t=t||r.create(),null!=e.locations&&e.locations.length)for(var n=0;n>>3){case 1:o.locations&&o.locations.length||(o.locations=[]),o.locations.push(c.google.cloud.location.Location.decode(e,e.uint32()));break;case 2:o.nextPageToken=e.string();break;default:e.skipType(7&r)}}return o},a.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},a.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.locations&&e.hasOwnProperty("locations")){if(!Array.isArray(e.locations))return"locations: array expected";for(var t=0;t>>3==1?o.name=e.string():e.skipType(7&r)}return o},G.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},G.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.name&&e.hasOwnProperty("name")&&!u.isString(e.name)?"name: string expected":null},G.fromObject=function(e){var t;return e instanceof c.google.cloud.location.GetLocationRequest?e:(t=new c.google.cloud.location.GetLocationRequest,null!=e.name&&(t.name=String(e.name)),t)},G.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.name=""),null!=e.name&&e.hasOwnProperty("name")&&(n.name=e.name),n},G.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},G),e.Location=(p.prototype.name="",p.prototype.locationId="",p.prototype.displayName="",p.prototype.labels=u.emptyObject,p.prototype.metadata=null,p.create=function(e){return new p(e)},p.encode=function(e,t){if(t=t||r.create(),null!=e.name&&Object.hasOwnProperty.call(e,"name")&&t.uint32(10).string(e.name),null!=e.labels&&Object.hasOwnProperty.call(e,"labels"))for(var n=Object.keys(e.labels),o=0;o>>3){case 1:o.name=e.string();break;case 4:o.locationId=e.string();break;case 5:o.displayName=e.string();break;case 2:o.labels===u.emptyObject&&(o.labels={});for(var i=e.uint32()+e.pos,a="",p="";e.pos>>3){case 1:a=e.string();break;case 2:p=e.string();break;default:e.skipType(7&l)}}o.labels[a]=p;break;case 3:o.metadata=c.google.protobuf.Any.decode(e,e.uint32());break;default:e.skipType(7&r)}}return o},p.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},p.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.name&&e.hasOwnProperty("name")&&!u.isString(e.name))return"name: string expected";if(null!=e.locationId&&e.hasOwnProperty("locationId")&&!u.isString(e.locationId))return"locationId: string expected";if(null!=e.displayName&&e.hasOwnProperty("displayName")&&!u.isString(e.displayName))return"displayName: string expected";if(null!=e.labels&&e.hasOwnProperty("labels")){if(!u.isObject(e.labels))return"labels: object expected";for(var t=Object.keys(e.labels),n=0;n>>3){case 1:o.rules&&o.rules.length||(o.rules=[]),o.rules.push(c.google.api.HttpRule.decode(e,e.uint32()));break;case 2:o.fullyDecodeReservedExpansion=e.bool();break;default:e.skipType(7&r)}}return o},l.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},l.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.rules&&e.hasOwnProperty("rules")){if(!Array.isArray(e.rules))return"rules: array expected";for(var t=0;t>>3){case 1:o.selector=e.string();break;case 2:o.get=e.string();break;case 3:o.put=e.string();break;case 4:o.post=e.string();break;case 5:o.delete=e.string();break;case 6:o.patch=e.string();break;case 8:o.custom=c.google.api.CustomHttpPattern.decode(e,e.uint32());break;case 7:o.body=e.string();break;case 12:o.responseBody=e.string();break;case 11:o.additionalBindings&&o.additionalBindings.length||(o.additionalBindings=[]),o.additionalBindings.push(c.google.api.HttpRule.decode(e,e.uint32()));break;default:e.skipType(7&r)}}return o},d.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},d.verify=function(e){if("object"!=typeof e||null===e)return"object expected";var t={};if(null!=e.selector&&e.hasOwnProperty("selector")&&!u.isString(e.selector))return"selector: string expected";if(null!=e.get&&e.hasOwnProperty("get")&&(t.pattern=1,!u.isString(e.get)))return"get: string expected";if(null!=e.put&&e.hasOwnProperty("put")){if(1===t.pattern)return"pattern: multiple values";if(t.pattern=1,!u.isString(e.put))return"put: string expected"}if(null!=e.post&&e.hasOwnProperty("post")){if(1===t.pattern)return"pattern: multiple values";if(t.pattern=1,!u.isString(e.post))return"post: string expected"}if(null!=e.delete&&e.hasOwnProperty("delete")){if(1===t.pattern)return"pattern: multiple values";if(t.pattern=1,!u.isString(e.delete))return"delete: string expected"}if(null!=e.patch&&e.hasOwnProperty("patch")){if(1===t.pattern)return"pattern: multiple values";if(t.pattern=1,!u.isString(e.patch))return"patch: string expected"}if(null!=e.custom&&e.hasOwnProperty("custom")){if(1===t.pattern)return"pattern: multiple values";if(t.pattern=1,n=c.google.api.CustomHttpPattern.verify(e.custom))return"custom."+n}if(null!=e.body&&e.hasOwnProperty("body")&&!u.isString(e.body))return"body: string expected";if(null!=e.responseBody&&e.hasOwnProperty("responseBody")&&!u.isString(e.responseBody))return"responseBody: string expected";if(null!=e.additionalBindings&&e.hasOwnProperty("additionalBindings")){if(!Array.isArray(e.additionalBindings))return"additionalBindings: array expected";for(var n,o=0;o>>3){case 1:o.kind=e.string();break;case 2:o.path=e.string();break;default:e.skipType(7&r)}}return o},g.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},g.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.kind&&e.hasOwnProperty("kind")&&!u.isString(e.kind)?"kind: string expected":null!=e.path&&e.hasOwnProperty("path")&&!u.isString(e.path)?"path: string expected":null},g.fromObject=function(e){var t;return e instanceof c.google.api.CustomHttpPattern?e:(t=new c.google.api.CustomHttpPattern,null!=e.kind&&(t.kind=String(e.kind)),null!=e.path&&(t.path=String(e.path)),t)},g.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.kind="",n.path=""),null!=e.kind&&e.hasOwnProperty("kind")&&(n.kind=e.kind),null!=e.path&&e.hasOwnProperty("path")&&(n.path=e.path),n},g.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},g),e),F.protobuf=((n={}).FileDescriptorSet=(B.prototype.file=u.emptyArray,B.create=function(e){return new B(e)},B.encode=function(e,t){if(t=t||r.create(),null!=e.file&&e.file.length)for(var n=0;n>>3==1?(o.file&&o.file.length||(o.file=[]),o.file.push(c.google.protobuf.FileDescriptorProto.decode(e,e.uint32()))):e.skipType(7&r)}return o},B.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},B.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.file&&e.hasOwnProperty("file")){if(!Array.isArray(e.file))return"file: array expected";for(var t=0;t>>3){case 1:o.name=e.string();break;case 2:o.package=e.string();break;case 3:o.dependency&&o.dependency.length||(o.dependency=[]),o.dependency.push(e.string());break;case 10:if(o.publicDependency&&o.publicDependency.length||(o.publicDependency=[]),2==(7&r))for(var i=e.uint32()+e.pos;e.pos>>3){case 1:o.name=e.string();break;case 2:o.field&&o.field.length||(o.field=[]),o.field.push(c.google.protobuf.FieldDescriptorProto.decode(e,e.uint32()));break;case 6:o.extension&&o.extension.length||(o.extension=[]),o.extension.push(c.google.protobuf.FieldDescriptorProto.decode(e,e.uint32()));break;case 3:o.nestedType&&o.nestedType.length||(o.nestedType=[]),o.nestedType.push(c.google.protobuf.DescriptorProto.decode(e,e.uint32()));break;case 4:o.enumType&&o.enumType.length||(o.enumType=[]),o.enumType.push(c.google.protobuf.EnumDescriptorProto.decode(e,e.uint32()));break;case 5:o.extensionRange&&o.extensionRange.length||(o.extensionRange=[]),o.extensionRange.push(c.google.protobuf.DescriptorProto.ExtensionRange.decode(e,e.uint32()));break;case 8:o.oneofDecl&&o.oneofDecl.length||(o.oneofDecl=[]),o.oneofDecl.push(c.google.protobuf.OneofDescriptorProto.decode(e,e.uint32()));break;case 7:o.options=c.google.protobuf.MessageOptions.decode(e,e.uint32());break;case 9:o.reservedRange&&o.reservedRange.length||(o.reservedRange=[]),o.reservedRange.push(c.google.protobuf.DescriptorProto.ReservedRange.decode(e,e.uint32()));break;case 10:o.reservedName&&o.reservedName.length||(o.reservedName=[]),o.reservedName.push(e.string());break;default:e.skipType(7&r)}}return o},y.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},y.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.name&&e.hasOwnProperty("name")&&!u.isString(e.name))return"name: string expected";if(null!=e.field&&e.hasOwnProperty("field")){if(!Array.isArray(e.field))return"field: array expected";for(var t=0;t>>3){case 1:o.start=e.int32();break;case 2:o.end=e.int32();break;case 3:o.options=c.google.protobuf.ExtensionRangeOptions.decode(e,e.uint32());break;default:e.skipType(7&r)}}return o},h.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},h.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.start&&e.hasOwnProperty("start")&&!u.isInteger(e.start))return"start: integer expected";if(null!=e.end&&e.hasOwnProperty("end")&&!u.isInteger(e.end))return"end: integer expected";if(null!=e.options&&e.hasOwnProperty("options")){e=c.google.protobuf.ExtensionRangeOptions.verify(e.options);if(e)return"options."+e}return null},h.fromObject=function(e){if(e instanceof c.google.protobuf.DescriptorProto.ExtensionRange)return e;var t=new c.google.protobuf.DescriptorProto.ExtensionRange;if(null!=e.start&&(t.start=0|e.start),null!=e.end&&(t.end=0|e.end),null!=e.options){if("object"!=typeof e.options)throw TypeError(".google.protobuf.DescriptorProto.ExtensionRange.options: object expected");t.options=c.google.protobuf.ExtensionRangeOptions.fromObject(e.options)}return t},h.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.start=0,n.end=0,n.options=null),null!=e.start&&e.hasOwnProperty("start")&&(n.start=e.start),null!=e.end&&e.hasOwnProperty("end")&&(n.end=e.end),null!=e.options&&e.hasOwnProperty("options")&&(n.options=c.google.protobuf.ExtensionRangeOptions.toObject(e.options,t)),n},h.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},h),y.ReservedRange=(b.prototype.start=0,b.prototype.end=0,b.create=function(e){return new b(e)},b.encode=function(e,t){return t=t||r.create(),null!=e.start&&Object.hasOwnProperty.call(e,"start")&&t.uint32(8).int32(e.start),null!=e.end&&Object.hasOwnProperty.call(e,"end")&&t.uint32(16).int32(e.end),t},b.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},b.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new c.google.protobuf.DescriptorProto.ReservedRange;e.pos>>3){case 1:o.start=e.int32();break;case 2:o.end=e.int32();break;default:e.skipType(7&r)}}return o},b.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},b.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.start&&e.hasOwnProperty("start")&&!u.isInteger(e.start)?"start: integer expected":null!=e.end&&e.hasOwnProperty("end")&&!u.isInteger(e.end)?"end: integer expected":null},b.fromObject=function(e){var t;return e instanceof c.google.protobuf.DescriptorProto.ReservedRange?e:(t=new c.google.protobuf.DescriptorProto.ReservedRange,null!=e.start&&(t.start=0|e.start),null!=e.end&&(t.end=0|e.end),t)},b.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.start=0,n.end=0),null!=e.start&&e.hasOwnProperty("start")&&(n.start=e.start),null!=e.end&&e.hasOwnProperty("end")&&(n.end=e.end),n},b.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},b),y),n.ExtensionRangeOptions=(U.prototype.uninterpretedOption=u.emptyArray,U.create=function(e){return new U(e)},U.encode=function(e,t){if(t=t||r.create(),null!=e.uninterpretedOption&&e.uninterpretedOption.length)for(var n=0;n>>3==999?(o.uninterpretedOption&&o.uninterpretedOption.length||(o.uninterpretedOption=[]),o.uninterpretedOption.push(c.google.protobuf.UninterpretedOption.decode(e,e.uint32()))):e.skipType(7&r)}return o},U.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},U.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.uninterpretedOption&&e.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e.uninterpretedOption))return"uninterpretedOption: array expected";for(var t=0;t>>3){case 1:o.name=e.string();break;case 3:o.number=e.int32();break;case 4:o.label=e.int32();break;case 5:o.type=e.int32();break;case 6:o.typeName=e.string();break;case 2:o.extendee=e.string();break;case 7:o.defaultValue=e.string();break;case 9:o.oneofIndex=e.int32();break;case 10:o.jsonName=e.string();break;case 8:o.options=c.google.protobuf.FieldOptions.decode(e,e.uint32());break;case 17:o.proto3Optional=e.bool();break;default:e.skipType(7&r)}}return o},O.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},O.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.name&&e.hasOwnProperty("name")&&!u.isString(e.name))return"name: string expected";if(null!=e.number&&e.hasOwnProperty("number")&&!u.isInteger(e.number))return"number: integer expected";if(null!=e.label&&e.hasOwnProperty("label"))switch(e.label){default:return"label: enum value expected";case 1:case 2:case 3:}if(null!=e.type&&e.hasOwnProperty("type"))switch(e.type){default:return"type: enum value expected";case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:}if(null!=e.typeName&&e.hasOwnProperty("typeName")&&!u.isString(e.typeName))return"typeName: string expected";if(null!=e.extendee&&e.hasOwnProperty("extendee")&&!u.isString(e.extendee))return"extendee: string expected";if(null!=e.defaultValue&&e.hasOwnProperty("defaultValue")&&!u.isString(e.defaultValue))return"defaultValue: string expected";if(null!=e.oneofIndex&&e.hasOwnProperty("oneofIndex")&&!u.isInteger(e.oneofIndex))return"oneofIndex: integer expected";if(null!=e.jsonName&&e.hasOwnProperty("jsonName")&&!u.isString(e.jsonName))return"jsonName: string expected";if(null!=e.options&&e.hasOwnProperty("options")){var t=c.google.protobuf.FieldOptions.verify(e.options);if(t)return"options."+t}return null!=e.proto3Optional&&e.hasOwnProperty("proto3Optional")&&"boolean"!=typeof e.proto3Optional?"proto3Optional: boolean expected":null},O.fromObject=function(e){if(e instanceof c.google.protobuf.FieldDescriptorProto)return e;var t=new c.google.protobuf.FieldDescriptorProto;switch(null!=e.name&&(t.name=String(e.name)),null!=e.number&&(t.number=0|e.number),e.label){case"LABEL_OPTIONAL":case 1:t.label=1;break;case"LABEL_REQUIRED":case 2:t.label=2;break;case"LABEL_REPEATED":case 3:t.label=3}switch(e.type){case"TYPE_DOUBLE":case 1:t.type=1;break;case"TYPE_FLOAT":case 2:t.type=2;break;case"TYPE_INT64":case 3:t.type=3;break;case"TYPE_UINT64":case 4:t.type=4;break;case"TYPE_INT32":case 5:t.type=5;break;case"TYPE_FIXED64":case 6:t.type=6;break;case"TYPE_FIXED32":case 7:t.type=7;break;case"TYPE_BOOL":case 8:t.type=8;break;case"TYPE_STRING":case 9:t.type=9;break;case"TYPE_GROUP":case 10:t.type=10;break;case"TYPE_MESSAGE":case 11:t.type=11;break;case"TYPE_BYTES":case 12:t.type=12;break;case"TYPE_UINT32":case 13:t.type=13;break;case"TYPE_ENUM":case 14:t.type=14;break;case"TYPE_SFIXED32":case 15:t.type=15;break;case"TYPE_SFIXED64":case 16:t.type=16;break;case"TYPE_SINT32":case 17:t.type=17;break;case"TYPE_SINT64":case 18:t.type=18}if(null!=e.typeName&&(t.typeName=String(e.typeName)),null!=e.extendee&&(t.extendee=String(e.extendee)),null!=e.defaultValue&&(t.defaultValue=String(e.defaultValue)),null!=e.oneofIndex&&(t.oneofIndex=0|e.oneofIndex),null!=e.jsonName&&(t.jsonName=String(e.jsonName)),null!=e.options){if("object"!=typeof e.options)throw TypeError(".google.protobuf.FieldDescriptorProto.options: object expected");t.options=c.google.protobuf.FieldOptions.fromObject(e.options)}return null!=e.proto3Optional&&(t.proto3Optional=Boolean(e.proto3Optional)),t},O.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.name="",n.extendee="",n.number=0,n.label=t.enums===String?"LABEL_OPTIONAL":1,n.type=t.enums===String?"TYPE_DOUBLE":1,n.typeName="",n.defaultValue="",n.options=null,n.oneofIndex=0,n.jsonName="",n.proto3Optional=!1),null!=e.name&&e.hasOwnProperty("name")&&(n.name=e.name),null!=e.extendee&&e.hasOwnProperty("extendee")&&(n.extendee=e.extendee),null!=e.number&&e.hasOwnProperty("number")&&(n.number=e.number),null!=e.label&&e.hasOwnProperty("label")&&(n.label=t.enums===String?c.google.protobuf.FieldDescriptorProto.Label[e.label]:e.label),null!=e.type&&e.hasOwnProperty("type")&&(n.type=t.enums===String?c.google.protobuf.FieldDescriptorProto.Type[e.type]:e.type),null!=e.typeName&&e.hasOwnProperty("typeName")&&(n.typeName=e.typeName),null!=e.defaultValue&&e.hasOwnProperty("defaultValue")&&(n.defaultValue=e.defaultValue),null!=e.options&&e.hasOwnProperty("options")&&(n.options=c.google.protobuf.FieldOptions.toObject(e.options,t)),null!=e.oneofIndex&&e.hasOwnProperty("oneofIndex")&&(n.oneofIndex=e.oneofIndex),null!=e.jsonName&&e.hasOwnProperty("jsonName")&&(n.jsonName=e.jsonName),null!=e.proto3Optional&&e.hasOwnProperty("proto3Optional")&&(n.proto3Optional=e.proto3Optional),n},O.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},O.Type=(e={},(t=Object.create(e))[e[1]="TYPE_DOUBLE"]=1,t[e[2]="TYPE_FLOAT"]=2,t[e[3]="TYPE_INT64"]=3,t[e[4]="TYPE_UINT64"]=4,t[e[5]="TYPE_INT32"]=5,t[e[6]="TYPE_FIXED64"]=6,t[e[7]="TYPE_FIXED32"]=7,t[e[8]="TYPE_BOOL"]=8,t[e[9]="TYPE_STRING"]=9,t[e[10]="TYPE_GROUP"]=10,t[e[11]="TYPE_MESSAGE"]=11,t[e[12]="TYPE_BYTES"]=12,t[e[13]="TYPE_UINT32"]=13,t[e[14]="TYPE_ENUM"]=14,t[e[15]="TYPE_SFIXED32"]=15,t[e[16]="TYPE_SFIXED64"]=16,t[e[17]="TYPE_SINT32"]=17,t[e[18]="TYPE_SINT64"]=18,t),O.Label=(e={},(t=Object.create(e))[e[1]="LABEL_OPTIONAL"]=1,t[e[2]="LABEL_REQUIRED"]=2,t[e[3]="LABEL_REPEATED"]=3,t),O),n.OneofDescriptorProto=(m.prototype.name="",m.prototype.options=null,m.create=function(e){return new m(e)},m.encode=function(e,t){return t=t||r.create(),null!=e.name&&Object.hasOwnProperty.call(e,"name")&&t.uint32(10).string(e.name),null!=e.options&&Object.hasOwnProperty.call(e,"options")&&c.google.protobuf.OneofOptions.encode(e.options,t.uint32(18).fork()).ldelim(),t},m.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},m.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new c.google.protobuf.OneofDescriptorProto;e.pos>>3){case 1:o.name=e.string();break;case 2:o.options=c.google.protobuf.OneofOptions.decode(e,e.uint32());break;default:e.skipType(7&r)}}return o},m.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},m.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.name&&e.hasOwnProperty("name")&&!u.isString(e.name))return"name: string expected";if(null!=e.options&&e.hasOwnProperty("options")){e=c.google.protobuf.OneofOptions.verify(e.options);if(e)return"options."+e}return null},m.fromObject=function(e){if(e instanceof c.google.protobuf.OneofDescriptorProto)return e;var t=new c.google.protobuf.OneofDescriptorProto;if(null!=e.name&&(t.name=String(e.name)),null!=e.options){if("object"!=typeof e.options)throw TypeError(".google.protobuf.OneofDescriptorProto.options: object expected");t.options=c.google.protobuf.OneofOptions.fromObject(e.options)}return t},m.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.name="",n.options=null),null!=e.name&&e.hasOwnProperty("name")&&(n.name=e.name),null!=e.options&&e.hasOwnProperty("options")&&(n.options=c.google.protobuf.OneofOptions.toObject(e.options,t)),n},m.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},m),n.EnumDescriptorProto=(v.prototype.name="",v.prototype.value=u.emptyArray,v.prototype.options=null,v.prototype.reservedRange=u.emptyArray,v.prototype.reservedName=u.emptyArray,v.create=function(e){return new v(e)},v.encode=function(e,t){if(t=t||r.create(),null!=e.name&&Object.hasOwnProperty.call(e,"name")&&t.uint32(10).string(e.name),null!=e.value&&e.value.length)for(var n=0;n>>3){case 1:o.name=e.string();break;case 2:o.value&&o.value.length||(o.value=[]),o.value.push(c.google.protobuf.EnumValueDescriptorProto.decode(e,e.uint32()));break;case 3:o.options=c.google.protobuf.EnumOptions.decode(e,e.uint32());break;case 4:o.reservedRange&&o.reservedRange.length||(o.reservedRange=[]),o.reservedRange.push(c.google.protobuf.EnumDescriptorProto.EnumReservedRange.decode(e,e.uint32()));break;case 5:o.reservedName&&o.reservedName.length||(o.reservedName=[]),o.reservedName.push(e.string());break;default:e.skipType(7&r)}}return o},v.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},v.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.name&&e.hasOwnProperty("name")&&!u.isString(e.name))return"name: string expected";if(null!=e.value&&e.hasOwnProperty("value")){if(!Array.isArray(e.value))return"value: array expected";for(var t=0;t>>3){case 1:o.start=e.int32();break;case 2:o.end=e.int32();break;default:e.skipType(7&r)}}return o},P.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},P.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.start&&e.hasOwnProperty("start")&&!u.isInteger(e.start)?"start: integer expected":null!=e.end&&e.hasOwnProperty("end")&&!u.isInteger(e.end)?"end: integer expected":null},P.fromObject=function(e){var t;return e instanceof c.google.protobuf.EnumDescriptorProto.EnumReservedRange?e:(t=new c.google.protobuf.EnumDescriptorProto.EnumReservedRange,null!=e.start&&(t.start=0|e.start),null!=e.end&&(t.end=0|e.end),t)},P.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.start=0,n.end=0),null!=e.start&&e.hasOwnProperty("start")&&(n.start=e.start),null!=e.end&&e.hasOwnProperty("end")&&(n.end=e.end),n},P.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},P),v),n.EnumValueDescriptorProto=(w.prototype.name="",w.prototype.number=0,w.prototype.options=null,w.create=function(e){return new w(e)},w.encode=function(e,t){return t=t||r.create(),null!=e.name&&Object.hasOwnProperty.call(e,"name")&&t.uint32(10).string(e.name),null!=e.number&&Object.hasOwnProperty.call(e,"number")&&t.uint32(16).int32(e.number),null!=e.options&&Object.hasOwnProperty.call(e,"options")&&c.google.protobuf.EnumValueOptions.encode(e.options,t.uint32(26).fork()).ldelim(),t},w.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},w.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new c.google.protobuf.EnumValueDescriptorProto;e.pos>>3){case 1:o.name=e.string();break;case 2:o.number=e.int32();break;case 3:o.options=c.google.protobuf.EnumValueOptions.decode(e,e.uint32());break;default:e.skipType(7&r)}}return o},w.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},w.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.name&&e.hasOwnProperty("name")&&!u.isString(e.name))return"name: string expected";if(null!=e.number&&e.hasOwnProperty("number")&&!u.isInteger(e.number))return"number: integer expected";if(null!=e.options&&e.hasOwnProperty("options")){e=c.google.protobuf.EnumValueOptions.verify(e.options);if(e)return"options."+e}return null},w.fromObject=function(e){if(e instanceof c.google.protobuf.EnumValueDescriptorProto)return e;var t=new c.google.protobuf.EnumValueDescriptorProto;if(null!=e.name&&(t.name=String(e.name)),null!=e.number&&(t.number=0|e.number),null!=e.options){if("object"!=typeof e.options)throw TypeError(".google.protobuf.EnumValueDescriptorProto.options: object expected");t.options=c.google.protobuf.EnumValueOptions.fromObject(e.options)}return t},w.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.name="",n.number=0,n.options=null),null!=e.name&&e.hasOwnProperty("name")&&(n.name=e.name),null!=e.number&&e.hasOwnProperty("number")&&(n.number=e.number),null!=e.options&&e.hasOwnProperty("options")&&(n.options=c.google.protobuf.EnumValueOptions.toObject(e.options,t)),n},w.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},w),n.ServiceDescriptorProto=(j.prototype.name="",j.prototype.method=u.emptyArray,j.prototype.options=null,j.create=function(e){return new j(e)},j.encode=function(e,t){if(t=t||r.create(),null!=e.name&&Object.hasOwnProperty.call(e,"name")&&t.uint32(10).string(e.name),null!=e.method&&e.method.length)for(var n=0;n>>3){case 1:o.name=e.string();break;case 2:o.method&&o.method.length||(o.method=[]),o.method.push(c.google.protobuf.MethodDescriptorProto.decode(e,e.uint32()));break;case 3:o.options=c.google.protobuf.ServiceOptions.decode(e,e.uint32());break;default:e.skipType(7&r)}}return o},j.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},j.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.name&&e.hasOwnProperty("name")&&!u.isString(e.name))return"name: string expected";if(null!=e.method&&e.hasOwnProperty("method")){if(!Array.isArray(e.method))return"method: array expected";for(var t=0;t>>3){case 1:o.name=e.string();break;case 2:o.inputType=e.string();break;case 3:o.outputType=e.string();break;case 4:o.options=c.google.protobuf.MethodOptions.decode(e,e.uint32());break;case 5:o.clientStreaming=e.bool();break;case 6:o.serverStreaming=e.bool();break;default:e.skipType(7&r)}}return o},x.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},x.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.name&&e.hasOwnProperty("name")&&!u.isString(e.name))return"name: string expected";if(null!=e.inputType&&e.hasOwnProperty("inputType")&&!u.isString(e.inputType))return"inputType: string expected";if(null!=e.outputType&&e.hasOwnProperty("outputType")&&!u.isString(e.outputType))return"outputType: string expected";if(null!=e.options&&e.hasOwnProperty("options")){var t=c.google.protobuf.MethodOptions.verify(e.options);if(t)return"options."+t}return null!=e.clientStreaming&&e.hasOwnProperty("clientStreaming")&&"boolean"!=typeof e.clientStreaming?"clientStreaming: boolean expected":null!=e.serverStreaming&&e.hasOwnProperty("serverStreaming")&&"boolean"!=typeof e.serverStreaming?"serverStreaming: boolean expected":null},x.fromObject=function(e){if(e instanceof c.google.protobuf.MethodDescriptorProto)return e;var t=new c.google.protobuf.MethodDescriptorProto;if(null!=e.name&&(t.name=String(e.name)),null!=e.inputType&&(t.inputType=String(e.inputType)),null!=e.outputType&&(t.outputType=String(e.outputType)),null!=e.options){if("object"!=typeof e.options)throw TypeError(".google.protobuf.MethodDescriptorProto.options: object expected");t.options=c.google.protobuf.MethodOptions.fromObject(e.options)}return null!=e.clientStreaming&&(t.clientStreaming=Boolean(e.clientStreaming)),null!=e.serverStreaming&&(t.serverStreaming=Boolean(e.serverStreaming)),t},x.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.name="",n.inputType="",n.outputType="",n.options=null,n.clientStreaming=!1,n.serverStreaming=!1),null!=e.name&&e.hasOwnProperty("name")&&(n.name=e.name),null!=e.inputType&&e.hasOwnProperty("inputType")&&(n.inputType=e.inputType),null!=e.outputType&&e.hasOwnProperty("outputType")&&(n.outputType=e.outputType),null!=e.options&&e.hasOwnProperty("options")&&(n.options=c.google.protobuf.MethodOptions.toObject(e.options,t)),null!=e.clientStreaming&&e.hasOwnProperty("clientStreaming")&&(n.clientStreaming=e.clientStreaming),null!=e.serverStreaming&&e.hasOwnProperty("serverStreaming")&&(n.serverStreaming=e.serverStreaming),n},x.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},x),n.FileOptions=(S.prototype.javaPackage="",S.prototype.javaOuterClassname="",S.prototype.javaMultipleFiles=!1,S.prototype.javaGenerateEqualsAndHash=!1,S.prototype.javaStringCheckUtf8=!1,S.prototype.optimizeFor=1,S.prototype.goPackage="",S.prototype.ccGenericServices=!1,S.prototype.javaGenericServices=!1,S.prototype.pyGenericServices=!1,S.prototype.phpGenericServices=!1,S.prototype.deprecated=!1,S.prototype.ccEnableArenas=!0,S.prototype.objcClassPrefix="",S.prototype.csharpNamespace="",S.prototype.swiftPrefix="",S.prototype.phpClassPrefix="",S.prototype.phpNamespace="",S.prototype.phpMetadataNamespace="",S.prototype.rubyPackage="",S.prototype.uninterpretedOption=u.emptyArray,S.create=function(e){return new S(e)},S.encode=function(e,t){if(t=t||r.create(),null!=e.javaPackage&&Object.hasOwnProperty.call(e,"javaPackage")&&t.uint32(10).string(e.javaPackage),null!=e.javaOuterClassname&&Object.hasOwnProperty.call(e,"javaOuterClassname")&&t.uint32(66).string(e.javaOuterClassname),null!=e.optimizeFor&&Object.hasOwnProperty.call(e,"optimizeFor")&&t.uint32(72).int32(e.optimizeFor),null!=e.javaMultipleFiles&&Object.hasOwnProperty.call(e,"javaMultipleFiles")&&t.uint32(80).bool(e.javaMultipleFiles),null!=e.goPackage&&Object.hasOwnProperty.call(e,"goPackage")&&t.uint32(90).string(e.goPackage),null!=e.ccGenericServices&&Object.hasOwnProperty.call(e,"ccGenericServices")&&t.uint32(128).bool(e.ccGenericServices),null!=e.javaGenericServices&&Object.hasOwnProperty.call(e,"javaGenericServices")&&t.uint32(136).bool(e.javaGenericServices),null!=e.pyGenericServices&&Object.hasOwnProperty.call(e,"pyGenericServices")&&t.uint32(144).bool(e.pyGenericServices),null!=e.javaGenerateEqualsAndHash&&Object.hasOwnProperty.call(e,"javaGenerateEqualsAndHash")&&t.uint32(160).bool(e.javaGenerateEqualsAndHash),null!=e.deprecated&&Object.hasOwnProperty.call(e,"deprecated")&&t.uint32(184).bool(e.deprecated),null!=e.javaStringCheckUtf8&&Object.hasOwnProperty.call(e,"javaStringCheckUtf8")&&t.uint32(216).bool(e.javaStringCheckUtf8),null!=e.ccEnableArenas&&Object.hasOwnProperty.call(e,"ccEnableArenas")&&t.uint32(248).bool(e.ccEnableArenas),null!=e.objcClassPrefix&&Object.hasOwnProperty.call(e,"objcClassPrefix")&&t.uint32(290).string(e.objcClassPrefix),null!=e.csharpNamespace&&Object.hasOwnProperty.call(e,"csharpNamespace")&&t.uint32(298).string(e.csharpNamespace),null!=e.swiftPrefix&&Object.hasOwnProperty.call(e,"swiftPrefix")&&t.uint32(314).string(e.swiftPrefix),null!=e.phpClassPrefix&&Object.hasOwnProperty.call(e,"phpClassPrefix")&&t.uint32(322).string(e.phpClassPrefix),null!=e.phpNamespace&&Object.hasOwnProperty.call(e,"phpNamespace")&&t.uint32(330).string(e.phpNamespace),null!=e.phpGenericServices&&Object.hasOwnProperty.call(e,"phpGenericServices")&&t.uint32(336).bool(e.phpGenericServices),null!=e.phpMetadataNamespace&&Object.hasOwnProperty.call(e,"phpMetadataNamespace")&&t.uint32(354).string(e.phpMetadataNamespace),null!=e.rubyPackage&&Object.hasOwnProperty.call(e,"rubyPackage")&&t.uint32(362).string(e.rubyPackage),null!=e.uninterpretedOption&&e.uninterpretedOption.length)for(var n=0;n>>3){case 1:o.javaPackage=e.string();break;case 8:o.javaOuterClassname=e.string();break;case 10:o.javaMultipleFiles=e.bool();break;case 20:o.javaGenerateEqualsAndHash=e.bool();break;case 27:o.javaStringCheckUtf8=e.bool();break;case 9:o.optimizeFor=e.int32();break;case 11:o.goPackage=e.string();break;case 16:o.ccGenericServices=e.bool();break;case 17:o.javaGenericServices=e.bool();break;case 18:o.pyGenericServices=e.bool();break;case 42:o.phpGenericServices=e.bool();break;case 23:o.deprecated=e.bool();break;case 31:o.ccEnableArenas=e.bool();break;case 36:o.objcClassPrefix=e.string();break;case 37:o.csharpNamespace=e.string();break;case 39:o.swiftPrefix=e.string();break;case 40:o.phpClassPrefix=e.string();break;case 41:o.phpNamespace=e.string();break;case 44:o.phpMetadataNamespace=e.string();break;case 45:o.rubyPackage=e.string();break;case 999:o.uninterpretedOption&&o.uninterpretedOption.length||(o.uninterpretedOption=[]),o.uninterpretedOption.push(c.google.protobuf.UninterpretedOption.decode(e,e.uint32()));break;default:e.skipType(7&r)}}return o},S.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},S.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.javaPackage&&e.hasOwnProperty("javaPackage")&&!u.isString(e.javaPackage))return"javaPackage: string expected";if(null!=e.javaOuterClassname&&e.hasOwnProperty("javaOuterClassname")&&!u.isString(e.javaOuterClassname))return"javaOuterClassname: string expected";if(null!=e.javaMultipleFiles&&e.hasOwnProperty("javaMultipleFiles")&&"boolean"!=typeof e.javaMultipleFiles)return"javaMultipleFiles: boolean expected";if(null!=e.javaGenerateEqualsAndHash&&e.hasOwnProperty("javaGenerateEqualsAndHash")&&"boolean"!=typeof e.javaGenerateEqualsAndHash)return"javaGenerateEqualsAndHash: boolean expected";if(null!=e.javaStringCheckUtf8&&e.hasOwnProperty("javaStringCheckUtf8")&&"boolean"!=typeof e.javaStringCheckUtf8)return"javaStringCheckUtf8: boolean expected";if(null!=e.optimizeFor&&e.hasOwnProperty("optimizeFor"))switch(e.optimizeFor){default:return"optimizeFor: enum value expected";case 1:case 2:case 3:}if(null!=e.goPackage&&e.hasOwnProperty("goPackage")&&!u.isString(e.goPackage))return"goPackage: string expected";if(null!=e.ccGenericServices&&e.hasOwnProperty("ccGenericServices")&&"boolean"!=typeof e.ccGenericServices)return"ccGenericServices: boolean expected";if(null!=e.javaGenericServices&&e.hasOwnProperty("javaGenericServices")&&"boolean"!=typeof e.javaGenericServices)return"javaGenericServices: boolean expected";if(null!=e.pyGenericServices&&e.hasOwnProperty("pyGenericServices")&&"boolean"!=typeof e.pyGenericServices)return"pyGenericServices: boolean expected";if(null!=e.phpGenericServices&&e.hasOwnProperty("phpGenericServices")&&"boolean"!=typeof e.phpGenericServices)return"phpGenericServices: boolean expected";if(null!=e.deprecated&&e.hasOwnProperty("deprecated")&&"boolean"!=typeof e.deprecated)return"deprecated: boolean expected";if(null!=e.ccEnableArenas&&e.hasOwnProperty("ccEnableArenas")&&"boolean"!=typeof e.ccEnableArenas)return"ccEnableArenas: boolean expected";if(null!=e.objcClassPrefix&&e.hasOwnProperty("objcClassPrefix")&&!u.isString(e.objcClassPrefix))return"objcClassPrefix: string expected";if(null!=e.csharpNamespace&&e.hasOwnProperty("csharpNamespace")&&!u.isString(e.csharpNamespace))return"csharpNamespace: string expected";if(null!=e.swiftPrefix&&e.hasOwnProperty("swiftPrefix")&&!u.isString(e.swiftPrefix))return"swiftPrefix: string expected";if(null!=e.phpClassPrefix&&e.hasOwnProperty("phpClassPrefix")&&!u.isString(e.phpClassPrefix))return"phpClassPrefix: string expected";if(null!=e.phpNamespace&&e.hasOwnProperty("phpNamespace")&&!u.isString(e.phpNamespace))return"phpNamespace: string expected";if(null!=e.phpMetadataNamespace&&e.hasOwnProperty("phpMetadataNamespace")&&!u.isString(e.phpMetadataNamespace))return"phpMetadataNamespace: string expected";if(null!=e.rubyPackage&&e.hasOwnProperty("rubyPackage")&&!u.isString(e.rubyPackage))return"rubyPackage: string expected";if(null!=e.uninterpretedOption&&e.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e.uninterpretedOption))return"uninterpretedOption: array expected";for(var t=0;t>>3){case 1:o.messageSetWireFormat=e.bool();break;case 2:o.noStandardDescriptorAccessor=e.bool();break;case 3:o.deprecated=e.bool();break;case 7:o.mapEntry=e.bool();break;case 999:o.uninterpretedOption&&o.uninterpretedOption.length||(o.uninterpretedOption=[]),o.uninterpretedOption.push(c.google.protobuf.UninterpretedOption.decode(e,e.uint32()));break;default:e.skipType(7&r)}}return o},k.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},k.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.messageSetWireFormat&&e.hasOwnProperty("messageSetWireFormat")&&"boolean"!=typeof e.messageSetWireFormat)return"messageSetWireFormat: boolean expected";if(null!=e.noStandardDescriptorAccessor&&e.hasOwnProperty("noStandardDescriptorAccessor")&&"boolean"!=typeof e.noStandardDescriptorAccessor)return"noStandardDescriptorAccessor: boolean expected";if(null!=e.deprecated&&e.hasOwnProperty("deprecated")&&"boolean"!=typeof e.deprecated)return"deprecated: boolean expected";if(null!=e.mapEntry&&e.hasOwnProperty("mapEntry")&&"boolean"!=typeof e.mapEntry)return"mapEntry: boolean expected";if(null!=e.uninterpretedOption&&e.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e.uninterpretedOption))return"uninterpretedOption: array expected";for(var t=0;t>>3){case 1:o.ctype=e.int32();break;case 2:o.packed=e.bool();break;case 6:o.jstype=e.int32();break;case 5:o.lazy=e.bool();break;case 3:o.deprecated=e.bool();break;case 10:o.weak=e.bool();break;case 999:o.uninterpretedOption&&o.uninterpretedOption.length||(o.uninterpretedOption=[]),o.uninterpretedOption.push(c.google.protobuf.UninterpretedOption.decode(e,e.uint32()));break;default:e.skipType(7&r)}}return o},D.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},D.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.ctype&&e.hasOwnProperty("ctype"))switch(e.ctype){default:return"ctype: enum value expected";case 0:case 1:case 2:}if(null!=e.packed&&e.hasOwnProperty("packed")&&"boolean"!=typeof e.packed)return"packed: boolean expected";if(null!=e.jstype&&e.hasOwnProperty("jstype"))switch(e.jstype){default:return"jstype: enum value expected";case 0:case 1:case 2:}if(null!=e.lazy&&e.hasOwnProperty("lazy")&&"boolean"!=typeof e.lazy)return"lazy: boolean expected";if(null!=e.deprecated&&e.hasOwnProperty("deprecated")&&"boolean"!=typeof e.deprecated)return"deprecated: boolean expected";if(null!=e.weak&&e.hasOwnProperty("weak")&&"boolean"!=typeof e.weak)return"weak: boolean expected";if(null!=e.uninterpretedOption&&e.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e.uninterpretedOption))return"uninterpretedOption: array expected";for(var t=0;t>>3==999?(o.uninterpretedOption&&o.uninterpretedOption.length||(o.uninterpretedOption=[]),o.uninterpretedOption.push(c.google.protobuf.UninterpretedOption.decode(e,e.uint32()))):e.skipType(7&r)}return o},M.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},M.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.uninterpretedOption&&e.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e.uninterpretedOption))return"uninterpretedOption: array expected";for(var t=0;t>>3){case 2:o.allowAlias=e.bool();break;case 3:o.deprecated=e.bool();break;case 999:o.uninterpretedOption&&o.uninterpretedOption.length||(o.uninterpretedOption=[]),o.uninterpretedOption.push(c.google.protobuf.UninterpretedOption.decode(e,e.uint32()));break;default:e.skipType(7&r)}}return o},T.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},T.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.allowAlias&&e.hasOwnProperty("allowAlias")&&"boolean"!=typeof e.allowAlias)return"allowAlias: boolean expected";if(null!=e.deprecated&&e.hasOwnProperty("deprecated")&&"boolean"!=typeof e.deprecated)return"deprecated: boolean expected";if(null!=e.uninterpretedOption&&e.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e.uninterpretedOption))return"uninterpretedOption: array expected";for(var t=0;t>>3){case 1:o.deprecated=e.bool();break;case 999:o.uninterpretedOption&&o.uninterpretedOption.length||(o.uninterpretedOption=[]),o.uninterpretedOption.push(c.google.protobuf.UninterpretedOption.decode(e,e.uint32()));break;default:e.skipType(7&r)}}return o},E.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},E.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.deprecated&&e.hasOwnProperty("deprecated")&&"boolean"!=typeof e.deprecated)return"deprecated: boolean expected";if(null!=e.uninterpretedOption&&e.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e.uninterpretedOption))return"uninterpretedOption: array expected";for(var t=0;t>>3){case 33:o.deprecated=e.bool();break;case 999:o.uninterpretedOption&&o.uninterpretedOption.length||(o.uninterpretedOption=[]),o.uninterpretedOption.push(c.google.protobuf.UninterpretedOption.decode(e,e.uint32()));break;case 1049:o[".google.api.defaultHost"]=e.string();break;case 1050:o[".google.api.oauthScopes"]=e.string();break;default:e.skipType(7&r)}}return o},A.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},A.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.deprecated&&e.hasOwnProperty("deprecated")&&"boolean"!=typeof e.deprecated)return"deprecated: boolean expected";if(null!=e.uninterpretedOption&&e.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e.uninterpretedOption))return"uninterpretedOption: array expected";for(var t=0;t>>3){case 33:o.deprecated=e.bool();break;case 34:o.idempotencyLevel=e.int32();break;case 999:o.uninterpretedOption&&o.uninterpretedOption.length||(o.uninterpretedOption=[]),o.uninterpretedOption.push(c.google.protobuf.UninterpretedOption.decode(e,e.uint32()));break;case 72295728:o[".google.api.http"]=c.google.api.HttpRule.decode(e,e.uint32());break;case 1051:o[".google.api.methodSignature"]&&o[".google.api.methodSignature"].length||(o[".google.api.methodSignature"]=[]),o[".google.api.methodSignature"].push(e.string());break;default:e.skipType(7&r)}}return o},N.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},N.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.deprecated&&e.hasOwnProperty("deprecated")&&"boolean"!=typeof e.deprecated)return"deprecated: boolean expected";if(null!=e.idempotencyLevel&&e.hasOwnProperty("idempotencyLevel"))switch(e.idempotencyLevel){default:return"idempotencyLevel: enum value expected";case 0:case 1:case 2:}if(null!=e.uninterpretedOption&&e.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e.uninterpretedOption))return"uninterpretedOption: array expected";for(var t=0;t>>3){case 2:o.name&&o.name.length||(o.name=[]),o.name.push(c.google.protobuf.UninterpretedOption.NamePart.decode(e,e.uint32()));break;case 3:o.identifierValue=e.string();break;case 4:o.positiveIntValue=e.uint64();break;case 5:o.negativeIntValue=e.int64();break;case 6:o.doubleValue=e.double();break;case 7:o.stringValue=e.bytes();break;case 8:o.aggregateValue=e.string();break;default:e.skipType(7&r)}}return o},I.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},I.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.name&&e.hasOwnProperty("name")){if(!Array.isArray(e.name))return"name: array expected";for(var t=0;t>>0,e.positiveIntValue.high>>>0).toNumber(!0))),null!=e.negativeIntValue&&(u.Long?(t.negativeIntValue=u.Long.fromValue(e.negativeIntValue)).unsigned=!1:"string"==typeof e.negativeIntValue?t.negativeIntValue=parseInt(e.negativeIntValue,10):"number"==typeof e.negativeIntValue?t.negativeIntValue=e.negativeIntValue:"object"==typeof e.negativeIntValue&&(t.negativeIntValue=new u.LongBits(e.negativeIntValue.low>>>0,e.negativeIntValue.high>>>0).toNumber())),null!=e.doubleValue&&(t.doubleValue=Number(e.doubleValue)),null!=e.stringValue&&("string"==typeof e.stringValue?u.base64.decode(e.stringValue,t.stringValue=u.newBuffer(u.base64.length(e.stringValue)),0):e.stringValue.length&&(t.stringValue=e.stringValue)),null!=e.aggregateValue&&(t.aggregateValue=String(e.aggregateValue)),t},I.toObject=function(e,t){var n,o={};if(((t=t||{}).arrays||t.defaults)&&(o.name=[]),t.defaults&&(o.identifierValue="",u.Long?(n=new u.Long(0,0,!0),o.positiveIntValue=t.longs===String?n.toString():t.longs===Number?n.toNumber():n):o.positiveIntValue=t.longs===String?"0":0,u.Long?(n=new u.Long(0,0,!1),o.negativeIntValue=t.longs===String?n.toString():t.longs===Number?n.toNumber():n):o.negativeIntValue=t.longs===String?"0":0,o.doubleValue=0,t.bytes===String?o.stringValue="":(o.stringValue=[],t.bytes!==Array&&(o.stringValue=u.newBuffer(o.stringValue))),o.aggregateValue=""),e.name&&e.name.length){o.name=[];for(var r=0;r>>0,e.positiveIntValue.high>>>0).toNumber(!0):e.positiveIntValue),null!=e.negativeIntValue&&e.hasOwnProperty("negativeIntValue")&&("number"==typeof e.negativeIntValue?o.negativeIntValue=t.longs===String?String(e.negativeIntValue):e.negativeIntValue:o.negativeIntValue=t.longs===String?u.Long.prototype.toString.call(e.negativeIntValue):t.longs===Number?new u.LongBits(e.negativeIntValue.low>>>0,e.negativeIntValue.high>>>0).toNumber():e.negativeIntValue),null!=e.doubleValue&&e.hasOwnProperty("doubleValue")&&(o.doubleValue=t.json&&!isFinite(e.doubleValue)?String(e.doubleValue):e.doubleValue),null!=e.stringValue&&e.hasOwnProperty("stringValue")&&(o.stringValue=t.bytes===String?u.base64.encode(e.stringValue,0,e.stringValue.length):t.bytes===Array?Array.prototype.slice.call(e.stringValue):e.stringValue),null!=e.aggregateValue&&e.hasOwnProperty("aggregateValue")&&(o.aggregateValue=e.aggregateValue),o},I.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},I.NamePart=(R.prototype.namePart="",R.prototype.isExtension=!1,R.create=function(e){return new R(e)},R.encode=function(e,t){return(t=t||r.create()).uint32(10).string(e.namePart),t.uint32(16).bool(e.isExtension),t},R.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},R.decode=function(e,t){e instanceof s||(e=s.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new c.google.protobuf.UninterpretedOption.NamePart;e.pos>>3){case 1:o.namePart=e.string();break;case 2:o.isExtension=e.bool();break;default:e.skipType(7&r)}}if(!o.hasOwnProperty("namePart"))throw u.ProtocolError("missing required 'namePart'",{instance:o});if(o.hasOwnProperty("isExtension"))return o;throw u.ProtocolError("missing required 'isExtension'",{instance:o})},R.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},R.verify=function(e){return"object"!=typeof e||null===e?"object expected":u.isString(e.namePart)?"boolean"!=typeof e.isExtension?"isExtension: boolean expected":null:"namePart: string expected"},R.fromObject=function(e){var t;return e instanceof c.google.protobuf.UninterpretedOption.NamePart?e:(t=new c.google.protobuf.UninterpretedOption.NamePart,null!=e.namePart&&(t.namePart=String(e.namePart)),null!=e.isExtension&&(t.isExtension=Boolean(e.isExtension)),t)},R.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.namePart="",n.isExtension=!1),null!=e.namePart&&e.hasOwnProperty("namePart")&&(n.namePart=e.namePart),null!=e.isExtension&&e.hasOwnProperty("isExtension")&&(n.isExtension=e.isExtension),n},R.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},R),I),n.SourceCodeInfo=(_.prototype.location=u.emptyArray,_.create=function(e){return new _(e)},_.encode=function(e,t){if(t=t||r.create(),null!=e.location&&e.location.length)for(var n=0;n>>3==1?(o.location&&o.location.length||(o.location=[]),o.location.push(c.google.protobuf.SourceCodeInfo.Location.decode(e,e.uint32()))):e.skipType(7&r)}return o},_.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},_.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.location&&e.hasOwnProperty("location")){if(!Array.isArray(e.location))return"location: array expected";for(var t=0;t>>3){case 1:if(o.path&&o.path.length||(o.path=[]),2==(7&r))for(var i=e.uint32()+e.pos;e.pos>>3==1?(o.annotation&&o.annotation.length||(o.annotation=[]),o.annotation.push(c.google.protobuf.GeneratedCodeInfo.Annotation.decode(e,e.uint32()))):e.skipType(7&r)}return o},J.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},J.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.annotation&&e.hasOwnProperty("annotation")){if(!Array.isArray(e.annotation))return"annotation: array expected";for(var t=0;t>>3){case 1:if(o.path&&o.path.length||(o.path=[]),2==(7&r))for(var i=e.uint32()+e.pos;e.pos>>3){case 1:o.type_url=e.string();break;case 2:o.value=e.bytes();break;default:e.skipType(7&r)}}return o},H.decodeDelimited=function(e){return e instanceof s||(e=new s(e)),this.decode(e,e.uint32())},H.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.type_url&&e.hasOwnProperty("type_url")&&!u.isString(e.type_url)?"type_url: string expected":null!=e.value&&e.hasOwnProperty("value")&&!(e.value&&"number"==typeof e.value.length||u.isString(e.value))?"value: buffer expected":null},H.fromObject=function(e){var t;return e instanceof c.google.protobuf.Any?e:(t=new c.google.protobuf.Any,null!=e.type_url&&(t.type_url=String(e.type_url)),null!=e.value&&("string"==typeof e.value?u.base64.decode(e.value,t.value=u.newBuffer(u.base64.length(e.value)),0):e.value.length&&(t.value=e.value)),t)},H.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.type_url="",t.bytes===String?n.value="":(n.value=[],t.bytes!==Array&&(n.value=u.newBuffer(n.value)))),null!=e.type_url&&e.hasOwnProperty("type_url")&&(n.type_url=e.type_url),null!=e.value&&e.hasOwnProperty("value")&&(n.value=t.bytes===String?u.base64.encode(e.value,0,e.value.length):t.bytes===Array?Array.prototype.slice.call(e.value):e.value),n},H.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},H),n),F),c}); + +/***/ }), + +/***/ 99467: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +/* module decorator */ module = __nccwpck_require__.nmd(module); +(e=>{"function"==typeof define&&define.amd?define(["protobufjs/minimal"],e): true&&module&&module.exports&&(module.exports=e(__nccwpck_require__(37823)))})(function(o){var e,t,n,F,a=o.Reader,r=o.Writer,i=o.util,p=o.roots.operations_protos||(o.roots.operations_protos={});function G(e,t,n){o.rpc.Service.call(this,e,t,n)}function l(e){if(e)for(var t=Object.keys(e),n=0;n>>3){case 1:o.name=e.string();break;case 2:o.metadata=p.google.protobuf.Any.decode(e,e.uint32());break;case 3:o.done=e.bool();break;case 4:o.error=p.google.rpc.Status.decode(e,e.uint32());break;case 5:o.response=p.google.protobuf.Any.decode(e,e.uint32());break;default:e.skipType(7&r)}}return o},l.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},l.verify=function(e){if("object"!=typeof e||null===e)return"object expected";var t,n={};if(null!=e.name&&e.hasOwnProperty("name")&&!i.isString(e.name))return"name: string expected";if(null!=e.metadata&&e.hasOwnProperty("metadata")&&(t=p.google.protobuf.Any.verify(e.metadata)))return"metadata."+t;if(null!=e.done&&e.hasOwnProperty("done")&&"boolean"!=typeof e.done)return"done: boolean expected";if(null!=e.error&&e.hasOwnProperty("error")&&(n.result=1,t=p.google.rpc.Status.verify(e.error)))return"error."+t;if(null!=e.response&&e.hasOwnProperty("response")){if(1===n.result)return"result: multiple values";if(n.result=1,t=p.google.protobuf.Any.verify(e.response))return"response."+t}return null},l.fromObject=function(e){if(e instanceof p.google.longrunning.Operation)return e;var t=new p.google.longrunning.Operation;if(null!=e.name&&(t.name=String(e.name)),null!=e.metadata){if("object"!=typeof e.metadata)throw TypeError(".google.longrunning.Operation.metadata: object expected");t.metadata=p.google.protobuf.Any.fromObject(e.metadata)}if(null!=e.done&&(t.done=Boolean(e.done)),null!=e.error){if("object"!=typeof e.error)throw TypeError(".google.longrunning.Operation.error: object expected");t.error=p.google.rpc.Status.fromObject(e.error)}if(null!=e.response){if("object"!=typeof e.response)throw TypeError(".google.longrunning.Operation.response: object expected");t.response=p.google.protobuf.Any.fromObject(e.response)}return t},l.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.name="",n.metadata=null,n.done=!1),null!=e.name&&e.hasOwnProperty("name")&&(n.name=e.name),null!=e.metadata&&e.hasOwnProperty("metadata")&&(n.metadata=p.google.protobuf.Any.toObject(e.metadata,t)),null!=e.done&&e.hasOwnProperty("done")&&(n.done=e.done),null!=e.error&&e.hasOwnProperty("error")&&(n.error=p.google.rpc.Status.toObject(e.error,t),t.oneofs)&&(n.result="error"),null!=e.response&&e.hasOwnProperty("response")&&(n.response=p.google.protobuf.Any.toObject(e.response,t),t.oneofs)&&(n.result="response"),n},l.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},l),t.GetOperationRequest=(B.prototype.name="",B.create=function(e){return new B(e)},B.encode=function(e,t){return t=t||r.create(),null!=e.name&&Object.hasOwnProperty.call(e,"name")&&t.uint32(10).string(e.name),t},B.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},B.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new p.google.longrunning.GetOperationRequest;e.pos>>3==1?o.name=e.string():e.skipType(7&r)}return o},B.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},B.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.name&&e.hasOwnProperty("name")&&!i.isString(e.name)?"name: string expected":null},B.fromObject=function(e){var t;return e instanceof p.google.longrunning.GetOperationRequest?e:(t=new p.google.longrunning.GetOperationRequest,null!=e.name&&(t.name=String(e.name)),t)},B.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.name=""),null!=e.name&&e.hasOwnProperty("name")&&(n.name=e.name),n},B.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},B),t.ListOperationsRequest=(s.prototype.name="",s.prototype.filter="",s.prototype.pageSize=0,s.prototype.pageToken="",s.create=function(e){return new s(e)},s.encode=function(e,t){return t=t||r.create(),null!=e.filter&&Object.hasOwnProperty.call(e,"filter")&&t.uint32(10).string(e.filter),null!=e.pageSize&&Object.hasOwnProperty.call(e,"pageSize")&&t.uint32(16).int32(e.pageSize),null!=e.pageToken&&Object.hasOwnProperty.call(e,"pageToken")&&t.uint32(26).string(e.pageToken),null!=e.name&&Object.hasOwnProperty.call(e,"name")&&t.uint32(34).string(e.name),t},s.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},s.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new p.google.longrunning.ListOperationsRequest;e.pos>>3){case 4:o.name=e.string();break;case 1:o.filter=e.string();break;case 2:o.pageSize=e.int32();break;case 3:o.pageToken=e.string();break;default:e.skipType(7&r)}}return o},s.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},s.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.name&&e.hasOwnProperty("name")&&!i.isString(e.name)?"name: string expected":null!=e.filter&&e.hasOwnProperty("filter")&&!i.isString(e.filter)?"filter: string expected":null!=e.pageSize&&e.hasOwnProperty("pageSize")&&!i.isInteger(e.pageSize)?"pageSize: integer expected":null!=e.pageToken&&e.hasOwnProperty("pageToken")&&!i.isString(e.pageToken)?"pageToken: string expected":null},s.fromObject=function(e){var t;return e instanceof p.google.longrunning.ListOperationsRequest?e:(t=new p.google.longrunning.ListOperationsRequest,null!=e.name&&(t.name=String(e.name)),null!=e.filter&&(t.filter=String(e.filter)),null!=e.pageSize&&(t.pageSize=0|e.pageSize),null!=e.pageToken&&(t.pageToken=String(e.pageToken)),t)},s.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.filter="",n.pageSize=0,n.pageToken="",n.name=""),null!=e.filter&&e.hasOwnProperty("filter")&&(n.filter=e.filter),null!=e.pageSize&&e.hasOwnProperty("pageSize")&&(n.pageSize=e.pageSize),null!=e.pageToken&&e.hasOwnProperty("pageToken")&&(n.pageToken=e.pageToken),null!=e.name&&e.hasOwnProperty("name")&&(n.name=e.name),n},s.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},s),t.ListOperationsResponse=(u.prototype.operations=i.emptyArray,u.prototype.nextPageToken="",u.create=function(e){return new u(e)},u.encode=function(e,t){if(t=t||r.create(),null!=e.operations&&e.operations.length)for(var n=0;n>>3){case 1:o.operations&&o.operations.length||(o.operations=[]),o.operations.push(p.google.longrunning.Operation.decode(e,e.uint32()));break;case 2:o.nextPageToken=e.string();break;default:e.skipType(7&r)}}return o},u.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},u.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.operations&&e.hasOwnProperty("operations")){if(!Array.isArray(e.operations))return"operations: array expected";for(var t=0;t>>3==1?o.name=e.string():e.skipType(7&r)}return o},L.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},L.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.name&&e.hasOwnProperty("name")&&!i.isString(e.name)?"name: string expected":null},L.fromObject=function(e){var t;return e instanceof p.google.longrunning.CancelOperationRequest?e:(t=new p.google.longrunning.CancelOperationRequest,null!=e.name&&(t.name=String(e.name)),t)},L.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.name=""),null!=e.name&&e.hasOwnProperty("name")&&(n.name=e.name),n},L.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},L),t.DeleteOperationRequest=(U.prototype.name="",U.create=function(e){return new U(e)},U.encode=function(e,t){return t=t||r.create(),null!=e.name&&Object.hasOwnProperty.call(e,"name")&&t.uint32(10).string(e.name),t},U.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},U.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new p.google.longrunning.DeleteOperationRequest;e.pos>>3==1?o.name=e.string():e.skipType(7&r)}return o},U.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},U.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.name&&e.hasOwnProperty("name")&&!i.isString(e.name)?"name: string expected":null},U.fromObject=function(e){var t;return e instanceof p.google.longrunning.DeleteOperationRequest?e:(t=new p.google.longrunning.DeleteOperationRequest,null!=e.name&&(t.name=String(e.name)),t)},U.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.name=""),null!=e.name&&e.hasOwnProperty("name")&&(n.name=e.name),n},U.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},U),t.WaitOperationRequest=(c.prototype.name="",c.prototype.timeout=null,c.create=function(e){return new c(e)},c.encode=function(e,t){return t=t||r.create(),null!=e.name&&Object.hasOwnProperty.call(e,"name")&&t.uint32(10).string(e.name),null!=e.timeout&&Object.hasOwnProperty.call(e,"timeout")&&p.google.protobuf.Duration.encode(e.timeout,t.uint32(18).fork()).ldelim(),t},c.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},c.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new p.google.longrunning.WaitOperationRequest;e.pos>>3){case 1:o.name=e.string();break;case 2:o.timeout=p.google.protobuf.Duration.decode(e,e.uint32());break;default:e.skipType(7&r)}}return o},c.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},c.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.name&&e.hasOwnProperty("name")&&!i.isString(e.name))return"name: string expected";if(null!=e.timeout&&e.hasOwnProperty("timeout")){e=p.google.protobuf.Duration.verify(e.timeout);if(e)return"timeout."+e}return null},c.fromObject=function(e){if(e instanceof p.google.longrunning.WaitOperationRequest)return e;var t=new p.google.longrunning.WaitOperationRequest;if(null!=e.name&&(t.name=String(e.name)),null!=e.timeout){if("object"!=typeof e.timeout)throw TypeError(".google.longrunning.WaitOperationRequest.timeout: object expected");t.timeout=p.google.protobuf.Duration.fromObject(e.timeout)}return t},c.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.name="",n.timeout=null),null!=e.name&&e.hasOwnProperty("name")&&(n.name=e.name),null!=e.timeout&&e.hasOwnProperty("timeout")&&(n.timeout=p.google.protobuf.Duration.toObject(e.timeout,t)),n},c.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},c),t.OperationInfo=(d.prototype.responseType="",d.prototype.metadataType="",d.create=function(e){return new d(e)},d.encode=function(e,t){return t=t||r.create(),null!=e.responseType&&Object.hasOwnProperty.call(e,"responseType")&&t.uint32(10).string(e.responseType),null!=e.metadataType&&Object.hasOwnProperty.call(e,"metadataType")&&t.uint32(18).string(e.metadataType),t},d.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},d.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new p.google.longrunning.OperationInfo;e.pos>>3){case 1:o.responseType=e.string();break;case 2:o.metadataType=e.string();break;default:e.skipType(7&r)}}return o},d.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},d.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.responseType&&e.hasOwnProperty("responseType")&&!i.isString(e.responseType)?"responseType: string expected":null!=e.metadataType&&e.hasOwnProperty("metadataType")&&!i.isString(e.metadataType)?"metadataType: string expected":null},d.fromObject=function(e){var t;return e instanceof p.google.longrunning.OperationInfo?e:(t=new p.google.longrunning.OperationInfo,null!=e.responseType&&(t.responseType=String(e.responseType)),null!=e.metadataType&&(t.metadataType=String(e.metadataType)),t)},d.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.responseType="",n.metadataType=""),null!=e.responseType&&e.hasOwnProperty("responseType")&&(n.responseType=e.responseType),null!=e.metadataType&&e.hasOwnProperty("metadataType")&&(n.metadataType=e.metadataType),n},d.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},d),t),F.api=((n={}).Http=(g.prototype.rules=i.emptyArray,g.prototype.fullyDecodeReservedExpansion=!1,g.create=function(e){return new g(e)},g.encode=function(e,t){if(t=t||r.create(),null!=e.rules&&e.rules.length)for(var n=0;n>>3){case 1:o.rules&&o.rules.length||(o.rules=[]),o.rules.push(p.google.api.HttpRule.decode(e,e.uint32()));break;case 2:o.fullyDecodeReservedExpansion=e.bool();break;default:e.skipType(7&r)}}return o},g.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},g.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.rules&&e.hasOwnProperty("rules")){if(!Array.isArray(e.rules))return"rules: array expected";for(var t=0;t>>3){case 1:o.selector=e.string();break;case 2:o.get=e.string();break;case 3:o.put=e.string();break;case 4:o.post=e.string();break;case 5:o.delete=e.string();break;case 6:o.patch=e.string();break;case 8:o.custom=p.google.api.CustomHttpPattern.decode(e,e.uint32());break;case 7:o.body=e.string();break;case 12:o.responseBody=e.string();break;case 11:o.additionalBindings&&o.additionalBindings.length||(o.additionalBindings=[]),o.additionalBindings.push(p.google.api.HttpRule.decode(e,e.uint32()));break;default:e.skipType(7&r)}}return o},f.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},f.verify=function(e){if("object"!=typeof e||null===e)return"object expected";var t={};if(null!=e.selector&&e.hasOwnProperty("selector")&&!i.isString(e.selector))return"selector: string expected";if(null!=e.get&&e.hasOwnProperty("get")&&(t.pattern=1,!i.isString(e.get)))return"get: string expected";if(null!=e.put&&e.hasOwnProperty("put")){if(1===t.pattern)return"pattern: multiple values";if(t.pattern=1,!i.isString(e.put))return"put: string expected"}if(null!=e.post&&e.hasOwnProperty("post")){if(1===t.pattern)return"pattern: multiple values";if(t.pattern=1,!i.isString(e.post))return"post: string expected"}if(null!=e.delete&&e.hasOwnProperty("delete")){if(1===t.pattern)return"pattern: multiple values";if(t.pattern=1,!i.isString(e.delete))return"delete: string expected"}if(null!=e.patch&&e.hasOwnProperty("patch")){if(1===t.pattern)return"pattern: multiple values";if(t.pattern=1,!i.isString(e.patch))return"patch: string expected"}if(null!=e.custom&&e.hasOwnProperty("custom")){if(1===t.pattern)return"pattern: multiple values";if(t.pattern=1,n=p.google.api.CustomHttpPattern.verify(e.custom))return"custom."+n}if(null!=e.body&&e.hasOwnProperty("body")&&!i.isString(e.body))return"body: string expected";if(null!=e.responseBody&&e.hasOwnProperty("responseBody")&&!i.isString(e.responseBody))return"responseBody: string expected";if(null!=e.additionalBindings&&e.hasOwnProperty("additionalBindings")){if(!Array.isArray(e.additionalBindings))return"additionalBindings: array expected";for(var n,o=0;o>>3){case 1:o.kind=e.string();break;case 2:o.path=e.string();break;default:e.skipType(7&r)}}return o},y.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},y.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.kind&&e.hasOwnProperty("kind")&&!i.isString(e.kind)?"kind: string expected":null!=e.path&&e.hasOwnProperty("path")&&!i.isString(e.path)?"path: string expected":null},y.fromObject=function(e){var t;return e instanceof p.google.api.CustomHttpPattern?e:(t=new p.google.api.CustomHttpPattern,null!=e.kind&&(t.kind=String(e.kind)),null!=e.path&&(t.path=String(e.path)),t)},y.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.kind="",n.path=""),null!=e.kind&&e.hasOwnProperty("kind")&&(n.kind=e.kind),null!=e.path&&e.hasOwnProperty("path")&&(n.path=e.path),n},y.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},y),n),F.protobuf=((t={}).FileDescriptorSet=(J.prototype.file=i.emptyArray,J.create=function(e){return new J(e)},J.encode=function(e,t){if(t=t||r.create(),null!=e.file&&e.file.length)for(var n=0;n>>3==1?(o.file&&o.file.length||(o.file=[]),o.file.push(p.google.protobuf.FileDescriptorProto.decode(e,e.uint32()))):e.skipType(7&r)}return o},J.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},J.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.file&&e.hasOwnProperty("file")){if(!Array.isArray(e.file))return"file: array expected";for(var t=0;t>>3){case 1:o.name=e.string();break;case 2:o.package=e.string();break;case 3:o.dependency&&o.dependency.length||(o.dependency=[]),o.dependency.push(e.string());break;case 10:if(o.publicDependency&&o.publicDependency.length||(o.publicDependency=[]),2==(7&r))for(var i=e.uint32()+e.pos;e.pos>>3){case 1:o.name=e.string();break;case 2:o.field&&o.field.length||(o.field=[]),o.field.push(p.google.protobuf.FieldDescriptorProto.decode(e,e.uint32()));break;case 6:o.extension&&o.extension.length||(o.extension=[]),o.extension.push(p.google.protobuf.FieldDescriptorProto.decode(e,e.uint32()));break;case 3:o.nestedType&&o.nestedType.length||(o.nestedType=[]),o.nestedType.push(p.google.protobuf.DescriptorProto.decode(e,e.uint32()));break;case 4:o.enumType&&o.enumType.length||(o.enumType=[]),o.enumType.push(p.google.protobuf.EnumDescriptorProto.decode(e,e.uint32()));break;case 5:o.extensionRange&&o.extensionRange.length||(o.extensionRange=[]),o.extensionRange.push(p.google.protobuf.DescriptorProto.ExtensionRange.decode(e,e.uint32()));break;case 8:o.oneofDecl&&o.oneofDecl.length||(o.oneofDecl=[]),o.oneofDecl.push(p.google.protobuf.OneofDescriptorProto.decode(e,e.uint32()));break;case 7:o.options=p.google.protobuf.MessageOptions.decode(e,e.uint32());break;case 9:o.reservedRange&&o.reservedRange.length||(o.reservedRange=[]),o.reservedRange.push(p.google.protobuf.DescriptorProto.ReservedRange.decode(e,e.uint32()));break;case 10:o.reservedName&&o.reservedName.length||(o.reservedName=[]),o.reservedName.push(e.string());break;default:e.skipType(7&r)}}return o},O.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},O.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.name&&e.hasOwnProperty("name")&&!i.isString(e.name))return"name: string expected";if(null!=e.field&&e.hasOwnProperty("field")){if(!Array.isArray(e.field))return"field: array expected";for(var t=0;t>>3){case 1:o.start=e.int32();break;case 2:o.end=e.int32();break;case 3:o.options=p.google.protobuf.ExtensionRangeOptions.decode(e,e.uint32());break;default:e.skipType(7&r)}}return o},b.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},b.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.start&&e.hasOwnProperty("start")&&!i.isInteger(e.start))return"start: integer expected";if(null!=e.end&&e.hasOwnProperty("end")&&!i.isInteger(e.end))return"end: integer expected";if(null!=e.options&&e.hasOwnProperty("options")){e=p.google.protobuf.ExtensionRangeOptions.verify(e.options);if(e)return"options."+e}return null},b.fromObject=function(e){if(e instanceof p.google.protobuf.DescriptorProto.ExtensionRange)return e;var t=new p.google.protobuf.DescriptorProto.ExtensionRange;if(null!=e.start&&(t.start=0|e.start),null!=e.end&&(t.end=0|e.end),null!=e.options){if("object"!=typeof e.options)throw TypeError(".google.protobuf.DescriptorProto.ExtensionRange.options: object expected");t.options=p.google.protobuf.ExtensionRangeOptions.fromObject(e.options)}return t},b.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.start=0,n.end=0,n.options=null),null!=e.start&&e.hasOwnProperty("start")&&(n.start=e.start),null!=e.end&&e.hasOwnProperty("end")&&(n.end=e.end),null!=e.options&&e.hasOwnProperty("options")&&(n.options=p.google.protobuf.ExtensionRangeOptions.toObject(e.options,t)),n},b.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},b),O.ReservedRange=(m.prototype.start=0,m.prototype.end=0,m.create=function(e){return new m(e)},m.encode=function(e,t){return t=t||r.create(),null!=e.start&&Object.hasOwnProperty.call(e,"start")&&t.uint32(8).int32(e.start),null!=e.end&&Object.hasOwnProperty.call(e,"end")&&t.uint32(16).int32(e.end),t},m.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},m.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new p.google.protobuf.DescriptorProto.ReservedRange;e.pos>>3){case 1:o.start=e.int32();break;case 2:o.end=e.int32();break;default:e.skipType(7&r)}}return o},m.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},m.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.start&&e.hasOwnProperty("start")&&!i.isInteger(e.start)?"start: integer expected":null!=e.end&&e.hasOwnProperty("end")&&!i.isInteger(e.end)?"end: integer expected":null},m.fromObject=function(e){var t;return e instanceof p.google.protobuf.DescriptorProto.ReservedRange?e:(t=new p.google.protobuf.DescriptorProto.ReservedRange,null!=e.start&&(t.start=0|e.start),null!=e.end&&(t.end=0|e.end),t)},m.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.start=0,n.end=0),null!=e.start&&e.hasOwnProperty("start")&&(n.start=e.start),null!=e.end&&e.hasOwnProperty("end")&&(n.end=e.end),n},m.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},m),O),t.ExtensionRangeOptions=(M.prototype.uninterpretedOption=i.emptyArray,M.create=function(e){return new M(e)},M.encode=function(e,t){if(t=t||r.create(),null!=e.uninterpretedOption&&e.uninterpretedOption.length)for(var n=0;n>>3==999?(o.uninterpretedOption&&o.uninterpretedOption.length||(o.uninterpretedOption=[]),o.uninterpretedOption.push(p.google.protobuf.UninterpretedOption.decode(e,e.uint32()))):e.skipType(7&r)}return o},M.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},M.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.uninterpretedOption&&e.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e.uninterpretedOption))return"uninterpretedOption: array expected";for(var t=0;t>>3){case 1:o.name=e.string();break;case 3:o.number=e.int32();break;case 4:o.label=e.int32();break;case 5:o.type=e.int32();break;case 6:o.typeName=e.string();break;case 2:o.extendee=e.string();break;case 7:o.defaultValue=e.string();break;case 9:o.oneofIndex=e.int32();break;case 10:o.jsonName=e.string();break;case 8:o.options=p.google.protobuf.FieldOptions.decode(e,e.uint32());break;case 17:o.proto3Optional=e.bool();break;default:e.skipType(7&r)}}return o},v.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},v.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.name&&e.hasOwnProperty("name")&&!i.isString(e.name))return"name: string expected";if(null!=e.number&&e.hasOwnProperty("number")&&!i.isInteger(e.number))return"number: integer expected";if(null!=e.label&&e.hasOwnProperty("label"))switch(e.label){default:return"label: enum value expected";case 1:case 2:case 3:}if(null!=e.type&&e.hasOwnProperty("type"))switch(e.type){default:return"type: enum value expected";case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:case 10:case 11:case 12:case 13:case 14:case 15:case 16:case 17:case 18:}if(null!=e.typeName&&e.hasOwnProperty("typeName")&&!i.isString(e.typeName))return"typeName: string expected";if(null!=e.extendee&&e.hasOwnProperty("extendee")&&!i.isString(e.extendee))return"extendee: string expected";if(null!=e.defaultValue&&e.hasOwnProperty("defaultValue")&&!i.isString(e.defaultValue))return"defaultValue: string expected";if(null!=e.oneofIndex&&e.hasOwnProperty("oneofIndex")&&!i.isInteger(e.oneofIndex))return"oneofIndex: integer expected";if(null!=e.jsonName&&e.hasOwnProperty("jsonName")&&!i.isString(e.jsonName))return"jsonName: string expected";if(null!=e.options&&e.hasOwnProperty("options")){var t=p.google.protobuf.FieldOptions.verify(e.options);if(t)return"options."+t}return null!=e.proto3Optional&&e.hasOwnProperty("proto3Optional")&&"boolean"!=typeof e.proto3Optional?"proto3Optional: boolean expected":null},v.fromObject=function(e){if(e instanceof p.google.protobuf.FieldDescriptorProto)return e;var t=new p.google.protobuf.FieldDescriptorProto;switch(null!=e.name&&(t.name=String(e.name)),null!=e.number&&(t.number=0|e.number),e.label){case"LABEL_OPTIONAL":case 1:t.label=1;break;case"LABEL_REQUIRED":case 2:t.label=2;break;case"LABEL_REPEATED":case 3:t.label=3}switch(e.type){case"TYPE_DOUBLE":case 1:t.type=1;break;case"TYPE_FLOAT":case 2:t.type=2;break;case"TYPE_INT64":case 3:t.type=3;break;case"TYPE_UINT64":case 4:t.type=4;break;case"TYPE_INT32":case 5:t.type=5;break;case"TYPE_FIXED64":case 6:t.type=6;break;case"TYPE_FIXED32":case 7:t.type=7;break;case"TYPE_BOOL":case 8:t.type=8;break;case"TYPE_STRING":case 9:t.type=9;break;case"TYPE_GROUP":case 10:t.type=10;break;case"TYPE_MESSAGE":case 11:t.type=11;break;case"TYPE_BYTES":case 12:t.type=12;break;case"TYPE_UINT32":case 13:t.type=13;break;case"TYPE_ENUM":case 14:t.type=14;break;case"TYPE_SFIXED32":case 15:t.type=15;break;case"TYPE_SFIXED64":case 16:t.type=16;break;case"TYPE_SINT32":case 17:t.type=17;break;case"TYPE_SINT64":case 18:t.type=18}if(null!=e.typeName&&(t.typeName=String(e.typeName)),null!=e.extendee&&(t.extendee=String(e.extendee)),null!=e.defaultValue&&(t.defaultValue=String(e.defaultValue)),null!=e.oneofIndex&&(t.oneofIndex=0|e.oneofIndex),null!=e.jsonName&&(t.jsonName=String(e.jsonName)),null!=e.options){if("object"!=typeof e.options)throw TypeError(".google.protobuf.FieldDescriptorProto.options: object expected");t.options=p.google.protobuf.FieldOptions.fromObject(e.options)}return null!=e.proto3Optional&&(t.proto3Optional=Boolean(e.proto3Optional)),t},v.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.name="",n.extendee="",n.number=0,n.label=t.enums===String?"LABEL_OPTIONAL":1,n.type=t.enums===String?"TYPE_DOUBLE":1,n.typeName="",n.defaultValue="",n.options=null,n.oneofIndex=0,n.jsonName="",n.proto3Optional=!1),null!=e.name&&e.hasOwnProperty("name")&&(n.name=e.name),null!=e.extendee&&e.hasOwnProperty("extendee")&&(n.extendee=e.extendee),null!=e.number&&e.hasOwnProperty("number")&&(n.number=e.number),null!=e.label&&e.hasOwnProperty("label")&&(n.label=t.enums===String?p.google.protobuf.FieldDescriptorProto.Label[e.label]:e.label),null!=e.type&&e.hasOwnProperty("type")&&(n.type=t.enums===String?p.google.protobuf.FieldDescriptorProto.Type[e.type]:e.type),null!=e.typeName&&e.hasOwnProperty("typeName")&&(n.typeName=e.typeName),null!=e.defaultValue&&e.hasOwnProperty("defaultValue")&&(n.defaultValue=e.defaultValue),null!=e.options&&e.hasOwnProperty("options")&&(n.options=p.google.protobuf.FieldOptions.toObject(e.options,t)),null!=e.oneofIndex&&e.hasOwnProperty("oneofIndex")&&(n.oneofIndex=e.oneofIndex),null!=e.jsonName&&e.hasOwnProperty("jsonName")&&(n.jsonName=e.jsonName),null!=e.proto3Optional&&e.hasOwnProperty("proto3Optional")&&(n.proto3Optional=e.proto3Optional),n},v.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},v.Type=(n={},(e=Object.create(n))[n[1]="TYPE_DOUBLE"]=1,e[n[2]="TYPE_FLOAT"]=2,e[n[3]="TYPE_INT64"]=3,e[n[4]="TYPE_UINT64"]=4,e[n[5]="TYPE_INT32"]=5,e[n[6]="TYPE_FIXED64"]=6,e[n[7]="TYPE_FIXED32"]=7,e[n[8]="TYPE_BOOL"]=8,e[n[9]="TYPE_STRING"]=9,e[n[10]="TYPE_GROUP"]=10,e[n[11]="TYPE_MESSAGE"]=11,e[n[12]="TYPE_BYTES"]=12,e[n[13]="TYPE_UINT32"]=13,e[n[14]="TYPE_ENUM"]=14,e[n[15]="TYPE_SFIXED32"]=15,e[n[16]="TYPE_SFIXED64"]=16,e[n[17]="TYPE_SINT32"]=17,e[n[18]="TYPE_SINT64"]=18,e),v.Label=(n={},(e=Object.create(n))[n[1]="LABEL_OPTIONAL"]=1,e[n[2]="LABEL_REQUIRED"]=2,e[n[3]="LABEL_REPEATED"]=3,e),v),t.OneofDescriptorProto=(w.prototype.name="",w.prototype.options=null,w.create=function(e){return new w(e)},w.encode=function(e,t){return t=t||r.create(),null!=e.name&&Object.hasOwnProperty.call(e,"name")&&t.uint32(10).string(e.name),null!=e.options&&Object.hasOwnProperty.call(e,"options")&&p.google.protobuf.OneofOptions.encode(e.options,t.uint32(18).fork()).ldelim(),t},w.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},w.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new p.google.protobuf.OneofDescriptorProto;e.pos>>3){case 1:o.name=e.string();break;case 2:o.options=p.google.protobuf.OneofOptions.decode(e,e.uint32());break;default:e.skipType(7&r)}}return o},w.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},w.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.name&&e.hasOwnProperty("name")&&!i.isString(e.name))return"name: string expected";if(null!=e.options&&e.hasOwnProperty("options")){e=p.google.protobuf.OneofOptions.verify(e.options);if(e)return"options."+e}return null},w.fromObject=function(e){if(e instanceof p.google.protobuf.OneofDescriptorProto)return e;var t=new p.google.protobuf.OneofDescriptorProto;if(null!=e.name&&(t.name=String(e.name)),null!=e.options){if("object"!=typeof e.options)throw TypeError(".google.protobuf.OneofDescriptorProto.options: object expected");t.options=p.google.protobuf.OneofOptions.fromObject(e.options)}return t},w.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.name="",n.options=null),null!=e.name&&e.hasOwnProperty("name")&&(n.name=e.name),null!=e.options&&e.hasOwnProperty("options")&&(n.options=p.google.protobuf.OneofOptions.toObject(e.options,t)),n},w.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},w),t.EnumDescriptorProto=(P.prototype.name="",P.prototype.value=i.emptyArray,P.prototype.options=null,P.prototype.reservedRange=i.emptyArray,P.prototype.reservedName=i.emptyArray,P.create=function(e){return new P(e)},P.encode=function(e,t){if(t=t||r.create(),null!=e.name&&Object.hasOwnProperty.call(e,"name")&&t.uint32(10).string(e.name),null!=e.value&&e.value.length)for(var n=0;n>>3){case 1:o.name=e.string();break;case 2:o.value&&o.value.length||(o.value=[]),o.value.push(p.google.protobuf.EnumValueDescriptorProto.decode(e,e.uint32()));break;case 3:o.options=p.google.protobuf.EnumOptions.decode(e,e.uint32());break;case 4:o.reservedRange&&o.reservedRange.length||(o.reservedRange=[]),o.reservedRange.push(p.google.protobuf.EnumDescriptorProto.EnumReservedRange.decode(e,e.uint32()));break;case 5:o.reservedName&&o.reservedName.length||(o.reservedName=[]),o.reservedName.push(e.string());break;default:e.skipType(7&r)}}return o},P.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},P.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.name&&e.hasOwnProperty("name")&&!i.isString(e.name))return"name: string expected";if(null!=e.value&&e.hasOwnProperty("value")){if(!Array.isArray(e.value))return"value: array expected";for(var t=0;t>>3){case 1:o.start=e.int32();break;case 2:o.end=e.int32();break;default:e.skipType(7&r)}}return o},_.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},_.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.start&&e.hasOwnProperty("start")&&!i.isInteger(e.start)?"start: integer expected":null!=e.end&&e.hasOwnProperty("end")&&!i.isInteger(e.end)?"end: integer expected":null},_.fromObject=function(e){var t;return e instanceof p.google.protobuf.EnumDescriptorProto.EnumReservedRange?e:(t=new p.google.protobuf.EnumDescriptorProto.EnumReservedRange,null!=e.start&&(t.start=0|e.start),null!=e.end&&(t.end=0|e.end),t)},_.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.start=0,n.end=0),null!=e.start&&e.hasOwnProperty("start")&&(n.start=e.start),null!=e.end&&e.hasOwnProperty("end")&&(n.end=e.end),n},_.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},_),P),t.EnumValueDescriptorProto=(j.prototype.name="",j.prototype.number=0,j.prototype.options=null,j.create=function(e){return new j(e)},j.encode=function(e,t){return t=t||r.create(),null!=e.name&&Object.hasOwnProperty.call(e,"name")&&t.uint32(10).string(e.name),null!=e.number&&Object.hasOwnProperty.call(e,"number")&&t.uint32(16).int32(e.number),null!=e.options&&Object.hasOwnProperty.call(e,"options")&&p.google.protobuf.EnumValueOptions.encode(e.options,t.uint32(26).fork()).ldelim(),t},j.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},j.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new p.google.protobuf.EnumValueDescriptorProto;e.pos>>3){case 1:o.name=e.string();break;case 2:o.number=e.int32();break;case 3:o.options=p.google.protobuf.EnumValueOptions.decode(e,e.uint32());break;default:e.skipType(7&r)}}return o},j.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},j.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.name&&e.hasOwnProperty("name")&&!i.isString(e.name))return"name: string expected";if(null!=e.number&&e.hasOwnProperty("number")&&!i.isInteger(e.number))return"number: integer expected";if(null!=e.options&&e.hasOwnProperty("options")){e=p.google.protobuf.EnumValueOptions.verify(e.options);if(e)return"options."+e}return null},j.fromObject=function(e){if(e instanceof p.google.protobuf.EnumValueDescriptorProto)return e;var t=new p.google.protobuf.EnumValueDescriptorProto;if(null!=e.name&&(t.name=String(e.name)),null!=e.number&&(t.number=0|e.number),null!=e.options){if("object"!=typeof e.options)throw TypeError(".google.protobuf.EnumValueDescriptorProto.options: object expected");t.options=p.google.protobuf.EnumValueOptions.fromObject(e.options)}return t},j.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.name="",n.number=0,n.options=null),null!=e.name&&e.hasOwnProperty("name")&&(n.name=e.name),null!=e.number&&e.hasOwnProperty("number")&&(n.number=e.number),null!=e.options&&e.hasOwnProperty("options")&&(n.options=p.google.protobuf.EnumValueOptions.toObject(e.options,t)),n},j.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},j),t.ServiceDescriptorProto=(S.prototype.name="",S.prototype.method=i.emptyArray,S.prototype.options=null,S.create=function(e){return new S(e)},S.encode=function(e,t){if(t=t||r.create(),null!=e.name&&Object.hasOwnProperty.call(e,"name")&&t.uint32(10).string(e.name),null!=e.method&&e.method.length)for(var n=0;n>>3){case 1:o.name=e.string();break;case 2:o.method&&o.method.length||(o.method=[]),o.method.push(p.google.protobuf.MethodDescriptorProto.decode(e,e.uint32()));break;case 3:o.options=p.google.protobuf.ServiceOptions.decode(e,e.uint32());break;default:e.skipType(7&r)}}return o},S.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},S.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.name&&e.hasOwnProperty("name")&&!i.isString(e.name))return"name: string expected";if(null!=e.method&&e.hasOwnProperty("method")){if(!Array.isArray(e.method))return"method: array expected";for(var t=0;t>>3){case 1:o.name=e.string();break;case 2:o.inputType=e.string();break;case 3:o.outputType=e.string();break;case 4:o.options=p.google.protobuf.MethodOptions.decode(e,e.uint32());break;case 5:o.clientStreaming=e.bool();break;case 6:o.serverStreaming=e.bool();break;default:e.skipType(7&r)}}return o},x.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},x.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.name&&e.hasOwnProperty("name")&&!i.isString(e.name))return"name: string expected";if(null!=e.inputType&&e.hasOwnProperty("inputType")&&!i.isString(e.inputType))return"inputType: string expected";if(null!=e.outputType&&e.hasOwnProperty("outputType")&&!i.isString(e.outputType))return"outputType: string expected";if(null!=e.options&&e.hasOwnProperty("options")){var t=p.google.protobuf.MethodOptions.verify(e.options);if(t)return"options."+t}return null!=e.clientStreaming&&e.hasOwnProperty("clientStreaming")&&"boolean"!=typeof e.clientStreaming?"clientStreaming: boolean expected":null!=e.serverStreaming&&e.hasOwnProperty("serverStreaming")&&"boolean"!=typeof e.serverStreaming?"serverStreaming: boolean expected":null},x.fromObject=function(e){if(e instanceof p.google.protobuf.MethodDescriptorProto)return e;var t=new p.google.protobuf.MethodDescriptorProto;if(null!=e.name&&(t.name=String(e.name)),null!=e.inputType&&(t.inputType=String(e.inputType)),null!=e.outputType&&(t.outputType=String(e.outputType)),null!=e.options){if("object"!=typeof e.options)throw TypeError(".google.protobuf.MethodDescriptorProto.options: object expected");t.options=p.google.protobuf.MethodOptions.fromObject(e.options)}return null!=e.clientStreaming&&(t.clientStreaming=Boolean(e.clientStreaming)),null!=e.serverStreaming&&(t.serverStreaming=Boolean(e.serverStreaming)),t},x.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.name="",n.inputType="",n.outputType="",n.options=null,n.clientStreaming=!1,n.serverStreaming=!1),null!=e.name&&e.hasOwnProperty("name")&&(n.name=e.name),null!=e.inputType&&e.hasOwnProperty("inputType")&&(n.inputType=e.inputType),null!=e.outputType&&e.hasOwnProperty("outputType")&&(n.outputType=e.outputType),null!=e.options&&e.hasOwnProperty("options")&&(n.options=p.google.protobuf.MethodOptions.toObject(e.options,t)),null!=e.clientStreaming&&e.hasOwnProperty("clientStreaming")&&(n.clientStreaming=e.clientStreaming),null!=e.serverStreaming&&e.hasOwnProperty("serverStreaming")&&(n.serverStreaming=e.serverStreaming),n},x.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},x),t.FileOptions=(k.prototype.javaPackage="",k.prototype.javaOuterClassname="",k.prototype.javaMultipleFiles=!1,k.prototype.javaGenerateEqualsAndHash=!1,k.prototype.javaStringCheckUtf8=!1,k.prototype.optimizeFor=1,k.prototype.goPackage="",k.prototype.ccGenericServices=!1,k.prototype.javaGenericServices=!1,k.prototype.pyGenericServices=!1,k.prototype.phpGenericServices=!1,k.prototype.deprecated=!1,k.prototype.ccEnableArenas=!0,k.prototype.objcClassPrefix="",k.prototype.csharpNamespace="",k.prototype.swiftPrefix="",k.prototype.phpClassPrefix="",k.prototype.phpNamespace="",k.prototype.phpMetadataNamespace="",k.prototype.rubyPackage="",k.prototype.uninterpretedOption=i.emptyArray,k.create=function(e){return new k(e)},k.encode=function(e,t){if(t=t||r.create(),null!=e.javaPackage&&Object.hasOwnProperty.call(e,"javaPackage")&&t.uint32(10).string(e.javaPackage),null!=e.javaOuterClassname&&Object.hasOwnProperty.call(e,"javaOuterClassname")&&t.uint32(66).string(e.javaOuterClassname),null!=e.optimizeFor&&Object.hasOwnProperty.call(e,"optimizeFor")&&t.uint32(72).int32(e.optimizeFor),null!=e.javaMultipleFiles&&Object.hasOwnProperty.call(e,"javaMultipleFiles")&&t.uint32(80).bool(e.javaMultipleFiles),null!=e.goPackage&&Object.hasOwnProperty.call(e,"goPackage")&&t.uint32(90).string(e.goPackage),null!=e.ccGenericServices&&Object.hasOwnProperty.call(e,"ccGenericServices")&&t.uint32(128).bool(e.ccGenericServices),null!=e.javaGenericServices&&Object.hasOwnProperty.call(e,"javaGenericServices")&&t.uint32(136).bool(e.javaGenericServices),null!=e.pyGenericServices&&Object.hasOwnProperty.call(e,"pyGenericServices")&&t.uint32(144).bool(e.pyGenericServices),null!=e.javaGenerateEqualsAndHash&&Object.hasOwnProperty.call(e,"javaGenerateEqualsAndHash")&&t.uint32(160).bool(e.javaGenerateEqualsAndHash),null!=e.deprecated&&Object.hasOwnProperty.call(e,"deprecated")&&t.uint32(184).bool(e.deprecated),null!=e.javaStringCheckUtf8&&Object.hasOwnProperty.call(e,"javaStringCheckUtf8")&&t.uint32(216).bool(e.javaStringCheckUtf8),null!=e.ccEnableArenas&&Object.hasOwnProperty.call(e,"ccEnableArenas")&&t.uint32(248).bool(e.ccEnableArenas),null!=e.objcClassPrefix&&Object.hasOwnProperty.call(e,"objcClassPrefix")&&t.uint32(290).string(e.objcClassPrefix),null!=e.csharpNamespace&&Object.hasOwnProperty.call(e,"csharpNamespace")&&t.uint32(298).string(e.csharpNamespace),null!=e.swiftPrefix&&Object.hasOwnProperty.call(e,"swiftPrefix")&&t.uint32(314).string(e.swiftPrefix),null!=e.phpClassPrefix&&Object.hasOwnProperty.call(e,"phpClassPrefix")&&t.uint32(322).string(e.phpClassPrefix),null!=e.phpNamespace&&Object.hasOwnProperty.call(e,"phpNamespace")&&t.uint32(330).string(e.phpNamespace),null!=e.phpGenericServices&&Object.hasOwnProperty.call(e,"phpGenericServices")&&t.uint32(336).bool(e.phpGenericServices),null!=e.phpMetadataNamespace&&Object.hasOwnProperty.call(e,"phpMetadataNamespace")&&t.uint32(354).string(e.phpMetadataNamespace),null!=e.rubyPackage&&Object.hasOwnProperty.call(e,"rubyPackage")&&t.uint32(362).string(e.rubyPackage),null!=e.uninterpretedOption&&e.uninterpretedOption.length)for(var n=0;n>>3){case 1:o.javaPackage=e.string();break;case 8:o.javaOuterClassname=e.string();break;case 10:o.javaMultipleFiles=e.bool();break;case 20:o.javaGenerateEqualsAndHash=e.bool();break;case 27:o.javaStringCheckUtf8=e.bool();break;case 9:o.optimizeFor=e.int32();break;case 11:o.goPackage=e.string();break;case 16:o.ccGenericServices=e.bool();break;case 17:o.javaGenericServices=e.bool();break;case 18:o.pyGenericServices=e.bool();break;case 42:o.phpGenericServices=e.bool();break;case 23:o.deprecated=e.bool();break;case 31:o.ccEnableArenas=e.bool();break;case 36:o.objcClassPrefix=e.string();break;case 37:o.csharpNamespace=e.string();break;case 39:o.swiftPrefix=e.string();break;case 40:o.phpClassPrefix=e.string();break;case 41:o.phpNamespace=e.string();break;case 44:o.phpMetadataNamespace=e.string();break;case 45:o.rubyPackage=e.string();break;case 999:o.uninterpretedOption&&o.uninterpretedOption.length||(o.uninterpretedOption=[]),o.uninterpretedOption.push(p.google.protobuf.UninterpretedOption.decode(e,e.uint32()));break;default:e.skipType(7&r)}}return o},k.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},k.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.javaPackage&&e.hasOwnProperty("javaPackage")&&!i.isString(e.javaPackage))return"javaPackage: string expected";if(null!=e.javaOuterClassname&&e.hasOwnProperty("javaOuterClassname")&&!i.isString(e.javaOuterClassname))return"javaOuterClassname: string expected";if(null!=e.javaMultipleFiles&&e.hasOwnProperty("javaMultipleFiles")&&"boolean"!=typeof e.javaMultipleFiles)return"javaMultipleFiles: boolean expected";if(null!=e.javaGenerateEqualsAndHash&&e.hasOwnProperty("javaGenerateEqualsAndHash")&&"boolean"!=typeof e.javaGenerateEqualsAndHash)return"javaGenerateEqualsAndHash: boolean expected";if(null!=e.javaStringCheckUtf8&&e.hasOwnProperty("javaStringCheckUtf8")&&"boolean"!=typeof e.javaStringCheckUtf8)return"javaStringCheckUtf8: boolean expected";if(null!=e.optimizeFor&&e.hasOwnProperty("optimizeFor"))switch(e.optimizeFor){default:return"optimizeFor: enum value expected";case 1:case 2:case 3:}if(null!=e.goPackage&&e.hasOwnProperty("goPackage")&&!i.isString(e.goPackage))return"goPackage: string expected";if(null!=e.ccGenericServices&&e.hasOwnProperty("ccGenericServices")&&"boolean"!=typeof e.ccGenericServices)return"ccGenericServices: boolean expected";if(null!=e.javaGenericServices&&e.hasOwnProperty("javaGenericServices")&&"boolean"!=typeof e.javaGenericServices)return"javaGenericServices: boolean expected";if(null!=e.pyGenericServices&&e.hasOwnProperty("pyGenericServices")&&"boolean"!=typeof e.pyGenericServices)return"pyGenericServices: boolean expected";if(null!=e.phpGenericServices&&e.hasOwnProperty("phpGenericServices")&&"boolean"!=typeof e.phpGenericServices)return"phpGenericServices: boolean expected";if(null!=e.deprecated&&e.hasOwnProperty("deprecated")&&"boolean"!=typeof e.deprecated)return"deprecated: boolean expected";if(null!=e.ccEnableArenas&&e.hasOwnProperty("ccEnableArenas")&&"boolean"!=typeof e.ccEnableArenas)return"ccEnableArenas: boolean expected";if(null!=e.objcClassPrefix&&e.hasOwnProperty("objcClassPrefix")&&!i.isString(e.objcClassPrefix))return"objcClassPrefix: string expected";if(null!=e.csharpNamespace&&e.hasOwnProperty("csharpNamespace")&&!i.isString(e.csharpNamespace))return"csharpNamespace: string expected";if(null!=e.swiftPrefix&&e.hasOwnProperty("swiftPrefix")&&!i.isString(e.swiftPrefix))return"swiftPrefix: string expected";if(null!=e.phpClassPrefix&&e.hasOwnProperty("phpClassPrefix")&&!i.isString(e.phpClassPrefix))return"phpClassPrefix: string expected";if(null!=e.phpNamespace&&e.hasOwnProperty("phpNamespace")&&!i.isString(e.phpNamespace))return"phpNamespace: string expected";if(null!=e.phpMetadataNamespace&&e.hasOwnProperty("phpMetadataNamespace")&&!i.isString(e.phpMetadataNamespace))return"phpMetadataNamespace: string expected";if(null!=e.rubyPackage&&e.hasOwnProperty("rubyPackage")&&!i.isString(e.rubyPackage))return"rubyPackage: string expected";if(null!=e.uninterpretedOption&&e.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e.uninterpretedOption))return"uninterpretedOption: array expected";for(var t=0;t>>3){case 1:o.messageSetWireFormat=e.bool();break;case 2:o.noStandardDescriptorAccessor=e.bool();break;case 3:o.deprecated=e.bool();break;case 7:o.mapEntry=e.bool();break;case 999:o.uninterpretedOption&&o.uninterpretedOption.length||(o.uninterpretedOption=[]),o.uninterpretedOption.push(p.google.protobuf.UninterpretedOption.decode(e,e.uint32()));break;default:e.skipType(7&r)}}return o},D.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},D.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.messageSetWireFormat&&e.hasOwnProperty("messageSetWireFormat")&&"boolean"!=typeof e.messageSetWireFormat)return"messageSetWireFormat: boolean expected";if(null!=e.noStandardDescriptorAccessor&&e.hasOwnProperty("noStandardDescriptorAccessor")&&"boolean"!=typeof e.noStandardDescriptorAccessor)return"noStandardDescriptorAccessor: boolean expected";if(null!=e.deprecated&&e.hasOwnProperty("deprecated")&&"boolean"!=typeof e.deprecated)return"deprecated: boolean expected";if(null!=e.mapEntry&&e.hasOwnProperty("mapEntry")&&"boolean"!=typeof e.mapEntry)return"mapEntry: boolean expected";if(null!=e.uninterpretedOption&&e.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e.uninterpretedOption))return"uninterpretedOption: array expected";for(var t=0;t>>3){case 1:o.ctype=e.int32();break;case 2:o.packed=e.bool();break;case 6:o.jstype=e.int32();break;case 5:o.lazy=e.bool();break;case 3:o.deprecated=e.bool();break;case 10:o.weak=e.bool();break;case 999:o.uninterpretedOption&&o.uninterpretedOption.length||(o.uninterpretedOption=[]),o.uninterpretedOption.push(p.google.protobuf.UninterpretedOption.decode(e,e.uint32()));break;default:e.skipType(7&r)}}return o},T.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},T.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.ctype&&e.hasOwnProperty("ctype"))switch(e.ctype){default:return"ctype: enum value expected";case 0:case 1:case 2:}if(null!=e.packed&&e.hasOwnProperty("packed")&&"boolean"!=typeof e.packed)return"packed: boolean expected";if(null!=e.jstype&&e.hasOwnProperty("jstype"))switch(e.jstype){default:return"jstype: enum value expected";case 0:case 1:case 2:}if(null!=e.lazy&&e.hasOwnProperty("lazy")&&"boolean"!=typeof e.lazy)return"lazy: boolean expected";if(null!=e.deprecated&&e.hasOwnProperty("deprecated")&&"boolean"!=typeof e.deprecated)return"deprecated: boolean expected";if(null!=e.weak&&e.hasOwnProperty("weak")&&"boolean"!=typeof e.weak)return"weak: boolean expected";if(null!=e.uninterpretedOption&&e.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e.uninterpretedOption))return"uninterpretedOption: array expected";for(var t=0;t>>3==999?(o.uninterpretedOption&&o.uninterpretedOption.length||(o.uninterpretedOption=[]),o.uninterpretedOption.push(p.google.protobuf.UninterpretedOption.decode(e,e.uint32()))):e.skipType(7&r)}return o},H.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},H.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.uninterpretedOption&&e.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e.uninterpretedOption))return"uninterpretedOption: array expected";for(var t=0;t>>3){case 2:o.allowAlias=e.bool();break;case 3:o.deprecated=e.bool();break;case 999:o.uninterpretedOption&&o.uninterpretedOption.length||(o.uninterpretedOption=[]),o.uninterpretedOption.push(p.google.protobuf.UninterpretedOption.decode(e,e.uint32()));break;default:e.skipType(7&r)}}return o},E.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},E.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.allowAlias&&e.hasOwnProperty("allowAlias")&&"boolean"!=typeof e.allowAlias)return"allowAlias: boolean expected";if(null!=e.deprecated&&e.hasOwnProperty("deprecated")&&"boolean"!=typeof e.deprecated)return"deprecated: boolean expected";if(null!=e.uninterpretedOption&&e.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e.uninterpretedOption))return"uninterpretedOption: array expected";for(var t=0;t>>3){case 1:o.deprecated=e.bool();break;case 999:o.uninterpretedOption&&o.uninterpretedOption.length||(o.uninterpretedOption=[]),o.uninterpretedOption.push(p.google.protobuf.UninterpretedOption.decode(e,e.uint32()));break;default:e.skipType(7&r)}}return o},z.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},z.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.deprecated&&e.hasOwnProperty("deprecated")&&"boolean"!=typeof e.deprecated)return"deprecated: boolean expected";if(null!=e.uninterpretedOption&&e.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e.uninterpretedOption))return"uninterpretedOption: array expected";for(var t=0;t>>3){case 33:o.deprecated=e.bool();break;case 999:o.uninterpretedOption&&o.uninterpretedOption.length||(o.uninterpretedOption=[]),o.uninterpretedOption.push(p.google.protobuf.UninterpretedOption.decode(e,e.uint32()));break;case 1049:o[".google.api.defaultHost"]=e.string();break;case 1050:o[".google.api.oauthScopes"]=e.string();break;default:e.skipType(7&r)}}return o},A.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},A.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.deprecated&&e.hasOwnProperty("deprecated")&&"boolean"!=typeof e.deprecated)return"deprecated: boolean expected";if(null!=e.uninterpretedOption&&e.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e.uninterpretedOption))return"uninterpretedOption: array expected";for(var t=0;t>>3){case 33:o.deprecated=e.bool();break;case 34:o.idempotencyLevel=e.int32();break;case 999:o.uninterpretedOption&&o.uninterpretedOption.length||(o.uninterpretedOption=[]),o.uninterpretedOption.push(p.google.protobuf.UninterpretedOption.decode(e,e.uint32()));break;case 1049:o[".google.longrunning.operationInfo"]=p.google.longrunning.OperationInfo.decode(e,e.uint32());break;case 72295728:o[".google.api.http"]=p.google.api.HttpRule.decode(e,e.uint32());break;case 1051:o[".google.api.methodSignature"]&&o[".google.api.methodSignature"].length||(o[".google.api.methodSignature"]=[]),o[".google.api.methodSignature"].push(e.string());break;default:e.skipType(7&r)}}return o},N.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},N.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.deprecated&&e.hasOwnProperty("deprecated")&&"boolean"!=typeof e.deprecated)return"deprecated: boolean expected";if(null!=e.idempotencyLevel&&e.hasOwnProperty("idempotencyLevel"))switch(e.idempotencyLevel){default:return"idempotencyLevel: enum value expected";case 0:case 1:case 2:}if(null!=e.uninterpretedOption&&e.hasOwnProperty("uninterpretedOption")){if(!Array.isArray(e.uninterpretedOption))return"uninterpretedOption: array expected";for(var t=0;t>>3){case 2:o.name&&o.name.length||(o.name=[]),o.name.push(p.google.protobuf.UninterpretedOption.NamePart.decode(e,e.uint32()));break;case 3:o.identifierValue=e.string();break;case 4:o.positiveIntValue=e.uint64();break;case 5:o.negativeIntValue=e.int64();break;case 6:o.doubleValue=e.double();break;case 7:o.stringValue=e.bytes();break;case 8:o.aggregateValue=e.string();break;default:e.skipType(7&r)}}return o},I.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},I.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.name&&e.hasOwnProperty("name")){if(!Array.isArray(e.name))return"name: array expected";for(var t=0;t>>0,e.positiveIntValue.high>>>0).toNumber(!0))),null!=e.negativeIntValue&&(i.Long?(t.negativeIntValue=i.Long.fromValue(e.negativeIntValue)).unsigned=!1:"string"==typeof e.negativeIntValue?t.negativeIntValue=parseInt(e.negativeIntValue,10):"number"==typeof e.negativeIntValue?t.negativeIntValue=e.negativeIntValue:"object"==typeof e.negativeIntValue&&(t.negativeIntValue=new i.LongBits(e.negativeIntValue.low>>>0,e.negativeIntValue.high>>>0).toNumber())),null!=e.doubleValue&&(t.doubleValue=Number(e.doubleValue)),null!=e.stringValue&&("string"==typeof e.stringValue?i.base64.decode(e.stringValue,t.stringValue=i.newBuffer(i.base64.length(e.stringValue)),0):e.stringValue.length&&(t.stringValue=e.stringValue)),null!=e.aggregateValue&&(t.aggregateValue=String(e.aggregateValue)),t},I.toObject=function(e,t){var n,o={};if(((t=t||{}).arrays||t.defaults)&&(o.name=[]),t.defaults&&(o.identifierValue="",i.Long?(n=new i.Long(0,0,!0),o.positiveIntValue=t.longs===String?n.toString():t.longs===Number?n.toNumber():n):o.positiveIntValue=t.longs===String?"0":0,i.Long?(n=new i.Long(0,0,!1),o.negativeIntValue=t.longs===String?n.toString():t.longs===Number?n.toNumber():n):o.negativeIntValue=t.longs===String?"0":0,o.doubleValue=0,t.bytes===String?o.stringValue="":(o.stringValue=[],t.bytes!==Array&&(o.stringValue=i.newBuffer(o.stringValue))),o.aggregateValue=""),e.name&&e.name.length){o.name=[];for(var r=0;r>>0,e.positiveIntValue.high>>>0).toNumber(!0):e.positiveIntValue),null!=e.negativeIntValue&&e.hasOwnProperty("negativeIntValue")&&("number"==typeof e.negativeIntValue?o.negativeIntValue=t.longs===String?String(e.negativeIntValue):e.negativeIntValue:o.negativeIntValue=t.longs===String?i.Long.prototype.toString.call(e.negativeIntValue):t.longs===Number?new i.LongBits(e.negativeIntValue.low>>>0,e.negativeIntValue.high>>>0).toNumber():e.negativeIntValue),null!=e.doubleValue&&e.hasOwnProperty("doubleValue")&&(o.doubleValue=t.json&&!isFinite(e.doubleValue)?String(e.doubleValue):e.doubleValue),null!=e.stringValue&&e.hasOwnProperty("stringValue")&&(o.stringValue=t.bytes===String?i.base64.encode(e.stringValue,0,e.stringValue.length):t.bytes===Array?Array.prototype.slice.call(e.stringValue):e.stringValue),null!=e.aggregateValue&&e.hasOwnProperty("aggregateValue")&&(o.aggregateValue=e.aggregateValue),o},I.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},I.NamePart=(q.prototype.namePart="",q.prototype.isExtension=!1,q.create=function(e){return new q(e)},q.encode=function(e,t){return(t=t||r.create()).uint32(10).string(e.namePart),t.uint32(16).bool(e.isExtension),t},q.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},q.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new p.google.protobuf.UninterpretedOption.NamePart;e.pos>>3){case 1:o.namePart=e.string();break;case 2:o.isExtension=e.bool();break;default:e.skipType(7&r)}}if(!o.hasOwnProperty("namePart"))throw i.ProtocolError("missing required 'namePart'",{instance:o});if(o.hasOwnProperty("isExtension"))return o;throw i.ProtocolError("missing required 'isExtension'",{instance:o})},q.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},q.verify=function(e){return"object"!=typeof e||null===e?"object expected":i.isString(e.namePart)?"boolean"!=typeof e.isExtension?"isExtension: boolean expected":null:"namePart: string expected"},q.fromObject=function(e){var t;return e instanceof p.google.protobuf.UninterpretedOption.NamePart?e:(t=new p.google.protobuf.UninterpretedOption.NamePart,null!=e.namePart&&(t.namePart=String(e.namePart)),null!=e.isExtension&&(t.isExtension=Boolean(e.isExtension)),t)},q.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.namePart="",n.isExtension=!1),null!=e.namePart&&e.hasOwnProperty("namePart")&&(n.namePart=e.namePart),null!=e.isExtension&&e.hasOwnProperty("isExtension")&&(n.isExtension=e.isExtension),n},q.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},q),I),t.SourceCodeInfo=(Y.prototype.location=i.emptyArray,Y.create=function(e){return new Y(e)},Y.encode=function(e,t){if(t=t||r.create(),null!=e.location&&e.location.length)for(var n=0;n>>3==1?(o.location&&o.location.length||(o.location=[]),o.location.push(p.google.protobuf.SourceCodeInfo.Location.decode(e,e.uint32()))):e.skipType(7&r)}return o},Y.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},Y.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.location&&e.hasOwnProperty("location")){if(!Array.isArray(e.location))return"location: array expected";for(var t=0;t>>3){case 1:if(o.path&&o.path.length||(o.path=[]),2==(7&r))for(var i=e.uint32()+e.pos;e.pos>>3==1?(o.annotation&&o.annotation.length||(o.annotation=[]),o.annotation.push(p.google.protobuf.GeneratedCodeInfo.Annotation.decode(e,e.uint32()))):e.skipType(7&r)}return o},W.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},W.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.annotation&&e.hasOwnProperty("annotation")){if(!Array.isArray(e.annotation))return"annotation: array expected";for(var t=0;t>>3){case 1:if(o.path&&o.path.length||(o.path=[]),2==(7&r))for(var i=e.uint32()+e.pos;e.pos>>3){case 1:o.type_url=e.string();break;case 2:o.value=e.bytes();break;default:e.skipType(7&r)}}return o},X.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},X.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.type_url&&e.hasOwnProperty("type_url")&&!i.isString(e.type_url)?"type_url: string expected":null!=e.value&&e.hasOwnProperty("value")&&!(e.value&&"number"==typeof e.value.length||i.isString(e.value))?"value: buffer expected":null},X.fromObject=function(e){var t;return e instanceof p.google.protobuf.Any?e:(t=new p.google.protobuf.Any,null!=e.type_url&&(t.type_url=String(e.type_url)),null!=e.value&&("string"==typeof e.value?i.base64.decode(e.value,t.value=i.newBuffer(i.base64.length(e.value)),0):e.value.length&&(t.value=e.value)),t)},X.toObject=function(e,t){var n={};return(t=t||{}).defaults&&(n.type_url="",t.bytes===String?n.value="":(n.value=[],t.bytes!==Array&&(n.value=i.newBuffer(n.value)))),null!=e.type_url&&e.hasOwnProperty("type_url")&&(n.type_url=e.type_url),null!=e.value&&e.hasOwnProperty("value")&&(n.value=t.bytes===String?i.base64.encode(e.value,0,e.value.length):t.bytes===Array?Array.prototype.slice.call(e.value):e.value),n},X.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},X),t.Duration=(K.prototype.seconds=i.Long?i.Long.fromBits(0,0,!1):0,K.prototype.nanos=0,K.create=function(e){return new K(e)},K.encode=function(e,t){return t=t||r.create(),null!=e.seconds&&Object.hasOwnProperty.call(e,"seconds")&&t.uint32(8).int64(e.seconds),null!=e.nanos&&Object.hasOwnProperty.call(e,"nanos")&&t.uint32(16).int32(e.nanos),t},K.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},K.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,o=new p.google.protobuf.Duration;e.pos>>3){case 1:o.seconds=e.int64();break;case 2:o.nanos=e.int32();break;default:e.skipType(7&r)}}return o},K.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},K.verify=function(e){return"object"!=typeof e||null===e?"object expected":null!=e.seconds&&e.hasOwnProperty("seconds")&&!(i.isInteger(e.seconds)||e.seconds&&i.isInteger(e.seconds.low)&&i.isInteger(e.seconds.high))?"seconds: integer|Long expected":null!=e.nanos&&e.hasOwnProperty("nanos")&&!i.isInteger(e.nanos)?"nanos: integer expected":null},K.fromObject=function(e){var t;return e instanceof p.google.protobuf.Duration?e:(t=new p.google.protobuf.Duration,null!=e.seconds&&(i.Long?(t.seconds=i.Long.fromValue(e.seconds)).unsigned=!1:"string"==typeof e.seconds?t.seconds=parseInt(e.seconds,10):"number"==typeof e.seconds?t.seconds=e.seconds:"object"==typeof e.seconds&&(t.seconds=new i.LongBits(e.seconds.low>>>0,e.seconds.high>>>0).toNumber())),null!=e.nanos&&(t.nanos=0|e.nanos),t)},K.toObject=function(e,t){var n,o={};return(t=t||{}).defaults&&(i.Long?(n=new i.Long(0,0,!1),o.seconds=t.longs===String?n.toString():t.longs===Number?n.toNumber():n):o.seconds=t.longs===String?"0":0,o.nanos=0),null!=e.seconds&&e.hasOwnProperty("seconds")&&("number"==typeof e.seconds?o.seconds=t.longs===String?String(e.seconds):e.seconds:o.seconds=t.longs===String?i.Long.prototype.toString.call(e.seconds):t.longs===Number?new i.LongBits(e.seconds.low>>>0,e.seconds.high>>>0).toNumber():e.seconds),null!=e.nanos&&e.hasOwnProperty("nanos")&&(o.nanos=e.nanos),o},K.prototype.toJSON=function(){return this.constructor.toObject(this,o.util.toJSONOptions)},K),t.Empty=(Q.create=function(e){return new Q(e)},Q.encode=function(e,t){return t=t||r.create()},Q.encodeDelimited=function(e,t){return this.encode(e,t).ldelim()},Q.decode=function(e,t){e instanceof a||(e=a.create(e));for(var n=void 0===t?e.len:e.pos+t,t=new p.google.protobuf.Empty;e.pos>>3){case 1:o.code=e.int32();break;case 2:o.message=e.string();break;case 3:o.details&&o.details.length||(o.details=[]),o.details.push(p.google.protobuf.Any.decode(e,e.uint32()));break;default:e.skipType(7&r)}}return o},V.decodeDelimited=function(e){return e instanceof a||(e=new a(e)),this.decode(e,e.uint32())},V.verify=function(e){if("object"!=typeof e||null===e)return"object expected";if(null!=e.code&&e.hasOwnProperty("code")&&!i.isInteger(e.code))return"code: integer expected";if(null!=e.message&&e.hasOwnProperty("message")&&!i.isString(e.message))return"message: string expected";if(null!=e.details&&e.hasOwnProperty("details")){if(!Array.isArray(e.details))return"details: array expected";for(var t=0;t { + +"use strict"; + +/** + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createAPICaller = createAPICaller; +const normalApiCaller_1 = __nccwpck_require__(51161); +function createAPICaller(settings, descriptor) { + if (!descriptor) { + return new normalApiCaller_1.NormalApiCaller(); + } + return descriptor.getApiCaller(settings); +} +//# sourceMappingURL=apiCaller.js.map + +/***/ }), + +/***/ 41984: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/** + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.BundleApiCaller = void 0; +const call_1 = __nccwpck_require__(49746); +const googleError_1 = __nccwpck_require__(34775); +/** + * An implementation of APICaller for bundled calls. + * Uses BundleExecutor to do bundling. + */ +class BundleApiCaller { + constructor(bundler) { + this.bundler = bundler; + } + init(callback) { + if (callback) { + return new call_1.OngoingCall(callback); + } + return new call_1.OngoingCallPromise(); + } + wrap(func) { + return func; + } + call(apiCall, argument, settings, status) { + if (!settings.isBundling) { + throw new googleError_1.GoogleError('Bundling enabled with no isBundling!'); + } + status.call((argument, callback) => { + this.bundler.schedule(apiCall, argument, callback); + return status; + }, argument); + } + fail(canceller, err) { + canceller.callback(err); + } + result(canceller) { + return canceller.promise; + } +} +exports.BundleApiCaller = BundleApiCaller; +//# sourceMappingURL=bundleApiCaller.js.map + +/***/ }), + +/***/ 57910: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/** + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.BundleDescriptor = void 0; +const normalApiCaller_1 = __nccwpck_require__(51161); +const bundleApiCaller_1 = __nccwpck_require__(41984); +const bundleExecutor_1 = __nccwpck_require__(44682); +const util_1 = __nccwpck_require__(24938); +/** + * A descriptor for calls that can be bundled into one call. + */ +class BundleDescriptor { + /** + * Describes the structure of bundled call. + * + * requestDiscriminatorFields may include '.' as a separator, which is used to + * indicate object traversal. This allows fields in nested objects to be used + * to determine what request to bundle. + * + * @property {String} bundledField + * @property {String} requestDiscriminatorFields + * @property {String} subresponseField + * @property {Function} byteLengthFunction + * + * @param {String} bundledField - the repeated field in the request message + * that will have its elements aggregated by bundling. + * @param {String} requestDiscriminatorFields - a list of fields in the + * target request message class that are used to detemrine which request + * messages should be bundled together. + * @param {String} subresponseField - an optional field, when present it + * indicates the field in the response message that should be used to + * demultiplex the response into multiple response messages. + * @param {Function} byteLengthFunction - a function to obtain the byte + * length to be consumed for the bundled field messages. Because Node.JS + * protobuf.js/gRPC uses builtin Objects for the user-visible data and + * internally they are encoded/decoded in protobuf manner, this function + * is actually necessary to calculate the byte length. + * @constructor + */ + constructor(bundledField, requestDiscriminatorFields, subresponseField, byteLengthFunction) { + if (!byteLengthFunction && typeof subresponseField === 'function') { + byteLengthFunction = subresponseField; + subresponseField = null; + } + this.bundledField = bundledField; + this.requestDiscriminatorFields = + requestDiscriminatorFields.map(util_1.toCamelCase); + this.subresponseField = subresponseField; + this.byteLengthFunction = byteLengthFunction; + } + getApiCaller(settings) { + if (settings.isBundling === false) { + return new normalApiCaller_1.NormalApiCaller(); + } + return new bundleApiCaller_1.BundleApiCaller(new bundleExecutor_1.BundleExecutor(settings.bundleOptions, this)); + } +} +exports.BundleDescriptor = BundleDescriptor; +//# sourceMappingURL=bundleDescriptor.js.map + +/***/ }), + +/***/ 44682: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/** + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.BundleExecutor = void 0; +const status_1 = __nccwpck_require__(69124); +const googleError_1 = __nccwpck_require__(34775); +const warnings_1 = __nccwpck_require__(25531); +const bundlingUtils_1 = __nccwpck_require__(90855); +const task_1 = __nccwpck_require__(86922); +function noop() { } +/** + * BundleExecutor stores several timers for each bundle (calls are bundled based + * on the options passed, each bundle has unique ID that is calculated based on + * field values). Each timer fires and sends a call after certain amount of + * time, and if a new request comes to the same bundle, the timer can be + * restarted. + */ +class BundleExecutor { + /** + * Organizes requests for an api service that requires to bundle them. + * + * @param {BundleOptions} bundleOptions - configures strategy this instance + * uses when executing bundled functions. + * @param {BundleDescriptor} bundleDescriptor - the description of the bundling. + * @constructor + */ + constructor(bundleOptions, bundleDescriptor) { + this._options = bundleOptions; + this._descriptor = bundleDescriptor; + this._tasks = {}; + this._timers = {}; + this._invocations = {}; + this._invocationId = 0; + } + /** + * Schedule a method call. + * + * @param {function} apiCall - the function for an API call. + * @param {Object} request - the request object to be bundled with others. + * @param {APICallback} callback - the callback to be called when the method finished. + * @return {function()} - the function to cancel the scheduled invocation. + */ + schedule(apiCall, request, callback) { + const bundleId = (0, bundlingUtils_1.computeBundleId)(request, this._descriptor.requestDiscriminatorFields); + callback = (callback || noop); + if (bundleId === undefined) { + (0, warnings_1.warn)('bundling_schedule_bundleid_undefined', 'The request does not have enough information for request bundling. ' + + `Invoking immediately. Request: ${JSON.stringify(request)} ` + + `discriminator fields: ${this._descriptor.requestDiscriminatorFields}`); + return apiCall(request, callback); + } + if (request[this._descriptor.bundledField] === undefined) { + (0, warnings_1.warn)('bundling_no_bundled_field', `Request does not contain field ${this._descriptor.bundledField} that must present for bundling. ` + + `Invoking immediately. Request: ${JSON.stringify(request)}`); + return apiCall(request, callback); + } + if (!(bundleId in this._tasks)) { + this._tasks[bundleId] = new task_1.Task(apiCall, request, this._descriptor.bundledField, this._descriptor.subresponseField); + } + let task = this._tasks[bundleId]; + callback.id = String(this._invocationId++); + this._invocations[callback.id] = bundleId; + const bundledField = request[this._descriptor.bundledField]; + const elementCount = bundledField.length; + let requestBytes = 0; + // eslint-disable-next-line @typescript-eslint/no-this-alias + const self = this; + bundledField.forEach(obj => { + requestBytes += this._descriptor.byteLengthFunction(obj); + }); + const countLimit = this._options.elementCountLimit || 0; + const byteLimit = this._options.requestByteLimit || 0; + if ((countLimit > 0 && elementCount > countLimit) || + (byteLimit > 0 && requestBytes >= byteLimit)) { + let message; + if (countLimit > 0 && elementCount > countLimit) { + message = + 'The number of elements ' + + elementCount + + ' exceeds the limit ' + + this._options.elementCountLimit; + } + else { + message = + 'The required bytes ' + + requestBytes + + ' exceeds the limit ' + + this._options.requestByteLimit; + } + const error = new googleError_1.GoogleError(message); + error.code = status_1.Status.INVALID_ARGUMENT; + callback(error); + return { + cancel: noop, + }; + } + const existingCount = task.getElementCount(); + const existingBytes = task.getRequestByteSize(); + if ((countLimit > 0 && elementCount + existingCount >= countLimit) || + (byteLimit > 0 && requestBytes + existingBytes >= byteLimit)) { + this._runNow(bundleId); + this._tasks[bundleId] = new task_1.Task(apiCall, request, this._descriptor.bundledField, this._descriptor.subresponseField); + task = this._tasks[bundleId]; + } + task.extend(bundledField, requestBytes, callback); + const ret = { + cancel() { + self._cancel(callback.id); + }, + }; + const countThreshold = this._options.elementCountThreshold || 0; + const sizeThreshold = this._options.requestByteThreshold || 0; + if ((countThreshold > 0 && task.getElementCount() >= countThreshold) || + (sizeThreshold > 0 && task.getRequestByteSize() >= sizeThreshold)) { + this._runNow(bundleId); + return ret; + } + if (!(bundleId in this._timers) && this._options.delayThreshold > 0) { + this._timers[bundleId] = setTimeout(() => { + delete this._timers[bundleId]; + this._runNow(bundleId); + }, this._options.delayThreshold); + } + return ret; + } + /** + * Clears scheduled timeout if it exists. + * + * @param {String} bundleId - the id for the task whose timeout needs to be + * cleared. + * @private + */ + _maybeClearTimeout(bundleId) { + if (bundleId in this._timers) { + const timerId = this._timers[bundleId]; + delete this._timers[bundleId]; + clearTimeout(timerId); + } + } + /** + * Cancels an event. + * + * @param {String} id - The id for the event in the task. + * @private + */ + _cancel(id) { + if (!(id in this._invocations)) { + return; + } + const bundleId = this._invocations[id]; + if (!(bundleId in this._tasks)) { + return; + } + const task = this._tasks[bundleId]; + delete this._invocations[id]; + if (task.cancel(id)) { + this._maybeClearTimeout(bundleId); + delete this._tasks[bundleId]; + } + } + /** + * Invokes a task. + * + * @param {String} bundleId - The id for the task. + * @private + */ + _runNow(bundleId) { + if (!(bundleId in this._tasks)) { + (0, warnings_1.warn)('bundle_runnow_bundleid_unknown', `No such bundleid: ${bundleId}`); + return; + } + this._maybeClearTimeout(bundleId); + const task = this._tasks[bundleId]; + delete this._tasks[bundleId]; + task.run().forEach(id => { + delete this._invocations[id]; + }); + } +} +exports.BundleExecutor = BundleExecutor; +//# sourceMappingURL=bundleExecutor.js.map + +/***/ }), + +/***/ 90855: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/** + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.computeBundleId = computeBundleId; +/** + * Compute the identifier of the `obj`. The objects of the same ID + * will be bundled together. + * + * @param {RequestType} obj - The request object. + * @param {String[]} discriminatorFields - The array of field names. + * A field name may include '.' as a separator, which is used to + * indicate object traversal. + * @return {String|undefined} - the identifier string, or undefined if any + * discriminator fields do not exist. + */ +function computeBundleId(obj, discriminatorFields) { + const ids = []; + let hasIds = false; + for (const field of discriminatorFields) { + const id = at(obj, field); + if (id === undefined) { + ids.push(null); + } + else { + hasIds = true; + ids.push(id); + } + } + if (!hasIds) { + return undefined; + } + return JSON.stringify(ids); +} +/** + * Given an object field path that may contain dots, dig into the obj and find + * the value at the given path. + * @example + * const obj = { + * a: { + * b: 5 + * } + * } + * const id = at(obj, 'a.b'); + * // id = 5 + * @param field Path to the property with `.` notation + * @param obj The object to traverse + * @returns the value at the given path + */ +function at(obj, field) { + const pathParts = field.split('.'); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + let currentObj = obj; + for (const pathPart of pathParts) { + currentObj = currentObj === null || currentObj === void 0 ? void 0 : currentObj[pathPart]; + } + return currentObj; +} +//# sourceMappingURL=bundlingUtils.js.map + +/***/ }), + +/***/ 86922: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/** + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Task = void 0; +exports.deepCopyForResponse = deepCopyForResponse; +const status_1 = __nccwpck_require__(69124); +const googleError_1 = __nccwpck_require__(34775); +/** + * Creates a deep copy of the object with the consideration of subresponse + * fields for bundling. + * + * @param {Object} obj - The source object. + * @param {Object?} subresponseInfo - The information to copy the subset of + * the field for the response. Do nothing if it's null. + * @param {String} subresponseInfo.field - The field name. + * @param {number} subresponseInfo.start - The offset where the copying + * element should starts with. + * @param {number} subresponseInfo.end - The ending index where the copying + * region of the elements ends. + * @return {Object} The copied object. + * @private + */ +function deepCopyForResponse( +// eslint-disable-next-line @typescript-eslint/no-explicit-any +obj, subresponseInfo) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + let result; + if (obj === null) { + return null; + } + if (obj === undefined) { + return undefined; + } + if (Array.isArray(obj)) { + result = []; + obj.forEach(element => { + result.push(deepCopyForResponse(element, null)); + }); + return result; + } + // Some objects (such as ByteBuffer) have copy method. + if (obj.copy !== undefined) { + return obj.copy(); + } + // ArrayBuffer should be copied through slice(). + if (obj instanceof ArrayBuffer) { + return obj.slice(0); + } + if (typeof obj === 'object') { + result = {}; + Object.keys(obj).forEach(key => { + if (subresponseInfo && + key === subresponseInfo.field && + Array.isArray(obj[key])) { + // Note that subresponses are not deep-copied. This is safe because + // those subresponses are not shared among callbacks. + result[key] = obj[key].slice(subresponseInfo.start, subresponseInfo.end); + } + else { + result[key] = deepCopyForResponse(obj[key], null); + } + }); + return result; + } + return obj; +} +class Task { + /** + * A task coordinates the execution of a single bundle. + * + * @param {function} apiCall - The function to conduct calling API. + * @param {Object} bundlingRequest - The base request object to be used + * for the actual API call. + * @param {string} bundledField - The name of the field in bundlingRequest + * to be bundled. + * @param {string=} subresponseField - The name of the field in the response + * to be passed to the callback. + * @constructor + * @private + */ + constructor(apiCall, bundlingRequest, bundledField, subresponseField) { + this._apiCall = apiCall; + this._request = bundlingRequest; + this._bundledField = bundledField; + this._subresponseField = subresponseField; + this._data = []; + } + /** + * Returns the number of elements in a task. + * @return {number} The number of elements. + */ + getElementCount() { + let count = 0; + for (let i = 0; i < this._data.length; ++i) { + count += this._data[i].elements.length; + } + return count; + } + /** + * Returns the total byte size of the elements in a task. + * @return {number} The byte size. + */ + getRequestByteSize() { + let size = 0; + for (let i = 0; i < this._data.length; ++i) { + size += this._data[i].bytes; + } + return size; + } + /** + * Invokes the actual API call with current elements. + * @return {string[]} - the list of ids for invocations to be run. + */ + run() { + if (this._data.length === 0) { + return []; + } + const request = this._request; + const elements = []; + const ids = []; + for (let i = 0; i < this._data.length; ++i) { + elements.push(...this._data[i].elements); + ids.push(this._data[i].callback.id); + } + request[this._bundledField] = elements; + // eslint-disable-next-line @typescript-eslint/no-this-alias + const self = this; + this.callCanceller = this._apiCall(request, (err, response) => { + const responses = []; + if (err) { + self._data.forEach(() => { + responses.push(undefined); + }); + } + else { + let subresponseInfo = null; + if (self._subresponseField) { + subresponseInfo = { + field: self._subresponseField, + start: 0, + }; + } + self._data.forEach(data => { + if (subresponseInfo) { + subresponseInfo.end = + subresponseInfo.start + data.elements.length; + } + responses.push(deepCopyForResponse(response, subresponseInfo)); + if (subresponseInfo) { + subresponseInfo.start = subresponseInfo.end; + } + }); + } + for (let i = 0; i < self._data.length; ++i) { + if (self._data[i].cancelled) { + const error = new googleError_1.GoogleError('cancelled'); + error.code = status_1.Status.CANCELLED; + self._data[i].callback(error); + } + else { + self._data[i].callback(err, responses[i]); + } + } + }); + return ids; + } + /** + * Appends the list of elements into the task. + * @param {Object[]} elements - the new list of elements. + * @param {number} bytes - the byte size required to encode elements in the API. + * @param {APICallback} callback - the callback of the method call. + */ + extend(elements, bytes, callback) { + this._data.push({ + elements, + bytes, + callback, + }); + } + /** + * Cancels a part of elements. + * @param {string} id - The identifier of the part of elements. + * @return {boolean} Whether the entire task will be canceled or not. + */ + cancel(id) { + if (this.callCanceller) { + let allCancelled = true; + this._data.forEach(d => { + if (d.callback.id === id) { + d.cancelled = true; + } + if (!d.cancelled) { + allCancelled = false; + } + }); + if (allCancelled) { + this.callCanceller.cancel(); + } + return allCancelled; + } + for (let i = 0; i < this._data.length; ++i) { + if (this._data[i].callback.id === id) { + const error = new googleError_1.GoogleError('cancelled'); + error.code = status_1.Status.CANCELLED; + this._data[i].callback(error); + this._data.splice(i, 1); + break; + } + } + return this._data.length === 0; + } +} +exports.Task = Task; +//# sourceMappingURL=task.js.map + +/***/ }), + +/***/ 49746: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/** + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.OngoingCallPromise = exports.OngoingCall = void 0; +const status_1 = __nccwpck_require__(69124); +const googleError_1 = __nccwpck_require__(34775); +class OngoingCall { + /** + * OngoingCall manages callback, API calls, and cancellation + * of the API calls. + * @param {APICallback=} callback + * The callback to be called asynchronously when the API call + * finishes. + * @constructor + * @property {APICallback} callback + * The callback function to be called. + * @private + */ + constructor(callback) { + this.callback = callback; + this.completed = false; + } + /** + * Cancels the ongoing promise. + */ + cancel() { + if (this.completed) { + return; + } + this.completed = true; + if (this.cancelFunc) { + this.cancelFunc(); + } + else { + const error = new googleError_1.GoogleError('cancelled'); + error.code = status_1.Status.CANCELLED; + this.callback(error); + } + } + /** + * Call calls the specified function. Result will be used to fulfill + * the promise. + * + * @param {SimpleCallbackFunction} func + * A function for an API call. + * @param {Object} argument + * A request object. + */ + call(func, argument) { + if (this.completed) { + return; + } + const canceller = func(argument, (err, response, next, rawResponse) => { + this.completed = true; + setImmediate(this.callback, err, response, next, rawResponse); + }); + if (canceller instanceof Promise) { + canceller.catch(err => { + setImmediate(this.callback, new googleError_1.GoogleError(err), null, null, null); + }); + } + this.cancelFunc = () => canceller.cancel(); + } +} +exports.OngoingCall = OngoingCall; +class OngoingCallPromise extends OngoingCall { + /** + * GaxPromise is GRPCCallbackWrapper, but it holds a promise when + * the API call finishes. + * @constructor + * @private + */ + constructor() { + let resolveCallback; + let rejectCallback; + const callback = (err, response, next, rawResponse) => { + if (err) { + // If gRPC metadata exist, parsed google.rpc.status details. + if (err.metadata) { + rejectCallback(googleError_1.GoogleError.parseGRPCStatusDetails(err)); + } + else { + rejectCallback(err); + } + } + else if (response !== undefined) { + resolveCallback([response, next || null, rawResponse || null]); + } + else { + throw new googleError_1.GoogleError('Neither error nor response are defined'); + } + }; + const promise = new Promise((resolve, reject) => { + resolveCallback = resolve; + rejectCallback = reject; + }); + super(callback); + this.promise = promise; + this.promise.cancel = () => { + this.cancel(); + }; + } +} +exports.OngoingCallPromise = OngoingCallPromise; +//# sourceMappingURL=call.js.map + +/***/ }), + +/***/ 42236: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/** + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.createApiCall = createApiCall; +/** + * Provides function wrappers that implement page streaming and retrying. + */ +const apiCaller_1 = __nccwpck_require__(75203); +const gax_1 = __nccwpck_require__(4996); +const retries_1 = __nccwpck_require__(61789); +const timeout_1 = __nccwpck_require__(86328); +const streamingApiCaller_1 = __nccwpck_require__(98177); +const warnings_1 = __nccwpck_require__(25531); +/** + * Converts an rpc call into an API call governed by the settings. + * + * In typical usage, `func` will be a promise to a callable used to make an rpc + * request. This will mostly likely be a bound method from a request stub used + * to make an rpc call. It is not a direct function but a Promise instance, + * because of its asynchronism (typically, obtaining the auth information). + * + * The result is a function which manages the API call with the given settings + * and the options on the invocation. + * + * @param {Promise|GRPCCall} func - is either a promise to be used to make + * a bare RPC call, or just a bare RPC call. + * @param {CallSettings} settings - provides the settings for this call + * @param {Descriptor} descriptor - optionally specify the descriptor for + * the method call. + * @return {GaxCall} func - a bound method on a request stub used + * to make an rpc call. + */ +function createApiCall(func, settings, descriptor, +// eslint-disable-next-line @typescript-eslint/no-unused-vars +_fallback // unused here, used in fallback.ts implementation +) { + // we want to be able to accept both promise resolving to a function and a + // function. Currently client librares are only calling this method with a + // promise, but it will change. + const funcPromise = typeof func === 'function' ? Promise.resolve(func) : func; + // the following apiCaller will be used for all calls of this function... + const apiCaller = (0, apiCaller_1.createAPICaller)(settings, descriptor); + return (request, callOptions, callback) => { + var _a, _b; + let currentApiCaller = apiCaller; + let thisSettings; + if (currentApiCaller instanceof streamingApiCaller_1.StreamingApiCaller) { + const gaxStreamingRetries = (_b = (_a = currentApiCaller.descriptor) === null || _a === void 0 ? void 0 : _a.gaxStreamingRetries) !== null && _b !== void 0 ? _b : false; + // If Gax streaming retries are enabled, check settings passed at call time and convert parameters if needed + const convertedRetryOptions = (0, gax_1.convertRetryOptions)(callOptions, gaxStreamingRetries); + thisSettings = settings.merge(convertedRetryOptions); + } + else { + thisSettings = settings.merge(callOptions); + } + // special case: if bundling is disabled for this one call, + // use default API caller instead + if (settings.isBundling && !thisSettings.isBundling) { + currentApiCaller = (0, apiCaller_1.createAPICaller)(settings, undefined); + } + const ongoingCall = currentApiCaller.init(callback); + funcPromise + .then((func) => { + var _a, _b; + var _c; + // Initially, the function is just what gRPC server stub contains. + func = currentApiCaller.wrap(func); + const streaming = (_a = currentApiCaller.descriptor) === null || _a === void 0 ? void 0 : _a.streaming; + const retry = thisSettings.retry; + if (streaming && retry) { + if (retry.retryCodes.length > 0 && retry.shouldRetryFn) { + (0, warnings_1.warn)('either_retrycodes_or_shouldretryfn', 'Only one of retryCodes or shouldRetryFn may be defined. Ignoring retryCodes.'); + retry.retryCodes = []; + } + if (!currentApiCaller.descriptor + .gaxStreamingRetries && + retry.getResumptionRequestFn) { + throw new Error('getResumptionRequestFn can only be used when gaxStreamingRetries is set to true.'); + } + } + if (!streaming && retry) { + if (retry.shouldRetryFn) { + throw new Error('Using a function to determine retry eligibility is only supported with server streaming calls'); + } + if (retry.getResumptionRequestFn) { + throw new Error('Resumption strategy can only be used with server streaming retries'); + } + if (retry.retryCodes && retry.retryCodes.length > 0) { + (_b = (_c = retry.backoffSettings).initialRpcTimeoutMillis) !== null && _b !== void 0 ? _b : (_c.initialRpcTimeoutMillis = thisSettings.timeout); + return (0, retries_1.retryable)(func, thisSettings.retry, thisSettings.otherArgs, thisSettings.apiName); + } + } + return (0, timeout_1.addTimeoutArg)(func, thisSettings.timeout, thisSettings.otherArgs); + }) + .then((apiCall) => { + // After adding retries / timeouts, the call function becomes simpler: + // it only accepts request and callback. + currentApiCaller.call(apiCall, request, thisSettings, ongoingCall); + }) + .catch(err => { + currentApiCaller.fail(ongoingCall, err); + }); + // Calls normally return a "cancellable promise" that can be used to `await` for the actual result, + // or to cancel the ongoing call. + return currentApiCaller.result(ongoingCall); + }; +} +//# sourceMappingURL=createApiCall.js.map + +/***/ }), + +/***/ 65151: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/** + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.BundleDescriptor = exports.StreamDescriptor = exports.PageDescriptor = exports.LongrunningDescriptor = void 0; +var longRunningDescriptor_1 = __nccwpck_require__(99199); +Object.defineProperty(exports, "LongrunningDescriptor", ({ enumerable: true, get: function () { return longRunningDescriptor_1.LongRunningDescriptor; } })); +var pageDescriptor_1 = __nccwpck_require__(53798); +Object.defineProperty(exports, "PageDescriptor", ({ enumerable: true, get: function () { return pageDescriptor_1.PageDescriptor; } })); +var streamDescriptor_1 = __nccwpck_require__(67839); +Object.defineProperty(exports, "StreamDescriptor", ({ enumerable: true, get: function () { return streamDescriptor_1.StreamDescriptor; } })); +var bundleDescriptor_1 = __nccwpck_require__(57910); +Object.defineProperty(exports, "BundleDescriptor", ({ enumerable: true, get: function () { return bundleDescriptor_1.BundleDescriptor; } })); +//# sourceMappingURL=descriptor.js.map + +/***/ }), + +/***/ 9592: +/***/ ((module, exports, __nccwpck_require__) => { + +"use strict"; + +/** + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.fallback = exports.GoogleError = exports.operation = exports.Operation = exports.warn = exports.protobufMinimal = exports.protobuf = exports.LocationProtos = exports.IamProtos = exports.operationsProtos = exports.GrpcClient = exports.defaultToObjectOptions = exports.makeUUID = exports.LocationsClient = exports.IamClient = exports.OperationsClient = exports.StreamType = exports.StreamDescriptor = exports.PageDescriptor = exports.LongrunningDescriptor = exports.BundleDescriptor = exports.version = exports.createDefaultBackoffSettings = exports.RetryOptions = exports.constructSettings = exports.CallSettings = exports.routingHeader = exports.PathTemplate = void 0; +exports.lro = lro; +exports.createApiCall = createApiCall; +const objectHash = __nccwpck_require__(77690); +const protobuf = __nccwpck_require__(23928); +exports.protobuf = protobuf; +const gax = __nccwpck_require__(4996); +const routingHeader = __nccwpck_require__(37515); +exports.routingHeader = routingHeader; +const status_1 = __nccwpck_require__(69124); +const google_auth_library_1 = __nccwpck_require__(492); +const operationsClient_1 = __nccwpck_require__(99463); +const createApiCall_1 = __nccwpck_require__(42236); +const fallbackRest = __nccwpck_require__(32230); +const featureDetection_1 = __nccwpck_require__(83515); +const fallbackServiceStub_1 = __nccwpck_require__(86477); +const streaming_1 = __nccwpck_require__(21224); +const util_1 = __nccwpck_require__(24938); +const IamProtos = __nccwpck_require__(37312); +exports.IamProtos = IamProtos; +const LocationProtos = __nccwpck_require__(81937); +exports.LocationProtos = LocationProtos; +const operationsProtos = __nccwpck_require__(99467); +exports.operationsProtos = operationsProtos; +var pathTemplate_1 = __nccwpck_require__(66575); +Object.defineProperty(exports, "PathTemplate", ({ enumerable: true, get: function () { return pathTemplate_1.PathTemplate; } })); +var gax_1 = __nccwpck_require__(4996); +Object.defineProperty(exports, "CallSettings", ({ enumerable: true, get: function () { return gax_1.CallSettings; } })); +Object.defineProperty(exports, "constructSettings", ({ enumerable: true, get: function () { return gax_1.constructSettings; } })); +Object.defineProperty(exports, "RetryOptions", ({ enumerable: true, get: function () { return gax_1.RetryOptions; } })); +Object.defineProperty(exports, "createDefaultBackoffSettings", ({ enumerable: true, get: function () { return gax_1.createDefaultBackoffSettings; } })); +exports.version = (__nccwpck_require__(57564).version) + '-fallback'; +var descriptor_1 = __nccwpck_require__(65151); +Object.defineProperty(exports, "BundleDescriptor", ({ enumerable: true, get: function () { return descriptor_1.BundleDescriptor; } })); +Object.defineProperty(exports, "LongrunningDescriptor", ({ enumerable: true, get: function () { return descriptor_1.LongrunningDescriptor; } })); +Object.defineProperty(exports, "PageDescriptor", ({ enumerable: true, get: function () { return descriptor_1.PageDescriptor; } })); +Object.defineProperty(exports, "StreamDescriptor", ({ enumerable: true, get: function () { return descriptor_1.StreamDescriptor; } })); +var streaming_2 = __nccwpck_require__(21224); +Object.defineProperty(exports, "StreamType", ({ enumerable: true, get: function () { return streaming_2.StreamType; } })); +var operationsClient_2 = __nccwpck_require__(99463); +Object.defineProperty(exports, "OperationsClient", ({ enumerable: true, get: function () { return operationsClient_2.OperationsClient; } })); +var iamService_1 = __nccwpck_require__(34126); +Object.defineProperty(exports, "IamClient", ({ enumerable: true, get: function () { return iamService_1.IamClient; } })); +var locationService_1 = __nccwpck_require__(47302); +Object.defineProperty(exports, "LocationsClient", ({ enumerable: true, get: function () { return locationService_1.LocationsClient; } })); +var util_2 = __nccwpck_require__(24938); +Object.defineProperty(exports, "makeUUID", ({ enumerable: true, get: function () { return util_2.makeUUID; } })); +exports.defaultToObjectOptions = { + keepCase: false, + longs: String, + enums: String, + defaults: true, + oneofs: true, +}; +const CLIENT_VERSION_HEADER = 'x-goog-api-client'; +class GrpcClient { + /** + * In rare cases users might need to deallocate all memory consumed by loaded protos. + * This method will delete the proto cache content. + */ + static clearProtoCache() { + GrpcClient.protoCache.clear(); + } + /** + * gRPC-fallback version of GrpcClient + * Implements GrpcClient API for a browser using grpc-fallback protocol (sends serialized protobuf to HTTP/1 $rpc endpoint). + * + * @param {Object=} options.auth - An instance of OAuth2Client to use in browser, or an instance of GoogleAuth from google-auth-library + * to use in Node.js. Required for browser, optional for Node.js. + * @constructor + */ + constructor(options = {}) { + var _a; + if (!(0, featureDetection_1.isNodeJS)()) { + if (!options.auth) { + throw new Error(JSON.stringify(options) + + 'You need to pass auth instance to use gRPC-fallback client in browser or other non-Node.js environments. Use OAuth2Client from google-auth-library.'); + } + this.auth = options.auth; + } + else { + this.auth = + options.auth || + new google_auth_library_1.GoogleAuth(options); + } + this.fallback = options.fallback ? true : false; + this.grpcVersion = (__nccwpck_require__(57564).version); + this.httpRules = options.httpRules; + this.numericEnums = (_a = options.numericEnums) !== null && _a !== void 0 ? _a : false; + } + /** + * gRPC-fallback version of loadProto + * Loads the protobuf root object from a JSON object created from a proto file + * @param {Object} jsonObject - A JSON version of a protofile created usin protobuf.js + * @returns {Object} Root namespace of proto JSON + */ + loadProto(jsonObject) { + const rootObject = protobuf.Root.fromJSON(jsonObject); + return rootObject; + } + loadProtoJSON(json, ignoreCache = false) { + const hash = objectHash(JSON.stringify(json)).toString(); + const cached = GrpcClient.protoCache.get(hash); + if (cached && !ignoreCache) { + return cached; + } + const root = protobuf.Root.fromJSON(json); + GrpcClient.protoCache.set(hash, root); + return root; + } + static getServiceMethods(service) { + const methods = {}; + for (const [methodName, methodObject] of Object.entries(service.methods)) { + const methodNameLowerCamelCase = (0, util_1.toLowerCamelCase)(methodName); + methods[methodNameLowerCamelCase] = methodObject; + } + return methods; + } + /** + * gRPC-fallback version of constructSettings + * A wrapper of {@link constructSettings} function under the gRPC context. + * + * Most of parameters are common among constructSettings, please take a look. + * @param {string} serviceName - The fullly-qualified name of the service. + * @param {Object} clientConfig - A dictionary of the client config. + * @param {Object} configOverrides - A dictionary of overriding configs. + * @param {Object} headers - A dictionary of additional HTTP header name to + * its value. + * @return {Object} A mapping of method names to CallSettings. + */ + constructSettings(serviceName, clientConfig, configOverrides, headers) { + function buildMetadata(abTests, moreHeaders) { + const metadata = {}; + if (!headers) { + headers = {}; + } + // Since gRPC expects each header to be an array, + // we are doing the same for fallback here. + for (const key in headers) { + metadata[key] = Array.isArray(headers[key]) + ? headers[key] + : [headers[key]]; + } + // gRPC-fallback request must have 'grpc-web/' in 'x-goog-api-client' + const clientVersions = []; + if (metadata[CLIENT_VERSION_HEADER] && + metadata[CLIENT_VERSION_HEADER][0]) { + clientVersions.push(...metadata[CLIENT_VERSION_HEADER][0].split(' ')); + } + clientVersions.push(`grpc-web/${exports.version}`); + metadata[CLIENT_VERSION_HEADER] = [clientVersions.join(' ')]; + if (!moreHeaders) { + return metadata; + } + for (const key in moreHeaders) { + if (key.toLowerCase() !== CLIENT_VERSION_HEADER) { + const value = moreHeaders[key]; + if (Array.isArray(value)) { + if (metadata[key] === undefined) { + metadata[key] = value; + } + else { + if (Array.isArray(metadata[key])) { + metadata[key].push(...value); + } + else { + throw new Error(`Can not add value ${value} to the call metadata.`); + } + } + } + else { + metadata[key] = [value]; + } + } + } + return metadata; + } + return gax.constructSettings(serviceName, clientConfig, configOverrides, status_1.Status, { metadataBuilder: buildMetadata }); + } + /** + * gRPC-fallback version of createStub + * Creates a gRPC-fallback stub with authentication headers built from supplied OAuth2Client instance + * + * @param {function} CreateStub - The constructor function of the stub. + * @param {Object} service - A protobufjs Service object (as returned by lookupService) + * @param {Object} opts - Connection options, as described below. + * @param {string} opts.servicePath - The hostname of the API endpoint service. + * @param {number} opts.port - The port of the service. + * @return {Promise} A promise which resolves to a gRPC-fallback service stub, which is a protobuf.js service stub instance modified to match the gRPC stub API + */ + async createStub(service, opts, + // For consistency with createStub in grpc.ts, customServicePath is defined: + // eslint-disable-next-line @typescript-eslint/no-unused-vars + customServicePath) { + if (!this.authClient) { + if (this.auth && 'getClient' in this.auth) { + this.authClient = (await this.auth.getClient()); + } + else if (this.auth && 'getRequestHeaders' in this.auth) { + this.authClient = this.auth; + } + } + if (!this.authClient) { + throw new Error('No authentication was provided'); + } + if (!opts.universeDomain) { + opts.universeDomain = 'googleapis.com'; + } + if (opts.universeDomain) { + const universeFromAuth = this.authClient.universeDomain; + if (universeFromAuth && opts.universeDomain !== universeFromAuth) { + throw new Error(`The configured universe domain (${opts.universeDomain}) does not match the universe domain found in the credentials (${universeFromAuth}). ` + + "If you haven't configured the universe domain explicitly, googleapis.com is the default."); + } + } + service.resolveAll(); + const methods = GrpcClient.getServiceMethods(service); + const protocol = opts.protocol || 'https'; + let servicePath = opts.servicePath; + if (!servicePath && + service.options && + service.options['(google.api.default_host)']) { + servicePath = service.options['(google.api.default_host)']; + } + if (!servicePath) { + throw new Error(`Cannot determine service API path for service ${service.name}.`); + } + let servicePort; + const match = servicePath.match(/^(.*):(\d+)$/); + if (match) { + servicePath = match[1]; + servicePort = parseInt(match[2]); + } + if (opts.port) { + servicePort = opts.port; + } + else if (!servicePort) { + servicePort = 443; + } + const encoder = fallbackRest.encodeRequest; + const decoder = fallbackRest.decodeResponse; + const serviceStub = (0, fallbackServiceStub_1.generateServiceStub)(methods, protocol, servicePath, servicePort, this.authClient, encoder, decoder, this.numericEnums); + return serviceStub; + } + /** + * Creates a 'bytelength' function for a given proto message class. + * + * See {@link BundleDescriptor} about the meaning of the return value. + * + * @param {function} message - a constructor function that is generated by + * protobuf.js. Assumes 'encoder' field in the message. + * @return {function(Object):number} - a function to compute the byte length + * for an object. + */ + static createByteLengthFunction(message) { + return gax.createByteLengthFunction(message); + } +} +exports.GrpcClient = GrpcClient; +GrpcClient.protoCache = new Map(); +/** + * gRPC-fallback version of lro + * + * @param {Object=} options.auth - An instance of google-auth-library. + * @return {Object} A OperationsClientBuilder that will return a OperationsClient + */ +function lro(options) { + options = Object.assign({ scopes: [] }, options); + if (options.protoJson) { + options = Object.assign(options, { fallback: true }); + } + const gaxGrpc = new GrpcClient(options); + return new operationsClient_1.OperationsClientBuilder(gaxGrpc, options.protoJson); +} +/** + * gRPC-fallback version of createApiCall + * + * Converts an rpc call into an API call governed by the settings. + * + * In typical usage, `func` will be a promise to a callable used to make an rpc + * request. This will mostly likely be a bound method from a request stub used + * to make an rpc call. It is not a direct function but a Promise instance, + * because of its asynchronism (typically, obtaining the auth information). + * + * The result is a function which manages the API call with the given settings + * and the options on the invocation. + * + * Throws exception on unsupported streaming calls + * + * @param {Promise|GRPCCall} func - is either a promise to be used to make + * a bare RPC call, or just a bare RPC call. + * @param {CallSettings} settings - provides the settings for this call + * @param {Descriptor} descriptor - optionally specify the descriptor for + * the method call. + * @return {GaxCall} func - a bound method on a request stub used + * to make an rpc call. + */ +function createApiCall(func, settings, descriptor, +// eslint-disable-next-line @typescript-eslint/no-unused-vars +_fallback // unused; for compatibility only +) { + if (descriptor && + 'streaming' in descriptor && + descriptor.type !== streaming_1.StreamType.SERVER_STREAMING) { + return () => { + throw new Error('The REST transport currently does not support client-streaming or bidi-stream calls.'); + }; + } + if (descriptor && 'streaming' in descriptor && !(0, featureDetection_1.isNodeJS)()) { + return () => { + throw new Error('Server streaming over the REST transport is only supported in Node.js.'); + }; + } + return (0, createApiCall_1.createApiCall)(func, settings, descriptor); +} +exports.protobufMinimal = __nccwpck_require__(37823); +var warnings_1 = __nccwpck_require__(25531); +Object.defineProperty(exports, "warn", ({ enumerable: true, get: function () { return warnings_1.warn; } })); +var longrunning_1 = __nccwpck_require__(76902); +Object.defineProperty(exports, "Operation", ({ enumerable: true, get: function () { return longrunning_1.Operation; } })); +Object.defineProperty(exports, "operation", ({ enumerable: true, get: function () { return longrunning_1.operation; } })); +var googleError_1 = __nccwpck_require__(34775); +Object.defineProperty(exports, "GoogleError", ({ enumerable: true, get: function () { return googleError_1.GoogleError; } })); +// Different environments or bundlers may or may not respect "browser" field +// in package.json (e.g. Electron does not respect it, but if you run the code +// through webpack first, it will follow the "browser" field). +// To make it safer and more compatible, let's make sure that if you do +// const gax = require("google-gax"); +// you can always ask for gax.fallback, regardless of "browser" field being +// understood or not. +const fallback = module.exports; +exports.fallback = fallback; +//# sourceMappingURL=fallback.js.map + +/***/ }), + +/***/ 32230: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/** + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.encodeRequest = encodeRequest; +exports.decodeResponse = decodeResponse; +// proto-over-HTTP request encoding and decoding +const serializer = __nccwpck_require__(65913); +const fallback_1 = __nccwpck_require__(9592); +const googleError_1 = __nccwpck_require__(34775); +const transcoding_1 = __nccwpck_require__(976); +function encodeRequest(rpc, protocol, servicePath, servicePort, request, numericEnums) { + const headers = { + 'Content-Type': 'application/json', + }; + const message = rpc.resolvedRequestType.fromObject(request); + const json = serializer.toProto3JSON(message, { + numericEnums, + }); + if (!json) { + throw new Error(`Cannot send null request to RPC ${rpc.name}.`); + } + if (typeof json !== 'object' || Array.isArray(json)) { + throw new Error(`Request to RPC ${rpc.name} must be an object.`); + } + const transcoded = (0, transcoding_1.transcode)(json, rpc.parsedOptions); + if (!transcoded) { + throw new Error(`Cannot build HTTP request for ${JSON.stringify(json)}, method: ${rpc.name}`); + } + // If numeric enums feature is requested, add extra parameter to the query string + if (numericEnums) { + transcoded.queryString = + (transcoded.queryString ? `${transcoded.queryString}&` : '') + + '$alt=json%3Benum-encoding=int'; + } + // Converts httpMethod to method that permitted in standard Fetch API spec + // https://fetch.spec.whatwg.org/#methods + const method = transcoded.httpMethod.toUpperCase(); + const body = JSON.stringify(transcoded.data); + const url = `${protocol}://${servicePath}:${servicePort}/${transcoded.url.replace(/^\//, '')}?${transcoded.queryString}`; + return { + method, + url, + headers, + body, + }; +} +function decodeResponse(rpc, ok, response) { + // eslint-disable-next-line n/no-unsupported-features/node-builtins + const decodedString = new TextDecoder().decode(response); + if (!decodedString) { + throw new Error(`Received null response from RPC ${rpc.name}`); + } + const json = JSON.parse(decodedString); + if (!ok) { + const error = googleError_1.GoogleError.parseHttpError(json); + throw error; + } + const message = serializer.fromProto3JSON(rpc.resolvedResponseType, json); + if (!message) { + throw new Error(`Received null or malformed response from JSON serializer from RPC ${rpc.name}`); + } + return rpc.resolvedResponseType.toObject(message, fallback_1.defaultToObjectOptions); +} +//# sourceMappingURL=fallbackRest.js.map + +/***/ }), + +/***/ 86477: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/** + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.generateServiceStub = generateServiceStub; +/* global window */ +/* global AbortController */ +const node_fetch_1 = __nccwpck_require__(26705); +const abort_controller_1 = __nccwpck_require__(17413); +const featureDetection_1 = __nccwpck_require__(83515); +const streamArrayParser_1 = __nccwpck_require__(46690); +const stream_1 = __nccwpck_require__(2203); +function generateServiceStub(rpcs, protocol, servicePath, servicePort, authClient, requestEncoder, responseDecoder, numericEnums) { + const fetch = (0, featureDetection_1.hasWindowFetch)() + ? window.fetch + : node_fetch_1.default; + const serviceStub = { + // close method should close all cancel controllers. If this feature request in the future, we can have a cancelControllerFactory that tracks created cancel controllers, and abort them all in close method. + close: () => { + return { cancel: () => { } }; + }, + }; + for (const [rpcName, rpc] of Object.entries(rpcs)) { + serviceStub[rpcName] = (request, options, _metadata, callback) => { + options !== null && options !== void 0 ? options : (options = {}); + // We cannot use async-await in this function because we need to return the canceller object as soon as possible. + // Using plain old promises instead. + let fetchParameters; + try { + fetchParameters = requestEncoder(rpc, protocol, servicePath, servicePort, request, numericEnums); + } + catch (err) { + // we could not encode parameters; pass error to the callback + // and return a no-op canceler object. + if (callback) { + callback(err); + } + return { + cancel() { }, + }; + } + const cancelController = (0, featureDetection_1.hasAbortController)() + ? new AbortController() + : new abort_controller_1.AbortController(); + const cancelSignal = cancelController.signal; + let cancelRequested = false; + const url = fetchParameters.url; + const headers = fetchParameters.headers; + for (const key of Object.keys(options)) { + headers[key] = options[key][0]; + } + const streamArrayParser = new streamArrayParser_1.StreamArrayParser(rpc); + authClient + .getRequestHeaders() + .then(authHeader => { + const fetchRequest = { + headers: { + ...authHeader, + ...headers, + }, + body: fetchParameters.body, + method: fetchParameters.method, + signal: cancelSignal, + }; + if (fetchParameters.method === 'GET' || + fetchParameters.method === 'DELETE') { + delete fetchRequest['body']; + } + return fetch(url, fetchRequest); + }) + .then((response) => { + if (response.ok && rpc.responseStream) { + (0, stream_1.pipeline)(response.body, streamArrayParser, (err) => { + if (err && + (!cancelRequested || + (err instanceof Error && err.name !== 'AbortError'))) { + if (callback) { + callback(err); + } + streamArrayParser.emit('error', err); + } + }); + return; + } + else { + return Promise.all([ + Promise.resolve(response.ok), + response.arrayBuffer(), + ]) + .then(([ok, buffer]) => { + const response = responseDecoder(rpc, ok, buffer); + callback(null, response); + }) + .catch((err) => { + if (!cancelRequested || err.name !== 'AbortError') { + if (rpc.responseStream) { + if (callback) { + callback(err); + } + streamArrayParser.emit('error', err); + } + else if (callback) { + callback(err); + } + else { + throw err; + } + } + }); + } + }) + .catch((err) => { + if (rpc.responseStream) { + if (callback) { + callback(err); + } + streamArrayParser.emit('error', err); + } + else if (callback) { + callback(err); + } + else { + throw err; + } + }); + if (rpc.responseStream) { + return streamArrayParser; + } + return { + cancel: () => { + cancelRequested = true; + cancelController.abort(); + }, + }; + }; + } + return serviceStub; +} +//# sourceMappingURL=fallbackServiceStub.js.map + +/***/ }), + +/***/ 83515: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/** + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +var _a; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.hasWindowFetch = hasWindowFetch; +exports.isNodeJS = isNodeJS; +exports.hasAbortController = hasAbortController; +/* global window */ +const features = { + windowFetch: typeof window !== 'undefined' && + (window === null || window === void 0 ? void 0 : window.fetch) && + typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function', + // eslint-disable-next-line n/no-unsupported-features/node-builtins + textEncoder: typeof TextEncoder !== 'undefined', + // eslint-disable-next-line n/no-unsupported-features/node-builtins + textDecoder: typeof TextDecoder !== 'undefined', + nodeJS: typeof process !== 'undefined' && ((_a = process === null || process === void 0 ? void 0 : process.versions) === null || _a === void 0 ? void 0 : _a.node), + abortController: typeof AbortController !== 'undefined', +}; +function hasWindowFetch() { + return features.windowFetch; +} +function isNodeJS() { + return features.nodeJS; +} +function hasAbortController() { + return features.abortController; +} +//# sourceMappingURL=featureDetection.js.map + +/***/ }), + +/***/ 4996: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/** + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.CallSettings = exports.RetryOptions = void 0; +exports.convertRetryOptions = convertRetryOptions; +exports.createRetryOptions = createRetryOptions; +exports.createBackoffSettings = createBackoffSettings; +exports.createDefaultBackoffSettings = createDefaultBackoffSettings; +exports.createMaxRetriesBackoffSettings = createMaxRetriesBackoffSettings; +exports.createBundleOptions = createBundleOptions; +exports.constructSettings = constructSettings; +exports.createByteLengthFunction = createByteLengthFunction; +const warnings_1 = __nccwpck_require__(25531); +const util_1 = __nccwpck_require__(24938); +const status_1 = __nccwpck_require__(69124); +/** + * Encapsulates the overridable settings for a particular API call. + * + * ``CallOptions`` is an optional arg for all GAX API calls. It is used to + * configure the settings of a specific API call. + * + * When provided, its values override the GAX service defaults for that + * particular call. + * + * Typically the API clients will accept this as the second to the last + * argument. See the examples below. + * @typedef {Object} CallOptions + * @property {number=} timeout - The client-side timeout for API calls. + * @property {RetryOptions=} retry - determines whether and how to retry + * on transient errors. When set to null, the call will not retry. + * @property {boolean=} autoPaginate - If set to false and the call is + * configured for paged iteration, page unrolling is not performed, instead + * the callback will be called with the response object. + * @property {Object=} pageToken - If set and the call is configured for + * paged iteration, paged iteration is not performed and requested with this + * pageToken. + * @property {number} maxResults - If set and the call is configured for + * paged iteration, the call will stop when the number of response elements + * reaches to the specified size. By default, it will unroll the page to + * the end of the list. + * @property {boolean=} isBundling - If set to false and the call is configured + * for bundling, bundling is not performed. + * @property {BackoffSettings=} longrunning - BackoffSettings used for polling. + * @example + * // suppress bundling for bundled method. + * api.bundlingMethod( + * param, {optParam: aValue, isBundling: false}, function(err, response) { + * // handle response. + * }); + * @example + * // suppress streaming for page-streaming method. + * api.pageStreamingMethod( + * param, {optParam: aValue, autoPaginate: false}, function(err, page) { + * // not returning a stream, but callback is called with the paged response. + * }); + */ +/** + * Per-call configurable settings for retrying upon transient failure. + * @implements {RetryOptionsType} + * @typedef {Object} RetryOptions + * @property {number[]} retryCodes + * @property {BackoffSettings} backoffSettings + * @property {(function)} shouldRetryFn + * @property {(function)} getResumptionRequestFn + */ +class RetryOptions { + constructor(retryCodes, backoffSettings, shouldRetryFn, getResumptionRequestFn) { + this.retryCodes = retryCodes; + this.backoffSettings = backoffSettings; + this.shouldRetryFn = shouldRetryFn; + this.getResumptionRequestFn = getResumptionRequestFn; + } +} +exports.RetryOptions = RetryOptions; +class CallSettings { + /** + * @param {Object} settings - An object containing parameters of this settings. + * @param {number} settings.timeout - The client-side timeout for API calls. + * This parameter is ignored for retrying calls. + * @param {RetryOptions} settings.retry - The configuration for retrying upon + * transient error. If set to null, this call will not retry. + * @param {boolean} settings.autoPaginate - If there is no `pageDescriptor`, + * this attrbute has no meaning. Otherwise, determines whether a page + * streamed response should make the page structure transparent to the user by + * flattening the repeated field in the returned generator. + * @param {number} settings.pageToken - If there is no `pageDescriptor`, + * this attribute has no meaning. Otherwise, determines the page token used + * in the page streaming request. + * @param {Object} settings.otherArgs - Additional arguments to be passed to + * the API calls. + * + * @constructor + */ + constructor(settings) { + var _a; + settings = settings || {}; + this.timeout = settings.timeout || 30 * 1000; + this.retry = settings.retry; + this.autoPaginate = + 'autoPaginate' in settings ? settings.autoPaginate : true; + this.maxResults = settings.maxResults; + this.otherArgs = settings.otherArgs || {}; + this.bundleOptions = settings.bundleOptions; + this.isBundling = 'isBundling' in settings ? settings.isBundling : true; + this.longrunning = + 'longrunning' in settings ? settings.longrunning : undefined; + this.apiName = (_a = settings.apiName) !== null && _a !== void 0 ? _a : undefined; + this.retryRequestOptions = settings.retryRequestOptions; + } + /** + * Returns a new CallSettings merged from this and a CallOptions object. + * + * @param {CallOptions} options - an instance whose values override + * those in this object. If null, ``merge`` returns a copy of this + * object + * @return {CallSettings} The merged CallSettings instance. + */ + merge(options) { + if (!options) { + return new CallSettings(this); + } + let timeout = this.timeout; + let retry = this.retry; + let autoPaginate = this.autoPaginate; + let maxResults = this.maxResults; + let otherArgs = this.otherArgs; + let isBundling = this.isBundling; + let longrunning = this.longrunning; + let apiName = this.apiName; + let retryRequestOptions = this.retryRequestOptions; + // If the user provides a timeout to the method, that timeout value will be used + // to override the backoff settings. + if ('timeout' in options) { + timeout = options.timeout; + } + // If a method-specific timeout is set in the service config, and the retry codes for that + // method are non-null, then that timeout value will be used to + // override backoff settings. + if (retry === null || retry === void 0 ? void 0 : retry.retryCodes) { + retry.backoffSettings.initialRpcTimeoutMillis = timeout; + retry.backoffSettings.maxRpcTimeoutMillis = timeout; + retry.backoffSettings.totalTimeoutMillis = timeout; + } + if ('retry' in options) { + retry = mergeRetryOptions(retry || {}, options.retry); + } + if ('autoPaginate' in options && !options.autoPaginate) { + autoPaginate = false; + } + if ('maxResults' in options) { + maxResults = options.maxResults; + } + if ('otherArgs' in options) { + otherArgs = {}; + for (const key in this.otherArgs) { + otherArgs[key] = this.otherArgs[key]; + } + for (const optionsKey in options.otherArgs) { + otherArgs[optionsKey] = options.otherArgs[optionsKey]; + } + } + if ('isBundling' in options) { + isBundling = options.isBundling; + } + if ('maxRetries' in options && options.maxRetries !== undefined) { + retry.backoffSettings.maxRetries = options.maxRetries; + delete retry.backoffSettings.totalTimeoutMillis; + } + if ('longrunning' in options) { + longrunning = options.longrunning; + } + if ('apiName' in options) { + apiName = options.apiName; + } + if ('retryRequestOptions' in options) { + retryRequestOptions = options.retryRequestOptions; + } + return new CallSettings({ + timeout, + retry, + bundleOptions: this.bundleOptions, + longrunning, + autoPaginate, + maxResults, + otherArgs, + isBundling, + apiName, + retryRequestOptions, + }); + } +} +exports.CallSettings = CallSettings; +/** + * Validates passed retry options in preparation for eventual parameter deprecation + * converts retryRequestOptions to retryOptions + * then sets retryRequestOptions to null + * + * @param {CallOptions} options - a list of passed retry option + * @return {CallOptions} A new CallOptions object. + * + */ +function convertRetryOptions(options, gaxStreamingRetries) { + var _a, _b, _c, _d; + // options will be undefined if no CallOptions object is passed at call time + if (!options) { + return options; + } + // if a user provided retry AND retryRequestOptions at call time, throw an error + // otherwise, convert supported parameters + if (!gaxStreamingRetries) { + return options; + } + if (options.retry && options.retryRequestOptions) { + throw new Error('Only one of retry or retryRequestOptions may be set'); + } // handles parameter conversion from retryRequestOptions to retryOptions + if (options.retryRequestOptions) { + if (options.retryRequestOptions.objectMode !== undefined) { + (0, warnings_1.warn)('retry_request_options', 'objectMode override is not supported. It is set to true internally by default in gax.', 'UnsupportedParameterWarning'); + } + if (options.retryRequestOptions.noResponseRetries !== undefined) { + (0, warnings_1.warn)('retry_request_options', 'noResponseRetries override is not supported. Please specify retry codes or a function to determine retry eligibility.', 'UnsupportedParameterWarning'); + } + if (options.retryRequestOptions.currentRetryAttempt !== undefined) { + (0, warnings_1.warn)('retry_request_options', 'currentRetryAttempt override is not supported. Retry attempts are tracked internally.', 'UnsupportedParameterWarning'); + } + let retryCodes = [status_1.Status.UNAVAILABLE]; + let shouldRetryFn; + if (options.retryRequestOptions.shouldRetryFn) { + retryCodes = []; + shouldRetryFn = options.retryRequestOptions.shouldRetryFn; + } + //Backoff settings + options.maxRetries = + (_b = (_a = options === null || options === void 0 ? void 0 : options.retryRequestOptions) === null || _a === void 0 ? void 0 : _a.retries) !== null && _b !== void 0 ? _b : options.maxRetries; + // create a default backoff settings object in case the user didn't provide overrides for everything + const backoffSettings = createDefaultBackoffSettings(); + let maxRetryDelayMillis; + let totalTimeoutMillis; + // maxRetryDelay - this is in seconds, need to convert to milliseconds + if (options.retryRequestOptions.maxRetryDelay !== undefined) { + maxRetryDelayMillis = options.retryRequestOptions.maxRetryDelay * 1000; + } + // retryDelayMultiplier - should be a one to one mapping to retryDelayMultiplier + const retryDelayMultiplier = (_d = (_c = options === null || options === void 0 ? void 0 : options.retryRequestOptions) === null || _c === void 0 ? void 0 : _c.retryDelayMultiplier) !== null && _d !== void 0 ? _d : backoffSettings.retryDelayMultiplier; + // this is in seconds and needs to be converted to milliseconds and the totalTimeoutMillis parameter + if (options.retryRequestOptions.totalTimeout !== undefined) { + totalTimeoutMillis = options.retryRequestOptions.totalTimeout * 1000; + } + else { + if (options.maxRetries === undefined) { + totalTimeoutMillis = 30000; + (0, warnings_1.warn)('retry_request_options_no_max_retries_timeout', 'Neither maxRetries nor totalTimeout were passed. Defaulting to totalTimeout of 30000ms.', 'MissingParameterWarning'); + } + } + // for the variables the user wants to override, override in the backoff settings object we made + backoffSettings.maxRetryDelayMillis = + maxRetryDelayMillis !== null && maxRetryDelayMillis !== void 0 ? maxRetryDelayMillis : backoffSettings.maxRetryDelayMillis; + backoffSettings.retryDelayMultiplier = + retryDelayMultiplier !== null && retryDelayMultiplier !== void 0 ? retryDelayMultiplier : backoffSettings.retryDelayMultiplier; + backoffSettings.totalTimeoutMillis = + totalTimeoutMillis !== null && totalTimeoutMillis !== void 0 ? totalTimeoutMillis : backoffSettings.totalTimeoutMillis; + const convertedRetryOptions = createRetryOptions(retryCodes, backoffSettings, shouldRetryFn); + options.retry = convertedRetryOptions; + delete options.retryRequestOptions; // completely remove them to avoid any further confusion + (0, warnings_1.warn)('retry_request_options', 'retryRequestOptions will be deprecated in a future release. Please use retryOptions to pass retry options at call time', 'DeprecationWarning'); + } + return options; +} +/** + * Per-call configurable settings for retrying upon transient failure. + * @param {number[]} retryCodes - a list of Google API canonical error codes OR a function that returns a boolean to determine retry behavior + * upon which a retry should be attempted. + * @param {BackoffSettings} backoffSettings - configures the retry + * exponential backoff algorithm. + * @param {function} shouldRetryFn - a function that determines whether a call should retry. If this is defined retryCodes must be empty + * @param {function} getResumptionRequestFn - a function with a resumption strategy - only used with server streaming retries + * @return {RetryOptions} A new RetryOptions object. + * + */ +function createRetryOptions(retryCodes, backoffSettings, shouldRetryFn, getResumptionRequestFn) { + return { + retryCodes, + backoffSettings, + shouldRetryFn, + getResumptionRequestFn, + }; +} +/** + * Parameters to the exponential backoff algorithm for retrying. + * + * @param {number} initialRetryDelayMillis - the initial delay time, + * in milliseconds, between the completion of the first failed request and the + * initiation of the first retrying request. + * @param {number} retryDelayMultiplier - the multiplier by which to + * increase the delay time between the completion of failed requests, and the + * initiation of the subsequent retrying request. + * @param {number} maxRetryDelayMillis - the maximum delay time, in + * milliseconds, between requests. When this value is reached, + * ``retryDelayMultiplier`` will no longer be used to increase delay time. + * @param {number} initialRpcTimeoutMillis - the initial timeout parameter + * to the request. + * @param {number} rpcTimeoutMultiplier - the multiplier by which to + * increase the timeout parameter between failed requests. + * @param {number} maxRpcTimeoutMillis - the maximum timeout parameter, in + * milliseconds, for a request. When this value is reached, + * ``rpcTimeoutMultiplier`` will no longer be used to increase the timeout. + * @param {number} totalTimeoutMillis - the total time, in milliseconds, + * starting from when the initial request is sent, after which an error will + * be returned, regardless of the retrying attempts made meanwhile. + * @return {BackoffSettings} a new settings. + * + */ +function createBackoffSettings(initialRetryDelayMillis, retryDelayMultiplier, maxRetryDelayMillis, initialRpcTimeoutMillis, rpcTimeoutMultiplier, maxRpcTimeoutMillis, totalTimeoutMillis) { + return { + initialRetryDelayMillis, + retryDelayMultiplier, + maxRetryDelayMillis, + initialRpcTimeoutMillis, + rpcTimeoutMultiplier, + maxRpcTimeoutMillis, + totalTimeoutMillis, + }; +} +function createDefaultBackoffSettings() { + return createBackoffSettings(100, 1.3, 60000, null, null, null, null); +} +/** + * Parameters to the exponential backoff algorithm for retrying. + * This function is unsupported, and intended for internal use only. + * + * @param {number} initialRetryDelayMillis - the initial delay time, + * in milliseconds, between the completion of the first failed request and the + * initiation of the first retrying request. + * @param {number} retryDelayMultiplier - the multiplier by which to + * increase the delay time between the completion of failed requests, and the + * initiation of the subsequent retrying request. + * @param {number} maxRetryDelayMillis - the maximum delay time, in + * milliseconds, between requests. When this value is reached, + * ``retryDelayMultiplier`` will no longer be used to increase delay time. + * @param {number} initialRpcTimeoutMillis - the initial timeout parameter + * to the request. + * @param {number} rpcTimeoutMultiplier - the multiplier by which to + * increase the timeout parameter between failed requests. + * @param {number} maxRpcTimeoutMillis - the maximum timeout parameter, in + * milliseconds, for a request. When this value is reached, + * ``rpcTimeoutMultiplier`` will no longer be used to increase the timeout. + * @param {number} maxRetries - the maximum number of retrying attempts that + * will be made. If reached, an error will be returned. + * @return {BackoffSettings} a new settings. + * + */ +function createMaxRetriesBackoffSettings(initialRetryDelayMillis, retryDelayMultiplier, maxRetryDelayMillis, initialRpcTimeoutMillis, rpcTimeoutMultiplier, maxRpcTimeoutMillis, maxRetries) { + return { + initialRetryDelayMillis, + retryDelayMultiplier, + maxRetryDelayMillis, + initialRpcTimeoutMillis, + rpcTimeoutMultiplier, + maxRpcTimeoutMillis, + maxRetries, + }; +} +/** + * Creates a new {@link BundleOptions}. + * + * @private + * @param {Object} options - An object to hold optional parameters. See + * properties for the content of options. + * @return {BundleOptions} - A new options. + */ +function createBundleOptions(options) { + const params = [ + 'element_count_threshold', + 'element_count_limit', + 'request_byte_threshold', + 'request_byte_limit', + 'delay_threshold_millis', + ]; + params.forEach(param => { + if (param in options && typeof options[param] !== 'number') { + throw new Error(`${param} should be a number`); + } + }); + const elementCountThreshold = options.element_count_threshold || 0; + const elementCountLimit = options.element_count_limit || 0; + const requestByteThreshold = options.request_byte_threshold || 0; + const requestByteLimit = options.request_byte_limit || 0; + const delayThreshold = options.delay_threshold_millis || 0; + if (elementCountThreshold === 0 && + requestByteThreshold === 0 && + delayThreshold === 0) { + throw new Error('one threshold should be > 0'); + } + return { + elementCountThreshold, + elementCountLimit, + requestByteThreshold, + requestByteLimit, + delayThreshold, + }; +} +/** + * Helper for {@link constructSettings} + * + * @private + * + * @param {Object} methodConfig - A dictionary representing a single + * `methods` entry of the standard API client config file. (See + * {@link constructSettings} for information on this yaml.) + * @param {?Object} retryCodes - A dictionary parsed from the + * `retry_codes_def` entry of the standard API client config + * file. (See {@link constructSettings} for information on this yaml.) + * @param {Object} retryParams - A dictionary parsed from the + * `retry_params` entry of the standard API client config + * file. (See {@link constructSettings} for information on this yaml.) + * @param {Object} retryNames - A dictionary mapping the string names + * used in the standard API client config file to API response + * status codes. + * @return {?RetryOptions} The new retry options. + */ +function constructRetry(methodConfig, retryCodes, retryParams, retryNames) { + if (!methodConfig) { + return null; + } + let codes = null; // this is one instance where it will NOT be an array OR a function because we do not allow shouldRetryFn in the client + if (retryCodes && 'retry_codes_name' in methodConfig) { + const retryCodesName = methodConfig['retry_codes_name']; + codes = (retryCodes[retryCodesName] || []).map(name => { + return Number(retryNames[name]); + }); + } + let backoffSettings = null; + if (retryParams && 'retry_params_name' in methodConfig) { + const params = retryParams[methodConfig.retry_params_name]; + backoffSettings = createBackoffSettings(params.initial_retry_delay_millis, params.retry_delay_multiplier, params.max_retry_delay_millis, params.initial_rpc_timeout_millis, params.rpc_timeout_multiplier, params.max_rpc_timeout_millis, params.total_timeout_millis); + } + return createRetryOptions(codes, backoffSettings); +} +/** + * Helper for {@link constructSettings} + * + * Takes two retry options, and merges them into a single RetryOption instance. + * + * @private + * + * @param {RetryOptions} retry - The base RetryOptions. + * @param {RetryOptions} overrides - The RetryOptions used for overriding + * `retry`. Use the values if it is not null. If entire `overrides` is null, + * ignore the base retry and return null. + * @return {?RetryOptions} The merged RetryOptions. + */ +function mergeRetryOptions(retry, overrides) { + if (!overrides) { + return null; + } + if (!overrides.retryCodes && + !overrides.backoffSettings && + !overrides.shouldRetryFn && + !overrides.getResumptionRequestFn) { + return retry; + } + const retryCodes = overrides.retryCodes + ? overrides.retryCodes + : retry.retryCodes; + const backoffSettings = overrides.backoffSettings + ? overrides.backoffSettings + : retry.backoffSettings; + const shouldRetryFn = overrides.shouldRetryFn + ? overrides.shouldRetryFn + : retry.shouldRetryFn; + const getResumptionRequestFn = overrides.getResumptionRequestFn + ? overrides.getResumptionRequestFn + : retry.getResumptionRequestFn; + return createRetryOptions(retryCodes, backoffSettings, shouldRetryFn, getResumptionRequestFn); +} +/** + * Constructs a dictionary mapping method names to {@link CallSettings}. + * + * The `clientConfig` parameter is parsed from a client configuration JSON + * file of the form: + * + * { + * "interfaces": { + * "google.fake.v1.ServiceName": { + * "retry_codes": { + * "idempotent": ["UNAVAILABLE", "DEADLINE_EXCEEDED"], + * "non_idempotent": [] + * }, + * "retry_params": { + * "default": { + * "initial_retry_delay_millis": 100, + * "retry_delay_multiplier": 1.2, + * "max_retry_delay_millis": 1000, + * "initial_rpc_timeout_millis": 2000, + * "rpc_timeout_multiplier": 1.5, + * "max_rpc_timeout_millis": 30000, + * "total_timeout_millis": 45000 + * } + * }, + * "methods": { + * "CreateFoo": { + * "retry_codes_name": "idempotent", + * "retry_params_name": "default" + * }, + * "Publish": { + * "retry_codes_name": "non_idempotent", + * "retry_params_name": "default", + * "bundling": { + * "element_count_threshold": 40, + * "element_count_limit": 200, + * "request_byte_threshold": 90000, + * "request_byte_limit": 100000, + * "delay_threshold_millis": 100 + * } + * } + * } + * } + * } + * } + * + * @param {String} serviceName - The fully-qualified name of this + * service, used as a key into the client config file (in the + * example above, this value should be 'google.fake.v1.ServiceName'). + * @param {Object} clientConfig - A dictionary parsed from the + * standard API client config file. + * @param {Object} configOverrides - A dictionary in the same structure of + * client_config to override the settings. + * @param {Object.} retryNames - A dictionary mapping the strings + * referring to response status codes to objects representing + * those codes. + * @param {Object} otherArgs - the non-request arguments to be passed to the API + * calls. + * @return {Object} A mapping from method name to CallSettings, or null if the + * service is not found in the config. + */ +function constructSettings(serviceName, clientConfig, configOverrides, retryNames, otherArgs) { + otherArgs = otherArgs || {}; + // eslint-disable-next-line @typescript-eslint/no-explicit-any + const defaults = {}; + const serviceConfig = (clientConfig.interfaces || {})[serviceName]; + if (!serviceConfig) { + return null; + } + // users can override the config from client side, like bundling options. + // The detailed structure of the clientConfig can be found here: https://github.com/googleapis/gax-nodejs/blob/main/src/gax.ts#L546 + // The way to override bundling options: + // + // const customConfig = {"interfaces": {"service": {"methods": {"methodName": {"bundling": {..}}}}}} + // const client = new Client({ projectId, customConfig }); + const overrides = (configOverrides.interfaces || {})[serviceName] || {}; + const methods = serviceConfig.methods; + const overridingMethods = overrides.methods || {}; + for (const methodName in methods) { + const methodConfig = methods[methodName]; + const jsName = (0, util_1.toLowerCamelCase)(methodName); + let retry = constructRetry(methodConfig, serviceConfig.retry_codes, serviceConfig.retry_params, retryNames); + let bundlingConfig = methodConfig.bundling; + let timeout = methodConfig.timeout_millis; + if (methodName in overridingMethods) { + const overridingMethod = overridingMethods[methodName]; + if (overridingMethod) { + if ('bundling' in overridingMethod) { + bundlingConfig = overridingMethod.bundling; + } + if ('timeout_millis' in overridingMethod) { + timeout = overridingMethod.timeout_millis; + } + } + retry = mergeRetryOptions(retry, constructRetry(overridingMethod, overrides.retry_codes, overrides.retry_params, retryNames)); + } + const apiName = serviceName; + defaults[jsName] = new CallSettings({ + timeout, + retry, + bundleOptions: bundlingConfig + ? createBundleOptions(bundlingConfig) + : null, + otherArgs, + apiName, + }); + } + return defaults; +} +function createByteLengthFunction(message) { + return function getByteLength(obj) { + try { + return message.encode(obj).finish().length; + } + catch (err) { + const stringified = JSON.stringify(obj); + (0, warnings_1.warn)('error_encoding_protobufjs_object', `Cannot encode protobuf.js object: ${stringified}: ${err}`); + // We failed to encode the object properly, let's just return an upper boundary of its length. + // It's only needed for calculating the size of the batch, so it's safe if it's bigger than needed. + return stringified.length; + } + }; +} +//# sourceMappingURL=gax.js.map + +/***/ }), + +/***/ 34775: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/** + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.GoogleErrorDecoder = exports.GoogleError = void 0; +const status_1 = __nccwpck_require__(69124); +const protobuf = __nccwpck_require__(23928); +const serializer = __nccwpck_require__(65913); +const fallback_1 = __nccwpck_require__(9592); +class GoogleError extends Error { + // Parse details field in google.rpc.status wire over gRPC medatadata. + // Promote google.rpc.ErrorInfo if exist. + static parseGRPCStatusDetails(err) { + const decoder = new GoogleErrorDecoder(); + try { + if (err.metadata && err.metadata.get('grpc-status-details-bin')) { + const statusDetailsObj = decoder.decodeGRPCStatusDetails(err.metadata.get('grpc-status-details-bin')); + if (statusDetailsObj && + statusDetailsObj.details && + statusDetailsObj.details.length > 0) { + err.statusDetails = statusDetailsObj.details; + } + if (statusDetailsObj && statusDetailsObj.errorInfo) { + err.reason = statusDetailsObj.errorInfo.reason; + err.domain = statusDetailsObj.errorInfo.domain; + err.errorInfoMetadata = statusDetailsObj.errorInfo.metadata; + } + } + } + catch (decodeErr) { + // ignoring the error + } + return err; + } + // Parse http JSON error and promote google.rpc.ErrorInfo if exist. + // eslint-disable-next-line @typescript-eslint/no-explicit-any + static parseHttpError(json) { + if (Array.isArray(json)) { + // eslint-disable-next-line @typescript-eslint/no-explicit-any + json = json.find((obj) => { + return 'error' in obj; + }); + } + // fallback logic. + // related issue: https://github.com/googleapis/gax-nodejs/issues/1303 + // google error mapping: https://cloud.google.com/apis/design/errors + // if input json doesn't have 'error' fields, wrap the whole object with 'error' field + if (!json['error']) { + json['error'] = {}; + Object.keys(json) + .filter(key => key !== 'error') + .forEach(key => { + json['error'][key] = json[key]; + delete json[key]; + }); + } + const decoder = new GoogleErrorDecoder(); + const proto3Error = decoder.decodeHTTPError(json['error']); + const error = Object.assign(new GoogleError(json['error']['message']), proto3Error); + // Map Http Status Code to gRPC Status Code + if (json['error']['code']) { + error.code = (0, status_1.rpcCodeFromHttpStatusCode)(json['error']['code']); + } + else { + // If error code is absent, proto3 message default value is 0. We should + // keep error code as undefined. + delete error.code; + } + // Keep consistency with gRPC statusDetails fields. gRPC details has been occupied before. + // Rename "details" to "statusDetails". + if (error.details) { + try { + const statusDetailsObj = decoder.decodeHttpStatusDetails(error.details); + if (statusDetailsObj && + statusDetailsObj.details && + statusDetailsObj.details.length > 0) { + error.statusDetails = statusDetailsObj.details; + } + if (statusDetailsObj && statusDetailsObj.errorInfo) { + error.reason = statusDetailsObj.errorInfo.reason; + error.domain = statusDetailsObj.errorInfo.domain; + // error.metadata has been occupied for gRPC metadata, so we use + // errorInfoMetadata to represent ErrorInfo' metadata field. Keep + // consistency with gRPC ErrorInfo metadata field name. + error.errorInfoMetadata = statusDetailsObj.errorInfo.metadata; + } + } + catch (decodeErr) { + // ignoring the error + } + } + return error; + } +} +exports.GoogleError = GoogleError; +class GoogleErrorDecoder { + constructor() { + // eslint-disable-next-line @typescript-eslint/no-var-requires + const errorProtoJson = __nccwpck_require__(64765); + this.root = protobuf.Root.fromJSON(errorProtoJson); + this.anyType = this.root.lookupType('google.protobuf.Any'); + this.statusType = this.root.lookupType('google.rpc.Status'); + } + decodeProtobufAny(anyValue) { + const match = anyValue.type_url.match(/^type.googleapis.com\/(.*)/); + if (!match) { + throw new Error(`Unknown type encoded in google.protobuf.any: ${anyValue.type_url}`); + } + const typeName = match[1]; + const type = this.root.lookupType(typeName); + if (!type) { + throw new Error(`Cannot lookup type ${typeName}`); + } + return type.decode(anyValue.value); + } + // Decodes gRPC-fallback error which is an instance of google.rpc.Status. + decodeRpcStatus(buffer) { + const uint8array = new Uint8Array(buffer); + const status = this.statusType.decode(uint8array); + // google.rpc.Status contains an array of google.protobuf.Any + // which need a special treatment + const details = []; + let errorInfo; + for (const detail of status.details) { + try { + const decodedDetail = this.decodeProtobufAny(detail); + details.push(decodedDetail); + if (detail.type_url === 'type.googleapis.com/google.rpc.ErrorInfo') { + errorInfo = decodedDetail; + } + } + catch (err) { + // cannot decode detail, likely because of the unknown type - just skip it + } + } + const result = { + code: status.code, + message: status.message, + statusDetails: details, + reason: errorInfo === null || errorInfo === void 0 ? void 0 : errorInfo.reason, + domain: errorInfo === null || errorInfo === void 0 ? void 0 : errorInfo.domain, + errorInfoMetadata: errorInfo === null || errorInfo === void 0 ? void 0 : errorInfo.metadata, + }; + return result; + } + // Construct an Error from a StatusObject. + // Adapted from https://github.com/grpc/grpc-node/blob/main/packages/grpc-js/src/call.ts#L79 + callErrorFromStatus(status) { + status.message = `${status.code} ${status_1.Status[status.code]}: ${status.message}`; + return Object.assign(new GoogleError(status.message), status); + } + // Decodes gRPC-fallback error which is an instance of google.rpc.Status, + // and puts it into the object similar to gRPC ServiceError object. + decodeErrorFromBuffer(buffer) { + return this.callErrorFromStatus(this.decodeRpcStatus(buffer)); + } + // Decodes gRPC metadata error details which is an instance of google.rpc.Status. + decodeGRPCStatusDetails(bufferArr) { + const details = []; + let errorInfo; + bufferArr.forEach(buffer => { + const uint8array = new Uint8Array(buffer); + const rpcStatus = this.statusType.decode(uint8array); + for (const detail of rpcStatus.details) { + try { + const decodedDetail = this.decodeProtobufAny(detail); + details.push(decodedDetail); + if (detail.type_url === 'type.googleapis.com/google.rpc.ErrorInfo') { + errorInfo = decodedDetail; + } + } + catch (err) { + // cannot decode detail, likely because of the unknown type - just skip it + } + } + }); + const result = { + details, + errorInfo, + }; + return result; + } + // Decodes http error which is an instance of google.rpc.Status. + decodeHTTPError(json) { + const errorMessage = serializer.fromProto3JSON(this.statusType, json); + if (!errorMessage) { + throw new Error(`Received error message ${json}, but failed to serialize as proto3 message`); + } + return this.statusType.toObject(errorMessage, fallback_1.defaultToObjectOptions); + } + // Decodes http error details which is an instance of Array. + decodeHttpStatusDetails(rawDetails) { + // eslint-disable-next-line @typescript-eslint/no-unused-vars + const details = []; + let errorInfo; + for (const detail of rawDetails) { + try { + const decodedDetail = this.decodeProtobufAny(detail); + details.push(decodedDetail); + if (detail.type_url === 'type.googleapis.com/google.rpc.ErrorInfo') { + errorInfo = decodedDetail; + } + } + catch (err) { + // cannot decode detail, likely because of the unknown type - just skip it + } + } + return { details, errorInfo }; + } +} +exports.GoogleErrorDecoder = GoogleErrorDecoder; +//# sourceMappingURL=googleError.js.map + +/***/ }), + +/***/ 42606: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/** + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.GoogleProtoFilesRoot = exports.GrpcClient = exports.ClientStub = void 0; +const grpcProtoLoader = __nccwpck_require__(76081); +const child_process_1 = __nccwpck_require__(35317); +const fs = __nccwpck_require__(79896); +const google_auth_library_1 = __nccwpck_require__(492); +const grpc = __nccwpck_require__(83033); +const os = __nccwpck_require__(70857); +const path_1 = __nccwpck_require__(16928); +const path = __nccwpck_require__(16928); +const protobuf = __nccwpck_require__(23928); +const objectHash = __nccwpck_require__(77690); +const gax = __nccwpck_require__(4996); +const googleProtoFilesDir = __nccwpck_require__.ab + "protos"; +// INCLUDE_DIRS is passed to @grpc/proto-loader +const INCLUDE_DIRS = []; +INCLUDE_DIRS.push(googleProtoFilesDir); +// COMMON_PROTO_FILES logic is here for protobufjs loads (see +// GoogleProtoFilesRoot below) +const commonProtoFiles = __nccwpck_require__(7085); +// use the correct path separator for the OS we are running on +const COMMON_PROTO_FILES = commonProtoFiles.map(file => file.replace(/[/\\]/g, path.sep)); +/* + * Async version of readFile. + * + * @returns {Promise} Contents of file at path. + */ +async function readFileAsync(path) { + return new Promise((resolve, reject) => { + fs.readFile(path, 'utf8', (err, content) => { + if (err) + return reject(err); + else + resolve(content); + }); + }); +} +/* + * Async version of execFile. + * + * @returns {Promise} stdout from command execution. + */ +async function execFileAsync(command, args) { + return new Promise((resolve, reject) => { + (0, child_process_1.execFile)(command, args, (err, stdout) => { + if (err) + return reject(err); + else + resolve(stdout); + }); + }); +} +class ClientStub extends grpc.Client { +} +exports.ClientStub = ClientStub; +class GrpcClient { + /** + * Key for proto cache map. We are doing our best to make sure we respect + * the options, so if the same proto file is loaded with different set of + * options, the cache won't be used. Since some of the options are + * Functions (e.g. `enums: String` - see below in `loadProto()`), + * they will be omitted from the cache key. If the cache breaks anything + * for you, use the `ignoreCache` parameter of `loadProto()` to disable it. + */ + static protoCacheKey(filename, options) { + if (!filename || + (Array.isArray(filename) && (filename.length === 0 || !filename[0]))) { + return undefined; + } + return JSON.stringify(filename) + ' ' + JSON.stringify(options); + } + /** + * In rare cases users might need to deallocate all memory consumed by loaded protos. + * This method will delete the proto cache content. + */ + static clearProtoCache() { + GrpcClient.protoCache.clear(); + } + /** + * A class which keeps the context of gRPC and auth for the gRPC. + * + * @param {Object=} options - The optional parameters. It will be directly + * passed to google-auth-library library, so parameters like keyFile or + * credentials will be valid. + * @param {Object=} options.auth - An instance of google-auth-library. + * When specified, this auth instance will be used instead of creating + * a new one. + * @param {Object=} options.grpc - When specified, this will be used + * for the 'grpc' module in this context. By default, it will load the grpc + * module in the standard way. + * @constructor + */ + constructor(options = {}) { + var _a; + this.auth = options.auth || new google_auth_library_1.GoogleAuth(options); + this.fallback = false; + const minimumVersion = 10; + const major = Number((_a = process.version.match(/^v(\d+)/)) === null || _a === void 0 ? void 0 : _a[1]); + if (Number.isNaN(major) || major < minimumVersion) { + const errorMessage = `Node.js v${minimumVersion}.0.0 is a minimum requirement. To learn about legacy version support visit: ` + + 'https://github.com/googleapis/google-cloud-node#supported-nodejs-versions'; + throw new Error(errorMessage); + } + if ('grpc' in options) { + this.grpc = options.grpc; + this.grpcVersion = ''; + } + else { + this.grpc = grpc; + this.grpcVersion = (__nccwpck_require__(9943)/* .version */ .rE); + } + } + /** + * Creates a gRPC credentials. It asks the auth data if necessary. + * @private + * @param {Object} opts - options values for configuring credentials. + * @param {Object=} opts.sslCreds - when specified, this is used instead + * of default channel credentials. + * @return {Promise} The promise which will be resolved to the gRPC credential. + */ + async _getCredentials(opts) { + if (opts.sslCreds) { + return opts.sslCreds; + } + const grpc = this.grpc; + const sslCreds = opts.cert && opts.key + ? grpc.credentials.createSsl(null, Buffer.from(opts.key), Buffer.from(opts.cert)) + : grpc.credentials.createSsl(); + const client = await this.auth.getClient(); + const credentials = grpc.credentials.combineChannelCredentials(sslCreds, grpc.credentials.createFromGoogleCredential(client)); + return credentials; + } + static defaultOptions() { + // This set of @grpc/proto-loader options + // 'closely approximates the existing behavior of grpc.load' + const includeDirs = INCLUDE_DIRS.slice(); + const options = { + keepCase: false, + longs: String, + enums: String, + defaults: true, + oneofs: true, + includeDirs, + }; + return options; + } + /** + * Loads the gRPC service from the proto file(s) at the given path and with the + * given options. Caches the loaded protos so the subsequent loads don't do + * any disk reads. + * @param filename The path to the proto file(s). + * @param options Options for loading the proto file. + * @param ignoreCache Defaults to `false`. Set it to `true` if the caching logic + * incorrectly decides that the options object is the same, or if you want to + * re-read the protos from disk for any other reason. + */ + loadFromProto(filename, options, ignoreCache = false) { + const cacheKey = GrpcClient.protoCacheKey(filename, options); + let grpcPackage = cacheKey + ? GrpcClient.protoCache.get(cacheKey) + : undefined; + if (ignoreCache || !grpcPackage) { + const packageDef = grpcProtoLoader.loadSync(filename, options); + grpcPackage = this.grpc.loadPackageDefinition(packageDef); + if (cacheKey) { + GrpcClient.protoCache.set(cacheKey, grpcPackage); + } + } + return grpcPackage; + } + /** + * Load gRPC proto service from a filename looking in googleapis common protos + * when necessary. Caches the loaded protos so the subsequent loads don't do + * any disk reads. + * @param {String} protoPath - The directory to search for the protofile. + * @param {String|String[]} filename - The filename(s) of the proto(s) to be loaded. + * If omitted, protoPath will be treated as a file path to load. + * @param ignoreCache Defaults to `false`. Set it to `true` if the caching logic + * incorrectly decides that the options object is the same, or if you want to + * re-read the protos from disk for any other reason. + * @return {Object} The gRPC loaded result (the toplevel namespace + * object). + */ + loadProto(protoPath, filename, ignoreCache = false) { + if (!filename) { + filename = path.basename(protoPath); + protoPath = path.dirname(protoPath); + } + if (Array.isArray(filename) && filename.length === 0) { + return {}; + } + const options = GrpcClient.defaultOptions(); + options.includeDirs.unshift(protoPath); + return this.loadFromProto(filename, options, ignoreCache); + } + static _resolveFile(protoPath, filename) { + if (fs.existsSync(path.join(protoPath, filename))) { + return path.join(protoPath, filename); + } + else if (COMMON_PROTO_FILES.indexOf(filename) > -1) { + return path.join(googleProtoFilesDir, filename); + } + throw new Error(filename + ' could not be found in ' + protoPath); + } + loadProtoJSON(json, ignoreCache = false) { + const hash = objectHash(JSON.stringify(json)).toString(); + const cached = GrpcClient.protoCache.get(hash); + if (cached && !ignoreCache) { + return cached; + } + const options = GrpcClient.defaultOptions(); + const packageDefinition = grpcProtoLoader.fromJSON(json, options); + const grpcPackage = this.grpc.loadPackageDefinition(packageDefinition); + GrpcClient.protoCache.set(hash, grpcPackage); + return grpcPackage; + } + metadataBuilder(headers) { + const Metadata = this.grpc.Metadata; + const baseMetadata = new Metadata(); + for (const key in headers) { + const value = headers[key]; + if (Array.isArray(value)) { + value.forEach(v => baseMetadata.add(key, v)); + } + else { + baseMetadata.set(key, `${value}`); + } + } + return function buildMetadata(abTests, moreHeaders) { + // TODO: bring the A/B testing info into the metadata. + let copied = false; + let metadata = baseMetadata; + if (moreHeaders) { + for (const key in moreHeaders) { + if (key.toLowerCase() !== 'x-goog-api-client') { + if (!copied) { + copied = true; + metadata = metadata.clone(); + } + const value = moreHeaders[key]; + if (Array.isArray(value)) { + value.forEach(v => metadata.add(key, v)); + } + else { + metadata.set(key, `${value}`); + } + } + } + } + return metadata; + }; + } + /** + * A wrapper of {@link constructSettings} function under the gRPC context. + * + * Most of parameters are common among constructSettings, please take a look. + * @param {string} serviceName - The fullly-qualified name of the service. + * @param {Object} clientConfig - A dictionary of the client config. + * @param {Object} configOverrides - A dictionary of overriding configs. + * @param {Object} headers - A dictionary of additional HTTP header name to + * its value. + * @return {Object} A mapping of method names to CallSettings. + */ + constructSettings(serviceName, clientConfig, configOverrides, headers) { + return gax.constructSettings(serviceName, clientConfig, configOverrides, this.grpc.status, { metadataBuilder: this.metadataBuilder(headers) }); + } + /** + * Creates a gRPC stub with current gRPC and auth. + * @param {function} CreateStub - The constructor function of the stub. + * @param {Object} options - The optional arguments to customize + * gRPC connection. This options will be passed to the constructor of + * gRPC client too. + * @param {string} options.servicePath - The name of the server of the service. + * @param {number} options.port - The port of the service. + * @param {grpcTypes.ClientCredentials=} options.sslCreds - The credentials to be used + * to set up gRPC connection. + * @param {string} defaultServicePath - The default service path. + * @return {Promise} A promise which resolves to a gRPC stub instance. + */ + async createStub(CreateStub, options, customServicePath) { + // The following options are understood by grpc-gcp and need a special treatment + // (should be passed without a `grpc.` prefix) + const grpcGcpOptions = [ + 'grpc.callInvocationTransformer', + 'grpc.channelFactoryOverride', + 'grpc.gcpApiConfig', + ]; + const [cert, key] = await this._detectClientCertificate(options, options.universeDomain); + const servicePath = this._mtlsServicePath(options.servicePath, customServicePath, cert && key); + const opts = Object.assign({}, options, { cert, key, servicePath }); + const serviceAddress = servicePath + ':' + opts.port; + if (!options.universeDomain) { + options.universeDomain = 'googleapis.com'; + } + if (options.universeDomain) { + const universeFromAuth = await this.auth.getUniverseDomain(); + if (universeFromAuth && options.universeDomain !== universeFromAuth) { + throw new Error(`The configured universe domain (${options.universeDomain}) does not match the universe domain found in the credentials (${universeFromAuth}). ` + + "If you haven't configured the universe domain explicitly, googleapis.com is the default."); + } + } + const creds = await this._getCredentials(opts); + const grpcOptions = {}; + // @grpc/grpc-js limits max receive/send message length starting from v0.8.0 + // https://github.com/grpc/grpc-node/releases/tag/%40grpc%2Fgrpc-js%400.8.0 + // To keep the existing behavior and avoid libraries breakage, we pass -1 there as suggested. + grpcOptions['grpc.max_receive_message_length'] = -1; + grpcOptions['grpc.max_send_message_length'] = -1; + grpcOptions['grpc.initial_reconnect_backoff_ms'] = 1000; + Object.keys(opts).forEach(key => { + const value = options[key]; + // the older versions had a bug which required users to call an option + // grpc.grpc.* to make it actually pass to gRPC as grpc.*, let's handle + // this here until the next major release + if (key.startsWith('grpc.grpc.')) { + key = key.replace(/^grpc\./, ''); + } + if (key.startsWith('grpc.')) { + if (grpcGcpOptions.includes(key)) { + key = key.replace(/^grpc\./, ''); + } + grpcOptions[key] = value; + } + if (key.startsWith('grpc-node.')) { + grpcOptions[key] = value; + } + }); + const stub = new CreateStub(serviceAddress, creds, grpcOptions); + return stub; + } + /** + * Detect mTLS client certificate based on logic described in + * https://google.aip.dev/auth/4114. + * + * @param {object} [options] - The configuration object. + * @returns {Promise} Resolves array of strings representing cert and key. + */ + async _detectClientCertificate(opts, universeDomain) { + var _a; + const certRegex = /(?-----BEGIN CERTIFICATE-----.*?-----END CERTIFICATE-----)/s; + const keyRegex = /(?-----BEGIN PRIVATE KEY-----.*?-----END PRIVATE KEY-----)/s; + // If GOOGLE_API_USE_CLIENT_CERTIFICATE is true...: + if (typeof process !== 'undefined' && + ((_a = process === null || process === void 0 ? void 0 : process.env) === null || _a === void 0 ? void 0 : _a.GOOGLE_API_USE_CLIENT_CERTIFICATE) === 'true') { + if (universeDomain && universeDomain !== 'googleapis.com') { + throw new Error('mTLS is not supported outside of googleapis.com universe domain.'); + } + if ((opts === null || opts === void 0 ? void 0 : opts.cert) && (opts === null || opts === void 0 ? void 0 : opts.key)) { + return [opts.cert, opts.key]; + } + // If context aware metadata exists, run the cert provider command, + // parse the output to extract cert and key, and use this cert/key. + const metadataPath = (0, path_1.join)(os.homedir(), '.secureConnect', 'context_aware_metadata.json'); + const metadata = JSON.parse(await readFileAsync(metadataPath)); + if (!metadata.cert_provider_command) { + throw Error('no cert_provider_command found'); + } + const stdout = await execFileAsync(metadata.cert_provider_command[0], metadata.cert_provider_command.slice(1)); + const matchCert = stdout.toString().match(certRegex); + const matchKey = stdout.toString().match(keyRegex); + if (!((matchCert === null || matchCert === void 0 ? void 0 : matchCert.groups) && (matchKey === null || matchKey === void 0 ? void 0 : matchKey.groups))) { + throw Error('unable to parse certificate and key'); + } + else { + return [matchCert.groups.cert, matchKey.groups.key]; + } + } + // If GOOGLE_API_USE_CLIENT_CERTIFICATE is not set or false, + // use no cert or key: + return [undefined, undefined]; + } + /** + * Return service path, taking into account mTLS logic. + * See: https://google.aip.dev/auth/4114 + * + * @param {string|undefined} servicePath - The path of the service. + * @param {string|undefined} customServicePath - Did the user provide a custom service URL. + * @param {boolean} hasCertificate - Was a certificate found. + * @returns {string} The DNS address for this service. + */ + _mtlsServicePath(servicePath, customServicePath, hasCertificate) { + var _a, _b; + // If user provides a custom service path, return the current service + // path and do not attempt to add mtls subdomain: + if (customServicePath || !servicePath) + return servicePath; + if (typeof process !== 'undefined' && + ((_a = process === null || process === void 0 ? void 0 : process.env) === null || _a === void 0 ? void 0 : _a.GOOGLE_API_USE_MTLS_ENDPOINT) === 'never') { + // It was explicitly asked that mtls endpoint not be used: + return servicePath; + } + else if ((typeof process !== 'undefined' && + ((_b = process === null || process === void 0 ? void 0 : process.env) === null || _b === void 0 ? void 0 : _b.GOOGLE_API_USE_MTLS_ENDPOINT) === 'always') || + hasCertificate) { + // Either auto-detect or explicit setting of endpoint: + return servicePath.replace('googleapis.com', 'mtls.googleapis.com'); + } + return servicePath; + } + /** + * Creates a 'bytelength' function for a given proto message class. + * + * See {@link BundleDescriptor} about the meaning of the return value. + * + * @param {function} message - a constructor function that is generated by + * protobuf.js. Assumes 'encoder' field in the message. + * @return {function(Object):number} - a function to compute the byte length + * for an object. + */ + static createByteLengthFunction(message) { + return gax.createByteLengthFunction(message); + } +} +exports.GrpcClient = GrpcClient; +GrpcClient.protoCache = new Map(); +class GoogleProtoFilesRoot extends protobuf.Root { + constructor(...args) { + super(...args); + } + // Causes the loading of an included proto to check if it is a common + // proto. If it is a common proto, use the bundled proto. + resolvePath(originPath, includePath) { + originPath = path.normalize(originPath); + includePath = path.normalize(includePath); + // Fully qualified paths don't need to be resolved. + if (path.isAbsolute(includePath)) { + if (!fs.existsSync(includePath)) { + throw new Error('The include `' + includePath + '` was not found.'); + } + return includePath; + } + if (COMMON_PROTO_FILES.indexOf(includePath) > -1) { + return path.join(googleProtoFilesDir, includePath); + } + return GoogleProtoFilesRoot._findIncludePath(originPath, includePath); + } + static _findIncludePath(originPath, includePath) { + originPath = path.normalize(originPath); + includePath = path.normalize(includePath); + let current = originPath; + let found = fs.existsSync(path.join(current, includePath)); + while (!found && current.length > 0) { + current = current.substring(0, current.lastIndexOf(path.sep)); + found = fs.existsSync(path.join(current, includePath)); + } + if (!found) { + throw new Error('The include `' + includePath + '` was not found.'); + } + return path.join(current, includePath); + } +} +exports.GoogleProtoFilesRoot = GoogleProtoFilesRoot; +//# sourceMappingURL=grpc.js.map + +/***/ }), + +/***/ 34126: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright 2020 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.IamClient = void 0; +const createApiCall_1 = __nccwpck_require__(42236); +const routingHeader = __nccwpck_require__(37515); +const gapicConfig = __nccwpck_require__(55083); +const fallback = __nccwpck_require__(9592); +let version = (__nccwpck_require__(57564).version); +const jsonProtos = __nccwpck_require__(70192); +/** + * Google Cloud IAM Client. + * This is manually written for providing methods [setIamPolicy, getIamPolicy, testIamPerssion] to the generated client. + */ +class IamClient { + constructor(gaxGrpc, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + options) { + this._terminated = false; + this.descriptors = { page: {}, stream: {}, longrunning: {} }; + this.innerApiCalls = {}; + this.gaxGrpc = gaxGrpc; + // Ensure that options include the service address and port. + const opts = Object.assign({ + servicePath: options.servicePath, + port: options.port, + clientConfig: options.clientConfig, + apiEndpoint: options.apiEndpoint, + fallback: options.fallback, + }, options); + version = opts.fallback ? fallback.version : version; + opts.scopes = this.constructor.scopes; + // Save options to use in initialize() method. + this._opts = opts; + // Save the auth object to the client, for use by other methods. + this.auth = gaxGrpc.auth; + // Determine the client header string. + const clientHeader = [`gax/${version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } + else { + clientHeader.push(`gl-web/${version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this.gaxGrpc.loadProtoJSON(jsonProtos); + // Put together the default options sent with requests. + this._defaults = gaxGrpc.constructSettings('google.iam.v1.IAMPolicy', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') }); + this.innerApiCalls = {}; + } + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.iamPolicyStub) { + return this.iamPolicyStub; + } + // Put together the "service stub" for + // google.iam.v1.IAMPolicy. + this.iamPolicyStub = this.gaxGrpc.createStub(this._opts.fallback + ? this._protos.lookupService('google.iam.v1.IAMPolicy') + : this._protos.google.iam.v1.IAMPolicy, this._opts); + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const iamPolicyStubMethods = [ + 'getIamPolicy', + 'setIamPolicy', + 'testIamPermissions', + ]; + for (const methodName of iamPolicyStubMethods) { + const innerCallPromise = this.iamPolicyStub.then(stub => (...args) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, (err) => () => { + throw err; + }); + this.innerApiCalls[methodName] = (0, createApiCall_1.createApiCall)(innerCallPromise, this._defaults[methodName], this.descriptors.page[methodName]); + } + return this.iamPolicyStub; + } + /** + * The DNS address for this API service. + */ + static get servicePath() { + return 'cloudkms.googleapis.com'; + } + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + */ + static get apiEndpoint() { + return 'cloudkms.googleapis.com'; + } + /** + * The port for this API service. + */ + static get port() { + return 443; + } + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + */ + static get scopes() { + return [ + 'https://www.googleapis.com/auth/cloud-platform', + 'https://www.googleapis.com/auth/cloudkms', + ]; + } + getProjectId(callback) { + if (this.auth && 'getProjectId' in this.auth) { + return this.auth.getProjectId(callback); + } + if (callback) { + callback(new Error('Cannot determine project ID.')); + } + else { + return Promise.reject('Cannot determine project ID.'); + } + } + getIamPolicy(request, optionsOrCallback, callback) { + let options; + if (optionsOrCallback instanceof Function && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + routingHeader.fromParams({ + resource: request.resource, + }); + this.initialize(); + return this.innerApiCalls.getIamPolicy(request, options, callback); + } + setIamPolicy(request, optionsOrCallback, callback) { + let options; + if (optionsOrCallback instanceof Function && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + routingHeader.fromParams({ + resource: request.resource, + }); + this.initialize(); + return this.innerApiCalls.setIamPolicy(request, options, callback); + } + testIamPermissions(request, optionsOrCallback, callback) { + let options; + if (optionsOrCallback instanceof Function && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + routingHeader.fromParams({ + resource: request.resource, + }); + this.initialize(); + return this.innerApiCalls.testIamPermissions(request, options, callback); + } + /** + * Terminate the GRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + */ + close() { + this.initialize(); + if (!this._terminated) { + return this.iamPolicyStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} +exports.IamClient = IamClient; +//# sourceMappingURL=iamService.js.map + +/***/ }), + +/***/ 83232: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/** + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.serializer = exports.warn = exports.ChannelCredentials = exports.makeUUID = exports.fallback = exports.protobufMinimal = exports.protobuf = exports.version = exports.createByteLengthFunction = exports.LocationsClient = exports.IamClient = exports.OperationsClient = exports.LocationProtos = exports.IamProtos = exports.operationsProtos = exports.routingHeader = exports.StreamType = exports.Status = exports.PathTemplate = exports.operation = exports.Operation = exports.GrpcClient = exports.GoogleProtoFilesRoot = exports.ClientStub = exports.GoogleError = exports.createMaxRetriesBackoffSettings = exports.createDefaultBackoffSettings = exports.createBackoffSettings = exports.createBundleOptions = exports.createRetryOptions = exports.RetryOptions = exports.constructSettings = exports.CallSettings = exports.StreamDescriptor = exports.PageDescriptor = exports.LongrunningDescriptor = exports.BundleDescriptor = exports.createApiCall = exports.OngoingCall = exports.grpc = exports.GoogleAuth = void 0; +exports.lro = lro; +const grpc = __nccwpck_require__(83033); +exports.grpc = grpc; +const grpc_1 = __nccwpck_require__(42606); +const IamProtos = __nccwpck_require__(37312); +exports.IamProtos = IamProtos; +const LocationProtos = __nccwpck_require__(81937); +exports.LocationProtos = LocationProtos; +const operationsProtos = __nccwpck_require__(99467); +exports.operationsProtos = operationsProtos; +const operationsClient = __nccwpck_require__(99463); +const routingHeader = __nccwpck_require__(37515); +exports.routingHeader = routingHeader; +var google_auth_library_1 = __nccwpck_require__(492); +Object.defineProperty(exports, "GoogleAuth", ({ enumerable: true, get: function () { return google_auth_library_1.GoogleAuth; } })); +var call_1 = __nccwpck_require__(49746); +Object.defineProperty(exports, "OngoingCall", ({ enumerable: true, get: function () { return call_1.OngoingCall; } })); +var createApiCall_1 = __nccwpck_require__(42236); +Object.defineProperty(exports, "createApiCall", ({ enumerable: true, get: function () { return createApiCall_1.createApiCall; } })); +var descriptor_1 = __nccwpck_require__(65151); +Object.defineProperty(exports, "BundleDescriptor", ({ enumerable: true, get: function () { return descriptor_1.BundleDescriptor; } })); +Object.defineProperty(exports, "LongrunningDescriptor", ({ enumerable: true, get: function () { return descriptor_1.LongrunningDescriptor; } })); +Object.defineProperty(exports, "PageDescriptor", ({ enumerable: true, get: function () { return descriptor_1.PageDescriptor; } })); +Object.defineProperty(exports, "StreamDescriptor", ({ enumerable: true, get: function () { return descriptor_1.StreamDescriptor; } })); +var gax_1 = __nccwpck_require__(4996); +Object.defineProperty(exports, "CallSettings", ({ enumerable: true, get: function () { return gax_1.CallSettings; } })); +Object.defineProperty(exports, "constructSettings", ({ enumerable: true, get: function () { return gax_1.constructSettings; } })); +Object.defineProperty(exports, "RetryOptions", ({ enumerable: true, get: function () { return gax_1.RetryOptions; } })); +Object.defineProperty(exports, "createRetryOptions", ({ enumerable: true, get: function () { return gax_1.createRetryOptions; } })); +Object.defineProperty(exports, "createBundleOptions", ({ enumerable: true, get: function () { return gax_1.createBundleOptions; } })); +Object.defineProperty(exports, "createBackoffSettings", ({ enumerable: true, get: function () { return gax_1.createBackoffSettings; } })); +Object.defineProperty(exports, "createDefaultBackoffSettings", ({ enumerable: true, get: function () { return gax_1.createDefaultBackoffSettings; } })); +Object.defineProperty(exports, "createMaxRetriesBackoffSettings", ({ enumerable: true, get: function () { return gax_1.createMaxRetriesBackoffSettings; } })); +var googleError_1 = __nccwpck_require__(34775); +Object.defineProperty(exports, "GoogleError", ({ enumerable: true, get: function () { return googleError_1.GoogleError; } })); +var grpc_2 = __nccwpck_require__(42606); +Object.defineProperty(exports, "ClientStub", ({ enumerable: true, get: function () { return grpc_2.ClientStub; } })); +Object.defineProperty(exports, "GoogleProtoFilesRoot", ({ enumerable: true, get: function () { return grpc_2.GoogleProtoFilesRoot; } })); +Object.defineProperty(exports, "GrpcClient", ({ enumerable: true, get: function () { return grpc_2.GrpcClient; } })); +var longrunning_1 = __nccwpck_require__(76902); +Object.defineProperty(exports, "Operation", ({ enumerable: true, get: function () { return longrunning_1.Operation; } })); +Object.defineProperty(exports, "operation", ({ enumerable: true, get: function () { return longrunning_1.operation; } })); +var pathTemplate_1 = __nccwpck_require__(66575); +Object.defineProperty(exports, "PathTemplate", ({ enumerable: true, get: function () { return pathTemplate_1.PathTemplate; } })); +var status_1 = __nccwpck_require__(69124); +Object.defineProperty(exports, "Status", ({ enumerable: true, get: function () { return status_1.Status; } })); +var streaming_1 = __nccwpck_require__(21224); +Object.defineProperty(exports, "StreamType", ({ enumerable: true, get: function () { return streaming_1.StreamType; } })); +function lro(options) { + options = Object.assign({ scopes: lro.ALL_SCOPES }, options); + const gaxGrpc = new grpc_1.GrpcClient(options); + return new operationsClient.OperationsClientBuilder(gaxGrpc); +} +lro.SERVICE_ADDRESS = operationsClient.SERVICE_ADDRESS; +lro.ALL_SCOPES = operationsClient.ALL_SCOPES; +var operationsClient_1 = __nccwpck_require__(99463); +Object.defineProperty(exports, "OperationsClient", ({ enumerable: true, get: function () { return operationsClient_1.OperationsClient; } })); +var iamService_1 = __nccwpck_require__(34126); +Object.defineProperty(exports, "IamClient", ({ enumerable: true, get: function () { return iamService_1.IamClient; } })); +var locationService_1 = __nccwpck_require__(47302); +Object.defineProperty(exports, "LocationsClient", ({ enumerable: true, get: function () { return locationService_1.LocationsClient; } })); +exports.createByteLengthFunction = grpc_1.GrpcClient.createByteLengthFunction; +exports.version = __nccwpck_require__(57564).version; +const protobuf = __nccwpck_require__(23928); +exports.protobuf = protobuf; +exports.protobufMinimal = __nccwpck_require__(37823); +const fallback = __nccwpck_require__(9592); +exports.fallback = fallback; +var util_1 = __nccwpck_require__(24938); +Object.defineProperty(exports, "makeUUID", ({ enumerable: true, get: function () { return util_1.makeUUID; } })); +var grpc_js_1 = __nccwpck_require__(83033); +Object.defineProperty(exports, "ChannelCredentials", ({ enumerable: true, get: function () { return grpc_js_1.ChannelCredentials; } })); +var warnings_1 = __nccwpck_require__(25531); +Object.defineProperty(exports, "warn", ({ enumerable: true, get: function () { return warnings_1.warn; } })); +const serializer = __nccwpck_require__(65913); +exports.serializer = serializer; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 47302: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// https://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.LocationsClient = void 0; +/* global window */ +const gax = __nccwpck_require__(4996); +const warnings_1 = __nccwpck_require__(25531); +const createApiCall_1 = __nccwpck_require__(42236); +const routingHeader = __nccwpck_require__(37515); +const pageDescriptor_1 = __nccwpck_require__(53798); +const jsonProtos = __nccwpck_require__(44909); +/** + * This file defines retry strategy and timeouts for all API methods in this library. + */ +const gapicConfig = __nccwpck_require__(29343); +const version = (__nccwpck_require__(57564).version); +/** + * Google Cloud Locations Client. + * This is manually written for providing methods [listLocations, getLocations] to the generated client. + */ +class LocationsClient { + /** + * Construct an instance of LocationsClient. + * + * @param {object} [options] - The configuration object. + * The options accepted by the constructor are described in detail + * in [this document](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#creating-the-client-instance). + * The common options are: + * @param {object} [options.credentials] - Credentials object. + * @param {string} [options.credentials.client_email] + * @param {string} [options.credentials.private_key] + * @param {string} [options.email] - Account email address. Required when + * using a .pem or .p12 keyFilename. + * @param {string} [options.keyFilename] - Full path to the a .json, .pem, or + * .p12 key downloaded from the Google Developers Console. If you provide + * a path to a JSON file, the projectId option below is not necessary. + * NOTE: .pem and .p12 require you to specify options.email as well. + * @param {number} [options.port] - The port on which to connect to + * the remote host. + * @param {string} [options.projectId] - The project ID from the Google + * Developer's Console, e.g. 'grape-spaceship-123'. We will also check + * the environment variable GCLOUD_PROJECT for your project ID. If your + * app is running in an environment which supports + * {@link https://developers.google.com/identity/protocols/application-default-credentials Application Default Credentials}, + * your project ID will be detected automatically. + * @param {string} [options.apiEndpoint] - The domain name of the + * API remote host. + * @param {gax.ClientConfig} [options.clientConfig] - Client configuration override. + * Follows the structure of {@link gapicConfig}. + * @param {boolean} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(gaxGrpc, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + opts) { + var _a, _b; + this._terminated = false; + this.descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + // Ensure that options include all the required fields. + this.gaxGrpc = gaxGrpc; + const staticMembers = this.constructor; + const servicePath = (opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint) || staticMembers.servicePath; + this._providedCustomServicePath = !!((opts === null || opts === void 0 ? void 0 : opts.servicePath) || (opts === null || opts === void 0 ? void 0 : opts.apiEndpoint)); + const port = (opts === null || opts === void 0 ? void 0 : opts.port) || staticMembers.port; + const clientConfig = (_a = opts === null || opts === void 0 ? void 0 : opts.clientConfig) !== null && _a !== void 0 ? _a : {}; + const fallback = (_b = opts === null || opts === void 0 ? void 0 : opts.fallback) !== null && _b !== void 0 ? _b : (typeof window !== 'undefined' && typeof (window === null || window === void 0 ? void 0 : window.fetch) === 'function'); + opts = Object.assign({ servicePath, port, clientConfig, fallback }, opts); + // If scopes are unset in options and we're connecting to a non-default endpoint, set scopes just in case. + if (servicePath !== staticMembers.servicePath && !('scopes' in opts)) { + opts['scopes'] = staticMembers.scopes; + } + // Save options to use in initialize() method. + this._opts = opts; + // Save the auth object to the client, for use by other methods. + this.auth = gaxGrpc.auth; + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + // Determine the client header string. + const clientHeader = [`gax/${version}`, `gapic/${version}`]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } + else { + clientHeader.push(`gl-web/${version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${gaxGrpc.grpcVersion}`); + } + else if (opts.fallback === 'rest') { + clientHeader.push(`rest/${gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = gaxGrpc.loadProtoJSON(jsonProtos); + // Some of the methods on this service return "paged" results, + // (e.g. 50 results at a time, with tokens to get subsequent + // pages). Denote the keys used for pagination and results. + this.descriptors.page = { + listLocations: new pageDescriptor_1.PageDescriptor('pageToken', 'nextPageToken', 'locations'), + }; + // Put together the default options sent with requests. + this._defaults = gaxGrpc.constructSettings('google.cloud.location.Locations', gapicConfig, opts.clientConfig || {}, { 'x-goog-api-client': clientHeader.join(' ') }); + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + // Add a warn function to the client constructor so it can be easily tested. + this.warn = warnings_1.warn; + } + /** + * Initialize the client. + * Performs asynchronous operations (such as authentication) and prepares the client. + * This function will be called automatically when any class method is called for the + * first time, but if you need to initialize it before calling an actual method, + * feel free to call initialize() directly. + * + * You can await on this method if you want to make sure the client is initialized. + * + * @returns {Promise} A promise that resolves to an authenticated service stub. + */ + initialize() { + // If the client stub promise is already initialized, return immediately. + if (this.locationsStub) { + return this.locationsStub; + } + // Put together the "service stub" for + // google.cloud.location.Locations. + this.locationsStub = this.gaxGrpc.createStub(this._opts.fallback + ? this._protos.lookupService('google.cloud.location.Locations') + : // eslint-disable-next-line @typescript-eslint/no-explicit-any + this._protos.google.cloud.location.Locations, this._opts, this._providedCustomServicePath); + // Iterate over each of the methods that the service provides + // and create an API call method for each. + const locationsStubMethods = ['listLocations', 'getLocation']; + for (const methodName of locationsStubMethods) { + const callPromise = this.locationsStub.then(stub => (...args) => { + if (this._terminated) { + return Promise.reject('The client has already been closed.'); + } + const func = stub[methodName]; + return func.apply(stub, args); + }, (err) => () => { + throw err; + }); + const descriptor = this.descriptors.page[methodName] || undefined; + const apiCall = (0, createApiCall_1.createApiCall)(callPromise, this._defaults[methodName], descriptor); + this.innerApiCalls[methodName] = apiCall; + } + return this.locationsStub; + } + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'cloud.googleapis.com'; + } + /** + * The DNS address for this API service - same as servicePath(), + * exists for compatibility reasons. + * @returns {string} The DNS address for this service. + */ + static get apiEndpoint() { + return 'cloud.googleapis.com'; + } + /** + * The port for this API service. + * @returns {number} The default port for this service. + */ + static get port() { + return 443; + } + /** + * The scopes needed to make gRPC calls for every method defined + * in this service. + * @returns {string[]} List of default scopes. + */ + static get scopes() { + return ['https://www.googleapis.com/auth/cloud-platform']; + } + getProjectId(callback) { + if (callback) { + this.auth.getProjectId(callback); + return; + } + return this.auth.getProjectId(); + } + /** + * Gets information about a location. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Resource name for the location. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Location]{@link google.cloud.location.Location}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#regular-methods) + * for more details and examples. + * @example + * const [response] = await client.getLocation(request); + */ + getLocation(request, optionsOrCallback, callback) { + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getLocation(request, options, callback); + } + /** + * Lists information about the supported locations for this service. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is Array of [Location]{@link google.cloud.location.Location}. + * The client library will perform auto-pagination by default: it will call the API as many + * times as needed and will merge results from all the pages into this array. + * Note that it can affect your quota. + * We recommend using `listLocationsAsync()` + * method described below for async iteration which you can stop as needed. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#auto-pagination) + * for more details and examples. + */ + listLocations(request, optionsOrCallback, callback) { + request = request || {}; + let options; + if (typeof optionsOrCallback === 'function' && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + routingHeader.fromParams({ + name: request.name || '', + }); + this.initialize(); + return this.innerApiCalls.listLocations(request, options, callback); + } + /** + * Equivalent to `listLocations`, but returns an iterable object. + * + * `for`-`await`-`of` syntax is used with the iterable to get response elements on-demand. + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * The resource that owns the locations collection, if applicable. + * @param {string} request.filter + * The standard list filter. + * @param {number} request.pageSize + * The standard list page size. + * @param {string} request.pageToken + * The standard list page token. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Object} + * An iterable Object that allows [async iteration](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols). + * When you iterate the returned iterable, each element will be an object representing + * [Location]{@link google.cloud.location.Location}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#auto-pagination) + * for more details and examples. + * @example + * const iterable = client.listLocationsAsync(request); + * for await (const response of iterable) { + * // process response + * } + */ + listLocationsAsync(request, options) { + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers['x-goog-request-params'] = + routingHeader.fromParams({ + name: request.name || '', + }); + options = options || {}; + const callSettings = new gax.CallSettings(options); + this.initialize(); + return this.descriptors.page.listLocations.asyncIterate(this.innerApiCalls['listLocations'], request, callSettings); + } + /** + * Terminate the gRPC channel and close the client. + * + * The client will no longer be usable and all future behavior is undefined. + * @returns {Promise} A promise that resolves when the client is closed. + */ + close() { + this.initialize(); + if (!this._terminated) { + return this.locationsStub.then(stub => { + this._terminated = true; + stub.close(); + }); + } + return Promise.resolve(); + } +} +exports.LocationsClient = LocationsClient; +//# sourceMappingURL=locationService.js.map + +/***/ }), + +/***/ 73571: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/** + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.LongrunningApiCaller = void 0; +const call_1 = __nccwpck_require__(49746); +const gax_1 = __nccwpck_require__(4996); +const longrunning_1 = __nccwpck_require__(76902); +class LongrunningApiCaller { + /** + * Creates an API caller that performs polling on a long running operation. + * + * @private + * @constructor + * @param {LongRunningDescriptor} longrunningDescriptor - Holds the + * decoders used for unpacking responses and the operationsClient + * used for polling the operation. + */ + constructor(longrunningDescriptor) { + this.longrunningDescriptor = longrunningDescriptor; + } + init(callback) { + if (callback) { + return new call_1.OngoingCall(callback); + } + return new call_1.OngoingCallPromise(); + } + wrap(func) { + return func; + } + call(apiCall, argument, settings, canceller) { + canceller.call((argument, callback) => { + return this._wrapOperation(apiCall, settings, argument, callback); + }, argument); + } + _wrapOperation(apiCall, settings, argument, callback) { + let backoffSettings = settings.longrunning; + if (!backoffSettings) { + backoffSettings = (0, gax_1.createDefaultBackoffSettings)(); + } + const longrunningDescriptor = this.longrunningDescriptor; + return apiCall(argument, (err, rawResponse) => { + if (err) { + callback(err, null, null, rawResponse); + return; + } + const operation = new longrunning_1.Operation(rawResponse, longrunningDescriptor, backoffSettings, settings); + callback(null, operation, rawResponse); + }); + } + fail(canceller, err) { + canceller.callback(err); + } + result(canceller) { + return canceller.promise; + } +} +exports.LongrunningApiCaller = LongrunningApiCaller; +//# sourceMappingURL=longRunningApiCaller.js.map + +/***/ }), + +/***/ 99199: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/** + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.LongRunningDescriptor = void 0; +const longRunningApiCaller_1 = __nccwpck_require__(73571); +/** + * A descriptor for long-running operations. + */ +class LongRunningDescriptor { + constructor(operationsClient, responseDecoder, metadataDecoder) { + this.operationsClient = operationsClient; + this.responseDecoder = responseDecoder; + this.metadataDecoder = metadataDecoder; + } + getApiCaller() { + return new longRunningApiCaller_1.LongrunningApiCaller(this); + } +} +exports.LongRunningDescriptor = LongRunningDescriptor; +//# sourceMappingURL=longRunningDescriptor.js.map + +/***/ }), + +/***/ 76902: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/** + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.Operation = void 0; +exports.operation = operation; +const events_1 = __nccwpck_require__(24434); +const status_1 = __nccwpck_require__(69124); +const googleError_1 = __nccwpck_require__(34775); +const operationProtos = __nccwpck_require__(99467); +class Operation extends events_1.EventEmitter { + /** + * Wrapper for a google.longrunnung.Operation. + * + * @constructor + * + * @param {google.longrunning.Operation} grpcOp - The operation to be wrapped. + * @param {LongRunningDescriptor} longrunningDescriptor - This defines the + * operations service client and unpacking mechanisms for the operation. + * @param {BackoffSettings} backoffSettings - The backoff settings used in + * in polling the operation. + * @param {CallOptions} callOptions - CallOptions used in making get operation + * requests. + */ + constructor(grpcOp, longrunningDescriptor, backoffSettings, callOptions) { + super(); + this.completeListeners = 0; + this.hasActiveListeners = false; + this.latestResponse = grpcOp; + this.name = this.latestResponse.name; + this.done = this.latestResponse.done; + this.error = this.latestResponse.error; + this.longrunningDescriptor = longrunningDescriptor; + this.result = null; + this.metadata = null; + this.backoffSettings = backoffSettings; + this._unpackResponse(grpcOp); + this._listenForEvents(); + this._callOptions = callOptions; + } + /** + * Begin listening for events on the operation. This method keeps track of how + * many "complete" listeners are registered and removed, making sure polling + * is handled automatically. + * + * As long as there is one active "complete" listener, the connection is open. + * When there are no more listeners, the polling stops. + * + * @private + */ + _listenForEvents() { + this.on('newListener', event => { + if (event === 'complete') { + this.completeListeners++; + if (!this.hasActiveListeners) { + this.hasActiveListeners = true; + this.startPolling_(); + } + } + }); + this.on('removeListener', event => { + if (event === 'complete' && --this.completeListeners === 0) { + this.hasActiveListeners = false; + } + }); + } + /** + * Cancels current polling api call and cancels the operation. + * + * @return {Promise} the promise of the OperationsClient#cancelOperation api + * request. + */ + cancel() { + if (this.currentCallPromise_) { + this.currentCallPromise_.cancel(); + } + const operationsClient = this.longrunningDescriptor.operationsClient; + const cancelRequest = new operationProtos.google.longrunning.CancelOperationRequest(); + cancelRequest.name = this.latestResponse.name; + return operationsClient.cancelOperation(cancelRequest); + } + getOperation(callback) { + // eslint-disable-next-line @typescript-eslint/no-this-alias + const self = this; + const operationsClient = this.longrunningDescriptor.operationsClient; + function promisifyResponse() { + if (!callback) { + return new Promise((resolve, reject) => { + if (self.latestResponse.error) { + const error = new googleError_1.GoogleError(self.latestResponse.error.message); + error.code = self.latestResponse.error.code; + reject(error); + } + else { + resolve([self.result, self.metadata, self.latestResponse]); + } + }); + } + return; + } + if (this.latestResponse.done) { + this._unpackResponse(this.latestResponse, callback); + return promisifyResponse(); + } + const request = new operationProtos.google.longrunning.GetOperationRequest(); + request.name = this.latestResponse.name; + this.currentCallPromise_ = operationsClient.getOperationInternal(request, this._callOptions); + const noCallbackPromise = this.currentCallPromise_.then(responses => { + self.latestResponse = responses[0]; + self._unpackResponse(responses[0], callback); + return promisifyResponse(); + }, (err) => { + if (callback) { + callback(err); + return; + } + return Promise.reject(err); + }); + if (!callback) { + return noCallbackPromise; + } + } + _unpackResponse(op, callback) { + const responseDecoder = this.longrunningDescriptor.responseDecoder; + const metadataDecoder = this.longrunningDescriptor.metadataDecoder; + let response; + let metadata; + if (op.done) { + if (op.result === 'error') { + const error = new googleError_1.GoogleError(op.error.message); + error.code = op.error.code; + this.error = error; + if (callback) { + callback(error); + } + return; + } + if (responseDecoder && op.response) { + this.response = op.response; + response = responseDecoder(op.response.value); + this.result = response; + this.done = true; + } + } + if (metadataDecoder && op.metadata) { + metadata = metadataDecoder(op.metadata.value); + this.metadata = metadata; + } + if (callback) { + callback(null, response, metadata, op); + } + } + /** + * Poll `getOperation` to check the operation's status. This runs a loop to + * ping using the backoff strategy specified at initialization. + * + * Note: This method is automatically called once a "complete" event handler + * is registered on the operation. + * + * @private + */ + startPolling_() { + // eslint-disable-next-line @typescript-eslint/no-this-alias + const self = this; + let now = new Date(); + const delayMult = this.backoffSettings.retryDelayMultiplier; + const maxDelay = this.backoffSettings.maxRetryDelayMillis; + let delay = this.backoffSettings.initialRetryDelayMillis; + let deadline = Infinity; + if (this.backoffSettings.totalTimeoutMillis) { + deadline = now.getTime() + this.backoffSettings.totalTimeoutMillis; + } + let previousMetadataBytes; + if (this.latestResponse.metadata) { + previousMetadataBytes = this.latestResponse.metadata.value; + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any + function emit(event, ...args) { + self.emit(event, ...args); + } + // Helper function to replace nodejs buffer's equals() + function arrayEquals(a, b) { + if (a.byteLength !== b.byteLength) { + return false; + } + for (let i = 0; i < a.byteLength; ++i) { + if (a[i] !== b[i]) + return false; + } + return true; + } + function retry() { + if (!self.hasActiveListeners) { + return; + } + if (now.getTime() >= deadline) { + const error = new googleError_1.GoogleError('Total timeout exceeded before any response was received'); + error.code = status_1.Status.DEADLINE_EXCEEDED; + setImmediate(emit, 'error', error); + return; + } + self.getOperation((err, result, metadata, rawResponse) => { + if (err) { + setImmediate(emit, 'error', err); + return; + } + if (!result) { + if (rawResponse.metadata && + (!previousMetadataBytes || + (rawResponse && + !arrayEquals(rawResponse.metadata.value, previousMetadataBytes)))) { + setImmediate(emit, 'progress', metadata, rawResponse); + previousMetadataBytes = rawResponse.metadata.value; + } + // special case: some APIs fail to set either result or error + // but set done = true (e.g. speech with silent file). + // Some APIs just use this for the normal completion + // (e.g. nodejs-contact-center-insights), so let's just return + // an empty response in this case. + if (rawResponse.done) { + setImmediate(emit, 'complete', {}, metadata, rawResponse); + return; + } + setTimeout(() => { + now = new Date(); + delay = Math.min(delay * delayMult, maxDelay); + retry(); + }, delay); + return; + } + setImmediate(emit, 'complete', result, metadata, rawResponse); + }); + } + retry(); + } + /** + * Wraps the `complete` and `error` events in a Promise. + * + * @return {promise} - Promise that resolves on operation completion and rejects + * on operation error. + */ + promise() { + return new Promise((resolve, reject) => { + this.on('error', reject).on('complete', (result, metadata, rawResponse) => { + resolve([result, metadata, rawResponse]); + }); + }); + } +} +exports.Operation = Operation; +/** + * Method used to create Operation objects. + * + * @constructor + * + * @param {google.longrunning.Operation} op - The operation to be wrapped. + * @param {LongRunningDescriptor} longrunningDescriptor - This defines the + * operations service client and unpacking mechanisms for the operation. + * @param {BackoffSettings} backoffSettings - The backoff settings used in + * in polling the operation. + * @param {CallOptions=} callOptions - CallOptions used in making get operation + * requests. + */ +function operation(op, longrunningDescriptor, backoffSettings, callOptions) { + return new Operation(op, longrunningDescriptor, backoffSettings, callOptions); +} +//# sourceMappingURL=longrunning.js.map + +/***/ }), + +/***/ 51161: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/** + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.NormalApiCaller = void 0; +const call_1 = __nccwpck_require__(49746); +/** + * Creates an API caller for regular unary methods. + */ +class NormalApiCaller { + init(callback) { + if (callback) { + return new call_1.OngoingCall(callback); + } + return new call_1.OngoingCallPromise(); + } + wrap(func) { + return func; + } + call(apiCall, argument, settings, canceller) { + canceller.call(apiCall, argument); + } + fail(canceller, err) { + canceller.callback(err); + } + result(canceller) { + return canceller.promise; + } +} +exports.NormalApiCaller = NormalApiCaller; +//# sourceMappingURL=normalApiCaller.js.map + +/***/ }), + +/***/ 61789: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/** + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.retryable = retryable; +const status_1 = __nccwpck_require__(69124); +const googleError_1 = __nccwpck_require__(34775); +const timeout_1 = __nccwpck_require__(86328); +/** + * Creates a function equivalent to func, but that retries on certain + * exceptions. + * + * @private + * + * @param {GRPCCall} func - A function. + * @param {RetryOptions} retry - Configures the exceptions upon which the + * function eshould retry, and the parameters to the exponential backoff retry + * algorithm. + * @param {GRPCCallOtherArgs} otherArgs - the additional arguments to be passed to func. + * @return {SimpleCallbackFunction} A function that will retry. + */ +function retryable(func, retry, otherArgs, apiName) { + const delayMult = retry.backoffSettings.retryDelayMultiplier; + const maxDelay = retry.backoffSettings.maxRetryDelayMillis; + const timeoutMult = retry.backoffSettings.rpcTimeoutMultiplier; + const maxTimeout = retry.backoffSettings.maxRpcTimeoutMillis; + let delay = retry.backoffSettings.initialRetryDelayMillis; + let timeout = retry.backoffSettings.initialRpcTimeoutMillis; + /** + * Equivalent to ``func``, but retries upon transient failure. + * + * Retrying is done through an exponential backoff algorithm configured + * by the options in ``retry``. + * @param {RequestType} argument The request object. + * @param {APICallback} callback The callback. + * @return {GRPCCall} + */ + return (argument, callback) => { + let canceller; + let timeoutId; + let now = new Date(); + let deadline; + if (retry.backoffSettings.totalTimeoutMillis) { + deadline = now.getTime() + retry.backoffSettings.totalTimeoutMillis; + } + let retries = 0; + const maxRetries = retry.backoffSettings.maxRetries; + // TODO: define A/B testing values for retry behaviors. + /** Repeat the API call as long as necessary. */ + function repeat(err) { + timeoutId = null; + if (deadline && now.getTime() >= deadline) { + const error = new googleError_1.GoogleError(`Total timeout of API ${apiName} exceeded ${retry.backoffSettings.totalTimeoutMillis} milliseconds ${err ? `retrying error ${err} ` : ''} before any response was received.`); + error.code = status_1.Status.DEADLINE_EXCEEDED; + callback(error); + return; + } + if (retries && retries >= maxRetries) { + const error = new googleError_1.GoogleError('Exceeded maximum number of retries ' + + (err ? `retrying error ${err} ` : '') + + 'before any response was received'); + error.code = status_1.Status.DEADLINE_EXCEEDED; + callback(error); + return; + } + retries++; + let lastError = err; + const toCall = (0, timeout_1.addTimeoutArg)(func, timeout, otherArgs); + canceller = toCall(argument, (err, response, next, rawResponse) => { + // Save only the error before deadline exceeded + if (err && err.code !== 4) { + lastError = err; + } + if (!err) { + callback(null, response, next, rawResponse); + return; + } + canceller = null; + if (retry.retryCodes.length > 0 && + retry.retryCodes.indexOf(err.code) < 0) { + err.note = + 'Exception occurred in retry method that was ' + + 'not classified as transient'; + callback(err); + } + else { + const toSleep = Math.random() * delay; + timeoutId = setTimeout(() => { + now = new Date(); + delay = Math.min(delay * delayMult, maxDelay); + const timeoutCal = timeout && timeoutMult ? timeout * timeoutMult : 0; + const rpcTimeout = maxTimeout ? maxTimeout : 0; + const newDeadline = deadline ? deadline - now.getTime() : 0; + timeout = Math.min(timeoutCal, rpcTimeout, newDeadline); + repeat(lastError); + }, toSleep); + } + }); + if (canceller instanceof Promise) { + canceller.catch(err => { + callback(new googleError_1.GoogleError(err)); + }); + } + } + if (maxRetries && deadline) { + const error = new googleError_1.GoogleError('Cannot set both totalTimeoutMillis and maxRetries ' + + 'in backoffSettings.'); + error.code = status_1.Status.INVALID_ARGUMENT; + callback(error); + } + else { + repeat(); + } + return { + cancel() { + if (timeoutId) { + clearTimeout(timeoutId); + } + if (canceller) { + canceller.cancel(); + } + else { + const error = new googleError_1.GoogleError('cancelled'); + error.code = status_1.Status.CANCELLED; + callback(error); + } + }, + }; + }; +} +//# sourceMappingURL=retries.js.map + +/***/ }), + +/***/ 86328: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/** + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.addTimeoutArg = addTimeoutArg; +/** + * Updates func so that it gets called with the timeout as its final arg. + * + * This converts a function, func, into another function with updated deadline. + * + * @private + * + * @param {GRPCCall} func - a function to be updated. + * @param {number} timeout - to be added to the original function as it final + * positional arg. + * @param {Object} otherArgs - the additional arguments to be passed to func. + * @param {Object=} abTests - the A/B testing key/value pairs. + * @return {function(Object, APICallback)} + * the function with other arguments and the timeout. + */ +function addTimeoutArg(func, timeout, otherArgs, abTests) { + // TODO: this assumes the other arguments consist of metadata and options, + // which is specific to gRPC calls. Remove the hidden dependency on gRPC. + return (argument, callback) => { + const now = new Date(); + const options = otherArgs.options || {}; + options.deadline = new Date(now.getTime() + timeout); + const metadata = otherArgs.metadataBuilder + ? otherArgs.metadataBuilder(abTests, otherArgs.headers || {}) + : null; + return func(argument, metadata, options, callback); + }; +} +//# sourceMappingURL=timeout.js.map + +/***/ }), + +/***/ 99463: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/** + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.OperationsClientBuilder = exports.OperationsClient = exports.ALL_SCOPES = exports.SERVICE_ADDRESS = void 0; +const createApiCall_1 = __nccwpck_require__(42236); +const descriptor_1 = __nccwpck_require__(65151); +const gax = __nccwpck_require__(4996); +const configData = __nccwpck_require__(25365); +const operationProtoJson = __nccwpck_require__(9961); +const transcoding_1 = __nccwpck_require__(976); +exports.SERVICE_ADDRESS = 'longrunning.googleapis.com'; +const version = (__nccwpck_require__(57564).version); +const DEFAULT_SERVICE_PORT = 443; +const CODE_GEN_NAME_VERSION = 'gapic/0.7.1'; +/** + * The scopes needed to make gRPC calls to all of the methods defined in + * this service. + */ +exports.ALL_SCOPES = []; +/** + * Manages long-running operations with an API service. + * + * When an API method normally takes long time to complete, it can be designed + * to return {@link Operation} to the client, and the client can use this + * interface to receive the real response asynchronously by polling the + * operation resource, or pass the operation resource to another API (such as + * Google Cloud Pub/Sub API) to receive the response. Any API service that + * returns long-running operations should implement the `Operations` interface + * so developers can have a consistent client experience. + * + * This will be created through a builder function which can be obtained by the + * module. See the following example of how to initialize the module and how to + * access to the builder. + * @see {@link operationsClient} + * + * @class + */ +class OperationsClient { + constructor(gaxGrpc, + // eslint-disable-next-line @typescript-eslint/no-explicit-any + operationsProtos, options) { + const opts = Object.assign({ + servicePath: exports.SERVICE_ADDRESS, + port: DEFAULT_SERVICE_PORT, + clientConfig: {}, + }, options); + const googleApiClient = ['gl-node/' + process.versions.node]; + if (opts.libName && opts.libVersion) { + googleApiClient.push(opts.libName + '/' + opts.libVersion); + } + googleApiClient.push(CODE_GEN_NAME_VERSION, 'gax/' + version); + if (opts.fallback) { + googleApiClient.push('gl-web/' + version); + } + else { + googleApiClient.push('grpc/' + gaxGrpc.grpcVersion); + } + const defaults = gaxGrpc.constructSettings('google.longrunning.Operations', configData, opts.clientConfig || {}, { 'x-goog-api-client': googleApiClient.join(' ') }); + this.auth = gaxGrpc.auth; + // Set up a dictionary of "inner API calls"; the core implementation + // of calling the API is handled in `google-gax`, with this code + // merely providing the destination and request information. + this.innerApiCalls = {}; + this.descriptor = { + listOperations: new descriptor_1.PageDescriptor('pageToken', 'nextPageToken', 'operations'), + }; + // Put together the "service stub" for + // google.longrunning.Operations. + this.operationsStub = gaxGrpc.createStub(opts.fallback + ? operationsProtos.lookupService('google.longrunning.Operations') + : operationsProtos.google.longrunning.Operations, opts); + const operationsStubMethods = [ + 'getOperation', + 'listOperations', + 'cancelOperation', + 'deleteOperation', + ]; + for (const methodName of operationsStubMethods) { + const innerCallPromise = this.operationsStub.then(stub => (...args) => { + const func = stub[methodName]; + return func.apply(stub, args); + }, err => () => { + throw err; + }); + this.innerApiCalls[methodName] = (0, createApiCall_1.createApiCall)(innerCallPromise, defaults[methodName], this.descriptor[methodName]); + } + } + /** Closes this operations client. */ + close() { + this.operationsStub.then(stub => stub.close()); + } + getProjectId(callback) { + if (this.auth && 'getProjectId' in this.auth) { + return this.auth.getProjectId(callback); + } + if (callback) { + callback(new Error('Cannot determine project ID.')); + } + else { + return Promise.reject('Cannot determine project ID.'); + } + } + // Service calls + getOperationInternal(request, options, callback) { + request = request || {}; + options = options || {}; + return this.innerApiCalls.getOperation(request, options, callback); + } + /** + * Gets the latest state of a long-running operation. Clients can use this + * method to poll the operation result at intervals as recommended by the API + * service. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. The promise has a method named + * "cancel" which cancels the ongoing API call. + * + * @example + * + * const client = longrunning.operationsClient(); + * const name = ''; + * const [response] = await client.getOperation({name}); + * // doThingsWith(response) + */ + getOperation(request, optionsOrCallback, callback) { + let options; + if (optionsOrCallback instanceof Function && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + request = request || {}; + options = options || {}; + return this.innerApiCalls.getOperation(request, options, callback); + } + /** + * Lists operations that match the specified filter in the request. If the + * server doesn't support this method, it returns `UNIMPLEMENTED`. + * + * NOTE: the `name` binding below allows API services to override the binding + * to use different resource name schemes. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error, ?Array, ?Object, ?Object)=} callback + * The function which will be called with the result of the API call. + * + * The second parameter to the callback is Array of + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * + * When autoPaginate: false is specified through options, it contains the + * result in a single response. If the response indicates the next page + * exists, the third parameter is set to be used for the next request object. + * The fourth parameter keeps the raw response object of an object + * representing [google.longrunning.ListOperationsResponse]{@link + * external:"google.longrunning.ListOperationsResponse"}. + * @return {Promise} - The promise which resolves to an array. + * The first element of the array is Array of + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"}. + * + * When autoPaginate: false is specified through options, the array has + * three elements. The first element is Array of + * [google.longrunning.Operation]{@link + * external:"google.longrunning.Operation"} in a single response. The second + * element is the next request object if the response indicates the next page + * exists, or null. The third element is an object representing + * [google.longrunning.ListOperationsResponse]{@link + * external:"google.longrunning.ListOperationsResponse"}. + * + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * + * const client = longrunning.operationsClient(); + * const request = { + * name: '', + * filter: '' + * }; + * // Iterate over all elements. + * const [resources] = await client.listOperations(request); + * for (const resource of resources) { + * console.log(resources); + * } + * + * // Or obtain the paged response. + * const options = {autoPaginate: false}; + * let nextRequest = request; + * while(nextRequest) { + * const response = await client.listOperations(nextRequest, options); + * const resources = response[0]; + * nextRequest = response[1]; + * const rawResponse = response[2]; + * for (const resource of resources) { + * // doThingsWith(resource); + * } + * }; + */ + listOperations(request, optionsOrCallback, callback) { + let options; + if (optionsOrCallback instanceof Function && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + request = request || {}; + options = options || {}; + return this.innerApiCalls.listOperations(request, options, callback); + } + /** + * Equivalent to {@link listOperations}, but returns a NodeJS Stream object. + * + * This fetches the paged responses for {@link listOperations} continuously + * and invokes the callback registered for 'data' event for each element in + * the responses. + * + * The returned object has 'end' method when no more elements are required. + * + * autoPaginate option will be ignored. + * + * @see {@link https://nodejs.org/api/stream.html} + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @return {Stream} - An object stream which emits an object representing [google.longrunning.Operation]{@link external:"google.longrunning.Operation"} on 'data' event. + * + * @example + * + * const client = longrunning.operationsClient(); + * const request = { + * name: '', + * filter: '' + * }; + * client.listOperationsStream(request) + * .on('data', element => { + * // doThingsWith(element) + * }) + * .on('error', err => { + * console.error(err); + * }); + */ + listOperationsStream(request, options) { + const callSettings = new gax.CallSettings(options); + return this.descriptor.listOperations.createStream(this.innerApiCalls.listOperations, request, callSettings); + } + /** + * Equivalent to {@link listOperations}, but returns an iterable object. + * + * for-await-of syntax is used with the iterable to recursively get response element on-demand. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation collection. + * @param {string} request.filter - The standard list filter. + * @param {number=} request.pageSize - + * The maximum number of resources contained in the underlying API + * response. If page streaming is performed per-resource, this + * parameter does not affect the return value. If page streaming is + * performed per-page, this determines the maximum number of + * resources in a page. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @returns {Object} + * An iterable Object that conforms to @link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Iteration_protocols. + */ + listOperationsAsync(request, options) { + request = request || {}; + options = options || {}; + const callSettings = new gax.CallSettings(options); + return this.descriptor.listOperations.asyncIterate(this.innerApiCalls.listOperations, request, callSettings); + } + /** + * Starts asynchronous cancellation on a long-running operation. The server + * makes a best effort to cancel the operation, but success is not + * guaranteed. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. Clients can use + * {@link Operations.GetOperation} or + * other methods to check whether the cancellation succeeded or whether the + * operation completed despite cancellation. On successful cancellation, + * the operation is not deleted; instead, it becomes an operation with + * an {@link Operation.error} value with a {@link google.rpc.Status.code} of + * 1, corresponding to `Code.CANCELLED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be cancelled. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * + * const client = longrunning.operationsClient(); + * await client.cancelOperation({name: ''}); + */ + cancelOperation(request, optionsOrCallback, callback) { + let options; + if (optionsOrCallback instanceof Function && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + request = request || {}; + options = options || {}; + return this.innerApiCalls.cancelOperation(request, options, callback); + } + /** + * Deletes a long-running operation. This method indicates that the client is + * no longer interested in the operation result. It does not cancel the + * operation. If the server doesn't support this method, it returns + * `google.rpc.Code.UNIMPLEMENTED`. + * + * @param {Object} request - The request object that will be sent. + * @param {string} request.name - The name of the operation resource to be deleted. + * @param {Object=} options + * Optional parameters. You can override the default settings for this call, + * e.g, timeout, retries, paginations, etc. See [gax.CallOptions]{@link + * https://googleapis.github.io/gax-nodejs/global.html#CallOptions} for the + * details. + * @param {function(?Error)=} callback + * The function which will be called with the result of the API call. + * @return {Promise} - The promise which resolves when API call finishes. + * The promise has a method named "cancel" which cancels the ongoing API + * call. + * + * @example + * + * const client = longrunning.operationsClient(); + * await client.deleteOperation({name: ''}); + */ + deleteOperation(request, optionsOrCallback, callback) { + let options; + if (optionsOrCallback instanceof Function && callback === undefined) { + callback = optionsOrCallback; + options = {}; + } + else { + options = optionsOrCallback; + } + request = request || {}; + options = options || {}; + return this.innerApiCalls.deleteOperation(request, options, callback); + } +} +exports.OperationsClient = OperationsClient; +class OperationsClientBuilder { + /** + * Builds a new Operations Client + * @param gaxGrpc {GrpcClient} + */ + constructor(gaxGrpc, protoJson) { + if (protoJson && gaxGrpc.httpRules) { + // overwrite the http rules if provide in service yaml. + (0, transcoding_1.overrideHttpRules)(gaxGrpc.httpRules, protoJson); + } + const operationsProtos = protoJson !== null && protoJson !== void 0 ? protoJson : gaxGrpc.loadProtoJSON(operationProtoJson); + /** + * Build a new instance of {@link OperationsClient}. + * + * @param {Object=} opts - The optional parameters. + * @param {String=} opts.servicePath - Domain name of the API remote host. + * @param {number=} opts.port - The port on which to connect to the remote host. + * @param {grpc.ClientCredentials=} opts.sslCreds - A ClientCredentials for use with an SSL-enabled channel. + * @param {Object=} opts.clientConfig - The customized config to build the call settings. See {@link gax.constructSettings} for the format. + */ + this.operationsClient = opts => { + if (gaxGrpc.fallback) { + opts.fallback = gaxGrpc.fallback; + } + return new OperationsClient(gaxGrpc, operationsProtos, opts); + }; + Object.assign(this.operationsClient, OperationsClient); + } +} +exports.OperationsClientBuilder = OperationsClientBuilder; +//# sourceMappingURL=operationsClient.js.map + +/***/ }), + +/***/ 53798: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/** + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.PageDescriptor = void 0; +const stream_1 = __nccwpck_require__(2203); +const normalApiCaller_1 = __nccwpck_require__(51161); +const warnings_1 = __nccwpck_require__(25531); +const pagedApiCaller_1 = __nccwpck_require__(89780); +const maxAttemptsEmptyResponse = 10; +/** + * A descriptor for methods that support pagination. + */ +class PageDescriptor { + constructor(requestPageTokenField, responsePageTokenField, resourceField) { + this.requestPageTokenField = requestPageTokenField; + this.responsePageTokenField = responsePageTokenField; + this.resourceField = resourceField; + } + /** + * Creates a new object Stream which emits the resource on 'data' event. + */ + createStream(apiCall, request, options) { + if (options === null || options === void 0 ? void 0 : options.autoPaginate) { + (0, warnings_1.warn)('autoPaginate true', 'Autopaginate will always be set to false in stream paging methods. See more info at https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#auto-pagination for more information on how to configure paging calls', 'AutopaginateTrueWarning'); + } + const stream = new stream_1.PassThrough({ objectMode: true }); + options = Object.assign({}, options, { autoPaginate: false }); + const maxResults = 'maxResults' in options ? options.maxResults : -1; + let pushCount = 0; + let started = false; + function callback(err, resources, next, apiResp) { + if (err) { + stream.emit('error', err); + return; + } + // emit full api response with every page. + stream.emit('response', apiResp); + for (let i = 0; i < resources.length; ++i) { + // TODO: rewrite without accessing stream internals + if (stream + ._readableState.ended) { + return; + } + if (resources[i] === null) { + continue; + } + stream.push(resources[i]); + pushCount++; + if (pushCount === maxResults) { + stream.end(); + } + } + // TODO: rewrite without accessing stream internals + if (stream._readableState + .ended) { + return; + } + if (!next) { + stream.end(); + return; + } + // When pageToken is specified in the original options, it will overwrite + // the page token field in the next request. Therefore it must be cleared. + if ('pageToken' in options) { + delete options.pageToken; + } + if (stream.isPaused()) { + request = next; + started = false; + } + else { + setImmediate(apiCall, next, options, callback); + } + } + stream.on('resume', () => { + if (!started) { + started = true; + apiCall(request, options, callback); + } + }); + return stream; + } + /** + * Create an async iterable which can be recursively called for data on-demand. + */ + asyncIterate(apiCall, request, options) { + if (options === null || options === void 0 ? void 0 : options.autoPaginate) { + (0, warnings_1.warn)('autoPaginate true', 'Autopaginate will always be set to false in Async paging methods. See more info at https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#auto-pagination for more information on how to configure paging calls', 'AutopaginateTrueWarning'); + } + options = Object.assign({}, options, { autoPaginate: false }); + const iterable = this.createIterator(apiCall, request, options); + return iterable; + } + createIterator(apiCall, request, options) { + const asyncIterable = { + [Symbol.asyncIterator]() { + let nextPageRequest = request; + const cache = []; + return { + async next() { + if (cache.length > 0) { + return Promise.resolve({ + done: false, + value: cache.shift(), + }); + } + let attempts = 0; + while (cache.length === 0 && nextPageRequest) { + let result; + [result, nextPageRequest] = (await apiCall(nextPageRequest, options)); + // For pagination response with protobuf map type, use tuple as representation. + if (result && !Array.isArray(result)) { + for (const [key, value] of Object.entries(result)) { + cache.push([key, value]); + } + } + else { + cache.push(...result); + } + if (cache.length === 0) { + ++attempts; + if (attempts > maxAttemptsEmptyResponse) { + break; + } + } + } + if (cache.length === 0) { + return Promise.resolve({ done: true, value: undefined }); + } + return Promise.resolve({ done: false, value: cache.shift() }); + }, + }; + }, + }; + return asyncIterable; + } + getApiCaller(settings) { + if (!settings.autoPaginate) { + return new normalApiCaller_1.NormalApiCaller(); + } + return new pagedApiCaller_1.PagedApiCaller(this); + } +} +exports.PageDescriptor = PageDescriptor; +//# sourceMappingURL=pageDescriptor.js.map + +/***/ }), + +/***/ 89780: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/** + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.PagedApiCaller = void 0; +const call_1 = __nccwpck_require__(49746); +const googleError_1 = __nccwpck_require__(34775); +const resourceCollector_1 = __nccwpck_require__(73281); +const warnings_1 = __nccwpck_require__(25531); +class PagedApiCaller { + /** + * Creates an API caller that returns a stream to performs page-streaming. + * + * @private + * @constructor + * @param {PageDescriptor} pageDescriptor - indicates the structure + * of page streaming to be performed. + */ + constructor(pageDescriptor) { + this.pageDescriptor = pageDescriptor; + } + /** + * This function translates between regular gRPC calls (that accepts a request and returns a response, + * and does not know anything about pages and page tokens) and the users' callback (that expects + * to see resources from one page, a request to get the next page, and the raw response from the server). + * + * It generates a function that can be passed as a callback function to a gRPC call, will understand + * pagination-specific fields in the response, and call the users' callback after having those fields + * parsed. + * + * @param request Request object. It needs to be passed to all subsequent next page requests + * (the main content of the request object stays unchanged, only the next page token changes) + * @param callback The user's callback that expects the page content, next page request, and raw response. + */ + generateParseResponseCallback(request, callback) { + const resourceFieldName = this.pageDescriptor.resourceField; + const responsePageTokenFieldName = this.pageDescriptor.responsePageTokenField; + const requestPageTokenFieldName = this.pageDescriptor.requestPageTokenField; + return (err, response) => { + if (err) { + callback(err); + return; + } + if (!request) { + callback(new googleError_1.GoogleError('Undefined request in pagination method callback.')); + return; + } + if (!response) { + callback(new googleError_1.GoogleError('Undefined response in pagination method callback.')); + return; + } + const resources = response[resourceFieldName] || []; + const pageToken = response[responsePageTokenFieldName]; + let nextPageRequest = null; + if (pageToken) { + nextPageRequest = Object.assign({}, request); + nextPageRequest[requestPageTokenFieldName] = pageToken; + } + callback(err, resources, nextPageRequest, response); + }; + } + /** + * Adds a special ability to understand pagination-specific fields to the existing gRPC call. + * The original gRPC call just calls callback(err, result). + * The wrapped one will call callback(err, resources, nextPageRequest, rawResponse) instead. + * + * @param func gRPC call (normally, a service stub call). The gRPC call is expected to accept four parameters: + * request, metadata, call options, and callback. + */ + wrap(func) { + // eslint-disable-next-line @typescript-eslint/no-this-alias + const self = this; + return function wrappedCall(argument, metadata, options, callback) { + return func(argument, metadata, options, self.generateParseResponseCallback(argument, callback)); + }; + } + /** + * Makes it possible to use both callback-based and promise-based calls. + * Returns an OngoingCall or OngoingCallPromise object. + * Regardless of which one is returned, it always has a `.callback` to call. + * + * @param settings Call settings. Can only be used to replace Promise with another promise implementation. + * @param [callback] Callback to be called, if any. + */ + init(callback) { + if (callback) { + return new call_1.OngoingCall(callback); + } + return new call_1.OngoingCallPromise(); + } + /** + * Implements auto-pagination logic. + * + * @param apiCall A function that performs gRPC request and calls its callback with a response or an error. + * It's supposed to be a gRPC service stub function wrapped into several layers of wrappers that make it + * accept just two parameters: (request, callback). + * @param request A request object that came from the user. + * @param settings Call settings. We are interested in `maxResults` and `autoPaginate` (they are optional). + * @param ongoingCall An instance of OngoingCall or OngoingCallPromise that can be used for call cancellation, + * and is used to return results to the user. + */ + call(apiCall, request, settings, ongoingCall) { + request = Object.assign({}, request); + if (!settings.autoPaginate) { + // they don't want auto-pagination this time - okay, just call once + ongoingCall.call(apiCall, request); + return; + } + if (request.pageSize && settings.autoPaginate) { + (0, warnings_1.warn)('autoPaginate true', 'Providing a pageSize without setting autoPaginate to false will still return all results. See https://github.com/googleapis/gax-nodejs/blob/main/client-libraries.md#auto-pagination for more information on how to configure manual paging', 'AutopaginateTrueWarning'); + } + const maxResults = settings.maxResults || -1; + const resourceCollector = new resourceCollector_1.ResourceCollector(apiCall, maxResults); + resourceCollector.processAllPages(request).then(resources => ongoingCall.callback(null, resources), err => ongoingCall.callback(err)); + } + fail(ongoingCall, err) { + ongoingCall.callback(err); + } + result(ongoingCall) { + return ongoingCall.promise; + } +} +exports.PagedApiCaller = PagedApiCaller; +//# sourceMappingURL=pagedApiCaller.js.map + +/***/ }), + +/***/ 73281: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/** + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.ResourceCollector = void 0; +/** + * ResourceCollector class implements asynchronous logic of calling the API call that supports pagination, + * page by page, collecting all resources (up to `maxResults`) in the array. + * + * Usage: + * const resourceCollector = new ResourceCollector(apiCall, maxResults); // -1 for unlimited + * resourceCollector.processAllPages(request).then(resources => ...); + */ +class ResourceCollector { + constructor(apiCall, maxResults = -1) { + this.apiCall = apiCall; + this.resources = []; + this.maxResults = maxResults; + } + callback(err, resources, nextPageRequest) { + if (err) { + // Something went wrong with this request - failing everything + this.rejectCallback(err); + return; + } + // Process one page + for (const resource of resources) { + this.resources.push(resource); + if (this.resources.length === this.maxResults) { + nextPageRequest = null; + break; + } + } + // All done? + if (!nextPageRequest) { + this.resolveCallback(this.resources); + return; + } + // Schedule the next call + const callback = (...args) => this.callback(...args); + setImmediate(this.apiCall, nextPageRequest, callback); + } + processAllPages(firstRequest) { + return new Promise((resolve, reject) => { + this.resolveCallback = resolve; + this.rejectCallback = reject; + // Schedule the first call + const callback = (...args) => this.callback(...args); + setImmediate(this.apiCall, firstRequest, callback); + }); + } +} +exports.ResourceCollector = ResourceCollector; +//# sourceMappingURL=resourceCollector.js.map + +/***/ }), + +/***/ 66575: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/** + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.PathTemplate = void 0; +class PathTemplate { + /** + * @param {String} data the of the template + * + * @constructor + */ + constructor(data) { + this.bindings = {}; + this.data = data; + this.segments = this.parsePathTemplate(data); + this.size = this.segments.length; + } + /** + * Matches a fully-qualified path template string. + * + * @param {String} path a fully-qualified path template string + * @return {Object} contains const names matched to binding values + * @throws {TypeError} if path can't be matched to this template + */ + match(path) { + let pathSegments = path.split('/'); + const bindings = {}; + if (pathSegments.length !== this.segments.length) { + // if the path contains a wildcard, then the length may differ by 1. + if (!this.data.includes('**')) { + throw new TypeError(`This path ${path} does not match path template ${this.data}, the number of parameters is not same.`); + } + else if (pathSegments.length !== this.segments.length + 1) { + throw new TypeError(`This path ${path} does not match path template ${this.data}, the number of parameters is not same with one wildcard.`); + } + } + for (let index = 0; index < this.segments.length && pathSegments.length > 0; index++) { + if (this.segments[index] !== pathSegments[0]) { + if (!this.segments[index].includes('*')) { + throw new TypeError(`segment does not match, ${this.segments[index]} and ${pathSegments[index]}.`); + } + else { + let segment = this.segments[index]; + const matches = segment.match(/\{[$0-9a-zA-Z_]+=.*?\}/g); + if (!matches) { + throw new Error(`Error processing path template segment ${segment}`); + } + const variables = matches.map(str => str.replace(/^\{/, '').replace(/=.*/, '')); + if (segment.includes('**')) { + bindings[variables[0]] = pathSegments[0] + '/' + pathSegments[1]; + pathSegments = pathSegments.slice(2); + } + else { + // atomic resource + if (variables.length === 1) { + bindings[variables[0]] = pathSegments[0]; + } + else { + // non-slash resource + // segment: {blurb_id=*}.{legacy_user=*} to match pathSegments: ['bar.user2'] + // split the match pathSegments[0] -> value: ['bar', 'user2'] + // compare the length of two arrays, and compare array items + const value = pathSegments[0].split(/[-_.~]/); + if (value.length !== variables.length) { + throw new Error(`segment ${segment} does not match ${pathSegments[0]}`); + } + for (const v of variables) { + bindings[v] = value[0]; + segment = segment.replace(`{${v}=*}`, `${value[0]}`); + value.shift(); + } + // segment: {blurb_id=*}.{legacy_user=*} matching pathSegments: ['bar~user2'] should fail + if (segment !== pathSegments[0]) { + throw new TypeError(`non slash resource pattern ${this.segments[index]} and ${pathSegments[0]} should have same separator`); + } + } + pathSegments.shift(); + } + } + } + else { + pathSegments.shift(); + } + } + return bindings; + } + /** + * Renders a path template using the provided bindings. + * + * @param {Object} bindings a mapping of const names to binding strings + * @return {String} a rendered representation of the path template + * @throws {TypeError} if a key is missing, or if a sub-template cannot be + * parsed + */ + render(bindings) { + if (Object.keys(bindings).length !== Object.keys(this.bindings).length) { + throw new TypeError(`The number of variables ${Object.keys(bindings).length} does not match the number of needed variables ${Object.keys(this.bindings).length}`); + } + let path = this.inspect(); + for (const key of Object.keys(bindings)) { + const b = bindings[key].toString(); + if (!this.bindings[key]) { + throw new TypeError(`render fails for not matching ${bindings[key]}`); + } + const variable = this.bindings[key]; + if (variable === '*') { + if (!b.match(/[^/{}]+/)) { + throw new TypeError(`render fails for not matching ${b}`); + } + path = path.replace(`{${key}=*}`, `${b}`); + } + else if (variable === '**') { + if (!b.match(/[^{}]+/)) { + throw new TypeError(`render fails for not matching ${b}`); + } + path = path.replace(`{${key}=**}`, `${b}`); + } + } + return path; + } + /** + * Renders the path template. + * + * @return {string} contains const names matched to binding values + */ + inspect() { + return this.segments.join('/'); + } + /** + * Parse the path template. + * + * @return {string[]} return segments of the input path. + * For example: 'buckets/{hello}'' will give back ['buckets', {hello=*}] + */ + parsePathTemplate(data) { + const pathSegments = splitPathTemplate(data); + let index = 0; + let wildCardCount = 0; + const segments = []; + let matches; + pathSegments.forEach(segment => { + // * or ** -> segments.push('{$0=*}'); + // -> bindings['$0'] = '*' + if (segment === '*' || segment === '**') { + this.bindings[`$${index}`] = segment; + segments.push(`{$${index}=${segment}}`); + index = index + 1; + if (segment === '**') { + ++wildCardCount; + } + } + else if ((matches = segment.match(/\{[0-9a-zA-Z-.~_]+(?:=.*?)?\}/g))) { + for (const subsegment of matches) { + const pairMatch = subsegment.match(/^\{([0-9a-zA-Z-.~_]+)(?:=(.*?))?\}$/); + if (!pairMatch) { + throw new Error(`Cannot process path template segment ${subsegment}`); + } + const key = pairMatch[1]; + let value = pairMatch[2]; + if (!value) { + value = '*'; + segment = segment.replace(key, key + '=*'); + this.bindings[key] = value; + } + else if (value === '*') { + this.bindings[key] = value; + } + else if (value === '**') { + ++wildCardCount; + this.bindings[key] = value; + } + } + segments.push(segment); + } + else if (segment.match(/[0-9a-zA-Z-.~_]+/)) { + segments.push(segment); + } + }); + if (wildCardCount > 1) { + throw new TypeError('Can not have more than one wildcard.'); + } + return segments; + } +} +exports.PathTemplate = PathTemplate; +/** + * Split the path template by `/`. + * It can not be simply splitted by `/` because there might be `/` in the segments. + * For example: 'a/b/{a=hello/world}' we do not want to break the brackets pair + * so above path will be splitted as ['a', 'b', '{a=hello/world}'] + */ +function splitPathTemplate(data) { + let left = 0; + let right = 0; + let bracketCount = 0; + const segments = []; + while (right >= left && right < data.length) { + if (data.charAt(right) === '{') { + bracketCount = bracketCount + 1; + } + else if (data.charAt(right) === '}') { + bracketCount = bracketCount - 1; + } + else if (data.charAt(right) === '/') { + if (right === data.length - 1) { + throw new TypeError('Invalid path, it can not be ended by /'); + } + if (bracketCount === 0) { + // complete bracket, to avoid the case a/b/**/*/{a=hello/world} + segments.push(data.substring(left, right)); + left = right + 1; + } + } + if (right === data.length - 1) { + if (bracketCount !== 0) { + throw new TypeError('Brackets are invalid.'); + } + segments.push(data.substring(left)); + } + right = right + 1; + } + return segments; +} +//# sourceMappingURL=pathTemplate.js.map + +/***/ }), + +/***/ 71529: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; +var __webpack_unused_export__; + +/** + * Copyright 2022 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +__webpack_unused_export__ = ({ value: true }); +exports.protobufMinimal = void 0; +// This file is here to re-export protobuf.js so that the proto.js files +// produced by tools/compileProtos.ts did not depend on protobuf.js +// directly. +// Usage: +// const {protobufMinimal} = require('google-gax/build/src/protobuf'); +exports.protobufMinimal = __nccwpck_require__(37823); +//# sourceMappingURL=protobuf.js.map + +/***/ }), + +/***/ 37515: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/** + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.fromParams = fromParams; +const querystring = __nccwpck_require__(83480); +/** + * Helpers for constructing routing headers. + * + * These headers are used by Google infrastructure to determine how to route + * requests, especially for services that are regional. + * + * Generally, these headers are specified as gRPC metadata. + */ +/** + * Constructs the routing header from the given params + * + * @param {Object} params - the request header parameters. + * @return {string} the routing header value. + */ +function fromParams(params) { + return querystring.stringify(params); +} +//# sourceMappingURL=routingHeader.js.map + +/***/ }), + +/***/ 69124: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/** + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.HttpCodeToRpcCodeMap = exports.Status = void 0; +exports.rpcCodeFromHttpStatusCode = rpcCodeFromHttpStatusCode; +// The following is a copy of the Status enum defined in @grpc/grpc-js, +// src/constants.ts. We need to use some of these statuses here and there, +// but we don't want to include the whole @grpc/grpc-js into the browser +// bundle just to have this small enum. +var Status; +(function (Status) { + Status[Status["OK"] = 0] = "OK"; + Status[Status["CANCELLED"] = 1] = "CANCELLED"; + Status[Status["UNKNOWN"] = 2] = "UNKNOWN"; + Status[Status["INVALID_ARGUMENT"] = 3] = "INVALID_ARGUMENT"; + Status[Status["DEADLINE_EXCEEDED"] = 4] = "DEADLINE_EXCEEDED"; + Status[Status["NOT_FOUND"] = 5] = "NOT_FOUND"; + Status[Status["ALREADY_EXISTS"] = 6] = "ALREADY_EXISTS"; + Status[Status["PERMISSION_DENIED"] = 7] = "PERMISSION_DENIED"; + Status[Status["RESOURCE_EXHAUSTED"] = 8] = "RESOURCE_EXHAUSTED"; + Status[Status["FAILED_PRECONDITION"] = 9] = "FAILED_PRECONDITION"; + Status[Status["ABORTED"] = 10] = "ABORTED"; + Status[Status["OUT_OF_RANGE"] = 11] = "OUT_OF_RANGE"; + Status[Status["UNIMPLEMENTED"] = 12] = "UNIMPLEMENTED"; + Status[Status["INTERNAL"] = 13] = "INTERNAL"; + Status[Status["UNAVAILABLE"] = 14] = "UNAVAILABLE"; + Status[Status["DATA_LOSS"] = 15] = "DATA_LOSS"; + Status[Status["UNAUTHENTICATED"] = 16] = "UNAUTHENTICATED"; +})(Status || (exports.Status = Status = {})); +exports.HttpCodeToRpcCodeMap = new Map([ + [400, Status.INVALID_ARGUMENT], + [401, Status.UNAUTHENTICATED], + [403, Status.PERMISSION_DENIED], + [404, Status.NOT_FOUND], + [409, Status.ABORTED], + [416, Status.OUT_OF_RANGE], + [429, Status.RESOURCE_EXHAUSTED], + [499, Status.CANCELLED], + [501, Status.UNIMPLEMENTED], + [503, Status.UNAVAILABLE], + [504, Status.DEADLINE_EXCEEDED], +]); +// Maps HTTP status codes to gRPC status codes above. +function rpcCodeFromHttpStatusCode(httpStatusCode) { + if (exports.HttpCodeToRpcCodeMap.has(httpStatusCode)) { + return exports.HttpCodeToRpcCodeMap.get(httpStatusCode); + } + // All 2xx + if (httpStatusCode >= 200 && httpStatusCode < 300) { + return Status.OK; + } + // All other 4xx + if (httpStatusCode >= 400 && httpStatusCode < 500) { + return Status.FAILED_PRECONDITION; + } + // All other 5xx + if (httpStatusCode >= 500 && httpStatusCode < 600) { + return Status.INTERNAL; + } + // Everything else + return Status.UNKNOWN; +} +//# sourceMappingURL=status.js.map + +/***/ }), + +/***/ 46690: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/** + * Copyright 2021 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.StreamArrayParser = void 0; +const abort_controller_1 = __nccwpck_require__(17413); +const stream_1 = __nccwpck_require__(2203); +const fallbackRest_1 = __nccwpck_require__(32230); +const featureDetection_1 = __nccwpck_require__(83515); +class StreamArrayParser extends stream_1.Transform { + /** + * StreamArrayParser processes array of valid JSON objects in random chunks + * through readable stream, and produces a stream of plain Javascript objects + * where it converted from the corresponding protobuf message instance. + * + * The default JSON parser decodes the input stream under the + * following rules: + * 1. The stream represents a valid JSON array (must start with a "[" and + * close with the corresponding "]"). Each element of this array is assumed to + * be either an array or an object, and will be decoded as a JS object and + * delivered. + * 2. All JSON elements in the buffer will be decoded and delivered in a + * stream. + * + * @private + * @constructor + * @param {protobuf.Method} rpc - the protobuf method produce array of JSON. + * @param {Object} options - the options pass to Transform Stream. See more + * details + * https://nodejs.org/api/stream.html#stream_new_stream_transform_options. + */ + constructor(rpc, options) { + super(Object.assign({}, options, { readableObjectMode: true })); + this._done = false; + this._prevBlock = Buffer.from(''); + this._isInString = false; + this._isSkipped = false; + this._level = 0; + this.rpc = rpc; + this.cancelController = (0, featureDetection_1.hasAbortController)() + ? new AbortController() + : new abort_controller_1.AbortController(); + this.cancelSignal = this.cancelController.signal; + this.cancelRequested = false; + } + _transform(chunk, _, callback) { + let objectStart = 0; + let curIndex = 0; + if (this._level === 0 && curIndex === 0) { + if (String.fromCharCode(chunk[0]) !== '[') { + this.emit('error', new Error(`Internal Error: API service stream data must start with a '[' and close with the corresponding ']', but it start with ${String.fromCharCode(chunk[0])}`)); + } + curIndex++; + this._level++; + } + while (curIndex < chunk.length) { + const curValue = String.fromCharCode(chunk[curIndex]); + if (!this._isSkipped) { + switch (curValue) { + case '{': + // Check if it's in string, we ignore the curly brace in string. + // Otherwise the object level++. + if (!this._isInString) { + this._level++; + } + if (!this._isInString && this._level === 2) { + objectStart = curIndex; + } + break; + case '"': + // Flip the string status + this._isInString = !this._isInString; + break; + case '}': + // check if it's in string + // if true, do nothing + // if false and level = 0, push data + if (!this._isInString) { + this._level--; + } + if (!this._isInString && this._level === 1) { + // find a object + const objBuff = Buffer.concat([ + this._prevBlock, + chunk.slice(objectStart, curIndex + 1), + ]); + try { + // HTTP response.ok is true. + const msgObj = (0, fallbackRest_1.decodeResponse)(this.rpc, true, objBuff); + this.push(msgObj); + } + catch (err) { + this.emit('error', err); + } + objectStart = curIndex + 1; + this._prevBlock = Buffer.from(''); + } + break; + case ']': + if (!this._isInString && this._level === 1) { + this._done = true; + this.push(null); + } + break; + case '\\': + // Escaping escape character. + this._isSkipped = true; + break; + default: + break; + } + } + else { + this._isSkipped = false; + } + curIndex++; + } + if (this._level > 1) { + this._prevBlock = Buffer.concat([ + this._prevBlock, + chunk.slice(objectStart, curIndex), + ]); + } + callback(); + } + _flush(callback) { + callback(); + } + cancel() { + this._done = true; + this.cancelRequested = true; + this.cancelController.abort(); + this.end(); + } +} +exports.StreamArrayParser = StreamArrayParser; +//# sourceMappingURL=streamArrayParser.js.map + +/***/ }), + +/***/ 67839: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/** + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.StreamDescriptor = void 0; +const streamingApiCaller_1 = __nccwpck_require__(98177); +/** + * A descriptor for streaming calls. + */ +class StreamDescriptor { + constructor(streamType, rest, gaxStreamingRetries) { + this.type = streamType; + this.streaming = true; + this.rest = rest; + this.gaxStreamingRetries = gaxStreamingRetries; + } + getApiCaller() { + // Right now retrying does not work with gRPC-streaming, because retryable + // assumes an API call returns an event emitter while gRPC-streaming methods + // return Stream. + return new streamingApiCaller_1.StreamingApiCaller(this); + } +} +exports.StreamDescriptor = StreamDescriptor; +//# sourceMappingURL=streamDescriptor.js.map + +/***/ }), + +/***/ 21224: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/** + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.StreamProxy = exports.StreamType = void 0; +const gax_1 = __nccwpck_require__(4996); +const googleError_1 = __nccwpck_require__(34775); +const status_1 = __nccwpck_require__(69124); +const stream_1 = __nccwpck_require__(2203); +// eslint-disable-next-line @typescript-eslint/no-var-requires +const duplexify = __nccwpck_require__(29112); +// eslint-disable-next-line @typescript-eslint/no-var-requires +const retryRequest = __nccwpck_require__(67842); +/** + * The type of gRPC streaming. + * @enum {number} + */ +var StreamType; +(function (StreamType) { + /** Client sends a single request, server streams responses. */ + StreamType[StreamType["SERVER_STREAMING"] = 1] = "SERVER_STREAMING"; + /** Client streams requests, server returns a single response. */ + StreamType[StreamType["CLIENT_STREAMING"] = 2] = "CLIENT_STREAMING"; + /** Both client and server stream objects. */ + StreamType[StreamType["BIDI_STREAMING"] = 3] = "BIDI_STREAMING"; +})(StreamType || (exports.StreamType = StreamType = {})); +// In retry-request, you could pass parameters to request using the requestOpts parameter +// when we called retry-request from gax, we always passed null +// passing null here removes an unnecessary parameter from this implementation +const requestOps = null; +class StreamProxy extends duplexify { + /** + * StreamProxy is a proxy to gRPC-streaming method. + * + * @private + * @constructor + * @param {StreamType} type - the type of gRPC stream. + * @param {ApiCallback} callback - the callback for further API call. + */ + constructor(type, callback, rest, gaxServerStreamingRetries) { + super(undefined, undefined, { + objectMode: true, + readable: type !== StreamType.CLIENT_STREAMING, + writable: type !== StreamType.SERVER_STREAMING, + }); + this.type = type; + this._callback = callback; + this._isCancelCalled = false; + this._responseHasSent = false; + this.rest = rest; + this.gaxServerStreamingRetries = gaxServerStreamingRetries; + } + shouldRetryRequest(error, retry) { + const e = googleError_1.GoogleError.parseGRPCStatusDetails(error); + let shouldRetry = this.defaultShouldRetry(e, retry); + if (retry.shouldRetryFn) { + shouldRetry = retry.shouldRetryFn(e); + } + return shouldRetry; + } + cancel() { + if (this.stream) { + this.stream.cancel(); + } + else { + this._isCancelCalled = true; + } + } + /** + * Helper function to handle total timeout + max retry check for server streaming retries + * @param {number} deadline - the current retry deadline + * @param {number} maxRetries - maximum total number of retries + * @param {number} totalTimeoutMillis - total timeout in milliseconds used in timeout calculation + * @param {GoogleError} originalError - underlying error received by the stream + * @param {originalTimeout} originalTimeout - the original Timeout set in backoff settings + * @param {retries} retries - the number of retries the call has made so far + */ + throwIfMaxRetriesOrTotalTimeoutExceeded(deadline, maxRetries, totalTimeoutMillis, originalError, originalTimeout, retries) { + const now = new Date(); + const nowTime = now.getTime(); + if (originalTimeout && + (totalTimeoutMillis === 0 || + totalTimeoutMillis < 0 || + (deadline && nowTime >= deadline))) { + const error = new googleError_1.GoogleError(`Total timeout of API exceeded ${originalTimeout} milliseconds ${originalError ? `retrying error ${originalError} ` : ''} before any response was received.`); + error.code = status_1.Status.DEADLINE_EXCEEDED; + throw error; + } + if (maxRetries === 0) { + const error = originalError; + error.note = 'Max retries is set to zero.'; + throw error; + } + if (retries && retries >= maxRetries) { + const error = new googleError_1.GoogleError('Exceeded maximum number of retries ' + + (originalError ? `retrying error ${originalError} ` : '') + + 'before any response was received'); + error.code = status_1.Status.DEADLINE_EXCEEDED; + throw error; + } + } + /** + * Forwards events from an API request stream to the user's stream. + * @param {Stream} stream - The API request stream. + */ + eventForwardHelper(stream) { + const eventsToForward = ['metadata', 'response', 'status']; + eventsToForward.forEach(event => { + stream.on(event, this.emit.bind(this, event)); + }); + } + /** + * Helper function that emits a response on the stream after either a 'metadata' + * or a 'status' event - this helps streams to behave more like http consumers expect + * @param {Stream} stream - The API request stream. + */ + statusMetadataHelper(stream) { + // gRPC is guaranteed emit the 'status' event but not 'metadata', and 'status' is the last event to emit. + // Emit the 'response' event if stream has no 'metadata' event. + // This avoids the stream swallowing the other events, such as 'end'. + stream.on('status', () => { + if (!this._responseHasSent) { + stream.emit('response', { + code: 200, + details: '', + message: 'OK', + }); + } + }); + // We also want to supply the status data as 'response' event to support + // the behavior of google-cloud-node expects. + // see: + // https://github.com/GoogleCloudPlatform/google-cloud-node/pull/1775#issuecomment-259141029 + // https://github.com/GoogleCloudPlatform/google-cloud-node/blob/116436fa789d8b0f7fc5100b19b424e3ec63e6bf/packages/common/src/grpc-service.js#L355 + stream.on('metadata', metadata => { + // Create a response object with succeeds. + // TODO: unify this logic with the decoration of gRPC response when it's + // added. see: https://github.com/googleapis/gax-nodejs/issues/65 + stream.emit('response', { + code: 200, + details: '', + message: 'OK', + metadata, + }); + this._responseHasSent = true; + }); + } + /** + * Forward events from an API request stream to the user's stream. + * @param {Stream} stream - The API request stream. + * @param {RetryOptions} retry - Configures the exceptions upon which the + * function should retry, and the parameters to the exponential backoff retry + * algorithm. + */ + forwardEvents(stream) { + this.eventForwardHelper(stream); + this.statusMetadataHelper(stream); + stream.on('error', error => { + googleError_1.GoogleError.parseGRPCStatusDetails(error); + }); + } + /** + * Default mechanism for determining whether a streaming call should retry + * If a user passes in a "shouldRetryFn", this will not be used + * @param {GoogleError} errpr - The error we need to determine is retryable or not + * @param {RetryOptions} retry - Configures the exceptions upon which the + * function should retry, and the parameters to the exponential backoff retry + * algorithm. + */ + defaultShouldRetry(error, retry) { + if ((retry.retryCodes.length > 0 && + retry.retryCodes.indexOf(error.code) < 0) || + retry.retryCodes.length === 0) { + return false; + } + return true; + } + /** + * Specifies the target stream. + * @param {ApiCall} apiCall - the API function to be called. + * @param {Object} argument - the argument to be passed to the apiCall. + * @param {RetryOptions} retry - Configures the exceptions upon which the + * function should retry, and the parameters to the exponential backoff retry + * algorithm. + */ + setStream(apiCall, argument, retryRequestOptions = {}, retry) { + this.apiCall = apiCall; + this.argument = argument; + if (this.type === StreamType.SERVER_STREAMING) { + if (this.rest) { + const stream = apiCall(argument, this._callback); + this.stream = stream; + this.setReadable(stream); + } + else if (this.gaxServerStreamingRetries) { + const request = () => { + if (this._isCancelCalled) { + if (this.stream) { + this.stream.cancel(); + } + return; + } + const stream = apiCall(argument, this._callback); + return stream; + }; + const retryStream = this.newStreamingRetryRequest({ request, retry }); + this.stream = retryStream; + this.eventForwardHelper(retryStream); + this.setReadable(retryStream); + } + else { + const retryStream = retryRequest(null, { + objectMode: true, + request: () => { + if (this._isCancelCalled) { + if (this.stream) { + this.stream.cancel(); + } + return; + } + const stream = apiCall(argument, this._callback); + this.stream = stream; + this.forwardEvents(stream); + return stream; + }, + retries: retryRequestOptions.retries, + currentRetryAttempt: retryRequestOptions.currentRetryAttempt, + noResponseRetries: retryRequestOptions.noResponseRetries, + shouldRetryFn: retryRequestOptions.shouldRetryFn, + }); + this.setReadable(retryStream); + } + return; + } + const stream = apiCall(argument, this._callback); + this.stream = stream; + this.forwardEvents(stream); + if (this.type === StreamType.CLIENT_STREAMING) { + this.setWritable(stream); + } + if (this.type === StreamType.BIDI_STREAMING) { + this.setReadable(stream); + this.setWritable(stream); + } + if (this._isCancelCalled && this.stream) { + this.stream.cancel(); + } + } + /** + * Creates a new retry request stream - + *inner arrow function "newMakeRequest" handles retrying and resumption + * @param {streamingRetryRequestOptions} opts + * {request} - the request to be made if the stream errors + * {retry} - the retry options associated with the call + * @returns {CancellableStream} - the stream that handles retry logic + */ + newStreamingRetryRequest(opts) { + var _a, _b, _c, _d; + // at this point, it would be unexpected if retry were undefined + // but if it is, provide a logical default so we don't run into trouble + const retry = (_a = opts.retry) !== null && _a !== void 0 ? _a : { + retryCodes: [], + backoffSettings: (0, gax_1.createDefaultBackoffSettings)(), + }; + let retries = 0; + const retryStream = new stream_1.PassThrough({ + objectMode: true, + }); + const totalTimeout = (_b = retry.backoffSettings.totalTimeoutMillis) !== null && _b !== void 0 ? _b : undefined; + const maxRetries = (_c = retry.backoffSettings.maxRetries) !== null && _c !== void 0 ? _c : undefined; + let timeout = (_d = retry.backoffSettings.initialRpcTimeoutMillis) !== null && _d !== void 0 ? _d : undefined; + let now = new Date(); + let deadline = 0; + if (totalTimeout) { + deadline = now.getTime() + totalTimeout; + } + const transientErrorHelper = (error, requestStream) => { + const e = googleError_1.GoogleError.parseGRPCStatusDetails(error); + e.note = + 'Exception occurred in retry method that was ' + + 'not classified as transient'; + // clean up the request stream and retryStreams, silently destroy it on the request stream + // but do raise it on destructin of the retryStream so the consumer can see it + requestStream.destroy(); + retryStream.destroy(e); + return retryStream; + }; + const newMakeRequest = (newopts) => { + let dataEnd = false; + let statusReceived = false; + let enteredError = false; + // make the request + const requestStream = newopts.request(requestOps); + retryStream.cancel = requestStream.cancel; // make sure the retryStream is also cancellable by the user + const eventsToForward = ['metadata', 'response', 'status']; + eventsToForward.forEach(event => { + requestStream.on(event, retryStream.emit.bind(retryStream, event)); + }); + this.statusMetadataHelper(requestStream); + // TODO - b/353262542 address buffer stuff + requestStream.on('data', (data) => { + retries = 0; + this.emit.bind(this, 'data')(data); + }); + /* in retry-request, which previously handled retries, + * "end" could be emitted on a request stream before other gRPC events. + * To ensure it doesn't reach the consumer stream prematurely, retry-request piped + * two streams together (delayStream and retryStream) + * to ensure that "end" only emitted after a "response" event + * + * We are consciously NOT using pipeline or .pipe as part of similar logic here + * because we want more control over what happens during event handoff and we want to + * avoid the undesired behavior that can happen with error events + * if consumers in client libraries are also using pipes + * + * Since "status" is guaranteed to be the last event emitted by gRPC. + * If we have seen an "end" event, the dataEnd boolean will be true and we can safely + * end the stream. + * + * The "statusReceived" boolean covers the opposite case - that we receive the "status" event before + * a successful stream end event - this signals the .on('end') event handler that it's okay to end the stream + * + * + */ + requestStream.on('status', () => { + statusReceived = true; + if (dataEnd) { + retryStream.end(); + } + return retryStream; + }); + requestStream.on('end', () => { + if (!enteredError) { + dataEnd = true; + // in this case, we've already received "status" + // which is the last event from gRPC, so it's cool to end the stream + if (statusReceived) { + retryStream.end(); + } + } + return retryStream; + // there is no else case because if enteredError + // is true, we will handle stream destruction as part of + // either retrying (where we don't want to end the stream) + // or as part of error handling, which will take care of stream destruction + }); + requestStream.on('error', (error) => { + enteredError = true; + // type check for undefined instead of for truthiness in case maxRetries or timeout is equal to zero + if (typeof maxRetries !== undefined || + typeof totalTimeout !== undefined) { + if (this.shouldRetryRequest(error, retry)) { + if (maxRetries && totalTimeout) { + const newError = new googleError_1.GoogleError('Cannot set both totalTimeoutMillis and maxRetries ' + + 'in backoffSettings.'); + newError.code = status_1.Status.INVALID_ARGUMENT; + // clean up the request stream and retryStreams, silently destroy it on the request stream + // but do raise it on destructin of the retryStream so the consumer can see it + requestStream.destroy(); + retryStream.destroy(newError); + return retryStream; + } + else { + // check for exceeding timeout or max retries + try { + this.throwIfMaxRetriesOrTotalTimeoutExceeded(deadline, maxRetries, timeout, error, totalTimeout, retries); + } + catch (error) { + const e = googleError_1.GoogleError.parseGRPCStatusDetails(error); + // clean up the request stream and retryStreams, silently destroy it on the request stream + // but do raise it on destruction of the retryStream so the consumer can see it + requestStream.destroy(); + retryStream.destroy(e); + return retryStream; + } + const delayMult = retry.backoffSettings.retryDelayMultiplier; + const maxDelay = retry.backoffSettings.maxRetryDelayMillis; + const timeoutMult = retry.backoffSettings.rpcTimeoutMultiplier; + const maxTimeout = retry.backoffSettings.maxRpcTimeoutMillis; + let delay = retry.backoffSettings.initialRetryDelayMillis; + // calculate new deadlines + const toSleep = Math.random() * delay; + const calculateTimeoutAndResumptionFunction = () => { + setTimeout(() => { + // only do timeout calculations if not using maxRetries + if (timeout) { + now = new Date(); + delay = Math.min(delay * delayMult, maxDelay); + const timeoutCal = timeout && timeoutMult ? timeout * timeoutMult : 0; + const rpcTimeout = maxTimeout ? maxTimeout : 0; + const newDeadline = deadline ? deadline - now.getTime() : 0; + timeout = Math.min(timeoutCal, rpcTimeout, newDeadline); + } + retries++; + let retryArgument = this.argument; + // if resumption logic is passed, use it to determined the + // new argument for the new request made to the server + // otherwise, the original argument will be passed + if (retry.getResumptionRequestFn !== undefined) { + retryArgument = retry.getResumptionRequestFn(retryArgument); + } + const newRequest = () => { + if (this._isCancelCalled) { + if (this.stream) { + this.stream.cancel(); + } + return; + } + const newStream = this.apiCall(retryArgument, this._callback); + return newStream; + }; + opts.request = newRequest; + // make a request with the updated parameters + // based on the resumption strategy + return newMakeRequest(opts); + }, toSleep); + }; + return calculateTimeoutAndResumptionFunction(); + } + } + else { + // non retryable error + return transientErrorHelper(error, requestStream); + } + } + else { + // neither timeout nor maxRetries are defined, surface the error to the caller + return transientErrorHelper(error, requestStream); + } + }); + // return the stream if we didn't return it as + // part of an error state + return retryStream; + }; + // this is the first make request call with the options the user passed in + return newMakeRequest(opts); + } +} +exports.StreamProxy = StreamProxy; +//# sourceMappingURL=streaming.js.map + +/***/ }), + +/***/ 98177: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/** + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.StreamingApiCaller = void 0; +const warnings_1 = __nccwpck_require__(25531); +const streaming_1 = __nccwpck_require__(21224); +class StreamingApiCaller { + /** + * An API caller for methods of gRPC streaming. + * @private + * @constructor + * @param {StreamDescriptor} descriptor - the descriptor of the method structure. + */ + constructor(descriptor) { + this.descriptor = descriptor; + } + init(callback) { + return new streaming_1.StreamProxy(this.descriptor.type, callback, this.descriptor.rest, this.descriptor.gaxStreamingRetries); + } + wrap(func) { + switch (this.descriptor.type) { + case streaming_1.StreamType.SERVER_STREAMING: + return (argument, metadata, options) => { + return func(argument, metadata, options); + }; + case streaming_1.StreamType.CLIENT_STREAMING: + return (argument, metadata, options, callback) => { + return func(metadata, options, callback); + }; + case streaming_1.StreamType.BIDI_STREAMING: + return (argument, metadata, options) => { + return func(metadata, options); + }; + default: + (0, warnings_1.warn)('streaming_wrap_unknown_stream_type', `Unknown stream type: ${this.descriptor.type}`); + } + return func; + } + call(apiCall, argument, settings, stream) { + stream.setStream(apiCall, argument, settings.retryRequestOptions, settings.retry); + } + fail(stream, err) { + stream.emit('error', err); + } + result(stream) { + return stream; + } +} +exports.StreamingApiCaller = StreamingApiCaller; +//# sourceMappingURL=streamingApiCaller.js.map + +/***/ }), + +/***/ 976: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/** + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getField = getField; +exports.deepCopyWithoutMatchedFields = deepCopyWithoutMatchedFields; +exports.deleteField = deleteField; +exports.buildQueryStringComponents = buildQueryStringComponents; +exports.encodeWithSlashes = encodeWithSlashes; +exports.encodeWithoutSlashes = encodeWithoutSlashes; +exports.applyPattern = applyPattern; +exports.match = match; +exports.flattenObject = flattenObject; +exports.isProto3OptionalField = isProto3OptionalField; +exports.transcode = transcode; +exports.overrideHttpRules = overrideHttpRules; +const util_1 = __nccwpck_require__(24938); +const httpOptionName = '(google.api.http)'; +const proto3OptionalName = 'proto3_optional'; +// List of methods as defined in google/api/http.proto (see HttpRule) +const supportedHttpMethods = ['get', 'post', 'put', 'patch', 'delete']; +function getField(request, field, allowObjects = false // in most cases, we need leaf fields +) { + const parts = field.split('.'); + let value = request; + for (const part of parts) { + if (typeof value !== 'object') { + return undefined; + } + value = value[part]; + } + if (!allowObjects && + typeof value === 'object' && + !Array.isArray(value) && + value !== null) { + return undefined; + } + return value; +} +function deepCopyWithoutMatchedFields(request, fieldsToSkip, fullNamePrefix = '') { + if (typeof request !== 'object' || request === null) { + return request; + } + const copy = Object.assign({}, request); + for (const key in copy) { + if (fieldsToSkip.has(`${fullNamePrefix}${key}`)) { + delete copy[key]; + continue; + } + const nextFullNamePrefix = `${fullNamePrefix}${key}.`; + if (Array.isArray(copy[key])) { + // a field of an array cannot be addressed as "request.field", so we omit the skipping logic for array descendants + copy[key] = copy[key].map(value => deepCopyWithoutMatchedFields(value, new Set())); + } + else if (typeof copy[key] === 'object' && copy[key] !== null) { + copy[key] = deepCopyWithoutMatchedFields(copy[key], fieldsToSkip, nextFullNamePrefix); + } + } + return copy; +} +function deleteField(request, field) { + const parts = field.split('.'); + while (parts.length > 1) { + if (typeof request !== 'object') { + return; + } + const part = parts.shift(); + request = request[part]; + } + const part = parts.shift(); + if (typeof request !== 'object') { + return; + } + delete request[part]; +} +function buildQueryStringComponents(request, prefix = '') { + const resultList = []; + for (const key in request) { + if (Array.isArray(request[key])) { + for (const value of request[key]) { + resultList.push(`${prefix}${encodeWithoutSlashes(key)}=${encodeWithoutSlashes(value.toString())}`); + } + } + else if (typeof request[key] === 'object' && request[key] !== null) { + resultList.push(...buildQueryStringComponents(request[key], `${key}.`)); + } + else { + resultList.push(`${prefix}${encodeWithoutSlashes(key)}=${encodeWithoutSlashes(request[key] === null ? 'null' : request[key].toString())}`); + } + } + return resultList; +} +function encodeWithSlashes(str) { + return str + .split('') + .map(c => (c.match(/[-_.~0-9a-zA-Z]/) ? c : encodeURIComponent(c))) + .join(''); +} +function encodeWithoutSlashes(str) { + return str + .split('') + .map(c => (c.match(/[-_.~0-9a-zA-Z/]/) ? c : encodeURIComponent(c))) + .join(''); +} +function escapeRegExp(str) { + return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&'); +} +function applyPattern(pattern, fieldValue) { + if (!pattern || pattern === '*') { + return encodeWithSlashes(fieldValue); + } + if (!pattern.includes('*') && pattern !== fieldValue) { + return undefined; + } + // since we're converting the pattern to a regex, make necessary precautions: + const regex = new RegExp('^' + + escapeRegExp(pattern) + .replace(/\\\*\\\*/g, '(.+)') + .replace(/\\\*/g, '([^/]+)') + + '$'); + if (!fieldValue.match(regex)) { + return undefined; + } + return encodeWithoutSlashes(fieldValue); +} +function fieldToCamelCase(field) { + const parts = field.split('.'); + return parts.map(part => (0, util_1.toCamelCase)(part)).join('.'); +} +function match(request, pattern) { + let url = pattern; + const matchedFields = []; + for (;;) { + const match = url.match(/^(.*)\{([^}=]+)(?:=([^}]*))?\}(.*)/); + if (!match) { + break; + } + const [, before, field, pattern, after] = match; + const camelCasedField = fieldToCamelCase(field); + matchedFields.push(fieldToCamelCase(camelCasedField)); + const fieldValue = getField(request, camelCasedField); + if (fieldValue === undefined) { + return undefined; + } + const appliedPattern = applyPattern(pattern, fieldValue === null ? 'null' : fieldValue.toString()); + if (appliedPattern === undefined) { + return undefined; + } + url = before + appliedPattern + after; + } + return { matchedFields, url }; +} +function flattenObject(request) { + const result = {}; + for (const key in request) { + if (request[key] === undefined) { + continue; + } + if (Array.isArray(request[key])) { + // According to the http.proto comments, a repeated field may only + // contain primitive types, so no extra recursion here. + result[key] = request[key]; + continue; + } + if (typeof request[key] === 'object' && request[key] !== null) { + const nested = flattenObject(request[key]); + for (const nestedKey in nested) { + result[`${key}.${nestedKey}`] = nested[nestedKey]; + } + continue; + } + result[key] = request[key]; + } + return result; +} +function isProto3OptionalField(field) { + return field && field.options && field.options[proto3OptionalName]; +} +function transcode(request, parsedOptions) { + const httpRules = []; + for (const option of parsedOptions) { + if (!(httpOptionName in option)) { + continue; + } + const httpRule = option[httpOptionName]; + httpRules.push(httpRule); + if (httpRule === null || httpRule === void 0 ? void 0 : httpRule.additional_bindings) { + const additionalBindings = Array.isArray(httpRule.additional_bindings) + ? httpRule.additional_bindings + : [httpRule.additional_bindings]; + httpRules.push(...additionalBindings); + } + } + for (const httpRule of httpRules) { + for (const httpMethod of supportedHttpMethods) { + if (!(httpMethod in httpRule)) { + continue; + } + const pathTemplate = httpRule[httpMethod]; + const matchResult = match(request, pathTemplate); + if (matchResult === undefined) { + continue; + } + const { url, matchedFields } = matchResult; + let data = deepCopyWithoutMatchedFields(request, new Set(matchedFields)); + if (httpRule.body === '*') { + return { httpMethod, url, queryString: '', data }; + } + // one field possibly goes to request data, others go to query string + const queryStringObject = data; + if (httpRule.body) { + data = getField(queryStringObject, fieldToCamelCase(httpRule.body), + /*allowObjects:*/ true); + deleteField(queryStringObject, fieldToCamelCase(httpRule.body)); + } + else { + data = ''; + } + const queryStringComponents = buildQueryStringComponents(queryStringObject); + const queryString = queryStringComponents.join('&'); + if (!data || + (typeof data === 'object' && Object.keys(data).length === 0)) { + data = ''; + } + return { httpMethod, url, queryString, data }; + } + } + return undefined; +} +// Override the protobuf json's the http rules. +function overrideHttpRules(httpRules, protoJson) { + for (const rule of httpRules) { + if (!rule.selector) { + continue; + } + const rpc = protoJson.lookup(rule.selector); + // Not support override on non-exist RPC or a RPC without an annotation. + // We could reconsider if we have the use case later. + if (!rpc || !rpc.parsedOptions) { + continue; + } + for (const item of rpc.parsedOptions) { + if (!(httpOptionName in item)) { + continue; + } + const httpOptions = item[httpOptionName]; + for (const httpMethod in httpOptions) { + if (httpMethod in rule) { + if (httpMethod === 'additional_bindings') { + continue; + } + httpOptions[httpMethod] = + rule[httpMethod]; + } + if (rule.additional_bindings) { + httpOptions['additional_bindings'] = !httpOptions['additional_bindings'] + ? [] + : Array.isArray(httpOptions['additional_bindings']) + ? httpOptions['additional_bindings'] + : [httpOptions['additional_bindings']]; + // Make the additional_binding to be an array if it is not. + httpOptions['additional_bindings'].push(...rule.additional_bindings); + } + } + } + } +} +//# sourceMappingURL=transcoding.js.map + +/***/ }), + +/***/ 24938: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.camelToSnakeCase = camelToSnakeCase; +exports.toCamelCase = toCamelCase; +exports.toLowerCamelCase = toLowerCamelCase; +exports.makeUUID = makeUUID; +/** + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +const uuid_1 = __nccwpck_require__(12048); +function words(str, normalize = false) { + if (normalize) { + // strings like somethingABCSomething are special case for protobuf.js, + // they should be split as "something", "abc", "something". + // Deal with sequences of capital letters first. + str = str.replace(/([A-Z])([A-Z]+)([A-Z])/g, (str) => { + return (str[0] + + str.slice(1, str.length - 1).toLowerCase() + + str[str.length - 1]); + }); + } + // split on spaces, non-alphanumeric, or capital letters + // note: we keep the capitalization of the first word (special case: IPProtocol) + return str + .split(/(?=[A-Z])|[^A-Za-z0-9.]+/) + .filter(w => w.length > 0) + .map((w, index) => (index === 0 ? w : w.toLowerCase())); +} +/** + * Converts the first character of the given string to lower case. + */ +function lowercase(str) { + if (str.length === 0) { + return str; + } + return str[0].toLowerCase() + str.slice(1); +} +/** + * Converts a given string from camelCase (used by protobuf.js and in JSON) + * to snake_case (normally used in proto definitions). + */ +function camelToSnakeCase(str) { + // Keep the first position capitalization, otherwise decapitalize with underscore. + const wordsList = words(str); + if (wordsList.length === 0) { + return str; + } + const result = [wordsList[0]]; + result.push(...wordsList.slice(1).map(lowercase)); + return result.join('_'); +} +/** + * Capitalizes the first character of the given string. + */ +function capitalize(str) { + if (str.length === 0) { + return str; + } + return str[0].toUpperCase() + str.slice(1); +} +/** + * Converts a given string from snake_case (normally used in proto definitions) or + * PascalCase (also used in proto definitions) to camelCase (used by protobuf.js). + * Preserves capitalization of the first character. + */ +function toCamelCase(str) { + const wordsList = words(str, /*normalize:*/ true); + if (wordsList.length === 0) { + return str; + } + const result = [wordsList[0]]; + result.push(...wordsList.slice(1).map(w => { + if (w.match(/^\d+$/)) { + return '_' + w; + } + return capitalize(w); + })); + return result.join(''); +} +/** + * Converts a given string to lower camel case (forcing the first character to be + * in lower case). + */ +function toLowerCamelCase(str) { + const camelCase = toCamelCase(str); + if (camelCase.length === 0) { + return camelCase; + } + return camelCase[0].toLowerCase() + camelCase.slice(1); +} +/** + * Converts a given string to lower camel case (forcing the first character to be + * in lower case). + */ +function makeUUID() { + return (0, uuid_1.v4)(); +} +//# sourceMappingURL=util.js.map + +/***/ }), + +/***/ 25531: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/** + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.warn = warn; +const featureDetection_1 = __nccwpck_require__(83515); +const emittedWarnings = new Set(); +// warnType is the type of warning (e.g. 'DeprecationWarning', 'ExperimentalWarning', etc.) +function warn(code, message, warnType) { + // Only show a given warning once + if (emittedWarnings.has(code)) { + return; + } + emittedWarnings.add(code); + if (!(0, featureDetection_1.isNodeJS)()) { + console.warn(message); + } + else if (typeof warnType !== 'undefined') { + process.emitWarning(message, { + type: warnType, + }); + } + else { + process.emitWarning(message); + } +} +//# sourceMappingURL=warnings.js.map + /***/ }), /***/ 71628: @@ -54636,6 +151800,414 @@ var bind = __nccwpck_require__(37564); module.exports = bind.call(call, $hasOwn); +/***/ }), + +/***/ 77847: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const net_1 = __importDefault(__nccwpck_require__(69278)); +const tls_1 = __importDefault(__nccwpck_require__(64756)); +const url_1 = __importDefault(__nccwpck_require__(87016)); +const debug_1 = __importDefault(__nccwpck_require__(2830)); +const once_1 = __importDefault(__nccwpck_require__(48662)); +const agent_base_1 = __nccwpck_require__(32960); +const debug = (0, debug_1.default)('http-proxy-agent'); +function isHTTPS(protocol) { + return typeof protocol === 'string' ? /^https:?$/i.test(protocol) : false; +} +/** + * The `HttpProxyAgent` implements an HTTP Agent subclass that connects + * to the specified "HTTP proxy server" in order to proxy HTTP requests. + * + * @api public + */ +class HttpProxyAgent extends agent_base_1.Agent { + constructor(_opts) { + let opts; + if (typeof _opts === 'string') { + opts = url_1.default.parse(_opts); + } + else { + opts = _opts; + } + if (!opts) { + throw new Error('an HTTP(S) proxy server `host` and `port` must be specified!'); + } + debug('Creating new HttpProxyAgent instance: %o', opts); + super(opts); + const proxy = Object.assign({}, opts); + // If `true`, then connect to the proxy server over TLS. + // Defaults to `false`. + this.secureProxy = opts.secureProxy || isHTTPS(proxy.protocol); + // Prefer `hostname` over `host`, and set the `port` if needed. + proxy.host = proxy.hostname || proxy.host; + if (typeof proxy.port === 'string') { + proxy.port = parseInt(proxy.port, 10); + } + if (!proxy.port && proxy.host) { + proxy.port = this.secureProxy ? 443 : 80; + } + if (proxy.host && proxy.path) { + // If both a `host` and `path` are specified then it's most likely + // the result of a `url.parse()` call... we need to remove the + // `path` portion so that `net.connect()` doesn't attempt to open + // that as a Unix socket file. + delete proxy.path; + delete proxy.pathname; + } + this.proxy = proxy; + } + /** + * Called when the node-core HTTP client library is creating a + * new HTTP request. + * + * @api protected + */ + callback(req, opts) { + return __awaiter(this, void 0, void 0, function* () { + const { proxy, secureProxy } = this; + const parsed = url_1.default.parse(req.path); + if (!parsed.protocol) { + parsed.protocol = 'http:'; + } + if (!parsed.hostname) { + parsed.hostname = opts.hostname || opts.host || null; + } + if (parsed.port == null && typeof opts.port) { + parsed.port = String(opts.port); + } + if (parsed.port === '80') { + // if port is 80, then we can remove the port so that the + // ":80" portion is not on the produced URL + parsed.port = ''; + } + // Change the `http.ClientRequest` instance's "path" field + // to the absolute path of the URL that will be requested. + req.path = url_1.default.format(parsed); + // Inject the `Proxy-Authorization` header if necessary. + if (proxy.auth) { + req.setHeader('Proxy-Authorization', `Basic ${Buffer.from(proxy.auth).toString('base64')}`); + } + // Create a socket connection to the proxy server. + let socket; + if (secureProxy) { + debug('Creating `tls.Socket`: %o', proxy); + socket = tls_1.default.connect(proxy); + } + else { + debug('Creating `net.Socket`: %o', proxy); + socket = net_1.default.connect(proxy); + } + // At this point, the http ClientRequest's internal `_header` field + // might have already been set. If this is the case then we'll need + // to re-generate the string since we just changed the `req.path`. + if (req._header) { + let first; + let endOfHeaders; + debug('Regenerating stored HTTP header string for request'); + req._header = null; + req._implicitHeader(); + if (req.output && req.output.length > 0) { + // Node < 12 + debug('Patching connection write() output buffer with updated header'); + first = req.output[0]; + endOfHeaders = first.indexOf('\r\n\r\n') + 4; + req.output[0] = req._header + first.substring(endOfHeaders); + debug('Output buffer: %o', req.output); + } + else if (req.outputData && req.outputData.length > 0) { + // Node >= 12 + debug('Patching connection write() output buffer with updated header'); + first = req.outputData[0].data; + endOfHeaders = first.indexOf('\r\n\r\n') + 4; + req.outputData[0].data = + req._header + first.substring(endOfHeaders); + debug('Output buffer: %o', req.outputData[0].data); + } + } + // Wait for the socket's `connect` event, so that this `callback()` + // function throws instead of the `http` request machinery. This is + // important for i.e. `PacProxyAgent` which determines a failed proxy + // connection via the `callback()` function throwing. + yield (0, once_1.default)(socket, 'connect'); + return socket; + }); + } +} +exports["default"] = HttpProxyAgent; +//# sourceMappingURL=agent.js.map + +/***/ }), + +/***/ 81970: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +const agent_1 = __importDefault(__nccwpck_require__(77847)); +function createHttpProxyAgent(opts) { + return new agent_1.default(opts); +} +(function (createHttpProxyAgent) { + createHttpProxyAgent.HttpProxyAgent = agent_1.default; + createHttpProxyAgent.prototype = agent_1.default.prototype; +})(createHttpProxyAgent || (createHttpProxyAgent = {})); +module.exports = createHttpProxyAgent; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 32960: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +const events_1 = __nccwpck_require__(24434); +const debug_1 = __importDefault(__nccwpck_require__(2830)); +const promisify_1 = __importDefault(__nccwpck_require__(62600)); +const debug = debug_1.default('agent-base'); +function isAgent(v) { + return Boolean(v) && typeof v.addRequest === 'function'; +} +function isSecureEndpoint() { + const { stack } = new Error(); + if (typeof stack !== 'string') + return false; + return stack.split('\n').some(l => l.indexOf('(https.js:') !== -1 || l.indexOf('node:https:') !== -1); +} +function createAgent(callback, opts) { + return new createAgent.Agent(callback, opts); +} +(function (createAgent) { + /** + * Base `http.Agent` implementation. + * No pooling/keep-alive is implemented by default. + * + * @param {Function} callback + * @api public + */ + class Agent extends events_1.EventEmitter { + constructor(callback, _opts) { + super(); + let opts = _opts; + if (typeof callback === 'function') { + this.callback = callback; + } + else if (callback) { + opts = callback; + } + // Timeout for the socket to be returned from the callback + this.timeout = null; + if (opts && typeof opts.timeout === 'number') { + this.timeout = opts.timeout; + } + // These aren't actually used by `agent-base`, but are required + // for the TypeScript definition files in `@types/node` :/ + this.maxFreeSockets = 1; + this.maxSockets = 1; + this.maxTotalSockets = Infinity; + this.sockets = {}; + this.freeSockets = {}; + this.requests = {}; + this.options = {}; + } + get defaultPort() { + if (typeof this.explicitDefaultPort === 'number') { + return this.explicitDefaultPort; + } + return isSecureEndpoint() ? 443 : 80; + } + set defaultPort(v) { + this.explicitDefaultPort = v; + } + get protocol() { + if (typeof this.explicitProtocol === 'string') { + return this.explicitProtocol; + } + return isSecureEndpoint() ? 'https:' : 'http:'; + } + set protocol(v) { + this.explicitProtocol = v; + } + callback(req, opts, fn) { + throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`'); + } + /** + * Called by node-core's "_http_client.js" module when creating + * a new HTTP request with this Agent instance. + * + * @api public + */ + addRequest(req, _opts) { + const opts = Object.assign({}, _opts); + if (typeof opts.secureEndpoint !== 'boolean') { + opts.secureEndpoint = isSecureEndpoint(); + } + if (opts.host == null) { + opts.host = 'localhost'; + } + if (opts.port == null) { + opts.port = opts.secureEndpoint ? 443 : 80; + } + if (opts.protocol == null) { + opts.protocol = opts.secureEndpoint ? 'https:' : 'http:'; + } + if (opts.host && opts.path) { + // If both a `host` and `path` are specified then it's most + // likely the result of a `url.parse()` call... we need to + // remove the `path` portion so that `net.connect()` doesn't + // attempt to open that as a unix socket file. + delete opts.path; + } + delete opts.agent; + delete opts.hostname; + delete opts._defaultAgent; + delete opts.defaultPort; + delete opts.createConnection; + // Hint to use "Connection: close" + // XXX: non-documented `http` module API :( + req._last = true; + req.shouldKeepAlive = false; + let timedOut = false; + let timeoutId = null; + const timeoutMs = opts.timeout || this.timeout; + const onerror = (err) => { + if (req._hadError) + return; + req.emit('error', err); + // For Safety. Some additional errors might fire later on + // and we need to make sure we don't double-fire the error event. + req._hadError = true; + }; + const ontimeout = () => { + timeoutId = null; + timedOut = true; + const err = new Error(`A "socket" was not created for HTTP request before ${timeoutMs}ms`); + err.code = 'ETIMEOUT'; + onerror(err); + }; + const callbackError = (err) => { + if (timedOut) + return; + if (timeoutId !== null) { + clearTimeout(timeoutId); + timeoutId = null; + } + onerror(err); + }; + const onsocket = (socket) => { + if (timedOut) + return; + if (timeoutId != null) { + clearTimeout(timeoutId); + timeoutId = null; + } + if (isAgent(socket)) { + // `socket` is actually an `http.Agent` instance, so + // relinquish responsibility for this `req` to the Agent + // from here on + debug('Callback returned another Agent instance %o', socket.constructor.name); + socket.addRequest(req, opts); + return; + } + if (socket) { + socket.once('free', () => { + this.freeSocket(socket, opts); + }); + req.onSocket(socket); + return; + } + const err = new Error(`no Duplex stream was returned to agent-base for \`${req.method} ${req.path}\``); + onerror(err); + }; + if (typeof this.callback !== 'function') { + onerror(new Error('`callback` is not defined')); + return; + } + if (!this.promisifiedCallback) { + if (this.callback.length >= 3) { + debug('Converting legacy callback function to promise'); + this.promisifiedCallback = promisify_1.default(this.callback); + } + else { + this.promisifiedCallback = this.callback; + } + } + if (typeof timeoutMs === 'number' && timeoutMs > 0) { + timeoutId = setTimeout(ontimeout, timeoutMs); + } + if ('port' in opts && typeof opts.port !== 'number') { + opts.port = Number(opts.port); + } + try { + debug('Resolving socket for %o request: %o', opts.protocol, `${req.method} ${req.path}`); + Promise.resolve(this.promisifiedCallback(req, opts)).then(onsocket, callbackError); + } + catch (err) { + Promise.reject(err).catch(callbackError); + } + } + freeSocket(socket, opts) { + debug('Freeing socket %o %o', socket.constructor.name, opts); + socket.destroy(); + } + destroy() { + debug('Destroying agent %o', this.constructor.name); + } + } + createAgent.Agent = Agent; + // So that `instanceof` works correctly + createAgent.prototype = createAgent.Agent.prototype; +})(createAgent || (createAgent = {})); +module.exports = createAgent; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 62600: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +function promisify(fn) { + return function (req, opts) { + return new Promise((resolve, reject) => { + fn.call(this, req, opts, (err, rtn) => { + if (err) { + reject(err); + } + else { + resolve(rtn); + } + }); + }); + }; +} +exports["default"] = promisify; +//# sourceMappingURL=promisify.js.map + /***/ }), /***/ 3669: @@ -54931,6 +152503,70 @@ function parseProxyResponse(socket) { exports.parseProxyResponse = parseProxyResponse; //# sourceMappingURL=parse-proxy-response.js.map +/***/ }), + +/***/ 39598: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +try { + var util = __nccwpck_require__(39023); + /* istanbul ignore next */ + if (typeof util.inherits !== 'function') throw ''; + module.exports = util.inherits; +} catch (e) { + /* istanbul ignore next */ + module.exports = __nccwpck_require__(26589); +} + + +/***/ }), + +/***/ 26589: +/***/ ((module) => { + +if (typeof Object.create === 'function') { + // implementation from standard node.js 'util' module + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + ctor.prototype = Object.create(superCtor.prototype, { + constructor: { + value: ctor, + enumerable: false, + writable: true, + configurable: true + } + }) + } + }; +} else { + // old school shim for old browsers + module.exports = function inherits(ctor, superCtor) { + if (superCtor) { + ctor.super_ = superCtor + var TempCtor = function () {} + TempCtor.prototype = superCtor.prototype + ctor.prototype = new TempCtor() + ctor.prototype.constructor = ctor + } + } +} + + +/***/ }), + +/***/ 75200: +/***/ ((module) => { + +"use strict"; + + +module.exports = value => { + const type = typeof value; + return value !== null && (type === 'object' || type === 'function'); +}; + + /***/ }), /***/ 96543: @@ -56420,6 +154056,612 @@ VerifyStream.verify = jwsVerify; module.exports = VerifyStream; +/***/ }), + +/***/ 14277: +/***/ ((module) => { + +/** + * lodash (Custom Build) + * Build: `lodash modularize exports="npm" -o ./` + * Copyright jQuery Foundation and other contributors + * Released under MIT license + * Based on Underscore.js 1.8.3 + * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + */ + +/** Used as references for various `Number` constants. */ +var INFINITY = 1 / 0; + +/** `Object#toString` result references. */ +var symbolTag = '[object Symbol]'; + +/** Used to match words composed of alphanumeric characters. */ +var reAsciiWord = /[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g; + +/** Used to match Latin Unicode letters (excluding mathematical operators). */ +var reLatin = /[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g; + +/** Used to compose unicode character classes. */ +var rsAstralRange = '\\ud800-\\udfff', + rsComboMarksRange = '\\u0300-\\u036f\\ufe20-\\ufe23', + rsComboSymbolsRange = '\\u20d0-\\u20f0', + rsDingbatRange = '\\u2700-\\u27bf', + rsLowerRange = 'a-z\\xdf-\\xf6\\xf8-\\xff', + rsMathOpRange = '\\xac\\xb1\\xd7\\xf7', + rsNonCharRange = '\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf', + rsPunctuationRange = '\\u2000-\\u206f', + rsSpaceRange = ' \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000', + rsUpperRange = 'A-Z\\xc0-\\xd6\\xd8-\\xde', + rsVarRange = '\\ufe0e\\ufe0f', + rsBreakRange = rsMathOpRange + rsNonCharRange + rsPunctuationRange + rsSpaceRange; + +/** Used to compose unicode capture groups. */ +var rsApos = "['\u2019]", + rsAstral = '[' + rsAstralRange + ']', + rsBreak = '[' + rsBreakRange + ']', + rsCombo = '[' + rsComboMarksRange + rsComboSymbolsRange + ']', + rsDigits = '\\d+', + rsDingbat = '[' + rsDingbatRange + ']', + rsLower = '[' + rsLowerRange + ']', + rsMisc = '[^' + rsAstralRange + rsBreakRange + rsDigits + rsDingbatRange + rsLowerRange + rsUpperRange + ']', + rsFitz = '\\ud83c[\\udffb-\\udfff]', + rsModifier = '(?:' + rsCombo + '|' + rsFitz + ')', + rsNonAstral = '[^' + rsAstralRange + ']', + rsRegional = '(?:\\ud83c[\\udde6-\\uddff]){2}', + rsSurrPair = '[\\ud800-\\udbff][\\udc00-\\udfff]', + rsUpper = '[' + rsUpperRange + ']', + rsZWJ = '\\u200d'; + +/** Used to compose unicode regexes. */ +var rsLowerMisc = '(?:' + rsLower + '|' + rsMisc + ')', + rsUpperMisc = '(?:' + rsUpper + '|' + rsMisc + ')', + rsOptLowerContr = '(?:' + rsApos + '(?:d|ll|m|re|s|t|ve))?', + rsOptUpperContr = '(?:' + rsApos + '(?:D|LL|M|RE|S|T|VE))?', + reOptMod = rsModifier + '?', + rsOptVar = '[' + rsVarRange + ']?', + rsOptJoin = '(?:' + rsZWJ + '(?:' + [rsNonAstral, rsRegional, rsSurrPair].join('|') + ')' + rsOptVar + reOptMod + ')*', + rsSeq = rsOptVar + reOptMod + rsOptJoin, + rsEmoji = '(?:' + [rsDingbat, rsRegional, rsSurrPair].join('|') + ')' + rsSeq, + rsSymbol = '(?:' + [rsNonAstral + rsCombo + '?', rsCombo, rsRegional, rsSurrPair, rsAstral].join('|') + ')'; + +/** Used to match apostrophes. */ +var reApos = RegExp(rsApos, 'g'); + +/** + * Used to match [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks) and + * [combining diacritical marks for symbols](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks_for_Symbols). + */ +var reComboMark = RegExp(rsCombo, 'g'); + +/** Used to match [string symbols](https://mathiasbynens.be/notes/javascript-unicode). */ +var reUnicode = RegExp(rsFitz + '(?=' + rsFitz + ')|' + rsSymbol + rsSeq, 'g'); + +/** Used to match complex or compound words. */ +var reUnicodeWord = RegExp([ + rsUpper + '?' + rsLower + '+' + rsOptLowerContr + '(?=' + [rsBreak, rsUpper, '$'].join('|') + ')', + rsUpperMisc + '+' + rsOptUpperContr + '(?=' + [rsBreak, rsUpper + rsLowerMisc, '$'].join('|') + ')', + rsUpper + '?' + rsLowerMisc + '+' + rsOptLowerContr, + rsUpper + '+' + rsOptUpperContr, + rsDigits, + rsEmoji +].join('|'), 'g'); + +/** Used to detect strings with [zero-width joiners or code points from the astral planes](http://eev.ee/blog/2015/09/12/dark-corners-of-unicode/). */ +var reHasUnicode = RegExp('[' + rsZWJ + rsAstralRange + rsComboMarksRange + rsComboSymbolsRange + rsVarRange + ']'); + +/** Used to detect strings that need a more robust regexp to match words. */ +var reHasUnicodeWord = /[a-z][A-Z]|[A-Z]{2,}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/; + +/** Used to map Latin Unicode letters to basic Latin letters. */ +var deburredLetters = { + // Latin-1 Supplement block. + '\xc0': 'A', '\xc1': 'A', '\xc2': 'A', '\xc3': 'A', '\xc4': 'A', '\xc5': 'A', + '\xe0': 'a', '\xe1': 'a', '\xe2': 'a', '\xe3': 'a', '\xe4': 'a', '\xe5': 'a', + '\xc7': 'C', '\xe7': 'c', + '\xd0': 'D', '\xf0': 'd', + '\xc8': 'E', '\xc9': 'E', '\xca': 'E', '\xcb': 'E', + '\xe8': 'e', '\xe9': 'e', '\xea': 'e', '\xeb': 'e', + '\xcc': 'I', '\xcd': 'I', '\xce': 'I', '\xcf': 'I', + '\xec': 'i', '\xed': 'i', '\xee': 'i', '\xef': 'i', + '\xd1': 'N', '\xf1': 'n', + '\xd2': 'O', '\xd3': 'O', '\xd4': 'O', '\xd5': 'O', '\xd6': 'O', '\xd8': 'O', + '\xf2': 'o', '\xf3': 'o', '\xf4': 'o', '\xf5': 'o', '\xf6': 'o', '\xf8': 'o', + '\xd9': 'U', '\xda': 'U', '\xdb': 'U', '\xdc': 'U', + '\xf9': 'u', '\xfa': 'u', '\xfb': 'u', '\xfc': 'u', + '\xdd': 'Y', '\xfd': 'y', '\xff': 'y', + '\xc6': 'Ae', '\xe6': 'ae', + '\xde': 'Th', '\xfe': 'th', + '\xdf': 'ss', + // Latin Extended-A block. + '\u0100': 'A', '\u0102': 'A', '\u0104': 'A', + '\u0101': 'a', '\u0103': 'a', '\u0105': 'a', + '\u0106': 'C', '\u0108': 'C', '\u010a': 'C', '\u010c': 'C', + '\u0107': 'c', '\u0109': 'c', '\u010b': 'c', '\u010d': 'c', + '\u010e': 'D', '\u0110': 'D', '\u010f': 'd', '\u0111': 'd', + '\u0112': 'E', '\u0114': 'E', '\u0116': 'E', '\u0118': 'E', '\u011a': 'E', + '\u0113': 'e', '\u0115': 'e', '\u0117': 'e', '\u0119': 'e', '\u011b': 'e', + '\u011c': 'G', '\u011e': 'G', '\u0120': 'G', '\u0122': 'G', + '\u011d': 'g', '\u011f': 'g', '\u0121': 'g', '\u0123': 'g', + '\u0124': 'H', '\u0126': 'H', '\u0125': 'h', '\u0127': 'h', + '\u0128': 'I', '\u012a': 'I', '\u012c': 'I', '\u012e': 'I', '\u0130': 'I', + '\u0129': 'i', '\u012b': 'i', '\u012d': 'i', '\u012f': 'i', '\u0131': 'i', + '\u0134': 'J', '\u0135': 'j', + '\u0136': 'K', '\u0137': 'k', '\u0138': 'k', + '\u0139': 'L', '\u013b': 'L', '\u013d': 'L', '\u013f': 'L', '\u0141': 'L', + '\u013a': 'l', '\u013c': 'l', '\u013e': 'l', '\u0140': 'l', '\u0142': 'l', + '\u0143': 'N', '\u0145': 'N', '\u0147': 'N', '\u014a': 'N', + '\u0144': 'n', '\u0146': 'n', '\u0148': 'n', '\u014b': 'n', + '\u014c': 'O', '\u014e': 'O', '\u0150': 'O', + '\u014d': 'o', '\u014f': 'o', '\u0151': 'o', + '\u0154': 'R', '\u0156': 'R', '\u0158': 'R', + '\u0155': 'r', '\u0157': 'r', '\u0159': 'r', + '\u015a': 'S', '\u015c': 'S', '\u015e': 'S', '\u0160': 'S', + '\u015b': 's', '\u015d': 's', '\u015f': 's', '\u0161': 's', + '\u0162': 'T', '\u0164': 'T', '\u0166': 'T', + '\u0163': 't', '\u0165': 't', '\u0167': 't', + '\u0168': 'U', '\u016a': 'U', '\u016c': 'U', '\u016e': 'U', '\u0170': 'U', '\u0172': 'U', + '\u0169': 'u', '\u016b': 'u', '\u016d': 'u', '\u016f': 'u', '\u0171': 'u', '\u0173': 'u', + '\u0174': 'W', '\u0175': 'w', + '\u0176': 'Y', '\u0177': 'y', '\u0178': 'Y', + '\u0179': 'Z', '\u017b': 'Z', '\u017d': 'Z', + '\u017a': 'z', '\u017c': 'z', '\u017e': 'z', + '\u0132': 'IJ', '\u0133': 'ij', + '\u0152': 'Oe', '\u0153': 'oe', + '\u0149': "'n", '\u017f': 'ss' +}; + +/** Detect free variable `global` from Node.js. */ +var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; + +/** Detect free variable `self`. */ +var freeSelf = typeof self == 'object' && self && self.Object === Object && self; + +/** Used as a reference to the global object. */ +var root = freeGlobal || freeSelf || Function('return this')(); + +/** + * A specialized version of `_.reduce` for arrays without support for + * iteratee shorthands. + * + * @private + * @param {Array} [array] The array to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {*} [accumulator] The initial value. + * @param {boolean} [initAccum] Specify using the first element of `array` as + * the initial value. + * @returns {*} Returns the accumulated value. + */ +function arrayReduce(array, iteratee, accumulator, initAccum) { + var index = -1, + length = array ? array.length : 0; + + if (initAccum && length) { + accumulator = array[++index]; + } + while (++index < length) { + accumulator = iteratee(accumulator, array[index], index, array); + } + return accumulator; +} + +/** + * Converts an ASCII `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ +function asciiToArray(string) { + return string.split(''); +} + +/** + * Splits an ASCII `string` into an array of its words. + * + * @private + * @param {string} The string to inspect. + * @returns {Array} Returns the words of `string`. + */ +function asciiWords(string) { + return string.match(reAsciiWord) || []; +} + +/** + * The base implementation of `_.propertyOf` without support for deep paths. + * + * @private + * @param {Object} object The object to query. + * @returns {Function} Returns the new accessor function. + */ +function basePropertyOf(object) { + return function(key) { + return object == null ? undefined : object[key]; + }; +} + +/** + * Used by `_.deburr` to convert Latin-1 Supplement and Latin Extended-A + * letters to basic Latin letters. + * + * @private + * @param {string} letter The matched letter to deburr. + * @returns {string} Returns the deburred letter. + */ +var deburrLetter = basePropertyOf(deburredLetters); + +/** + * Checks if `string` contains Unicode symbols. + * + * @private + * @param {string} string The string to inspect. + * @returns {boolean} Returns `true` if a symbol is found, else `false`. + */ +function hasUnicode(string) { + return reHasUnicode.test(string); +} + +/** + * Checks if `string` contains a word composed of Unicode symbols. + * + * @private + * @param {string} string The string to inspect. + * @returns {boolean} Returns `true` if a word is found, else `false`. + */ +function hasUnicodeWord(string) { + return reHasUnicodeWord.test(string); +} + +/** + * Converts `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ +function stringToArray(string) { + return hasUnicode(string) + ? unicodeToArray(string) + : asciiToArray(string); +} + +/** + * Converts a Unicode `string` to an array. + * + * @private + * @param {string} string The string to convert. + * @returns {Array} Returns the converted array. + */ +function unicodeToArray(string) { + return string.match(reUnicode) || []; +} + +/** + * Splits a Unicode `string` into an array of its words. + * + * @private + * @param {string} The string to inspect. + * @returns {Array} Returns the words of `string`. + */ +function unicodeWords(string) { + return string.match(reUnicodeWord) || []; +} + +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var objectToString = objectProto.toString; + +/** Built-in value references. */ +var Symbol = root.Symbol; + +/** Used to convert symbols to primitives and strings. */ +var symbolProto = Symbol ? Symbol.prototype : undefined, + symbolToString = symbolProto ? symbolProto.toString : undefined; + +/** + * The base implementation of `_.slice` without an iteratee call guard. + * + * @private + * @param {Array} array The array to slice. + * @param {number} [start=0] The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the slice of `array`. + */ +function baseSlice(array, start, end) { + var index = -1, + length = array.length; + + if (start < 0) { + start = -start > length ? 0 : (length + start); + } + end = end > length ? length : end; + if (end < 0) { + end += length; + } + length = start > end ? 0 : ((end - start) >>> 0); + start >>>= 0; + + var result = Array(length); + while (++index < length) { + result[index] = array[index + start]; + } + return result; +} + +/** + * The base implementation of `_.toString` which doesn't convert nullish + * values to empty strings. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ +function baseToString(value) { + // Exit early for strings to avoid a performance hit in some environments. + if (typeof value == 'string') { + return value; + } + if (isSymbol(value)) { + return symbolToString ? symbolToString.call(value) : ''; + } + var result = (value + ''); + return (result == '0' && (1 / value) == -INFINITY) ? '-0' : result; +} + +/** + * Casts `array` to a slice if it's needed. + * + * @private + * @param {Array} array The array to inspect. + * @param {number} start The start position. + * @param {number} [end=array.length] The end position. + * @returns {Array} Returns the cast slice. + */ +function castSlice(array, start, end) { + var length = array.length; + end = end === undefined ? length : end; + return (!start && end >= length) ? array : baseSlice(array, start, end); +} + +/** + * Creates a function like `_.lowerFirst`. + * + * @private + * @param {string} methodName The name of the `String` case method to use. + * @returns {Function} Returns the new case function. + */ +function createCaseFirst(methodName) { + return function(string) { + string = toString(string); + + var strSymbols = hasUnicode(string) + ? stringToArray(string) + : undefined; + + var chr = strSymbols + ? strSymbols[0] + : string.charAt(0); + + var trailing = strSymbols + ? castSlice(strSymbols, 1).join('') + : string.slice(1); + + return chr[methodName]() + trailing; + }; +} + +/** + * Creates a function like `_.camelCase`. + * + * @private + * @param {Function} callback The function to combine each word. + * @returns {Function} Returns the new compounder function. + */ +function createCompounder(callback) { + return function(string) { + return arrayReduce(words(deburr(string).replace(reApos, '')), callback, ''); + }; +} + +/** + * Checks if `value` is object-like. A value is object-like if it's not `null` + * and has a `typeof` result of "object". + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + * @example + * + * _.isObjectLike({}); + * // => true + * + * _.isObjectLike([1, 2, 3]); + * // => true + * + * _.isObjectLike(_.noop); + * // => false + * + * _.isObjectLike(null); + * // => false + */ +function isObjectLike(value) { + return !!value && typeof value == 'object'; +} + +/** + * Checks if `value` is classified as a `Symbol` primitive or object. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a symbol, else `false`. + * @example + * + * _.isSymbol(Symbol.iterator); + * // => true + * + * _.isSymbol('abc'); + * // => false + */ +function isSymbol(value) { + return typeof value == 'symbol' || + (isObjectLike(value) && objectToString.call(value) == symbolTag); +} + +/** + * Converts `value` to a string. An empty string is returned for `null` + * and `undefined` values. The sign of `-0` is preserved. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category Lang + * @param {*} value The value to process. + * @returns {string} Returns the string. + * @example + * + * _.toString(null); + * // => '' + * + * _.toString(-0); + * // => '-0' + * + * _.toString([1, 2, 3]); + * // => '1,2,3' + */ +function toString(value) { + return value == null ? '' : baseToString(value); +} + +/** + * Converts `string` to [camel case](https://en.wikipedia.org/wiki/CamelCase). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the camel cased string. + * @example + * + * _.camelCase('Foo Bar'); + * // => 'fooBar' + * + * _.camelCase('--foo-bar--'); + * // => 'fooBar' + * + * _.camelCase('__FOO_BAR__'); + * // => 'fooBar' + */ +var camelCase = createCompounder(function(result, word, index) { + word = word.toLowerCase(); + return result + (index ? capitalize(word) : word); +}); + +/** + * Converts the first character of `string` to upper case and the remaining + * to lower case. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to capitalize. + * @returns {string} Returns the capitalized string. + * @example + * + * _.capitalize('FRED'); + * // => 'Fred' + */ +function capitalize(string) { + return upperFirst(toString(string).toLowerCase()); +} + +/** + * Deburrs `string` by converting + * [Latin-1 Supplement](https://en.wikipedia.org/wiki/Latin-1_Supplement_(Unicode_block)#Character_table) + * and [Latin Extended-A](https://en.wikipedia.org/wiki/Latin_Extended-A) + * letters to basic Latin letters and removing + * [combining diacritical marks](https://en.wikipedia.org/wiki/Combining_Diacritical_Marks). + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to deburr. + * @returns {string} Returns the deburred string. + * @example + * + * _.deburr('dÊjà vu'); + * // => 'deja vu' + */ +function deburr(string) { + string = toString(string); + return string && string.replace(reLatin, deburrLetter).replace(reComboMark, ''); +} + +/** + * Converts the first character of `string` to upper case. + * + * @static + * @memberOf _ + * @since 4.0.0 + * @category String + * @param {string} [string=''] The string to convert. + * @returns {string} Returns the converted string. + * @example + * + * _.upperFirst('fred'); + * // => 'Fred' + * + * _.upperFirst('FRED'); + * // => 'FRED' + */ +var upperFirst = createCaseFirst('toUpperCase'); + +/** + * Splits `string` into an array of its words. + * + * @static + * @memberOf _ + * @since 3.0.0 + * @category String + * @param {string} [string=''] The string to inspect. + * @param {RegExp|string} [pattern] The pattern to match words. + * @param- {Object} [guard] Enables use as an iteratee for methods like `_.map`. + * @returns {Array} Returns the words of `string`. + * @example + * + * _.words('fred, barney, & pebbles'); + * // => ['fred', 'barney', 'pebbles'] + * + * _.words('fred, barney, & pebbles', /[^, ]+/g); + * // => ['fred', 'barney', '&', 'pebbles'] + */ +function words(string, pattern, guard) { + string = toString(string); + pattern = guard ? undefined : pattern; + + if (pattern === undefined) { + return hasUnicodeWord(string) ? unicodeWords(string) : asciiWords(string); + } + return string.match(pattern) || []; +} + +module.exports = camelCase; + + /***/ }), /***/ 55641: @@ -58489,6 +156731,467 @@ exports.FetchError = FetchError; exports.AbortError = AbortError; +/***/ }), + +/***/ 77690: +/***/ ((module, exports, __nccwpck_require__) => { + +"use strict"; + + +var crypto = __nccwpck_require__(76982); + +/** + * Exported function + * + * Options: + * + * - `algorithm` hash algo to be used by this instance: *'sha1', 'md5' + * - `excludeValues` {true|*false} hash object keys, values ignored + * - `encoding` hash encoding, supports 'buffer', '*hex', 'binary', 'base64' + * - `ignoreUnknown` {true|*false} ignore unknown object types + * - `replacer` optional function that replaces values before hashing + * - `respectFunctionProperties` {*true|false} consider function properties when hashing + * - `respectFunctionNames` {*true|false} consider 'name' property of functions for hashing + * - `respectType` {*true|false} Respect special properties (prototype, constructor) + * when hashing to distinguish between types + * - `unorderedArrays` {true|*false} Sort all arrays before hashing + * - `unorderedSets` {*true|false} Sort `Set` and `Map` instances before hashing + * * = default + * + * @param {object} object value to hash + * @param {object} options hashing options + * @return {string} hash value + * @api public + */ +exports = module.exports = objectHash; + +function objectHash(object, options){ + options = applyDefaults(object, options); + + return hash(object, options); +} + +/** + * Exported sugar methods + * + * @param {object} object value to hash + * @return {string} hash value + * @api public + */ +exports.sha1 = function(object){ + return objectHash(object); +}; +exports.keys = function(object){ + return objectHash(object, {excludeValues: true, algorithm: 'sha1', encoding: 'hex'}); +}; +exports.MD5 = function(object){ + return objectHash(object, {algorithm: 'md5', encoding: 'hex'}); +}; +exports.keysMD5 = function(object){ + return objectHash(object, {algorithm: 'md5', encoding: 'hex', excludeValues: true}); +}; + +// Internals +var hashes = crypto.getHashes ? crypto.getHashes().slice() : ['sha1', 'md5']; +hashes.push('passthrough'); +var encodings = ['buffer', 'hex', 'binary', 'base64']; + +function applyDefaults(object, sourceOptions){ + sourceOptions = sourceOptions || {}; + + // create a copy rather than mutating + var options = {}; + options.algorithm = sourceOptions.algorithm || 'sha1'; + options.encoding = sourceOptions.encoding || 'hex'; + options.excludeValues = sourceOptions.excludeValues ? true : false; + options.algorithm = options.algorithm.toLowerCase(); + options.encoding = options.encoding.toLowerCase(); + options.ignoreUnknown = sourceOptions.ignoreUnknown !== true ? false : true; // default to false + options.respectType = sourceOptions.respectType === false ? false : true; // default to true + options.respectFunctionNames = sourceOptions.respectFunctionNames === false ? false : true; + options.respectFunctionProperties = sourceOptions.respectFunctionProperties === false ? false : true; + options.unorderedArrays = sourceOptions.unorderedArrays !== true ? false : true; // default to false + options.unorderedSets = sourceOptions.unorderedSets === false ? false : true; // default to false + options.unorderedObjects = sourceOptions.unorderedObjects === false ? false : true; // default to true + options.replacer = sourceOptions.replacer || undefined; + options.excludeKeys = sourceOptions.excludeKeys || undefined; + + if(typeof object === 'undefined') { + throw new Error('Object argument required.'); + } + + // if there is a case-insensitive match in the hashes list, accept it + // (i.e. SHA256 for sha256) + for (var i = 0; i < hashes.length; ++i) { + if (hashes[i].toLowerCase() === options.algorithm.toLowerCase()) { + options.algorithm = hashes[i]; + } + } + + if(hashes.indexOf(options.algorithm) === -1){ + throw new Error('Algorithm "' + options.algorithm + '" not supported. ' + + 'supported values: ' + hashes.join(', ')); + } + + if(encodings.indexOf(options.encoding) === -1 && + options.algorithm !== 'passthrough'){ + throw new Error('Encoding "' + options.encoding + '" not supported. ' + + 'supported values: ' + encodings.join(', ')); + } + + return options; +} + +/** Check if the given function is a native function */ +function isNativeFunction(f) { + if ((typeof f) !== 'function') { + return false; + } + var exp = /^function\s+\w*\s*\(\s*\)\s*{\s+\[native code\]\s+}$/i; + return exp.exec(Function.prototype.toString.call(f)) != null; +} + +function hash(object, options) { + var hashingStream; + + if (options.algorithm !== 'passthrough') { + hashingStream = crypto.createHash(options.algorithm); + } else { + hashingStream = new PassThrough(); + } + + if (typeof hashingStream.write === 'undefined') { + hashingStream.write = hashingStream.update; + hashingStream.end = hashingStream.update; + } + + var hasher = typeHasher(options, hashingStream); + hasher.dispatch(object); + if (!hashingStream.update) { + hashingStream.end(''); + } + + if (hashingStream.digest) { + return hashingStream.digest(options.encoding === 'buffer' ? undefined : options.encoding); + } + + var buf = hashingStream.read(); + if (options.encoding === 'buffer') { + return buf; + } + + return buf.toString(options.encoding); +} + +/** + * Expose streaming API + * + * @param {object} object Value to serialize + * @param {object} options Options, as for hash() + * @param {object} stream A stream to write the serializiation to + * @api public + */ +exports.writeToStream = function(object, options, stream) { + if (typeof stream === 'undefined') { + stream = options; + options = {}; + } + + options = applyDefaults(object, options); + + return typeHasher(options, stream).dispatch(object); +}; + +function typeHasher(options, writeTo, context){ + context = context || []; + var write = function(str) { + if (writeTo.update) { + return writeTo.update(str, 'utf8'); + } else { + return writeTo.write(str, 'utf8'); + } + }; + + return { + dispatch: function(value){ + if (options.replacer) { + value = options.replacer(value); + } + + var type = typeof value; + if (value === null) { + type = 'null'; + } + + //console.log("[DEBUG] Dispatch: ", value, "->", type, " -> ", "_" + type); + + return this['_' + type](value); + }, + _object: function(object) { + var pattern = (/\[object (.*)\]/i); + var objString = Object.prototype.toString.call(object); + var objType = pattern.exec(objString); + if (!objType) { // object type did not match [object ...] + objType = 'unknown:[' + objString + ']'; + } else { + objType = objType[1]; // take only the class name + } + + objType = objType.toLowerCase(); + + var objectNumber = null; + + if ((objectNumber = context.indexOf(object)) >= 0) { + return this.dispatch('[CIRCULAR:' + objectNumber + ']'); + } else { + context.push(object); + } + + if (typeof Buffer !== 'undefined' && Buffer.isBuffer && Buffer.isBuffer(object)) { + write('buffer:'); + return write(object); + } + + if(objType !== 'object' && objType !== 'function' && objType !== 'asyncfunction') { + if(this['_' + objType]) { + this['_' + objType](object); + } else if (options.ignoreUnknown) { + return write('[' + objType + ']'); + } else { + throw new Error('Unknown object type "' + objType + '"'); + } + }else{ + var keys = Object.keys(object); + if (options.unorderedObjects) { + keys = keys.sort(); + } + // Make sure to incorporate special properties, so + // Types with different prototypes will produce + // a different hash and objects derived from + // different functions (`new Foo`, `new Bar`) will + // produce different hashes. + // We never do this for native functions since some + // seem to break because of that. + if (options.respectType !== false && !isNativeFunction(object)) { + keys.splice(0, 0, 'prototype', '__proto__', 'constructor'); + } + + if (options.excludeKeys) { + keys = keys.filter(function(key) { return !options.excludeKeys(key); }); + } + + write('object:' + keys.length + ':'); + var self = this; + return keys.forEach(function(key){ + self.dispatch(key); + write(':'); + if(!options.excludeValues) { + self.dispatch(object[key]); + } + write(','); + }); + } + }, + _array: function(arr, unordered){ + unordered = typeof unordered !== 'undefined' ? unordered : + options.unorderedArrays !== false; // default to options.unorderedArrays + + var self = this; + write('array:' + arr.length + ':'); + if (!unordered || arr.length <= 1) { + return arr.forEach(function(entry) { + return self.dispatch(entry); + }); + } + + // the unordered case is a little more complicated: + // since there is no canonical ordering on objects, + // i.e. {a:1} < {a:2} and {a:1} > {a:2} are both false, + // we first serialize each entry using a PassThrough stream + // before sorting. + // also: we can’t use the same context array for all entries + // since the order of hashing should *not* matter. instead, + // we keep track of the additions to a copy of the context array + // and add all of them to the global context array when we’re done + var contextAdditions = []; + var entries = arr.map(function(entry) { + var strm = new PassThrough(); + var localContext = context.slice(); // make copy + var hasher = typeHasher(options, strm, localContext); + hasher.dispatch(entry); + // take only what was added to localContext and append it to contextAdditions + contextAdditions = contextAdditions.concat(localContext.slice(context.length)); + return strm.read().toString(); + }); + context = context.concat(contextAdditions); + entries.sort(); + return this._array(entries, false); + }, + _date: function(date){ + return write('date:' + date.toJSON()); + }, + _symbol: function(sym){ + return write('symbol:' + sym.toString()); + }, + _error: function(err){ + return write('error:' + err.toString()); + }, + _boolean: function(bool){ + return write('bool:' + bool.toString()); + }, + _string: function(string){ + write('string:' + string.length + ':'); + write(string.toString()); + }, + _function: function(fn){ + write('fn:'); + if (isNativeFunction(fn)) { + this.dispatch('[native]'); + } else { + this.dispatch(fn.toString()); + } + + if (options.respectFunctionNames !== false) { + // Make sure we can still distinguish native functions + // by their name, otherwise String and Function will + // have the same hash + this.dispatch("function-name:" + String(fn.name)); + } + + if (options.respectFunctionProperties) { + this._object(fn); + } + }, + _number: function(number){ + return write('number:' + number.toString()); + }, + _xml: function(xml){ + return write('xml:' + xml.toString()); + }, + _null: function() { + return write('Null'); + }, + _undefined: function() { + return write('Undefined'); + }, + _regexp: function(regex){ + return write('regex:' + regex.toString()); + }, + _uint8array: function(arr){ + write('uint8array:'); + return this.dispatch(Array.prototype.slice.call(arr)); + }, + _uint8clampedarray: function(arr){ + write('uint8clampedarray:'); + return this.dispatch(Array.prototype.slice.call(arr)); + }, + _int8array: function(arr){ + write('int8array:'); + return this.dispatch(Array.prototype.slice.call(arr)); + }, + _uint16array: function(arr){ + write('uint16array:'); + return this.dispatch(Array.prototype.slice.call(arr)); + }, + _int16array: function(arr){ + write('int16array:'); + return this.dispatch(Array.prototype.slice.call(arr)); + }, + _uint32array: function(arr){ + write('uint32array:'); + return this.dispatch(Array.prototype.slice.call(arr)); + }, + _int32array: function(arr){ + write('int32array:'); + return this.dispatch(Array.prototype.slice.call(arr)); + }, + _float32array: function(arr){ + write('float32array:'); + return this.dispatch(Array.prototype.slice.call(arr)); + }, + _float64array: function(arr){ + write('float64array:'); + return this.dispatch(Array.prototype.slice.call(arr)); + }, + _arraybuffer: function(arr){ + write('arraybuffer:'); + return this.dispatch(new Uint8Array(arr)); + }, + _url: function(url) { + return write('url:' + url.toString(), 'utf8'); + }, + _map: function(map) { + write('map:'); + var arr = Array.from(map); + return this._array(arr, options.unorderedSets !== false); + }, + _set: function(set) { + write('set:'); + var arr = Array.from(set); + return this._array(arr, options.unorderedSets !== false); + }, + _file: function(file) { + write('file:'); + return this.dispatch([file.name, file.size, file.type, file.lastModfied]); + }, + _blob: function() { + if (options.ignoreUnknown) { + return write('[blob]'); + } + + throw Error('Hashing Blob objects is currently not supported\n' + + '(see https://github.com/puleos/object-hash/issues/26)\n' + + 'Use "options.replacer" or "options.ignoreUnknown"\n'); + }, + _domwindow: function() { return write('domwindow'); }, + _bigint: function(number){ + return write('bigint:' + number.toString()); + }, + /* Node.js standard native objects */ + _process: function() { return write('process'); }, + _timer: function() { return write('timer'); }, + _pipe: function() { return write('pipe'); }, + _tcp: function() { return write('tcp'); }, + _udp: function() { return write('udp'); }, + _tty: function() { return write('tty'); }, + _statwatcher: function() { return write('statwatcher'); }, + _securecontext: function() { return write('securecontext'); }, + _connection: function() { return write('connection'); }, + _zlib: function() { return write('zlib'); }, + _context: function() { return write('context'); }, + _nodescript: function() { return write('nodescript'); }, + _httpparser: function() { return write('httpparser'); }, + _dataview: function() { return write('dataview'); }, + _signal: function() { return write('signal'); }, + _fsevent: function() { return write('fsevent'); }, + _tlswrap: function() { return write('tlswrap'); }, + }; +} + +// Mini-implementation of stream.PassThrough +// We are far from having need for the full implementation, and we can +// make assumptions like "many writes, then only one final read" +// and we can ignore encoding specifics +function PassThrough() { + return { + buf: '', + + write: function(b) { + this.buf += b; + }, + + end: function(b) { + this.buf += b; + }, + + read: function() { + return this.buf; + } + }; +} + + /***/ }), /***/ 60506: @@ -59048,6 +157751,248 @@ function arrObjKeys(obj, inspect) { module.exports = __nccwpck_require__(39023).inspect; +/***/ }), + +/***/ 5698: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; +/*! + * on-finished + * Copyright(c) 2013 Jonathan Ong + * Copyright(c) 2014 Douglas Christopher Wilson + * MIT Licensed + */ + + + +/** + * Module exports. + * @public + */ + +module.exports = onFinished +module.exports.isFinished = isFinished + +/** + * Module dependencies. + * @private + */ + +var asyncHooks = tryRequireAsyncHooks() +var first = __nccwpck_require__(25049) + +/** + * Variables. + * @private + */ + +/* istanbul ignore next */ +var defer = typeof setImmediate === 'function' + ? setImmediate + : function (fn) { process.nextTick(fn.bind.apply(fn, arguments)) } + +/** + * Invoke callback when the response has finished, useful for + * cleaning up resources afterwards. + * + * @param {object} msg + * @param {function} listener + * @return {object} + * @public + */ + +function onFinished (msg, listener) { + if (isFinished(msg) !== false) { + defer(listener, null, msg) + return msg + } + + // attach the listener to the message + attachListener(msg, wrap(listener)) + + return msg +} + +/** + * Determine if message is already finished. + * + * @param {object} msg + * @return {boolean} + * @public + */ + +function isFinished (msg) { + var socket = msg.socket + + if (typeof msg.finished === 'boolean') { + // OutgoingMessage + return Boolean(msg.finished || (socket && !socket.writable)) + } + + if (typeof msg.complete === 'boolean') { + // IncomingMessage + return Boolean(msg.upgrade || !socket || !socket.readable || (msg.complete && !msg.readable)) + } + + // don't know + return undefined +} + +/** + * Attach a finished listener to the message. + * + * @param {object} msg + * @param {function} callback + * @private + */ + +function attachFinishedListener (msg, callback) { + var eeMsg + var eeSocket + var finished = false + + function onFinish (error) { + eeMsg.cancel() + eeSocket.cancel() + + finished = true + callback(error) + } + + // finished on first message event + eeMsg = eeSocket = first([[msg, 'end', 'finish']], onFinish) + + function onSocket (socket) { + // remove listener + msg.removeListener('socket', onSocket) + + if (finished) return + if (eeMsg !== eeSocket) return + + // finished on first socket event + eeSocket = first([[socket, 'error', 'close']], onFinish) + } + + if (msg.socket) { + // socket already assigned + onSocket(msg.socket) + return + } + + // wait for socket to be assigned + msg.on('socket', onSocket) + + if (msg.socket === undefined) { + // istanbul ignore next: node.js 0.8 patch + patchAssignSocket(msg, onSocket) + } +} + +/** + * Attach the listener to the message. + * + * @param {object} msg + * @return {function} + * @private + */ + +function attachListener (msg, listener) { + var attached = msg.__onFinished + + // create a private single listener with queue + if (!attached || !attached.queue) { + attached = msg.__onFinished = createListener(msg) + attachFinishedListener(msg, attached) + } + + attached.queue.push(listener) +} + +/** + * Create listener on message. + * + * @param {object} msg + * @return {function} + * @private + */ + +function createListener (msg) { + function listener (err) { + if (msg.__onFinished === listener) msg.__onFinished = null + if (!listener.queue) return + + var queue = listener.queue + listener.queue = null + + for (var i = 0; i < queue.length; i++) { + queue[i](err, msg) + } + } + + listener.queue = [] + + return listener +} + +/** + * Patch ServerResponse.prototype.assignSocket for node.js 0.8. + * + * @param {ServerResponse} res + * @param {function} callback + * @private + */ + +// istanbul ignore next: node.js 0.8 patch +function patchAssignSocket (res, callback) { + var assignSocket = res.assignSocket + + if (typeof assignSocket !== 'function') return + + // res.on('socket', callback) is broken in 0.8 + res.assignSocket = function _assignSocket (socket) { + assignSocket.call(this, socket) + callback(socket) + } +} + +/** + * Try to require async_hooks + * @private + */ + +function tryRequireAsyncHooks () { + try { + return __nccwpck_require__(90290) + } catch (e) { + return {} + } +} + +/** + * Wrap function with async resource, if possible. + * AsyncResource.bind static method backported. + * @private + */ + +function wrap (fn) { + var res + + // create anonymous resource + if (asyncHooks.AsyncResource) { + res = new asyncHooks.AsyncResource(fn.name || 'bound-anonymous-fn') + } + + // incompatible node.js + if (!res || !res.runInAsyncScope) { + return fn + } + + // return bound function + return res.runInAsyncScope.bind(res, fn, null) +} + + /***/ }), /***/ 55560: @@ -59097,6 +158042,11012 @@ function onceStrict (fn) { } +/***/ }), + +/***/ 12851: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.googleProtobufAnyFromProto3JSON = exports.googleProtobufAnyToProto3JSON = void 0; +const fromproto3json_1 = __nccwpck_require__(32360); +const toproto3json_1 = __nccwpck_require__(63269); +// https://github.com/protocolbuffers/protobuf/blob/ba3836703b4a9e98e474aea2bac8c5b49b6d3b5c/python/google/protobuf/json_format.py#L850 +const specialJSON = new Set([ + 'google.protobuf.Any', + 'google.protobuf.Duration', + 'google.protobuf.FieldMask', + 'google.protobuf.ListValue', + 'google.protobuf.Struct', + 'google.protobuf.Timestamp', + 'google.protobuf.Value', +]); +function googleProtobufAnyToProto3JSON(obj, options) { + // https://developers.google.com/protocol-buffers/docs/proto3#json + // If the Any contains a value that has a special JSON mapping, it will be converted as follows: + // {"@type": xxx, "value": yyy}. + // Otherwise, the value will be converted into a JSON object, and the "@type" field will be inserted + // to indicate the actual data type. + const typeName = obj.type_url.replace(/^.*\//, ''); + let type; + try { + type = obj.$type.root.lookupType(typeName); + } + catch (err) { + throw new Error(`googleProtobufAnyToProto3JSON: cannot find type ${typeName}: ${err}`); + } + const valueMessage = type.decode(obj.value); + const valueProto3JSON = (0, toproto3json_1.toProto3JSON)(valueMessage, options); + if (specialJSON.has(typeName)) { + return { + '@type': obj.type_url, + value: valueProto3JSON, + }; + } + valueProto3JSON['@type'] = obj.type_url; + return valueProto3JSON; +} +exports.googleProtobufAnyToProto3JSON = googleProtobufAnyToProto3JSON; +function googleProtobufAnyFromProto3JSON(root, json) { + // Not all possible JSON values can hold Any, only real objects. + if (json === null || typeof json !== 'object' || Array.isArray(json)) { + throw new Error('googleProtobufAnyFromProto3JSON: must be an object to decode google.protobuf.Any'); + } + const typeUrl = json['@type']; + if (!typeUrl || typeof typeUrl !== 'string') { + throw new Error('googleProtobufAnyFromProto3JSON: JSON serialization of google.protobuf.Any must contain @type field'); + } + const typeName = typeUrl.replace(/^.*\//, ''); + let type; + try { + type = root.lookupType(typeName); + } + catch (err) { + throw new Error(`googleProtobufAnyFromProto3JSON: cannot find type ${typeName}: ${err}`); + } + let value = json; + if (specialJSON.has(typeName)) { + if (!('value' in json)) { + throw new Error(`googleProtobufAnyFromProto3JSON: JSON representation of google.protobuf.Any with type ${typeName} must contain the value field`); + } + value = json.value; + } + const valueMessage = (0, fromproto3json_1.fromProto3JSON)(type, value); + if (valueMessage === null) { + return { + type_url: typeUrl, + value: null, + }; + } + const uint8array = type.encode(valueMessage).finish(); + const buffer = Buffer.from(uint8array, 0, uint8array.byteLength); + const base64 = buffer.toString('base64'); + return { + type_url: typeUrl, + value: base64, + }; +} +exports.googleProtobufAnyFromProto3JSON = googleProtobufAnyFromProto3JSON; +//# sourceMappingURL=any.js.map + +/***/ }), + +/***/ 87066: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.bytesFromProto3JSON = exports.bytesToProto3JSON = void 0; +function bytesToProto3JSON(obj) { + if (Buffer.isBuffer(obj)) { + return obj.toString('base64'); + } + else { + return Buffer.from(obj.buffer, 0, obj.byteLength).toString('base64'); + } +} +exports.bytesToProto3JSON = bytesToProto3JSON; +function bytesFromProto3JSON(json) { + return Buffer.from(json, 'base64'); +} +exports.bytesFromProto3JSON = bytesFromProto3JSON; +//# sourceMappingURL=bytes.js.map + +/***/ }), + +/***/ 1849: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.googleProtobufDurationFromProto3JSON = exports.googleProtobufDurationToProto3JSON = void 0; +function googleProtobufDurationToProto3JSON(obj) { + // seconds is an instance of Long so it won't be undefined + let durationSeconds = obj.seconds.toString(); + if (typeof obj.nanos === 'number' && obj.nanos > 0) { + // nanosStr should contain 3, 6, or 9 fractional digits. + const nanosStr = obj.nanos + .toString() + .padStart(9, '0') + .replace(/^((?:\d\d\d)+?)(?:0*)$/, '$1'); + durationSeconds += '.' + nanosStr; + } + durationSeconds += 's'; + return durationSeconds; +} +exports.googleProtobufDurationToProto3JSON = googleProtobufDurationToProto3JSON; +function googleProtobufDurationFromProto3JSON(json) { + const match = json.match(/^(\d*)(?:\.(\d*))?s$/); + if (!match) { + throw new Error(`googleProtobufDurationFromProto3JSON: incorrect value ${json} passed as google.protobuf.Duration`); + } + let seconds = 0; + let nanos = 0; + if (typeof match[1] === 'string' && match[1].length > 0) { + seconds = parseInt(match[1]); + } + if (typeof match[2] === 'string' && match[2].length > 0) { + nanos = parseInt(match[2].padEnd(9, '0')); + } + const result = {}; + if (seconds !== 0) { + result.seconds = seconds; + } + if (nanos !== 0) { + result.nanos = nanos; + } + return result; +} +exports.googleProtobufDurationFromProto3JSON = googleProtobufDurationFromProto3JSON; +//# sourceMappingURL=duration.js.map + +/***/ }), + +/***/ 94944: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.resolveEnumValueToNumber = exports.resolveEnumValueToString = void 0; +function resolveEnumValueToString(enumType, enumValue) { + // for unknown enum values, do not fail and try to do the best we could. + // protobuf.js fromObject() will likely ignore unknown values, but at least + // we won't fail. + if (typeof enumValue === 'number') { + const value = enumType.valuesById[enumValue]; + if (typeof value === 'undefined') { + // unknown value, cannot convert to string, returning number as is + return enumValue; + } + return value; + } + if (typeof enumValue === 'string') { + // for strings, just accept what we got + return enumValue; + } + throw new Error('resolveEnumValueToString: enum value must be a string or a number'); +} +exports.resolveEnumValueToString = resolveEnumValueToString; +function resolveEnumValueToNumber(enumType, enumValue) { + if (typeof enumValue === 'number') { + // return as is + return enumValue; + } + if (typeof enumValue === 'string') { + const num = enumType.values[enumValue]; + if (typeof num === 'undefined') { + // unknown value, cannot convert to number, returning string as is + return enumValue; + } + return num; + } + throw new Error('resolveEnumValueToNumber: enum value must be a string or a number'); +} +exports.resolveEnumValueToNumber = resolveEnumValueToNumber; +//# sourceMappingURL=enum.js.map + +/***/ }), + +/***/ 56441: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.googleProtobufFieldMaskFromProto3JSON = exports.googleProtobufFieldMaskToProto3JSON = void 0; +function googleProtobufFieldMaskToProto3JSON(obj) { + return obj.paths.join(','); +} +exports.googleProtobufFieldMaskToProto3JSON = googleProtobufFieldMaskToProto3JSON; +function googleProtobufFieldMaskFromProto3JSON(json) { + return { + paths: json.split(','), + }; +} +exports.googleProtobufFieldMaskFromProto3JSON = googleProtobufFieldMaskFromProto3JSON; +//# sourceMappingURL=fieldmask.js.map + +/***/ }), + +/***/ 32360: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.fromProto3JSON = exports.fromProto3JSONToInternalRepresentation = void 0; +const any_1 = __nccwpck_require__(12851); +const bytes_1 = __nccwpck_require__(87066); +const enum_1 = __nccwpck_require__(94944); +const value_1 = __nccwpck_require__(92304); +const util_1 = __nccwpck_require__(27905); +const duration_1 = __nccwpck_require__(1849); +const timestamp_1 = __nccwpck_require__(6181); +const wrappers_1 = __nccwpck_require__(18157); +const fieldmask_1 = __nccwpck_require__(56441); +function fromProto3JSONToInternalRepresentation(type, json) { + const fullyQualifiedTypeName = typeof type === 'string' ? type : (0, util_1.getFullyQualifiedTypeName)(type); + if (typeof type !== 'string' && 'values' in type) { + // type is an Enum + if (fullyQualifiedTypeName === '.google.protobuf.NullValue') { + return 'NULL_VALUE'; + } + return (0, enum_1.resolveEnumValueToString)(type, json); + } + if (typeof type !== 'string') { + type.resolveAll(); + } + if (typeof type === 'string') { + return json; + } + // Types that require special handling according to + // https://developers.google.com/protocol-buffers/docs/proto3#json + // Types that can have meaningful "null" value + if (fullyQualifiedTypeName === '.google.protobuf.Value') { + return (0, value_1.googleProtobufValueFromProto3JSON)(json); + } + if (util_1.wrapperTypes.has(fullyQualifiedTypeName)) { + if ((json !== null && typeof json === 'object') || Array.isArray(json)) { + throw new Error(`fromProto3JSONToInternalRepresentation: JSON representation for ${fullyQualifiedTypeName} expects a string, a number, or a boolean, but got ${typeof json}`); + } + return (0, wrappers_1.wrapperFromProto3JSON)(fullyQualifiedTypeName, json); + } + if (json === null) { + return null; + } + // Types that cannot be "null" + if (fullyQualifiedTypeName === '.google.protobuf.Any') { + return (0, any_1.googleProtobufAnyFromProto3JSON)(type.root, json); + } + if (fullyQualifiedTypeName === '.google.protobuf.Struct') { + if (typeof json !== 'object') { + throw new Error(`fromProto3JSONToInternalRepresentation: google.protobuf.Struct must be an object but got ${typeof json}`); + } + if (Array.isArray(json)) { + throw new Error('fromProto3JSONToInternalRepresentation: google.protobuf.Struct must be an object but got an array'); + } + return (0, value_1.googleProtobufStructFromProto3JSON)(json); + } + if (fullyQualifiedTypeName === '.google.protobuf.ListValue') { + if (!Array.isArray(json)) { + throw new Error(`fromProto3JSONToInternalRepresentation: google.protobuf.ListValue must be an array but got ${typeof json}`); + } + return (0, value_1.googleProtobufListValueFromProto3JSON)(json); + } + if (fullyQualifiedTypeName === '.google.protobuf.Duration') { + if (typeof json !== 'string') { + throw new Error(`fromProto3JSONToInternalRepresentation: google.protobuf.Duration must be a string but got ${typeof json}`); + } + return (0, duration_1.googleProtobufDurationFromProto3JSON)(json); + } + if (fullyQualifiedTypeName === '.google.protobuf.Timestamp') { + if (typeof json !== 'string') { + throw new Error(`fromProto3JSONToInternalRepresentation: google.protobuf.Timestamp must be a string but got ${typeof json}`); + } + return (0, timestamp_1.googleProtobufTimestampFromProto3JSON)(json); + } + if (fullyQualifiedTypeName === '.google.protobuf.FieldMask') { + if (typeof json !== 'string') { + throw new Error(`fromProto3JSONToInternalRepresentation: google.protobuf.FieldMask must be a string but got ${typeof json}`); + } + return (0, fieldmask_1.googleProtobufFieldMaskFromProto3JSON)(json); + } + const result = {}; + for (const [key, value] of Object.entries(json)) { + const field = type.fields[key]; + if (!field) { + continue; + } + const resolvedType = field.resolvedType; + const fieldType = field.type; + if (field.repeated) { + if (value === null) { + result[key] = []; + } + else { + if (!Array.isArray(value)) { + throw new Error(`fromProto3JSONToInternalRepresentation: expected an array for field ${key}`); + } + result[key] = value.map(element => fromProto3JSONToInternalRepresentation(resolvedType || fieldType, element)); + } + } + else if (field.map) { + const map = {}; + for (const [mapKey, mapValue] of Object.entries(value)) { + map[mapKey] = fromProto3JSONToInternalRepresentation(resolvedType || fieldType, mapValue); + } + result[key] = map; + } + else if (fieldType.match(/^(?:(?:(?:u?int|fixed)(?:32|64))|float|double)$/)) { + if (typeof value !== 'number' && typeof value !== 'string') { + throw new Error(`fromProto3JSONToInternalRepresentation: field ${key} of type ${field.type} cannot contain value ${value}`); + } + result[key] = value; + } + else if (fieldType === 'string') { + if (typeof value !== 'string') { + throw new Error(`fromProto3JSONToInternalRepresentation: field ${key} of type ${field.type} cannot contain value ${value}`); + } + result[key] = value; + } + else if (fieldType === 'bool') { + if (typeof value !== 'boolean') { + throw new Error(`fromProto3JSONToInternalRepresentation: field ${key} of type ${field.type} cannot contain value ${value}`); + } + result[key] = value; + } + else if (fieldType === 'bytes') { + if (typeof value !== 'string') { + throw new Error(`fromProto3JSONToInternalRepresentation: field ${key} of type ${field.type} cannot contain value ${value}`); + } + result[key] = (0, bytes_1.bytesFromProto3JSON)(value); + } + else { + // Message type + (0, util_1.assert)(resolvedType !== null, `Expected to be able to resolve type for field ${field.name}`); + const deserializedValue = fromProto3JSONToInternalRepresentation(resolvedType, value); + result[key] = deserializedValue; + } + } + return result; +} +exports.fromProto3JSONToInternalRepresentation = fromProto3JSONToInternalRepresentation; +function fromProto3JSON(type, json) { + const internalRepr = fromProto3JSONToInternalRepresentation(type, json); + if (internalRepr === null) { + return null; + } + // We only expect a real object here sine all special cases should be already resolved. Everything else is an internal error + (0, util_1.assert)(typeof internalRepr === 'object' && !Array.isArray(internalRepr), `fromProto3JSON: expected an object, not ${json}`); + return type.fromObject(internalRepr); +} +exports.fromProto3JSON = fromProto3JSON; +//# sourceMappingURL=fromproto3json.js.map + +/***/ }), + +/***/ 65913: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.fromProto3JSON = exports.toProto3JSON = void 0; +var toproto3json_1 = __nccwpck_require__(63269); +Object.defineProperty(exports, "toProto3JSON", ({ enumerable: true, get: function () { return toproto3json_1.toProto3JSON; } })); +var fromproto3json_1 = __nccwpck_require__(32360); +Object.defineProperty(exports, "fromProto3JSON", ({ enumerable: true, get: function () { return fromproto3json_1.fromProto3JSON; } })); +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 6181: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.googleProtobufTimestampFromProto3JSON = exports.googleProtobufTimestampToProto3JSON = void 0; +function googleProtobufTimestampToProto3JSON(obj) { + var _a; + // seconds is an instance of Long so it won't be undefined + const durationSeconds = obj.seconds; + const date = new Date(durationSeconds * 1000).toISOString(); + // Pad leading zeros if nano string length is less than 9. + let nanos = (_a = obj.nanos) === null || _a === void 0 ? void 0 : _a.toString().padStart(9, '0'); + // Trim the unsignificant zeros and keep 3, 6, or 9 decimal digits. + while (nanos && nanos.length > 3 && nanos.endsWith('000')) { + nanos = nanos.slice(0, -3); + } + return date.replace(/(?:\.\d{0,9})/, '.' + nanos); +} +exports.googleProtobufTimestampToProto3JSON = googleProtobufTimestampToProto3JSON; +function googleProtobufTimestampFromProto3JSON(json) { + const match = json.match(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(?:\.\d+)?/); + if (!match) { + throw new Error(`googleProtobufDurationFromProto3JSON: incorrect value ${json} passed as google.protobuf.Duration`); + } + const date = new Date(json); + const millisecondsSinceEpoch = date.getTime(); + const seconds = Math.floor(millisecondsSinceEpoch / 1000); + // The fractional seconds in the JSON timestamps can go up to 9 digits (i.e. up to 1 nanosecond resolution). + // However, Javascript Date object represent any date and time to millisecond precision. + // To keep the precision, we extract the fractional seconds and append 0 until the length is equal to 9. + let nanos = 0; + const secondsFromDate = json.split('.')[1]; + if (secondsFromDate) { + nanos = parseInt(secondsFromDate.slice(0, -1).padEnd(9, '0')); + } + const result = {}; + if (seconds !== 0) { + result.seconds = seconds; + } + if (nanos !== 0) { + result.nanos = nanos; + } + return result; +} +exports.googleProtobufTimestampFromProto3JSON = googleProtobufTimestampFromProto3JSON; +//# sourceMappingURL=timestamp.js.map + +/***/ }), + +/***/ 63269: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.toProto3JSON = void 0; +const any_1 = __nccwpck_require__(12851); +const bytes_1 = __nccwpck_require__(87066); +const util_1 = __nccwpck_require__(27905); +const enum_1 = __nccwpck_require__(94944); +const value_1 = __nccwpck_require__(92304); +const duration_1 = __nccwpck_require__(1849); +const timestamp_1 = __nccwpck_require__(6181); +const wrappers_1 = __nccwpck_require__(18157); +const fieldmask_1 = __nccwpck_require__(56441); +// Convert a single value, which might happen to be an instance of Long, to JSONValue +function convertSingleValue(value) { + var _a; + if (typeof value === 'object') { + if (((_a = value === null || value === void 0 ? void 0 : value.constructor) === null || _a === void 0 ? void 0 : _a.name) === 'Long') { + return value.toString(); + } + throw new Error(`toProto3JSON: don't know how to convert value ${value}`); + } + return value; +} +function toProto3JSON(obj, options) { + const objType = obj.$type; + if (!objType) { + throw new Error('Cannot serialize object to proto3 JSON since its .$type is unknown. Use Type.fromObject(obj) before calling toProto3JSON.'); + } + objType.resolveAll(); + const typeName = (0, util_1.getFullyQualifiedTypeName)(objType); + // Types that require special handling according to + // https://developers.google.com/protocol-buffers/docs/proto3#json + if (typeName === '.google.protobuf.Any') { + return (0, any_1.googleProtobufAnyToProto3JSON)(obj, options); + } + if (typeName === '.google.protobuf.Value') { + return (0, value_1.googleProtobufValueToProto3JSON)(obj); + } + if (typeName === '.google.protobuf.Struct') { + return (0, value_1.googleProtobufStructToProto3JSON)(obj); + } + if (typeName === '.google.protobuf.ListValue') { + return (0, value_1.googleProtobufListValueToProto3JSON)(obj); + } + if (typeName === '.google.protobuf.Duration') { + return (0, duration_1.googleProtobufDurationToProto3JSON)(obj); + } + if (typeName === '.google.protobuf.Timestamp') { + return (0, timestamp_1.googleProtobufTimestampToProto3JSON)(obj); + } + if (typeName === '.google.protobuf.FieldMask') { + return (0, fieldmask_1.googleProtobufFieldMaskToProto3JSON)(obj); + } + if (util_1.wrapperTypes.has(typeName)) { + return (0, wrappers_1.wrapperToProto3JSON)(obj); + } + const result = {}; + for (const [key, value] of Object.entries(obj)) { + const field = objType.fields[key]; + const fieldResolvedType = field.resolvedType; + const fieldFullyQualifiedTypeName = fieldResolvedType + ? (0, util_1.getFullyQualifiedTypeName)(fieldResolvedType) + : null; + if (value === null) { + result[key] = null; + continue; + } + if (Array.isArray(value)) { + if (value.length === 0) { + // ignore repeated fields with no values + continue; + } + // if the repeated value has a complex type, convert it to proto3 JSON, otherwise use as is + result[key] = value.map(fieldResolvedType + ? element => { + return toProto3JSON(element, options); + } + : convertSingleValue); + continue; + } + if (field.map) { + const map = {}; + for (const [mapKey, mapValue] of Object.entries(value)) { + // if the map value has a complex type, convert it to proto3 JSON, otherwise use as is + map[mapKey] = fieldResolvedType + ? toProto3JSON(mapValue, options) + : convertSingleValue(mapValue); + } + result[key] = map; + continue; + } + if (fieldFullyQualifiedTypeName === '.google.protobuf.NullValue') { + result[key] = null; + continue; + } + if (fieldResolvedType && 'values' in fieldResolvedType && value !== null) { + if (options === null || options === void 0 ? void 0 : options.numericEnums) { + result[key] = (0, enum_1.resolveEnumValueToNumber)(fieldResolvedType, value); + } + else { + result[key] = (0, enum_1.resolveEnumValueToString)(fieldResolvedType, value); + } + continue; + } + if (fieldResolvedType) { + result[key] = toProto3JSON(value, options); + continue; + } + if (typeof value === 'string' || + typeof value === 'number' || + typeof value === 'boolean' || + value === null) { + if (typeof value === 'number' && !Number.isFinite(value)) { + result[key] = value.toString(); + continue; + } + result[key] = value; + continue; + } + if (Buffer.isBuffer(value) || value instanceof Uint8Array) { + result[key] = (0, bytes_1.bytesToProto3JSON)(value); + continue; + } + result[key] = convertSingleValue(value); + continue; + } + return result; +} +exports.toProto3JSON = toProto3JSON; +//# sourceMappingURL=toproto3json.js.map + +/***/ }), + +/***/ 27905: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.assert = exports.wrapperTypes = exports.getFullyQualifiedTypeName = void 0; +function getFullyQualifiedTypeName(type) { + // We assume that the protobuf package tree cannot have cycles. + let fullyQualifiedTypeName = ''; + while (type.parent) { + fullyQualifiedTypeName = `.${type.name}${fullyQualifiedTypeName}`; + type = type.parent; + } + return fullyQualifiedTypeName; +} +exports.getFullyQualifiedTypeName = getFullyQualifiedTypeName; +exports.wrapperTypes = new Set([ + '.google.protobuf.DoubleValue', + '.google.protobuf.FloatValue', + '.google.protobuf.Int64Value', + '.google.protobuf.UInt64Value', + '.google.protobuf.Int32Value', + '.google.protobuf.UInt32Value', + '.google.protobuf.BoolValue', + '.google.protobuf.StringValue', + '.google.protobuf.BytesValue', +]); +function assert(assertion, message) { + if (!assertion) { + throw new Error(message); + } +} +exports.assert = assert; +//# sourceMappingURL=util.js.map + +/***/ }), + +/***/ 92304: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.googleProtobufValueFromProto3JSON = exports.googleProtobufListValueFromProto3JSON = exports.googleProtobufStructFromProto3JSON = exports.googleProtobufValueToProto3JSON = exports.googleProtobufListValueToProto3JSON = exports.googleProtobufStructToProto3JSON = void 0; +const util_1 = __nccwpck_require__(27905); +function googleProtobufStructToProto3JSON(obj) { + const result = {}; + const fields = obj.fields; + for (const [key, value] of Object.entries(fields)) { + result[key] = googleProtobufValueToProto3JSON(value); + } + return result; +} +exports.googleProtobufStructToProto3JSON = googleProtobufStructToProto3JSON; +function googleProtobufListValueToProto3JSON(obj) { + (0, util_1.assert)(Array.isArray(obj.values), 'ListValue internal representation must contain array of values'); + return obj.values.map(googleProtobufValueToProto3JSON); +} +exports.googleProtobufListValueToProto3JSON = googleProtobufListValueToProto3JSON; +function googleProtobufValueToProto3JSON(obj) { + if (Object.prototype.hasOwnProperty.call(obj, 'nullValue')) { + return null; + } + if (Object.prototype.hasOwnProperty.call(obj, 'numberValue') && + typeof obj.numberValue === 'number') { + if (!Number.isFinite(obj.numberValue)) { + return obj.numberValue.toString(); + } + return obj.numberValue; + } + if (Object.prototype.hasOwnProperty.call(obj, 'stringValue') && + typeof obj.stringValue === 'string') { + return obj.stringValue; + } + if (Object.prototype.hasOwnProperty.call(obj, 'boolValue') && + typeof obj.boolValue === 'boolean') { + return obj.boolValue; + } + if (Object.prototype.hasOwnProperty.call(obj, 'structValue') && + typeof obj.structValue === 'object') { + return googleProtobufStructToProto3JSON(obj.structValue); + } + if (Object.prototype.hasOwnProperty.call(obj, 'listValue') && + typeof obj === 'object' && + typeof obj.listValue === 'object') { + return googleProtobufListValueToProto3JSON(obj.listValue); + } + // Assuming empty Value to be null + return null; +} +exports.googleProtobufValueToProto3JSON = googleProtobufValueToProto3JSON; +function googleProtobufStructFromProto3JSON(json) { + const fields = {}; + for (const [key, value] of Object.entries(json)) { + fields[key] = googleProtobufValueFromProto3JSON(value); + } + return { fields }; +} +exports.googleProtobufStructFromProto3JSON = googleProtobufStructFromProto3JSON; +function googleProtobufListValueFromProto3JSON(json) { + return { + values: json.map(element => googleProtobufValueFromProto3JSON(element)), + }; +} +exports.googleProtobufListValueFromProto3JSON = googleProtobufListValueFromProto3JSON; +function googleProtobufValueFromProto3JSON(json) { + if (json === null) { + return { nullValue: 'NULL_VALUE' }; + } + if (typeof json === 'number') { + return { numberValue: json }; + } + if (typeof json === 'string') { + return { stringValue: json }; + } + if (typeof json === 'boolean') { + return { boolValue: json }; + } + if (Array.isArray(json)) { + return { + listValue: googleProtobufListValueFromProto3JSON(json), + }; + } + if (typeof json === 'object') { + return { + structValue: googleProtobufStructFromProto3JSON(json), + }; + } + throw new Error(`googleProtobufValueFromProto3JSON: incorrect parameter type: ${typeof json}`); +} +exports.googleProtobufValueFromProto3JSON = googleProtobufValueFromProto3JSON; +//# sourceMappingURL=value.js.map + +/***/ }), + +/***/ 18157: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +// Copyright 2021 Google LLC +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.wrapperFromProto3JSON = exports.wrapperToProto3JSON = void 0; +const bytes_1 = __nccwpck_require__(87066); +const util_1 = __nccwpck_require__(27905); +function wrapperToProto3JSON(obj) { + if (!Object.prototype.hasOwnProperty.call(obj, 'value')) { + return null; + } + if (Buffer.isBuffer(obj.value) || obj.value instanceof Uint8Array) { + return (0, bytes_1.bytesToProto3JSON)(obj.value); + } + if (typeof obj.value === 'object') { + (0, util_1.assert)(obj.value.constructor.name === 'Long', `wrapperToProto3JSON: expected to see a number, a string, a boolean, or a Long, but got ${obj.value}`); + return obj.value.toString(); + } + // JSON accept special string values "NaN", "Infinity", and "-Infinity". + if (typeof obj.value === 'number' && !Number.isFinite(obj.value)) { + return obj.value.toString(); + } + return obj.value; +} +exports.wrapperToProto3JSON = wrapperToProto3JSON; +function wrapperFromProto3JSON(typeName, json) { + if (json === null) { + return { + value: null, + }; + } + if (typeName === '.google.protobuf.BytesValue') { + if (typeof json !== 'string') { + throw new Error(`numberWrapperFromProto3JSON: expected to get a string for google.protobuf.BytesValue but got ${typeof json}`); + } + return { + value: (0, bytes_1.bytesFromProto3JSON)(json), + }; + } + return { + value: json, + }; +} +exports.wrapperFromProto3JSON = wrapperFromProto3JSON; +//# sourceMappingURL=wrappers.js.map + +/***/ }), + +/***/ 6412: +/***/ ((module, exports, __nccwpck_require__) => { + +"use strict"; + +var $protobuf = __nccwpck_require__(23928); +module.exports = exports = $protobuf.descriptor = $protobuf.Root.fromJSON(__nccwpck_require__(93951)).lookup(".google.protobuf"); + +var Namespace = $protobuf.Namespace, + Root = $protobuf.Root, + Enum = $protobuf.Enum, + Type = $protobuf.Type, + Field = $protobuf.Field, + MapField = $protobuf.MapField, + OneOf = $protobuf.OneOf, + Service = $protobuf.Service, + Method = $protobuf.Method; + +// --- Root --- + +/** + * Properties of a FileDescriptorSet message. + * @interface IFileDescriptorSet + * @property {IFileDescriptorProto[]} file Files + */ + +/** + * Properties of a FileDescriptorProto message. + * @interface IFileDescriptorProto + * @property {string} [name] File name + * @property {string} [package] Package + * @property {*} [dependency] Not supported + * @property {*} [publicDependency] Not supported + * @property {*} [weakDependency] Not supported + * @property {IDescriptorProto[]} [messageType] Nested message types + * @property {IEnumDescriptorProto[]} [enumType] Nested enums + * @property {IServiceDescriptorProto[]} [service] Nested services + * @property {IFieldDescriptorProto[]} [extension] Nested extension fields + * @property {IFileOptions} [options] Options + * @property {*} [sourceCodeInfo] Not supported + * @property {string} [syntax="proto2"] Syntax + * @property {IEdition} [edition] Edition + */ + +/** + * Values of the Edition enum. + * @typedef IEdition + * @type {number} + * @property {number} EDITION_UNKNOWN=0 + * @property {number} EDITION_LEGACY=900 + * @property {number} EDITION_PROTO2=998 + * @property {number} EDITION_PROTO3=999 + * @property {number} EDITION_2023=1000 + * @property {number} EDITION_2024=1001 + * @property {number} EDITION_1_TEST_ONLY=1 + * @property {number} EDITION_2_TEST_ONLY=2 + * @property {number} EDITION_99997_TEST_ONLY=99997 + * @property {number} EDITION_99998_TEST_ONLY=99998 + * @property {number} EDITION_99998_TEST_ONLY=99999 + * @property {number} EDITION_MAX=2147483647 + */ + +/** + * Properties of a FileOptions message. + * @interface IFileOptions + * @property {string} [javaPackage] + * @property {string} [javaOuterClassname] + * @property {boolean} [javaMultipleFiles] + * @property {boolean} [javaGenerateEqualsAndHash] + * @property {boolean} [javaStringCheckUtf8] + * @property {IFileOptionsOptimizeMode} [optimizeFor=1] + * @property {string} [goPackage] + * @property {boolean} [ccGenericServices] + * @property {boolean} [javaGenericServices] + * @property {boolean} [pyGenericServices] + * @property {boolean} [deprecated] + * @property {boolean} [ccEnableArenas] + * @property {string} [objcClassPrefix] + * @property {string} [csharpNamespace] + */ + +/** + * Values of he FileOptions.OptimizeMode enum. + * @typedef IFileOptionsOptimizeMode + * @type {number} + * @property {number} SPEED=1 + * @property {number} CODE_SIZE=2 + * @property {number} LITE_RUNTIME=3 + */ + +/** + * Creates a root from a descriptor set. + * @param {IFileDescriptorSet|Reader|Uint8Array} descriptor Descriptor + * @returns {Root} Root instance + */ +Root.fromDescriptor = function fromDescriptor(descriptor) { + + // Decode the descriptor message if specified as a buffer: + if (typeof descriptor.length === "number") + descriptor = exports.FileDescriptorSet.decode(descriptor); + + var root = new Root(); + + if (descriptor.file) { + var fileDescriptor, + filePackage; + for (var j = 0, i; j < descriptor.file.length; ++j) { + filePackage = root; + if ((fileDescriptor = descriptor.file[j])["package"] && fileDescriptor["package"].length) + filePackage = root.define(fileDescriptor["package"]); + var edition = editionFromDescriptor(fileDescriptor); + if (fileDescriptor.name && fileDescriptor.name.length) + root.files.push(filePackage.filename = fileDescriptor.name); + if (fileDescriptor.messageType) + for (i = 0; i < fileDescriptor.messageType.length; ++i) + filePackage.add(Type.fromDescriptor(fileDescriptor.messageType[i], edition)); + if (fileDescriptor.enumType) + for (i = 0; i < fileDescriptor.enumType.length; ++i) + filePackage.add(Enum.fromDescriptor(fileDescriptor.enumType[i], edition)); + if (fileDescriptor.extension) + for (i = 0; i < fileDescriptor.extension.length; ++i) + filePackage.add(Field.fromDescriptor(fileDescriptor.extension[i], edition)); + if (fileDescriptor.service) + for (i = 0; i < fileDescriptor.service.length; ++i) + filePackage.add(Service.fromDescriptor(fileDescriptor.service[i], edition)); + var opts = fromDescriptorOptions(fileDescriptor.options, exports.FileOptions); + if (opts) { + var ks = Object.keys(opts); + for (i = 0; i < ks.length; ++i) + filePackage.setOption(ks[i], opts[ks[i]]); + } + } + } + + return root.resolveAll(); +}; + +/** + * Converts a root to a descriptor set. + * @returns {Message} Descriptor + * @param {string} [edition="proto2"] The syntax or edition to use + */ +Root.prototype.toDescriptor = function toDescriptor(edition) { + var set = exports.FileDescriptorSet.create(); + Root_toDescriptorRecursive(this, set.file, edition); + return set; +}; + +// Traverses a namespace and assembles the descriptor set +function Root_toDescriptorRecursive(ns, files, edition) { + + // Create a new file + var file = exports.FileDescriptorProto.create({ name: ns.filename || (ns.fullName.substring(1).replace(/\./g, "_") || "root") + ".proto" }); + editionToDescriptor(edition, file); + if (!(ns instanceof Root)) + file["package"] = ns.fullName.substring(1); + + // Add nested types + for (var i = 0, nested; i < ns.nestedArray.length; ++i) + if ((nested = ns._nestedArray[i]) instanceof Type) + file.messageType.push(nested.toDescriptor(edition)); + else if (nested instanceof Enum) + file.enumType.push(nested.toDescriptor()); + else if (nested instanceof Field) + file.extension.push(nested.toDescriptor(edition)); + else if (nested instanceof Service) + file.service.push(nested.toDescriptor()); + else if (nested instanceof /* plain */ Namespace) + Root_toDescriptorRecursive(nested, files, edition); // requires new file + + // Keep package-level options + file.options = toDescriptorOptions(ns.options, exports.FileOptions); + + // And keep the file only if there is at least one nested object + if (file.messageType.length + file.enumType.length + file.extension.length + file.service.length) + files.push(file); +} + +// --- Type --- + +/** + * Properties of a DescriptorProto message. + * @interface IDescriptorProto + * @property {string} [name] Message type name + * @property {IFieldDescriptorProto[]} [field] Fields + * @property {IFieldDescriptorProto[]} [extension] Extension fields + * @property {IDescriptorProto[]} [nestedType] Nested message types + * @property {IEnumDescriptorProto[]} [enumType] Nested enums + * @property {IDescriptorProtoExtensionRange[]} [extensionRange] Extension ranges + * @property {IOneofDescriptorProto[]} [oneofDecl] Oneofs + * @property {IMessageOptions} [options] Not supported + * @property {IDescriptorProtoReservedRange[]} [reservedRange] Reserved ranges + * @property {string[]} [reservedName] Reserved names + */ + +/** + * Properties of a MessageOptions message. + * @interface IMessageOptions + * @property {boolean} [mapEntry=false] Whether this message is a map entry + */ + +/** + * Properties of an ExtensionRange message. + * @interface IDescriptorProtoExtensionRange + * @property {number} [start] Start field id + * @property {number} [end] End field id + */ + +/** + * Properties of a ReservedRange message. + * @interface IDescriptorProtoReservedRange + * @property {number} [start] Start field id + * @property {number} [end] End field id + */ + +var unnamedMessageIndex = 0; + +/** + * Creates a type from a descriptor. + * + * Warning: this is not safe to use with editions protos, since it discards relevant file context. + * + * @param {IDescriptorProto|Reader|Uint8Array} descriptor Descriptor + * @param {string} [edition="proto2"] The syntax or edition to use + * @param {boolean} [nested=false] Whether or not this is a nested object + * @returns {Type} Type instance + */ +Type.fromDescriptor = function fromDescriptor(descriptor, edition, nested) { + // Decode the descriptor message if specified as a buffer: + if (typeof descriptor.length === "number") + descriptor = exports.DescriptorProto.decode(descriptor); + + // Create the message type + var type = new Type(descriptor.name.length ? descriptor.name : "Type" + unnamedMessageIndex++, fromDescriptorOptions(descriptor.options, exports.MessageOptions)), + i; + + if (!nested) + type._edition = edition; + + /* Oneofs */ if (descriptor.oneofDecl) + for (i = 0; i < descriptor.oneofDecl.length; ++i) + type.add(OneOf.fromDescriptor(descriptor.oneofDecl[i])); + /* Fields */ if (descriptor.field) + for (i = 0; i < descriptor.field.length; ++i) { + var field = Field.fromDescriptor(descriptor.field[i], edition, true); + type.add(field); + if (descriptor.field[i].hasOwnProperty("oneofIndex")) // eslint-disable-line no-prototype-builtins + type.oneofsArray[descriptor.field[i].oneofIndex].add(field); + } + /* Extension fields */ if (descriptor.extension) + for (i = 0; i < descriptor.extension.length; ++i) + type.add(Field.fromDescriptor(descriptor.extension[i], edition, true)); + /* Nested types */ if (descriptor.nestedType) + for (i = 0; i < descriptor.nestedType.length; ++i) { + type.add(Type.fromDescriptor(descriptor.nestedType[i], edition, true)); + if (descriptor.nestedType[i].options && descriptor.nestedType[i].options.mapEntry) + type.setOption("map_entry", true); + } + /* Nested enums */ if (descriptor.enumType) + for (i = 0; i < descriptor.enumType.length; ++i) + type.add(Enum.fromDescriptor(descriptor.enumType[i], edition, true)); + /* Extension ranges */ if (descriptor.extensionRange && descriptor.extensionRange.length) { + type.extensions = []; + for (i = 0; i < descriptor.extensionRange.length; ++i) + type.extensions.push([ descriptor.extensionRange[i].start, descriptor.extensionRange[i].end ]); + } + /* Reserved... */ if (descriptor.reservedRange && descriptor.reservedRange.length || descriptor.reservedName && descriptor.reservedName.length) { + type.reserved = []; + /* Ranges */ if (descriptor.reservedRange) + for (i = 0; i < descriptor.reservedRange.length; ++i) + type.reserved.push([ descriptor.reservedRange[i].start, descriptor.reservedRange[i].end ]); + /* Names */ if (descriptor.reservedName) + for (i = 0; i < descriptor.reservedName.length; ++i) + type.reserved.push(descriptor.reservedName[i]); + } + + return type; +}; + +/** + * Converts a type to a descriptor. + * @returns {Message} Descriptor + * @param {string} [edition="proto2"] The syntax or edition to use + */ +Type.prototype.toDescriptor = function toDescriptor(edition) { + var descriptor = exports.DescriptorProto.create({ name: this.name }), + i; + + /* Fields */ for (i = 0; i < this.fieldsArray.length; ++i) { + var fieldDescriptor; + descriptor.field.push(fieldDescriptor = this._fieldsArray[i].toDescriptor(edition)); + if (this._fieldsArray[i] instanceof MapField) { // map fields are repeated FieldNameEntry + var keyType = toDescriptorType(this._fieldsArray[i].keyType, this._fieldsArray[i].resolvedKeyType, false), + valueType = toDescriptorType(this._fieldsArray[i].type, this._fieldsArray[i].resolvedType, false), + valueTypeName = valueType === /* type */ 11 || valueType === /* enum */ 14 + ? this._fieldsArray[i].resolvedType && shortname(this.parent, this._fieldsArray[i].resolvedType) || this._fieldsArray[i].type + : undefined; + descriptor.nestedType.push(exports.DescriptorProto.create({ + name: fieldDescriptor.typeName, + field: [ + exports.FieldDescriptorProto.create({ name: "key", number: 1, label: 1, type: keyType }), // can't reference a type or enum + exports.FieldDescriptorProto.create({ name: "value", number: 2, label: 1, type: valueType, typeName: valueTypeName }) + ], + options: exports.MessageOptions.create({ mapEntry: true }) + })); + } + } + /* Oneofs */ for (i = 0; i < this.oneofsArray.length; ++i) + descriptor.oneofDecl.push(this._oneofsArray[i].toDescriptor()); + /* Nested... */ for (i = 0; i < this.nestedArray.length; ++i) { + /* Extension fields */ if (this._nestedArray[i] instanceof Field) + descriptor.field.push(this._nestedArray[i].toDescriptor(edition)); + /* Types */ else if (this._nestedArray[i] instanceof Type) + descriptor.nestedType.push(this._nestedArray[i].toDescriptor(edition)); + /* Enums */ else if (this._nestedArray[i] instanceof Enum) + descriptor.enumType.push(this._nestedArray[i].toDescriptor()); + // plain nested namespaces become packages instead in Root#toDescriptor + } + /* Extension ranges */ if (this.extensions) + for (i = 0; i < this.extensions.length; ++i) + descriptor.extensionRange.push(exports.DescriptorProto.ExtensionRange.create({ start: this.extensions[i][0], end: this.extensions[i][1] })); + /* Reserved... */ if (this.reserved) + for (i = 0; i < this.reserved.length; ++i) + /* Names */ if (typeof this.reserved[i] === "string") + descriptor.reservedName.push(this.reserved[i]); + /* Ranges */ else + descriptor.reservedRange.push(exports.DescriptorProto.ReservedRange.create({ start: this.reserved[i][0], end: this.reserved[i][1] })); + + descriptor.options = toDescriptorOptions(this.options, exports.MessageOptions); + + return descriptor; +}; + +// --- Field --- + +/** + * Properties of a FieldDescriptorProto message. + * @interface IFieldDescriptorProto + * @property {string} [name] Field name + * @property {number} [number] Field id + * @property {IFieldDescriptorProtoLabel} [label] Field rule + * @property {IFieldDescriptorProtoType} [type] Field basic type + * @property {string} [typeName] Field type name + * @property {string} [extendee] Extended type name + * @property {string} [defaultValue] Literal default value + * @property {number} [oneofIndex] Oneof index if part of a oneof + * @property {*} [jsonName] Not supported + * @property {IFieldOptions} [options] Field options + */ + +/** + * Values of the FieldDescriptorProto.Label enum. + * @typedef IFieldDescriptorProtoLabel + * @type {number} + * @property {number} LABEL_OPTIONAL=1 + * @property {number} LABEL_REQUIRED=2 + * @property {number} LABEL_REPEATED=3 + */ + +/** + * Values of the FieldDescriptorProto.Type enum. + * @typedef IFieldDescriptorProtoType + * @type {number} + * @property {number} TYPE_DOUBLE=1 + * @property {number} TYPE_FLOAT=2 + * @property {number} TYPE_INT64=3 + * @property {number} TYPE_UINT64=4 + * @property {number} TYPE_INT32=5 + * @property {number} TYPE_FIXED64=6 + * @property {number} TYPE_FIXED32=7 + * @property {number} TYPE_BOOL=8 + * @property {number} TYPE_STRING=9 + * @property {number} TYPE_GROUP=10 + * @property {number} TYPE_MESSAGE=11 + * @property {number} TYPE_BYTES=12 + * @property {number} TYPE_UINT32=13 + * @property {number} TYPE_ENUM=14 + * @property {number} TYPE_SFIXED32=15 + * @property {number} TYPE_SFIXED64=16 + * @property {number} TYPE_SINT32=17 + * @property {number} TYPE_SINT64=18 + */ + +/** + * Properties of a FieldOptions message. + * @interface IFieldOptions + * @property {boolean} [packed] Whether packed or not (defaults to `false` for proto2 and `true` for proto3) + * @property {IFieldOptionsJSType} [jstype] JavaScript value type (not used by protobuf.js) + */ + +/** + * Values of the FieldOptions.JSType enum. + * @typedef IFieldOptionsJSType + * @type {number} + * @property {number} JS_NORMAL=0 + * @property {number} JS_STRING=1 + * @property {number} JS_NUMBER=2 + */ + +// copied here from parse.js +var numberRe = /^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/; + +/** + * Creates a field from a descriptor. + * + * Warning: this is not safe to use with editions protos, since it discards relevant file context. + * + * @param {IFieldDescriptorProto|Reader|Uint8Array} descriptor Descriptor + * @param {string} [edition="proto2"] The syntax or edition to use + * @param {boolean} [nested=false] Whether or not this is a top-level object + * @returns {Field} Field instance + */ +Field.fromDescriptor = function fromDescriptor(descriptor, edition, nested) { + + // Decode the descriptor message if specified as a buffer: + if (typeof descriptor.length === "number") + descriptor = exports.DescriptorProto.decode(descriptor); + + if (typeof descriptor.number !== "number") + throw Error("missing field id"); + + // Rewire field type + var fieldType; + if (descriptor.typeName && descriptor.typeName.length) + fieldType = descriptor.typeName; + else + fieldType = fromDescriptorType(descriptor.type); + + // Rewire field rule + var fieldRule; + switch (descriptor.label) { + // 0 is reserved for errors + case 1: fieldRule = undefined; break; + case 2: fieldRule = "required"; break; + case 3: fieldRule = "repeated"; break; + default: throw Error("illegal label: " + descriptor.label); + } + + var extendee = descriptor.extendee; + if (descriptor.extendee !== undefined) { + extendee = extendee.length ? extendee : undefined; + } + var field = new Field( + descriptor.name.length ? descriptor.name : "field" + descriptor.number, + descriptor.number, + fieldType, + fieldRule, + extendee + ); + + if (!nested) + field._edition = edition; + + field.options = fromDescriptorOptions(descriptor.options, exports.FieldOptions); + if (descriptor.proto3_optional) + field.options.proto3_optional = true; + + if (descriptor.defaultValue && descriptor.defaultValue.length) { + var defaultValue = descriptor.defaultValue; + switch (defaultValue) { + case "true": case "TRUE": + defaultValue = true; + break; + case "false": case "FALSE": + defaultValue = false; + break; + default: + var match = numberRe.exec(defaultValue); + if (match) + defaultValue = parseInt(defaultValue); // eslint-disable-line radix + break; + } + field.setOption("default", defaultValue); + } + + if (packableDescriptorType(descriptor.type)) { + if (edition === "proto3") { // defaults to packed=true (internal preset is packed=true) + if (descriptor.options && !descriptor.options.packed) + field.setOption("packed", false); + } else if ((!edition || edition === "proto2") && descriptor.options && descriptor.options.packed) // defaults to packed=false + field.setOption("packed", true); + } + + return field; +}; + +/** + * Converts a field to a descriptor. + * @returns {Message} Descriptor + * @param {string} [edition="proto2"] The syntax or edition to use + */ +Field.prototype.toDescriptor = function toDescriptor(edition) { + var descriptor = exports.FieldDescriptorProto.create({ name: this.name, number: this.id }); + + if (this.map) { + + descriptor.type = 11; // message + descriptor.typeName = $protobuf.util.ucFirst(this.name); // fieldName -> FieldNameEntry (built in Type#toDescriptor) + descriptor.label = 3; // repeated + + } else { + + // Rewire field type + switch (descriptor.type = toDescriptorType(this.type, this.resolve().resolvedType, this.delimited)) { + case 10: // group + case 11: // type + case 14: // enum + descriptor.typeName = this.resolvedType ? shortname(this.parent, this.resolvedType) : this.type; + break; + } + + // Rewire field rule + if (this.rule === "repeated") { + descriptor.label = 3; + } else if (this.required && edition === "proto2") { + descriptor.label = 2; + } else { + descriptor.label = 1; + } + } + + // Handle extension field + descriptor.extendee = this.extensionField ? this.extensionField.parent.fullName : this.extend; + + // Handle part of oneof + if (this.partOf) + if ((descriptor.oneofIndex = this.parent.oneofsArray.indexOf(this.partOf)) < 0) + throw Error("missing oneof"); + + if (this.options) { + descriptor.options = toDescriptorOptions(this.options, exports.FieldOptions); + if (this.options["default"] != null) + descriptor.defaultValue = String(this.options["default"]); + if (this.options.proto3_optional) + descriptor.proto3_optional = true; + } + + if (edition === "proto3") { // defaults to packed=true + if (!this.packed) + (descriptor.options || (descriptor.options = exports.FieldOptions.create())).packed = false; + } else if ((!edition || edition === "proto2") && this.packed) // defaults to packed=false + (descriptor.options || (descriptor.options = exports.FieldOptions.create())).packed = true; + + return descriptor; +}; + +// --- Enum --- + +/** + * Properties of an EnumDescriptorProto message. + * @interface IEnumDescriptorProto + * @property {string} [name] Enum name + * @property {IEnumValueDescriptorProto[]} [value] Enum values + * @property {IEnumOptions} [options] Enum options + */ + +/** + * Properties of an EnumValueDescriptorProto message. + * @interface IEnumValueDescriptorProto + * @property {string} [name] Name + * @property {number} [number] Value + * @property {*} [options] Not supported + */ + +/** + * Properties of an EnumOptions message. + * @interface IEnumOptions + * @property {boolean} [allowAlias] Whether aliases are allowed + * @property {boolean} [deprecated] + */ + +var unnamedEnumIndex = 0; + +/** + * Creates an enum from a descriptor. + * + * Warning: this is not safe to use with editions protos, since it discards relevant file context. + * + * @param {IEnumDescriptorProto|Reader|Uint8Array} descriptor Descriptor + * @param {string} [edition="proto2"] The syntax or edition to use + * @param {boolean} [nested=false] Whether or not this is a top-level object + * @returns {Enum} Enum instance + */ +Enum.fromDescriptor = function fromDescriptor(descriptor, edition, nested) { + + // Decode the descriptor message if specified as a buffer: + if (typeof descriptor.length === "number") + descriptor = exports.EnumDescriptorProto.decode(descriptor); + + // Construct values object + var values = {}; + if (descriptor.value) + for (var i = 0; i < descriptor.value.length; ++i) { + var name = descriptor.value[i].name, + value = descriptor.value[i].number || 0; + values[name && name.length ? name : "NAME" + value] = value; + } + + var enm = new Enum( + descriptor.name && descriptor.name.length ? descriptor.name : "Enum" + unnamedEnumIndex++, + values, + fromDescriptorOptions(descriptor.options, exports.EnumOptions) + ); + + if (!nested) + enm._edition = edition; + + return enm; +}; + +/** + * Converts an enum to a descriptor. + * @returns {Message} Descriptor + */ +Enum.prototype.toDescriptor = function toDescriptor() { + + // Values + var values = []; + for (var i = 0, ks = Object.keys(this.values); i < ks.length; ++i) + values.push(exports.EnumValueDescriptorProto.create({ name: ks[i], number: this.values[ks[i]] })); + + return exports.EnumDescriptorProto.create({ + name: this.name, + value: values, + options: toDescriptorOptions(this.options, exports.EnumOptions) + }); +}; + +// --- OneOf --- + +/** + * Properties of a OneofDescriptorProto message. + * @interface IOneofDescriptorProto + * @property {string} [name] Oneof name + * @property {*} [options] Not supported + */ + +var unnamedOneofIndex = 0; + +/** + * Creates a oneof from a descriptor. + * + * Warning: this is not safe to use with editions protos, since it discards relevant file context. + * + * @param {IOneofDescriptorProto|Reader|Uint8Array} descriptor Descriptor + * @returns {OneOf} OneOf instance + */ +OneOf.fromDescriptor = function fromDescriptor(descriptor) { + + // Decode the descriptor message if specified as a buffer: + if (typeof descriptor.length === "number") + descriptor = exports.OneofDescriptorProto.decode(descriptor); + + return new OneOf( + // unnamedOneOfIndex is global, not per type, because we have no ref to a type here + descriptor.name && descriptor.name.length ? descriptor.name : "oneof" + unnamedOneofIndex++ + // fromDescriptorOptions(descriptor.options, exports.OneofOptions) - only uninterpreted_option + ); +}; + +/** + * Converts a oneof to a descriptor. + * @returns {Message} Descriptor + */ +OneOf.prototype.toDescriptor = function toDescriptor() { + return exports.OneofDescriptorProto.create({ + name: this.name + // options: toDescriptorOptions(this.options, exports.OneofOptions) - only uninterpreted_option + }); +}; + +// --- Service --- + +/** + * Properties of a ServiceDescriptorProto message. + * @interface IServiceDescriptorProto + * @property {string} [name] Service name + * @property {IMethodDescriptorProto[]} [method] Methods + * @property {IServiceOptions} [options] Options + */ + +/** + * Properties of a ServiceOptions message. + * @interface IServiceOptions + * @property {boolean} [deprecated] + */ + +var unnamedServiceIndex = 0; + +/** + * Creates a service from a descriptor. + * + * Warning: this is not safe to use with editions protos, since it discards relevant file context. + * + * @param {IServiceDescriptorProto|Reader|Uint8Array} descriptor Descriptor + * @param {string} [edition="proto2"] The syntax or edition to use + * @param {boolean} [nested=false] Whether or not this is a top-level object + * @returns {Service} Service instance + */ +Service.fromDescriptor = function fromDescriptor(descriptor, edition, nested) { + + // Decode the descriptor message if specified as a buffer: + if (typeof descriptor.length === "number") + descriptor = exports.ServiceDescriptorProto.decode(descriptor); + + var service = new Service(descriptor.name && descriptor.name.length ? descriptor.name : "Service" + unnamedServiceIndex++, fromDescriptorOptions(descriptor.options, exports.ServiceOptions)); + if (!nested) + service._edition = edition; + if (descriptor.method) + for (var i = 0; i < descriptor.method.length; ++i) + service.add(Method.fromDescriptor(descriptor.method[i])); + + return service; +}; + +/** + * Converts a service to a descriptor. + * @returns {Message} Descriptor + */ +Service.prototype.toDescriptor = function toDescriptor() { + + // Methods + var methods = []; + for (var i = 0; i < this.methodsArray.length; ++i) + methods.push(this._methodsArray[i].toDescriptor()); + + return exports.ServiceDescriptorProto.create({ + name: this.name, + method: methods, + options: toDescriptorOptions(this.options, exports.ServiceOptions) + }); +}; + +// --- Method --- + +/** + * Properties of a MethodDescriptorProto message. + * @interface IMethodDescriptorProto + * @property {string} [name] Method name + * @property {string} [inputType] Request type name + * @property {string} [outputType] Response type name + * @property {IMethodOptions} [options] Not supported + * @property {boolean} [clientStreaming=false] Whether requests are streamed + * @property {boolean} [serverStreaming=false] Whether responses are streamed + */ + +/** + * Properties of a MethodOptions message. + * + * Warning: this is not safe to use with editions protos, since it discards relevant file context. + * + * @interface IMethodOptions + * @property {boolean} [deprecated] + */ + +var unnamedMethodIndex = 0; + +/** + * Creates a method from a descriptor. + * @param {IMethodDescriptorProto|Reader|Uint8Array} descriptor Descriptor + * @returns {Method} Reflected method instance + */ +Method.fromDescriptor = function fromDescriptor(descriptor) { + + // Decode the descriptor message if specified as a buffer: + if (typeof descriptor.length === "number") + descriptor = exports.MethodDescriptorProto.decode(descriptor); + + return new Method( + // unnamedMethodIndex is global, not per service, because we have no ref to a service here + descriptor.name && descriptor.name.length ? descriptor.name : "Method" + unnamedMethodIndex++, + "rpc", + descriptor.inputType, + descriptor.outputType, + Boolean(descriptor.clientStreaming), + Boolean(descriptor.serverStreaming), + fromDescriptorOptions(descriptor.options, exports.MethodOptions) + ); +}; + +/** + * Converts a method to a descriptor. + * @returns {Message} Descriptor + */ +Method.prototype.toDescriptor = function toDescriptor() { + return exports.MethodDescriptorProto.create({ + name: this.name, + inputType: this.resolvedRequestType ? this.resolvedRequestType.fullName : this.requestType, + outputType: this.resolvedResponseType ? this.resolvedResponseType.fullName : this.responseType, + clientStreaming: this.requestStream, + serverStreaming: this.responseStream, + options: toDescriptorOptions(this.options, exports.MethodOptions) + }); +}; + +// --- utility --- + +// Converts a descriptor type to a protobuf.js basic type +function fromDescriptorType(type) { + switch (type) { + // 0 is reserved for errors + case 1: return "double"; + case 2: return "float"; + case 3: return "int64"; + case 4: return "uint64"; + case 5: return "int32"; + case 6: return "fixed64"; + case 7: return "fixed32"; + case 8: return "bool"; + case 9: return "string"; + case 12: return "bytes"; + case 13: return "uint32"; + case 15: return "sfixed32"; + case 16: return "sfixed64"; + case 17: return "sint32"; + case 18: return "sint64"; + } + throw Error("illegal type: " + type); +} + +// Tests if a descriptor type is packable +function packableDescriptorType(type) { + switch (type) { + case 1: // double + case 2: // float + case 3: // int64 + case 4: // uint64 + case 5: // int32 + case 6: // fixed64 + case 7: // fixed32 + case 8: // bool + case 13: // uint32 + case 14: // enum (!) + case 15: // sfixed32 + case 16: // sfixed64 + case 17: // sint32 + case 18: // sint64 + return true; + } + return false; +} + +// Converts a protobuf.js basic type to a descriptor type +function toDescriptorType(type, resolvedType, delimited) { + switch (type) { + // 0 is reserved for errors + case "double": return 1; + case "float": return 2; + case "int64": return 3; + case "uint64": return 4; + case "int32": return 5; + case "fixed64": return 6; + case "fixed32": return 7; + case "bool": return 8; + case "string": return 9; + case "bytes": return 12; + case "uint32": return 13; + case "sfixed32": return 15; + case "sfixed64": return 16; + case "sint32": return 17; + case "sint64": return 18; + } + if (resolvedType instanceof Enum) + return 14; + if (resolvedType instanceof Type) + return delimited ? 10 : 11; + throw Error("illegal type: " + type); +} + +function fromDescriptorOptionsRecursive(obj, type) { + var val = {}; + for (var i = 0, field, key; i < type.fieldsArray.length; ++i) { + if ((key = (field = type._fieldsArray[i]).name) === "uninterpretedOption") continue; + if (!Object.prototype.hasOwnProperty.call(obj, key)) continue; + + var newKey = underScore(key); + if (field.resolvedType instanceof Type) { + val[newKey] = fromDescriptorOptionsRecursive(obj[key], field.resolvedType); + } else if(field.resolvedType instanceof Enum) { + val[newKey] = field.resolvedType.valuesById[obj[key]]; + } else { + val[newKey] = obj[key]; + } + } + return val; +} + +// Converts descriptor options to an options object +function fromDescriptorOptions(options, type) { + if (!options) + return undefined; + return fromDescriptorOptionsRecursive(type.toObject(options), type); +} + +function toDescriptorOptionsRecursive(obj, type) { + var val = {}; + var keys = Object.keys(obj); + for (var i = 0; i < keys.length; ++i) { + var key = keys[i]; + var newKey = $protobuf.util.camelCase(key); + if (!Object.prototype.hasOwnProperty.call(type.fields, newKey)) continue; + var field = type.fields[newKey]; + if (field.resolvedType instanceof Type) { + val[newKey] = toDescriptorOptionsRecursive(obj[key], field.resolvedType); + } else { + val[newKey] = obj[key]; + } + if (field.repeated && !Array.isArray(val[newKey])) { + val[newKey] = [val[newKey]]; + } + } + return val; +} + +// Converts an options object to descriptor options +function toDescriptorOptions(options, type) { + if (!options) + return undefined; + return type.fromObject(toDescriptorOptionsRecursive(options, type)); +} + +// Calculates the shortest relative path from `from` to `to`. +function shortname(from, to) { + var fromPath = from.fullName.split("."), + toPath = to.fullName.split("."), + i = 0, + j = 0, + k = toPath.length - 1; + if (!(from instanceof Root) && to instanceof Namespace) + while (i < fromPath.length && j < k && fromPath[i] === toPath[j]) { + var other = to.lookup(fromPath[i++], true); + if (other !== null && other !== to) + break; + ++j; + } + else + for (; i < fromPath.length && j < k && fromPath[i] === toPath[j]; ++i, ++j); + return toPath.slice(j).join("."); +} + +// copied here from cli/targets/proto.js +function underScore(str) { + return str.substring(0,1) + + str.substring(1) + .replace(/([A-Z])(?=[a-z]|$)/g, function($0, $1) { return "_" + $1.toLowerCase(); }); +} + +function editionFromDescriptor(fileDescriptor) { + if (fileDescriptor.syntax === "editions") { + switch(fileDescriptor.edition) { + case exports.Edition.EDITION_2023: + return "2023"; + default: + throw new Error("Unsupported edition " + fileDescriptor.edition); + } + } + if (fileDescriptor.syntax === "proto3") { + return "proto3"; + } + return "proto2"; +} + +function editionToDescriptor(edition, fileDescriptor) { + if (!edition) return; + if (edition === "proto2" || edition === "proto3") { + fileDescriptor.syntax = edition; + } else { + fileDescriptor.syntax = "editions"; + switch(edition) { + case "2023": + fileDescriptor.edition = exports.Edition.EDITION_2023; + break; + default: + throw new Error("Unsupported edition " + edition); + } + } +} + +// --- exports --- + +/** + * Reflected file descriptor set. + * @name FileDescriptorSet + * @type {Type} + * @const + * @tstype $protobuf.Type + */ + +/** + * Reflected file descriptor proto. + * @name FileDescriptorProto + * @type {Type} + * @const + * @tstype $protobuf.Type + */ + +/** + * Reflected descriptor proto. + * @name DescriptorProto + * @type {Type} + * @property {Type} ExtensionRange + * @property {Type} ReservedRange + * @const + * @tstype $protobuf.Type & { + * ExtensionRange: $protobuf.Type, + * ReservedRange: $protobuf.Type + * } + */ + +/** + * Reflected field descriptor proto. + * @name FieldDescriptorProto + * @type {Type} + * @property {Enum} Label + * @property {Enum} Type + * @const + * @tstype $protobuf.Type & { + * Label: $protobuf.Enum, + * Type: $protobuf.Enum + * } + */ + +/** + * Reflected oneof descriptor proto. + * @name OneofDescriptorProto + * @type {Type} + * @const + * @tstype $protobuf.Type + */ + +/** + * Reflected enum descriptor proto. + * @name EnumDescriptorProto + * @type {Type} + * @const + * @tstype $protobuf.Type + */ + +/** + * Reflected service descriptor proto. + * @name ServiceDescriptorProto + * @type {Type} + * @const + * @tstype $protobuf.Type + */ + +/** + * Reflected enum value descriptor proto. + * @name EnumValueDescriptorProto + * @type {Type} + * @const + * @tstype $protobuf.Type + */ + +/** + * Reflected method descriptor proto. + * @name MethodDescriptorProto + * @type {Type} + * @const + * @tstype $protobuf.Type + */ + +/** + * Reflected file options. + * @name FileOptions + * @type {Type} + * @property {Enum} OptimizeMode + * @const + * @tstype $protobuf.Type & { + * OptimizeMode: $protobuf.Enum + * } + */ + +/** + * Reflected message options. + * @name MessageOptions + * @type {Type} + * @const + * @tstype $protobuf.Type + */ + +/** + * Reflected field options. + * @name FieldOptions + * @type {Type} + * @property {Enum} CType + * @property {Enum} JSType + * @const + * @tstype $protobuf.Type & { + * CType: $protobuf.Enum, + * JSType: $protobuf.Enum + * } + */ + +/** + * Reflected oneof options. + * @name OneofOptions + * @type {Type} + * @const + * @tstype $protobuf.Type + */ + +/** + * Reflected enum options. + * @name EnumOptions + * @type {Type} + * @const + * @tstype $protobuf.Type + */ + +/** + * Reflected enum value options. + * @name EnumValueOptions + * @type {Type} + * @const + * @tstype $protobuf.Type + */ + +/** + * Reflected service options. + * @name ServiceOptions + * @type {Type} + * @const + * @tstype $protobuf.Type + */ + +/** + * Reflected method options. + * @name MethodOptions + * @type {Type} + * @const + * @tstype $protobuf.Type + */ + +/** + * Reflected uninterpretet option. + * @name UninterpretedOption + * @type {Type} + * @property {Type} NamePart + * @const + * @tstype $protobuf.Type & { + * NamePart: $protobuf.Type + * } + */ + +/** + * Reflected source code info. + * @name SourceCodeInfo + * @type {Type} + * @property {Type} Location + * @const + * @tstype $protobuf.Type & { + * Location: $protobuf.Type + * } + */ + +/** + * Reflected generated code info. + * @name GeneratedCodeInfo + * @type {Type} + * @property {Type} Annotation + * @const + * @tstype $protobuf.Type & { + * Annotation: $protobuf.Type + * } + */ + + +/***/ }), + +/***/ 23928: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; +// full library entry point. + + +module.exports = __nccwpck_require__(58513); + + +/***/ }), + +/***/ 37823: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; +// minimal library entry point. + + +module.exports = __nccwpck_require__(66579); + + +/***/ }), + +/***/ 60872: +/***/ ((module) => { + +"use strict"; + +module.exports = common; + +var commonRe = /\/|\./; + +/** + * Provides common type definitions. + * Can also be used to provide additional google types or your own custom types. + * @param {string} name Short name as in `google/protobuf/[name].proto` or full file name + * @param {Object.} json JSON definition within `google.protobuf` if a short name, otherwise the file's root definition + * @returns {undefined} + * @property {INamespace} google/protobuf/any.proto Any + * @property {INamespace} google/protobuf/duration.proto Duration + * @property {INamespace} google/protobuf/empty.proto Empty + * @property {INamespace} google/protobuf/field_mask.proto FieldMask + * @property {INamespace} google/protobuf/struct.proto Struct, Value, NullValue and ListValue + * @property {INamespace} google/protobuf/timestamp.proto Timestamp + * @property {INamespace} google/protobuf/wrappers.proto Wrappers + * @example + * // manually provides descriptor.proto (assumes google/protobuf/ namespace and .proto extension) + * protobuf.common("descriptor", descriptorJson); + * + * // manually provides a custom definition (uses my.foo namespace) + * protobuf.common("my/foo/bar.proto", myFooBarJson); + */ +function common(name, json) { + if (!commonRe.test(name)) { + name = "google/protobuf/" + name + ".proto"; + json = { nested: { google: { nested: { protobuf: { nested: json } } } } }; + } + common[name] = json; +} + +// Not provided because of limited use (feel free to discuss or to provide yourself): +// +// google/protobuf/descriptor.proto +// google/protobuf/source_context.proto +// google/protobuf/type.proto +// +// Stripped and pre-parsed versions of these non-bundled files are instead available as part of +// the repository or package within the google/protobuf directory. + +common("any", { + + /** + * Properties of a google.protobuf.Any message. + * @interface IAny + * @type {Object} + * @property {string} [typeUrl] + * @property {Uint8Array} [bytes] + * @memberof common + */ + Any: { + fields: { + type_url: { + type: "string", + id: 1 + }, + value: { + type: "bytes", + id: 2 + } + } + } +}); + +var timeType; + +common("duration", { + + /** + * Properties of a google.protobuf.Duration message. + * @interface IDuration + * @type {Object} + * @property {number|Long} [seconds] + * @property {number} [nanos] + * @memberof common + */ + Duration: timeType = { + fields: { + seconds: { + type: "int64", + id: 1 + }, + nanos: { + type: "int32", + id: 2 + } + } + } +}); + +common("timestamp", { + + /** + * Properties of a google.protobuf.Timestamp message. + * @interface ITimestamp + * @type {Object} + * @property {number|Long} [seconds] + * @property {number} [nanos] + * @memberof common + */ + Timestamp: timeType +}); + +common("empty", { + + /** + * Properties of a google.protobuf.Empty message. + * @interface IEmpty + * @memberof common + */ + Empty: { + fields: {} + } +}); + +common("struct", { + + /** + * Properties of a google.protobuf.Struct message. + * @interface IStruct + * @type {Object} + * @property {Object.} [fields] + * @memberof common + */ + Struct: { + fields: { + fields: { + keyType: "string", + type: "Value", + id: 1 + } + } + }, + + /** + * Properties of a google.protobuf.Value message. + * @interface IValue + * @type {Object} + * @property {string} [kind] + * @property {0} [nullValue] + * @property {number} [numberValue] + * @property {string} [stringValue] + * @property {boolean} [boolValue] + * @property {IStruct} [structValue] + * @property {IListValue} [listValue] + * @memberof common + */ + Value: { + oneofs: { + kind: { + oneof: [ + "nullValue", + "numberValue", + "stringValue", + "boolValue", + "structValue", + "listValue" + ] + } + }, + fields: { + nullValue: { + type: "NullValue", + id: 1 + }, + numberValue: { + type: "double", + id: 2 + }, + stringValue: { + type: "string", + id: 3 + }, + boolValue: { + type: "bool", + id: 4 + }, + structValue: { + type: "Struct", + id: 5 + }, + listValue: { + type: "ListValue", + id: 6 + } + } + }, + + NullValue: { + values: { + NULL_VALUE: 0 + } + }, + + /** + * Properties of a google.protobuf.ListValue message. + * @interface IListValue + * @type {Object} + * @property {Array.} [values] + * @memberof common + */ + ListValue: { + fields: { + values: { + rule: "repeated", + type: "Value", + id: 1 + } + } + } +}); + +common("wrappers", { + + /** + * Properties of a google.protobuf.DoubleValue message. + * @interface IDoubleValue + * @type {Object} + * @property {number} [value] + * @memberof common + */ + DoubleValue: { + fields: { + value: { + type: "double", + id: 1 + } + } + }, + + /** + * Properties of a google.protobuf.FloatValue message. + * @interface IFloatValue + * @type {Object} + * @property {number} [value] + * @memberof common + */ + FloatValue: { + fields: { + value: { + type: "float", + id: 1 + } + } + }, + + /** + * Properties of a google.protobuf.Int64Value message. + * @interface IInt64Value + * @type {Object} + * @property {number|Long} [value] + * @memberof common + */ + Int64Value: { + fields: { + value: { + type: "int64", + id: 1 + } + } + }, + + /** + * Properties of a google.protobuf.UInt64Value message. + * @interface IUInt64Value + * @type {Object} + * @property {number|Long} [value] + * @memberof common + */ + UInt64Value: { + fields: { + value: { + type: "uint64", + id: 1 + } + } + }, + + /** + * Properties of a google.protobuf.Int32Value message. + * @interface IInt32Value + * @type {Object} + * @property {number} [value] + * @memberof common + */ + Int32Value: { + fields: { + value: { + type: "int32", + id: 1 + } + } + }, + + /** + * Properties of a google.protobuf.UInt32Value message. + * @interface IUInt32Value + * @type {Object} + * @property {number} [value] + * @memberof common + */ + UInt32Value: { + fields: { + value: { + type: "uint32", + id: 1 + } + } + }, + + /** + * Properties of a google.protobuf.BoolValue message. + * @interface IBoolValue + * @type {Object} + * @property {boolean} [value] + * @memberof common + */ + BoolValue: { + fields: { + value: { + type: "bool", + id: 1 + } + } + }, + + /** + * Properties of a google.protobuf.StringValue message. + * @interface IStringValue + * @type {Object} + * @property {string} [value] + * @memberof common + */ + StringValue: { + fields: { + value: { + type: "string", + id: 1 + } + } + }, + + /** + * Properties of a google.protobuf.BytesValue message. + * @interface IBytesValue + * @type {Object} + * @property {Uint8Array} [value] + * @memberof common + */ + BytesValue: { + fields: { + value: { + type: "bytes", + id: 1 + } + } + } +}); + +common("field_mask", { + + /** + * Properties of a google.protobuf.FieldMask message. + * @interface IDoubleValue + * @type {Object} + * @property {number} [value] + * @memberof common + */ + FieldMask: { + fields: { + paths: { + rule: "repeated", + type: "string", + id: 1 + } + } + } +}); + +/** + * Gets the root definition of the specified common proto file. + * + * Bundled definitions are: + * - google/protobuf/any.proto + * - google/protobuf/duration.proto + * - google/protobuf/empty.proto + * - google/protobuf/field_mask.proto + * - google/protobuf/struct.proto + * - google/protobuf/timestamp.proto + * - google/protobuf/wrappers.proto + * + * @param {string} file Proto file name + * @returns {INamespace|null} Root definition or `null` if not defined + */ +common.get = function get(file) { + return common[file] || null; +}; + + +/***/ }), + +/***/ 92437: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/** + * Runtime message from/to plain object converters. + * @namespace + */ +var converter = exports; + +var Enum = __nccwpck_require__(73528), + util = __nccwpck_require__(39609); + +/** + * Generates a partial value fromObject conveter. + * @param {Codegen} gen Codegen instance + * @param {Field} field Reflected field + * @param {number} fieldIndex Field index + * @param {string} prop Property reference + * @returns {Codegen} Codegen instance + * @ignore + */ +function genValuePartial_fromObject(gen, field, fieldIndex, prop) { + var defaultAlreadyEmitted = false; + /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */ + if (field.resolvedType) { + if (field.resolvedType instanceof Enum) { gen + ("switch(d%s){", prop); + for (var values = field.resolvedType.values, keys = Object.keys(values), i = 0; i < keys.length; ++i) { + // enum unknown values passthrough + if (values[keys[i]] === field.typeDefault && !defaultAlreadyEmitted) { gen + ("default:") + ("if(typeof(d%s)===\"number\"){m%s=d%s;break}", prop, prop, prop); + if (!field.repeated) gen // fallback to default value only for + // arrays, to avoid leaving holes. + ("break"); // for non-repeated fields, just ignore + defaultAlreadyEmitted = true; + } + gen + ("case%j:", keys[i]) + ("case %i:", values[keys[i]]) + ("m%s=%j", prop, values[keys[i]]) + ("break"); + } gen + ("}"); + } else gen + ("if(typeof d%s!==\"object\")", prop) + ("throw TypeError(%j)", field.fullName + ": object expected") + ("m%s=types[%i].fromObject(d%s)", prop, fieldIndex, prop); + } else { + var isUnsigned = false; + switch (field.type) { + case "double": + case "float": gen + ("m%s=Number(d%s)", prop, prop); // also catches "NaN", "Infinity" + break; + case "uint32": + case "fixed32": gen + ("m%s=d%s>>>0", prop, prop); + break; + case "int32": + case "sint32": + case "sfixed32": gen + ("m%s=d%s|0", prop, prop); + break; + case "uint64": + isUnsigned = true; + // eslint-disable-next-line no-fallthrough + case "int64": + case "sint64": + case "fixed64": + case "sfixed64": gen + ("if(util.Long)") + ("(m%s=util.Long.fromValue(d%s)).unsigned=%j", prop, prop, isUnsigned) + ("else if(typeof d%s===\"string\")", prop) + ("m%s=parseInt(d%s,10)", prop, prop) + ("else if(typeof d%s===\"number\")", prop) + ("m%s=d%s", prop, prop) + ("else if(typeof d%s===\"object\")", prop) + ("m%s=new util.LongBits(d%s.low>>>0,d%s.high>>>0).toNumber(%s)", prop, prop, prop, isUnsigned ? "true" : ""); + break; + case "bytes": gen + ("if(typeof d%s===\"string\")", prop) + ("util.base64.decode(d%s,m%s=util.newBuffer(util.base64.length(d%s)),0)", prop, prop, prop) + ("else if(d%s.length >= 0)", prop) + ("m%s=d%s", prop, prop); + break; + case "string": gen + ("m%s=String(d%s)", prop, prop); + break; + case "bool": gen + ("m%s=Boolean(d%s)", prop, prop); + break; + /* default: gen + ("m%s=d%s", prop, prop); + break; */ + } + } + return gen; + /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */ +} + +/** + * Generates a plain object to runtime message converter specific to the specified message type. + * @param {Type} mtype Message type + * @returns {Codegen} Codegen instance + */ +converter.fromObject = function fromObject(mtype) { + /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */ + var fields = mtype.fieldsArray; + var gen = util.codegen(["d"], mtype.name + "$fromObject") + ("if(d instanceof this.ctor)") + ("return d"); + if (!fields.length) return gen + ("return new this.ctor"); + gen + ("var m=new this.ctor"); + for (var i = 0; i < fields.length; ++i) { + var field = fields[i].resolve(), + prop = util.safeProp(field.name); + + // Map fields + if (field.map) { gen + ("if(d%s){", prop) + ("if(typeof d%s!==\"object\")", prop) + ("throw TypeError(%j)", field.fullName + ": object expected") + ("m%s={}", prop) + ("for(var ks=Object.keys(d%s),i=0;i>>0,m%s.high>>>0).toNumber(%s):m%s", prop, prop, prop, prop, isUnsigned ? "true": "", prop); + break; + case "bytes": gen + ("d%s=o.bytes===String?util.base64.encode(m%s,0,m%s.length):o.bytes===Array?Array.prototype.slice.call(m%s):m%s", prop, prop, prop, prop, prop); + break; + default: gen + ("d%s=m%s", prop, prop); + break; + } + } + return gen; + /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */ +} + +/** + * Generates a runtime message to plain object converter specific to the specified message type. + * @param {Type} mtype Message type + * @returns {Codegen} Codegen instance + */ +converter.toObject = function toObject(mtype) { + /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */ + var fields = mtype.fieldsArray.slice().sort(util.compareFieldsById); + if (!fields.length) + return util.codegen()("return {}"); + var gen = util.codegen(["m", "o"], mtype.name + "$toObject") + ("if(!o)") + ("o={}") + ("var d={}"); + + var repeatedFields = [], + mapFields = [], + normalFields = [], + i = 0; + for (; i < fields.length; ++i) + if (!fields[i].partOf) + ( fields[i].resolve().repeated ? repeatedFields + : fields[i].map ? mapFields + : normalFields).push(fields[i]); + + if (repeatedFields.length) { gen + ("if(o.arrays||o.defaults){"); + for (i = 0; i < repeatedFields.length; ++i) gen + ("d%s=[]", util.safeProp(repeatedFields[i].name)); + gen + ("}"); + } + + if (mapFields.length) { gen + ("if(o.objects||o.defaults){"); + for (i = 0; i < mapFields.length; ++i) gen + ("d%s={}", util.safeProp(mapFields[i].name)); + gen + ("}"); + } + + if (normalFields.length) { gen + ("if(o.defaults){"); + for (i = 0; i < normalFields.length; ++i) { + var field = normalFields[i], + prop = util.safeProp(field.name); + if (field.resolvedType instanceof Enum) gen + ("d%s=o.enums===String?%j:%j", prop, field.resolvedType.valuesById[field.typeDefault], field.typeDefault); + else if (field.long) gen + ("if(util.Long){") + ("var n=new util.Long(%i,%i,%j)", field.typeDefault.low, field.typeDefault.high, field.typeDefault.unsigned) + ("d%s=o.longs===String?n.toString():o.longs===Number?n.toNumber():n", prop) + ("}else") + ("d%s=o.longs===String?%j:%i", prop, field.typeDefault.toString(), field.typeDefault.toNumber()); + else if (field.bytes) { + var arrayDefault = "[" + Array.prototype.slice.call(field.typeDefault).join(",") + "]"; + gen + ("if(o.bytes===String)d%s=%j", prop, String.fromCharCode.apply(String, field.typeDefault)) + ("else{") + ("d%s=%s", prop, arrayDefault) + ("if(o.bytes!==Array)d%s=util.newBuffer(d%s)", prop, prop) + ("}"); + } else gen + ("d%s=%j", prop, field.typeDefault); // also messages (=null) + } gen + ("}"); + } + var hasKs2 = false; + for (i = 0; i < fields.length; ++i) { + var field = fields[i], + index = mtype._fieldsArray.indexOf(field), + prop = util.safeProp(field.name); + if (field.map) { + if (!hasKs2) { hasKs2 = true; gen + ("var ks2"); + } gen + ("if(m%s&&(ks2=Object.keys(m%s)).length){", prop, prop) + ("d%s={}", prop) + ("for(var j=0;j { + +"use strict"; + +module.exports = decoder; + +var Enum = __nccwpck_require__(73528), + types = __nccwpck_require__(21024), + util = __nccwpck_require__(39609); + +function missing(field) { + return "missing required '" + field.name + "'"; +} + +/** + * Generates a decoder specific to the specified message type. + * @param {Type} mtype Message type + * @returns {Codegen} Codegen instance + */ +function decoder(mtype) { + /* eslint-disable no-unexpected-multiline */ + var gen = util.codegen(["r", "l", "e"], mtype.name + "$decode") + ("if(!(r instanceof Reader))") + ("r=Reader.create(r)") + ("var c=l===undefined?r.len:r.pos+l,m=new this.ctor" + (mtype.fieldsArray.filter(function(field) { return field.map; }).length ? ",k,value" : "")) + ("while(r.pos>>3){"); + + var i = 0; + for (; i < /* initializes */ mtype.fieldsArray.length; ++i) { + var field = mtype._fieldsArray[i].resolve(), + type = field.resolvedType instanceof Enum ? "int32" : field.type, + ref = "m" + util.safeProp(field.name); gen + ("case %i: {", field.id); + + // Map fields + if (field.map) { gen + ("if(%s===util.emptyObject)", ref) + ("%s={}", ref) + ("var c2 = r.uint32()+r.pos"); + + if (types.defaults[field.keyType] !== undefined) gen + ("k=%j", types.defaults[field.keyType]); + else gen + ("k=null"); + + if (types.defaults[type] !== undefined) gen + ("value=%j", types.defaults[type]); + else gen + ("value=null"); + + gen + ("while(r.pos>>3){") + ("case 1: k=r.%s(); break", field.keyType) + ("case 2:"); + + if (types.basic[type] === undefined) gen + ("value=types[%i].decode(r,r.uint32())", i); // can't be groups + else gen + ("value=r.%s()", type); + + gen + ("break") + ("default:") + ("r.skipType(tag2&7)") + ("break") + ("}") + ("}"); + + if (types.long[field.keyType] !== undefined) gen + ("%s[typeof k===\"object\"?util.longToHash(k):k]=value", ref); + else gen + ("%s[k]=value", ref); + + // Repeated fields + } else if (field.repeated) { gen + + ("if(!(%s&&%s.length))", ref, ref) + ("%s=[]", ref); + + // Packable (always check for forward and backward compatiblity) + if (types.packed[type] !== undefined) gen + ("if((t&7)===2){") + ("var c2=r.uint32()+r.pos") + ("while(r.pos { + +"use strict"; + +module.exports = encoder; + +var Enum = __nccwpck_require__(73528), + types = __nccwpck_require__(21024), + util = __nccwpck_require__(39609); + +/** + * Generates a partial message type encoder. + * @param {Codegen} gen Codegen instance + * @param {Field} field Reflected field + * @param {number} fieldIndex Field index + * @param {string} ref Variable reference + * @returns {Codegen} Codegen instance + * @ignore + */ +function genTypePartial(gen, field, fieldIndex, ref) { + return field.delimited + ? gen("types[%i].encode(%s,w.uint32(%i)).uint32(%i)", fieldIndex, ref, (field.id << 3 | 3) >>> 0, (field.id << 3 | 4) >>> 0) + : gen("types[%i].encode(%s,w.uint32(%i).fork()).ldelim()", fieldIndex, ref, (field.id << 3 | 2) >>> 0); +} + +/** + * Generates an encoder specific to the specified message type. + * @param {Type} mtype Message type + * @returns {Codegen} Codegen instance + */ +function encoder(mtype) { + /* eslint-disable no-unexpected-multiline, block-scoped-var, no-redeclare */ + var gen = util.codegen(["m", "w"], mtype.name + "$encode") + ("if(!w)") + ("w=Writer.create()"); + + var i, ref; + + // "when a message is serialized its known fields should be written sequentially by field number" + var fields = /* initializes */ mtype.fieldsArray.slice().sort(util.compareFieldsById); + + for (var i = 0; i < fields.length; ++i) { + var field = fields[i].resolve(), + index = mtype._fieldsArray.indexOf(field), + type = field.resolvedType instanceof Enum ? "int32" : field.type, + wireType = types.basic[type]; + ref = "m" + util.safeProp(field.name); + + // Map fields + if (field.map) { + gen + ("if(%s!=null&&Object.hasOwnProperty.call(m,%j)){", ref, field.name) // !== undefined && !== null + ("for(var ks=Object.keys(%s),i=0;i>> 0, 8 | types.mapKey[field.keyType], field.keyType); + if (wireType === undefined) gen + ("types[%i].encode(%s[ks[i]],w.uint32(18).fork()).ldelim().ldelim()", index, ref); // can't be groups + else gen + (".uint32(%i).%s(%s[ks[i]]).ldelim()", 16 | wireType, type, ref); + gen + ("}") + ("}"); + + // Repeated fields + } else if (field.repeated) { gen + ("if(%s!=null&&%s.length){", ref, ref); // !== undefined && !== null + + // Packed repeated + if (field.packed && types.packed[type] !== undefined) { gen + + ("w.uint32(%i).fork()", (field.id << 3 | 2) >>> 0) + ("for(var i=0;i<%s.length;++i)", ref) + ("w.%s(%s[i])", type, ref) + ("w.ldelim()"); + + // Non-packed + } else { gen + + ("for(var i=0;i<%s.length;++i)", ref); + if (wireType === undefined) + genTypePartial(gen, field, index, ref + "[i]"); + else gen + ("w.uint32(%i).%s(%s[i])", (field.id << 3 | wireType) >>> 0, type, ref); + + } gen + ("}"); + + // Non-repeated + } else { + if (field.optional) gen + ("if(%s!=null&&Object.hasOwnProperty.call(m,%j))", ref, field.name); // !== undefined && !== null + + if (wireType === undefined) + genTypePartial(gen, field, index, ref); + else gen + ("w.uint32(%i).%s(%s)", (field.id << 3 | wireType) >>> 0, type, ref); + + } + } + + return gen + ("return w"); + /* eslint-enable no-unexpected-multiline, block-scoped-var, no-redeclare */ +} + + +/***/ }), + +/***/ 73528: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +module.exports = Enum; + +// extends ReflectionObject +var ReflectionObject = __nccwpck_require__(67946); +((Enum.prototype = Object.create(ReflectionObject.prototype)).constructor = Enum).className = "Enum"; + +var Namespace = __nccwpck_require__(21946), + util = __nccwpck_require__(39609); + +/** + * Constructs a new enum instance. + * @classdesc Reflected enum. + * @extends ReflectionObject + * @constructor + * @param {string} name Unique name within its namespace + * @param {Object.} [values] Enum values as an object, by name + * @param {Object.} [options] Declared options + * @param {string} [comment] The comment for this enum + * @param {Object.} [comments] The value comments for this enum + * @param {Object.>|undefined} [valuesOptions] The value options for this enum + */ +function Enum(name, values, options, comment, comments, valuesOptions) { + ReflectionObject.call(this, name, options); + + if (values && typeof values !== "object") + throw TypeError("values must be an object"); + + /** + * Enum values by id. + * @type {Object.} + */ + this.valuesById = {}; + + /** + * Enum values by name. + * @type {Object.} + */ + this.values = Object.create(this.valuesById); // toJSON, marker + + /** + * Enum comment text. + * @type {string|null} + */ + this.comment = comment; + + /** + * Value comment texts, if any. + * @type {Object.} + */ + this.comments = comments || {}; + + /** + * Values options, if any + * @type {Object>|undefined} + */ + this.valuesOptions = valuesOptions; + + /** + * Resolved values features, if any + * @type {Object>|undefined} + */ + this._valuesFeatures = {}; + + /** + * Reserved ranges, if any. + * @type {Array.} + */ + this.reserved = undefined; // toJSON + + // Note that values inherit valuesById on their prototype which makes them a TypeScript- + // compatible enum. This is used by pbts to write actual enum definitions that work for + // static and reflection code alike instead of emitting generic object definitions. + + if (values) + for (var keys = Object.keys(values), i = 0; i < keys.length; ++i) + if (typeof values[keys[i]] === "number") // use forward entries only + this.valuesById[ this.values[keys[i]] = values[keys[i]] ] = keys[i]; +} + +/** + * @override + */ +Enum.prototype._resolveFeatures = function _resolveFeatures(edition) { + edition = this._edition || edition; + ReflectionObject.prototype._resolveFeatures.call(this, edition); + + Object.keys(this.values).forEach(key => { + var parentFeaturesCopy = Object.assign({}, this._features); + this._valuesFeatures[key] = Object.assign(parentFeaturesCopy, this.valuesOptions && this.valuesOptions[key] && this.valuesOptions[key].features); + }); + + return this; +}; + +/** + * Enum descriptor. + * @interface IEnum + * @property {Object.} values Enum values + * @property {Object.} [options] Enum options + */ + +/** + * Constructs an enum from an enum descriptor. + * @param {string} name Enum name + * @param {IEnum} json Enum descriptor + * @returns {Enum} Created enum + * @throws {TypeError} If arguments are invalid + */ +Enum.fromJSON = function fromJSON(name, json) { + var enm = new Enum(name, json.values, json.options, json.comment, json.comments); + enm.reserved = json.reserved; + if (json.edition) + enm._edition = json.edition; + enm._defaultEdition = "proto3"; // For backwards-compatibility. + return enm; +}; + +/** + * Converts this enum to an enum descriptor. + * @param {IToJSONOptions} [toJSONOptions] JSON conversion options + * @returns {IEnum} Enum descriptor + */ +Enum.prototype.toJSON = function toJSON(toJSONOptions) { + var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; + return util.toObject([ + "edition" , this._editionToJSON(), + "options" , this.options, + "valuesOptions" , this.valuesOptions, + "values" , this.values, + "reserved" , this.reserved && this.reserved.length ? this.reserved : undefined, + "comment" , keepComments ? this.comment : undefined, + "comments" , keepComments ? this.comments : undefined + ]); +}; + +/** + * Adds a value to this enum. + * @param {string} name Value name + * @param {number} id Value id + * @param {string} [comment] Comment, if any + * @param {Object.|undefined} [options] Options, if any + * @returns {Enum} `this` + * @throws {TypeError} If arguments are invalid + * @throws {Error} If there is already a value with this name or id + */ +Enum.prototype.add = function add(name, id, comment, options) { + // utilized by the parser but not by .fromJSON + + if (!util.isString(name)) + throw TypeError("name must be a string"); + + if (!util.isInteger(id)) + throw TypeError("id must be an integer"); + + if (this.values[name] !== undefined) + throw Error("duplicate name '" + name + "' in " + this); + + if (this.isReservedId(id)) + throw Error("id " + id + " is reserved in " + this); + + if (this.isReservedName(name)) + throw Error("name '" + name + "' is reserved in " + this); + + if (this.valuesById[id] !== undefined) { + if (!(this.options && this.options.allow_alias)) + throw Error("duplicate id " + id + " in " + this); + this.values[name] = id; + } else + this.valuesById[this.values[name] = id] = name; + + if (options) { + if (this.valuesOptions === undefined) + this.valuesOptions = {}; + this.valuesOptions[name] = options || null; + } + + this.comments[name] = comment || null; + return this; +}; + +/** + * Removes a value from this enum + * @param {string} name Value name + * @returns {Enum} `this` + * @throws {TypeError} If arguments are invalid + * @throws {Error} If `name` is not a name of this enum + */ +Enum.prototype.remove = function remove(name) { + + if (!util.isString(name)) + throw TypeError("name must be a string"); + + var val = this.values[name]; + if (val == null) + throw Error("name '" + name + "' does not exist in " + this); + + delete this.valuesById[val]; + delete this.values[name]; + delete this.comments[name]; + if (this.valuesOptions) + delete this.valuesOptions[name]; + + return this; +}; + +/** + * Tests if the specified id is reserved. + * @param {number} id Id to test + * @returns {boolean} `true` if reserved, otherwise `false` + */ +Enum.prototype.isReservedId = function isReservedId(id) { + return Namespace.isReservedId(this.reserved, id); +}; + +/** + * Tests if the specified name is reserved. + * @param {string} name Name to test + * @returns {boolean} `true` if reserved, otherwise `false` + */ +Enum.prototype.isReservedName = function isReservedName(name) { + return Namespace.isReservedName(this.reserved, name); +}; + + +/***/ }), + +/***/ 30457: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +module.exports = Field; + +// extends ReflectionObject +var ReflectionObject = __nccwpck_require__(67946); +((Field.prototype = Object.create(ReflectionObject.prototype)).constructor = Field).className = "Field"; + +var Enum = __nccwpck_require__(73528), + types = __nccwpck_require__(21024), + util = __nccwpck_require__(39609); + +var Type; // cyclic + +var ruleRe = /^required|optional|repeated$/; + +/** + * Constructs a new message field instance. Note that {@link MapField|map fields} have their own class. + * @name Field + * @classdesc Reflected message field. + * @extends FieldBase + * @constructor + * @param {string} name Unique name within its namespace + * @param {number} id Unique id within its namespace + * @param {string} type Value type + * @param {string|Object.} [rule="optional"] Field rule + * @param {string|Object.} [extend] Extended type if different from parent + * @param {Object.} [options] Declared options + */ + +/** + * Constructs a field from a field descriptor. + * @param {string} name Field name + * @param {IField} json Field descriptor + * @returns {Field} Created field + * @throws {TypeError} If arguments are invalid + */ +Field.fromJSON = function fromJSON(name, json) { + var field = new Field(name, json.id, json.type, json.rule, json.extend, json.options, json.comment); + if (json.edition) + field._edition = json.edition; + field._defaultEdition = "proto3"; // For backwards-compatibility. + return field; +}; + +/** + * Not an actual constructor. Use {@link Field} instead. + * @classdesc Base class of all reflected message fields. This is not an actual class but here for the sake of having consistent type definitions. + * @exports FieldBase + * @extends ReflectionObject + * @constructor + * @param {string} name Unique name within its namespace + * @param {number} id Unique id within its namespace + * @param {string} type Value type + * @param {string|Object.} [rule="optional"] Field rule + * @param {string|Object.} [extend] Extended type if different from parent + * @param {Object.} [options] Declared options + * @param {string} [comment] Comment associated with this field + */ +function Field(name, id, type, rule, extend, options, comment) { + + if (util.isObject(rule)) { + comment = extend; + options = rule; + rule = extend = undefined; + } else if (util.isObject(extend)) { + comment = options; + options = extend; + extend = undefined; + } + + ReflectionObject.call(this, name, options); + + if (!util.isInteger(id) || id < 0) + throw TypeError("id must be a non-negative integer"); + + if (!util.isString(type)) + throw TypeError("type must be a string"); + + if (rule !== undefined && !ruleRe.test(rule = rule.toString().toLowerCase())) + throw TypeError("rule must be a string rule"); + + if (extend !== undefined && !util.isString(extend)) + throw TypeError("extend must be a string"); + + /** + * Field rule, if any. + * @type {string|undefined} + */ + if (rule === "proto3_optional") { + rule = "optional"; + } + this.rule = rule && rule !== "optional" ? rule : undefined; // toJSON + + /** + * Field type. + * @type {string} + */ + this.type = type; // toJSON + + /** + * Unique field id. + * @type {number} + */ + this.id = id; // toJSON, marker + + /** + * Extended type if different from parent. + * @type {string|undefined} + */ + this.extend = extend || undefined; // toJSON + + /** + * Whether this field is repeated. + * @type {boolean} + */ + this.repeated = rule === "repeated"; + + /** + * Whether this field is a map or not. + * @type {boolean} + */ + this.map = false; + + /** + * Message this field belongs to. + * @type {Type|null} + */ + this.message = null; + + /** + * OneOf this field belongs to, if any, + * @type {OneOf|null} + */ + this.partOf = null; + + /** + * The field type's default value. + * @type {*} + */ + this.typeDefault = null; + + /** + * The field's default value on prototypes. + * @type {*} + */ + this.defaultValue = null; + + /** + * Whether this field's value should be treated as a long. + * @type {boolean} + */ + this.long = util.Long ? types.long[type] !== undefined : /* istanbul ignore next */ false; + + /** + * Whether this field's value is a buffer. + * @type {boolean} + */ + this.bytes = type === "bytes"; + + /** + * Resolved type if not a basic type. + * @type {Type|Enum|null} + */ + this.resolvedType = null; + + /** + * Sister-field within the extended type if a declaring extension field. + * @type {Field|null} + */ + this.extensionField = null; + + /** + * Sister-field within the declaring namespace if an extended field. + * @type {Field|null} + */ + this.declaringField = null; + + /** + * Comment for this field. + * @type {string|null} + */ + this.comment = comment; +} + +/** + * Determines whether this field is required. + * @name Field#required + * @type {boolean} + * @readonly + */ +Object.defineProperty(Field.prototype, "required", { + get: function() { + return this._features.field_presence === "LEGACY_REQUIRED"; + } +}); + +/** + * Determines whether this field is not required. + * @name Field#optional + * @type {boolean} + * @readonly + */ +Object.defineProperty(Field.prototype, "optional", { + get: function() { + return !this.required; + } +}); + +/** + * Determines whether this field uses tag-delimited encoding. In proto2 this + * corresponded to group syntax. + * @name Field#delimited + * @type {boolean} + * @readonly + */ +Object.defineProperty(Field.prototype, "delimited", { + get: function() { + return this.resolvedType instanceof Type && + this._features.message_encoding === "DELIMITED"; + } +}); + +/** + * Determines whether this field is packed. Only relevant when repeated. + * @name Field#packed + * @type {boolean} + * @readonly + */ +Object.defineProperty(Field.prototype, "packed", { + get: function() { + return this._features.repeated_field_encoding === "PACKED"; + } +}); + +/** + * Determines whether this field tracks presence. + * @name Field#hasPresence + * @type {boolean} + * @readonly + */ +Object.defineProperty(Field.prototype, "hasPresence", { + get: function() { + if (this.repeated || this.map) { + return false; + } + return this.partOf || // oneofs + this.declaringField || this.extensionField || // extensions + this._features.field_presence !== "IMPLICIT"; + } +}); + +/** + * @override + */ +Field.prototype.setOption = function setOption(name, value, ifNotSet) { + return ReflectionObject.prototype.setOption.call(this, name, value, ifNotSet); +}; + +/** + * Field descriptor. + * @interface IField + * @property {string} [rule="optional"] Field rule + * @property {string} type Field type + * @property {number} id Field id + * @property {Object.} [options] Field options + */ + +/** + * Extension field descriptor. + * @interface IExtensionField + * @extends IField + * @property {string} extend Extended type + */ + +/** + * Converts this field to a field descriptor. + * @param {IToJSONOptions} [toJSONOptions] JSON conversion options + * @returns {IField} Field descriptor + */ +Field.prototype.toJSON = function toJSON(toJSONOptions) { + var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; + return util.toObject([ + "edition" , this._editionToJSON(), + "rule" , this.rule !== "optional" && this.rule || undefined, + "type" , this.type, + "id" , this.id, + "extend" , this.extend, + "options" , this.options, + "comment" , keepComments ? this.comment : undefined + ]); +}; + +/** + * Resolves this field's type references. + * @returns {Field} `this` + * @throws {Error} If any reference cannot be resolved + */ +Field.prototype.resolve = function resolve() { + + if (this.resolved) + return this; + + if ((this.typeDefault = types.defaults[this.type]) === undefined) { // if not a basic type, resolve it + this.resolvedType = (this.declaringField ? this.declaringField.parent : this.parent).lookupTypeOrEnum(this.type); + if (this.resolvedType instanceof Type) + this.typeDefault = null; + else // instanceof Enum + this.typeDefault = this.resolvedType.values[Object.keys(this.resolvedType.values)[0]]; // first defined + } else if (this.options && this.options.proto3_optional) { + // proto3 scalar value marked optional; should default to null + this.typeDefault = null; + } + + // use explicitly set default value if present + if (this.options && this.options["default"] != null) { + this.typeDefault = this.options["default"]; + if (this.resolvedType instanceof Enum && typeof this.typeDefault === "string") + this.typeDefault = this.resolvedType.values[this.typeDefault]; + } + + // remove unnecessary options + if (this.options) { + if (this.options.packed !== undefined && this.resolvedType && !(this.resolvedType instanceof Enum)) + delete this.options.packed; + if (!Object.keys(this.options).length) + this.options = undefined; + } + + // convert to internal data type if necesssary + if (this.long) { + this.typeDefault = util.Long.fromNumber(this.typeDefault, this.type.charAt(0) === "u"); + + /* istanbul ignore else */ + if (Object.freeze) + Object.freeze(this.typeDefault); // long instances are meant to be immutable anyway (i.e. use small int cache that even requires it) + + } else if (this.bytes && typeof this.typeDefault === "string") { + var buf; + if (util.base64.test(this.typeDefault)) + util.base64.decode(this.typeDefault, buf = util.newBuffer(util.base64.length(this.typeDefault)), 0); + else + util.utf8.write(this.typeDefault, buf = util.newBuffer(util.utf8.length(this.typeDefault)), 0); + this.typeDefault = buf; + } + + // take special care of maps and repeated fields + if (this.map) + this.defaultValue = util.emptyObject; + else if (this.repeated) + this.defaultValue = util.emptyArray; + else + this.defaultValue = this.typeDefault; + + // ensure proper value on prototype + if (this.parent instanceof Type) + this.parent.ctor.prototype[this.name] = this.defaultValue; + + return ReflectionObject.prototype.resolve.call(this); +}; + +/** + * Infers field features from legacy syntax that may have been specified differently. + * in older editions. + * @param {string|undefined} edition The edition this proto is on, or undefined if pre-editions + * @returns {object} The feature values to override + */ +Field.prototype._inferLegacyProtoFeatures = function _inferLegacyProtoFeatures(edition) { + if (edition !== "proto2" && edition !== "proto3") { + return {}; + } + + var features = {}; + + if (this.rule === "required") { + features.field_presence = "LEGACY_REQUIRED"; + } + if (this.parent && types.defaults[this.type] === undefined) { + // We can't use resolvedType because types may not have been resolved yet. However, + // legacy groups are always in the same scope as the field so we don't have to do a + // full scan of the tree. + var type = this.parent.get(this.type.split(".").pop()); + if (type && type instanceof Type && type.group) { + features.message_encoding = "DELIMITED"; + } + } + if (this.getOption("packed") === true) { + features.repeated_field_encoding = "PACKED"; + } else if (this.getOption("packed") === false) { + features.repeated_field_encoding = "EXPANDED"; + } + return features; +}; + +/** + * @override + */ +Field.prototype._resolveFeatures = function _resolveFeatures(edition) { + return ReflectionObject.prototype._resolveFeatures.call(this, this._edition || edition); +}; + +/** + * Decorator function as returned by {@link Field.d} and {@link MapField.d} (TypeScript). + * @typedef FieldDecorator + * @type {function} + * @param {Object} prototype Target prototype + * @param {string} fieldName Field name + * @returns {undefined} + */ + +/** + * Field decorator (TypeScript). + * @name Field.d + * @function + * @param {number} fieldId Field id + * @param {"double"|"float"|"int32"|"uint32"|"sint32"|"fixed32"|"sfixed32"|"int64"|"uint64"|"sint64"|"fixed64"|"sfixed64"|"string"|"bool"|"bytes"|Object} fieldType Field type + * @param {"optional"|"required"|"repeated"} [fieldRule="optional"] Field rule + * @param {T} [defaultValue] Default value + * @returns {FieldDecorator} Decorator function + * @template T extends number | number[] | Long | Long[] | string | string[] | boolean | boolean[] | Uint8Array | Uint8Array[] | Buffer | Buffer[] + */ +Field.d = function decorateField(fieldId, fieldType, fieldRule, defaultValue) { + + // submessage: decorate the submessage and use its name as the type + if (typeof fieldType === "function") + fieldType = util.decorateType(fieldType).name; + + // enum reference: create a reflected copy of the enum and keep reuseing it + else if (fieldType && typeof fieldType === "object") + fieldType = util.decorateEnum(fieldType).name; + + return function fieldDecorator(prototype, fieldName) { + util.decorateType(prototype.constructor) + .add(new Field(fieldName, fieldId, fieldType, fieldRule, { "default": defaultValue })); + }; +}; + +/** + * Field decorator (TypeScript). + * @name Field.d + * @function + * @param {number} fieldId Field id + * @param {Constructor|string} fieldType Field type + * @param {"optional"|"required"|"repeated"} [fieldRule="optional"] Field rule + * @returns {FieldDecorator} Decorator function + * @template T extends Message + * @variation 2 + */ +// like Field.d but without a default value + +// Sets up cyclic dependencies (called in index-light) +Field._configure = function configure(Type_) { + Type = Type_; +}; + + +/***/ }), + +/***/ 35504: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +var protobuf = module.exports = __nccwpck_require__(66579); + +protobuf.build = "light"; + +/** + * A node-style callback as used by {@link load} and {@link Root#load}. + * @typedef LoadCallback + * @type {function} + * @param {Error|null} error Error, if any, otherwise `null` + * @param {Root} [root] Root, if there hasn't been an error + * @returns {undefined} + */ + +/** + * Loads one or multiple .proto or preprocessed .json files into a common root namespace and calls the callback. + * @param {string|string[]} filename One or multiple files to load + * @param {Root} root Root namespace, defaults to create a new one if omitted. + * @param {LoadCallback} callback Callback function + * @returns {undefined} + * @see {@link Root#load} + */ +function load(filename, root, callback) { + if (typeof root === "function") { + callback = root; + root = new protobuf.Root(); + } else if (!root) + root = new protobuf.Root(); + return root.load(filename, callback); +} + +/** + * Loads one or multiple .proto or preprocessed .json files into a common root namespace and calls the callback. + * @name load + * @function + * @param {string|string[]} filename One or multiple files to load + * @param {LoadCallback} callback Callback function + * @returns {undefined} + * @see {@link Root#load} + * @variation 2 + */ +// function load(filename:string, callback:LoadCallback):undefined + +/** + * Loads one or multiple .proto or preprocessed .json files into a common root namespace and returns a promise. + * @name load + * @function + * @param {string|string[]} filename One or multiple files to load + * @param {Root} [root] Root namespace, defaults to create a new one if omitted. + * @returns {Promise} Promise + * @see {@link Root#load} + * @variation 3 + */ +// function load(filename:string, [root:Root]):Promise + +protobuf.load = load; + +/** + * Synchronously loads one or multiple .proto or preprocessed .json files into a common root namespace (node only). + * @param {string|string[]} filename One or multiple files to load + * @param {Root} [root] Root namespace, defaults to create a new one if omitted. + * @returns {Root} Root namespace + * @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid + * @see {@link Root#loadSync} + */ +function loadSync(filename, root) { + if (!root) + root = new protobuf.Root(); + return root.loadSync(filename); +} + +protobuf.loadSync = loadSync; + +// Serialization +protobuf.encoder = __nccwpck_require__(67641); +protobuf.decoder = __nccwpck_require__(45301); +protobuf.verifier = __nccwpck_require__(7639); +protobuf.converter = __nccwpck_require__(92437); + +// Reflection +protobuf.ReflectionObject = __nccwpck_require__(67946); +protobuf.Namespace = __nccwpck_require__(21946); +protobuf.Root = __nccwpck_require__(8185); +protobuf.Enum = __nccwpck_require__(73528); +protobuf.Type = __nccwpck_require__(70901); +protobuf.Field = __nccwpck_require__(30457); +protobuf.OneOf = __nccwpck_require__(84624); +protobuf.MapField = __nccwpck_require__(58791); +protobuf.Service = __nccwpck_require__(30338); +protobuf.Method = __nccwpck_require__(59988); + +// Runtime +protobuf.Message = __nccwpck_require__(69450); +protobuf.wrappers = __nccwpck_require__(59781); + +// Utility +protobuf.types = __nccwpck_require__(21024); +protobuf.util = __nccwpck_require__(39609); + +// Set up possibly cyclic reflection dependencies +protobuf.ReflectionObject._configure(protobuf.Root); +protobuf.Namespace._configure(protobuf.Type, protobuf.Service, protobuf.Enum); +protobuf.Root._configure(protobuf.Type); +protobuf.Field._configure(protobuf.Type); + + +/***/ }), + +/***/ 66579: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +var protobuf = exports; + +/** + * Build type, one of `"full"`, `"light"` or `"minimal"`. + * @name build + * @type {string} + * @const + */ +protobuf.build = "minimal"; + +// Serialization +protobuf.Writer = __nccwpck_require__(33654); +protobuf.BufferWriter = __nccwpck_require__(3751); +protobuf.Reader = __nccwpck_require__(69350); +protobuf.BufferReader = __nccwpck_require__(42423); + +// Utility +protobuf.util = __nccwpck_require__(22857); +protobuf.rpc = __nccwpck_require__(9882); +protobuf.roots = __nccwpck_require__(34460); +protobuf.configure = configure; + +/* istanbul ignore next */ +/** + * Reconfigures the library according to the environment. + * @returns {undefined} + */ +function configure() { + protobuf.util._configure(); + protobuf.Writer._configure(protobuf.BufferWriter); + protobuf.Reader._configure(protobuf.BufferReader); +} + +// Set up buffer utility according to the environment +configure(); + + +/***/ }), + +/***/ 58513: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +var protobuf = module.exports = __nccwpck_require__(35504); + +protobuf.build = "full"; + +// Parser +protobuf.tokenize = __nccwpck_require__(580); +protobuf.parse = __nccwpck_require__(58790); +protobuf.common = __nccwpck_require__(60872); + +// Configure parser +protobuf.Root._configure(protobuf.Type, protobuf.parse, protobuf.common); + + +/***/ }), + +/***/ 58791: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +module.exports = MapField; + +// extends Field +var Field = __nccwpck_require__(30457); +((MapField.prototype = Object.create(Field.prototype)).constructor = MapField).className = "MapField"; + +var types = __nccwpck_require__(21024), + util = __nccwpck_require__(39609); + +/** + * Constructs a new map field instance. + * @classdesc Reflected map field. + * @extends FieldBase + * @constructor + * @param {string} name Unique name within its namespace + * @param {number} id Unique id within its namespace + * @param {string} keyType Key type + * @param {string} type Value type + * @param {Object.} [options] Declared options + * @param {string} [comment] Comment associated with this field + */ +function MapField(name, id, keyType, type, options, comment) { + Field.call(this, name, id, type, undefined, undefined, options, comment); + + /* istanbul ignore if */ + if (!util.isString(keyType)) + throw TypeError("keyType must be a string"); + + /** + * Key type. + * @type {string} + */ + this.keyType = keyType; // toJSON, marker + + /** + * Resolved key type if not a basic type. + * @type {ReflectionObject|null} + */ + this.resolvedKeyType = null; + + // Overrides Field#map + this.map = true; +} + +/** + * Map field descriptor. + * @interface IMapField + * @extends {IField} + * @property {string} keyType Key type + */ + +/** + * Extension map field descriptor. + * @interface IExtensionMapField + * @extends IMapField + * @property {string} extend Extended type + */ + +/** + * Constructs a map field from a map field descriptor. + * @param {string} name Field name + * @param {IMapField} json Map field descriptor + * @returns {MapField} Created map field + * @throws {TypeError} If arguments are invalid + */ +MapField.fromJSON = function fromJSON(name, json) { + return new MapField(name, json.id, json.keyType, json.type, json.options, json.comment); +}; + +/** + * Converts this map field to a map field descriptor. + * @param {IToJSONOptions} [toJSONOptions] JSON conversion options + * @returns {IMapField} Map field descriptor + */ +MapField.prototype.toJSON = function toJSON(toJSONOptions) { + var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; + return util.toObject([ + "keyType" , this.keyType, + "type" , this.type, + "id" , this.id, + "extend" , this.extend, + "options" , this.options, + "comment" , keepComments ? this.comment : undefined + ]); +}; + +/** + * @override + */ +MapField.prototype.resolve = function resolve() { + if (this.resolved) + return this; + + // Besides a value type, map fields have a key type that may be "any scalar type except for floating point types and bytes" + if (types.mapKey[this.keyType] === undefined) + throw Error("invalid key type: " + this.keyType); + + return Field.prototype.resolve.call(this); +}; + +/** + * Map field decorator (TypeScript). + * @name MapField.d + * @function + * @param {number} fieldId Field id + * @param {"int32"|"uint32"|"sint32"|"fixed32"|"sfixed32"|"int64"|"uint64"|"sint64"|"fixed64"|"sfixed64"|"bool"|"string"} fieldKeyType Field key type + * @param {"double"|"float"|"int32"|"uint32"|"sint32"|"fixed32"|"sfixed32"|"int64"|"uint64"|"sint64"|"fixed64"|"sfixed64"|"bool"|"string"|"bytes"|Object|Constructor<{}>} fieldValueType Field value type + * @returns {FieldDecorator} Decorator function + * @template T extends { [key: string]: number | Long | string | boolean | Uint8Array | Buffer | number[] | Message<{}> } + */ +MapField.d = function decorateMapField(fieldId, fieldKeyType, fieldValueType) { + + // submessage value: decorate the submessage and use its name as the type + if (typeof fieldValueType === "function") + fieldValueType = util.decorateType(fieldValueType).name; + + // enum reference value: create a reflected copy of the enum and keep reuseing it + else if (fieldValueType && typeof fieldValueType === "object") + fieldValueType = util.decorateEnum(fieldValueType).name; + + return function mapFieldDecorator(prototype, fieldName) { + util.decorateType(prototype.constructor) + .add(new MapField(fieldName, fieldId, fieldKeyType, fieldValueType)); + }; +}; + + +/***/ }), + +/***/ 69450: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +module.exports = Message; + +var util = __nccwpck_require__(22857); + +/** + * Constructs a new message instance. + * @classdesc Abstract runtime message. + * @constructor + * @param {Properties} [properties] Properties to set + * @template T extends object = object + */ +function Message(properties) { + // not used internally + if (properties) + for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i) + this[keys[i]] = properties[keys[i]]; +} + +/** + * Reference to the reflected type. + * @name Message.$type + * @type {Type} + * @readonly + */ + +/** + * Reference to the reflected type. + * @name Message#$type + * @type {Type} + * @readonly + */ + +/*eslint-disable valid-jsdoc*/ + +/** + * Creates a new message of this type using the specified properties. + * @param {Object.} [properties] Properties to set + * @returns {Message} Message instance + * @template T extends Message + * @this Constructor + */ +Message.create = function create(properties) { + return this.$type.create(properties); +}; + +/** + * Encodes a message of this type. + * @param {T|Object.} message Message to encode + * @param {Writer} [writer] Writer to use + * @returns {Writer} Writer + * @template T extends Message + * @this Constructor + */ +Message.encode = function encode(message, writer) { + return this.$type.encode(message, writer); +}; + +/** + * Encodes a message of this type preceeded by its length as a varint. + * @param {T|Object.} message Message to encode + * @param {Writer} [writer] Writer to use + * @returns {Writer} Writer + * @template T extends Message + * @this Constructor + */ +Message.encodeDelimited = function encodeDelimited(message, writer) { + return this.$type.encodeDelimited(message, writer); +}; + +/** + * Decodes a message of this type. + * @name Message.decode + * @function + * @param {Reader|Uint8Array} reader Reader or buffer to decode + * @returns {T} Decoded message + * @template T extends Message + * @this Constructor + */ +Message.decode = function decode(reader) { + return this.$type.decode(reader); +}; + +/** + * Decodes a message of this type preceeded by its length as a varint. + * @name Message.decodeDelimited + * @function + * @param {Reader|Uint8Array} reader Reader or buffer to decode + * @returns {T} Decoded message + * @template T extends Message + * @this Constructor + */ +Message.decodeDelimited = function decodeDelimited(reader) { + return this.$type.decodeDelimited(reader); +}; + +/** + * Verifies a message of this type. + * @name Message.verify + * @function + * @param {Object.} message Plain object to verify + * @returns {string|null} `null` if valid, otherwise the reason why it is not + */ +Message.verify = function verify(message) { + return this.$type.verify(message); +}; + +/** + * Creates a new message of this type from a plain object. Also converts values to their respective internal types. + * @param {Object.} object Plain object + * @returns {T} Message instance + * @template T extends Message + * @this Constructor + */ +Message.fromObject = function fromObject(object) { + return this.$type.fromObject(object); +}; + +/** + * Creates a plain object from a message of this type. Also converts values to other types if specified. + * @param {T} message Message instance + * @param {IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + * @template T extends Message + * @this Constructor + */ +Message.toObject = function toObject(message, options) { + return this.$type.toObject(message, options); +}; + +/** + * Converts this message to JSON. + * @returns {Object.} JSON object + */ +Message.prototype.toJSON = function toJSON() { + return this.$type.toObject(this, util.toJSONOptions); +}; + +/*eslint-enable valid-jsdoc*/ + +/***/ }), + +/***/ 59988: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +module.exports = Method; + +// extends ReflectionObject +var ReflectionObject = __nccwpck_require__(67946); +((Method.prototype = Object.create(ReflectionObject.prototype)).constructor = Method).className = "Method"; + +var util = __nccwpck_require__(39609); + +/** + * Constructs a new service method instance. + * @classdesc Reflected service method. + * @extends ReflectionObject + * @constructor + * @param {string} name Method name + * @param {string|undefined} type Method type, usually `"rpc"` + * @param {string} requestType Request message type + * @param {string} responseType Response message type + * @param {boolean|Object.} [requestStream] Whether the request is streamed + * @param {boolean|Object.} [responseStream] Whether the response is streamed + * @param {Object.} [options] Declared options + * @param {string} [comment] The comment for this method + * @param {Object.} [parsedOptions] Declared options, properly parsed into an object + */ +function Method(name, type, requestType, responseType, requestStream, responseStream, options, comment, parsedOptions) { + + /* istanbul ignore next */ + if (util.isObject(requestStream)) { + options = requestStream; + requestStream = responseStream = undefined; + } else if (util.isObject(responseStream)) { + options = responseStream; + responseStream = undefined; + } + + /* istanbul ignore if */ + if (!(type === undefined || util.isString(type))) + throw TypeError("type must be a string"); + + /* istanbul ignore if */ + if (!util.isString(requestType)) + throw TypeError("requestType must be a string"); + + /* istanbul ignore if */ + if (!util.isString(responseType)) + throw TypeError("responseType must be a string"); + + ReflectionObject.call(this, name, options); + + /** + * Method type. + * @type {string} + */ + this.type = type || "rpc"; // toJSON + + /** + * Request type. + * @type {string} + */ + this.requestType = requestType; // toJSON, marker + + /** + * Whether requests are streamed or not. + * @type {boolean|undefined} + */ + this.requestStream = requestStream ? true : undefined; // toJSON + + /** + * Response type. + * @type {string} + */ + this.responseType = responseType; // toJSON + + /** + * Whether responses are streamed or not. + * @type {boolean|undefined} + */ + this.responseStream = responseStream ? true : undefined; // toJSON + + /** + * Resolved request type. + * @type {Type|null} + */ + this.resolvedRequestType = null; + + /** + * Resolved response type. + * @type {Type|null} + */ + this.resolvedResponseType = null; + + /** + * Comment for this method + * @type {string|null} + */ + this.comment = comment; + + /** + * Options properly parsed into an object + */ + this.parsedOptions = parsedOptions; +} + +/** + * Method descriptor. + * @interface IMethod + * @property {string} [type="rpc"] Method type + * @property {string} requestType Request type + * @property {string} responseType Response type + * @property {boolean} [requestStream=false] Whether requests are streamed + * @property {boolean} [responseStream=false] Whether responses are streamed + * @property {Object.} [options] Method options + * @property {string} comment Method comments + * @property {Object.} [parsedOptions] Method options properly parsed into an object + */ + +/** + * Constructs a method from a method descriptor. + * @param {string} name Method name + * @param {IMethod} json Method descriptor + * @returns {Method} Created method + * @throws {TypeError} If arguments are invalid + */ +Method.fromJSON = function fromJSON(name, json) { + return new Method(name, json.type, json.requestType, json.responseType, json.requestStream, json.responseStream, json.options, json.comment, json.parsedOptions); +}; + +/** + * Converts this method to a method descriptor. + * @param {IToJSONOptions} [toJSONOptions] JSON conversion options + * @returns {IMethod} Method descriptor + */ +Method.prototype.toJSON = function toJSON(toJSONOptions) { + var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; + return util.toObject([ + "type" , this.type !== "rpc" && /* istanbul ignore next */ this.type || undefined, + "requestType" , this.requestType, + "requestStream" , this.requestStream, + "responseType" , this.responseType, + "responseStream" , this.responseStream, + "options" , this.options, + "comment" , keepComments ? this.comment : undefined, + "parsedOptions" , this.parsedOptions, + ]); +}; + +/** + * @override + */ +Method.prototype.resolve = function resolve() { + + /* istanbul ignore if */ + if (this.resolved) + return this; + + this.resolvedRequestType = this.parent.lookupType(this.requestType); + this.resolvedResponseType = this.parent.lookupType(this.responseType); + + return ReflectionObject.prototype.resolve.call(this); +}; + + +/***/ }), + +/***/ 21946: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +module.exports = Namespace; + +// extends ReflectionObject +var ReflectionObject = __nccwpck_require__(67946); +((Namespace.prototype = Object.create(ReflectionObject.prototype)).constructor = Namespace).className = "Namespace"; + +var Field = __nccwpck_require__(30457), + util = __nccwpck_require__(39609), + OneOf = __nccwpck_require__(84624); + +var Type, // cyclic + Service, + Enum; + +/** + * Constructs a new namespace instance. + * @name Namespace + * @classdesc Reflected namespace. + * @extends NamespaceBase + * @constructor + * @param {string} name Namespace name + * @param {Object.} [options] Declared options + */ + +/** + * Constructs a namespace from JSON. + * @memberof Namespace + * @function + * @param {string} name Namespace name + * @param {Object.} json JSON object + * @returns {Namespace} Created namespace + * @throws {TypeError} If arguments are invalid + */ +Namespace.fromJSON = function fromJSON(name, json) { + return new Namespace(name, json.options).addJSON(json.nested); +}; + +/** + * Converts an array of reflection objects to JSON. + * @memberof Namespace + * @param {ReflectionObject[]} array Object array + * @param {IToJSONOptions} [toJSONOptions] JSON conversion options + * @returns {Object.|undefined} JSON object or `undefined` when array is empty + */ +function arrayToJSON(array, toJSONOptions) { + if (!(array && array.length)) + return undefined; + var obj = {}; + for (var i = 0; i < array.length; ++i) + obj[array[i].name] = array[i].toJSON(toJSONOptions); + return obj; +} + +Namespace.arrayToJSON = arrayToJSON; + +/** + * Tests if the specified id is reserved. + * @param {Array.|undefined} reserved Array of reserved ranges and names + * @param {number} id Id to test + * @returns {boolean} `true` if reserved, otherwise `false` + */ +Namespace.isReservedId = function isReservedId(reserved, id) { + if (reserved) + for (var i = 0; i < reserved.length; ++i) + if (typeof reserved[i] !== "string" && reserved[i][0] <= id && reserved[i][1] > id) + return true; + return false; +}; + +/** + * Tests if the specified name is reserved. + * @param {Array.|undefined} reserved Array of reserved ranges and names + * @param {string} name Name to test + * @returns {boolean} `true` if reserved, otherwise `false` + */ +Namespace.isReservedName = function isReservedName(reserved, name) { + if (reserved) + for (var i = 0; i < reserved.length; ++i) + if (reserved[i] === name) + return true; + return false; +}; + +/** + * Not an actual constructor. Use {@link Namespace} instead. + * @classdesc Base class of all reflection objects containing nested objects. This is not an actual class but here for the sake of having consistent type definitions. + * @exports NamespaceBase + * @extends ReflectionObject + * @abstract + * @constructor + * @param {string} name Namespace name + * @param {Object.} [options] Declared options + * @see {@link Namespace} + */ +function Namespace(name, options) { + ReflectionObject.call(this, name, options); + + /** + * Nested objects by name. + * @type {Object.|undefined} + */ + this.nested = undefined; // toJSON + + /** + * Cached nested objects as an array. + * @type {ReflectionObject[]|null} + * @private + */ + this._nestedArray = null; + + /** + * Cache lookup calls for any objects contains anywhere under this namespace. + * This drastically speeds up resolve for large cross-linked protos where the same + * types are looked up repeatedly. + * @type {Object.} + * @private + */ + this._lookupCache = {}; + + /** + * Whether or not objects contained in this namespace need feature resolution. + * @type {boolean} + * @protected + */ + this._needsRecursiveFeatureResolution = true; + + /** + * Whether or not objects contained in this namespace need a resolve. + * @type {boolean} + * @protected + */ + this._needsRecursiveResolve = true; +} + +function clearCache(namespace) { + namespace._nestedArray = null; + namespace._lookupCache = {}; + + // Also clear parent caches, since they include nested lookups. + var parent = namespace; + while(parent = parent.parent) { + parent._lookupCache = {}; + } + return namespace; +} + +/** + * Nested objects of this namespace as an array for iteration. + * @name NamespaceBase#nestedArray + * @type {ReflectionObject[]} + * @readonly + */ +Object.defineProperty(Namespace.prototype, "nestedArray", { + get: function() { + return this._nestedArray || (this._nestedArray = util.toArray(this.nested)); + } +}); + +/** + * Namespace descriptor. + * @interface INamespace + * @property {Object.} [options] Namespace options + * @property {Object.} [nested] Nested object descriptors + */ + +/** + * Any extension field descriptor. + * @typedef AnyExtensionField + * @type {IExtensionField|IExtensionMapField} + */ + +/** + * Any nested object descriptor. + * @typedef AnyNestedObject + * @type {IEnum|IType|IService|AnyExtensionField|INamespace|IOneOf} + */ + +/** + * Converts this namespace to a namespace descriptor. + * @param {IToJSONOptions} [toJSONOptions] JSON conversion options + * @returns {INamespace} Namespace descriptor + */ +Namespace.prototype.toJSON = function toJSON(toJSONOptions) { + return util.toObject([ + "options" , this.options, + "nested" , arrayToJSON(this.nestedArray, toJSONOptions) + ]); +}; + +/** + * Adds nested objects to this namespace from nested object descriptors. + * @param {Object.} nestedJson Any nested object descriptors + * @returns {Namespace} `this` + */ +Namespace.prototype.addJSON = function addJSON(nestedJson) { + var ns = this; + /* istanbul ignore else */ + if (nestedJson) { + for (var names = Object.keys(nestedJson), i = 0, nested; i < names.length; ++i) { + nested = nestedJson[names[i]]; + ns.add( // most to least likely + ( nested.fields !== undefined + ? Type.fromJSON + : nested.values !== undefined + ? Enum.fromJSON + : nested.methods !== undefined + ? Service.fromJSON + : nested.id !== undefined + ? Field.fromJSON + : Namespace.fromJSON )(names[i], nested) + ); + } + } + return this; +}; + +/** + * Gets the nested object of the specified name. + * @param {string} name Nested object name + * @returns {ReflectionObject|null} The reflection object or `null` if it doesn't exist + */ +Namespace.prototype.get = function get(name) { + return this.nested && this.nested[name] + || null; +}; + +/** + * Gets the values of the nested {@link Enum|enum} of the specified name. + * This methods differs from {@link Namespace#get|get} in that it returns an enum's values directly and throws instead of returning `null`. + * @param {string} name Nested enum name + * @returns {Object.} Enum values + * @throws {Error} If there is no such enum + */ +Namespace.prototype.getEnum = function getEnum(name) { + if (this.nested && this.nested[name] instanceof Enum) + return this.nested[name].values; + throw Error("no such enum: " + name); +}; + +/** + * Adds a nested object to this namespace. + * @param {ReflectionObject} object Nested object to add + * @returns {Namespace} `this` + * @throws {TypeError} If arguments are invalid + * @throws {Error} If there is already a nested object with this name + */ +Namespace.prototype.add = function add(object) { + + if (!(object instanceof Field && object.extend !== undefined || object instanceof Type || object instanceof OneOf || object instanceof Enum || object instanceof Service || object instanceof Namespace)) + throw TypeError("object must be a valid nested object"); + + if (!this.nested) + this.nested = {}; + else { + var prev = this.get(object.name); + if (prev) { + if (prev instanceof Namespace && object instanceof Namespace && !(prev instanceof Type || prev instanceof Service)) { + // replace plain namespace but keep existing nested elements and options + var nested = prev.nestedArray; + for (var i = 0; i < nested.length; ++i) + object.add(nested[i]); + this.remove(prev); + if (!this.nested) + this.nested = {}; + object.setOptions(prev.options, true); + + } else + throw Error("duplicate name '" + object.name + "' in " + this); + } + } + this.nested[object.name] = object; + + if (!(this instanceof Type || this instanceof Service || this instanceof Enum || this instanceof Field)) { + // This is a package or a root namespace. + if (!object._edition) { + // Make sure that some edition is set if it hasn't already been specified. + object._edition = object._defaultEdition; + } + } + + this._needsRecursiveFeatureResolution = true; + this._needsRecursiveResolve = true; + + // Also clear parent caches, since they need to recurse down. + var parent = this; + while(parent = parent.parent) { + parent._needsRecursiveFeatureResolution = true; + parent._needsRecursiveResolve = true; + } + + object.onAdd(this); + return clearCache(this); +}; + +/** + * Removes a nested object from this namespace. + * @param {ReflectionObject} object Nested object to remove + * @returns {Namespace} `this` + * @throws {TypeError} If arguments are invalid + * @throws {Error} If `object` is not a member of this namespace + */ +Namespace.prototype.remove = function remove(object) { + + if (!(object instanceof ReflectionObject)) + throw TypeError("object must be a ReflectionObject"); + if (object.parent !== this) + throw Error(object + " is not a member of " + this); + + delete this.nested[object.name]; + if (!Object.keys(this.nested).length) + this.nested = undefined; + + object.onRemove(this); + return clearCache(this); +}; + +/** + * Defines additial namespaces within this one if not yet existing. + * @param {string|string[]} path Path to create + * @param {*} [json] Nested types to create from JSON + * @returns {Namespace} Pointer to the last namespace created or `this` if path is empty + */ +Namespace.prototype.define = function define(path, json) { + + if (util.isString(path)) + path = path.split("."); + else if (!Array.isArray(path)) + throw TypeError("illegal path"); + if (path && path.length && path[0] === "") + throw Error("path must be relative"); + + var ptr = this; + while (path.length > 0) { + var part = path.shift(); + if (ptr.nested && ptr.nested[part]) { + ptr = ptr.nested[part]; + if (!(ptr instanceof Namespace)) + throw Error("path conflicts with non-namespace objects"); + } else + ptr.add(ptr = new Namespace(part)); + } + if (json) + ptr.addJSON(json); + return ptr; +}; + +/** + * Resolves this namespace's and all its nested objects' type references. Useful to validate a reflection tree, but comes at a cost. + * @returns {Namespace} `this` + */ +Namespace.prototype.resolveAll = function resolveAll() { + if (!this._needsRecursiveResolve) return this; + + this._resolveFeaturesRecursive(this._edition); + + var nested = this.nestedArray, i = 0; + this.resolve(); + while (i < nested.length) + if (nested[i] instanceof Namespace) + nested[i++].resolveAll(); + else + nested[i++].resolve(); + this._needsRecursiveResolve = false; + return this; +}; + +/** + * @override + */ +Namespace.prototype._resolveFeaturesRecursive = function _resolveFeaturesRecursive(edition) { + if (!this._needsRecursiveFeatureResolution) return this; + this._needsRecursiveFeatureResolution = false; + + edition = this._edition || edition; + + ReflectionObject.prototype._resolveFeaturesRecursive.call(this, edition); + this.nestedArray.forEach(nested => { + nested._resolveFeaturesRecursive(edition); + }); + return this; +}; + +/** + * Recursively looks up the reflection object matching the specified path in the scope of this namespace. + * @param {string|string[]} path Path to look up + * @param {*|Array.<*>} filterTypes Filter types, any combination of the constructors of `protobuf.Type`, `protobuf.Enum`, `protobuf.Service` etc. + * @param {boolean} [parentAlreadyChecked=false] If known, whether the parent has already been checked + * @returns {ReflectionObject|null} Looked up object or `null` if none could be found + */ +Namespace.prototype.lookup = function lookup(path, filterTypes, parentAlreadyChecked) { + /* istanbul ignore next */ + if (typeof filterTypes === "boolean") { + parentAlreadyChecked = filterTypes; + filterTypes = undefined; + } else if (filterTypes && !Array.isArray(filterTypes)) + filterTypes = [ filterTypes ]; + + if (util.isString(path) && path.length) { + if (path === ".") + return this.root; + path = path.split("."); + } else if (!path.length) + return this; + + var flatPath = path.join("."); + + // Start at root if path is absolute + if (path[0] === "") + return this.root.lookup(path.slice(1), filterTypes); + + // Early bailout for objects with matching absolute paths + var found = this.root._fullyQualifiedObjects && this.root._fullyQualifiedObjects["." + flatPath]; + if (found && (!filterTypes || filterTypes.indexOf(found.constructor) > -1)) { + return found; + } + + // Do a regular lookup at this namespace and below + found = this._lookupImpl(path, flatPath); + if (found && (!filterTypes || filterTypes.indexOf(found.constructor) > -1)) { + return found; + } + + if (parentAlreadyChecked) + return null; + + // If there hasn't been a match, walk up the tree and look more broadly + var current = this; + while (current.parent) { + found = current.parent._lookupImpl(path, flatPath); + if (found && (!filterTypes || filterTypes.indexOf(found.constructor) > -1)) { + return found; + } + current = current.parent; + } + return null; +}; + +/** + * Internal helper for lookup that handles searching just at this namespace and below along with caching. + * @param {string[]} path Path to look up + * @param {string} flatPath Flattened version of the path to use as a cache key + * @returns {ReflectionObject|null} Looked up object or `null` if none could be found + * @private + */ +Namespace.prototype._lookupImpl = function lookup(path, flatPath) { + if(Object.prototype.hasOwnProperty.call(this._lookupCache, flatPath)) { + return this._lookupCache[flatPath]; + } + + // Test if the first part matches any nested object, and if so, traverse if path contains more + var found = this.get(path[0]); + var exact = null; + if (found) { + if (path.length === 1) { + exact = found; + } else if (found instanceof Namespace) { + path = path.slice(1); + exact = found._lookupImpl(path, path.join(".")); + } + + // Otherwise try each nested namespace + } else { + for (var i = 0; i < this.nestedArray.length; ++i) + if (this._nestedArray[i] instanceof Namespace && (found = this._nestedArray[i]._lookupImpl(path, flatPath))) + exact = found; + } + + // Set this even when null, so that when we walk up the tree we can quickly bail on repeated checks back down. + this._lookupCache[flatPath] = exact; + return exact; +}; + +/** + * Looks up the reflection object at the specified path, relative to this namespace. + * @name NamespaceBase#lookup + * @function + * @param {string|string[]} path Path to look up + * @param {boolean} [parentAlreadyChecked=false] Whether the parent has already been checked + * @returns {ReflectionObject|null} Looked up object or `null` if none could be found + * @variation 2 + */ +// lookup(path: string, [parentAlreadyChecked: boolean]) + +/** + * Looks up the {@link Type|type} at the specified path, relative to this namespace. + * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`. + * @param {string|string[]} path Path to look up + * @returns {Type} Looked up type + * @throws {Error} If `path` does not point to a type + */ +Namespace.prototype.lookupType = function lookupType(path) { + var found = this.lookup(path, [ Type ]); + if (!found) + throw Error("no such type: " + path); + return found; +}; + +/** + * Looks up the values of the {@link Enum|enum} at the specified path, relative to this namespace. + * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`. + * @param {string|string[]} path Path to look up + * @returns {Enum} Looked up enum + * @throws {Error} If `path` does not point to an enum + */ +Namespace.prototype.lookupEnum = function lookupEnum(path) { + var found = this.lookup(path, [ Enum ]); + if (!found) + throw Error("no such Enum '" + path + "' in " + this); + return found; +}; + +/** + * Looks up the {@link Type|type} or {@link Enum|enum} at the specified path, relative to this namespace. + * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`. + * @param {string|string[]} path Path to look up + * @returns {Type} Looked up type or enum + * @throws {Error} If `path` does not point to a type or enum + */ +Namespace.prototype.lookupTypeOrEnum = function lookupTypeOrEnum(path) { + var found = this.lookup(path, [ Type, Enum ]); + if (!found) + throw Error("no such Type or Enum '" + path + "' in " + this); + return found; +}; + +/** + * Looks up the {@link Service|service} at the specified path, relative to this namespace. + * Besides its signature, this methods differs from {@link Namespace#lookup|lookup} in that it throws instead of returning `null`. + * @param {string|string[]} path Path to look up + * @returns {Service} Looked up service + * @throws {Error} If `path` does not point to a service + */ +Namespace.prototype.lookupService = function lookupService(path) { + var found = this.lookup(path, [ Service ]); + if (!found) + throw Error("no such Service '" + path + "' in " + this); + return found; +}; + +// Sets up cyclic dependencies (called in index-light) +Namespace._configure = function(Type_, Service_, Enum_) { + Type = Type_; + Service = Service_; + Enum = Enum_; +}; + + +/***/ }), + +/***/ 67946: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +module.exports = ReflectionObject; + +ReflectionObject.className = "ReflectionObject"; + +const OneOf = __nccwpck_require__(84624); +var util = __nccwpck_require__(39609); + +var Root; // cyclic + +/* eslint-disable no-warning-comments */ +// TODO: Replace with embedded proto. +var editions2023Defaults = {enum_type: "OPEN", field_presence: "EXPLICIT", json_format: "ALLOW", message_encoding: "LENGTH_PREFIXED", repeated_field_encoding: "PACKED", utf8_validation: "VERIFY"}; +var proto2Defaults = {enum_type: "CLOSED", field_presence: "EXPLICIT", json_format: "LEGACY_BEST_EFFORT", message_encoding: "LENGTH_PREFIXED", repeated_field_encoding: "EXPANDED", utf8_validation: "NONE"}; +var proto3Defaults = {enum_type: "OPEN", field_presence: "IMPLICIT", json_format: "ALLOW", message_encoding: "LENGTH_PREFIXED", repeated_field_encoding: "PACKED", utf8_validation: "VERIFY"}; + +/** + * Constructs a new reflection object instance. + * @classdesc Base class of all reflection objects. + * @constructor + * @param {string} name Object name + * @param {Object.} [options] Declared options + * @abstract + */ +function ReflectionObject(name, options) { + + if (!util.isString(name)) + throw TypeError("name must be a string"); + + if (options && !util.isObject(options)) + throw TypeError("options must be an object"); + + /** + * Options. + * @type {Object.|undefined} + */ + this.options = options; // toJSON + + /** + * Parsed Options. + * @type {Array.>|undefined} + */ + this.parsedOptions = null; + + /** + * Unique name within its namespace. + * @type {string} + */ + this.name = name; + + /** + * The edition specified for this object. Only relevant for top-level objects. + * @type {string} + * @private + */ + this._edition = null; + + /** + * The default edition to use for this object if none is specified. For legacy reasons, + * this is proto2 except in the JSON parsing case where it was proto3. + * @type {string} + * @private + */ + this._defaultEdition = "proto2"; + + /** + * Resolved Features. + * @type {object} + * @private + */ + this._features = {}; + + /** + * Whether or not features have been resolved. + * @type {boolean} + * @private + */ + this._featuresResolved = false; + + /** + * Parent namespace. + * @type {Namespace|null} + */ + this.parent = null; + + /** + * Whether already resolved or not. + * @type {boolean} + */ + this.resolved = false; + + /** + * Comment text, if any. + * @type {string|null} + */ + this.comment = null; + + /** + * Defining file name. + * @type {string|null} + */ + this.filename = null; +} + +Object.defineProperties(ReflectionObject.prototype, { + + /** + * Reference to the root namespace. + * @name ReflectionObject#root + * @type {Root} + * @readonly + */ + root: { + get: function() { + var ptr = this; + while (ptr.parent !== null) + ptr = ptr.parent; + return ptr; + } + }, + + /** + * Full name including leading dot. + * @name ReflectionObject#fullName + * @type {string} + * @readonly + */ + fullName: { + get: function() { + var path = [ this.name ], + ptr = this.parent; + while (ptr) { + path.unshift(ptr.name); + ptr = ptr.parent; + } + return path.join("."); + } + } +}); + +/** + * Converts this reflection object to its descriptor representation. + * @returns {Object.} Descriptor + * @abstract + */ +ReflectionObject.prototype.toJSON = /* istanbul ignore next */ function toJSON() { + throw Error(); // not implemented, shouldn't happen +}; + +/** + * Called when this object is added to a parent. + * @param {ReflectionObject} parent Parent added to + * @returns {undefined} + */ +ReflectionObject.prototype.onAdd = function onAdd(parent) { + if (this.parent && this.parent !== parent) + this.parent.remove(this); + this.parent = parent; + this.resolved = false; + var root = parent.root; + if (root instanceof Root) + root._handleAdd(this); +}; + +/** + * Called when this object is removed from a parent. + * @param {ReflectionObject} parent Parent removed from + * @returns {undefined} + */ +ReflectionObject.prototype.onRemove = function onRemove(parent) { + var root = parent.root; + if (root instanceof Root) + root._handleRemove(this); + this.parent = null; + this.resolved = false; +}; + +/** + * Resolves this objects type references. + * @returns {ReflectionObject} `this` + */ +ReflectionObject.prototype.resolve = function resolve() { + if (this.resolved) + return this; + if (this.root instanceof Root) + this.resolved = true; // only if part of a root + return this; +}; + +/** + * Resolves this objects editions features. + * @param {string} edition The edition we're currently resolving for. + * @returns {ReflectionObject} `this` + */ +ReflectionObject.prototype._resolveFeaturesRecursive = function _resolveFeaturesRecursive(edition) { + return this._resolveFeatures(this._edition || edition); +}; + +/** + * Resolves child features from parent features + * @param {string} edition The edition we're currently resolving for. + * @returns {undefined} + */ +ReflectionObject.prototype._resolveFeatures = function _resolveFeatures(edition) { + if (this._featuresResolved) { + return; + } + + var defaults = {}; + + /* istanbul ignore if */ + if (!edition) { + throw new Error("Unknown edition for " + this.fullName); + } + + var protoFeatures = Object.assign(this.options ? Object.assign({}, this.options.features) : {}, + this._inferLegacyProtoFeatures(edition)); + + if (this._edition) { + // For a namespace marked with a specific edition, reset defaults. + /* istanbul ignore else */ + if (edition === "proto2") { + defaults = Object.assign({}, proto2Defaults); + } else if (edition === "proto3") { + defaults = Object.assign({}, proto3Defaults); + } else if (edition === "2023") { + defaults = Object.assign({}, editions2023Defaults); + } else { + throw new Error("Unknown edition: " + edition); + } + this._features = Object.assign(defaults, protoFeatures || {}); + this._featuresResolved = true; + return; + } + + // fields in Oneofs aren't actually children of them, so we have to + // special-case it + /* istanbul ignore else */ + if (this.partOf instanceof OneOf) { + var lexicalParentFeaturesCopy = Object.assign({}, this.partOf._features); + this._features = Object.assign(lexicalParentFeaturesCopy, protoFeatures || {}); + } else if (this.declaringField) { + // Skip feature resolution of sister fields. + } else if (this.parent) { + var parentFeaturesCopy = Object.assign({}, this.parent._features); + this._features = Object.assign(parentFeaturesCopy, protoFeatures || {}); + } else { + throw new Error("Unable to find a parent for " + this.fullName); + } + if (this.extensionField) { + // Sister fields should have the same features as their extensions. + this.extensionField._features = this._features; + } + this._featuresResolved = true; +}; + +/** + * Infers features from legacy syntax that may have been specified differently. + * in older editions. + * @param {string|undefined} edition The edition this proto is on, or undefined if pre-editions + * @returns {object} The feature values to override + */ +ReflectionObject.prototype._inferLegacyProtoFeatures = function _inferLegacyProtoFeatures(/*edition*/) { + return {}; +}; + +/** + * Gets an option value. + * @param {string} name Option name + * @returns {*} Option value or `undefined` if not set + */ +ReflectionObject.prototype.getOption = function getOption(name) { + if (this.options) + return this.options[name]; + return undefined; +}; + +/** + * Sets an option. + * @param {string} name Option name + * @param {*} value Option value + * @param {boolean|undefined} [ifNotSet] Sets the option only if it isn't currently set + * @returns {ReflectionObject} `this` + */ +ReflectionObject.prototype.setOption = function setOption(name, value, ifNotSet) { + if (!this.options) + this.options = {}; + if (/^features\./.test(name)) { + util.setProperty(this.options, name, value, ifNotSet); + } else if (!ifNotSet || this.options[name] === undefined) { + if (this.getOption(name) !== value) this.resolved = false; + this.options[name] = value; + } + + return this; +}; + +/** + * Sets a parsed option. + * @param {string} name parsed Option name + * @param {*} value Option value + * @param {string} propName dot '.' delimited full path of property within the option to set. if undefined\empty, will add a new option with that value + * @returns {ReflectionObject} `this` + */ +ReflectionObject.prototype.setParsedOption = function setParsedOption(name, value, propName) { + if (!this.parsedOptions) { + this.parsedOptions = []; + } + var parsedOptions = this.parsedOptions; + if (propName) { + // If setting a sub property of an option then try to merge it + // with an existing option + var opt = parsedOptions.find(function (opt) { + return Object.prototype.hasOwnProperty.call(opt, name); + }); + if (opt) { + // If we found an existing option - just merge the property value + // (If it's a feature, will just write over) + var newValue = opt[name]; + util.setProperty(newValue, propName, value); + } else { + // otherwise, create a new option, set its property and add it to the list + opt = {}; + opt[name] = util.setProperty({}, propName, value); + parsedOptions.push(opt); + } + } else { + // Always create a new option when setting the value of the option itself + var newOpt = {}; + newOpt[name] = value; + parsedOptions.push(newOpt); + } + + return this; +}; + +/** + * Sets multiple options. + * @param {Object.} options Options to set + * @param {boolean} [ifNotSet] Sets an option only if it isn't currently set + * @returns {ReflectionObject} `this` + */ +ReflectionObject.prototype.setOptions = function setOptions(options, ifNotSet) { + if (options) + for (var keys = Object.keys(options), i = 0; i < keys.length; ++i) + this.setOption(keys[i], options[keys[i]], ifNotSet); + return this; +}; + +/** + * Converts this instance to its string representation. + * @returns {string} Class name[, space, full name] + */ +ReflectionObject.prototype.toString = function toString() { + var className = this.constructor.className, + fullName = this.fullName; + if (fullName.length) + return className + " " + fullName; + return className; +}; + +/** + * Converts the edition this object is pinned to for JSON format. + * @returns {string|undefined} The edition string for JSON representation + */ +ReflectionObject.prototype._editionToJSON = function _editionToJSON() { + if (!this._edition || this._edition === "proto3") { + // Avoid emitting proto3 since we need to default to it for backwards + // compatibility anyway. + return undefined; + } + return this._edition; +}; + +// Sets up cyclic dependencies (called in index-light) +ReflectionObject._configure = function(Root_) { + Root = Root_; +}; + + +/***/ }), + +/***/ 84624: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +module.exports = OneOf; + +// extends ReflectionObject +var ReflectionObject = __nccwpck_require__(67946); +((OneOf.prototype = Object.create(ReflectionObject.prototype)).constructor = OneOf).className = "OneOf"; + +var Field = __nccwpck_require__(30457), + util = __nccwpck_require__(39609); + +/** + * Constructs a new oneof instance. + * @classdesc Reflected oneof. + * @extends ReflectionObject + * @constructor + * @param {string} name Oneof name + * @param {string[]|Object.} [fieldNames] Field names + * @param {Object.} [options] Declared options + * @param {string} [comment] Comment associated with this field + */ +function OneOf(name, fieldNames, options, comment) { + if (!Array.isArray(fieldNames)) { + options = fieldNames; + fieldNames = undefined; + } + ReflectionObject.call(this, name, options); + + /* istanbul ignore if */ + if (!(fieldNames === undefined || Array.isArray(fieldNames))) + throw TypeError("fieldNames must be an Array"); + + /** + * Field names that belong to this oneof. + * @type {string[]} + */ + this.oneof = fieldNames || []; // toJSON, marker + + /** + * Fields that belong to this oneof as an array for iteration. + * @type {Field[]} + * @readonly + */ + this.fieldsArray = []; // declared readonly for conformance, possibly not yet added to parent + + /** + * Comment for this field. + * @type {string|null} + */ + this.comment = comment; +} + +/** + * Oneof descriptor. + * @interface IOneOf + * @property {Array.} oneof Oneof field names + * @property {Object.} [options] Oneof options + */ + +/** + * Constructs a oneof from a oneof descriptor. + * @param {string} name Oneof name + * @param {IOneOf} json Oneof descriptor + * @returns {OneOf} Created oneof + * @throws {TypeError} If arguments are invalid + */ +OneOf.fromJSON = function fromJSON(name, json) { + return new OneOf(name, json.oneof, json.options, json.comment); +}; + +/** + * Converts this oneof to a oneof descriptor. + * @param {IToJSONOptions} [toJSONOptions] JSON conversion options + * @returns {IOneOf} Oneof descriptor + */ +OneOf.prototype.toJSON = function toJSON(toJSONOptions) { + var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; + return util.toObject([ + "options" , this.options, + "oneof" , this.oneof, + "comment" , keepComments ? this.comment : undefined + ]); +}; + +/** + * Adds the fields of the specified oneof to the parent if not already done so. + * @param {OneOf} oneof The oneof + * @returns {undefined} + * @inner + * @ignore + */ +function addFieldsToParent(oneof) { + if (oneof.parent) + for (var i = 0; i < oneof.fieldsArray.length; ++i) + if (!oneof.fieldsArray[i].parent) + oneof.parent.add(oneof.fieldsArray[i]); +} + +/** + * Adds a field to this oneof and removes it from its current parent, if any. + * @param {Field} field Field to add + * @returns {OneOf} `this` + */ +OneOf.prototype.add = function add(field) { + + /* istanbul ignore if */ + if (!(field instanceof Field)) + throw TypeError("field must be a Field"); + + if (field.parent && field.parent !== this.parent) + field.parent.remove(field); + this.oneof.push(field.name); + this.fieldsArray.push(field); + field.partOf = this; // field.parent remains null + addFieldsToParent(this); + return this; +}; + +/** + * Removes a field from this oneof and puts it back to the oneof's parent. + * @param {Field} field Field to remove + * @returns {OneOf} `this` + */ +OneOf.prototype.remove = function remove(field) { + + /* istanbul ignore if */ + if (!(field instanceof Field)) + throw TypeError("field must be a Field"); + + var index = this.fieldsArray.indexOf(field); + + /* istanbul ignore if */ + if (index < 0) + throw Error(field + " is not a member of " + this); + + this.fieldsArray.splice(index, 1); + index = this.oneof.indexOf(field.name); + + /* istanbul ignore else */ + if (index > -1) // theoretical + this.oneof.splice(index, 1); + + field.partOf = null; + return this; +}; + +/** + * @override + */ +OneOf.prototype.onAdd = function onAdd(parent) { + ReflectionObject.prototype.onAdd.call(this, parent); + var self = this; + // Collect present fields + for (var i = 0; i < this.oneof.length; ++i) { + var field = parent.get(this.oneof[i]); + if (field && !field.partOf) { + field.partOf = self; + self.fieldsArray.push(field); + } + } + // Add not yet present fields + addFieldsToParent(this); +}; + +/** + * @override + */ +OneOf.prototype.onRemove = function onRemove(parent) { + for (var i = 0, field; i < this.fieldsArray.length; ++i) + if ((field = this.fieldsArray[i]).parent) + field.parent.remove(field); + ReflectionObject.prototype.onRemove.call(this, parent); +}; + +/** + * Determines whether this field corresponds to a synthetic oneof created for + * a proto3 optional field. No behavioral logic should depend on this, but it + * can be relevant for reflection. + * @name OneOf#isProto3Optional + * @type {boolean} + * @readonly + */ +Object.defineProperty(OneOf.prototype, "isProto3Optional", { + get: function() { + if (this.fieldsArray == null || this.fieldsArray.length !== 1) { + return false; + } + + var field = this.fieldsArray[0]; + return field.options != null && field.options["proto3_optional"] === true; + } +}); + +/** + * Decorator function as returned by {@link OneOf.d} (TypeScript). + * @typedef OneOfDecorator + * @type {function} + * @param {Object} prototype Target prototype + * @param {string} oneofName OneOf name + * @returns {undefined} + */ + +/** + * OneOf decorator (TypeScript). + * @function + * @param {...string} fieldNames Field names + * @returns {OneOfDecorator} Decorator function + * @template T extends string + */ +OneOf.d = function decorateOneOf() { + var fieldNames = new Array(arguments.length), + index = 0; + while (index < arguments.length) + fieldNames[index] = arguments[index++]; + return function oneOfDecorator(prototype, oneofName) { + util.decorateType(prototype.constructor) + .add(new OneOf(oneofName, fieldNames)); + Object.defineProperty(prototype, oneofName, { + get: util.oneOfGetter(fieldNames), + set: util.oneOfSetter(fieldNames) + }); + }; +}; + + +/***/ }), + +/***/ 58790: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +module.exports = parse; + +parse.filename = null; +parse.defaults = { keepCase: false }; + +var tokenize = __nccwpck_require__(580), + Root = __nccwpck_require__(8185), + Type = __nccwpck_require__(70901), + Field = __nccwpck_require__(30457), + MapField = __nccwpck_require__(58791), + OneOf = __nccwpck_require__(84624), + Enum = __nccwpck_require__(73528), + Service = __nccwpck_require__(30338), + Method = __nccwpck_require__(59988), + ReflectionObject = __nccwpck_require__(67946), + types = __nccwpck_require__(21024), + util = __nccwpck_require__(39609); + +var base10Re = /^[1-9][0-9]*$/, + base10NegRe = /^-?[1-9][0-9]*$/, + base16Re = /^0[x][0-9a-fA-F]+$/, + base16NegRe = /^-?0[x][0-9a-fA-F]+$/, + base8Re = /^0[0-7]+$/, + base8NegRe = /^-?0[0-7]+$/, + numberRe = /^(?![eE])[0-9]*(?:\.[0-9]*)?(?:[eE][+-]?[0-9]+)?$/, + nameRe = /^[a-zA-Z_][a-zA-Z_0-9]*$/, + typeRefRe = /^(?:\.?[a-zA-Z_][a-zA-Z_0-9]*)(?:\.[a-zA-Z_][a-zA-Z_0-9]*)*$/; + +/** + * Result object returned from {@link parse}. + * @interface IParserResult + * @property {string|undefined} package Package name, if declared + * @property {string[]|undefined} imports Imports, if any + * @property {string[]|undefined} weakImports Weak imports, if any + * @property {Root} root Populated root instance + */ + +/** + * Options modifying the behavior of {@link parse}. + * @interface IParseOptions + * @property {boolean} [keepCase=false] Keeps field casing instead of converting to camel case + * @property {boolean} [alternateCommentMode=false] Recognize double-slash comments in addition to doc-block comments. + * @property {boolean} [preferTrailingComment=false] Use trailing comment when both leading comment and trailing comment exist. + */ + +/** + * Options modifying the behavior of JSON serialization. + * @interface IToJSONOptions + * @property {boolean} [keepComments=false] Serializes comments. + */ + +/** + * Parses the given .proto source and returns an object with the parsed contents. + * @param {string} source Source contents + * @param {Root} root Root to populate + * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted. + * @returns {IParserResult} Parser result + * @property {string} filename=null Currently processing file name for error reporting, if known + * @property {IParseOptions} defaults Default {@link IParseOptions} + */ +function parse(source, root, options) { + /* eslint-disable callback-return */ + if (!(root instanceof Root)) { + options = root; + root = new Root(); + } + if (!options) + options = parse.defaults; + + var preferTrailingComment = options.preferTrailingComment || false; + var tn = tokenize(source, options.alternateCommentMode || false), + next = tn.next, + push = tn.push, + peek = tn.peek, + skip = tn.skip, + cmnt = tn.cmnt; + + var head = true, + pkg, + imports, + weakImports, + edition = "proto2"; + + var ptr = root; + + var topLevelObjects = []; + var topLevelOptions = {}; + + var applyCase = options.keepCase ? function(name) { return name; } : util.camelCase; + + function resolveFileFeatures() { + topLevelObjects.forEach(obj => { + obj._edition = edition; + Object.keys(topLevelOptions).forEach(opt => { + if (obj.getOption(opt) !== undefined) return; + obj.setOption(opt, topLevelOptions[opt], true); + }); + }); + } + + /* istanbul ignore next */ + function illegal(token, name, insideTryCatch) { + var filename = parse.filename; + if (!insideTryCatch) + parse.filename = null; + return Error("illegal " + (name || "token") + " '" + token + "' (" + (filename ? filename + ", " : "") + "line " + tn.line + ")"); + } + + function readString() { + var values = [], + token; + do { + /* istanbul ignore if */ + if ((token = next()) !== "\"" && token !== "'") + throw illegal(token); + + values.push(next()); + skip(token); + token = peek(); + } while (token === "\"" || token === "'"); + return values.join(""); + } + + function readValue(acceptTypeRef) { + var token = next(); + switch (token) { + case "'": + case "\"": + push(token); + return readString(); + case "true": case "TRUE": + return true; + case "false": case "FALSE": + return false; + } + try { + return parseNumber(token, /* insideTryCatch */ true); + } catch (e) { + /* istanbul ignore else */ + if (acceptTypeRef && typeRefRe.test(token)) + return token; + + /* istanbul ignore next */ + throw illegal(token, "value"); + } + } + + function readRanges(target, acceptStrings) { + var token, start; + do { + if (acceptStrings && ((token = peek()) === "\"" || token === "'")) { + var str = readString(); + target.push(str); + if (edition >= 2023) { + throw illegal(str, "id"); + } + } else { + try { + target.push([ start = parseId(next()), skip("to", true) ? parseId(next()) : start ]); + } catch (err) { + if (acceptStrings && typeRefRe.test(token) && edition >= 2023) { + target.push(token); + } else { + throw err; + } + } + } + } while (skip(",", true)); + var dummy = {options: undefined}; + dummy.setOption = function(name, value) { + if (this.options === undefined) this.options = {}; + this.options[name] = value; + }; + ifBlock( + dummy, + function parseRange_block(token) { + /* istanbul ignore else */ + if (token === "option") { + parseOption(dummy, token); // skip + skip(";"); + } else + throw illegal(token); + }, + function parseRange_line() { + parseInlineOptions(dummy); // skip + }); + } + + function parseNumber(token, insideTryCatch) { + var sign = 1; + if (token.charAt(0) === "-") { + sign = -1; + token = token.substring(1); + } + switch (token) { + case "inf": case "INF": case "Inf": + return sign * Infinity; + case "nan": case "NAN": case "Nan": case "NaN": + return NaN; + case "0": + return 0; + } + if (base10Re.test(token)) + return sign * parseInt(token, 10); + if (base16Re.test(token)) + return sign * parseInt(token, 16); + if (base8Re.test(token)) + return sign * parseInt(token, 8); + + /* istanbul ignore else */ + if (numberRe.test(token)) + return sign * parseFloat(token); + + /* istanbul ignore next */ + throw illegal(token, "number", insideTryCatch); + } + + function parseId(token, acceptNegative) { + switch (token) { + case "max": case "MAX": case "Max": + return 536870911; + case "0": + return 0; + } + + /* istanbul ignore if */ + if (!acceptNegative && token.charAt(0) === "-") + throw illegal(token, "id"); + + if (base10NegRe.test(token)) + return parseInt(token, 10); + if (base16NegRe.test(token)) + return parseInt(token, 16); + + /* istanbul ignore else */ + if (base8NegRe.test(token)) + return parseInt(token, 8); + + /* istanbul ignore next */ + throw illegal(token, "id"); + } + + function parsePackage() { + /* istanbul ignore if */ + if (pkg !== undefined) + throw illegal("package"); + + pkg = next(); + + /* istanbul ignore if */ + if (!typeRefRe.test(pkg)) + throw illegal(pkg, "name"); + + ptr = ptr.define(pkg); + + skip(";"); + } + + function parseImport() { + var token = peek(); + var whichImports; + switch (token) { + case "weak": + whichImports = weakImports || (weakImports = []); + next(); + break; + case "public": + next(); + // eslint-disable-next-line no-fallthrough + default: + whichImports = imports || (imports = []); + break; + } + token = readString(); + skip(";"); + whichImports.push(token); + } + + function parseSyntax() { + skip("="); + edition = readString(); + + /* istanbul ignore if */ + if (edition < 2023) + throw illegal(edition, "syntax"); + + skip(";"); + } + + function parseEdition() { + skip("="); + edition = readString(); + const supportedEditions = ["2023"]; + + /* istanbul ignore if */ + if (!supportedEditions.includes(edition)) + throw illegal(edition, "edition"); + + skip(";"); + } + + + function parseCommon(parent, token) { + switch (token) { + + case "option": + parseOption(parent, token); + skip(";"); + return true; + + case "message": + parseType(parent, token); + return true; + + case "enum": + parseEnum(parent, token); + return true; + + case "service": + parseService(parent, token); + return true; + + case "extend": + parseExtension(parent, token); + return true; + } + return false; + } + + function ifBlock(obj, fnIf, fnElse) { + var trailingLine = tn.line; + if (obj) { + if(typeof obj.comment !== "string") { + obj.comment = cmnt(); // try block-type comment + } + obj.filename = parse.filename; + } + if (skip("{", true)) { + var token; + while ((token = next()) !== "}") + fnIf(token); + skip(";", true); + } else { + if (fnElse) + fnElse(); + skip(";"); + if (obj && (typeof obj.comment !== "string" || preferTrailingComment)) + obj.comment = cmnt(trailingLine) || obj.comment; // try line-type comment + } + } + + function parseType(parent, token) { + + /* istanbul ignore if */ + if (!nameRe.test(token = next())) + throw illegal(token, "type name"); + + var type = new Type(token); + ifBlock(type, function parseType_block(token) { + if (parseCommon(type, token)) + return; + + switch (token) { + + case "map": + parseMapField(type, token); + break; + + case "required": + if (edition !== "proto2") + throw illegal(token); + /* eslint-disable no-fallthrough */ + case "repeated": + parseField(type, token); + break; + + case "optional": + /* istanbul ignore if */ + if (edition === "proto3") { + parseField(type, "proto3_optional"); + } else if (edition !== "proto2") { + throw illegal(token); + } else { + parseField(type, "optional"); + } + break; + + case "oneof": + parseOneOf(type, token); + break; + + case "extensions": + readRanges(type.extensions || (type.extensions = [])); + break; + + case "reserved": + readRanges(type.reserved || (type.reserved = []), true); + break; + + default: + /* istanbul ignore if */ + if (edition === "proto2" || !typeRefRe.test(token)) { + throw illegal(token); + } + + push(token); + parseField(type, "optional"); + break; + } + }); + parent.add(type); + if (parent === ptr) { + topLevelObjects.push(type); + } + } + + function parseField(parent, rule, extend) { + var type = next(); + if (type === "group") { + parseGroup(parent, rule); + return; + } + // Type names can consume multiple tokens, in multiple variants: + // package.subpackage field tokens: "package.subpackage" [TYPE NAME ENDS HERE] "field" + // package . subpackage field tokens: "package" "." "subpackage" [TYPE NAME ENDS HERE] "field" + // package. subpackage field tokens: "package." "subpackage" [TYPE NAME ENDS HERE] "field" + // package .subpackage field tokens: "package" ".subpackage" [TYPE NAME ENDS HERE] "field" + // Keep reading tokens until we get a type name with no period at the end, + // and the next token does not start with a period. + while (type.endsWith(".") || peek().startsWith(".")) { + type += next(); + } + + /* istanbul ignore if */ + if (!typeRefRe.test(type)) + throw illegal(type, "type"); + + var name = next(); + + /* istanbul ignore if */ + + if (!nameRe.test(name)) + throw illegal(name, "name"); + + name = applyCase(name); + skip("="); + + var field = new Field(name, parseId(next()), type, rule, extend); + + ifBlock(field, function parseField_block(token) { + + /* istanbul ignore else */ + if (token === "option") { + parseOption(field, token); + skip(";"); + } else + throw illegal(token); + + }, function parseField_line() { + parseInlineOptions(field); + }); + + if (rule === "proto3_optional") { + // for proto3 optional fields, we create a single-member Oneof to mimic "optional" behavior + var oneof = new OneOf("_" + name); + field.setOption("proto3_optional", true); + oneof.add(field); + parent.add(oneof); + } else { + parent.add(field); + } + if (parent === ptr) { + topLevelObjects.push(field); + } + } + + function parseGroup(parent, rule) { + if (edition >= 2023) { + throw illegal("group"); + } + var name = next(); + + /* istanbul ignore if */ + if (!nameRe.test(name)) + throw illegal(name, "name"); + + var fieldName = util.lcFirst(name); + if (name === fieldName) + name = util.ucFirst(name); + skip("="); + var id = parseId(next()); + var type = new Type(name); + type.group = true; + var field = new Field(fieldName, id, name, rule); + field.filename = parse.filename; + ifBlock(type, function parseGroup_block(token) { + switch (token) { + + case "option": + parseOption(type, token); + skip(";"); + break; + case "required": + case "repeated": + parseField(type, token); + break; + + case "optional": + /* istanbul ignore if */ + if (edition === "proto3") { + parseField(type, "proto3_optional"); + } else { + parseField(type, "optional"); + } + break; + + case "message": + parseType(type, token); + break; + + case "enum": + parseEnum(type, token); + break; + + case "reserved": + readRanges(type.reserved || (type.reserved = []), true); + break; + + /* istanbul ignore next */ + default: + throw illegal(token); // there are no groups with proto3 semantics + } + }); + parent.add(type) + .add(field); + } + + function parseMapField(parent) { + skip("<"); + var keyType = next(); + + /* istanbul ignore if */ + if (types.mapKey[keyType] === undefined) + throw illegal(keyType, "type"); + + skip(","); + var valueType = next(); + + /* istanbul ignore if */ + if (!typeRefRe.test(valueType)) + throw illegal(valueType, "type"); + + skip(">"); + var name = next(); + + /* istanbul ignore if */ + if (!nameRe.test(name)) + throw illegal(name, "name"); + + skip("="); + var field = new MapField(applyCase(name), parseId(next()), keyType, valueType); + ifBlock(field, function parseMapField_block(token) { + + /* istanbul ignore else */ + if (token === "option") { + parseOption(field, token); + skip(";"); + } else + throw illegal(token); + + }, function parseMapField_line() { + parseInlineOptions(field); + }); + parent.add(field); + } + + function parseOneOf(parent, token) { + + /* istanbul ignore if */ + if (!nameRe.test(token = next())) + throw illegal(token, "name"); + + var oneof = new OneOf(applyCase(token)); + ifBlock(oneof, function parseOneOf_block(token) { + if (token === "option") { + parseOption(oneof, token); + skip(";"); + } else { + push(token); + parseField(oneof, "optional"); + } + }); + parent.add(oneof); + } + + function parseEnum(parent, token) { + + /* istanbul ignore if */ + if (!nameRe.test(token = next())) + throw illegal(token, "name"); + + var enm = new Enum(token); + ifBlock(enm, function parseEnum_block(token) { + switch(token) { + case "option": + parseOption(enm, token); + skip(";"); + break; + + case "reserved": + readRanges(enm.reserved || (enm.reserved = []), true); + if(enm.reserved === undefined) enm.reserved = []; + break; + + default: + parseEnumValue(enm, token); + } + }); + parent.add(enm); + if (parent === ptr) { + topLevelObjects.push(enm); + } + } + + function parseEnumValue(parent, token) { + + /* istanbul ignore if */ + if (!nameRe.test(token)) + throw illegal(token, "name"); + + skip("="); + var value = parseId(next(), true), + dummy = { + options: undefined + }; + dummy.getOption = function(name) { + return this.options[name]; + }; + dummy.setOption = function(name, value) { + ReflectionObject.prototype.setOption.call(dummy, name, value); + }; + dummy.setParsedOption = function() { + return undefined; + }; + ifBlock(dummy, function parseEnumValue_block(token) { + + /* istanbul ignore else */ + if (token === "option") { + parseOption(dummy, token); // skip + skip(";"); + } else + throw illegal(token); + + }, function parseEnumValue_line() { + parseInlineOptions(dummy); // skip + }); + parent.add(token, value, dummy.comment, dummy.parsedOptions || dummy.options); + } + + function parseOption(parent, token) { + var option; + var propName; + var isOption = true; + if (token === "option") { + token = next(); + } + + while (token !== "=") { + if (token === "(") { + var parensValue = next(); + skip(")"); + token = "(" + parensValue + ")"; + } + if (isOption) { + isOption = false; + if (token.includes(".") && !token.includes("(")) { + var tokens = token.split("."); + option = tokens[0] + "."; + token = tokens[1]; + continue; + } + option = token; + } else { + propName = propName ? propName += token : token; + } + token = next(); + } + var name = propName ? option.concat(propName) : option; + var optionValue = parseOptionValue(parent, name); + propName = propName && propName[0] === "." ? propName.slice(1) : propName; + option = option && option[option.length - 1] === "." ? option.slice(0, -1) : option; + setParsedOption(parent, option, optionValue, propName); + } + + function parseOptionValue(parent, name) { + // { a: "foo" b { c: "bar" } } + if (skip("{", true)) { + var objectResult = {}; + + while (!skip("}", true)) { + /* istanbul ignore if */ + if (!nameRe.test(token = next())) { + throw illegal(token, "name"); + } + if (token === null) { + throw illegal(token, "end of input"); + } + + var value; + var propName = token; + + skip(":", true); + + if (peek() === "{") { + // option (my_option) = { + // repeated_value: [ "foo", "bar" ] + // }; + value = parseOptionValue(parent, name + "." + token); + } else if (peek() === "[") { + value = []; + var lastValue; + if (skip("[", true)) { + do { + lastValue = readValue(true); + value.push(lastValue); + } while (skip(",", true)); + skip("]"); + if (typeof lastValue !== "undefined") { + setOption(parent, name + "." + token, lastValue); + } + } + } else { + value = readValue(true); + setOption(parent, name + "." + token, value); + } + + var prevValue = objectResult[propName]; + + if (prevValue) + value = [].concat(prevValue).concat(value); + + objectResult[propName] = value; + + // Semicolons and commas can be optional + skip(",", true); + skip(";", true); + } + + return objectResult; + } + + var simpleValue = readValue(true); + setOption(parent, name, simpleValue); + return simpleValue; + // Does not enforce a delimiter to be universal + } + + function setOption(parent, name, value) { + if (ptr === parent && /^features\./.test(name)) { + topLevelOptions[name] = value; + return; + } + if (parent.setOption) + parent.setOption(name, value); + } + + function setParsedOption(parent, name, value, propName) { + if (parent.setParsedOption) + parent.setParsedOption(name, value, propName); + } + + function parseInlineOptions(parent) { + if (skip("[", true)) { + do { + parseOption(parent, "option"); + } while (skip(",", true)); + skip("]"); + } + return parent; + } + + function parseService(parent, token) { + + /* istanbul ignore if */ + if (!nameRe.test(token = next())) + throw illegal(token, "service name"); + + var service = new Service(token); + ifBlock(service, function parseService_block(token) { + if (parseCommon(service, token)) { + return; + } + + /* istanbul ignore else */ + if (token === "rpc") + parseMethod(service, token); + else + throw illegal(token); + }); + parent.add(service); + if (parent === ptr) { + topLevelObjects.push(service); + } + } + + function parseMethod(parent, token) { + // Get the comment of the preceding line now (if one exists) in case the + // method is defined across multiple lines. + var commentText = cmnt(); + + var type = token; + + /* istanbul ignore if */ + if (!nameRe.test(token = next())) + throw illegal(token, "name"); + + var name = token, + requestType, requestStream, + responseType, responseStream; + + skip("("); + if (skip("stream", true)) + requestStream = true; + + /* istanbul ignore if */ + if (!typeRefRe.test(token = next())) + throw illegal(token); + + requestType = token; + skip(")"); skip("returns"); skip("("); + if (skip("stream", true)) + responseStream = true; + + /* istanbul ignore if */ + if (!typeRefRe.test(token = next())) + throw illegal(token); + + responseType = token; + skip(")"); + + var method = new Method(name, type, requestType, responseType, requestStream, responseStream); + method.comment = commentText; + ifBlock(method, function parseMethod_block(token) { + + /* istanbul ignore else */ + if (token === "option") { + parseOption(method, token); + skip(";"); + } else + throw illegal(token); + + }); + parent.add(method); + } + + function parseExtension(parent, token) { + + /* istanbul ignore if */ + if (!typeRefRe.test(token = next())) + throw illegal(token, "reference"); + + var reference = token; + ifBlock(null, function parseExtension_block(token) { + switch (token) { + + case "required": + case "repeated": + parseField(parent, token, reference); + break; + + case "optional": + /* istanbul ignore if */ + if (edition === "proto3") { + parseField(parent, "proto3_optional", reference); + } else { + parseField(parent, "optional", reference); + } + break; + + default: + /* istanbul ignore if */ + if (edition === "proto2" || !typeRefRe.test(token)) + throw illegal(token); + push(token); + parseField(parent, "optional", reference); + break; + } + }); + } + + var token; + while ((token = next()) !== null) { + switch (token) { + + case "package": + + /* istanbul ignore if */ + if (!head) + throw illegal(token); + + parsePackage(); + break; + + case "import": + + /* istanbul ignore if */ + if (!head) + throw illegal(token); + + parseImport(); + break; + + case "syntax": + + /* istanbul ignore if */ + if (!head) + throw illegal(token); + + parseSyntax(); + break; + + case "edition": + /* istanbul ignore if */ + if (!head) + throw illegal(token); + parseEdition(); + break; + + case "option": + parseOption(ptr, token); + skip(";", true); + break; + + default: + + /* istanbul ignore else */ + if (parseCommon(ptr, token)) { + head = false; + continue; + } + + /* istanbul ignore next */ + throw illegal(token); + } + } + + resolveFileFeatures(); + + parse.filename = null; + return { + "package" : pkg, + "imports" : imports, + weakImports : weakImports, + root : root + }; +} + +/** + * Parses the given .proto source and returns an object with the parsed contents. + * @name parse + * @function + * @param {string} source Source contents + * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted. + * @returns {IParserResult} Parser result + * @property {string} filename=null Currently processing file name for error reporting, if known + * @property {IParseOptions} defaults Default {@link IParseOptions} + * @variation 2 + */ + + +/***/ }), + +/***/ 69350: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +module.exports = Reader; + +var util = __nccwpck_require__(22857); + +var BufferReader; // cyclic + +var LongBits = util.LongBits, + utf8 = util.utf8; + +/* istanbul ignore next */ +function indexOutOfRange(reader, writeLength) { + return RangeError("index out of range: " + reader.pos + " + " + (writeLength || 1) + " > " + reader.len); +} + +/** + * Constructs a new reader instance using the specified buffer. + * @classdesc Wire format reader using `Uint8Array` if available, otherwise `Array`. + * @constructor + * @param {Uint8Array} buffer Buffer to read from + */ +function Reader(buffer) { + + /** + * Read buffer. + * @type {Uint8Array} + */ + this.buf = buffer; + + /** + * Read buffer position. + * @type {number} + */ + this.pos = 0; + + /** + * Read buffer length. + * @type {number} + */ + this.len = buffer.length; +} + +var create_array = typeof Uint8Array !== "undefined" + ? function create_typed_array(buffer) { + if (buffer instanceof Uint8Array || Array.isArray(buffer)) + return new Reader(buffer); + throw Error("illegal buffer"); + } + /* istanbul ignore next */ + : function create_array(buffer) { + if (Array.isArray(buffer)) + return new Reader(buffer); + throw Error("illegal buffer"); + }; + +var create = function create() { + return util.Buffer + ? function create_buffer_setup(buffer) { + return (Reader.create = function create_buffer(buffer) { + return util.Buffer.isBuffer(buffer) + ? new BufferReader(buffer) + /* istanbul ignore next */ + : create_array(buffer); + })(buffer); + } + /* istanbul ignore next */ + : create_array; +}; + +/** + * Creates a new reader using the specified buffer. + * @function + * @param {Uint8Array|Buffer} buffer Buffer to read from + * @returns {Reader|BufferReader} A {@link BufferReader} if `buffer` is a Buffer, otherwise a {@link Reader} + * @throws {Error} If `buffer` is not a valid buffer + */ +Reader.create = create(); + +Reader.prototype._slice = util.Array.prototype.subarray || /* istanbul ignore next */ util.Array.prototype.slice; + +/** + * Reads a varint as an unsigned 32 bit value. + * @function + * @returns {number} Value read + */ +Reader.prototype.uint32 = (function read_uint32_setup() { + var value = 4294967295; // optimizer type-hint, tends to deopt otherwise (?!) + return function read_uint32() { + value = ( this.buf[this.pos] & 127 ) >>> 0; if (this.buf[this.pos++] < 128) return value; + value = (value | (this.buf[this.pos] & 127) << 7) >>> 0; if (this.buf[this.pos++] < 128) return value; + value = (value | (this.buf[this.pos] & 127) << 14) >>> 0; if (this.buf[this.pos++] < 128) return value; + value = (value | (this.buf[this.pos] & 127) << 21) >>> 0; if (this.buf[this.pos++] < 128) return value; + value = (value | (this.buf[this.pos] & 15) << 28) >>> 0; if (this.buf[this.pos++] < 128) return value; + + /* istanbul ignore if */ + if ((this.pos += 5) > this.len) { + this.pos = this.len; + throw indexOutOfRange(this, 10); + } + return value; + }; +})(); + +/** + * Reads a varint as a signed 32 bit value. + * @returns {number} Value read + */ +Reader.prototype.int32 = function read_int32() { + return this.uint32() | 0; +}; + +/** + * Reads a zig-zag encoded varint as a signed 32 bit value. + * @returns {number} Value read + */ +Reader.prototype.sint32 = function read_sint32() { + var value = this.uint32(); + return value >>> 1 ^ -(value & 1) | 0; +}; + +/* eslint-disable no-invalid-this */ + +function readLongVarint() { + // tends to deopt with local vars for octet etc. + var bits = new LongBits(0, 0); + var i = 0; + if (this.len - this.pos > 4) { // fast route (lo) + for (; i < 4; ++i) { + // 1st..4th + bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0; + if (this.buf[this.pos++] < 128) + return bits; + } + // 5th + bits.lo = (bits.lo | (this.buf[this.pos] & 127) << 28) >>> 0; + bits.hi = (bits.hi | (this.buf[this.pos] & 127) >> 4) >>> 0; + if (this.buf[this.pos++] < 128) + return bits; + i = 0; + } else { + for (; i < 3; ++i) { + /* istanbul ignore if */ + if (this.pos >= this.len) + throw indexOutOfRange(this); + // 1st..3th + bits.lo = (bits.lo | (this.buf[this.pos] & 127) << i * 7) >>> 0; + if (this.buf[this.pos++] < 128) + return bits; + } + // 4th + bits.lo = (bits.lo | (this.buf[this.pos++] & 127) << i * 7) >>> 0; + return bits; + } + if (this.len - this.pos > 4) { // fast route (hi) + for (; i < 5; ++i) { + // 6th..10th + bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0; + if (this.buf[this.pos++] < 128) + return bits; + } + } else { + for (; i < 5; ++i) { + /* istanbul ignore if */ + if (this.pos >= this.len) + throw indexOutOfRange(this); + // 6th..10th + bits.hi = (bits.hi | (this.buf[this.pos] & 127) << i * 7 + 3) >>> 0; + if (this.buf[this.pos++] < 128) + return bits; + } + } + /* istanbul ignore next */ + throw Error("invalid varint encoding"); +} + +/* eslint-enable no-invalid-this */ + +/** + * Reads a varint as a signed 64 bit value. + * @name Reader#int64 + * @function + * @returns {Long} Value read + */ + +/** + * Reads a varint as an unsigned 64 bit value. + * @name Reader#uint64 + * @function + * @returns {Long} Value read + */ + +/** + * Reads a zig-zag encoded varint as a signed 64 bit value. + * @name Reader#sint64 + * @function + * @returns {Long} Value read + */ + +/** + * Reads a varint as a boolean. + * @returns {boolean} Value read + */ +Reader.prototype.bool = function read_bool() { + return this.uint32() !== 0; +}; + +function readFixed32_end(buf, end) { // note that this uses `end`, not `pos` + return (buf[end - 4] + | buf[end - 3] << 8 + | buf[end - 2] << 16 + | buf[end - 1] << 24) >>> 0; +} + +/** + * Reads fixed 32 bits as an unsigned 32 bit integer. + * @returns {number} Value read + */ +Reader.prototype.fixed32 = function read_fixed32() { + + /* istanbul ignore if */ + if (this.pos + 4 > this.len) + throw indexOutOfRange(this, 4); + + return readFixed32_end(this.buf, this.pos += 4); +}; + +/** + * Reads fixed 32 bits as a signed 32 bit integer. + * @returns {number} Value read + */ +Reader.prototype.sfixed32 = function read_sfixed32() { + + /* istanbul ignore if */ + if (this.pos + 4 > this.len) + throw indexOutOfRange(this, 4); + + return readFixed32_end(this.buf, this.pos += 4) | 0; +}; + +/* eslint-disable no-invalid-this */ + +function readFixed64(/* this: Reader */) { + + /* istanbul ignore if */ + if (this.pos + 8 > this.len) + throw indexOutOfRange(this, 8); + + return new LongBits(readFixed32_end(this.buf, this.pos += 4), readFixed32_end(this.buf, this.pos += 4)); +} + +/* eslint-enable no-invalid-this */ + +/** + * Reads fixed 64 bits. + * @name Reader#fixed64 + * @function + * @returns {Long} Value read + */ + +/** + * Reads zig-zag encoded fixed 64 bits. + * @name Reader#sfixed64 + * @function + * @returns {Long} Value read + */ + +/** + * Reads a float (32 bit) as a number. + * @function + * @returns {number} Value read + */ +Reader.prototype.float = function read_float() { + + /* istanbul ignore if */ + if (this.pos + 4 > this.len) + throw indexOutOfRange(this, 4); + + var value = util.float.readFloatLE(this.buf, this.pos); + this.pos += 4; + return value; +}; + +/** + * Reads a double (64 bit float) as a number. + * @function + * @returns {number} Value read + */ +Reader.prototype.double = function read_double() { + + /* istanbul ignore if */ + if (this.pos + 8 > this.len) + throw indexOutOfRange(this, 4); + + var value = util.float.readDoubleLE(this.buf, this.pos); + this.pos += 8; + return value; +}; + +/** + * Reads a sequence of bytes preceeded by its length as a varint. + * @returns {Uint8Array} Value read + */ +Reader.prototype.bytes = function read_bytes() { + var length = this.uint32(), + start = this.pos, + end = this.pos + length; + + /* istanbul ignore if */ + if (end > this.len) + throw indexOutOfRange(this, length); + + this.pos += length; + if (Array.isArray(this.buf)) // plain array + return this.buf.slice(start, end); + + if (start === end) { // fix for IE 10/Win8 and others' subarray returning array of size 1 + var nativeBuffer = util.Buffer; + return nativeBuffer + ? nativeBuffer.alloc(0) + : new this.buf.constructor(0); + } + return this._slice.call(this.buf, start, end); +}; + +/** + * Reads a string preceeded by its byte length as a varint. + * @returns {string} Value read + */ +Reader.prototype.string = function read_string() { + var bytes = this.bytes(); + return utf8.read(bytes, 0, bytes.length); +}; + +/** + * Skips the specified number of bytes if specified, otherwise skips a varint. + * @param {number} [length] Length if known, otherwise a varint is assumed + * @returns {Reader} `this` + */ +Reader.prototype.skip = function skip(length) { + if (typeof length === "number") { + /* istanbul ignore if */ + if (this.pos + length > this.len) + throw indexOutOfRange(this, length); + this.pos += length; + } else { + do { + /* istanbul ignore if */ + if (this.pos >= this.len) + throw indexOutOfRange(this); + } while (this.buf[this.pos++] & 128); + } + return this; +}; + +/** + * Skips the next element of the specified wire type. + * @param {number} wireType Wire type received + * @returns {Reader} `this` + */ +Reader.prototype.skipType = function(wireType) { + switch (wireType) { + case 0: + this.skip(); + break; + case 1: + this.skip(8); + break; + case 2: + this.skip(this.uint32()); + break; + case 3: + while ((wireType = this.uint32() & 7) !== 4) { + this.skipType(wireType); + } + break; + case 5: + this.skip(4); + break; + + /* istanbul ignore next */ + default: + throw Error("invalid wire type " + wireType + " at offset " + this.pos); + } + return this; +}; + +Reader._configure = function(BufferReader_) { + BufferReader = BufferReader_; + Reader.create = create(); + BufferReader._configure(); + + var fn = util.Long ? "toLong" : /* istanbul ignore next */ "toNumber"; + util.merge(Reader.prototype, { + + int64: function read_int64() { + return readLongVarint.call(this)[fn](false); + }, + + uint64: function read_uint64() { + return readLongVarint.call(this)[fn](true); + }, + + sint64: function read_sint64() { + return readLongVarint.call(this).zzDecode()[fn](false); + }, + + fixed64: function read_fixed64() { + return readFixed64.call(this)[fn](true); + }, + + sfixed64: function read_sfixed64() { + return readFixed64.call(this)[fn](false); + } + + }); +}; + + +/***/ }), + +/***/ 42423: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +module.exports = BufferReader; + +// extends Reader +var Reader = __nccwpck_require__(69350); +(BufferReader.prototype = Object.create(Reader.prototype)).constructor = BufferReader; + +var util = __nccwpck_require__(22857); + +/** + * Constructs a new buffer reader instance. + * @classdesc Wire format reader using node buffers. + * @extends Reader + * @constructor + * @param {Buffer} buffer Buffer to read from + */ +function BufferReader(buffer) { + Reader.call(this, buffer); + + /** + * Read buffer. + * @name BufferReader#buf + * @type {Buffer} + */ +} + +BufferReader._configure = function () { + /* istanbul ignore else */ + if (util.Buffer) + BufferReader.prototype._slice = util.Buffer.prototype.slice; +}; + + +/** + * @override + */ +BufferReader.prototype.string = function read_string_buffer() { + var len = this.uint32(); // modifies pos + return this.buf.utf8Slice + ? this.buf.utf8Slice(this.pos, this.pos = Math.min(this.pos + len, this.len)) + : this.buf.toString("utf-8", this.pos, this.pos = Math.min(this.pos + len, this.len)); +}; + +/** + * Reads a sequence of bytes preceeded by its length as a varint. + * @name BufferReader#bytes + * @function + * @returns {Buffer} Value read + */ + +BufferReader._configure(); + + +/***/ }), + +/***/ 8185: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +module.exports = Root; + +// extends Namespace +var Namespace = __nccwpck_require__(21946); +((Root.prototype = Object.create(Namespace.prototype)).constructor = Root).className = "Root"; + +var Field = __nccwpck_require__(30457), + Enum = __nccwpck_require__(73528), + OneOf = __nccwpck_require__(84624), + util = __nccwpck_require__(39609); + +var Type, // cyclic + parse, // might be excluded + common; // " + +/** + * Constructs a new root namespace instance. + * @classdesc Root namespace wrapping all types, enums, services, sub-namespaces etc. that belong together. + * @extends NamespaceBase + * @constructor + * @param {Object.} [options] Top level options + */ +function Root(options) { + Namespace.call(this, "", options); + + /** + * Deferred extension fields. + * @type {Field[]} + */ + this.deferred = []; + + /** + * Resolved file names of loaded files. + * @type {string[]} + */ + this.files = []; + + /** + * Edition, defaults to proto2 if unspecified. + * @type {string} + * @private + */ + this._edition = "proto2"; + + /** + * Global lookup cache of fully qualified names. + * @type {Object.} + * @private + */ + this._fullyQualifiedObjects = {}; +} + +/** + * Loads a namespace descriptor into a root namespace. + * @param {INamespace} json Namespace descriptor + * @param {Root} [root] Root namespace, defaults to create a new one if omitted + * @returns {Root} Root namespace + */ +Root.fromJSON = function fromJSON(json, root) { + if (!root) + root = new Root(); + if (json.options) + root.setOptions(json.options); + return root.addJSON(json.nested).resolveAll(); +}; + +/** + * Resolves the path of an imported file, relative to the importing origin. + * This method exists so you can override it with your own logic in case your imports are scattered over multiple directories. + * @function + * @param {string} origin The file name of the importing file + * @param {string} target The file name being imported + * @returns {string|null} Resolved path to `target` or `null` to skip the file + */ +Root.prototype.resolvePath = util.path.resolve; + +/** + * Fetch content from file path or url + * This method exists so you can override it with your own logic. + * @function + * @param {string} path File path or url + * @param {FetchCallback} callback Callback function + * @returns {undefined} + */ +Root.prototype.fetch = util.fetch; + +// A symbol-like function to safely signal synchronous loading +/* istanbul ignore next */ +function SYNC() {} // eslint-disable-line no-empty-function + +/** + * Loads one or multiple .proto or preprocessed .json files into this root namespace and calls the callback. + * @param {string|string[]} filename Names of one or multiple files to load + * @param {IParseOptions} options Parse options + * @param {LoadCallback} callback Callback function + * @returns {undefined} + */ +Root.prototype.load = function load(filename, options, callback) { + if (typeof options === "function") { + callback = options; + options = undefined; + } + var self = this; + if (!callback) { + return util.asPromise(load, self, filename, options); + } + + var sync = callback === SYNC; // undocumented + + // Finishes loading by calling the callback (exactly once) + function finish(err, root) { + /* istanbul ignore if */ + if (!callback) { + return; + } + if (sync) { + throw err; + } + if (root) { + root.resolveAll(); + } + var cb = callback; + callback = null; + cb(err, root); + } + + // Bundled definition existence checking + function getBundledFileName(filename) { + var idx = filename.lastIndexOf("google/protobuf/"); + if (idx > -1) { + var altname = filename.substring(idx); + if (altname in common) return altname; + } + return null; + } + + // Processes a single file + function process(filename, source) { + try { + if (util.isString(source) && source.charAt(0) === "{") + source = JSON.parse(source); + if (!util.isString(source)) + self.setOptions(source.options).addJSON(source.nested); + else { + parse.filename = filename; + var parsed = parse(source, self, options), + resolved, + i = 0; + if (parsed.imports) + for (; i < parsed.imports.length; ++i) + if (resolved = getBundledFileName(parsed.imports[i]) || self.resolvePath(filename, parsed.imports[i])) + fetch(resolved); + if (parsed.weakImports) + for (i = 0; i < parsed.weakImports.length; ++i) + if (resolved = getBundledFileName(parsed.weakImports[i]) || self.resolvePath(filename, parsed.weakImports[i])) + fetch(resolved, true); + } + } catch (err) { + finish(err); + } + if (!sync && !queued) { + finish(null, self); // only once anyway + } + } + + // Fetches a single file + function fetch(filename, weak) { + filename = getBundledFileName(filename) || filename; + + // Skip if already loaded / attempted + if (self.files.indexOf(filename) > -1) { + return; + } + self.files.push(filename); + + // Shortcut bundled definitions + if (filename in common) { + if (sync) { + process(filename, common[filename]); + } else { + ++queued; + setTimeout(function() { + --queued; + process(filename, common[filename]); + }); + } + return; + } + + // Otherwise fetch from disk or network + if (sync) { + var source; + try { + source = util.fs.readFileSync(filename).toString("utf8"); + } catch (err) { + if (!weak) + finish(err); + return; + } + process(filename, source); + } else { + ++queued; + self.fetch(filename, function(err, source) { + --queued; + /* istanbul ignore if */ + if (!callback) { + return; // terminated meanwhile + } + if (err) { + /* istanbul ignore else */ + if (!weak) + finish(err); + else if (!queued) // can't be covered reliably + finish(null, self); + return; + } + process(filename, source); + }); + } + } + var queued = 0; + + // Assembling the root namespace doesn't require working type + // references anymore, so we can load everything in parallel + if (util.isString(filename)) { + filename = [ filename ]; + } + for (var i = 0, resolved; i < filename.length; ++i) + if (resolved = self.resolvePath("", filename[i])) + fetch(resolved); + if (sync) { + self.resolveAll(); + return self; + } + if (!queued) { + finish(null, self); + } + + return self; +}; +// function load(filename:string, options:IParseOptions, callback:LoadCallback):undefined + +/** + * Loads one or multiple .proto or preprocessed .json files into this root namespace and calls the callback. + * @function Root#load + * @param {string|string[]} filename Names of one or multiple files to load + * @param {LoadCallback} callback Callback function + * @returns {undefined} + * @variation 2 + */ +// function load(filename:string, callback:LoadCallback):undefined + +/** + * Loads one or multiple .proto or preprocessed .json files into this root namespace and returns a promise. + * @function Root#load + * @param {string|string[]} filename Names of one or multiple files to load + * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted. + * @returns {Promise} Promise + * @variation 3 + */ +// function load(filename:string, [options:IParseOptions]):Promise + +/** + * Synchronously loads one or multiple .proto or preprocessed .json files into this root namespace (node only). + * @function Root#loadSync + * @param {string|string[]} filename Names of one or multiple files to load + * @param {IParseOptions} [options] Parse options. Defaults to {@link parse.defaults} when omitted. + * @returns {Root} Root namespace + * @throws {Error} If synchronous fetching is not supported (i.e. in browsers) or if a file's syntax is invalid + */ +Root.prototype.loadSync = function loadSync(filename, options) { + if (!util.isNode) + throw Error("not supported"); + return this.load(filename, options, SYNC); +}; + +/** + * @override + */ +Root.prototype.resolveAll = function resolveAll() { + if (!this._needsRecursiveResolve) return this; + + if (this.deferred.length) + throw Error("unresolvable extensions: " + this.deferred.map(function(field) { + return "'extend " + field.extend + "' in " + field.parent.fullName; + }).join(", ")); + return Namespace.prototype.resolveAll.call(this); +}; + +// only uppercased (and thus conflict-free) children are exposed, see below +var exposeRe = /^[A-Z]/; + +/** + * Handles a deferred declaring extension field by creating a sister field to represent it within its extended type. + * @param {Root} root Root instance + * @param {Field} field Declaring extension field witin the declaring type + * @returns {boolean} `true` if successfully added to the extended type, `false` otherwise + * @inner + * @ignore + */ +function tryHandleExtension(root, field) { + var extendedType = field.parent.lookup(field.extend); + if (extendedType) { + var sisterField = new Field(field.fullName, field.id, field.type, field.rule, undefined, field.options); + //do not allow to extend same field twice to prevent the error + if (extendedType.get(sisterField.name)) { + return true; + } + sisterField.declaringField = field; + field.extensionField = sisterField; + extendedType.add(sisterField); + return true; + } + return false; +} + +/** + * Called when any object is added to this root or its sub-namespaces. + * @param {ReflectionObject} object Object added + * @returns {undefined} + * @private + */ +Root.prototype._handleAdd = function _handleAdd(object) { + if (object instanceof Field) { + + if (/* an extension field (implies not part of a oneof) */ object.extend !== undefined && /* not already handled */ !object.extensionField) + if (!tryHandleExtension(this, object)) + this.deferred.push(object); + + } else if (object instanceof Enum) { + + if (exposeRe.test(object.name)) + object.parent[object.name] = object.values; // expose enum values as property of its parent + + } else if (!(object instanceof OneOf)) /* everything else is a namespace */ { + + if (object instanceof Type) // Try to handle any deferred extensions + for (var i = 0; i < this.deferred.length;) + if (tryHandleExtension(this, this.deferred[i])) + this.deferred.splice(i, 1); + else + ++i; + for (var j = 0; j < /* initializes */ object.nestedArray.length; ++j) // recurse into the namespace + this._handleAdd(object._nestedArray[j]); + if (exposeRe.test(object.name)) + object.parent[object.name] = object; // expose namespace as property of its parent + } + + if (object instanceof Type || object instanceof Enum || object instanceof Field) { + // Only store types and enums for quick lookup during resolve. + this._fullyQualifiedObjects[object.fullName] = object; + } + + // The above also adds uppercased (and thus conflict-free) nested types, services and enums as + // properties of namespaces just like static code does. This allows using a .d.ts generated for + // a static module with reflection-based solutions where the condition is met. +}; + +/** + * Called when any object is removed from this root or its sub-namespaces. + * @param {ReflectionObject} object Object removed + * @returns {undefined} + * @private + */ +Root.prototype._handleRemove = function _handleRemove(object) { + if (object instanceof Field) { + + if (/* an extension field */ object.extend !== undefined) { + if (/* already handled */ object.extensionField) { // remove its sister field + object.extensionField.parent.remove(object.extensionField); + object.extensionField = null; + } else { // cancel the extension + var index = this.deferred.indexOf(object); + /* istanbul ignore else */ + if (index > -1) + this.deferred.splice(index, 1); + } + } + + } else if (object instanceof Enum) { + + if (exposeRe.test(object.name)) + delete object.parent[object.name]; // unexpose enum values + + } else if (object instanceof Namespace) { + + for (var i = 0; i < /* initializes */ object.nestedArray.length; ++i) // recurse into the namespace + this._handleRemove(object._nestedArray[i]); + + if (exposeRe.test(object.name)) + delete object.parent[object.name]; // unexpose namespaces + + } + + delete this._fullyQualifiedObjects[object.fullName]; +}; + +// Sets up cyclic dependencies (called in index-light) +Root._configure = function(Type_, parse_, common_) { + Type = Type_; + parse = parse_; + common = common_; +}; + + +/***/ }), + +/***/ 34460: +/***/ ((module) => { + +"use strict"; + +module.exports = {}; + +/** + * Named roots. + * This is where pbjs stores generated structures (the option `-r, --root` specifies a name). + * Can also be used manually to make roots available across modules. + * @name roots + * @type {Object.} + * @example + * // pbjs -r myroot -o compiled.js ... + * + * // in another module: + * require("./compiled.js"); + * + * // in any subsequent module: + * var root = protobuf.roots["myroot"]; + */ + + +/***/ }), + +/***/ 9882: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +/** + * Streaming RPC helpers. + * @namespace + */ +var rpc = exports; + +/** + * RPC implementation passed to {@link Service#create} performing a service request on network level, i.e. by utilizing http requests or websockets. + * @typedef RPCImpl + * @type {function} + * @param {Method|rpc.ServiceMethod,Message<{}>>} method Reflected or static method being called + * @param {Uint8Array} requestData Request data + * @param {RPCImplCallback} callback Callback function + * @returns {undefined} + * @example + * function rpcImpl(method, requestData, callback) { + * if (protobuf.util.lcFirst(method.name) !== "myMethod") // compatible with static code + * throw Error("no such method"); + * asynchronouslyObtainAResponse(requestData, function(err, responseData) { + * callback(err, responseData); + * }); + * } + */ + +/** + * Node-style callback as used by {@link RPCImpl}. + * @typedef RPCImplCallback + * @type {function} + * @param {Error|null} error Error, if any, otherwise `null` + * @param {Uint8Array|null} [response] Response data or `null` to signal end of stream, if there hasn't been an error + * @returns {undefined} + */ + +rpc.Service = __nccwpck_require__(34026); + + +/***/ }), + +/***/ 34026: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +module.exports = Service; + +var util = __nccwpck_require__(22857); + +// Extends EventEmitter +(Service.prototype = Object.create(util.EventEmitter.prototype)).constructor = Service; + +/** + * A service method callback as used by {@link rpc.ServiceMethod|ServiceMethod}. + * + * Differs from {@link RPCImplCallback} in that it is an actual callback of a service method which may not return `response = null`. + * @typedef rpc.ServiceMethodCallback + * @template TRes extends Message + * @type {function} + * @param {Error|null} error Error, if any + * @param {TRes} [response] Response message + * @returns {undefined} + */ + +/** + * A service method part of a {@link rpc.Service} as created by {@link Service.create}. + * @typedef rpc.ServiceMethod + * @template TReq extends Message + * @template TRes extends Message + * @type {function} + * @param {TReq|Properties} request Request message or plain object + * @param {rpc.ServiceMethodCallback} [callback] Node-style callback called with the error, if any, and the response message + * @returns {Promise>} Promise if `callback` has been omitted, otherwise `undefined` + */ + +/** + * Constructs a new RPC service instance. + * @classdesc An RPC service as returned by {@link Service#create}. + * @exports rpc.Service + * @extends util.EventEmitter + * @constructor + * @param {RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + */ +function Service(rpcImpl, requestDelimited, responseDelimited) { + + if (typeof rpcImpl !== "function") + throw TypeError("rpcImpl must be a function"); + + util.EventEmitter.call(this); + + /** + * RPC implementation. Becomes `null` once the service is ended. + * @type {RPCImpl|null} + */ + this.rpcImpl = rpcImpl; + + /** + * Whether requests are length-delimited. + * @type {boolean} + */ + this.requestDelimited = Boolean(requestDelimited); + + /** + * Whether responses are length-delimited. + * @type {boolean} + */ + this.responseDelimited = Boolean(responseDelimited); +} + +/** + * Calls a service method through {@link rpc.Service#rpcImpl|rpcImpl}. + * @param {Method|rpc.ServiceMethod} method Reflected or static method + * @param {Constructor} requestCtor Request constructor + * @param {Constructor} responseCtor Response constructor + * @param {TReq|Properties} request Request message or plain object + * @param {rpc.ServiceMethodCallback} callback Service callback + * @returns {undefined} + * @template TReq extends Message + * @template TRes extends Message + */ +Service.prototype.rpcCall = function rpcCall(method, requestCtor, responseCtor, request, callback) { + + if (!request) + throw TypeError("request must be specified"); + + var self = this; + if (!callback) + return util.asPromise(rpcCall, self, method, requestCtor, responseCtor, request); + + if (!self.rpcImpl) { + setTimeout(function() { callback(Error("already ended")); }, 0); + return undefined; + } + + try { + return self.rpcImpl( + method, + requestCtor[self.requestDelimited ? "encodeDelimited" : "encode"](request).finish(), + function rpcCallback(err, response) { + + if (err) { + self.emit("error", err, method); + return callback(err); + } + + if (response === null) { + self.end(/* endedByRPC */ true); + return undefined; + } + + if (!(response instanceof responseCtor)) { + try { + response = responseCtor[self.responseDelimited ? "decodeDelimited" : "decode"](response); + } catch (err) { + self.emit("error", err, method); + return callback(err); + } + } + + self.emit("data", response, method); + return callback(null, response); + } + ); + } catch (err) { + self.emit("error", err, method); + setTimeout(function() { callback(err); }, 0); + return undefined; + } +}; + +/** + * Ends this service and emits the `end` event. + * @param {boolean} [endedByRPC=false] Whether the service has been ended by the RPC implementation. + * @returns {rpc.Service} `this` + */ +Service.prototype.end = function end(endedByRPC) { + if (this.rpcImpl) { + if (!endedByRPC) // signal end to rpcImpl + this.rpcImpl(null, null, null); + this.rpcImpl = null; + this.emit("end").off(); + } + return this; +}; + + +/***/ }), + +/***/ 30338: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +module.exports = Service; + +// extends Namespace +var Namespace = __nccwpck_require__(21946); +((Service.prototype = Object.create(Namespace.prototype)).constructor = Service).className = "Service"; + +var Method = __nccwpck_require__(59988), + util = __nccwpck_require__(39609), + rpc = __nccwpck_require__(9882); + +/** + * Constructs a new service instance. + * @classdesc Reflected service. + * @extends NamespaceBase + * @constructor + * @param {string} name Service name + * @param {Object.} [options] Service options + * @throws {TypeError} If arguments are invalid + */ +function Service(name, options) { + Namespace.call(this, name, options); + + /** + * Service methods. + * @type {Object.} + */ + this.methods = {}; // toJSON, marker + + /** + * Cached methods as an array. + * @type {Method[]|null} + * @private + */ + this._methodsArray = null; +} + +/** + * Service descriptor. + * @interface IService + * @extends INamespace + * @property {Object.} methods Method descriptors + */ + +/** + * Constructs a service from a service descriptor. + * @param {string} name Service name + * @param {IService} json Service descriptor + * @returns {Service} Created service + * @throws {TypeError} If arguments are invalid + */ +Service.fromJSON = function fromJSON(name, json) { + var service = new Service(name, json.options); + /* istanbul ignore else */ + if (json.methods) + for (var names = Object.keys(json.methods), i = 0; i < names.length; ++i) + service.add(Method.fromJSON(names[i], json.methods[names[i]])); + if (json.nested) + service.addJSON(json.nested); + if (json.edition) + service._edition = json.edition; + service.comment = json.comment; + service._defaultEdition = "proto3"; // For backwards-compatibility. + return service; +}; + +/** + * Converts this service to a service descriptor. + * @param {IToJSONOptions} [toJSONOptions] JSON conversion options + * @returns {IService} Service descriptor + */ +Service.prototype.toJSON = function toJSON(toJSONOptions) { + var inherited = Namespace.prototype.toJSON.call(this, toJSONOptions); + var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; + return util.toObject([ + "edition" , this._editionToJSON(), + "options" , inherited && inherited.options || undefined, + "methods" , Namespace.arrayToJSON(this.methodsArray, toJSONOptions) || /* istanbul ignore next */ {}, + "nested" , inherited && inherited.nested || undefined, + "comment" , keepComments ? this.comment : undefined + ]); +}; + +/** + * Methods of this service as an array for iteration. + * @name Service#methodsArray + * @type {Method[]} + * @readonly + */ +Object.defineProperty(Service.prototype, "methodsArray", { + get: function() { + return this._methodsArray || (this._methodsArray = util.toArray(this.methods)); + } +}); + +function clearCache(service) { + service._methodsArray = null; + return service; +} + +/** + * @override + */ +Service.prototype.get = function get(name) { + return this.methods[name] + || Namespace.prototype.get.call(this, name); +}; + +/** + * @override + */ +Service.prototype.resolveAll = function resolveAll() { + if (!this._needsRecursiveResolve) return this; + + Namespace.prototype.resolve.call(this); + var methods = this.methodsArray; + for (var i = 0; i < methods.length; ++i) + methods[i].resolve(); + return this; +}; + +/** + * @override + */ +Service.prototype._resolveFeaturesRecursive = function _resolveFeaturesRecursive(edition) { + if (!this._needsRecursiveFeatureResolution) return this; + + edition = this._edition || edition; + + Namespace.prototype._resolveFeaturesRecursive.call(this, edition); + this.methodsArray.forEach(method => { + method._resolveFeaturesRecursive(edition); + }); + return this; +}; + +/** + * @override + */ +Service.prototype.add = function add(object) { + + /* istanbul ignore if */ + if (this.get(object.name)) + throw Error("duplicate name '" + object.name + "' in " + this); + + if (object instanceof Method) { + this.methods[object.name] = object; + object.parent = this; + return clearCache(this); + } + return Namespace.prototype.add.call(this, object); +}; + +/** + * @override + */ +Service.prototype.remove = function remove(object) { + if (object instanceof Method) { + + /* istanbul ignore if */ + if (this.methods[object.name] !== object) + throw Error(object + " is not a member of " + this); + + delete this.methods[object.name]; + object.parent = null; + return clearCache(this); + } + return Namespace.prototype.remove.call(this, object); +}; + +/** + * Creates a runtime service using the specified rpc implementation. + * @param {RPCImpl} rpcImpl RPC implementation + * @param {boolean} [requestDelimited=false] Whether requests are length-delimited + * @param {boolean} [responseDelimited=false] Whether responses are length-delimited + * @returns {rpc.Service} RPC service. Useful where requests and/or responses are streamed. + */ +Service.prototype.create = function create(rpcImpl, requestDelimited, responseDelimited) { + var rpcService = new rpc.Service(rpcImpl, requestDelimited, responseDelimited); + for (var i = 0, method; i < /* initializes */ this.methodsArray.length; ++i) { + var methodName = util.lcFirst((method = this._methodsArray[i]).resolve().name).replace(/[^$\w_]/g, ""); + rpcService[methodName] = util.codegen(["r","c"], util.isReserved(methodName) ? methodName + "_" : methodName)("return this.rpcCall(m,q,s,r,c)")({ + m: method, + q: method.resolvedRequestType.ctor, + s: method.resolvedResponseType.ctor + }); + } + return rpcService; +}; + + +/***/ }), + +/***/ 580: +/***/ ((module) => { + +"use strict"; + +module.exports = tokenize; + +var delimRe = /[\s{}=;:[\],'"()<>]/g, + stringDoubleRe = /(?:"([^"\\]*(?:\\.[^"\\]*)*)")/g, + stringSingleRe = /(?:'([^'\\]*(?:\\.[^'\\]*)*)')/g; + +var setCommentRe = /^ *[*/]+ */, + setCommentAltRe = /^\s*\*?\/*/, + setCommentSplitRe = /\n/g, + whitespaceRe = /\s/, + unescapeRe = /\\(.?)/g; + +var unescapeMap = { + "0": "\0", + "r": "\r", + "n": "\n", + "t": "\t" +}; + +/** + * Unescapes a string. + * @param {string} str String to unescape + * @returns {string} Unescaped string + * @property {Object.} map Special characters map + * @memberof tokenize + */ +function unescape(str) { + return str.replace(unescapeRe, function($0, $1) { + switch ($1) { + case "\\": + case "": + return $1; + default: + return unescapeMap[$1] || ""; + } + }); +} + +tokenize.unescape = unescape; + +/** + * Gets the next token and advances. + * @typedef TokenizerHandleNext + * @type {function} + * @returns {string|null} Next token or `null` on eof + */ + +/** + * Peeks for the next token. + * @typedef TokenizerHandlePeek + * @type {function} + * @returns {string|null} Next token or `null` on eof + */ + +/** + * Pushes a token back to the stack. + * @typedef TokenizerHandlePush + * @type {function} + * @param {string} token Token + * @returns {undefined} + */ + +/** + * Skips the next token. + * @typedef TokenizerHandleSkip + * @type {function} + * @param {string} expected Expected token + * @param {boolean} [optional=false] If optional + * @returns {boolean} Whether the token matched + * @throws {Error} If the token didn't match and is not optional + */ + +/** + * Gets the comment on the previous line or, alternatively, the line comment on the specified line. + * @typedef TokenizerHandleCmnt + * @type {function} + * @param {number} [line] Line number + * @returns {string|null} Comment text or `null` if none + */ + +/** + * Handle object returned from {@link tokenize}. + * @interface ITokenizerHandle + * @property {TokenizerHandleNext} next Gets the next token and advances (`null` on eof) + * @property {TokenizerHandlePeek} peek Peeks for the next token (`null` on eof) + * @property {TokenizerHandlePush} push Pushes a token back to the stack + * @property {TokenizerHandleSkip} skip Skips a token, returns its presence and advances or, if non-optional and not present, throws + * @property {TokenizerHandleCmnt} cmnt Gets the comment on the previous line or the line comment on the specified line, if any + * @property {number} line Current line number + */ + +/** + * Tokenizes the given .proto source and returns an object with useful utility functions. + * @param {string} source Source contents + * @param {boolean} alternateCommentMode Whether we should activate alternate comment parsing mode. + * @returns {ITokenizerHandle} Tokenizer handle + */ +function tokenize(source, alternateCommentMode) { + /* eslint-disable callback-return */ + source = source.toString(); + + var offset = 0, + length = source.length, + line = 1, + lastCommentLine = 0, + comments = {}; + + var stack = []; + + var stringDelim = null; + + /* istanbul ignore next */ + /** + * Creates an error for illegal syntax. + * @param {string} subject Subject + * @returns {Error} Error created + * @inner + */ + function illegal(subject) { + return Error("illegal " + subject + " (line " + line + ")"); + } + + /** + * Reads a string till its end. + * @returns {string} String read + * @inner + */ + function readString() { + var re = stringDelim === "'" ? stringSingleRe : stringDoubleRe; + re.lastIndex = offset - 1; + var match = re.exec(source); + if (!match) + throw illegal("string"); + offset = re.lastIndex; + push(stringDelim); + stringDelim = null; + return unescape(match[1]); + } + + /** + * Gets the character at `pos` within the source. + * @param {number} pos Position + * @returns {string} Character + * @inner + */ + function charAt(pos) { + return source.charAt(pos); + } + + /** + * Sets the current comment text. + * @param {number} start Start offset + * @param {number} end End offset + * @param {boolean} isLeading set if a leading comment + * @returns {undefined} + * @inner + */ + function setComment(start, end, isLeading) { + var comment = { + type: source.charAt(start++), + lineEmpty: false, + leading: isLeading, + }; + var lookback; + if (alternateCommentMode) { + lookback = 2; // alternate comment parsing: "//" or "/*" + } else { + lookback = 3; // "///" or "/**" + } + var commentOffset = start - lookback, + c; + do { + if (--commentOffset < 0 || + (c = source.charAt(commentOffset)) === "\n") { + comment.lineEmpty = true; + break; + } + } while (c === " " || c === "\t"); + var lines = source + .substring(start, end) + .split(setCommentSplitRe); + for (var i = 0; i < lines.length; ++i) + lines[i] = lines[i] + .replace(alternateCommentMode ? setCommentAltRe : setCommentRe, "") + .trim(); + comment.text = lines + .join("\n") + .trim(); + + comments[line] = comment; + lastCommentLine = line; + } + + function isDoubleSlashCommentLine(startOffset) { + var endOffset = findEndOfLine(startOffset); + + // see if remaining line matches comment pattern + var lineText = source.substring(startOffset, endOffset); + var isComment = /^\s*\/\//.test(lineText); + return isComment; + } + + function findEndOfLine(cursor) { + // find end of cursor's line + var endOffset = cursor; + while (endOffset < length && charAt(endOffset) !== "\n") { + endOffset++; + } + return endOffset; + } + + /** + * Obtains the next token. + * @returns {string|null} Next token or `null` on eof + * @inner + */ + function next() { + if (stack.length > 0) + return stack.shift(); + if (stringDelim) + return readString(); + var repeat, + prev, + curr, + start, + isDoc, + isLeadingComment = offset === 0; + do { + if (offset === length) + return null; + repeat = false; + while (whitespaceRe.test(curr = charAt(offset))) { + if (curr === "\n") { + isLeadingComment = true; + ++line; + } + if (++offset === length) + return null; + } + + if (charAt(offset) === "/") { + if (++offset === length) { + throw illegal("comment"); + } + if (charAt(offset) === "/") { // Line + if (!alternateCommentMode) { + // check for triple-slash comment + isDoc = charAt(start = offset + 1) === "/"; + + while (charAt(++offset) !== "\n") { + if (offset === length) { + return null; + } + } + ++offset; + if (isDoc) { + setComment(start, offset - 1, isLeadingComment); + // Trailing comment cannot not be multi-line, + // so leading comment state should be reset to handle potential next comments + isLeadingComment = true; + } + ++line; + repeat = true; + } else { + // check for double-slash comments, consolidating consecutive lines + start = offset; + isDoc = false; + if (isDoubleSlashCommentLine(offset - 1)) { + isDoc = true; + do { + offset = findEndOfLine(offset); + if (offset === length) { + break; + } + offset++; + if (!isLeadingComment) { + // Trailing comment cannot not be multi-line + break; + } + } while (isDoubleSlashCommentLine(offset)); + } else { + offset = Math.min(length, findEndOfLine(offset) + 1); + } + if (isDoc) { + setComment(start, offset, isLeadingComment); + isLeadingComment = true; + } + line++; + repeat = true; + } + } else if ((curr = charAt(offset)) === "*") { /* Block */ + // check for /** (regular comment mode) or /* (alternate comment mode) + start = offset + 1; + isDoc = alternateCommentMode || charAt(start) === "*"; + do { + if (curr === "\n") { + ++line; + } + if (++offset === length) { + throw illegal("comment"); + } + prev = curr; + curr = charAt(offset); + } while (prev !== "*" || curr !== "/"); + ++offset; + if (isDoc) { + setComment(start, offset - 2, isLeadingComment); + isLeadingComment = true; + } + repeat = true; + } else { + return "/"; + } + } + } while (repeat); + + // offset !== length if we got here + + var end = offset; + delimRe.lastIndex = 0; + var delim = delimRe.test(charAt(end++)); + if (!delim) + while (end < length && !delimRe.test(charAt(end))) + ++end; + var token = source.substring(offset, offset = end); + if (token === "\"" || token === "'") + stringDelim = token; + return token; + } + + /** + * Pushes a token back to the stack. + * @param {string} token Token + * @returns {undefined} + * @inner + */ + function push(token) { + stack.push(token); + } + + /** + * Peeks for the next token. + * @returns {string|null} Token or `null` on eof + * @inner + */ + function peek() { + if (!stack.length) { + var token = next(); + if (token === null) + return null; + push(token); + } + return stack[0]; + } + + /** + * Skips a token. + * @param {string} expected Expected token + * @param {boolean} [optional=false] Whether the token is optional + * @returns {boolean} `true` when skipped, `false` if not + * @throws {Error} When a required token is not present + * @inner + */ + function skip(expected, optional) { + var actual = peek(), + equals = actual === expected; + if (equals) { + next(); + return true; + } + if (!optional) + throw illegal("token '" + actual + "', '" + expected + "' expected"); + return false; + } + + /** + * Gets a comment. + * @param {number} [trailingLine] Line number if looking for a trailing comment + * @returns {string|null} Comment text + * @inner + */ + function cmnt(trailingLine) { + var ret = null; + var comment; + if (trailingLine === undefined) { + comment = comments[line - 1]; + delete comments[line - 1]; + if (comment && (alternateCommentMode || comment.type === "*" || comment.lineEmpty)) { + ret = comment.leading ? comment.text : null; + } + } else { + /* istanbul ignore else */ + if (lastCommentLine < trailingLine) { + peek(); + } + comment = comments[trailingLine]; + delete comments[trailingLine]; + if (comment && !comment.lineEmpty && (alternateCommentMode || comment.type === "/")) { + ret = comment.leading ? null : comment.text; + } + } + return ret; + } + + return Object.defineProperty({ + next: next, + peek: peek, + push: push, + skip: skip, + cmnt: cmnt + }, "line", { + get: function() { return line; } + }); + /* eslint-enable callback-return */ +} + + +/***/ }), + +/***/ 70901: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +module.exports = Type; + +// extends Namespace +var Namespace = __nccwpck_require__(21946); +((Type.prototype = Object.create(Namespace.prototype)).constructor = Type).className = "Type"; + +var Enum = __nccwpck_require__(73528), + OneOf = __nccwpck_require__(84624), + Field = __nccwpck_require__(30457), + MapField = __nccwpck_require__(58791), + Service = __nccwpck_require__(30338), + Message = __nccwpck_require__(69450), + Reader = __nccwpck_require__(69350), + Writer = __nccwpck_require__(33654), + util = __nccwpck_require__(39609), + encoder = __nccwpck_require__(67641), + decoder = __nccwpck_require__(45301), + verifier = __nccwpck_require__(7639), + converter = __nccwpck_require__(92437), + wrappers = __nccwpck_require__(59781); + +/** + * Constructs a new reflected message type instance. + * @classdesc Reflected message type. + * @extends NamespaceBase + * @constructor + * @param {string} name Message name + * @param {Object.} [options] Declared options + */ +function Type(name, options) { + Namespace.call(this, name, options); + + /** + * Message fields. + * @type {Object.} + */ + this.fields = {}; // toJSON, marker + + /** + * Oneofs declared within this namespace, if any. + * @type {Object.} + */ + this.oneofs = undefined; // toJSON + + /** + * Extension ranges, if any. + * @type {number[][]} + */ + this.extensions = undefined; // toJSON + + /** + * Reserved ranges, if any. + * @type {Array.} + */ + this.reserved = undefined; // toJSON + + /*? + * Whether this type is a legacy group. + * @type {boolean|undefined} + */ + this.group = undefined; // toJSON + + /** + * Cached fields by id. + * @type {Object.|null} + * @private + */ + this._fieldsById = null; + + /** + * Cached fields as an array. + * @type {Field[]|null} + * @private + */ + this._fieldsArray = null; + + /** + * Cached oneofs as an array. + * @type {OneOf[]|null} + * @private + */ + this._oneofsArray = null; + + /** + * Cached constructor. + * @type {Constructor<{}>} + * @private + */ + this._ctor = null; +} + +Object.defineProperties(Type.prototype, { + + /** + * Message fields by id. + * @name Type#fieldsById + * @type {Object.} + * @readonly + */ + fieldsById: { + get: function() { + + /* istanbul ignore if */ + if (this._fieldsById) + return this._fieldsById; + + this._fieldsById = {}; + for (var names = Object.keys(this.fields), i = 0; i < names.length; ++i) { + var field = this.fields[names[i]], + id = field.id; + + /* istanbul ignore if */ + if (this._fieldsById[id]) + throw Error("duplicate id " + id + " in " + this); + + this._fieldsById[id] = field; + } + return this._fieldsById; + } + }, + + /** + * Fields of this message as an array for iteration. + * @name Type#fieldsArray + * @type {Field[]} + * @readonly + */ + fieldsArray: { + get: function() { + return this._fieldsArray || (this._fieldsArray = util.toArray(this.fields)); + } + }, + + /** + * Oneofs of this message as an array for iteration. + * @name Type#oneofsArray + * @type {OneOf[]} + * @readonly + */ + oneofsArray: { + get: function() { + return this._oneofsArray || (this._oneofsArray = util.toArray(this.oneofs)); + } + }, + + /** + * The registered constructor, if any registered, otherwise a generic constructor. + * Assigning a function replaces the internal constructor. If the function does not extend {@link Message} yet, its prototype will be setup accordingly and static methods will be populated. If it already extends {@link Message}, it will just replace the internal constructor. + * @name Type#ctor + * @type {Constructor<{}>} + */ + ctor: { + get: function() { + return this._ctor || (this.ctor = Type.generateConstructor(this)()); + }, + set: function(ctor) { + + // Ensure proper prototype + var prototype = ctor.prototype; + if (!(prototype instanceof Message)) { + (ctor.prototype = new Message()).constructor = ctor; + util.merge(ctor.prototype, prototype); + } + + // Classes and messages reference their reflected type + ctor.$type = ctor.prototype.$type = this; + + // Mix in static methods + util.merge(ctor, Message, true); + + this._ctor = ctor; + + // Messages have non-enumerable default values on their prototype + var i = 0; + for (; i < /* initializes */ this.fieldsArray.length; ++i) + this._fieldsArray[i].resolve(); // ensures a proper value + + // Messages have non-enumerable getters and setters for each virtual oneof field + var ctorProperties = {}; + for (i = 0; i < /* initializes */ this.oneofsArray.length; ++i) + ctorProperties[this._oneofsArray[i].resolve().name] = { + get: util.oneOfGetter(this._oneofsArray[i].oneof), + set: util.oneOfSetter(this._oneofsArray[i].oneof) + }; + if (i) + Object.defineProperties(ctor.prototype, ctorProperties); + } + } +}); + +/** + * Generates a constructor function for the specified type. + * @param {Type} mtype Message type + * @returns {Codegen} Codegen instance + */ +Type.generateConstructor = function generateConstructor(mtype) { + /* eslint-disable no-unexpected-multiline */ + var gen = util.codegen(["p"], mtype.name); + // explicitly initialize mutable object/array fields so that these aren't just inherited from the prototype + for (var i = 0, field; i < mtype.fieldsArray.length; ++i) + if ((field = mtype._fieldsArray[i]).map) gen + ("this%s={}", util.safeProp(field.name)); + else if (field.repeated) gen + ("this%s=[]", util.safeProp(field.name)); + return gen + ("if(p)for(var ks=Object.keys(p),i=0;i} [oneofs] Oneof descriptors + * @property {Object.} fields Field descriptors + * @property {number[][]} [extensions] Extension ranges + * @property {Array.} [reserved] Reserved ranges + * @property {boolean} [group=false] Whether a legacy group or not + */ + +/** + * Creates a message type from a message type descriptor. + * @param {string} name Message name + * @param {IType} json Message type descriptor + * @returns {Type} Created message type + */ +Type.fromJSON = function fromJSON(name, json) { + var type = new Type(name, json.options); + type.extensions = json.extensions; + type.reserved = json.reserved; + var names = Object.keys(json.fields), + i = 0; + for (; i < names.length; ++i) + type.add( + ( typeof json.fields[names[i]].keyType !== "undefined" + ? MapField.fromJSON + : Field.fromJSON )(names[i], json.fields[names[i]]) + ); + if (json.oneofs) + for (names = Object.keys(json.oneofs), i = 0; i < names.length; ++i) + type.add(OneOf.fromJSON(names[i], json.oneofs[names[i]])); + if (json.nested) + for (names = Object.keys(json.nested), i = 0; i < names.length; ++i) { + var nested = json.nested[names[i]]; + type.add( // most to least likely + ( nested.id !== undefined + ? Field.fromJSON + : nested.fields !== undefined + ? Type.fromJSON + : nested.values !== undefined + ? Enum.fromJSON + : nested.methods !== undefined + ? Service.fromJSON + : Namespace.fromJSON )(names[i], nested) + ); + } + if (json.extensions && json.extensions.length) + type.extensions = json.extensions; + if (json.reserved && json.reserved.length) + type.reserved = json.reserved; + if (json.group) + type.group = true; + if (json.comment) + type.comment = json.comment; + if (json.edition) + type._edition = json.edition; + type._defaultEdition = "proto3"; // For backwards-compatibility. + return type; +}; + +/** + * Converts this message type to a message type descriptor. + * @param {IToJSONOptions} [toJSONOptions] JSON conversion options + * @returns {IType} Message type descriptor + */ +Type.prototype.toJSON = function toJSON(toJSONOptions) { + var inherited = Namespace.prototype.toJSON.call(this, toJSONOptions); + var keepComments = toJSONOptions ? Boolean(toJSONOptions.keepComments) : false; + return util.toObject([ + "edition" , this._editionToJSON(), + "options" , inherited && inherited.options || undefined, + "oneofs" , Namespace.arrayToJSON(this.oneofsArray, toJSONOptions), + "fields" , Namespace.arrayToJSON(this.fieldsArray.filter(function(obj) { return !obj.declaringField; }), toJSONOptions) || {}, + "extensions" , this.extensions && this.extensions.length ? this.extensions : undefined, + "reserved" , this.reserved && this.reserved.length ? this.reserved : undefined, + "group" , this.group || undefined, + "nested" , inherited && inherited.nested || undefined, + "comment" , keepComments ? this.comment : undefined + ]); +}; + +/** + * @override + */ +Type.prototype.resolveAll = function resolveAll() { + if (!this._needsRecursiveResolve) return this; + + Namespace.prototype.resolveAll.call(this); + var oneofs = this.oneofsArray; i = 0; + while (i < oneofs.length) + oneofs[i++].resolve(); + var fields = this.fieldsArray, i = 0; + while (i < fields.length) + fields[i++].resolve(); + return this; +}; + +/** + * @override + */ +Type.prototype._resolveFeaturesRecursive = function _resolveFeaturesRecursive(edition) { + if (!this._needsRecursiveFeatureResolution) return this; + + edition = this._edition || edition; + + Namespace.prototype._resolveFeaturesRecursive.call(this, edition); + this.oneofsArray.forEach(oneof => { + oneof._resolveFeatures(edition); + }); + this.fieldsArray.forEach(field => { + field._resolveFeatures(edition); + }); + return this; +}; + +/** + * @override + */ +Type.prototype.get = function get(name) { + return this.fields[name] + || this.oneofs && this.oneofs[name] + || this.nested && this.nested[name] + || null; +}; + +/** + * Adds a nested object to this type. + * @param {ReflectionObject} object Nested object to add + * @returns {Type} `this` + * @throws {TypeError} If arguments are invalid + * @throws {Error} If there is already a nested object with this name or, if a field, when there is already a field with this id + */ +Type.prototype.add = function add(object) { + + if (this.get(object.name)) + throw Error("duplicate name '" + object.name + "' in " + this); + + if (object instanceof Field && object.extend === undefined) { + // NOTE: Extension fields aren't actual fields on the declaring type, but nested objects. + // The root object takes care of adding distinct sister-fields to the respective extended + // type instead. + + // avoids calling the getter if not absolutely necessary because it's called quite frequently + if (this._fieldsById ? /* istanbul ignore next */ this._fieldsById[object.id] : this.fieldsById[object.id]) + throw Error("duplicate id " + object.id + " in " + this); + if (this.isReservedId(object.id)) + throw Error("id " + object.id + " is reserved in " + this); + if (this.isReservedName(object.name)) + throw Error("name '" + object.name + "' is reserved in " + this); + + if (object.parent) + object.parent.remove(object); + this.fields[object.name] = object; + object.message = this; + object.onAdd(this); + return clearCache(this); + } + if (object instanceof OneOf) { + if (!this.oneofs) + this.oneofs = {}; + this.oneofs[object.name] = object; + object.onAdd(this); + return clearCache(this); + } + return Namespace.prototype.add.call(this, object); +}; + +/** + * Removes a nested object from this type. + * @param {ReflectionObject} object Nested object to remove + * @returns {Type} `this` + * @throws {TypeError} If arguments are invalid + * @throws {Error} If `object` is not a member of this type + */ +Type.prototype.remove = function remove(object) { + if (object instanceof Field && object.extend === undefined) { + // See Type#add for the reason why extension fields are excluded here. + + /* istanbul ignore if */ + if (!this.fields || this.fields[object.name] !== object) + throw Error(object + " is not a member of " + this); + + delete this.fields[object.name]; + object.parent = null; + object.onRemove(this); + return clearCache(this); + } + if (object instanceof OneOf) { + + /* istanbul ignore if */ + if (!this.oneofs || this.oneofs[object.name] !== object) + throw Error(object + " is not a member of " + this); + + delete this.oneofs[object.name]; + object.parent = null; + object.onRemove(this); + return clearCache(this); + } + return Namespace.prototype.remove.call(this, object); +}; + +/** + * Tests if the specified id is reserved. + * @param {number} id Id to test + * @returns {boolean} `true` if reserved, otherwise `false` + */ +Type.prototype.isReservedId = function isReservedId(id) { + return Namespace.isReservedId(this.reserved, id); +}; + +/** + * Tests if the specified name is reserved. + * @param {string} name Name to test + * @returns {boolean} `true` if reserved, otherwise `false` + */ +Type.prototype.isReservedName = function isReservedName(name) { + return Namespace.isReservedName(this.reserved, name); +}; + +/** + * Creates a new message of this type using the specified properties. + * @param {Object.} [properties] Properties to set + * @returns {Message<{}>} Message instance + */ +Type.prototype.create = function create(properties) { + return new this.ctor(properties); +}; + +/** + * Sets up {@link Type#encode|encode}, {@link Type#decode|decode} and {@link Type#verify|verify}. + * @returns {Type} `this` + */ +Type.prototype.setup = function setup() { + // Sets up everything at once so that the prototype chain does not have to be re-evaluated + // multiple times (V8, soft-deopt prototype-check). + + var fullName = this.fullName, + types = []; + for (var i = 0; i < /* initializes */ this.fieldsArray.length; ++i) + types.push(this._fieldsArray[i].resolve().resolvedType); + + // Replace setup methods with type-specific generated functions + this.encode = encoder(this)({ + Writer : Writer, + types : types, + util : util + }); + this.decode = decoder(this)({ + Reader : Reader, + types : types, + util : util + }); + this.verify = verifier(this)({ + types : types, + util : util + }); + this.fromObject = converter.fromObject(this)({ + types : types, + util : util + }); + this.toObject = converter.toObject(this)({ + types : types, + util : util + }); + + // Inject custom wrappers for common types + var wrapper = wrappers[fullName]; + if (wrapper) { + var originalThis = Object.create(this); + // if (wrapper.fromObject) { + originalThis.fromObject = this.fromObject; + this.fromObject = wrapper.fromObject.bind(originalThis); + // } + // if (wrapper.toObject) { + originalThis.toObject = this.toObject; + this.toObject = wrapper.toObject.bind(originalThis); + // } + } + + return this; +}; + +/** + * Encodes a message of this type. Does not implicitly {@link Type#verify|verify} messages. + * @param {Message<{}>|Object.} message Message instance or plain object + * @param {Writer} [writer] Writer to encode to + * @returns {Writer} writer + */ +Type.prototype.encode = function encode_setup(message, writer) { + return this.setup().encode(message, writer); // overrides this method +}; + +/** + * Encodes a message of this type preceeded by its byte length as a varint. Does not implicitly {@link Type#verify|verify} messages. + * @param {Message<{}>|Object.} message Message instance or plain object + * @param {Writer} [writer] Writer to encode to + * @returns {Writer} writer + */ +Type.prototype.encodeDelimited = function encodeDelimited(message, writer) { + return this.encode(message, writer && writer.len ? writer.fork() : writer).ldelim(); +}; + +/** + * Decodes a message of this type. + * @param {Reader|Uint8Array} reader Reader or buffer to decode from + * @param {number} [length] Length of the message, if known beforehand + * @returns {Message<{}>} Decoded message + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {util.ProtocolError<{}>} If required fields are missing + */ +Type.prototype.decode = function decode_setup(reader, length) { + return this.setup().decode(reader, length); // overrides this method +}; + +/** + * Decodes a message of this type preceeded by its byte length as a varint. + * @param {Reader|Uint8Array} reader Reader or buffer to decode from + * @returns {Message<{}>} Decoded message + * @throws {Error} If the payload is not a reader or valid buffer + * @throws {util.ProtocolError} If required fields are missing + */ +Type.prototype.decodeDelimited = function decodeDelimited(reader) { + if (!(reader instanceof Reader)) + reader = Reader.create(reader); + return this.decode(reader, reader.uint32()); +}; + +/** + * Verifies that field values are valid and that required fields are present. + * @param {Object.} message Plain object to verify + * @returns {null|string} `null` if valid, otherwise the reason why it is not + */ +Type.prototype.verify = function verify_setup(message) { + return this.setup().verify(message); // overrides this method +}; + +/** + * Creates a new message of this type from a plain object. Also converts values to their respective internal types. + * @param {Object.} object Plain object to convert + * @returns {Message<{}>} Message instance + */ +Type.prototype.fromObject = function fromObject(object) { + return this.setup().fromObject(object); +}; + +/** + * Conversion options as used by {@link Type#toObject} and {@link Message.toObject}. + * @interface IConversionOptions + * @property {Function} [longs] Long conversion type. + * Valid values are `String` and `Number` (the global types). + * Defaults to copy the present value, which is a possibly unsafe number without and a {@link Long} with a long library. + * @property {Function} [enums] Enum value conversion type. + * Only valid value is `String` (the global type). + * Defaults to copy the present value, which is the numeric id. + * @property {Function} [bytes] Bytes value conversion type. + * Valid values are `Array` and (a base64 encoded) `String` (the global types). + * Defaults to copy the present value, which usually is a Buffer under node and an Uint8Array in the browser. + * @property {boolean} [defaults=false] Also sets default values on the resulting object + * @property {boolean} [arrays=false] Sets empty arrays for missing repeated fields even if `defaults=false` + * @property {boolean} [objects=false] Sets empty objects for missing map fields even if `defaults=false` + * @property {boolean} [oneofs=false] Includes virtual oneof properties set to the present field's name, if any + * @property {boolean} [json=false] Performs additional JSON compatibility conversions, i.e. NaN and Infinity to strings + */ + +/** + * Creates a plain object from a message of this type. Also converts values to other types if specified. + * @param {Message<{}>} message Message instance + * @param {IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + */ +Type.prototype.toObject = function toObject(message, options) { + return this.setup().toObject(message, options); +}; + +/** + * Decorator function as returned by {@link Type.d} (TypeScript). + * @typedef TypeDecorator + * @type {function} + * @param {Constructor} target Target constructor + * @returns {undefined} + * @template T extends Message + */ + +/** + * Type decorator (TypeScript). + * @param {string} [typeName] Type name, defaults to the constructor's name + * @returns {TypeDecorator} Decorator function + * @template T extends Message + */ +Type.d = function decorateType(typeName) { + return function typeDecorator(target) { + util.decorateType(target, typeName); + }; +}; + + +/***/ }), + +/***/ 21024: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + + +/** + * Common type constants. + * @namespace + */ +var types = exports; + +var util = __nccwpck_require__(39609); + +var s = [ + "double", // 0 + "float", // 1 + "int32", // 2 + "uint32", // 3 + "sint32", // 4 + "fixed32", // 5 + "sfixed32", // 6 + "int64", // 7 + "uint64", // 8 + "sint64", // 9 + "fixed64", // 10 + "sfixed64", // 11 + "bool", // 12 + "string", // 13 + "bytes" // 14 +]; + +function bake(values, offset) { + var i = 0, o = {}; + offset |= 0; + while (i < values.length) o[s[i + offset]] = values[i++]; + return o; +} + +/** + * Basic type wire types. + * @type {Object.} + * @const + * @property {number} double=1 Fixed64 wire type + * @property {number} float=5 Fixed32 wire type + * @property {number} int32=0 Varint wire type + * @property {number} uint32=0 Varint wire type + * @property {number} sint32=0 Varint wire type + * @property {number} fixed32=5 Fixed32 wire type + * @property {number} sfixed32=5 Fixed32 wire type + * @property {number} int64=0 Varint wire type + * @property {number} uint64=0 Varint wire type + * @property {number} sint64=0 Varint wire type + * @property {number} fixed64=1 Fixed64 wire type + * @property {number} sfixed64=1 Fixed64 wire type + * @property {number} bool=0 Varint wire type + * @property {number} string=2 Ldelim wire type + * @property {number} bytes=2 Ldelim wire type + */ +types.basic = bake([ + /* double */ 1, + /* float */ 5, + /* int32 */ 0, + /* uint32 */ 0, + /* sint32 */ 0, + /* fixed32 */ 5, + /* sfixed32 */ 5, + /* int64 */ 0, + /* uint64 */ 0, + /* sint64 */ 0, + /* fixed64 */ 1, + /* sfixed64 */ 1, + /* bool */ 0, + /* string */ 2, + /* bytes */ 2 +]); + +/** + * Basic type defaults. + * @type {Object.} + * @const + * @property {number} double=0 Double default + * @property {number} float=0 Float default + * @property {number} int32=0 Int32 default + * @property {number} uint32=0 Uint32 default + * @property {number} sint32=0 Sint32 default + * @property {number} fixed32=0 Fixed32 default + * @property {number} sfixed32=0 Sfixed32 default + * @property {number} int64=0 Int64 default + * @property {number} uint64=0 Uint64 default + * @property {number} sint64=0 Sint32 default + * @property {number} fixed64=0 Fixed64 default + * @property {number} sfixed64=0 Sfixed64 default + * @property {boolean} bool=false Bool default + * @property {string} string="" String default + * @property {Array.} bytes=Array(0) Bytes default + * @property {null} message=null Message default + */ +types.defaults = bake([ + /* double */ 0, + /* float */ 0, + /* int32 */ 0, + /* uint32 */ 0, + /* sint32 */ 0, + /* fixed32 */ 0, + /* sfixed32 */ 0, + /* int64 */ 0, + /* uint64 */ 0, + /* sint64 */ 0, + /* fixed64 */ 0, + /* sfixed64 */ 0, + /* bool */ false, + /* string */ "", + /* bytes */ util.emptyArray, + /* message */ null +]); + +/** + * Basic long type wire types. + * @type {Object.} + * @const + * @property {number} int64=0 Varint wire type + * @property {number} uint64=0 Varint wire type + * @property {number} sint64=0 Varint wire type + * @property {number} fixed64=1 Fixed64 wire type + * @property {number} sfixed64=1 Fixed64 wire type + */ +types.long = bake([ + /* int64 */ 0, + /* uint64 */ 0, + /* sint64 */ 0, + /* fixed64 */ 1, + /* sfixed64 */ 1 +], 7); + +/** + * Allowed types for map keys with their associated wire type. + * @type {Object.} + * @const + * @property {number} int32=0 Varint wire type + * @property {number} uint32=0 Varint wire type + * @property {number} sint32=0 Varint wire type + * @property {number} fixed32=5 Fixed32 wire type + * @property {number} sfixed32=5 Fixed32 wire type + * @property {number} int64=0 Varint wire type + * @property {number} uint64=0 Varint wire type + * @property {number} sint64=0 Varint wire type + * @property {number} fixed64=1 Fixed64 wire type + * @property {number} sfixed64=1 Fixed64 wire type + * @property {number} bool=0 Varint wire type + * @property {number} string=2 Ldelim wire type + */ +types.mapKey = bake([ + /* int32 */ 0, + /* uint32 */ 0, + /* sint32 */ 0, + /* fixed32 */ 5, + /* sfixed32 */ 5, + /* int64 */ 0, + /* uint64 */ 0, + /* sint64 */ 0, + /* fixed64 */ 1, + /* sfixed64 */ 1, + /* bool */ 0, + /* string */ 2 +], 2); + +/** + * Allowed types for packed repeated fields with their associated wire type. + * @type {Object.} + * @const + * @property {number} double=1 Fixed64 wire type + * @property {number} float=5 Fixed32 wire type + * @property {number} int32=0 Varint wire type + * @property {number} uint32=0 Varint wire type + * @property {number} sint32=0 Varint wire type + * @property {number} fixed32=5 Fixed32 wire type + * @property {number} sfixed32=5 Fixed32 wire type + * @property {number} int64=0 Varint wire type + * @property {number} uint64=0 Varint wire type + * @property {number} sint64=0 Varint wire type + * @property {number} fixed64=1 Fixed64 wire type + * @property {number} sfixed64=1 Fixed64 wire type + * @property {number} bool=0 Varint wire type + */ +types.packed = bake([ + /* double */ 1, + /* float */ 5, + /* int32 */ 0, + /* uint32 */ 0, + /* sint32 */ 0, + /* fixed32 */ 5, + /* sfixed32 */ 5, + /* int64 */ 0, + /* uint64 */ 0, + /* sint64 */ 0, + /* fixed64 */ 1, + /* sfixed64 */ 1, + /* bool */ 0 +]); + + +/***/ }), + +/***/ 39609: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +/** + * Various utility functions. + * @namespace + */ +var util = module.exports = __nccwpck_require__(22857); + +var roots = __nccwpck_require__(34460); + +var Type, // cyclic + Enum; + +util.codegen = __nccwpck_require__(25346); +util.fetch = __nccwpck_require__(44279); +util.path = __nccwpck_require__(66090); + +/** + * Node's fs module if available. + * @type {Object.} + */ +util.fs = util.inquire("fs"); + +/** + * Converts an object's values to an array. + * @param {Object.} object Object to convert + * @returns {Array.<*>} Converted array + */ +util.toArray = function toArray(object) { + if (object) { + var keys = Object.keys(object), + array = new Array(keys.length), + index = 0; + while (index < keys.length) + array[index] = object[keys[index++]]; + return array; + } + return []; +}; + +/** + * Converts an array of keys immediately followed by their respective value to an object, omitting undefined values. + * @param {Array.<*>} array Array to convert + * @returns {Object.} Converted object + */ +util.toObject = function toObject(array) { + var object = {}, + index = 0; + while (index < array.length) { + var key = array[index++], + val = array[index++]; + if (val !== undefined) + object[key] = val; + } + return object; +}; + +var safePropBackslashRe = /\\/g, + safePropQuoteRe = /"/g; + +/** + * Tests whether the specified name is a reserved word in JS. + * @param {string} name Name to test + * @returns {boolean} `true` if reserved, otherwise `false` + */ +util.isReserved = function isReserved(name) { + return /^(?:do|if|in|for|let|new|try|var|case|else|enum|eval|false|null|this|true|void|with|break|catch|class|const|super|throw|while|yield|delete|export|import|public|return|static|switch|typeof|default|extends|finally|package|private|continue|debugger|function|arguments|interface|protected|implements|instanceof)$/.test(name); +}; + +/** + * Returns a safe property accessor for the specified property name. + * @param {string} prop Property name + * @returns {string} Safe accessor + */ +util.safeProp = function safeProp(prop) { + if (!/^[$\w_]+$/.test(prop) || util.isReserved(prop)) + return "[\"" + prop.replace(safePropBackslashRe, "\\\\").replace(safePropQuoteRe, "\\\"") + "\"]"; + return "." + prop; +}; + +/** + * Converts the first character of a string to upper case. + * @param {string} str String to convert + * @returns {string} Converted string + */ +util.ucFirst = function ucFirst(str) { + return str.charAt(0).toUpperCase() + str.substring(1); +}; + +var camelCaseRe = /_([a-z])/g; + +/** + * Converts a string to camel case. + * @param {string} str String to convert + * @returns {string} Converted string + */ +util.camelCase = function camelCase(str) { + return str.substring(0, 1) + + str.substring(1) + .replace(camelCaseRe, function($0, $1) { return $1.toUpperCase(); }); +}; + +/** + * Compares reflected fields by id. + * @param {Field} a First field + * @param {Field} b Second field + * @returns {number} Comparison value + */ +util.compareFieldsById = function compareFieldsById(a, b) { + return a.id - b.id; +}; + +/** + * Decorator helper for types (TypeScript). + * @param {Constructor} ctor Constructor function + * @param {string} [typeName] Type name, defaults to the constructor's name + * @returns {Type} Reflected type + * @template T extends Message + * @property {Root} root Decorators root + */ +util.decorateType = function decorateType(ctor, typeName) { + + /* istanbul ignore if */ + if (ctor.$type) { + if (typeName && ctor.$type.name !== typeName) { + util.decorateRoot.remove(ctor.$type); + ctor.$type.name = typeName; + util.decorateRoot.add(ctor.$type); + } + return ctor.$type; + } + + /* istanbul ignore next */ + if (!Type) + Type = __nccwpck_require__(70901); + + var type = new Type(typeName || ctor.name); + util.decorateRoot.add(type); + type.ctor = ctor; // sets up .encode, .decode etc. + Object.defineProperty(ctor, "$type", { value: type, enumerable: false }); + Object.defineProperty(ctor.prototype, "$type", { value: type, enumerable: false }); + return type; +}; + +var decorateEnumIndex = 0; + +/** + * Decorator helper for enums (TypeScript). + * @param {Object} object Enum object + * @returns {Enum} Reflected enum + */ +util.decorateEnum = function decorateEnum(object) { + + /* istanbul ignore if */ + if (object.$type) + return object.$type; + + /* istanbul ignore next */ + if (!Enum) + Enum = __nccwpck_require__(73528); + + var enm = new Enum("Enum" + decorateEnumIndex++, object); + util.decorateRoot.add(enm); + Object.defineProperty(object, "$type", { value: enm, enumerable: false }); + return enm; +}; + + +/** + * Sets the value of a property by property path. If a value already exists, it is turned to an array + * @param {Object.} dst Destination object + * @param {string} path dot '.' delimited path of the property to set + * @param {Object} value the value to set + * @param {boolean|undefined} [ifNotSet] Sets the option only if it isn't currently set + * @returns {Object.} Destination object + */ +util.setProperty = function setProperty(dst, path, value, ifNotSet) { + function setProp(dst, path, value) { + var part = path.shift(); + if (part === "__proto__" || part === "prototype") { + return dst; + } + if (path.length > 0) { + dst[part] = setProp(dst[part] || {}, path, value); + } else { + var prevValue = dst[part]; + if (prevValue && ifNotSet) + return dst; + if (prevValue) + value = [].concat(prevValue).concat(value); + dst[part] = value; + } + return dst; + } + + if (typeof dst !== "object") + throw TypeError("dst must be an object"); + if (!path) + throw TypeError("path must be specified"); + + path = path.split("."); + return setProp(dst, path, value); +}; + +/** + * Decorator root (TypeScript). + * @name util.decorateRoot + * @type {Root} + * @readonly + */ +Object.defineProperty(util, "decorateRoot", { + get: function() { + return roots["decorated"] || (roots["decorated"] = new (__nccwpck_require__(8185))()); + } +}); + + +/***/ }), + +/***/ 70994: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +module.exports = LongBits; + +var util = __nccwpck_require__(22857); + +/** + * Constructs new long bits. + * @classdesc Helper class for working with the low and high bits of a 64 bit value. + * @memberof util + * @constructor + * @param {number} lo Low 32 bits, unsigned + * @param {number} hi High 32 bits, unsigned + */ +function LongBits(lo, hi) { + + // note that the casts below are theoretically unnecessary as of today, but older statically + // generated converter code might still call the ctor with signed 32bits. kept for compat. + + /** + * Low bits. + * @type {number} + */ + this.lo = lo >>> 0; + + /** + * High bits. + * @type {number} + */ + this.hi = hi >>> 0; +} + +/** + * Zero bits. + * @memberof util.LongBits + * @type {util.LongBits} + */ +var zero = LongBits.zero = new LongBits(0, 0); + +zero.toNumber = function() { return 0; }; +zero.zzEncode = zero.zzDecode = function() { return this; }; +zero.length = function() { return 1; }; + +/** + * Zero hash. + * @memberof util.LongBits + * @type {string} + */ +var zeroHash = LongBits.zeroHash = "\0\0\0\0\0\0\0\0"; + +/** + * Constructs new long bits from the specified number. + * @param {number} value Value + * @returns {util.LongBits} Instance + */ +LongBits.fromNumber = function fromNumber(value) { + if (value === 0) + return zero; + var sign = value < 0; + if (sign) + value = -value; + var lo = value >>> 0, + hi = (value - lo) / 4294967296 >>> 0; + if (sign) { + hi = ~hi >>> 0; + lo = ~lo >>> 0; + if (++lo > 4294967295) { + lo = 0; + if (++hi > 4294967295) + hi = 0; + } + } + return new LongBits(lo, hi); +}; + +/** + * Constructs new long bits from a number, long or string. + * @param {Long|number|string} value Value + * @returns {util.LongBits} Instance + */ +LongBits.from = function from(value) { + if (typeof value === "number") + return LongBits.fromNumber(value); + if (util.isString(value)) { + /* istanbul ignore else */ + if (util.Long) + value = util.Long.fromString(value); + else + return LongBits.fromNumber(parseInt(value, 10)); + } + return value.low || value.high ? new LongBits(value.low >>> 0, value.high >>> 0) : zero; +}; + +/** + * Converts this long bits to a possibly unsafe JavaScript number. + * @param {boolean} [unsigned=false] Whether unsigned or not + * @returns {number} Possibly unsafe number + */ +LongBits.prototype.toNumber = function toNumber(unsigned) { + if (!unsigned && this.hi >>> 31) { + var lo = ~this.lo + 1 >>> 0, + hi = ~this.hi >>> 0; + if (!lo) + hi = hi + 1 >>> 0; + return -(lo + hi * 4294967296); + } + return this.lo + this.hi * 4294967296; +}; + +/** + * Converts this long bits to a long. + * @param {boolean} [unsigned=false] Whether unsigned or not + * @returns {Long} Long + */ +LongBits.prototype.toLong = function toLong(unsigned) { + return util.Long + ? new util.Long(this.lo | 0, this.hi | 0, Boolean(unsigned)) + /* istanbul ignore next */ + : { low: this.lo | 0, high: this.hi | 0, unsigned: Boolean(unsigned) }; +}; + +var charCodeAt = String.prototype.charCodeAt; + +/** + * Constructs new long bits from the specified 8 characters long hash. + * @param {string} hash Hash + * @returns {util.LongBits} Bits + */ +LongBits.fromHash = function fromHash(hash) { + if (hash === zeroHash) + return zero; + return new LongBits( + ( charCodeAt.call(hash, 0) + | charCodeAt.call(hash, 1) << 8 + | charCodeAt.call(hash, 2) << 16 + | charCodeAt.call(hash, 3) << 24) >>> 0 + , + ( charCodeAt.call(hash, 4) + | charCodeAt.call(hash, 5) << 8 + | charCodeAt.call(hash, 6) << 16 + | charCodeAt.call(hash, 7) << 24) >>> 0 + ); +}; + +/** + * Converts this long bits to a 8 characters long hash. + * @returns {string} Hash + */ +LongBits.prototype.toHash = function toHash() { + return String.fromCharCode( + this.lo & 255, + this.lo >>> 8 & 255, + this.lo >>> 16 & 255, + this.lo >>> 24 , + this.hi & 255, + this.hi >>> 8 & 255, + this.hi >>> 16 & 255, + this.hi >>> 24 + ); +}; + +/** + * Zig-zag encodes this long bits. + * @returns {util.LongBits} `this` + */ +LongBits.prototype.zzEncode = function zzEncode() { + var mask = this.hi >> 31; + this.hi = ((this.hi << 1 | this.lo >>> 31) ^ mask) >>> 0; + this.lo = ( this.lo << 1 ^ mask) >>> 0; + return this; +}; + +/** + * Zig-zag decodes this long bits. + * @returns {util.LongBits} `this` + */ +LongBits.prototype.zzDecode = function zzDecode() { + var mask = -(this.lo & 1); + this.lo = ((this.lo >>> 1 | this.hi << 31) ^ mask) >>> 0; + this.hi = ( this.hi >>> 1 ^ mask) >>> 0; + return this; +}; + +/** + * Calculates the length of this longbits when encoded as a varint. + * @returns {number} Length + */ +LongBits.prototype.length = function length() { + var part0 = this.lo, + part1 = (this.lo >>> 28 | this.hi << 4) >>> 0, + part2 = this.hi >>> 24; + return part2 === 0 + ? part1 === 0 + ? part0 < 16384 + ? part0 < 128 ? 1 : 2 + : part0 < 2097152 ? 3 : 4 + : part1 < 16384 + ? part1 < 128 ? 5 : 6 + : part1 < 2097152 ? 7 : 8 + : part2 < 128 ? 9 : 10; +}; + + +/***/ }), + +/***/ 22857: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var util = exports; + +// used to return a Promise where callback is omitted +util.asPromise = __nccwpck_require__(92222); + +// converts to / from base64 encoded strings +util.base64 = __nccwpck_require__(25478); + +// base class of rpc.Service +util.EventEmitter = __nccwpck_require__(32491); + +// float handling accross browsers +util.float = __nccwpck_require__(8597); + +// requires modules optionally and hides the call from bundlers +util.inquire = __nccwpck_require__(77206); + +// converts to / from utf8 encoded strings +util.utf8 = __nccwpck_require__(70958); + +// provides a node-like buffer pool in the browser +util.pool = __nccwpck_require__(56239); + +// utility to work with the low and high bits of a 64 bit value +util.LongBits = __nccwpck_require__(70994); + +/** + * Whether running within node or not. + * @memberof util + * @type {boolean} + */ +util.isNode = Boolean(typeof global !== "undefined" + && global + && global.process + && global.process.versions + && global.process.versions.node); + +/** + * Global object reference. + * @memberof util + * @type {Object} + */ +util.global = util.isNode && global + || typeof window !== "undefined" && window + || typeof self !== "undefined" && self + || this; // eslint-disable-line no-invalid-this + +/** + * An immuable empty array. + * @memberof util + * @type {Array.<*>} + * @const + */ +util.emptyArray = Object.freeze ? Object.freeze([]) : /* istanbul ignore next */ []; // used on prototypes + +/** + * An immutable empty object. + * @type {Object} + * @const + */ +util.emptyObject = Object.freeze ? Object.freeze({}) : /* istanbul ignore next */ {}; // used on prototypes + +/** + * Tests if the specified value is an integer. + * @function + * @param {*} value Value to test + * @returns {boolean} `true` if the value is an integer + */ +util.isInteger = Number.isInteger || /* istanbul ignore next */ function isInteger(value) { + return typeof value === "number" && isFinite(value) && Math.floor(value) === value; +}; + +/** + * Tests if the specified value is a string. + * @param {*} value Value to test + * @returns {boolean} `true` if the value is a string + */ +util.isString = function isString(value) { + return typeof value === "string" || value instanceof String; +}; + +/** + * Tests if the specified value is a non-null object. + * @param {*} value Value to test + * @returns {boolean} `true` if the value is a non-null object + */ +util.isObject = function isObject(value) { + return value && typeof value === "object"; +}; + +/** + * Checks if a property on a message is considered to be present. + * This is an alias of {@link util.isSet}. + * @function + * @param {Object} obj Plain object or message instance + * @param {string} prop Property name + * @returns {boolean} `true` if considered to be present, otherwise `false` + */ +util.isset = + +/** + * Checks if a property on a message is considered to be present. + * @param {Object} obj Plain object or message instance + * @param {string} prop Property name + * @returns {boolean} `true` if considered to be present, otherwise `false` + */ +util.isSet = function isSet(obj, prop) { + var value = obj[prop]; + if (value != null && obj.hasOwnProperty(prop)) // eslint-disable-line eqeqeq, no-prototype-builtins + return typeof value !== "object" || (Array.isArray(value) ? value.length : Object.keys(value).length) > 0; + return false; +}; + +/** + * Any compatible Buffer instance. + * This is a minimal stand-alone definition of a Buffer instance. The actual type is that exported by node's typings. + * @interface Buffer + * @extends Uint8Array + */ + +/** + * Node's Buffer class if available. + * @type {Constructor} + */ +util.Buffer = (function() { + try { + var Buffer = util.inquire("buffer").Buffer; + // refuse to use non-node buffers if not explicitly assigned (perf reasons): + return Buffer.prototype.utf8Write ? Buffer : /* istanbul ignore next */ null; + } catch (e) { + /* istanbul ignore next */ + return null; + } +})(); + +// Internal alias of or polyfull for Buffer.from. +util._Buffer_from = null; + +// Internal alias of or polyfill for Buffer.allocUnsafe. +util._Buffer_allocUnsafe = null; + +/** + * Creates a new buffer of whatever type supported by the environment. + * @param {number|number[]} [sizeOrArray=0] Buffer size or number array + * @returns {Uint8Array|Buffer} Buffer + */ +util.newBuffer = function newBuffer(sizeOrArray) { + /* istanbul ignore next */ + return typeof sizeOrArray === "number" + ? util.Buffer + ? util._Buffer_allocUnsafe(sizeOrArray) + : new util.Array(sizeOrArray) + : util.Buffer + ? util._Buffer_from(sizeOrArray) + : typeof Uint8Array === "undefined" + ? sizeOrArray + : new Uint8Array(sizeOrArray); +}; + +/** + * Array implementation used in the browser. `Uint8Array` if supported, otherwise `Array`. + * @type {Constructor} + */ +util.Array = typeof Uint8Array !== "undefined" ? Uint8Array /* istanbul ignore next */ : Array; + +/** + * Any compatible Long instance. + * This is a minimal stand-alone definition of a Long instance. The actual type is that exported by long.js. + * @interface Long + * @property {number} low Low bits + * @property {number} high High bits + * @property {boolean} unsigned Whether unsigned or not + */ + +/** + * Long.js's Long class if available. + * @type {Constructor} + */ +util.Long = /* istanbul ignore next */ util.global.dcodeIO && /* istanbul ignore next */ util.global.dcodeIO.Long + || /* istanbul ignore next */ util.global.Long + || util.inquire("long"); + +/** + * Regular expression used to verify 2 bit (`bool`) map keys. + * @type {RegExp} + * @const + */ +util.key2Re = /^true|false|0|1$/; + +/** + * Regular expression used to verify 32 bit (`int32` etc.) map keys. + * @type {RegExp} + * @const + */ +util.key32Re = /^-?(?:0|[1-9][0-9]*)$/; + +/** + * Regular expression used to verify 64 bit (`int64` etc.) map keys. + * @type {RegExp} + * @const + */ +util.key64Re = /^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/; + +/** + * Converts a number or long to an 8 characters long hash string. + * @param {Long|number} value Value to convert + * @returns {string} Hash + */ +util.longToHash = function longToHash(value) { + return value + ? util.LongBits.from(value).toHash() + : util.LongBits.zeroHash; +}; + +/** + * Converts an 8 characters long hash string to a long or number. + * @param {string} hash Hash + * @param {boolean} [unsigned=false] Whether unsigned or not + * @returns {Long|number} Original value + */ +util.longFromHash = function longFromHash(hash, unsigned) { + var bits = util.LongBits.fromHash(hash); + if (util.Long) + return util.Long.fromBits(bits.lo, bits.hi, unsigned); + return bits.toNumber(Boolean(unsigned)); +}; + +/** + * Merges the properties of the source object into the destination object. + * @memberof util + * @param {Object.} dst Destination object + * @param {Object.} src Source object + * @param {boolean} [ifNotSet=false] Merges only if the key is not already set + * @returns {Object.} Destination object + */ +function merge(dst, src, ifNotSet) { // used by converters + for (var keys = Object.keys(src), i = 0; i < keys.length; ++i) + if (dst[keys[i]] === undefined || !ifNotSet) + dst[keys[i]] = src[keys[i]]; + return dst; +} + +util.merge = merge; + +/** + * Converts the first character of a string to lower case. + * @param {string} str String to convert + * @returns {string} Converted string + */ +util.lcFirst = function lcFirst(str) { + return str.charAt(0).toLowerCase() + str.substring(1); +}; + +/** + * Creates a custom error constructor. + * @memberof util + * @param {string} name Error name + * @returns {Constructor} Custom error constructor + */ +function newError(name) { + + function CustomError(message, properties) { + + if (!(this instanceof CustomError)) + return new CustomError(message, properties); + + // Error.call(this, message); + // ^ just returns a new error instance because the ctor can be called as a function + + Object.defineProperty(this, "message", { get: function() { return message; } }); + + /* istanbul ignore next */ + if (Error.captureStackTrace) // node + Error.captureStackTrace(this, CustomError); + else + Object.defineProperty(this, "stack", { value: new Error().stack || "" }); + + if (properties) + merge(this, properties); + } + + CustomError.prototype = Object.create(Error.prototype, { + constructor: { + value: CustomError, + writable: true, + enumerable: false, + configurable: true, + }, + name: { + get: function get() { return name; }, + set: undefined, + enumerable: false, + // configurable: false would accurately preserve the behavior of + // the original, but I'm guessing that was not intentional. + // For an actual error subclass, this property would + // be configurable. + configurable: true, + }, + toString: { + value: function value() { return this.name + ": " + this.message; }, + writable: true, + enumerable: false, + configurable: true, + }, + }); + + return CustomError; +} + +util.newError = newError; + +/** + * Constructs a new protocol error. + * @classdesc Error subclass indicating a protocol specifc error. + * @memberof util + * @extends Error + * @template T extends Message + * @constructor + * @param {string} message Error message + * @param {Object.} [properties] Additional properties + * @example + * try { + * MyMessage.decode(someBuffer); // throws if required fields are missing + * } catch (e) { + * if (e instanceof ProtocolError && e.instance) + * console.log("decoded so far: " + JSON.stringify(e.instance)); + * } + */ +util.ProtocolError = newError("ProtocolError"); + +/** + * So far decoded message instance. + * @name util.ProtocolError#instance + * @type {Message} + */ + +/** + * A OneOf getter as returned by {@link util.oneOfGetter}. + * @typedef OneOfGetter + * @type {function} + * @returns {string|undefined} Set field name, if any + */ + +/** + * Builds a getter for a oneof's present field name. + * @param {string[]} fieldNames Field names + * @returns {OneOfGetter} Unbound getter + */ +util.oneOfGetter = function getOneOf(fieldNames) { + var fieldMap = {}; + for (var i = 0; i < fieldNames.length; ++i) + fieldMap[fieldNames[i]] = 1; + + /** + * @returns {string|undefined} Set field name, if any + * @this Object + * @ignore + */ + return function() { // eslint-disable-line consistent-return + for (var keys = Object.keys(this), i = keys.length - 1; i > -1; --i) + if (fieldMap[keys[i]] === 1 && this[keys[i]] !== undefined && this[keys[i]] !== null) + return keys[i]; + }; +}; + +/** + * A OneOf setter as returned by {@link util.oneOfSetter}. + * @typedef OneOfSetter + * @type {function} + * @param {string|undefined} value Field name + * @returns {undefined} + */ + +/** + * Builds a setter for a oneof's present field name. + * @param {string[]} fieldNames Field names + * @returns {OneOfSetter} Unbound setter + */ +util.oneOfSetter = function setOneOf(fieldNames) { + + /** + * @param {string} name Field name + * @returns {undefined} + * @this Object + * @ignore + */ + return function(name) { + for (var i = 0; i < fieldNames.length; ++i) + if (fieldNames[i] !== name) + delete this[fieldNames[i]]; + }; +}; + +/** + * Default conversion options used for {@link Message#toJSON} implementations. + * + * These options are close to proto3's JSON mapping with the exception that internal types like Any are handled just like messages. More precisely: + * + * - Longs become strings + * - Enums become string keys + * - Bytes become base64 encoded strings + * - (Sub-)Messages become plain objects + * - Maps become plain objects with all string keys + * - Repeated fields become arrays + * - NaN and Infinity for float and double fields become strings + * + * @type {IConversionOptions} + * @see https://developers.google.com/protocol-buffers/docs/proto3?hl=en#json + */ +util.toJSONOptions = { + longs: String, + enums: String, + bytes: String, + json: true +}; + +// Sets up buffer utility according to the environment (called in index-minimal) +util._configure = function() { + var Buffer = util.Buffer; + /* istanbul ignore if */ + if (!Buffer) { + util._Buffer_from = util._Buffer_allocUnsafe = null; + return; + } + // because node 4.x buffers are incompatible & immutable + // see: https://github.com/dcodeIO/protobuf.js/pull/665 + util._Buffer_from = Buffer.from !== Uint8Array.from && Buffer.from || + /* istanbul ignore next */ + function Buffer_from(value, encoding) { + return new Buffer(value, encoding); + }; + util._Buffer_allocUnsafe = Buffer.allocUnsafe || + /* istanbul ignore next */ + function Buffer_allocUnsafe(size) { + return new Buffer(size); + }; +}; + + +/***/ }), + +/***/ 7639: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +module.exports = verifier; + +var Enum = __nccwpck_require__(73528), + util = __nccwpck_require__(39609); + +function invalid(field, expected) { + return field.name + ": " + expected + (field.repeated && expected !== "array" ? "[]" : field.map && expected !== "object" ? "{k:"+field.keyType+"}" : "") + " expected"; +} + +/** + * Generates a partial value verifier. + * @param {Codegen} gen Codegen instance + * @param {Field} field Reflected field + * @param {number} fieldIndex Field index + * @param {string} ref Variable reference + * @returns {Codegen} Codegen instance + * @ignore + */ +function genVerifyValue(gen, field, fieldIndex, ref) { + /* eslint-disable no-unexpected-multiline */ + if (field.resolvedType) { + if (field.resolvedType instanceof Enum) { gen + ("switch(%s){", ref) + ("default:") + ("return%j", invalid(field, "enum value")); + for (var keys = Object.keys(field.resolvedType.values), j = 0; j < keys.length; ++j) gen + ("case %i:", field.resolvedType.values[keys[j]]); + gen + ("break") + ("}"); + } else { + gen + ("{") + ("var e=types[%i].verify(%s);", fieldIndex, ref) + ("if(e)") + ("return%j+e", field.name + ".") + ("}"); + } + } else { + switch (field.type) { + case "int32": + case "uint32": + case "sint32": + case "fixed32": + case "sfixed32": gen + ("if(!util.isInteger(%s))", ref) + ("return%j", invalid(field, "integer")); + break; + case "int64": + case "uint64": + case "sint64": + case "fixed64": + case "sfixed64": gen + ("if(!util.isInteger(%s)&&!(%s&&util.isInteger(%s.low)&&util.isInteger(%s.high)))", ref, ref, ref, ref) + ("return%j", invalid(field, "integer|Long")); + break; + case "float": + case "double": gen + ("if(typeof %s!==\"number\")", ref) + ("return%j", invalid(field, "number")); + break; + case "bool": gen + ("if(typeof %s!==\"boolean\")", ref) + ("return%j", invalid(field, "boolean")); + break; + case "string": gen + ("if(!util.isString(%s))", ref) + ("return%j", invalid(field, "string")); + break; + case "bytes": gen + ("if(!(%s&&typeof %s.length===\"number\"||util.isString(%s)))", ref, ref, ref) + ("return%j", invalid(field, "buffer")); + break; + } + } + return gen; + /* eslint-enable no-unexpected-multiline */ +} + +/** + * Generates a partial key verifier. + * @param {Codegen} gen Codegen instance + * @param {Field} field Reflected field + * @param {string} ref Variable reference + * @returns {Codegen} Codegen instance + * @ignore + */ +function genVerifyKey(gen, field, ref) { + /* eslint-disable no-unexpected-multiline */ + switch (field.keyType) { + case "int32": + case "uint32": + case "sint32": + case "fixed32": + case "sfixed32": gen + ("if(!util.key32Re.test(%s))", ref) + ("return%j", invalid(field, "integer key")); + break; + case "int64": + case "uint64": + case "sint64": + case "fixed64": + case "sfixed64": gen + ("if(!util.key64Re.test(%s))", ref) // see comment above: x is ok, d is not + ("return%j", invalid(field, "integer|Long key")); + break; + case "bool": gen + ("if(!util.key2Re.test(%s))", ref) + ("return%j", invalid(field, "boolean key")); + break; + } + return gen; + /* eslint-enable no-unexpected-multiline */ +} + +/** + * Generates a verifier specific to the specified message type. + * @param {Type} mtype Message type + * @returns {Codegen} Codegen instance + */ +function verifier(mtype) { + /* eslint-disable no-unexpected-multiline */ + + var gen = util.codegen(["m"], mtype.name + "$verify") + ("if(typeof m!==\"object\"||m===null)") + ("return%j", "object expected"); + var oneofs = mtype.oneofsArray, + seenFirstField = {}; + if (oneofs.length) gen + ("var p={}"); + + for (var i = 0; i < /* initializes */ mtype.fieldsArray.length; ++i) { + var field = mtype._fieldsArray[i].resolve(), + ref = "m" + util.safeProp(field.name); + + if (field.optional) gen + ("if(%s!=null&&m.hasOwnProperty(%j)){", ref, field.name); // !== undefined && !== null + + // map fields + if (field.map) { gen + ("if(!util.isObject(%s))", ref) + ("return%j", invalid(field, "object")) + ("var k=Object.keys(%s)", ref) + ("for(var i=0;i { + +"use strict"; + + +/** + * Wrappers for common types. + * @type {Object.} + * @const + */ +var wrappers = exports; + +var Message = __nccwpck_require__(69450); + +/** + * From object converter part of an {@link IWrapper}. + * @typedef WrapperFromObjectConverter + * @type {function} + * @param {Object.} object Plain object + * @returns {Message<{}>} Message instance + * @this Type + */ + +/** + * To object converter part of an {@link IWrapper}. + * @typedef WrapperToObjectConverter + * @type {function} + * @param {Message<{}>} message Message instance + * @param {IConversionOptions} [options] Conversion options + * @returns {Object.} Plain object + * @this Type + */ + +/** + * Common type wrapper part of {@link wrappers}. + * @interface IWrapper + * @property {WrapperFromObjectConverter} [fromObject] From object converter + * @property {WrapperToObjectConverter} [toObject] To object converter + */ + +// Custom wrapper for Any +wrappers[".google.protobuf.Any"] = { + + fromObject: function(object) { + + // unwrap value type if mapped + if (object && object["@type"]) { + // Only use fully qualified type name after the last '/' + var name = object["@type"].substring(object["@type"].lastIndexOf("/") + 1); + var type = this.lookup(name); + /* istanbul ignore else */ + if (type) { + // type_url does not accept leading "." + var type_url = object["@type"].charAt(0) === "." ? + object["@type"].slice(1) : object["@type"]; + // type_url prefix is optional, but path seperator is required + if (type_url.indexOf("/") === -1) { + type_url = "/" + type_url; + } + return this.create({ + type_url: type_url, + value: type.encode(type.fromObject(object)).finish() + }); + } + } + + return this.fromObject(object); + }, + + toObject: function(message, options) { + + // Default prefix + var googleApi = "type.googleapis.com/"; + var prefix = ""; + var name = ""; + + // decode value if requested and unmapped + if (options && options.json && message.type_url && message.value) { + // Only use fully qualified type name after the last '/' + name = message.type_url.substring(message.type_url.lastIndexOf("/") + 1); + // Separate the prefix used + prefix = message.type_url.substring(0, message.type_url.lastIndexOf("/") + 1); + var type = this.lookup(name); + /* istanbul ignore else */ + if (type) + message = type.decode(message.value); + } + + // wrap value if unmapped + if (!(message instanceof this.ctor) && message instanceof Message) { + var object = message.$type.toObject(message, options); + var messageName = message.$type.fullName[0] === "." ? + message.$type.fullName.slice(1) : message.$type.fullName; + // Default to type.googleapis.com prefix if no prefix is used + if (prefix === "") { + prefix = googleApi; + } + name = prefix + messageName; + object["@type"] = name; + return object; + } + + return this.toObject(message, options); + } +}; + + +/***/ }), + +/***/ 33654: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +module.exports = Writer; + +var util = __nccwpck_require__(22857); + +var BufferWriter; // cyclic + +var LongBits = util.LongBits, + base64 = util.base64, + utf8 = util.utf8; + +/** + * Constructs a new writer operation instance. + * @classdesc Scheduled writer operation. + * @constructor + * @param {function(*, Uint8Array, number)} fn Function to call + * @param {number} len Value byte length + * @param {*} val Value to write + * @ignore + */ +function Op(fn, len, val) { + + /** + * Function to call. + * @type {function(Uint8Array, number, *)} + */ + this.fn = fn; + + /** + * Value byte length. + * @type {number} + */ + this.len = len; + + /** + * Next operation. + * @type {Writer.Op|undefined} + */ + this.next = undefined; + + /** + * Value to write. + * @type {*} + */ + this.val = val; // type varies +} + +/* istanbul ignore next */ +function noop() {} // eslint-disable-line no-empty-function + +/** + * Constructs a new writer state instance. + * @classdesc Copied writer state. + * @memberof Writer + * @constructor + * @param {Writer} writer Writer to copy state from + * @ignore + */ +function State(writer) { + + /** + * Current head. + * @type {Writer.Op} + */ + this.head = writer.head; + + /** + * Current tail. + * @type {Writer.Op} + */ + this.tail = writer.tail; + + /** + * Current buffer length. + * @type {number} + */ + this.len = writer.len; + + /** + * Next state. + * @type {State|null} + */ + this.next = writer.states; +} + +/** + * Constructs a new writer instance. + * @classdesc Wire format writer using `Uint8Array` if available, otherwise `Array`. + * @constructor + */ +function Writer() { + + /** + * Current length. + * @type {number} + */ + this.len = 0; + + /** + * Operations head. + * @type {Object} + */ + this.head = new Op(noop, 0, 0); + + /** + * Operations tail + * @type {Object} + */ + this.tail = this.head; + + /** + * Linked forked states. + * @type {Object|null} + */ + this.states = null; + + // When a value is written, the writer calculates its byte length and puts it into a linked + // list of operations to perform when finish() is called. This both allows us to allocate + // buffers of the exact required size and reduces the amount of work we have to do compared + // to first calculating over objects and then encoding over objects. In our case, the encoding + // part is just a linked list walk calling operations with already prepared values. +} + +var create = function create() { + return util.Buffer + ? function create_buffer_setup() { + return (Writer.create = function create_buffer() { + return new BufferWriter(); + })(); + } + /* istanbul ignore next */ + : function create_array() { + return new Writer(); + }; +}; + +/** + * Creates a new writer. + * @function + * @returns {BufferWriter|Writer} A {@link BufferWriter} when Buffers are supported, otherwise a {@link Writer} + */ +Writer.create = create(); + +/** + * Allocates a buffer of the specified size. + * @param {number} size Buffer size + * @returns {Uint8Array} Buffer + */ +Writer.alloc = function alloc(size) { + return new util.Array(size); +}; + +// Use Uint8Array buffer pool in the browser, just like node does with buffers +/* istanbul ignore else */ +if (util.Array !== Array) + Writer.alloc = util.pool(Writer.alloc, util.Array.prototype.subarray); + +/** + * Pushes a new operation to the queue. + * @param {function(Uint8Array, number, *)} fn Function to call + * @param {number} len Value byte length + * @param {number} val Value to write + * @returns {Writer} `this` + * @private + */ +Writer.prototype._push = function push(fn, len, val) { + this.tail = this.tail.next = new Op(fn, len, val); + this.len += len; + return this; +}; + +function writeByte(val, buf, pos) { + buf[pos] = val & 255; +} + +function writeVarint32(val, buf, pos) { + while (val > 127) { + buf[pos++] = val & 127 | 128; + val >>>= 7; + } + buf[pos] = val; +} + +/** + * Constructs a new varint writer operation instance. + * @classdesc Scheduled varint writer operation. + * @extends Op + * @constructor + * @param {number} len Value byte length + * @param {number} val Value to write + * @ignore + */ +function VarintOp(len, val) { + this.len = len; + this.next = undefined; + this.val = val; +} + +VarintOp.prototype = Object.create(Op.prototype); +VarintOp.prototype.fn = writeVarint32; + +/** + * Writes an unsigned 32 bit value as a varint. + * @param {number} value Value to write + * @returns {Writer} `this` + */ +Writer.prototype.uint32 = function write_uint32(value) { + // here, the call to this.push has been inlined and a varint specific Op subclass is used. + // uint32 is by far the most frequently used operation and benefits significantly from this. + this.len += (this.tail = this.tail.next = new VarintOp( + (value = value >>> 0) + < 128 ? 1 + : value < 16384 ? 2 + : value < 2097152 ? 3 + : value < 268435456 ? 4 + : 5, + value)).len; + return this; +}; + +/** + * Writes a signed 32 bit value as a varint. + * @function + * @param {number} value Value to write + * @returns {Writer} `this` + */ +Writer.prototype.int32 = function write_int32(value) { + return value < 0 + ? this._push(writeVarint64, 10, LongBits.fromNumber(value)) // 10 bytes per spec + : this.uint32(value); +}; + +/** + * Writes a 32 bit value as a varint, zig-zag encoded. + * @param {number} value Value to write + * @returns {Writer} `this` + */ +Writer.prototype.sint32 = function write_sint32(value) { + return this.uint32((value << 1 ^ value >> 31) >>> 0); +}; + +function writeVarint64(val, buf, pos) { + while (val.hi) { + buf[pos++] = val.lo & 127 | 128; + val.lo = (val.lo >>> 7 | val.hi << 25) >>> 0; + val.hi >>>= 7; + } + while (val.lo > 127) { + buf[pos++] = val.lo & 127 | 128; + val.lo = val.lo >>> 7; + } + buf[pos++] = val.lo; +} + +/** + * Writes an unsigned 64 bit value as a varint. + * @param {Long|number|string} value Value to write + * @returns {Writer} `this` + * @throws {TypeError} If `value` is a string and no long library is present. + */ +Writer.prototype.uint64 = function write_uint64(value) { + var bits = LongBits.from(value); + return this._push(writeVarint64, bits.length(), bits); +}; + +/** + * Writes a signed 64 bit value as a varint. + * @function + * @param {Long|number|string} value Value to write + * @returns {Writer} `this` + * @throws {TypeError} If `value` is a string and no long library is present. + */ +Writer.prototype.int64 = Writer.prototype.uint64; + +/** + * Writes a signed 64 bit value as a varint, zig-zag encoded. + * @param {Long|number|string} value Value to write + * @returns {Writer} `this` + * @throws {TypeError} If `value` is a string and no long library is present. + */ +Writer.prototype.sint64 = function write_sint64(value) { + var bits = LongBits.from(value).zzEncode(); + return this._push(writeVarint64, bits.length(), bits); +}; + +/** + * Writes a boolish value as a varint. + * @param {boolean} value Value to write + * @returns {Writer} `this` + */ +Writer.prototype.bool = function write_bool(value) { + return this._push(writeByte, 1, value ? 1 : 0); +}; + +function writeFixed32(val, buf, pos) { + buf[pos ] = val & 255; + buf[pos + 1] = val >>> 8 & 255; + buf[pos + 2] = val >>> 16 & 255; + buf[pos + 3] = val >>> 24; +} + +/** + * Writes an unsigned 32 bit value as fixed 32 bits. + * @param {number} value Value to write + * @returns {Writer} `this` + */ +Writer.prototype.fixed32 = function write_fixed32(value) { + return this._push(writeFixed32, 4, value >>> 0); +}; + +/** + * Writes a signed 32 bit value as fixed 32 bits. + * @function + * @param {number} value Value to write + * @returns {Writer} `this` + */ +Writer.prototype.sfixed32 = Writer.prototype.fixed32; + +/** + * Writes an unsigned 64 bit value as fixed 64 bits. + * @param {Long|number|string} value Value to write + * @returns {Writer} `this` + * @throws {TypeError} If `value` is a string and no long library is present. + */ +Writer.prototype.fixed64 = function write_fixed64(value) { + var bits = LongBits.from(value); + return this._push(writeFixed32, 4, bits.lo)._push(writeFixed32, 4, bits.hi); +}; + +/** + * Writes a signed 64 bit value as fixed 64 bits. + * @function + * @param {Long|number|string} value Value to write + * @returns {Writer} `this` + * @throws {TypeError} If `value` is a string and no long library is present. + */ +Writer.prototype.sfixed64 = Writer.prototype.fixed64; + +/** + * Writes a float (32 bit). + * @function + * @param {number} value Value to write + * @returns {Writer} `this` + */ +Writer.prototype.float = function write_float(value) { + return this._push(util.float.writeFloatLE, 4, value); +}; + +/** + * Writes a double (64 bit float). + * @function + * @param {number} value Value to write + * @returns {Writer} `this` + */ +Writer.prototype.double = function write_double(value) { + return this._push(util.float.writeDoubleLE, 8, value); +}; + +var writeBytes = util.Array.prototype.set + ? function writeBytes_set(val, buf, pos) { + buf.set(val, pos); // also works for plain array values + } + /* istanbul ignore next */ + : function writeBytes_for(val, buf, pos) { + for (var i = 0; i < val.length; ++i) + buf[pos + i] = val[i]; + }; + +/** + * Writes a sequence of bytes. + * @param {Uint8Array|string} value Buffer or base64 encoded string to write + * @returns {Writer} `this` + */ +Writer.prototype.bytes = function write_bytes(value) { + var len = value.length >>> 0; + if (!len) + return this._push(writeByte, 1, 0); + if (util.isString(value)) { + var buf = Writer.alloc(len = base64.length(value)); + base64.decode(value, buf, 0); + value = buf; + } + return this.uint32(len)._push(writeBytes, len, value); +}; + +/** + * Writes a string. + * @param {string} value Value to write + * @returns {Writer} `this` + */ +Writer.prototype.string = function write_string(value) { + var len = utf8.length(value); + return len + ? this.uint32(len)._push(utf8.write, len, value) + : this._push(writeByte, 1, 0); +}; + +/** + * Forks this writer's state by pushing it to a stack. + * Calling {@link Writer#reset|reset} or {@link Writer#ldelim|ldelim} resets the writer to the previous state. + * @returns {Writer} `this` + */ +Writer.prototype.fork = function fork() { + this.states = new State(this); + this.head = this.tail = new Op(noop, 0, 0); + this.len = 0; + return this; +}; + +/** + * Resets this instance to the last state. + * @returns {Writer} `this` + */ +Writer.prototype.reset = function reset() { + if (this.states) { + this.head = this.states.head; + this.tail = this.states.tail; + this.len = this.states.len; + this.states = this.states.next; + } else { + this.head = this.tail = new Op(noop, 0, 0); + this.len = 0; + } + return this; +}; + +/** + * Resets to the last state and appends the fork state's current write length as a varint followed by its operations. + * @returns {Writer} `this` + */ +Writer.prototype.ldelim = function ldelim() { + var head = this.head, + tail = this.tail, + len = this.len; + this.reset().uint32(len); + if (len) { + this.tail.next = head.next; // skip noop + this.tail = tail; + this.len += len; + } + return this; +}; + +/** + * Finishes the write operation. + * @returns {Uint8Array} Finished buffer + */ +Writer.prototype.finish = function finish() { + var head = this.head.next, // skip noop + buf = this.constructor.alloc(this.len), + pos = 0; + while (head) { + head.fn(head.val, buf, pos); + pos += head.len; + head = head.next; + } + // this.head = this.tail = null; + return buf; +}; + +Writer._configure = function(BufferWriter_) { + BufferWriter = BufferWriter_; + Writer.create = create(); + BufferWriter._configure(); +}; + + +/***/ }), + +/***/ 3751: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + +module.exports = BufferWriter; + +// extends Writer +var Writer = __nccwpck_require__(33654); +(BufferWriter.prototype = Object.create(Writer.prototype)).constructor = BufferWriter; + +var util = __nccwpck_require__(22857); + +/** + * Constructs a new buffer writer instance. + * @classdesc Wire format writer using node buffers. + * @extends Writer + * @constructor + */ +function BufferWriter() { + Writer.call(this); +} + +BufferWriter._configure = function () { + /** + * Allocates a buffer of the specified size. + * @function + * @param {number} size Buffer size + * @returns {Buffer} Buffer + */ + BufferWriter.alloc = util._Buffer_allocUnsafe; + + BufferWriter.writeBytesBuffer = util.Buffer && util.Buffer.prototype instanceof Uint8Array && util.Buffer.prototype.set.name === "set" + ? function writeBytesBuffer_set(val, buf, pos) { + buf.set(val, pos); // faster than copy (requires node >= 4 where Buffers extend Uint8Array and set is properly inherited) + // also works for plain array values + } + /* istanbul ignore next */ + : function writeBytesBuffer_copy(val, buf, pos) { + if (val.copy) // Buffer values + val.copy(buf, pos, 0, val.length); + else for (var i = 0; i < val.length;) // plain array values + buf[pos++] = val[i++]; + }; +}; + + +/** + * @override + */ +BufferWriter.prototype.bytes = function write_bytes_buffer(value) { + if (util.isString(value)) + value = util._Buffer_from(value, "base64"); + var len = value.length >>> 0; + this.uint32(len); + if (len) + this._push(BufferWriter.writeBytesBuffer, len, value); + return this; +}; + +function writeStringBuffer(val, buf, pos) { + if (val.length < 40) // plain js is faster for short strings (probably due to redundant assertions) + util.utf8.write(val, buf, pos); + else if (buf.utf8Write) + buf.utf8Write(val, pos); + else + buf.write(val, pos); +} + +/** + * @override + */ +BufferWriter.prototype.string = function write_string_buffer(value) { + var len = util.Buffer.byteLength(value); + this.uint32(len); + if (len) + this._push(writeStringBuffer, len, value); + return this; +}; + + +/** + * Finishes the write operation. + * @name BufferWriter#finish + * @function + * @returns {Buffer} Finished buffer + */ + +BufferWriter._configure(); + + +/***/ }), + +/***/ 87898: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var once = __nccwpck_require__(55560) +var eos = __nccwpck_require__(31424) +var fs + +try { + fs = __nccwpck_require__(79896) // we only need fs to get the ReadStream and WriteStream prototypes +} catch (e) {} + +var noop = function () {} +var ancient = typeof process === 'undefined' ? false : /^v?\.0/.test(process.version) + +var isFn = function (fn) { + return typeof fn === 'function' +} + +var isFS = function (stream) { + if (!ancient) return false // newer node version do not need to care about fs is a special way + if (!fs) return false // browser + return (stream instanceof (fs.ReadStream || noop) || stream instanceof (fs.WriteStream || noop)) && isFn(stream.close) +} + +var isRequest = function (stream) { + return stream.setHeader && isFn(stream.abort) +} + +var destroyer = function (stream, reading, writing, callback) { + callback = once(callback) + + var closed = false + stream.on('close', function () { + closed = true + }) + + eos(stream, {readable: reading, writable: writing}, function (err) { + if (err) return callback(err) + closed = true + callback() + }) + + var destroyed = false + return function (err) { + if (closed) return + if (destroyed) return + destroyed = true + + if (isFS(stream)) return stream.close(noop) // use close for fs streams to avoid fd leaks + if (isRequest(stream)) return stream.abort() // request.destroy just do .end - .abort is what we want + + if (isFn(stream.destroy)) return stream.destroy() + + callback(err || new Error('stream was destroyed')) + } +} + +var call = function (fn) { + fn() +} + +var pipe = function (from, to) { + return from.pipe(to) +} + +var pump = function () { + var streams = Array.prototype.slice.call(arguments) + var callback = isFn(streams[streams.length - 1] || noop) && streams.pop() || noop + + if (Array.isArray(streams[0])) streams = streams[0] + if (streams.length < 2) throw new Error('pump requires two streams per minimum') + + var error + var destroys = streams.map(function (stream, i) { + var reading = i < streams.length - 1 + var writing = i > 0 + return destroyer(stream, reading, writing, function (err) { + if (!error) error = err + if (err) destroys.forEach(call) + if (reading) return + destroys.forEach(call) + callback(error) + }) + }) + + return streams.reduce(pipe) +} + +module.exports = pump + + +/***/ }), + +/***/ 62432: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +var pump = __nccwpck_require__(87898) +var inherits = __nccwpck_require__(39598) +var Duplexify = __nccwpck_require__(29112) + +var toArray = function(args) { + if (!args.length) return [] + return Array.isArray(args[0]) ? args[0] : Array.prototype.slice.call(args) +} + +var define = function(opts) { + var Pumpify = function() { + var streams = toArray(arguments) + if (!(this instanceof Pumpify)) return new Pumpify(streams) + Duplexify.call(this, null, null, opts) + if (streams.length) this.setPipeline(streams) + } + + inherits(Pumpify, Duplexify) + + Pumpify.prototype.setPipeline = function() { + var streams = toArray(arguments) + var self = this + var ended = false + var w = streams[0] + var r = streams[streams.length-1] + + r = r.readable ? r : null + w = w.writable ? w : null + + var onclose = function() { + streams[0].emit('error', new Error('stream was destroyed')) + } + + this.on('close', onclose) + this.on('prefinish', function() { + if (!ended) self.cork() + }) + + pump(streams, function(err) { + self.removeListener('close', onclose) + if (err) return self.destroy(err.message === 'premature close' ? null : err) + ended = true + // pump ends after the last stream is not writable *but* + // pumpify still forwards the readable part so we need to catch errors + // still, so reenable autoDestroy in this case + if (self._autoDestroy === false) self._autoDestroy = true + self.uncork() + }) + + if (this.destroyed) return onclose() + this.setWritable(w) + this.setReadable(r) + } + + return Pumpify +} + +module.exports = define({autoDestroy:false, destroy:false}) +module.exports.obj = define({autoDestroy: false, destroy:false, objectMode:true, highWaterMark:16}) +module.exports.ctor = define + + /***/ }), /***/ 86032: @@ -60123,6 +170074,3273 @@ module.exports = { }; +/***/ }), + +/***/ 25500: +/***/ ((module) => { + +"use strict"; + + +const codes = {}; + +function createErrorType(code, message, Base) { + if (!Base) { + Base = Error + } + + function getMessage (arg1, arg2, arg3) { + if (typeof message === 'string') { + return message + } else { + return message(arg1, arg2, arg3) + } + } + + class NodeError extends Base { + constructor (arg1, arg2, arg3) { + super(getMessage(arg1, arg2, arg3)); + } + } + + NodeError.prototype.name = Base.name; + NodeError.prototype.code = code; + + codes[code] = NodeError; +} + +// https://github.com/nodejs/node/blob/v10.8.0/lib/internal/errors.js +function oneOf(expected, thing) { + if (Array.isArray(expected)) { + const len = expected.length; + expected = expected.map((i) => String(i)); + if (len > 2) { + return `one of ${thing} ${expected.slice(0, len - 1).join(', ')}, or ` + + expected[len - 1]; + } else if (len === 2) { + return `one of ${thing} ${expected[0]} or ${expected[1]}`; + } else { + return `of ${thing} ${expected[0]}`; + } + } else { + return `of ${thing} ${String(expected)}`; + } +} + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/startsWith +function startsWith(str, search, pos) { + return str.substr(!pos || pos < 0 ? 0 : +pos, search.length) === search; +} + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/endsWith +function endsWith(str, search, this_len) { + if (this_len === undefined || this_len > str.length) { + this_len = str.length; + } + return str.substring(this_len - search.length, this_len) === search; +} + +// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/includes +function includes(str, search, start) { + if (typeof start !== 'number') { + start = 0; + } + + if (start + search.length > str.length) { + return false; + } else { + return str.indexOf(search, start) !== -1; + } +} + +createErrorType('ERR_INVALID_OPT_VALUE', function (name, value) { + return 'The value "' + value + '" is invalid for option "' + name + '"' +}, TypeError); +createErrorType('ERR_INVALID_ARG_TYPE', function (name, expected, actual) { + // determiner: 'must be' or 'must not be' + let determiner; + if (typeof expected === 'string' && startsWith(expected, 'not ')) { + determiner = 'must not be'; + expected = expected.replace(/^not /, ''); + } else { + determiner = 'must be'; + } + + let msg; + if (endsWith(name, ' argument')) { + // For cases like 'first argument' + msg = `The ${name} ${determiner} ${oneOf(expected, 'type')}`; + } else { + const type = includes(name, '.') ? 'property' : 'argument'; + msg = `The "${name}" ${type} ${determiner} ${oneOf(expected, 'type')}`; + } + + msg += `. Received type ${typeof actual}`; + return msg; +}, TypeError); +createErrorType('ERR_STREAM_PUSH_AFTER_EOF', 'stream.push() after EOF'); +createErrorType('ERR_METHOD_NOT_IMPLEMENTED', function (name) { + return 'The ' + name + ' method is not implemented' +}); +createErrorType('ERR_STREAM_PREMATURE_CLOSE', 'Premature close'); +createErrorType('ERR_STREAM_DESTROYED', function (name) { + return 'Cannot call ' + name + ' after a stream was destroyed'; +}); +createErrorType('ERR_MULTIPLE_CALLBACK', 'Callback called multiple times'); +createErrorType('ERR_STREAM_CANNOT_PIPE', 'Cannot pipe, not readable'); +createErrorType('ERR_STREAM_WRITE_AFTER_END', 'write after end'); +createErrorType('ERR_STREAM_NULL_VALUES', 'May not write null values to stream', TypeError); +createErrorType('ERR_UNKNOWN_ENCODING', function (arg) { + return 'Unknown encoding: ' + arg +}, TypeError); +createErrorType('ERR_STREAM_UNSHIFT_AFTER_END_EVENT', 'stream.unshift() after end event'); + +module.exports.F = codes; + + +/***/ }), + +/***/ 82063: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a duplex stream is just a stream that is both readable and writable. +// Since JS doesn't have multiple prototypal inheritance, this class +// prototypally inherits from Readable, and then parasitically from +// Writable. + + + +/**/ +var objectKeys = Object.keys || function (obj) { + var keys = []; + for (var key in obj) keys.push(key); + return keys; +}; +/**/ + +module.exports = Duplex; +var Readable = __nccwpck_require__(86893); +var Writable = __nccwpck_require__(38797); +__nccwpck_require__(39598)(Duplex, Readable); +{ + // Allow the keys array to be GC'ed. + var keys = objectKeys(Writable.prototype); + for (var v = 0; v < keys.length; v++) { + var method = keys[v]; + if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method]; + } +} +function Duplex(options) { + if (!(this instanceof Duplex)) return new Duplex(options); + Readable.call(this, options); + Writable.call(this, options); + this.allowHalfOpen = true; + if (options) { + if (options.readable === false) this.readable = false; + if (options.writable === false) this.writable = false; + if (options.allowHalfOpen === false) { + this.allowHalfOpen = false; + this.once('end', onend); + } + } +} +Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.highWaterMark; + } +}); +Object.defineProperty(Duplex.prototype, 'writableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState && this._writableState.getBuffer(); + } +}); +Object.defineProperty(Duplex.prototype, 'writableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.length; + } +}); + +// the no-half-open enforcer +function onend() { + // If the writable side ended, then we're ok. + if (this._writableState.ended) return; + + // no more data can be written. + // But allow more writes to happen in this tick. + process.nextTick(onEndNT, this); +} +function onEndNT(self) { + self.end(); +} +Object.defineProperty(Duplex.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._readableState === undefined || this._writableState === undefined) { + return false; + } + return this._readableState.destroyed && this._writableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (this._readableState === undefined || this._writableState === undefined) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._readableState.destroyed = value; + this._writableState.destroyed = value; + } +}); + +/***/ }), + +/***/ 35283: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a passthrough stream. +// basically just the most minimal sort of Transform stream. +// Every written chunk gets output as-is. + + + +module.exports = PassThrough; +var Transform = __nccwpck_require__(12337); +__nccwpck_require__(39598)(PassThrough, Transform); +function PassThrough(options) { + if (!(this instanceof PassThrough)) return new PassThrough(options); + Transform.call(this, options); +} +PassThrough.prototype._transform = function (chunk, encoding, cb) { + cb(null, chunk); +}; + +/***/ }), + +/***/ 86893: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + + + +module.exports = Readable; + +/**/ +var Duplex; +/**/ + +Readable.ReadableState = ReadableState; + +/**/ +var EE = (__nccwpck_require__(24434).EventEmitter); +var EElistenerCount = function EElistenerCount(emitter, type) { + return emitter.listeners(type).length; +}; +/**/ + +/**/ +var Stream = __nccwpck_require__(63283); +/**/ + +var Buffer = (__nccwpck_require__(20181).Buffer); +var OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {}; +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} + +/**/ +var debugUtil = __nccwpck_require__(39023); +var debug; +if (debugUtil && debugUtil.debuglog) { + debug = debugUtil.debuglog('stream'); +} else { + debug = function debug() {}; +} +/**/ + +var BufferList = __nccwpck_require__(77336); +var destroyImpl = __nccwpck_require__(65089); +var _require = __nccwpck_require__(54874), + getHighWaterMark = _require.getHighWaterMark; +var _require$codes = (__nccwpck_require__(25500)/* .codes */ .F), + ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, + ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; + +// Lazy loaded to improve the startup performance. +var StringDecoder; +var createReadableStreamAsyncIterator; +var from; +__nccwpck_require__(39598)(Readable, Stream); +var errorOrDestroy = destroyImpl.errorOrDestroy; +var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume']; +function prependListener(emitter, event, fn) { + // Sadly this is not cacheable as some libraries bundle their own + // event emitter implementation with them. + if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); + + // This is a hack to make sure that our error handler is attached before any + // userland ones. NEVER DO THIS. This is here only because this code needs + // to continue to work with older versions of Node.js that do not include + // the prependListener() method. The goal is to eventually remove this hack. + if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]]; +} +function ReadableState(options, stream, isDuplex) { + Duplex = Duplex || __nccwpck_require__(82063); + options = options || {}; + + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream. + // These options can be provided separately as readableXXX and writableXXX. + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; + + // object stream flag. Used to make read(n) ignore n and to + // make all the buffer merging and length checks go away + this.objectMode = !!options.objectMode; + if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; + + // the point at which it stops calling _read() to fill the buffer + // Note: 0 is a valid value, means "don't call _read preemptively ever" + this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); + + // A linked list is used to store data chunks instead of an array because the + // linked list can remove elements from the beginning faster than + // array.shift() + this.buffer = new BufferList(); + this.length = 0; + this.pipes = null; + this.pipesCount = 0; + this.flowing = null; + this.ended = false; + this.endEmitted = false; + this.reading = false; + + // a flag to be able to tell if the event 'readable'/'data' is emitted + // immediately, or on a later tick. We set this to true at first, because + // any actions that shouldn't happen until "later" should generally also + // not happen before the first read call. + this.sync = true; + + // whenever we return null, then we set a flag to say + // that we're awaiting a 'readable' event emission. + this.needReadable = false; + this.emittedReadable = false; + this.readableListening = false; + this.resumeScheduled = false; + this.paused = true; + + // Should close be emitted on destroy. Defaults to true. + this.emitClose = options.emitClose !== false; + + // Should .destroy() be called after 'end' (and potentially 'finish') + this.autoDestroy = !!options.autoDestroy; + + // has it been destroyed + this.destroyed = false; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // the number of writers that are awaiting a drain event in .pipe()s + this.awaitDrain = 0; + + // if true, a maybeReadMore has been scheduled + this.readingMore = false; + this.decoder = null; + this.encoding = null; + if (options.encoding) { + if (!StringDecoder) StringDecoder = (__nccwpck_require__(80634)/* .StringDecoder */ .I); + this.decoder = new StringDecoder(options.encoding); + this.encoding = options.encoding; + } +} +function Readable(options) { + Duplex = Duplex || __nccwpck_require__(82063); + if (!(this instanceof Readable)) return new Readable(options); + + // Checking for a Stream.Duplex instance is faster here instead of inside + // the ReadableState constructor, at least with V8 6.5 + var isDuplex = this instanceof Duplex; + this._readableState = new ReadableState(options, this, isDuplex); + + // legacy + this.readable = true; + if (options) { + if (typeof options.read === 'function') this._read = options.read; + if (typeof options.destroy === 'function') this._destroy = options.destroy; + } + Stream.call(this); +} +Object.defineProperty(Readable.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._readableState === undefined) { + return false; + } + return this._readableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._readableState) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._readableState.destroyed = value; + } +}); +Readable.prototype.destroy = destroyImpl.destroy; +Readable.prototype._undestroy = destroyImpl.undestroy; +Readable.prototype._destroy = function (err, cb) { + cb(err); +}; + +// Manually shove something into the read() buffer. +// This returns true if the highWaterMark has not been hit yet, +// similar to how Writable.write() returns true if you should +// write() some more. +Readable.prototype.push = function (chunk, encoding) { + var state = this._readableState; + var skipChunkCheck; + if (!state.objectMode) { + if (typeof chunk === 'string') { + encoding = encoding || state.defaultEncoding; + if (encoding !== state.encoding) { + chunk = Buffer.from(chunk, encoding); + encoding = ''; + } + skipChunkCheck = true; + } + } else { + skipChunkCheck = true; + } + return readableAddChunk(this, chunk, encoding, false, skipChunkCheck); +}; + +// Unshift should *always* be something directly out of read() +Readable.prototype.unshift = function (chunk) { + return readableAddChunk(this, chunk, null, true, false); +}; +function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) { + debug('readableAddChunk', chunk); + var state = stream._readableState; + if (chunk === null) { + state.reading = false; + onEofChunk(stream, state); + } else { + var er; + if (!skipChunkCheck) er = chunkInvalid(state, chunk); + if (er) { + errorOrDestroy(stream, er); + } else if (state.objectMode || chunk && chunk.length > 0) { + if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) { + chunk = _uint8ArrayToBuffer(chunk); + } + if (addToFront) { + if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true); + } else if (state.ended) { + errorOrDestroy(stream, new ERR_STREAM_PUSH_AFTER_EOF()); + } else if (state.destroyed) { + return false; + } else { + state.reading = false; + if (state.decoder && !encoding) { + chunk = state.decoder.write(chunk); + if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state); + } else { + addChunk(stream, state, chunk, false); + } + } + } else if (!addToFront) { + state.reading = false; + maybeReadMore(stream, state); + } + } + + // We can push more data if we are below the highWaterMark. + // Also, if we have no data yet, we can stand some more bytes. + // This is to work around cases where hwm=0, such as the repl. + return !state.ended && (state.length < state.highWaterMark || state.length === 0); +} +function addChunk(stream, state, chunk, addToFront) { + if (state.flowing && state.length === 0 && !state.sync) { + state.awaitDrain = 0; + stream.emit('data', chunk); + } else { + // update the buffer info. + state.length += state.objectMode ? 1 : chunk.length; + if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk); + if (state.needReadable) emitReadable(stream); + } + maybeReadMore(stream, state); +} +function chunkInvalid(state, chunk) { + var er; + if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk); + } + return er; +} +Readable.prototype.isPaused = function () { + return this._readableState.flowing === false; +}; + +// backwards compatibility. +Readable.prototype.setEncoding = function (enc) { + if (!StringDecoder) StringDecoder = (__nccwpck_require__(80634)/* .StringDecoder */ .I); + var decoder = new StringDecoder(enc); + this._readableState.decoder = decoder; + // If setEncoding(null), decoder.encoding equals utf8 + this._readableState.encoding = this._readableState.decoder.encoding; + + // Iterate over current buffer to convert already stored Buffers: + var p = this._readableState.buffer.head; + var content = ''; + while (p !== null) { + content += decoder.write(p.data); + p = p.next; + } + this._readableState.buffer.clear(); + if (content !== '') this._readableState.buffer.push(content); + this._readableState.length = content.length; + return this; +}; + +// Don't raise the hwm > 1GB +var MAX_HWM = 0x40000000; +function computeNewHighWaterMark(n) { + if (n >= MAX_HWM) { + // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE. + n = MAX_HWM; + } else { + // Get the next highest power of 2 to prevent increasing hwm excessively in + // tiny amounts + n--; + n |= n >>> 1; + n |= n >>> 2; + n |= n >>> 4; + n |= n >>> 8; + n |= n >>> 16; + n++; + } + return n; +} + +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function howMuchToRead(n, state) { + if (n <= 0 || state.length === 0 && state.ended) return 0; + if (state.objectMode) return 1; + if (n !== n) { + // Only flow one buffer at a time + if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length; + } + // If we're asking for more than the current hwm, then raise the hwm. + if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n); + if (n <= state.length) return n; + // Don't have enough + if (!state.ended) { + state.needReadable = true; + return 0; + } + return state.length; +} + +// you can override either this method, or the async _read(n) below. +Readable.prototype.read = function (n) { + debug('read', n); + n = parseInt(n, 10); + var state = this._readableState; + var nOrig = n; + if (n !== 0) state.emittedReadable = false; + + // if we're doing read(0) to trigger a readable event, but we + // already have a bunch of data in the buffer, then just trigger + // the 'readable' event and move on. + if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) { + debug('read: emitReadable', state.length, state.ended); + if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this); + return null; + } + n = howMuchToRead(n, state); + + // if we've ended, and we're now clear, then finish it up. + if (n === 0 && state.ended) { + if (state.length === 0) endReadable(this); + return null; + } + + // All the actual chunk generation logic needs to be + // *below* the call to _read. The reason is that in certain + // synthetic stream cases, such as passthrough streams, _read + // may be a completely synchronous operation which may change + // the state of the read buffer, providing enough data when + // before there was *not* enough. + // + // So, the steps are: + // 1. Figure out what the state of things will be after we do + // a read from the buffer. + // + // 2. If that resulting state will trigger a _read, then call _read. + // Note that this may be asynchronous, or synchronous. Yes, it is + // deeply ugly to write APIs this way, but that still doesn't mean + // that the Readable class should behave improperly, as streams are + // designed to be sync/async agnostic. + // Take note if the _read call is sync or async (ie, if the read call + // has returned yet), so that we know whether or not it's safe to emit + // 'readable' etc. + // + // 3. Actually pull the requested chunks out of the buffer and return. + + // if we need a readable event, then we need to do some reading. + var doRead = state.needReadable; + debug('need readable', doRead); + + // if we currently have less than the highWaterMark, then also read some + if (state.length === 0 || state.length - n < state.highWaterMark) { + doRead = true; + debug('length less than watermark', doRead); + } + + // however, if we've ended, then there's no point, and if we're already + // reading, then it's unnecessary. + if (state.ended || state.reading) { + doRead = false; + debug('reading or ended', doRead); + } else if (doRead) { + debug('do read'); + state.reading = true; + state.sync = true; + // if the length is currently zero, then we *need* a readable event. + if (state.length === 0) state.needReadable = true; + // call internal read method + this._read(state.highWaterMark); + state.sync = false; + // If _read pushed data synchronously, then `reading` will be false, + // and we need to re-evaluate how much data we can return to the user. + if (!state.reading) n = howMuchToRead(nOrig, state); + } + var ret; + if (n > 0) ret = fromList(n, state);else ret = null; + if (ret === null) { + state.needReadable = state.length <= state.highWaterMark; + n = 0; + } else { + state.length -= n; + state.awaitDrain = 0; + } + if (state.length === 0) { + // If we have nothing in the buffer, then we want to know + // as soon as we *do* get something into the buffer. + if (!state.ended) state.needReadable = true; + + // If we tried to read() past the EOF, then emit end on the next tick. + if (nOrig !== n && state.ended) endReadable(this); + } + if (ret !== null) this.emit('data', ret); + return ret; +}; +function onEofChunk(stream, state) { + debug('onEofChunk'); + if (state.ended) return; + if (state.decoder) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) { + state.buffer.push(chunk); + state.length += state.objectMode ? 1 : chunk.length; + } + } + state.ended = true; + if (state.sync) { + // if we are sync, wait until next tick to emit the data. + // Otherwise we risk emitting data in the flow() + // the readable code triggers during a read() call + emitReadable(stream); + } else { + // emit 'readable' now to make sure it gets picked up. + state.needReadable = false; + if (!state.emittedReadable) { + state.emittedReadable = true; + emitReadable_(stream); + } + } +} + +// Don't emit readable right away in sync mode, because this can trigger +// another read() call => stack overflow. This way, it might trigger +// a nextTick recursion warning, but that's not so bad. +function emitReadable(stream) { + var state = stream._readableState; + debug('emitReadable', state.needReadable, state.emittedReadable); + state.needReadable = false; + if (!state.emittedReadable) { + debug('emitReadable', state.flowing); + state.emittedReadable = true; + process.nextTick(emitReadable_, stream); + } +} +function emitReadable_(stream) { + var state = stream._readableState; + debug('emitReadable_', state.destroyed, state.length, state.ended); + if (!state.destroyed && (state.length || state.ended)) { + stream.emit('readable'); + state.emittedReadable = false; + } + + // The stream needs another readable event if + // 1. It is not flowing, as the flow mechanism will take + // care of it. + // 2. It is not ended. + // 3. It is below the highWaterMark, so we can schedule + // another readable later. + state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark; + flow(stream); +} + +// at this point, the user has presumably seen the 'readable' event, +// and called read() to consume some data. that may have triggered +// in turn another _read(n) call, in which case reading = true if +// it's in progress. +// However, if we're not ended, or reading, and the length < hwm, +// then go ahead and try to read some more preemptively. +function maybeReadMore(stream, state) { + if (!state.readingMore) { + state.readingMore = true; + process.nextTick(maybeReadMore_, stream, state); + } +} +function maybeReadMore_(stream, state) { + // Attempt to read more data if we should. + // + // The conditions for reading more data are (one of): + // - Not enough data buffered (state.length < state.highWaterMark). The loop + // is responsible for filling the buffer with enough data if such data + // is available. If highWaterMark is 0 and we are not in the flowing mode + // we should _not_ attempt to buffer any extra data. We'll get more data + // when the stream consumer calls read() instead. + // - No data in the buffer, and the stream is in flowing mode. In this mode + // the loop below is responsible for ensuring read() is called. Failing to + // call read here would abort the flow and there's no other mechanism for + // continuing the flow if the stream consumer has just subscribed to the + // 'data' event. + // + // In addition to the above conditions to keep reading data, the following + // conditions prevent the data from being read: + // - The stream has ended (state.ended). + // - There is already a pending 'read' operation (state.reading). This is a + // case where the the stream has called the implementation defined _read() + // method, but they are processing the call asynchronously and have _not_ + // called push() with new data. In this case we skip performing more + // read()s. The execution ends in this method again after the _read() ends + // up calling push() with more data. + while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) { + var len = state.length; + debug('maybeReadMore read 0'); + stream.read(0); + if (len === state.length) + // didn't get any data, stop spinning. + break; + } + state.readingMore = false; +} + +// abstract method. to be overridden in specific implementation classes. +// call cb(er, data) where data is <= n in length. +// for virtual (non-string, non-buffer) streams, "length" is somewhat +// arbitrary, and perhaps not very meaningful. +Readable.prototype._read = function (n) { + errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()')); +}; +Readable.prototype.pipe = function (dest, pipeOpts) { + var src = this; + var state = this._readableState; + switch (state.pipesCount) { + case 0: + state.pipes = dest; + break; + case 1: + state.pipes = [state.pipes, dest]; + break; + default: + state.pipes.push(dest); + break; + } + state.pipesCount += 1; + debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts); + var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr; + var endFn = doEnd ? onend : unpipe; + if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn); + dest.on('unpipe', onunpipe); + function onunpipe(readable, unpipeInfo) { + debug('onunpipe'); + if (readable === src) { + if (unpipeInfo && unpipeInfo.hasUnpiped === false) { + unpipeInfo.hasUnpiped = true; + cleanup(); + } + } + } + function onend() { + debug('onend'); + dest.end(); + } + + // when the dest drains, it reduces the awaitDrain counter + // on the source. This would be more elegant with a .once() + // handler in flow(), but adding and removing repeatedly is + // too slow. + var ondrain = pipeOnDrain(src); + dest.on('drain', ondrain); + var cleanedUp = false; + function cleanup() { + debug('cleanup'); + // cleanup event handlers once the pipe is broken + dest.removeListener('close', onclose); + dest.removeListener('finish', onfinish); + dest.removeListener('drain', ondrain); + dest.removeListener('error', onerror); + dest.removeListener('unpipe', onunpipe); + src.removeListener('end', onend); + src.removeListener('end', unpipe); + src.removeListener('data', ondata); + cleanedUp = true; + + // if the reader is waiting for a drain event from this + // specific writer, then it would cause it to never start + // flowing again. + // So, if this is awaiting a drain, then we just call it now. + // If we don't know, then assume that we are waiting for one. + if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain(); + } + src.on('data', ondata); + function ondata(chunk) { + debug('ondata'); + var ret = dest.write(chunk); + debug('dest.write', ret); + if (ret === false) { + // If the user unpiped during `dest.write()`, it is possible + // to get stuck in a permanently paused state if that write + // also returned false. + // => Check whether `dest` is still a piping destination. + if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) { + debug('false write response, pause', state.awaitDrain); + state.awaitDrain++; + } + src.pause(); + } + } + + // if the dest has an error, then stop piping into it. + // however, don't suppress the throwing behavior for this. + function onerror(er) { + debug('onerror', er); + unpipe(); + dest.removeListener('error', onerror); + if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er); + } + + // Make sure our error handler is attached before userland ones. + prependListener(dest, 'error', onerror); + + // Both close and finish should trigger unpipe, but only once. + function onclose() { + dest.removeListener('finish', onfinish); + unpipe(); + } + dest.once('close', onclose); + function onfinish() { + debug('onfinish'); + dest.removeListener('close', onclose); + unpipe(); + } + dest.once('finish', onfinish); + function unpipe() { + debug('unpipe'); + src.unpipe(dest); + } + + // tell the dest that it's being piped to + dest.emit('pipe', src); + + // start the flow if it hasn't been started already. + if (!state.flowing) { + debug('pipe resume'); + src.resume(); + } + return dest; +}; +function pipeOnDrain(src) { + return function pipeOnDrainFunctionResult() { + var state = src._readableState; + debug('pipeOnDrain', state.awaitDrain); + if (state.awaitDrain) state.awaitDrain--; + if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) { + state.flowing = true; + flow(src); + } + }; +} +Readable.prototype.unpipe = function (dest) { + var state = this._readableState; + var unpipeInfo = { + hasUnpiped: false + }; + + // if we're not piping anywhere, then do nothing. + if (state.pipesCount === 0) return this; + + // just one destination. most common case. + if (state.pipesCount === 1) { + // passed in one, but it's not the right one. + if (dest && dest !== state.pipes) return this; + if (!dest) dest = state.pipes; + + // got a match. + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + if (dest) dest.emit('unpipe', this, unpipeInfo); + return this; + } + + // slow case. multiple pipe destinations. + + if (!dest) { + // remove all. + var dests = state.pipes; + var len = state.pipesCount; + state.pipes = null; + state.pipesCount = 0; + state.flowing = false; + for (var i = 0; i < len; i++) dests[i].emit('unpipe', this, { + hasUnpiped: false + }); + return this; + } + + // try to find the right one. + var index = indexOf(state.pipes, dest); + if (index === -1) return this; + state.pipes.splice(index, 1); + state.pipesCount -= 1; + if (state.pipesCount === 1) state.pipes = state.pipes[0]; + dest.emit('unpipe', this, unpipeInfo); + return this; +}; + +// set up data events if they are asked for +// Ensure readable listeners eventually get something +Readable.prototype.on = function (ev, fn) { + var res = Stream.prototype.on.call(this, ev, fn); + var state = this._readableState; + if (ev === 'data') { + // update readableListening so that resume() may be a no-op + // a few lines down. This is needed to support once('readable'). + state.readableListening = this.listenerCount('readable') > 0; + + // Try start flowing on next tick if stream isn't explicitly paused + if (state.flowing !== false) this.resume(); + } else if (ev === 'readable') { + if (!state.endEmitted && !state.readableListening) { + state.readableListening = state.needReadable = true; + state.flowing = false; + state.emittedReadable = false; + debug('on readable', state.length, state.reading); + if (state.length) { + emitReadable(this); + } else if (!state.reading) { + process.nextTick(nReadingNextTick, this); + } + } + } + return res; +}; +Readable.prototype.addListener = Readable.prototype.on; +Readable.prototype.removeListener = function (ev, fn) { + var res = Stream.prototype.removeListener.call(this, ev, fn); + if (ev === 'readable') { + // We need to check if there is someone still listening to + // readable and reset the state. However this needs to happen + // after readable has been emitted but before I/O (nextTick) to + // support once('readable', fn) cycles. This means that calling + // resume within the same tick will have no + // effect. + process.nextTick(updateReadableListening, this); + } + return res; +}; +Readable.prototype.removeAllListeners = function (ev) { + var res = Stream.prototype.removeAllListeners.apply(this, arguments); + if (ev === 'readable' || ev === undefined) { + // We need to check if there is someone still listening to + // readable and reset the state. However this needs to happen + // after readable has been emitted but before I/O (nextTick) to + // support once('readable', fn) cycles. This means that calling + // resume within the same tick will have no + // effect. + process.nextTick(updateReadableListening, this); + } + return res; +}; +function updateReadableListening(self) { + var state = self._readableState; + state.readableListening = self.listenerCount('readable') > 0; + if (state.resumeScheduled && !state.paused) { + // flowing needs to be set to true now, otherwise + // the upcoming resume will not flow. + state.flowing = true; + + // crude way to check if we should resume + } else if (self.listenerCount('data') > 0) { + self.resume(); + } +} +function nReadingNextTick(self) { + debug('readable nexttick read 0'); + self.read(0); +} + +// pause() and resume() are remnants of the legacy readable stream API +// If the user uses them, then switch into old mode. +Readable.prototype.resume = function () { + var state = this._readableState; + if (!state.flowing) { + debug('resume'); + // we flow only if there is no one listening + // for readable, but we still have to call + // resume() + state.flowing = !state.readableListening; + resume(this, state); + } + state.paused = false; + return this; +}; +function resume(stream, state) { + if (!state.resumeScheduled) { + state.resumeScheduled = true; + process.nextTick(resume_, stream, state); + } +} +function resume_(stream, state) { + debug('resume', state.reading); + if (!state.reading) { + stream.read(0); + } + state.resumeScheduled = false; + stream.emit('resume'); + flow(stream); + if (state.flowing && !state.reading) stream.read(0); +} +Readable.prototype.pause = function () { + debug('call pause flowing=%j', this._readableState.flowing); + if (this._readableState.flowing !== false) { + debug('pause'); + this._readableState.flowing = false; + this.emit('pause'); + } + this._readableState.paused = true; + return this; +}; +function flow(stream) { + var state = stream._readableState; + debug('flow', state.flowing); + while (state.flowing && stream.read() !== null); +} + +// wrap an old-style stream as the async data source. +// This is *not* part of the readable stream interface. +// It is an ugly unfortunate mess of history. +Readable.prototype.wrap = function (stream) { + var _this = this; + var state = this._readableState; + var paused = false; + stream.on('end', function () { + debug('wrapped end'); + if (state.decoder && !state.ended) { + var chunk = state.decoder.end(); + if (chunk && chunk.length) _this.push(chunk); + } + _this.push(null); + }); + stream.on('data', function (chunk) { + debug('wrapped data'); + if (state.decoder) chunk = state.decoder.write(chunk); + + // don't skip over falsy values in objectMode + if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return; + var ret = _this.push(chunk); + if (!ret) { + paused = true; + stream.pause(); + } + }); + + // proxy all the other methods. + // important when wrapping filters and duplexes. + for (var i in stream) { + if (this[i] === undefined && typeof stream[i] === 'function') { + this[i] = function methodWrap(method) { + return function methodWrapReturnFunction() { + return stream[method].apply(stream, arguments); + }; + }(i); + } + } + + // proxy certain important events. + for (var n = 0; n < kProxyEvents.length; n++) { + stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n])); + } + + // when we try to consume some more bytes, simply unpause the + // underlying stream. + this._read = function (n) { + debug('wrapped _read', n); + if (paused) { + paused = false; + stream.resume(); + } + }; + return this; +}; +if (typeof Symbol === 'function') { + Readable.prototype[Symbol.asyncIterator] = function () { + if (createReadableStreamAsyncIterator === undefined) { + createReadableStreamAsyncIterator = __nccwpck_require__(14868); + } + return createReadableStreamAsyncIterator(this); + }; +} +Object.defineProperty(Readable.prototype, 'readableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.highWaterMark; + } +}); +Object.defineProperty(Readable.prototype, 'readableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState && this._readableState.buffer; + } +}); +Object.defineProperty(Readable.prototype, 'readableFlowing', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.flowing; + }, + set: function set(state) { + if (this._readableState) { + this._readableState.flowing = state; + } + } +}); + +// exposed for testing purposes only. +Readable._fromList = fromList; +Object.defineProperty(Readable.prototype, 'readableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._readableState.length; + } +}); + +// Pluck off n bytes from an array of buffers. +// Length is the combined lengths of all the buffers in the list. +// This function is designed to be inlinable, so please take care when making +// changes to the function body. +function fromList(n, state) { + // nothing buffered + if (state.length === 0) return null; + var ret; + if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) { + // read it all, truncate the list + if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.first();else ret = state.buffer.concat(state.length); + state.buffer.clear(); + } else { + // read part of list + ret = state.buffer.consume(n, state.decoder); + } + return ret; +} +function endReadable(stream) { + var state = stream._readableState; + debug('endReadable', state.endEmitted); + if (!state.endEmitted) { + state.ended = true; + process.nextTick(endReadableNT, state, stream); + } +} +function endReadableNT(state, stream) { + debug('endReadableNT', state.endEmitted, state.length); + + // Check that we didn't get one last unshift. + if (!state.endEmitted && state.length === 0) { + state.endEmitted = true; + stream.readable = false; + stream.emit('end'); + if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the writable side is ready for autoDestroy as well + var wState = stream._writableState; + if (!wState || wState.autoDestroy && wState.finished) { + stream.destroy(); + } + } + } +} +if (typeof Symbol === 'function') { + Readable.from = function (iterable, opts) { + if (from === undefined) { + from = __nccwpck_require__(4659); + } + return from(Readable, iterable, opts); + }; +} +function indexOf(xs, x) { + for (var i = 0, l = xs.length; i < l; i++) { + if (xs[i] === x) return i; + } + return -1; +} + +/***/ }), + +/***/ 12337: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// a transform stream is a readable/writable stream where you do +// something with the data. Sometimes it's called a "filter", +// but that's not a great name for it, since that implies a thing where +// some bits pass through, and others are simply ignored. (That would +// be a valid example of a transform, of course.) +// +// While the output is causally related to the input, it's not a +// necessarily symmetric or synchronous transformation. For example, +// a zlib stream might take multiple plain-text writes(), and then +// emit a single compressed chunk some time in the future. +// +// Here's how this works: +// +// The Transform stream has all the aspects of the readable and writable +// stream classes. When you write(chunk), that calls _write(chunk,cb) +// internally, and returns false if there's a lot of pending writes +// buffered up. When you call read(), that calls _read(n) until +// there's enough pending readable data buffered up. +// +// In a transform stream, the written data is placed in a buffer. When +// _read(n) is called, it transforms the queued up data, calling the +// buffered _write cb's as it consumes chunks. If consuming a single +// written chunk would result in multiple output chunks, then the first +// outputted bit calls the readcb, and subsequent chunks just go into +// the read buffer, and will cause it to emit 'readable' if necessary. +// +// This way, back-pressure is actually determined by the reading side, +// since _read has to be called to start processing a new chunk. However, +// a pathological inflate type of transform can cause excessive buffering +// here. For example, imagine a stream where every byte of input is +// interpreted as an integer from 0-255, and then results in that many +// bytes of output. Writing the 4 bytes {ff,ff,ff,ff} would result in +// 1kb of data being output. In this case, you could write a very small +// amount of input, and end up with a very large amount of output. In +// such a pathological inflating mechanism, there'd be no way to tell +// the system to stop doing the transform. A single 4MB write could +// cause the system to run out of memory. +// +// However, even in such a pathological case, only a single written chunk +// would be consumed, and then the rest would wait (un-transformed) until +// the results of the previous transformed chunk were consumed. + + + +module.exports = Transform; +var _require$codes = (__nccwpck_require__(25500)/* .codes */ .F), + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, + ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING, + ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0; +var Duplex = __nccwpck_require__(82063); +__nccwpck_require__(39598)(Transform, Duplex); +function afterTransform(er, data) { + var ts = this._transformState; + ts.transforming = false; + var cb = ts.writecb; + if (cb === null) { + return this.emit('error', new ERR_MULTIPLE_CALLBACK()); + } + ts.writechunk = null; + ts.writecb = null; + if (data != null) + // single equals check for both `null` and `undefined` + this.push(data); + cb(er); + var rs = this._readableState; + rs.reading = false; + if (rs.needReadable || rs.length < rs.highWaterMark) { + this._read(rs.highWaterMark); + } +} +function Transform(options) { + if (!(this instanceof Transform)) return new Transform(options); + Duplex.call(this, options); + this._transformState = { + afterTransform: afterTransform.bind(this), + needTransform: false, + transforming: false, + writecb: null, + writechunk: null, + writeencoding: null + }; + + // start out asking for a readable event once data is transformed. + this._readableState.needReadable = true; + + // we have implemented the _read method, and done the other things + // that Readable wants before the first _read call, so unset the + // sync guard flag. + this._readableState.sync = false; + if (options) { + if (typeof options.transform === 'function') this._transform = options.transform; + if (typeof options.flush === 'function') this._flush = options.flush; + } + + // When the writable side finishes, then flush out anything remaining. + this.on('prefinish', prefinish); +} +function prefinish() { + var _this = this; + if (typeof this._flush === 'function' && !this._readableState.destroyed) { + this._flush(function (er, data) { + done(_this, er, data); + }); + } else { + done(this, null, null); + } +} +Transform.prototype.push = function (chunk, encoding) { + this._transformState.needTransform = false; + return Duplex.prototype.push.call(this, chunk, encoding); +}; + +// This is the part where you do stuff! +// override this function in implementation classes. +// 'chunk' is an input chunk. +// +// Call `push(newChunk)` to pass along transformed output +// to the readable side. You may call 'push' zero or more times. +// +// Call `cb(err)` when you are done with this chunk. If you pass +// an error, then that'll put the hurt on the whole operation. If you +// never call cb(), then you'll never get another chunk. +Transform.prototype._transform = function (chunk, encoding, cb) { + cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()')); +}; +Transform.prototype._write = function (chunk, encoding, cb) { + var ts = this._transformState; + ts.writecb = cb; + ts.writechunk = chunk; + ts.writeencoding = encoding; + if (!ts.transforming) { + var rs = this._readableState; + if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark); + } +}; + +// Doesn't matter what the args are here. +// _transform does all the work. +// That we got here means that the readable side wants more data. +Transform.prototype._read = function (n) { + var ts = this._transformState; + if (ts.writechunk !== null && !ts.transforming) { + ts.transforming = true; + this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform); + } else { + // mark that we need a transform, so that any data that comes in + // will get processed, now that we've asked for it. + ts.needTransform = true; + } +}; +Transform.prototype._destroy = function (err, cb) { + Duplex.prototype._destroy.call(this, err, function (err2) { + cb(err2); + }); +}; +function done(stream, er, data) { + if (er) return stream.emit('error', er); + if (data != null) + // single equals check for both `null` and `undefined` + stream.push(data); + + // TODO(BridgeAR): Write a test for these two error cases + // if there's nothing in the write buffer, then that means + // that nothing more will ever be provided + if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0(); + if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING(); + return stream.push(null); +} + +/***/ }), + +/***/ 38797: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + +// A bit simpler than readable streams. +// Implement an async ._write(chunk, encoding, cb), and it'll handle all +// the drain event emission and buffering. + + + +module.exports = Writable; + +/* */ +function WriteReq(chunk, encoding, cb) { + this.chunk = chunk; + this.encoding = encoding; + this.callback = cb; + this.next = null; +} + +// It seems a linked list but it is not +// there will be only 2 of these for each stream +function CorkedRequest(state) { + var _this = this; + this.next = null; + this.entry = null; + this.finish = function () { + onCorkedFinish(_this, state); + }; +} +/* */ + +/**/ +var Duplex; +/**/ + +Writable.WritableState = WritableState; + +/**/ +var internalUtil = { + deprecate: __nccwpck_require__(24488) +}; +/**/ + +/**/ +var Stream = __nccwpck_require__(63283); +/**/ + +var Buffer = (__nccwpck_require__(20181).Buffer); +var OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {}; +function _uint8ArrayToBuffer(chunk) { + return Buffer.from(chunk); +} +function _isUint8Array(obj) { + return Buffer.isBuffer(obj) || obj instanceof OurUint8Array; +} +var destroyImpl = __nccwpck_require__(65089); +var _require = __nccwpck_require__(54874), + getHighWaterMark = _require.getHighWaterMark; +var _require$codes = (__nccwpck_require__(25500)/* .codes */ .F), + ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE, + ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED, + ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK, + ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE, + ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED, + ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES, + ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END, + ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING; +var errorOrDestroy = destroyImpl.errorOrDestroy; +__nccwpck_require__(39598)(Writable, Stream); +function nop() {} +function WritableState(options, stream, isDuplex) { + Duplex = Duplex || __nccwpck_require__(82063); + options = options || {}; + + // Duplex streams are both readable and writable, but share + // the same options object. + // However, some cases require setting options to different + // values for the readable and the writable sides of the duplex stream, + // e.g. options.readableObjectMode vs. options.writableObjectMode, etc. + if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; + + // object stream flag to indicate whether or not this stream + // contains buffers or objects. + this.objectMode = !!options.objectMode; + if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; + + // the point at which write() starts returning false + // Note: 0 is a valid value, means that we always return false if + // the entire buffer is not flushed immediately on write() + this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); + + // if _final has been called + this.finalCalled = false; + + // drain event flag. + this.needDrain = false; + // at the start of calling end() + this.ending = false; + // when end() has been called, and returned + this.ended = false; + // when 'finish' is emitted + this.finished = false; + + // has it been destroyed + this.destroyed = false; + + // should we decode strings into buffers before passing to _write? + // this is here so that some node-core streams can optimize string + // handling at a lower level. + var noDecode = options.decodeStrings === false; + this.decodeStrings = !noDecode; + + // Crypto is kind of old and crusty. Historically, its default string + // encoding is 'binary' so we have to make this configurable. + // Everything else in the universe uses 'utf8', though. + this.defaultEncoding = options.defaultEncoding || 'utf8'; + + // not an actual buffer we keep track of, but a measurement + // of how much we're waiting to get pushed to some underlying + // socket or file. + this.length = 0; + + // a flag to see when we're in the middle of a write. + this.writing = false; + + // when true all writes will be buffered until .uncork() call + this.corked = 0; + + // a flag to be able to tell if the onwrite cb is called immediately, + // or on a later tick. We set this to true at first, because any + // actions that shouldn't happen until "later" should generally also + // not happen before the first write call. + this.sync = true; + + // a flag to know if we're processing previously buffered items, which + // may call the _write() callback in the same tick, so that we don't + // end up in an overlapped onwrite situation. + this.bufferProcessing = false; + + // the callback that's passed to _write(chunk,cb) + this.onwrite = function (er) { + onwrite(stream, er); + }; + + // the callback that the user supplies to write(chunk,encoding,cb) + this.writecb = null; + + // the amount that is being written when _write is called. + this.writelen = 0; + this.bufferedRequest = null; + this.lastBufferedRequest = null; + + // number of pending user-supplied write callbacks + // this must be 0 before 'finish' can be emitted + this.pendingcb = 0; + + // emit prefinish if the only thing we're waiting for is _write cbs + // This is relevant for synchronous Transform streams + this.prefinished = false; + + // True if the error was already emitted and should not be thrown again + this.errorEmitted = false; + + // Should close be emitted on destroy. Defaults to true. + this.emitClose = options.emitClose !== false; + + // Should .destroy() be called after 'finish' (and potentially 'end') + this.autoDestroy = !!options.autoDestroy; + + // count buffered requests + this.bufferedRequestCount = 0; + + // allocate the first CorkedRequest, there is always + // one allocated and free to use, and we maintain at most two + this.corkedRequestsFree = new CorkedRequest(this); +} +WritableState.prototype.getBuffer = function getBuffer() { + var current = this.bufferedRequest; + var out = []; + while (current) { + out.push(current); + current = current.next; + } + return out; +}; +(function () { + try { + Object.defineProperty(WritableState.prototype, 'buffer', { + get: internalUtil.deprecate(function writableStateBufferGetter() { + return this.getBuffer(); + }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003') + }); + } catch (_) {} +})(); + +// Test _writableState for inheritance to account for Duplex streams, +// whose prototype chain only points to Readable. +var realHasInstance; +if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') { + realHasInstance = Function.prototype[Symbol.hasInstance]; + Object.defineProperty(Writable, Symbol.hasInstance, { + value: function value(object) { + if (realHasInstance.call(this, object)) return true; + if (this !== Writable) return false; + return object && object._writableState instanceof WritableState; + } + }); +} else { + realHasInstance = function realHasInstance(object) { + return object instanceof this; + }; +} +function Writable(options) { + Duplex = Duplex || __nccwpck_require__(82063); + + // Writable ctor is applied to Duplexes, too. + // `realHasInstance` is necessary because using plain `instanceof` + // would return false, as no `_writableState` property is attached. + + // Trying to use the custom `instanceof` for Writable here will also break the + // Node.js LazyTransform implementation, which has a non-trivial getter for + // `_writableState` that would lead to infinite recursion. + + // Checking for a Stream.Duplex instance is faster here instead of inside + // the WritableState constructor, at least with V8 6.5 + var isDuplex = this instanceof Duplex; + if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options); + this._writableState = new WritableState(options, this, isDuplex); + + // legacy. + this.writable = true; + if (options) { + if (typeof options.write === 'function') this._write = options.write; + if (typeof options.writev === 'function') this._writev = options.writev; + if (typeof options.destroy === 'function') this._destroy = options.destroy; + if (typeof options.final === 'function') this._final = options.final; + } + Stream.call(this); +} + +// Otherwise people can pipe Writable streams, which is just wrong. +Writable.prototype.pipe = function () { + errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE()); +}; +function writeAfterEnd(stream, cb) { + var er = new ERR_STREAM_WRITE_AFTER_END(); + // TODO: defer error events consistently everywhere, not just the cb + errorOrDestroy(stream, er); + process.nextTick(cb, er); +} + +// Checks that a user-supplied chunk is valid, especially for the particular +// mode the stream is in. Currently this means that `null` is never accepted +// and undefined/non-string values are only allowed in object mode. +function validChunk(stream, state, chunk, cb) { + var er; + if (chunk === null) { + er = new ERR_STREAM_NULL_VALUES(); + } else if (typeof chunk !== 'string' && !state.objectMode) { + er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk); + } + if (er) { + errorOrDestroy(stream, er); + process.nextTick(cb, er); + return false; + } + return true; +} +Writable.prototype.write = function (chunk, encoding, cb) { + var state = this._writableState; + var ret = false; + var isBuf = !state.objectMode && _isUint8Array(chunk); + if (isBuf && !Buffer.isBuffer(chunk)) { + chunk = _uint8ArrayToBuffer(chunk); + } + if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding; + if (typeof cb !== 'function') cb = nop; + if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) { + state.pendingcb++; + ret = writeOrBuffer(this, state, isBuf, chunk, encoding, cb); + } + return ret; +}; +Writable.prototype.cork = function () { + this._writableState.corked++; +}; +Writable.prototype.uncork = function () { + var state = this._writableState; + if (state.corked) { + state.corked--; + if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state); + } +}; +Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) { + // node::ParseEncoding() requires lower case. + if (typeof encoding === 'string') encoding = encoding.toLowerCase(); + if (!(['hex', 'utf8', 'utf-8', 'ascii', 'binary', 'base64', 'ucs2', 'ucs-2', 'utf16le', 'utf-16le', 'raw'].indexOf((encoding + '').toLowerCase()) > -1)) throw new ERR_UNKNOWN_ENCODING(encoding); + this._writableState.defaultEncoding = encoding; + return this; +}; +Object.defineProperty(Writable.prototype, 'writableBuffer', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState && this._writableState.getBuffer(); + } +}); +function decodeChunk(state, chunk, encoding) { + if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') { + chunk = Buffer.from(chunk, encoding); + } + return chunk; +} +Object.defineProperty(Writable.prototype, 'writableHighWaterMark', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.highWaterMark; + } +}); + +// if we're already writing something, then just put this +// in the queue, and wait our turn. Otherwise, call _write +// If we return false, then we need a drain event, so set that flag. +function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) { + if (!isBuf) { + var newChunk = decodeChunk(state, chunk, encoding); + if (chunk !== newChunk) { + isBuf = true; + encoding = 'buffer'; + chunk = newChunk; + } + } + var len = state.objectMode ? 1 : chunk.length; + state.length += len; + var ret = state.length < state.highWaterMark; + // we must ensure that previous needDrain will not be reset to false. + if (!ret) state.needDrain = true; + if (state.writing || state.corked) { + var last = state.lastBufferedRequest; + state.lastBufferedRequest = { + chunk: chunk, + encoding: encoding, + isBuf: isBuf, + callback: cb, + next: null + }; + if (last) { + last.next = state.lastBufferedRequest; + } else { + state.bufferedRequest = state.lastBufferedRequest; + } + state.bufferedRequestCount += 1; + } else { + doWrite(stream, state, false, len, chunk, encoding, cb); + } + return ret; +} +function doWrite(stream, state, writev, len, chunk, encoding, cb) { + state.writelen = len; + state.writecb = cb; + state.writing = true; + state.sync = true; + if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite); + state.sync = false; +} +function onwriteError(stream, state, sync, er, cb) { + --state.pendingcb; + if (sync) { + // defer the callback if we are being called synchronously + // to avoid piling up things on the stack + process.nextTick(cb, er); + // this can emit finish, and it will always happen + // after error + process.nextTick(finishMaybe, stream, state); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + } else { + // the caller expect this to happen before if + // it is async + cb(er); + stream._writableState.errorEmitted = true; + errorOrDestroy(stream, er); + // this can emit finish, but finish must + // always follow error + finishMaybe(stream, state); + } +} +function onwriteStateUpdate(state) { + state.writing = false; + state.writecb = null; + state.length -= state.writelen; + state.writelen = 0; +} +function onwrite(stream, er) { + var state = stream._writableState; + var sync = state.sync; + var cb = state.writecb; + if (typeof cb !== 'function') throw new ERR_MULTIPLE_CALLBACK(); + onwriteStateUpdate(state); + if (er) onwriteError(stream, state, sync, er, cb);else { + // Check if we're actually ready to finish, but don't emit yet + var finished = needFinish(state) || stream.destroyed; + if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) { + clearBuffer(stream, state); + } + if (sync) { + process.nextTick(afterWrite, stream, state, finished, cb); + } else { + afterWrite(stream, state, finished, cb); + } + } +} +function afterWrite(stream, state, finished, cb) { + if (!finished) onwriteDrain(stream, state); + state.pendingcb--; + cb(); + finishMaybe(stream, state); +} + +// Must force callback to be called on nextTick, so that we don't +// emit 'drain' before the write() consumer gets the 'false' return +// value, and has a chance to attach a 'drain' listener. +function onwriteDrain(stream, state) { + if (state.length === 0 && state.needDrain) { + state.needDrain = false; + stream.emit('drain'); + } +} + +// if there's something in the buffer waiting, then process it +function clearBuffer(stream, state) { + state.bufferProcessing = true; + var entry = state.bufferedRequest; + if (stream._writev && entry && entry.next) { + // Fast case, write everything using _writev() + var l = state.bufferedRequestCount; + var buffer = new Array(l); + var holder = state.corkedRequestsFree; + holder.entry = entry; + var count = 0; + var allBuffers = true; + while (entry) { + buffer[count] = entry; + if (!entry.isBuf) allBuffers = false; + entry = entry.next; + count += 1; + } + buffer.allBuffers = allBuffers; + doWrite(stream, state, true, state.length, buffer, '', holder.finish); + + // doWrite is almost always async, defer these to save a bit of time + // as the hot path ends with doWrite + state.pendingcb++; + state.lastBufferedRequest = null; + if (holder.next) { + state.corkedRequestsFree = holder.next; + holder.next = null; + } else { + state.corkedRequestsFree = new CorkedRequest(state); + } + state.bufferedRequestCount = 0; + } else { + // Slow case, write chunks one-by-one + while (entry) { + var chunk = entry.chunk; + var encoding = entry.encoding; + var cb = entry.callback; + var len = state.objectMode ? 1 : chunk.length; + doWrite(stream, state, false, len, chunk, encoding, cb); + entry = entry.next; + state.bufferedRequestCount--; + // if we didn't call the onwrite immediately, then + // it means that we need to wait until it does. + // also, that means that the chunk and cb are currently + // being processed, so move the buffer counter past them. + if (state.writing) { + break; + } + } + if (entry === null) state.lastBufferedRequest = null; + } + state.bufferedRequest = entry; + state.bufferProcessing = false; +} +Writable.prototype._write = function (chunk, encoding, cb) { + cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()')); +}; +Writable.prototype._writev = null; +Writable.prototype.end = function (chunk, encoding, cb) { + var state = this._writableState; + if (typeof chunk === 'function') { + cb = chunk; + chunk = null; + encoding = null; + } else if (typeof encoding === 'function') { + cb = encoding; + encoding = null; + } + if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); + + // .end() fully uncorks + if (state.corked) { + state.corked = 1; + this.uncork(); + } + + // ignore unnecessary end() calls. + if (!state.ending) endWritable(this, state, cb); + return this; +}; +Object.defineProperty(Writable.prototype, 'writableLength', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + return this._writableState.length; + } +}); +function needFinish(state) { + return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing; +} +function callFinal(stream, state) { + stream._final(function (err) { + state.pendingcb--; + if (err) { + errorOrDestroy(stream, err); + } + state.prefinished = true; + stream.emit('prefinish'); + finishMaybe(stream, state); + }); +} +function prefinish(stream, state) { + if (!state.prefinished && !state.finalCalled) { + if (typeof stream._final === 'function' && !state.destroyed) { + state.pendingcb++; + state.finalCalled = true; + process.nextTick(callFinal, stream, state); + } else { + state.prefinished = true; + stream.emit('prefinish'); + } + } +} +function finishMaybe(stream, state) { + var need = needFinish(state); + if (need) { + prefinish(stream, state); + if (state.pendingcb === 0) { + state.finished = true; + stream.emit('finish'); + if (state.autoDestroy) { + // In case of duplex streams we need a way to detect + // if the readable side is ready for autoDestroy as well + var rState = stream._readableState; + if (!rState || rState.autoDestroy && rState.endEmitted) { + stream.destroy(); + } + } + } + } + return need; +} +function endWritable(stream, state, cb) { + state.ending = true; + finishMaybe(stream, state); + if (cb) { + if (state.finished) process.nextTick(cb);else stream.once('finish', cb); + } + state.ended = true; + stream.writable = false; +} +function onCorkedFinish(corkReq, state, err) { + var entry = corkReq.entry; + corkReq.entry = null; + while (entry) { + var cb = entry.callback; + state.pendingcb--; + cb(err); + entry = entry.next; + } + + // reuse the free corkReq. + state.corkedRequestsFree.next = corkReq; +} +Object.defineProperty(Writable.prototype, 'destroyed', { + // making it explicit this property is not enumerable + // because otherwise some prototype manipulation in + // userland will fail + enumerable: false, + get: function get() { + if (this._writableState === undefined) { + return false; + } + return this._writableState.destroyed; + }, + set: function set(value) { + // we ignore the value if the stream + // has not been initialized yet + if (!this._writableState) { + return; + } + + // backward compatibility, the user is explicitly + // managing destroyed + this._writableState.destroyed = value; + } +}); +Writable.prototype.destroy = destroyImpl.destroy; +Writable.prototype._undestroy = destroyImpl.undestroy; +Writable.prototype._destroy = function (err, cb) { + cb(err); +}; + +/***/ }), + +/***/ 14868: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var _Object$setPrototypeO; +function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } +function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +var finished = __nccwpck_require__(36815); +var kLastResolve = Symbol('lastResolve'); +var kLastReject = Symbol('lastReject'); +var kError = Symbol('error'); +var kEnded = Symbol('ended'); +var kLastPromise = Symbol('lastPromise'); +var kHandlePromise = Symbol('handlePromise'); +var kStream = Symbol('stream'); +function createIterResult(value, done) { + return { + value: value, + done: done + }; +} +function readAndResolve(iter) { + var resolve = iter[kLastResolve]; + if (resolve !== null) { + var data = iter[kStream].read(); + // we defer if data is null + // we can be expecting either 'end' or + // 'error' + if (data !== null) { + iter[kLastPromise] = null; + iter[kLastResolve] = null; + iter[kLastReject] = null; + resolve(createIterResult(data, false)); + } + } +} +function onReadable(iter) { + // we wait for the next tick, because it might + // emit an error with process.nextTick + process.nextTick(readAndResolve, iter); +} +function wrapForNext(lastPromise, iter) { + return function (resolve, reject) { + lastPromise.then(function () { + if (iter[kEnded]) { + resolve(createIterResult(undefined, true)); + return; + } + iter[kHandlePromise](resolve, reject); + }, reject); + }; +} +var AsyncIteratorPrototype = Object.getPrototypeOf(function () {}); +var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = { + get stream() { + return this[kStream]; + }, + next: function next() { + var _this = this; + // if we have detected an error in the meanwhile + // reject straight away + var error = this[kError]; + if (error !== null) { + return Promise.reject(error); + } + if (this[kEnded]) { + return Promise.resolve(createIterResult(undefined, true)); + } + if (this[kStream].destroyed) { + // We need to defer via nextTick because if .destroy(err) is + // called, the error will be emitted via nextTick, and + // we cannot guarantee that there is no error lingering around + // waiting to be emitted. + return new Promise(function (resolve, reject) { + process.nextTick(function () { + if (_this[kError]) { + reject(_this[kError]); + } else { + resolve(createIterResult(undefined, true)); + } + }); + }); + } + + // if we have multiple next() calls + // we will wait for the previous Promise to finish + // this logic is optimized to support for await loops, + // where next() is only called once at a time + var lastPromise = this[kLastPromise]; + var promise; + if (lastPromise) { + promise = new Promise(wrapForNext(lastPromise, this)); + } else { + // fast path needed to support multiple this.push() + // without triggering the next() queue + var data = this[kStream].read(); + if (data !== null) { + return Promise.resolve(createIterResult(data, false)); + } + promise = new Promise(this[kHandlePromise]); + } + this[kLastPromise] = promise; + return promise; + } +}, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () { + return this; +}), _defineProperty(_Object$setPrototypeO, "return", function _return() { + var _this2 = this; + // destroy(err, cb) is a private API + // we can guarantee we have that here, because we control the + // Readable class this is attached to + return new Promise(function (resolve, reject) { + _this2[kStream].destroy(null, function (err) { + if (err) { + reject(err); + return; + } + resolve(createIterResult(undefined, true)); + }); + }); +}), _Object$setPrototypeO), AsyncIteratorPrototype); +var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) { + var _Object$create; + var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, { + value: stream, + writable: true + }), _defineProperty(_Object$create, kLastResolve, { + value: null, + writable: true + }), _defineProperty(_Object$create, kLastReject, { + value: null, + writable: true + }), _defineProperty(_Object$create, kError, { + value: null, + writable: true + }), _defineProperty(_Object$create, kEnded, { + value: stream._readableState.endEmitted, + writable: true + }), _defineProperty(_Object$create, kHandlePromise, { + value: function value(resolve, reject) { + var data = iterator[kStream].read(); + if (data) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve(createIterResult(data, false)); + } else { + iterator[kLastResolve] = resolve; + iterator[kLastReject] = reject; + } + }, + writable: true + }), _Object$create)); + iterator[kLastPromise] = null; + finished(stream, function (err) { + if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') { + var reject = iterator[kLastReject]; + // reject if we are waiting for data in the Promise + // returned by next() and store the error + if (reject !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + reject(err); + } + iterator[kError] = err; + return; + } + var resolve = iterator[kLastResolve]; + if (resolve !== null) { + iterator[kLastPromise] = null; + iterator[kLastResolve] = null; + iterator[kLastReject] = null; + resolve(createIterResult(undefined, true)); + } + iterator[kEnded] = true; + }); + stream.on('readable', onReadable.bind(null, iterator)); + return iterator; +}; +module.exports = createReadableStreamAsyncIterator; + +/***/ }), + +/***/ 77336: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } +function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } +function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } } +function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; } +function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } +function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +var _require = __nccwpck_require__(20181), + Buffer = _require.Buffer; +var _require2 = __nccwpck_require__(39023), + inspect = _require2.inspect; +var custom = inspect && inspect.custom || 'inspect'; +function copyBuffer(src, target, offset) { + Buffer.prototype.copy.call(src, target, offset); +} +module.exports = /*#__PURE__*/function () { + function BufferList() { + _classCallCheck(this, BufferList); + this.head = null; + this.tail = null; + this.length = 0; + } + _createClass(BufferList, [{ + key: "push", + value: function push(v) { + var entry = { + data: v, + next: null + }; + if (this.length > 0) this.tail.next = entry;else this.head = entry; + this.tail = entry; + ++this.length; + } + }, { + key: "unshift", + value: function unshift(v) { + var entry = { + data: v, + next: this.head + }; + if (this.length === 0) this.tail = entry; + this.head = entry; + ++this.length; + } + }, { + key: "shift", + value: function shift() { + if (this.length === 0) return; + var ret = this.head.data; + if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next; + --this.length; + return ret; + } + }, { + key: "clear", + value: function clear() { + this.head = this.tail = null; + this.length = 0; + } + }, { + key: "join", + value: function join(s) { + if (this.length === 0) return ''; + var p = this.head; + var ret = '' + p.data; + while (p = p.next) ret += s + p.data; + return ret; + } + }, { + key: "concat", + value: function concat(n) { + if (this.length === 0) return Buffer.alloc(0); + var ret = Buffer.allocUnsafe(n >>> 0); + var p = this.head; + var i = 0; + while (p) { + copyBuffer(p.data, ret, i); + i += p.data.length; + p = p.next; + } + return ret; + } + + // Consumes a specified amount of bytes or characters from the buffered data. + }, { + key: "consume", + value: function consume(n, hasStrings) { + var ret; + if (n < this.head.data.length) { + // `slice` is the same for buffers and strings. + ret = this.head.data.slice(0, n); + this.head.data = this.head.data.slice(n); + } else if (n === this.head.data.length) { + // First chunk is a perfect match. + ret = this.shift(); + } else { + // Result spans more than one buffer. + ret = hasStrings ? this._getString(n) : this._getBuffer(n); + } + return ret; + } + }, { + key: "first", + value: function first() { + return this.head.data; + } + + // Consumes a specified amount of characters from the buffered data. + }, { + key: "_getString", + value: function _getString(n) { + var p = this.head; + var c = 1; + var ret = p.data; + n -= ret.length; + while (p = p.next) { + var str = p.data; + var nb = n > str.length ? str.length : n; + if (nb === str.length) ret += str;else ret += str.slice(0, n); + n -= nb; + if (n === 0) { + if (nb === str.length) { + ++c; + if (p.next) this.head = p.next;else this.head = this.tail = null; + } else { + this.head = p; + p.data = str.slice(nb); + } + break; + } + ++c; + } + this.length -= c; + return ret; + } + + // Consumes a specified amount of bytes from the buffered data. + }, { + key: "_getBuffer", + value: function _getBuffer(n) { + var ret = Buffer.allocUnsafe(n); + var p = this.head; + var c = 1; + p.data.copy(ret); + n -= p.data.length; + while (p = p.next) { + var buf = p.data; + var nb = n > buf.length ? buf.length : n; + buf.copy(ret, ret.length - n, 0, nb); + n -= nb; + if (n === 0) { + if (nb === buf.length) { + ++c; + if (p.next) this.head = p.next;else this.head = this.tail = null; + } else { + this.head = p; + p.data = buf.slice(nb); + } + break; + } + ++c; + } + this.length -= c; + return ret; + } + + // Make sure the linked list only shows the minimal necessary information. + }, { + key: custom, + value: function value(_, options) { + return inspect(this, _objectSpread(_objectSpread({}, options), {}, { + // Only inspect one level. + depth: 0, + // It should not recurse. + customInspect: false + })); + } + }]); + return BufferList; +}(); + +/***/ }), + +/***/ 65089: +/***/ ((module) => { + +"use strict"; + + +// undocumented cb() API, needed for core, not for public API +function destroy(err, cb) { + var _this = this; + var readableDestroyed = this._readableState && this._readableState.destroyed; + var writableDestroyed = this._writableState && this._writableState.destroyed; + if (readableDestroyed || writableDestroyed) { + if (cb) { + cb(err); + } else if (err) { + if (!this._writableState) { + process.nextTick(emitErrorNT, this, err); + } else if (!this._writableState.errorEmitted) { + this._writableState.errorEmitted = true; + process.nextTick(emitErrorNT, this, err); + } + } + return this; + } + + // we set destroyed to true before firing error callbacks in order + // to make it re-entrance safe in case destroy() is called within callbacks + + if (this._readableState) { + this._readableState.destroyed = true; + } + + // if this is a duplex stream mark the writable part as destroyed as well + if (this._writableState) { + this._writableState.destroyed = true; + } + this._destroy(err || null, function (err) { + if (!cb && err) { + if (!_this._writableState) { + process.nextTick(emitErrorAndCloseNT, _this, err); + } else if (!_this._writableState.errorEmitted) { + _this._writableState.errorEmitted = true; + process.nextTick(emitErrorAndCloseNT, _this, err); + } else { + process.nextTick(emitCloseNT, _this); + } + } else if (cb) { + process.nextTick(emitCloseNT, _this); + cb(err); + } else { + process.nextTick(emitCloseNT, _this); + } + }); + return this; +} +function emitErrorAndCloseNT(self, err) { + emitErrorNT(self, err); + emitCloseNT(self); +} +function emitCloseNT(self) { + if (self._writableState && !self._writableState.emitClose) return; + if (self._readableState && !self._readableState.emitClose) return; + self.emit('close'); +} +function undestroy() { + if (this._readableState) { + this._readableState.destroyed = false; + this._readableState.reading = false; + this._readableState.ended = false; + this._readableState.endEmitted = false; + } + if (this._writableState) { + this._writableState.destroyed = false; + this._writableState.ended = false; + this._writableState.ending = false; + this._writableState.finalCalled = false; + this._writableState.prefinished = false; + this._writableState.finished = false; + this._writableState.errorEmitted = false; + } +} +function emitErrorNT(self, err) { + self.emit('error', err); +} +function errorOrDestroy(stream, err) { + // We have tests that rely on errors being emitted + // in the same tick, so changing this is semver major. + // For now when you opt-in to autoDestroy we allow + // the error to be emitted nextTick. In a future + // semver major update we should change the default to this. + + var rState = stream._readableState; + var wState = stream._writableState; + if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err); +} +module.exports = { + destroy: destroy, + undestroy: undestroy, + errorOrDestroy: errorOrDestroy +}; + +/***/ }), + +/***/ 36815: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; +// Ported from https://github.com/mafintosh/end-of-stream with +// permission from the author, Mathias Buus (@mafintosh). + + + +var ERR_STREAM_PREMATURE_CLOSE = (__nccwpck_require__(25500)/* .codes */ .F).ERR_STREAM_PREMATURE_CLOSE; +function once(callback) { + var called = false; + return function () { + if (called) return; + called = true; + for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { + args[_key] = arguments[_key]; + } + callback.apply(this, args); + }; +} +function noop() {} +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +} +function eos(stream, opts, callback) { + if (typeof opts === 'function') return eos(stream, null, opts); + if (!opts) opts = {}; + callback = once(callback || noop); + var readable = opts.readable || opts.readable !== false && stream.readable; + var writable = opts.writable || opts.writable !== false && stream.writable; + var onlegacyfinish = function onlegacyfinish() { + if (!stream.writable) onfinish(); + }; + var writableEnded = stream._writableState && stream._writableState.finished; + var onfinish = function onfinish() { + writable = false; + writableEnded = true; + if (!readable) callback.call(stream); + }; + var readableEnded = stream._readableState && stream._readableState.endEmitted; + var onend = function onend() { + readable = false; + readableEnded = true; + if (!writable) callback.call(stream); + }; + var onerror = function onerror(err) { + callback.call(stream, err); + }; + var onclose = function onclose() { + var err; + if (readable && !readableEnded) { + if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); + } + if (writable && !writableEnded) { + if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE(); + return callback.call(stream, err); + } + }; + var onrequest = function onrequest() { + stream.req.on('finish', onfinish); + }; + if (isRequest(stream)) { + stream.on('complete', onfinish); + stream.on('abort', onclose); + if (stream.req) onrequest();else stream.on('request', onrequest); + } else if (writable && !stream._writableState) { + // legacy streams + stream.on('end', onlegacyfinish); + stream.on('close', onlegacyfinish); + } + stream.on('end', onend); + stream.on('finish', onfinish); + if (opts.error !== false) stream.on('error', onerror); + stream.on('close', onclose); + return function () { + stream.removeListener('complete', onfinish); + stream.removeListener('abort', onclose); + stream.removeListener('request', onrequest); + if (stream.req) stream.req.removeListener('finish', onfinish); + stream.removeListener('end', onlegacyfinish); + stream.removeListener('close', onlegacyfinish); + stream.removeListener('finish', onfinish); + stream.removeListener('end', onend); + stream.removeListener('error', onerror); + stream.removeListener('close', onclose); + }; +} +module.exports = eos; + +/***/ }), + +/***/ 4659: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } } +function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; } +function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; } +function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; } +function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } +function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); } +function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); } +var ERR_INVALID_ARG_TYPE = (__nccwpck_require__(25500)/* .codes */ .F).ERR_INVALID_ARG_TYPE; +function from(Readable, iterable, opts) { + var iterator; + if (iterable && typeof iterable.next === 'function') { + iterator = iterable; + } else if (iterable && iterable[Symbol.asyncIterator]) iterator = iterable[Symbol.asyncIterator]();else if (iterable && iterable[Symbol.iterator]) iterator = iterable[Symbol.iterator]();else throw new ERR_INVALID_ARG_TYPE('iterable', ['Iterable'], iterable); + var readable = new Readable(_objectSpread({ + objectMode: true + }, opts)); + // Reading boolean to protect against _read + // being called before last iteration completion. + var reading = false; + readable._read = function () { + if (!reading) { + reading = true; + next(); + } + }; + function next() { + return _next2.apply(this, arguments); + } + function _next2() { + _next2 = _asyncToGenerator(function* () { + try { + var _yield$iterator$next = yield iterator.next(), + value = _yield$iterator$next.value, + done = _yield$iterator$next.done; + if (done) { + readable.push(null); + } else if (readable.push(yield value)) { + next(); + } else { + reading = false; + } + } catch (err) { + readable.destroy(err); + } + }); + return _next2.apply(this, arguments); + } + return readable; +} +module.exports = from; + + +/***/ }), + +/***/ 16701: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; +// Ported from https://github.com/mafintosh/pump with +// permission from the author, Mathias Buus (@mafintosh). + + + +var eos; +function once(callback) { + var called = false; + return function () { + if (called) return; + called = true; + callback.apply(void 0, arguments); + }; +} +var _require$codes = (__nccwpck_require__(25500)/* .codes */ .F), + ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS, + ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED; +function noop(err) { + // Rethrow the error if it exists to avoid swallowing it + if (err) throw err; +} +function isRequest(stream) { + return stream.setHeader && typeof stream.abort === 'function'; +} +function destroyer(stream, reading, writing, callback) { + callback = once(callback); + var closed = false; + stream.on('close', function () { + closed = true; + }); + if (eos === undefined) eos = __nccwpck_require__(36815); + eos(stream, { + readable: reading, + writable: writing + }, function (err) { + if (err) return callback(err); + closed = true; + callback(); + }); + var destroyed = false; + return function (err) { + if (closed) return; + if (destroyed) return; + destroyed = true; + + // request.destroy just do .end - .abort is what we want + if (isRequest(stream)) return stream.abort(); + if (typeof stream.destroy === 'function') return stream.destroy(); + callback(err || new ERR_STREAM_DESTROYED('pipe')); + }; +} +function call(fn) { + fn(); +} +function pipe(from, to) { + return from.pipe(to); +} +function popCallback(streams) { + if (!streams.length) return noop; + if (typeof streams[streams.length - 1] !== 'function') return noop; + return streams.pop(); +} +function pipeline() { + for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) { + streams[_key] = arguments[_key]; + } + var callback = popCallback(streams); + if (Array.isArray(streams[0])) streams = streams[0]; + if (streams.length < 2) { + throw new ERR_MISSING_ARGS('streams'); + } + var error; + var destroys = streams.map(function (stream, i) { + var reading = i < streams.length - 1; + var writing = i > 0; + return destroyer(stream, reading, writing, function (err) { + if (!error) error = err; + if (err) destroys.forEach(call); + if (reading) return; + destroys.forEach(call); + callback(error); + }); + }); + return streams.reduce(pipe); +} +module.exports = pipeline; + +/***/ }), + +/***/ 54874: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var ERR_INVALID_OPT_VALUE = (__nccwpck_require__(25500)/* .codes */ .F).ERR_INVALID_OPT_VALUE; +function highWaterMarkFrom(options, isDuplex, duplexKey) { + return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null; +} +function getHighWaterMark(state, options, duplexKey, isDuplex) { + var hwm = highWaterMarkFrom(options, isDuplex, duplexKey); + if (hwm != null) { + if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) { + var name = isDuplex ? duplexKey : 'highWaterMark'; + throw new ERR_INVALID_OPT_VALUE(name, hwm); + } + return Math.floor(hwm); + } + + // Default value + return state.objectMode ? 16 : 16 * 1024; +} +module.exports = { + getHighWaterMark: getHighWaterMark +}; + +/***/ }), + +/***/ 63283: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +module.exports = __nccwpck_require__(2203); + + +/***/ }), + +/***/ 86131: +/***/ ((module, exports, __nccwpck_require__) => { + +var Stream = __nccwpck_require__(2203); +if (process.env.READABLE_STREAM === 'disable' && Stream) { + module.exports = Stream.Readable; + Object.assign(module.exports, Stream); + module.exports.Stream = Stream; +} else { + exports = module.exports = __nccwpck_require__(86893); + exports.Stream = Stream || exports; + exports.Readable = exports; + exports.Writable = __nccwpck_require__(38797); + exports.Duplex = __nccwpck_require__(82063); + exports.Transform = __nccwpck_require__(12337); + exports.PassThrough = __nccwpck_require__(35283); + exports.finished = __nccwpck_require__(36815); + exports.pipeline = __nccwpck_require__(16701); +} + + +/***/ }), + +/***/ 67842: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +const {PassThrough} = __nccwpck_require__(2203); +const extend = __nccwpck_require__(23860); + +let debug = () => {}; +if ( + typeof process !== 'undefined' && + 'env' in process && + typeof process.env === 'object' && + process.env.DEBUG === 'retry-request' +) { + debug = message => { + console.log('retry-request:', message); + }; +} + +const DEFAULTS = { + objectMode: false, + retries: 2, + + /* + The maximum time to delay in seconds. If retryDelayMultiplier results in a + delay greater than maxRetryDelay, retries should delay by maxRetryDelay + seconds instead. + */ + maxRetryDelay: 64, + + /* + The multiplier by which to increase the delay time between the completion of + failed requests, and the initiation of the subsequent retrying request. + */ + retryDelayMultiplier: 2, + + /* + The length of time to keep retrying in seconds. The last sleep period will + be shortened as necessary, so that the last retry runs at deadline (and not + considerably beyond it). The total time starting from when the initial + request is sent, after which an error will be returned, regardless of the + retrying attempts made meanwhile. + */ + totalTimeout: 600, + + noResponseRetries: 2, + currentRetryAttempt: 0, + shouldRetryFn: function (response) { + const retryRanges = [ + // https://en.wikipedia.org/wiki/List_of_HTTP_status_codes + // 1xx - Retry (Informational, request still processing) + // 2xx - Do not retry (Success) + // 3xx - Do not retry (Redirect) + // 4xx - Do not retry (Client errors) + // 429 - Retry ("Too Many Requests") + // 5xx - Retry (Server errors) + [100, 199], + [429, 429], + [500, 599], + ]; + + const statusCode = response.statusCode; + debug(`Response status: ${statusCode}`); + + let range; + while ((range = retryRanges.shift())) { + if (statusCode >= range[0] && statusCode <= range[1]) { + // Not a successful status or redirect. + return true; + } + } + }, +}; + +function retryRequest(requestOpts, opts, callback) { + if (typeof requestOpts === 'string') { + requestOpts = {url: requestOpts}; + } + + const streamMode = typeof arguments[arguments.length - 1] !== 'function'; + + if (typeof opts === 'function') { + callback = opts; + } + + const manualCurrentRetryAttemptWasSet = + opts && typeof opts.currentRetryAttempt === 'number'; + opts = extend({}, DEFAULTS, opts); + + if (typeof opts.request === 'undefined') { + throw new Error('A request library must be provided to retry-request.'); + } + + let currentRetryAttempt = opts.currentRetryAttempt; + + let numNoResponseAttempts = 0; + let streamResponseHandled = false; + + let retryStream; + let requestStream; + let delayStream; + + let activeRequest; + const retryRequest = { + abort: function () { + if (activeRequest && activeRequest.abort) { + activeRequest.abort(); + } + }, + }; + + if (streamMode) { + retryStream = new PassThrough({objectMode: opts.objectMode}); + retryStream.abort = resetStreams; + } + + const timeOfFirstRequest = Date.now(); + if (currentRetryAttempt > 0) { + retryAfterDelay(currentRetryAttempt); + } else { + makeRequest(); + } + + if (streamMode) { + return retryStream; + } else { + return retryRequest; + } + + function resetStreams() { + delayStream = null; + + if (requestStream) { + requestStream.abort && requestStream.abort(); + requestStream.cancel && requestStream.cancel(); + + if (requestStream.destroy) { + requestStream.destroy(); + } else if (requestStream.end) { + requestStream.end(); + } + } + } + + function makeRequest() { + let finishHandled = false; + currentRetryAttempt++; + debug(`Current retry attempt: ${currentRetryAttempt}`); + + function handleFinish(args = []) { + if (!finishHandled) { + finishHandled = true; + retryStream.emit('complete', ...args); + } + } + + if (streamMode) { + streamResponseHandled = false; + + delayStream = new PassThrough({objectMode: opts.objectMode}); + requestStream = opts.request(requestOpts); + + setImmediate(() => { + retryStream.emit('request'); + }); + + requestStream + // gRPC via google-cloud-node can emit an `error` as well as a `response` + // Whichever it emits, we run with-- we can't run with both. That's what + // is up with the `streamResponseHandled` tracking. + .on('error', err => { + if (streamResponseHandled) { + return; + } + + streamResponseHandled = true; + onResponse(err); + }) + .on('response', (resp, body) => { + if (streamResponseHandled) { + return; + } + + streamResponseHandled = true; + onResponse(null, resp, body); + }) + .on('complete', (...params) => handleFinish(params)) + .on('finish', (...params) => handleFinish(params)); + + requestStream.pipe(delayStream); + } else { + activeRequest = opts.request(requestOpts, onResponse); + } + } + + function retryAfterDelay(currentRetryAttempt) { + if (streamMode) { + resetStreams(); + } + + const nextRetryDelay = getNextRetryDelay({ + maxRetryDelay: opts.maxRetryDelay, + retryDelayMultiplier: opts.retryDelayMultiplier, + retryNumber: currentRetryAttempt, + timeOfFirstRequest, + totalTimeout: opts.totalTimeout, + }); + debug(`Next retry delay: ${nextRetryDelay}`); + + if (nextRetryDelay <= 0) { + numNoResponseAttempts = opts.noResponseRetries + 1; + return; + } + + setTimeout(makeRequest, nextRetryDelay); + } + + function onResponse(err, response, body) { + // An error such as DNS resolution. + if (err) { + numNoResponseAttempts++; + + if (numNoResponseAttempts <= opts.noResponseRetries) { + retryAfterDelay(numNoResponseAttempts); + } else { + if (streamMode) { + retryStream.emit('error', err); + retryStream.end(); + } else { + callback(err, response, body); + } + } + + return; + } + + // Send the response to see if we should try again. + // NOTE: "currentRetryAttempt" isn't accurate by default, as it counts + // the very first request sent as the first "retry". It is only accurate + // when a user provides their own "currentRetryAttempt" option at + // instantiation. + const adjustedCurrentRetryAttempt = manualCurrentRetryAttemptWasSet + ? currentRetryAttempt + : currentRetryAttempt - 1; + if ( + adjustedCurrentRetryAttempt < opts.retries && + opts.shouldRetryFn(response) + ) { + retryAfterDelay(currentRetryAttempt); + return; + } + + // No more attempts need to be made, just continue on. + if (streamMode) { + retryStream.emit('response', response); + delayStream.pipe(retryStream); + requestStream.on('error', err => { + retryStream.destroy(err); + }); + } else { + callback(err, response, body); + } + } +} + +module.exports = retryRequest; + +function getNextRetryDelay(config) { + const { + maxRetryDelay, + retryDelayMultiplier, + retryNumber, + timeOfFirstRequest, + totalTimeout, + } = config; + + const maxRetryDelayMs = maxRetryDelay * 1000; + const totalTimeoutMs = totalTimeout * 1000; + + const jitter = Math.floor(Math.random() * 1000); + const calculatedNextRetryDelay = + Math.pow(retryDelayMultiplier, retryNumber) * 1000 + jitter; + + const maxAllowableDelayMs = + totalTimeoutMs - (Date.now() - timeOfFirstRequest); + + return Math.min( + calculatedNextRetryDelay, + maxAllowableDelayMs, + maxRetryDelayMs + ); +} + +module.exports.defaults = DEFAULTS; +module.exports.getNextRetryDelay = getNextRetryDelay; + + /***/ }), /***/ 93058: @@ -60535,6 +173753,1450 @@ module.exports = function getSideChannel() { }; +/***/ }), + +/***/ 71546: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + +"use strict"; + + +var stubs = __nccwpck_require__(33897) + +/* + * StreamEvents can be used 2 ways: + * + * 1: + * function MyStream() { + * require('stream-events').call(this) + * } + * + * 2: + * require('stream-events')(myStream) + */ +function StreamEvents(stream) { + stream = stream || this + + var cfg = { + callthrough: true, + calls: 1 + } + + stubs(stream, '_read', cfg, stream.emit.bind(stream, 'reading')) + stubs(stream, '_write', cfg, stream.emit.bind(stream, 'writing')) + + return stream +} + +module.exports = StreamEvents + + +/***/ }), + +/***/ 34633: +/***/ ((module) => { + +module.exports = shift + +function shift (stream) { + var rs = stream._readableState + if (!rs) return null + return (rs.objectMode || typeof stream._duplexState === 'number') ? stream.read() : stream.read(getStateLength(rs)) +} + +function getStateLength (state) { + if (state.buffer.length) { + var idx = state.bufferIndex || 0 + // Since node 6.3.0 state.buffer is a BufferList not an array + if (state.buffer.head) { + return state.buffer.head.data.length + } else if (state.buffer.length - idx > 0 && state.buffer[idx]) { + return state.buffer[idx].length + } + } + + return state.length +} + + +/***/ }), + +/***/ 80634: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; +// Copyright Joyent, Inc. and other Node contributors. +// +// Permission is hereby granted, free of charge, to any person obtaining a +// copy of this software and associated documentation files (the +// "Software"), to deal in the Software without restriction, including +// without limitation the rights to use, copy, modify, merge, publish, +// distribute, sublicense, and/or sell copies of the Software, and to permit +// persons to whom the Software is furnished to do so, subject to the +// following conditions: +// +// The above copyright notice and this permission notice shall be included +// in all copies or substantial portions of the Software. +// +// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN +// NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +// DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR +// OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE +// USE OR OTHER DEALINGS IN THE SOFTWARE. + + + +/**/ + +var Buffer = (__nccwpck_require__(93058).Buffer); +/**/ + +var isEncoding = Buffer.isEncoding || function (encoding) { + encoding = '' + encoding; + switch (encoding && encoding.toLowerCase()) { + case 'hex':case 'utf8':case 'utf-8':case 'ascii':case 'binary':case 'base64':case 'ucs2':case 'ucs-2':case 'utf16le':case 'utf-16le':case 'raw': + return true; + default: + return false; + } +}; + +function _normalizeEncoding(enc) { + if (!enc) return 'utf8'; + var retried; + while (true) { + switch (enc) { + case 'utf8': + case 'utf-8': + return 'utf8'; + case 'ucs2': + case 'ucs-2': + case 'utf16le': + case 'utf-16le': + return 'utf16le'; + case 'latin1': + case 'binary': + return 'latin1'; + case 'base64': + case 'ascii': + case 'hex': + return enc; + default: + if (retried) return; // undefined + enc = ('' + enc).toLowerCase(); + retried = true; + } + } +}; + +// Do not cache `Buffer.isEncoding` when checking encoding names as some +// modules monkey-patch it to support additional encodings +function normalizeEncoding(enc) { + var nenc = _normalizeEncoding(enc); + if (typeof nenc !== 'string' && (Buffer.isEncoding === isEncoding || !isEncoding(enc))) throw new Error('Unknown encoding: ' + enc); + return nenc || enc; +} + +// StringDecoder provides an interface for efficiently splitting a series of +// buffers into a series of JS strings without breaking apart multi-byte +// characters. +exports.I = StringDecoder; +function StringDecoder(encoding) { + this.encoding = normalizeEncoding(encoding); + var nb; + switch (this.encoding) { + case 'utf16le': + this.text = utf16Text; + this.end = utf16End; + nb = 4; + break; + case 'utf8': + this.fillLast = utf8FillLast; + nb = 4; + break; + case 'base64': + this.text = base64Text; + this.end = base64End; + nb = 3; + break; + default: + this.write = simpleWrite; + this.end = simpleEnd; + return; + } + this.lastNeed = 0; + this.lastTotal = 0; + this.lastChar = Buffer.allocUnsafe(nb); +} + +StringDecoder.prototype.write = function (buf) { + if (buf.length === 0) return ''; + var r; + var i; + if (this.lastNeed) { + r = this.fillLast(buf); + if (r === undefined) return ''; + i = this.lastNeed; + this.lastNeed = 0; + } else { + i = 0; + } + if (i < buf.length) return r ? r + this.text(buf, i) : this.text(buf, i); + return r || ''; +}; + +StringDecoder.prototype.end = utf8End; + +// Returns only complete characters in a Buffer +StringDecoder.prototype.text = utf8Text; + +// Attempts to complete a partial non-UTF-8 character using bytes from a Buffer +StringDecoder.prototype.fillLast = function (buf) { + if (this.lastNeed <= buf.length) { + buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); + } + buf.copy(this.lastChar, this.lastTotal - this.lastNeed, 0, buf.length); + this.lastNeed -= buf.length; +}; + +// Checks the type of a UTF-8 byte, whether it's ASCII, a leading byte, or a +// continuation byte. If an invalid byte is detected, -2 is returned. +function utf8CheckByte(byte) { + if (byte <= 0x7F) return 0;else if (byte >> 5 === 0x06) return 2;else if (byte >> 4 === 0x0E) return 3;else if (byte >> 3 === 0x1E) return 4; + return byte >> 6 === 0x02 ? -1 : -2; +} + +// Checks at most 3 bytes at the end of a Buffer in order to detect an +// incomplete multi-byte UTF-8 character. The total number of bytes (2, 3, or 4) +// needed to complete the UTF-8 character (if applicable) are returned. +function utf8CheckIncomplete(self, buf, i) { + var j = buf.length - 1; + if (j < i) return 0; + var nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 1; + return nb; + } + if (--j < i || nb === -2) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) self.lastNeed = nb - 2; + return nb; + } + if (--j < i || nb === -2) return 0; + nb = utf8CheckByte(buf[j]); + if (nb >= 0) { + if (nb > 0) { + if (nb === 2) nb = 0;else self.lastNeed = nb - 3; + } + return nb; + } + return 0; +} + +// Validates as many continuation bytes for a multi-byte UTF-8 character as +// needed or are available. If we see a non-continuation byte where we expect +// one, we "replace" the validated continuation bytes we've seen so far with +// a single UTF-8 replacement character ('\ufffd'), to match v8's UTF-8 decoding +// behavior. The continuation byte check is included three times in the case +// where all of the continuation bytes for a character exist in the same buffer. +// It is also done this way as a slight performance increase instead of using a +// loop. +function utf8CheckExtraBytes(self, buf, p) { + if ((buf[0] & 0xC0) !== 0x80) { + self.lastNeed = 0; + return '\ufffd'; + } + if (self.lastNeed > 1 && buf.length > 1) { + if ((buf[1] & 0xC0) !== 0x80) { + self.lastNeed = 1; + return '\ufffd'; + } + if (self.lastNeed > 2 && buf.length > 2) { + if ((buf[2] & 0xC0) !== 0x80) { + self.lastNeed = 2; + return '\ufffd'; + } + } + } +} + +// Attempts to complete a multi-byte UTF-8 character using bytes from a Buffer. +function utf8FillLast(buf) { + var p = this.lastTotal - this.lastNeed; + var r = utf8CheckExtraBytes(this, buf, p); + if (r !== undefined) return r; + if (this.lastNeed <= buf.length) { + buf.copy(this.lastChar, p, 0, this.lastNeed); + return this.lastChar.toString(this.encoding, 0, this.lastTotal); + } + buf.copy(this.lastChar, p, 0, buf.length); + this.lastNeed -= buf.length; +} + +// Returns all complete UTF-8 characters in a Buffer. If the Buffer ended on a +// partial character, the character's bytes are buffered until the required +// number of bytes are available. +function utf8Text(buf, i) { + var total = utf8CheckIncomplete(this, buf, i); + if (!this.lastNeed) return buf.toString('utf8', i); + this.lastTotal = total; + var end = buf.length - (total - this.lastNeed); + buf.copy(this.lastChar, 0, end); + return buf.toString('utf8', i, end); +} + +// For UTF-8, a replacement character is added when ending on a partial +// character. +function utf8End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + '\ufffd'; + return r; +} + +// UTF-16LE typically needs two bytes per character, but even if we have an even +// number of bytes available, we need to check if we end on a leading/high +// surrogate. In that case, we need to wait for the next two bytes in order to +// decode the last character properly. +function utf16Text(buf, i) { + if ((buf.length - i) % 2 === 0) { + var r = buf.toString('utf16le', i); + if (r) { + var c = r.charCodeAt(r.length - 1); + if (c >= 0xD800 && c <= 0xDBFF) { + this.lastNeed = 2; + this.lastTotal = 4; + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; + return r.slice(0, -1); + } + } + return r; + } + this.lastNeed = 1; + this.lastTotal = 2; + this.lastChar[0] = buf[buf.length - 1]; + return buf.toString('utf16le', i, buf.length - 1); +} + +// For UTF-16LE we do not explicitly append special replacement characters if we +// end on a partial character, we simply let v8 handle that. +function utf16End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) { + var end = this.lastTotal - this.lastNeed; + return r + this.lastChar.toString('utf16le', 0, end); + } + return r; +} + +function base64Text(buf, i) { + var n = (buf.length - i) % 3; + if (n === 0) return buf.toString('base64', i); + this.lastNeed = 3 - n; + this.lastTotal = 3; + if (n === 1) { + this.lastChar[0] = buf[buf.length - 1]; + } else { + this.lastChar[0] = buf[buf.length - 2]; + this.lastChar[1] = buf[buf.length - 1]; + } + return buf.toString('base64', i, buf.length - n); +} + +function base64End(buf) { + var r = buf && buf.length ? this.write(buf) : ''; + if (this.lastNeed) return r + this.lastChar.toString('base64', 0, 3 - this.lastNeed); + return r; +} + +// Pass bytes on through for single-byte encodings (e.g. ascii, latin1, hex) +function simpleWrite(buf) { + return buf.toString(this.encoding); +} + +function simpleEnd(buf) { + return buf && buf.length ? this.write(buf) : ''; +} + +/***/ }), + +/***/ 33897: +/***/ ((module) => { + +"use strict"; + + +module.exports = function stubs(obj, method, cfg, stub) { + if (!obj || !method || !obj[method]) + throw new Error('You must provide an object and a key for an existing method') + + if (!stub) { + stub = cfg + cfg = {} + } + + stub = stub || function() {} + + cfg.callthrough = cfg.callthrough || false + cfg.calls = cfg.calls || 0 + + var norevert = cfg.calls === 0 + + var cached = obj[method].bind(obj) + + obj[method] = function() { + var args = [].slice.call(arguments) + var returnVal + + if (cfg.callthrough) + returnVal = cached.apply(obj, args) + + returnVal = stub.apply(obj, args) || returnVal + + if (!norevert && --cfg.calls === 0) + obj[method] = cached + + return returnVal + } +} + + +/***/ }), + +/***/ 97745: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +/** + * @license + * Copyright 2020 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.TeenyStatistics = exports.TeenyStatisticsWarning = void 0; +/** + * @class TeenyStatisticsWarning + * @extends Error + * @description While an error, is used for emitting warnings when + * meeting certain configured thresholds. + * @see process.emitWarning + */ +class TeenyStatisticsWarning extends Error { + /** + * @param {string} message + */ + constructor(message) { + super(message); + this.threshold = 0; + this.type = ''; + this.value = 0; + this.name = this.constructor.name; + Error.captureStackTrace(this, this.constructor); + } +} +exports.TeenyStatisticsWarning = TeenyStatisticsWarning; +TeenyStatisticsWarning.CONCURRENT_REQUESTS = 'ConcurrentRequestsExceededWarning'; +/** + * @class TeenyStatistics + * @description Maintain various statistics internal to teeny-request. Tracking + * is not automatic and must be instrumented within teeny-request. + */ +class TeenyStatistics { + /** + * @param {TeenyStatisticsOptions} [opts] + */ + constructor(opts) { + /** + * @type {number} + * @private + * @default 0 + */ + this._concurrentRequests = 0; + /** + * @type {boolean} + * @private + * @default false + */ + this._didConcurrentRequestWarn = false; + this._options = TeenyStatistics._prepareOptions(opts); + } + /** + * Returns a copy of the current options. + * @return {TeenyStatisticsOptions} + */ + getOptions() { + return Object.assign({}, this._options); + } + /** + * Change configured statistics options. This will not preserve unspecified + * options that were previously specified, i.e. this is a reset of options. + * @param {TeenyStatisticsOptions} [opts] + * @returns {TeenyStatisticsConfig} The previous options. + * @see _prepareOptions + */ + setOptions(opts) { + const oldOpts = this._options; + this._options = TeenyStatistics._prepareOptions(opts); + return oldOpts; + } + /** + * @readonly + * @return {TeenyStatisticsCounters} + */ + get counters() { + return { + concurrentRequests: this._concurrentRequests, + }; + } + /** + * @description Should call this right before making a request. + */ + requestStarting() { + this._concurrentRequests++; + if (this._options.concurrentRequests > 0 && + this._concurrentRequests >= this._options.concurrentRequests && + !this._didConcurrentRequestWarn) { + this._didConcurrentRequestWarn = true; + const warning = new TeenyStatisticsWarning('Possible excessive concurrent requests detected. ' + + this._concurrentRequests + + ' requests in-flight, which exceeds the configured threshold of ' + + this._options.concurrentRequests + + '. Use the TEENY_REQUEST_WARN_CONCURRENT_REQUESTS environment ' + + 'variable or the concurrentRequests option of teeny-request to ' + + 'increase or disable (0) this warning.'); + warning.type = TeenyStatisticsWarning.CONCURRENT_REQUESTS; + warning.value = this._concurrentRequests; + warning.threshold = this._options.concurrentRequests; + process.emitWarning(warning); + } + } + /** + * @description When using `requestStarting`, call this after the request + * has finished. + */ + requestFinished() { + // TODO negative? + this._concurrentRequests--; + } + /** + * Configuration Precedence: + * 1. Dependency inversion via defined option. + * 2. Global numeric environment variable. + * 3. Built-in default. + * This will not preserve unspecified options previously specified. + * @param {TeenyStatisticsOptions} [opts] + * @returns {TeenyStatisticsOptions} + * @private + */ + static _prepareOptions({ concurrentRequests: diConcurrentRequests, } = {}) { + let concurrentRequests = this.DEFAULT_WARN_CONCURRENT_REQUESTS; + const envConcurrentRequests = Number(process.env.TEENY_REQUEST_WARN_CONCURRENT_REQUESTS); + if (diConcurrentRequests !== undefined) { + concurrentRequests = diConcurrentRequests; + } + else if (!Number.isNaN(envConcurrentRequests)) { + concurrentRequests = envConcurrentRequests; + } + return { concurrentRequests }; + } +} +exports.TeenyStatistics = TeenyStatistics; +/** + * @description A default threshold representing when to warn about excessive + * in-flight/concurrent requests. + * @type {number} + * @static + * @readonly + * @default 5000 + */ +TeenyStatistics.DEFAULT_WARN_CONCURRENT_REQUESTS = 5000; +//# sourceMappingURL=TeenyStatistics.js.map + +/***/ }), + +/***/ 34003: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/** + * @license + * Copyright 2019 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.getAgent = exports.pool = void 0; +const http_1 = __nccwpck_require__(58611); +const https_1 = __nccwpck_require__(65692); +// eslint-disable-next-line node/no-deprecated-api +const url_1 = __nccwpck_require__(87016); +exports.pool = new Map(); +/** + * Determines if a proxy should be considered based on the environment. + * + * @param uri The request uri + * @returns {boolean} + */ +function shouldUseProxyForURI(uri) { + const noProxyEnv = process.env.NO_PROXY || process.env.no_proxy; + if (!noProxyEnv) { + return true; + } + const givenURI = new URL(uri); + for (const noProxyRaw of noProxyEnv.split(',')) { + const noProxy = noProxyRaw.trim(); + if (noProxy === givenURI.origin || noProxy === givenURI.hostname) { + return false; + } + else if (noProxy.startsWith('*.') || noProxy.startsWith('.')) { + const noProxyWildcard = noProxy.replace(/^\*\./, '.'); + if (givenURI.hostname.endsWith(noProxyWildcard)) { + return false; + } + } + } + return true; +} +/** + * Returns a custom request Agent if one is found, otherwise returns undefined + * which will result in the global http(s) Agent being used. + * @private + * @param {string} uri The request uri + * @param {Options} reqOpts The request options + * @returns {HttpAnyAgent|undefined} + */ +function getAgent(uri, reqOpts) { + const isHttp = uri.startsWith('http://'); + const proxy = reqOpts.proxy || + process.env.HTTP_PROXY || + process.env.http_proxy || + process.env.HTTPS_PROXY || + process.env.https_proxy; + const poolOptions = Object.assign({}, reqOpts.pool); + const manuallyProvidedProxy = !!reqOpts.proxy; + const shouldUseProxy = manuallyProvidedProxy || shouldUseProxyForURI(uri); + if (proxy && shouldUseProxy) { + // tslint:disable-next-line variable-name + const Agent = isHttp + ? __nccwpck_require__(81970) + : __nccwpck_require__(6518); + const proxyOpts = { ...(0, url_1.parse)(proxy), ...poolOptions }; + return new Agent(proxyOpts); + } + let key = isHttp ? 'http' : 'https'; + if (reqOpts.forever) { + key += ':forever'; + if (!exports.pool.has(key)) { + // tslint:disable-next-line variable-name + const Agent = isHttp ? http_1.Agent : https_1.Agent; + exports.pool.set(key, new Agent({ ...poolOptions, keepAlive: true })); + } + } + return exports.pool.get(key); +} +exports.getAgent = getAgent; +//# sourceMappingURL=agents.js.map + +/***/ }), + +/***/ 80321: +/***/ ((__unused_webpack_module, exports, __nccwpck_require__) => { + +"use strict"; + +/** + * @license + * Copyright 2018 Google LLC + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.teenyRequest = exports.RequestError = void 0; +const node_fetch_1 = __nccwpck_require__(26705); +const stream_1 = __nccwpck_require__(2203); +const uuid = __nccwpck_require__(12048); +const agents_1 = __nccwpck_require__(34003); +const TeenyStatistics_1 = __nccwpck_require__(97745); +// eslint-disable-next-line @typescript-eslint/no-var-requires +const streamEvents = __nccwpck_require__(71546); +class RequestError extends Error { +} +exports.RequestError = RequestError; +/** + * Convert options from Request to Fetch format + * @private + * @param reqOpts Request options + */ +function requestToFetchOptions(reqOpts) { + const options = { + method: reqOpts.method || 'GET', + ...(reqOpts.timeout && { timeout: reqOpts.timeout }), + ...(typeof reqOpts.gzip === 'boolean' && { compress: reqOpts.gzip }), + }; + if (typeof reqOpts.json === 'object') { + // Add Content-type: application/json header + reqOpts.headers = reqOpts.headers || {}; + reqOpts.headers['Content-Type'] = 'application/json'; + // Set body to JSON representation of value + options.body = JSON.stringify(reqOpts.json); + } + else { + if (Buffer.isBuffer(reqOpts.body)) { + options.body = reqOpts.body; + } + else if (typeof reqOpts.body !== 'string') { + options.body = JSON.stringify(reqOpts.body); + } + else { + options.body = reqOpts.body; + } + } + // eslint-disable-next-line @typescript-eslint/no-explicit-any + options.headers = reqOpts.headers; + let uri = (reqOpts.uri || + reqOpts.url); + if (!uri) { + throw new Error('Missing uri or url in reqOpts.'); + } + if (reqOpts.useQuerystring === true || typeof reqOpts.qs === 'object') { + // eslint-disable-next-line @typescript-eslint/no-var-requires + const qs = __nccwpck_require__(83480); + const params = qs.stringify(reqOpts.qs); + uri = uri + '?' + params; + } + options.agent = (0, agents_1.getAgent)(uri, reqOpts); + return { uri, options }; +} +/** + * Convert a response from `fetch` to `request` format. + * @private + * @param opts The `request` options used to create the request. + * @param res The Fetch response + * @returns A `request` response object + */ +function fetchToRequestResponse(opts, res) { + const request = {}; + request.agent = opts.agent || false; + request.headers = (opts.headers || {}); + request.href = res.url; + // headers need to be converted from a map to an obj + const resHeaders = {}; + res.headers.forEach((value, key) => (resHeaders[key] = value)); + const response = Object.assign(res.body, { + statusCode: res.status, + statusMessage: res.statusText, + request, + body: res.body, + headers: resHeaders, + toJSON: () => ({ headers: resHeaders }), + }); + return response; +} +/** + * Create POST body from two parts as multipart/related content-type + * @private + * @param boundary + * @param multipart + */ +function createMultipartStream(boundary, multipart) { + const finale = `--${boundary}--`; + const stream = new stream_1.PassThrough(); + for (const part of multipart) { + const preamble = `--${boundary}\r\nContent-Type: ${part['Content-Type']}\r\n\r\n`; + stream.write(preamble); + if (typeof part.body === 'string') { + stream.write(part.body); + stream.write('\r\n'); + } + else { + part.body.pipe(stream, { end: false }); + part.body.on('end', () => { + stream.write('\r\n'); + stream.write(finale); + stream.end(); + }); + } + } + return stream; +} +function teenyRequest(reqOpts, callback) { + const { uri, options } = requestToFetchOptions(reqOpts); + const multipart = reqOpts.multipart; + if (reqOpts.multipart && multipart.length === 2) { + if (!callback) { + // TODO: add support for multipart uploads through streaming + throw new Error('Multipart without callback is not implemented.'); + } + const boundary = uuid.v4(); + options.headers['Content-Type'] = `multipart/related; boundary=${boundary}`; + options.body = createMultipartStream(boundary, multipart); + // Multipart upload + teenyRequest.stats.requestStarting(); + (0, node_fetch_1.default)(uri, options).then(res => { + teenyRequest.stats.requestFinished(); + const header = res.headers.get('content-type'); + const response = fetchToRequestResponse(options, res); + const body = response.body; + if (header === 'application/json' || + header === 'application/json; charset=utf-8') { + res.json().then(json => { + response.body = json; + callback(null, response, json); + }, (err) => { + callback(err, response, body); + }); + return; + } + res.text().then(text => { + response.body = text; + callback(null, response, text); + }, err => { + callback(err, response, body); + }); + }, err => { + teenyRequest.stats.requestFinished(); + callback(err, null, null); + }); + return; + } + if (callback === undefined) { + // Stream mode + const requestStream = streamEvents(new stream_1.PassThrough()); + // eslint-disable-next-line @typescript-eslint/no-explicit-any + let responseStream; + requestStream.once('reading', () => { + if (responseStream) { + (0, stream_1.pipeline)(responseStream, requestStream, () => { }); + } + else { + requestStream.once('response', () => { + (0, stream_1.pipeline)(responseStream, requestStream, () => { }); + }); + } + }); + options.compress = false; + teenyRequest.stats.requestStarting(); + (0, node_fetch_1.default)(uri, options).then(res => { + teenyRequest.stats.requestFinished(); + responseStream = res.body; + responseStream.on('error', (err) => { + requestStream.emit('error', err); + }); + const response = fetchToRequestResponse(options, res); + requestStream.emit('response', response); + }, err => { + teenyRequest.stats.requestFinished(); + requestStream.emit('error', err); + }); + // fetch doesn't supply the raw HTTP stream, instead it + // returns a PassThrough piped from the HTTP response + // stream. + return requestStream; + } + // GET or POST with callback + teenyRequest.stats.requestStarting(); + (0, node_fetch_1.default)(uri, options).then(res => { + teenyRequest.stats.requestFinished(); + const header = res.headers.get('content-type'); + const response = fetchToRequestResponse(options, res); + const body = response.body; + if (header === 'application/json' || + header === 'application/json; charset=utf-8') { + if (response.statusCode === 204) { + // Probably a DELETE + callback(null, response, body); + return; + } + res.json().then(json => { + response.body = json; + callback(null, response, json); + }, err => { + callback(err, response, body); + }); + return; + } + res.text().then(text => { + const response = fetchToRequestResponse(options, res); + response.body = text; + callback(null, response, text); + }, err => { + callback(err, response, body); + }); + }, err => { + teenyRequest.stats.requestFinished(); + callback(err, null, null); + }); + return; +} +exports.teenyRequest = teenyRequest; +teenyRequest.defaults = (defaults) => { + return (reqOpts, callback) => { + const opts = { ...defaults, ...reqOpts }; + if (callback === undefined) { + return teenyRequest(opts); + } + teenyRequest(opts, callback); + }; +}; +/** + * Single instance of an interface for keeping track of things. + */ +teenyRequest.stats = new TeenyStatistics_1.TeenyStatistics(); +teenyRequest.resetStats = () => { + teenyRequest.stats = new TeenyStatistics_1.TeenyStatistics(teenyRequest.stats.getOptions()); +}; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 77954: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +const events_1 = __nccwpck_require__(24434); +const debug_1 = __importDefault(__nccwpck_require__(2830)); +const promisify_1 = __importDefault(__nccwpck_require__(44446)); +const debug = debug_1.default('agent-base'); +function isAgent(v) { + return Boolean(v) && typeof v.addRequest === 'function'; +} +function isSecureEndpoint() { + const { stack } = new Error(); + if (typeof stack !== 'string') + return false; + return stack.split('\n').some(l => l.indexOf('(https.js:') !== -1 || l.indexOf('node:https:') !== -1); +} +function createAgent(callback, opts) { + return new createAgent.Agent(callback, opts); +} +(function (createAgent) { + /** + * Base `http.Agent` implementation. + * No pooling/keep-alive is implemented by default. + * + * @param {Function} callback + * @api public + */ + class Agent extends events_1.EventEmitter { + constructor(callback, _opts) { + super(); + let opts = _opts; + if (typeof callback === 'function') { + this.callback = callback; + } + else if (callback) { + opts = callback; + } + // Timeout for the socket to be returned from the callback + this.timeout = null; + if (opts && typeof opts.timeout === 'number') { + this.timeout = opts.timeout; + } + // These aren't actually used by `agent-base`, but are required + // for the TypeScript definition files in `@types/node` :/ + this.maxFreeSockets = 1; + this.maxSockets = 1; + this.maxTotalSockets = Infinity; + this.sockets = {}; + this.freeSockets = {}; + this.requests = {}; + this.options = {}; + } + get defaultPort() { + if (typeof this.explicitDefaultPort === 'number') { + return this.explicitDefaultPort; + } + return isSecureEndpoint() ? 443 : 80; + } + set defaultPort(v) { + this.explicitDefaultPort = v; + } + get protocol() { + if (typeof this.explicitProtocol === 'string') { + return this.explicitProtocol; + } + return isSecureEndpoint() ? 'https:' : 'http:'; + } + set protocol(v) { + this.explicitProtocol = v; + } + callback(req, opts, fn) { + throw new Error('"agent-base" has no default implementation, you must subclass and override `callback()`'); + } + /** + * Called by node-core's "_http_client.js" module when creating + * a new HTTP request with this Agent instance. + * + * @api public + */ + addRequest(req, _opts) { + const opts = Object.assign({}, _opts); + if (typeof opts.secureEndpoint !== 'boolean') { + opts.secureEndpoint = isSecureEndpoint(); + } + if (opts.host == null) { + opts.host = 'localhost'; + } + if (opts.port == null) { + opts.port = opts.secureEndpoint ? 443 : 80; + } + if (opts.protocol == null) { + opts.protocol = opts.secureEndpoint ? 'https:' : 'http:'; + } + if (opts.host && opts.path) { + // If both a `host` and `path` are specified then it's most + // likely the result of a `url.parse()` call... we need to + // remove the `path` portion so that `net.connect()` doesn't + // attempt to open that as a unix socket file. + delete opts.path; + } + delete opts.agent; + delete opts.hostname; + delete opts._defaultAgent; + delete opts.defaultPort; + delete opts.createConnection; + // Hint to use "Connection: close" + // XXX: non-documented `http` module API :( + req._last = true; + req.shouldKeepAlive = false; + let timedOut = false; + let timeoutId = null; + const timeoutMs = opts.timeout || this.timeout; + const onerror = (err) => { + if (req._hadError) + return; + req.emit('error', err); + // For Safety. Some additional errors might fire later on + // and we need to make sure we don't double-fire the error event. + req._hadError = true; + }; + const ontimeout = () => { + timeoutId = null; + timedOut = true; + const err = new Error(`A "socket" was not created for HTTP request before ${timeoutMs}ms`); + err.code = 'ETIMEOUT'; + onerror(err); + }; + const callbackError = (err) => { + if (timedOut) + return; + if (timeoutId !== null) { + clearTimeout(timeoutId); + timeoutId = null; + } + onerror(err); + }; + const onsocket = (socket) => { + if (timedOut) + return; + if (timeoutId != null) { + clearTimeout(timeoutId); + timeoutId = null; + } + if (isAgent(socket)) { + // `socket` is actually an `http.Agent` instance, so + // relinquish responsibility for this `req` to the Agent + // from here on + debug('Callback returned another Agent instance %o', socket.constructor.name); + socket.addRequest(req, opts); + return; + } + if (socket) { + socket.once('free', () => { + this.freeSocket(socket, opts); + }); + req.onSocket(socket); + return; + } + const err = new Error(`no Duplex stream was returned to agent-base for \`${req.method} ${req.path}\``); + onerror(err); + }; + if (typeof this.callback !== 'function') { + onerror(new Error('`callback` is not defined')); + return; + } + if (!this.promisifiedCallback) { + if (this.callback.length >= 3) { + debug('Converting legacy callback function to promise'); + this.promisifiedCallback = promisify_1.default(this.callback); + } + else { + this.promisifiedCallback = this.callback; + } + } + if (typeof timeoutMs === 'number' && timeoutMs > 0) { + timeoutId = setTimeout(ontimeout, timeoutMs); + } + if ('port' in opts && typeof opts.port !== 'number') { + opts.port = Number(opts.port); + } + try { + debug('Resolving socket for %o request: %o', opts.protocol, `${req.method} ${req.path}`); + Promise.resolve(this.promisifiedCallback(req, opts)).then(onsocket, callbackError); + } + catch (err) { + Promise.reject(err).catch(callbackError); + } + } + freeSocket(socket, opts) { + debug('Freeing socket %o %o', socket.constructor.name, opts); + socket.destroy(); + } + destroy() { + debug('Destroying agent %o', this.constructor.name); + } + } + createAgent.Agent = Agent; + // So that `instanceof` works correctly + createAgent.prototype = createAgent.Agent.prototype; +})(createAgent || (createAgent = {})); +module.exports = createAgent; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 44446: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +function promisify(fn) { + return function (req, opts) { + return new Promise((resolve, reject) => { + fn.call(this, req, opts, (err, rtn) => { + if (err) { + reject(err); + } + else { + resolve(rtn); + } + }); + }); + }; +} +exports["default"] = promisify; +//# sourceMappingURL=promisify.js.map + +/***/ }), + +/***/ 15299: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { + function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } + return new (P || (P = Promise))(function (resolve, reject) { + function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } + function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } + function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } + step((generator = generator.apply(thisArg, _arguments || [])).next()); + }); +}; +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const net_1 = __importDefault(__nccwpck_require__(69278)); +const tls_1 = __importDefault(__nccwpck_require__(64756)); +const url_1 = __importDefault(__nccwpck_require__(87016)); +const assert_1 = __importDefault(__nccwpck_require__(42613)); +const debug_1 = __importDefault(__nccwpck_require__(2830)); +const agent_base_1 = __nccwpck_require__(77954); +const parse_proxy_response_1 = __importDefault(__nccwpck_require__(27742)); +const debug = debug_1.default('https-proxy-agent:agent'); +/** + * The `HttpsProxyAgent` implements an HTTP Agent subclass that connects to + * the specified "HTTP(s) proxy server" in order to proxy HTTPS requests. + * + * Outgoing HTTP requests are first tunneled through the proxy server using the + * `CONNECT` HTTP request method to establish a connection to the proxy server, + * and then the proxy server connects to the destination target and issues the + * HTTP request from the proxy server. + * + * `https:` requests have their socket connection upgraded to TLS once + * the connection to the proxy server has been established. + * + * @api public + */ +class HttpsProxyAgent extends agent_base_1.Agent { + constructor(_opts) { + let opts; + if (typeof _opts === 'string') { + opts = url_1.default.parse(_opts); + } + else { + opts = _opts; + } + if (!opts) { + throw new Error('an HTTP(S) proxy server `host` and `port` must be specified!'); + } + debug('creating new HttpsProxyAgent instance: %o', opts); + super(opts); + const proxy = Object.assign({}, opts); + // If `true`, then connect to the proxy server over TLS. + // Defaults to `false`. + this.secureProxy = opts.secureProxy || isHTTPS(proxy.protocol); + // Prefer `hostname` over `host`, and set the `port` if needed. + proxy.host = proxy.hostname || proxy.host; + if (typeof proxy.port === 'string') { + proxy.port = parseInt(proxy.port, 10); + } + if (!proxy.port && proxy.host) { + proxy.port = this.secureProxy ? 443 : 80; + } + // ALPN is supported by Node.js >= v5. + // attempt to negotiate http/1.1 for proxy servers that support http/2 + if (this.secureProxy && !('ALPNProtocols' in proxy)) { + proxy.ALPNProtocols = ['http 1.1']; + } + if (proxy.host && proxy.path) { + // If both a `host` and `path` are specified then it's most likely + // the result of a `url.parse()` call... we need to remove the + // `path` portion so that `net.connect()` doesn't attempt to open + // that as a Unix socket file. + delete proxy.path; + delete proxy.pathname; + } + this.proxy = proxy; + } + /** + * Called when the node-core HTTP client library is creating a + * new HTTP request. + * + * @api protected + */ + callback(req, opts) { + return __awaiter(this, void 0, void 0, function* () { + const { proxy, secureProxy } = this; + // Create a socket connection to the proxy server. + let socket; + if (secureProxy) { + debug('Creating `tls.Socket`: %o', proxy); + socket = tls_1.default.connect(proxy); + } + else { + debug('Creating `net.Socket`: %o', proxy); + socket = net_1.default.connect(proxy); + } + const headers = Object.assign({}, proxy.headers); + const hostname = `${opts.host}:${opts.port}`; + let payload = `CONNECT ${hostname} HTTP/1.1\r\n`; + // Inject the `Proxy-Authorization` header if necessary. + if (proxy.auth) { + headers['Proxy-Authorization'] = `Basic ${Buffer.from(proxy.auth).toString('base64')}`; + } + // The `Host` header should only include the port + // number when it is not the default port. + let { host, port, secureEndpoint } = opts; + if (!isDefaultPort(port, secureEndpoint)) { + host += `:${port}`; + } + headers.Host = host; + headers.Connection = 'close'; + for (const name of Object.keys(headers)) { + payload += `${name}: ${headers[name]}\r\n`; + } + const proxyResponsePromise = parse_proxy_response_1.default(socket); + socket.write(`${payload}\r\n`); + const { statusCode, buffered } = yield proxyResponsePromise; + if (statusCode === 200) { + req.once('socket', resume); + if (opts.secureEndpoint) { + // The proxy is connecting to a TLS server, so upgrade + // this socket connection to a TLS connection. + debug('Upgrading socket connection to TLS'); + const servername = opts.servername || opts.host; + return tls_1.default.connect(Object.assign(Object.assign({}, omit(opts, 'host', 'hostname', 'path', 'port')), { socket, + servername })); + } + return socket; + } + // Some other status code that's not 200... need to re-play the HTTP + // header "data" events onto the socket once the HTTP machinery is + // attached so that the node core `http` can parse and handle the + // error status code. + // Close the original socket, and a new "fake" socket is returned + // instead, so that the proxy doesn't get the HTTP request + // written to it (which may contain `Authorization` headers or other + // sensitive data). + // + // See: https://hackerone.com/reports/541502 + socket.destroy(); + const fakeSocket = new net_1.default.Socket({ writable: false }); + fakeSocket.readable = true; + // Need to wait for the "socket" event to re-play the "data" events. + req.once('socket', (s) => { + debug('replaying proxy buffer for failed request'); + assert_1.default(s.listenerCount('data') > 0); + // Replay the "buffered" Buffer onto the fake `socket`, since at + // this point the HTTP module machinery has been hooked up for + // the user. + s.push(buffered); + s.push(null); + }); + return fakeSocket; + }); + } +} +exports["default"] = HttpsProxyAgent; +function resume(socket) { + socket.resume(); +} +function isDefaultPort(port, secure) { + return Boolean((!secure && port === 80) || (secure && port === 443)); +} +function isHTTPS(protocol) { + return typeof protocol === 'string' ? /^https:?$/i.test(protocol) : false; +} +function omit(obj, ...keys) { + const ret = {}; + let key; + for (key in obj) { + if (!keys.includes(key)) { + ret[key] = obj[key]; + } + } + return ret; +} +//# sourceMappingURL=agent.js.map + +/***/ }), + +/***/ 6518: +/***/ (function(module, __unused_webpack_exports, __nccwpck_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +const agent_1 = __importDefault(__nccwpck_require__(15299)); +function createHttpsProxyAgent(opts) { + return new agent_1.default(opts); +} +(function (createHttpsProxyAgent) { + createHttpsProxyAgent.HttpsProxyAgent = agent_1.default; + createHttpsProxyAgent.prototype = agent_1.default.prototype; +})(createHttpsProxyAgent || (createHttpsProxyAgent = {})); +module.exports = createHttpsProxyAgent; +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 27742: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __importDefault = (this && this.__importDefault) || function (mod) { + return (mod && mod.__esModule) ? mod : { "default": mod }; +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +const debug_1 = __importDefault(__nccwpck_require__(2830)); +const debug = debug_1.default('https-proxy-agent:parse-proxy-response'); +function parseProxyResponse(socket) { + return new Promise((resolve, reject) => { + // we need to buffer any HTTP traffic that happens with the proxy before we get + // the CONNECT response, so that if the response is anything other than an "200" + // response code, then we can re-play the "data" events on the socket once the + // HTTP parser is hooked up... + let buffersLength = 0; + const buffers = []; + function read() { + const b = socket.read(); + if (b) + ondata(b); + else + socket.once('readable', read); + } + function cleanup() { + socket.removeListener('end', onend); + socket.removeListener('error', onerror); + socket.removeListener('close', onclose); + socket.removeListener('readable', read); + } + function onclose(err) { + debug('onclose had error %o', err); + } + function onend() { + debug('onend'); + } + function onerror(err) { + cleanup(); + debug('onerror %o', err); + reject(err); + } + function ondata(b) { + buffers.push(b); + buffersLength += b.length; + const buffered = Buffer.concat(buffers, buffersLength); + const endOfHeaders = buffered.indexOf('\r\n\r\n'); + if (endOfHeaders === -1) { + // keep buffering + debug('have not received end of HTTP headers yet...'); + read(); + return; + } + const firstLine = buffered.toString('ascii', 0, buffered.indexOf('\r\n')); + const statusCode = +firstLine.split(' ')[1]; + debug('got proxy server response: %o', firstLine); + resolve({ + statusCode, + buffered + }); + } + socket.on('error', onerror); + socket.on('close', onclose); + socket.on('end', onend); + read(); + }); +} +exports["default"] = parseProxyResponse; +//# sourceMappingURL=parse-proxy-response.js.map + /***/ }), /***/ 1552: @@ -83405,6 +198067,19 @@ exports.getUserAgent = getUserAgent; })); +/***/ }), + +/***/ 24488: +/***/ ((module, __unused_webpack_exports, __nccwpck_require__) => { + + +/** + * For Node.js, simply re-export the core `util.deprecate` function. + */ + +module.exports = __nccwpck_require__(39023).deprecate; + + /***/ }), /***/ 12048: @@ -86161,6 +200836,14 @@ module.exports = require("diagnostics_channel"); /***/ }), +/***/ 72250: +/***/ ((module) => { + +"use strict"; +module.exports = require("dns"); + +/***/ }), + /***/ 24434: /***/ ((module) => { @@ -88008,6 +202691,1944 @@ function parseParams (str) { module.exports = parseParams +/***/ }), + +/***/ 13660: +/***/ (function(__unused_webpack_module, exports, __nccwpck_require__) { + +"use strict"; + +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.encode = encode; +exports.decodeEntity = decodeEntity; +exports.decode = decode; +var named_references_js_1 = __nccwpck_require__(56000); +var numeric_unicode_map_js_1 = __nccwpck_require__(53438); +var surrogate_pairs_js_1 = __nccwpck_require__(69718); +var allNamedReferences = __assign(__assign({}, named_references_js_1.namedReferences), { all: named_references_js_1.namedReferences.html5 }); +var encodeRegExps = { + specialChars: /[<>'"&]/g, + nonAscii: /[<>'"&\u0080-\uD7FF\uE000-\uFFFF\uDC00-\uDFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g, + nonAsciiPrintable: /[<>'"&\x01-\x08\x11-\x15\x17-\x1F\x7f-\uD7FF\uE000-\uFFFF\uDC00-\uDFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g, + nonAsciiPrintableOnly: /[\x01-\x08\x11-\x15\x17-\x1F\x7f-\uD7FF\uE000-\uFFFF\uDC00-\uDFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g, + extensive: /[\x01-\x0c\x0e-\x1f\x21-\x2c\x2e-\x2f\x3a-\x40\x5b-\x60\x7b-\x7d\x7f-\uD7FF\uE000-\uFFFF\uDC00-\uDFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]?/g +}; +var defaultEncodeOptions = { + mode: 'specialChars', + level: 'all', + numeric: 'decimal' +}; +/** Encodes all the necessary (specified by `level`) characters in the text */ +function encode(text, _a) { + var _b = _a === void 0 ? defaultEncodeOptions : _a, _c = _b.mode, mode = _c === void 0 ? 'specialChars' : _c, _d = _b.numeric, numeric = _d === void 0 ? 'decimal' : _d, _e = _b.level, level = _e === void 0 ? 'all' : _e; + if (!text) { + return ''; + } + var encodeRegExp = encodeRegExps[mode]; + var references = allNamedReferences[level].characters; + var isHex = numeric === 'hexadecimal'; + return String.prototype.replace.call(text, encodeRegExp, function (input) { + var result = references[input]; + if (!result) { + var code = input.length > 1 ? (0, surrogate_pairs_js_1.getCodePoint)(input, 0) : input.charCodeAt(0); + result = (isHex ? '&#x' + code.toString(16) : '&#' + code) + ';'; + } + return result; + }); +} +var defaultDecodeOptions = { + scope: 'body', + level: 'all' +}; +var strict = /&(?:#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+);/g; +var attribute = /&(?:#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+)[;=]?/g; +var baseDecodeRegExps = { + xml: { + strict: strict, + attribute: attribute, + body: named_references_js_1.bodyRegExps.xml + }, + html4: { + strict: strict, + attribute: attribute, + body: named_references_js_1.bodyRegExps.html4 + }, + html5: { + strict: strict, + attribute: attribute, + body: named_references_js_1.bodyRegExps.html5 + } +}; +var decodeRegExps = __assign(__assign({}, baseDecodeRegExps), { all: baseDecodeRegExps.html5 }); +var fromCharCode = String.fromCharCode; +var outOfBoundsChar = fromCharCode(65533); +var defaultDecodeEntityOptions = { + level: 'all' +}; +function getDecodedEntity(entity, references, isAttribute, isStrict) { + var decodeResult = entity; + var decodeEntityLastChar = entity[entity.length - 1]; + if (isAttribute && decodeEntityLastChar === '=') { + decodeResult = entity; + } + else if (isStrict && decodeEntityLastChar !== ';') { + decodeResult = entity; + } + else { + var decodeResultByReference = references[entity]; + if (decodeResultByReference) { + decodeResult = decodeResultByReference; + } + else if (entity[0] === '&' && entity[1] === '#') { + var decodeSecondChar = entity[2]; + var decodeCode = decodeSecondChar == 'x' || decodeSecondChar == 'X' + ? parseInt(entity.substr(3), 16) + : parseInt(entity.substr(2)); + decodeResult = + decodeCode >= 0x10ffff + ? outOfBoundsChar + : decodeCode > 65535 + ? (0, surrogate_pairs_js_1.fromCodePoint)(decodeCode) + : fromCharCode(numeric_unicode_map_js_1.numericUnicodeMap[decodeCode] || decodeCode); + } + } + return decodeResult; +} +/** Decodes a single entity */ +function decodeEntity(entity, _a) { + var _b = _a === void 0 ? defaultDecodeEntityOptions : _a, _c = _b.level, level = _c === void 0 ? 'all' : _c; + if (!entity) { + return ''; + } + return getDecodedEntity(entity, allNamedReferences[level].entities, false, false); +} +/** Decodes all entities in the text */ +function decode(text, _a) { + var _b = _a === void 0 ? defaultDecodeOptions : _a, _c = _b.level, level = _c === void 0 ? 'all' : _c, _d = _b.scope, scope = _d === void 0 ? level === 'xml' ? 'strict' : 'body' : _d; + if (!text) { + return ''; + } + var decodeRegExp = decodeRegExps[level][scope]; + var references = allNamedReferences[level].entities; + var isAttribute = scope === 'attribute'; + var isStrict = scope === 'strict'; + return text.replace(decodeRegExp, function (entity) { return getDecodedEntity(entity, references, isAttribute, isStrict); }); +} +//# sourceMappingURL=index.js.map + +/***/ }), + +/***/ 56000: +/***/ (function(__unused_webpack_module, exports) { + +"use strict"; + +var __assign = (this && this.__assign) || function () { + __assign = Object.assign || function(t) { + for (var s, i = 1, n = arguments.length; i < n; i++) { + s = arguments[i]; + for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) + t[p] = s[p]; + } + return t; + }; + return __assign.apply(this, arguments); +}; +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.namedReferences = exports.bodyRegExps = void 0; +// This file is autogenerated by tools/process-named-references.ts +var pairDivider = "~"; +var blockDivider = "~~"; +function generateNamedReferences(input, prev) { + var entities = {}; + var characters = {}; + var blocks = input.split(blockDivider); + var isOptionalBlock = false; + for (var i = 0; blocks.length > i; i++) { + var entries = blocks[i].split(pairDivider); + for (var j = 0; j < entries.length; j += 2) { + var entity = entries[j]; + var character = entries[j + 1]; + var fullEntity = '&' + entity + ';'; + entities[fullEntity] = character; + if (isOptionalBlock) { + entities['&' + entity] = character; + } + characters[character] = fullEntity; + } + isOptionalBlock = true; + } + return prev ? + { entities: __assign(__assign({}, entities), prev.entities), characters: __assign(__assign({}, characters), prev.characters) } : + { entities: entities, characters: characters }; +} +exports.bodyRegExps = { + xml: /&(?:#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+);?/g, + html4: /∉|&(?:nbsp|iexcl|cent|pound|curren|yen|brvbar|sect|uml|copy|ordf|laquo|not|shy|reg|macr|deg|plusmn|sup2|sup3|acute|micro|para|middot|cedil|sup1|ordm|raquo|frac14|frac12|frac34|iquest|Agrave|Aacute|Acirc|Atilde|Auml|Aring|AElig|Ccedil|Egrave|Eacute|Ecirc|Euml|Igrave|Iacute|Icirc|Iuml|ETH|Ntilde|Ograve|Oacute|Ocirc|Otilde|Ouml|times|Oslash|Ugrave|Uacute|Ucirc|Uuml|Yacute|THORN|szlig|agrave|aacute|acirc|atilde|auml|aring|aelig|ccedil|egrave|eacute|ecirc|euml|igrave|iacute|icirc|iuml|eth|ntilde|ograve|oacute|ocirc|otilde|ouml|divide|oslash|ugrave|uacute|ucirc|uuml|yacute|thorn|yuml|quot|amp|lt|gt|#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+);?/g, + html5: /·|℗|⋇|⪧|⩺|⋗|⦕|⩼|⪆|⥸|⋗|⋛|⪌|≷|≳|⪦|⩹|⋖|⋋|⋉|⥶|⩻|⦖|◃|⊴|◂|∉|⋹̸|⋵̸|∉|⋷|⋶|∌|∌|⋾|⋽|∥|⊠|⨱|⨰|&(?:AElig|AMP|Aacute|Acirc|Agrave|Aring|Atilde|Auml|COPY|Ccedil|ETH|Eacute|Ecirc|Egrave|Euml|GT|Iacute|Icirc|Igrave|Iuml|LT|Ntilde|Oacute|Ocirc|Ograve|Oslash|Otilde|Ouml|QUOT|REG|THORN|Uacute|Ucirc|Ugrave|Uuml|Yacute|aacute|acirc|acute|aelig|agrave|amp|aring|atilde|auml|brvbar|ccedil|cedil|cent|copy|curren|deg|divide|eacute|ecirc|egrave|eth|euml|frac12|frac14|frac34|gt|iacute|icirc|iexcl|igrave|iquest|iuml|laquo|lt|macr|micro|middot|nbsp|not|ntilde|oacute|ocirc|ograve|ordf|ordm|oslash|otilde|ouml|para|plusmn|pound|quot|raquo|reg|sect|shy|sup1|sup2|sup3|szlig|thorn|times|uacute|ucirc|ugrave|uml|uuml|yacute|yen|yuml|#\d+|#[xX][\da-fA-F]+|[0-9a-zA-Z]+);?/g +}; +exports.namedReferences = {}; +exports.namedReferences.xml = generateNamedReferences("lt~<~gt~>~quot~\"~apos~'~amp~&"); +exports.namedReferences.html4 = generateNamedReferences("apos~'~OElig~Œ~oelig~œ~Scaron~Å ~scaron~ÅĄ~Yuml~Ÿ~circ~ˆ~tilde~˜~ensp~ ~emsp~ ~thinsp~ ~zwnj~‌~zwj~‍~lrm~‎~rlm~‏~ndash~–~mdash~—~lsquo~‘~rsquo~’~sbquo~‚~ldquo~“~rdquo~”~bdquo~„~dagger~†~Dagger~‡~permil~‰~lsaquo~‹~rsaquo~â€ē~euro~â‚Ŧ~fnof~ƒ~Alpha~Α~Beta~Β~Gamma~Γ~Delta~Δ~Epsilon~Ε~Zeta~Ζ~Eta~Η~Theta~Θ~Iota~Ι~Kappa~Κ~Lambda~Λ~Mu~Μ~Nu~Ν~Xi~Ξ~Omicron~Ο~Pi~Π~Rho~ÎĄ~Sigma~ÎŖ~Tau~Τ~Upsilon~ÎĨ~Phi~ÎĻ~Chi~Χ~Psi~Ψ~Omega~Ί~alpha~Îą~beta~β~gamma~Îŗ~delta~δ~epsilon~Îĩ~zeta~Îļ~eta~Ρ~theta~θ~iota~Κ~kappa~Îē~lambda~Îģ~mu~Îŧ~nu~ÎŊ~xi~Ξ~omicron~Îŋ~pi~Ī€~rho~΁~sigmaf~Ī‚~sigma~΃~tau~Ī„~upsilon~Ī…~phi~Ά~chi~·~psi~Έ~omega~Ή~thetasym~Ī‘~upsih~Ī’~piv~Ī–~bull~â€ĸ~hellip~â€Ļ~prime~′~Prime~â€ŗ~oline~‾~frasl~⁄~weierp~℘~image~ℑ~real~ℜ~trade~â„ĸ~alefsym~â„ĩ~larr~←~uarr~↑~rarr~→~darr~↓~harr~↔~crarr~â†ĩ~lArr~⇐~uArr~⇑~rArr~⇒~dArr~⇓~hArr~⇔~forall~∀~part~∂~exist~∃~empty~∅~nabla~∇~isin~∈~notin~∉~ni~∋~prod~∏~sum~∑~minus~−~lowast~∗~radic~√~prop~∝~infin~∞~ang~∠~and~∧~or~∨~cap~∊~cup~âˆĒ~int~âˆĢ~there4~∴~sim~âˆŧ~cong~≅~asymp~≈~ne~≠~equiv~≡~le~≤~ge~â‰Ĩ~sub~⊂~sup~⊃~nsub~⊄~sube~⊆~supe~⊇~oplus~⊕~otimes~⊗~perp~âŠĨ~sdot~⋅~lceil~⌈~rceil~⌉~lfloor~⌊~rfloor~⌋~lang~〈~rang~âŒĒ~loz~◊~spades~♠~clubs~â™Ŗ~hearts~â™Ĩ~diams~â™Ļ~~nbsp~ ~iexcl~ÂĄ~cent~Âĸ~pound~ÂŖ~curren~¤~yen~ÂĨ~brvbar~ÂĻ~sect~§~uml~¨~copy~Š~ordf~ÂĒ~laquo~ÂĢ~not~ÂŦ~shy~­~reg~ÂŽ~macr~¯~deg~°~plusmn~Âą~sup2~²~sup3~Âŗ~acute~´~micro~Âĩ~para~Âļ~middot~¡~cedil~¸~sup1~š~ordm~Âē~raquo~Âģ~frac14~Âŧ~frac12~ÂŊ~frac34~ž~iquest~Âŋ~Agrave~À~Aacute~Á~Acirc~Â~Atilde~Ã~Auml~Ä~Aring~Å~AElig~Æ~Ccedil~Ç~Egrave~È~Eacute~É~Ecirc~Ê~Euml~Ë~Igrave~Ì~Iacute~Í~Icirc~Î~Iuml~Ï~ETH~Ð~Ntilde~Ñ~Ograve~Ò~Oacute~Ó~Ocirc~Ô~Otilde~Õ~Ouml~Ö~times~×~Oslash~Ø~Ugrave~Ù~Uacute~Ú~Ucirc~Û~Uuml~Ü~Yacute~Ý~THORN~Þ~szlig~ß~agrave~à~aacute~ÃĄ~acirc~Ãĸ~atilde~ÃŖ~auml~ä~aring~ÃĨ~aelig~ÃĻ~ccedil~ç~egrave~è~eacute~Ê~ecirc~ÃĒ~euml~ÃĢ~igrave~ÃŦ~iacute~í~icirc~ÃŽ~iuml~ï~eth~ð~ntilde~Ãą~ograve~Ã˛~oacute~Ãŗ~ocirc~ô~otilde~Ãĩ~ouml~Ãļ~divide~Ãˇ~oslash~ø~ugrave~Ú~uacute~Ãē~ucirc~Ãģ~uuml~Ãŧ~yacute~ÃŊ~thorn~Þ~yuml~Ãŋ~quot~\"~amp~&~lt~<~gt~>"); +exports.namedReferences.html5 = generateNamedReferences("Abreve~Ă~Acy~А~Afr~𝔄~Amacr~Ā~And~⩓~Aogon~Ą~Aopf~𝔸~ApplyFunction~⁥~Ascr~𝒜~Assign~≔~Backslash~∖~Barv~â̧~Barwed~⌆~Bcy~Б~Because~âˆĩ~Bernoullis~â„Ŧ~Bfr~𝔅~Bopf~𝔹~Breve~˘~Bscr~â„Ŧ~Bumpeq~≎~CHcy~Ч~Cacute~Ć~Cap~⋒~CapitalDifferentialD~ⅅ~Cayleys~ℭ~Ccaron~Č~Ccirc~Ĉ~Cconint~∰~Cdot~Ċ~Cedilla~¸~CenterDot~¡~Cfr~ℭ~CircleDot~⊙~CircleMinus~⊖~CirclePlus~⊕~CircleTimes~⊗~ClockwiseContourIntegral~∲~CloseCurlyDoubleQuote~”~CloseCurlyQuote~’~Colon~∡~Colone~⊴~Congruent~≡~Conint~∯~ContourIntegral~∎~Copf~ℂ~Coproduct~∐~CounterClockwiseContourIntegral~âˆŗ~Cross~⨯~Cscr~𝒞~Cup~⋓~CupCap~≍~DD~ⅅ~DDotrahd~⤑~DJcy~Ђ~DScy~Ѕ~DZcy~Џ~Darr~↡~Dashv~â̤~Dcaron~Ď~Dcy~Д~Del~∇~Dfr~𝔇~DiacriticalAcute~´~DiacriticalDot~˙~DiacriticalDoubleAcute~˝~DiacriticalGrave~`~DiacriticalTilde~˜~Diamond~⋄~DifferentialD~ⅆ~Dopf~đ”ģ~Dot~¨~DotDot~⃜~DotEqual~≐~DoubleContourIntegral~∯~DoubleDot~¨~DoubleDownArrow~⇓~DoubleLeftArrow~⇐~DoubleLeftRightArrow~⇔~DoubleLeftTee~â̤~DoubleLongLeftArrow~⟸~DoubleLongLeftRightArrow~âŸē~DoubleLongRightArrow~⟹~DoubleRightArrow~⇒~DoubleRightTee~⊨~DoubleUpArrow~⇑~DoubleUpDownArrow~⇕~DoubleVerticalBar~âˆĨ~DownArrow~↓~DownArrowBar~⤓~DownArrowUpArrow~â‡ĩ~DownBreve~Ė‘~DownLeftRightVector~âĨ~DownLeftTeeVector~âĨž~DownLeftVector~â†Ŋ~DownLeftVectorBar~âĨ–~DownRightTeeVector~âĨŸ~DownRightVector~⇁~DownRightVectorBar~âĨ—~DownTee~⊤~DownTeeArrow~↧~Downarrow~⇓~Dscr~𝒟~Dstrok~Đ~ENG~Ŋ~Ecaron~Ě~Ecy~Đ­~Edot~Ė~Efr~𝔈~Element~∈~Emacr~Ē~EmptySmallSquare~â—ģ~EmptyVerySmallSquare~â–Ģ~Eogon~Ę~Eopf~đ”ŧ~Equal~âŠĩ~EqualTilde~≂~Equilibrium~⇌~Escr~ℰ~Esim~âŠŗ~Exists~∃~ExponentialE~ⅇ~Fcy~Ф~Ffr~𝔉~FilledSmallSquare~â—ŧ~FilledVerySmallSquare~â–Ē~Fopf~đ”Ŋ~ForAll~∀~Fouriertrf~ℱ~Fscr~ℱ~GJcy~Ѓ~Gammad~Μ~Gbreve~Ğ~Gcedil~Äĸ~Gcirc~Ĝ~Gcy~Г~Gdot~Ä ~Gfr~𝔊~Gg~⋙~Gopf~𝔾~GreaterEqual~â‰Ĩ~GreaterEqualLess~⋛~GreaterFullEqual~≧~GreaterGreater~âĒĸ~GreaterLess~≷~GreaterSlantEqual~⊞~GreaterTilde~â‰ŗ~Gscr~đ’ĸ~Gt~â‰Ģ~HARDcy~ĐĒ~Hacek~ˇ~Hat~^~Hcirc~Ĥ~Hfr~ℌ~HilbertSpace~ℋ~Hopf~ℍ~HorizontalLine~─~Hscr~ℋ~Hstrok~ÄĻ~HumpDownHump~≎~HumpEqual~≏~IEcy~Е~IJlig~IJ~IOcy~Ё~Icy~И~Idot~İ~Ifr~ℑ~Im~ℑ~Imacr~ÄĒ~ImaginaryI~ⅈ~Implies~⇒~Int~âˆŦ~Integral~âˆĢ~Intersection~⋂~InvisibleComma~âŖ~InvisibleTimes~âĸ~Iogon~ÄŽ~Iopf~𝕀~Iscr~ℐ~Itilde~Ĩ~Iukcy~І~Jcirc~Ä´~Jcy~Й~Jfr~𝔍~Jopf~𝕁~Jscr~đ’Ĩ~Jsercy~Ј~Jukcy~Є~KHcy~ĐĨ~KJcy~Ќ~Kcedil~Äļ~Kcy~К~Kfr~𝔎~Kopf~𝕂~Kscr~đ’Ļ~LJcy~Љ~Lacute~Äš~Lang~âŸĒ~Laplacetrf~ℒ~Larr~↞~Lcaron~ÄŊ~Lcedil~Äģ~Lcy~Л~LeftAngleBracket~⟨~LeftArrow~←~LeftArrowBar~⇤~LeftArrowRightArrow~⇆~LeftCeiling~⌈~LeftDoubleBracket~âŸĻ~LeftDownTeeVector~âĨĄ~LeftDownVector~⇃~LeftDownVectorBar~âĨ™~LeftFloor~⌊~LeftRightArrow~↔~LeftRightVector~âĨŽ~LeftTee~âŠŖ~LeftTeeArrow~↤~LeftTeeVector~âĨš~LeftTriangle~⊲~LeftTriangleBar~⧏~LeftTriangleEqual~⊴~LeftUpDownVector~âĨ‘~LeftUpTeeVector~âĨ ~LeftUpVector~â†ŋ~LeftUpVectorBar~âĨ˜~LeftVector~â†ŧ~LeftVectorBar~âĨ’~Leftarrow~⇐~Leftrightarrow~⇔~LessEqualGreater~⋚~LessFullEqual~â‰Ļ~LessGreater~â‰ļ~LessLess~âĒĄ~LessSlantEqual~âŠŊ~LessTilde~≲~Lfr~𝔏~Ll~⋘~Lleftarrow~⇚~Lmidot~Äŋ~LongLeftArrow~âŸĩ~LongLeftRightArrow~⟷~LongRightArrow~âŸļ~Longleftarrow~⟸~Longleftrightarrow~âŸē~Longrightarrow~⟹~Lopf~𝕃~LowerLeftArrow~↙~LowerRightArrow~↘~Lscr~ℒ~Lsh~↰~Lstrok~Ł~Lt~â‰Ē~Map~⤅~Mcy~М~MediumSpace~ ~Mellintrf~â„ŗ~Mfr~𝔐~MinusPlus~∓~Mopf~𝕄~Mscr~â„ŗ~NJcy~Њ~Nacute~Ń~Ncaron~Ň~Ncedil~Ņ~Ncy~Н~NegativeMediumSpace~​~NegativeThickSpace~​~NegativeThinSpace~​~NegativeVeryThinSpace~​~NestedGreaterGreater~â‰Ģ~NestedLessLess~â‰Ē~NewLine~\n~Nfr~𝔑~NoBreak~⁠~NonBreakingSpace~ ~Nopf~ℕ~Not~âĢŦ~NotCongruent~â‰ĸ~NotCupCap~≭~NotDoubleVerticalBar~âˆĻ~NotElement~∉~NotEqual~≠~NotEqualTilde~â‰‚Ė¸~NotExists~∄~NotGreater~≯~NotGreaterEqual~≱~NotGreaterFullEqual~â‰§Ė¸~NotGreaterGreater~â‰Ģˏ~NotGreaterLess~≹~NotGreaterSlantEqual~âŠžĖ¸~NotGreaterTilde~â‰ĩ~NotHumpDownHump~â‰ŽĖ¸~NotHumpEqual~â‰Ė¸~NotLeftTriangle~â‹Ē~NotLeftTriangleBar~â§Ė¸~NotLeftTriangleEqual~â‹Ŧ~NotLess~≮~NotLessEqual~≰~NotLessGreater~≸~NotLessLess~â‰Ēˏ~NotLessSlantEqual~âŠŊˏ~NotLessTilde~≴~NotNestedGreaterGreater~âĒĸˏ~NotNestedLessLess~âĒĄĖ¸~NotPrecedes~⊀~NotPrecedesEqual~âǝˏ~NotPrecedesSlantEqual~⋠~NotReverseElement~∌~NotRightTriangle~â‹Ģ~NotRightTriangleBar~â§Ė¸~NotRightTriangleEqual~⋭~NotSquareSubset~âŠĖ¸~NotSquareSubsetEqual~â‹ĸ~NotSquareSuperset~âŠĖ¸~NotSquareSupersetEqual~â‹Ŗ~NotSubset~⊂⃒~NotSubsetEqual~⊈~NotSucceeds~⊁~NotSucceedsEqual~âǰˏ~NotSucceedsSlantEqual~⋡~NotSucceedsTilde~â‰ŋˏ~NotSuperset~⊃⃒~NotSupersetEqual~⊉~NotTilde~≁~NotTildeEqual~≄~NotTildeFullEqual~≇~NotTildeTilde~≉~NotVerticalBar~∤~Nscr~𝒩~Ocy~О~Odblac~Ő~Ofr~𝔒~Omacr~Ō~Oopf~𝕆~OpenCurlyDoubleQuote~“~OpenCurlyQuote~‘~Or~⩔~Oscr~đ’Ē~Otimes~⨡~OverBar~‾~OverBrace~⏞~OverBracket~⎴~OverParenthesis~⏜~PartialD~∂~Pcy~П~Pfr~𝔓~PlusMinus~Âą~Poincareplane~ℌ~Popf~ℙ~Pr~âĒģ~Precedes~â‰ē~PrecedesEqual~âǝ~PrecedesSlantEqual~â‰ŧ~PrecedesTilde~≾~Product~∏~Proportion~∡~Proportional~∝~Pscr~đ’Ģ~Qfr~𝔔~Qopf~ℚ~Qscr~đ’Ŧ~RBarr~⤐~Racute~Ŕ~Rang~âŸĢ~Rarr~↠~Rarrtl~⤖~Rcaron~Ř~Rcedil~Ŗ~Rcy~Đ ~Re~ℜ~ReverseElement~∋~ReverseEquilibrium~⇋~ReverseUpEquilibrium~âĨ¯~Rfr~ℜ~RightAngleBracket~⟩~RightArrow~→~RightArrowBar~â‡Ĩ~RightArrowLeftArrow~⇄~RightCeiling~⌉~RightDoubleBracket~⟧~RightDownTeeVector~âĨ~RightDownVector~⇂~RightDownVectorBar~âĨ•~RightFloor~⌋~RightTee~âŠĸ~RightTeeArrow~â†Ļ~RightTeeVector~âĨ›~RightTriangle~âŠŗ~RightTriangleBar~⧐~RightTriangleEqual~âŠĩ~RightUpDownVector~âĨ~RightUpTeeVector~âĨœ~RightUpVector~↾~RightUpVectorBar~âĨ”~RightVector~⇀~RightVectorBar~âĨ“~Rightarrow~⇒~Ropf~ℝ~RoundImplies~âĨ°~Rrightarrow~⇛~Rscr~ℛ~Rsh~↱~RuleDelayed~â§´~SHCHcy~ĐŠ~SHcy~Ш~SOFTcy~ĐŦ~Sacute~Ś~Sc~âĒŧ~Scedil~Ş~Scirc~Ŝ~Scy~ĐĄ~Sfr~𝔖~ShortDownArrow~↓~ShortLeftArrow~←~ShortRightArrow~→~ShortUpArrow~↑~SmallCircle~∘~Sopf~𝕊~Sqrt~√~Square~□~SquareIntersection~⊓~SquareSubset~⊏~SquareSubsetEqual~⊑~SquareSuperset~⊐~SquareSupersetEqual~⊒~SquareUnion~⊔~Sscr~𝒮~Star~⋆~Sub~⋐~Subset~⋐~SubsetEqual~⊆~Succeeds~â‰ģ~SucceedsEqual~âǰ~SucceedsSlantEqual~â‰Ŋ~SucceedsTilde~â‰ŋ~SuchThat~∋~Sum~∑~Sup~⋑~Superset~⊃~SupersetEqual~⊇~Supset~⋑~TRADE~â„ĸ~TSHcy~Ћ~TScy~ĐĻ~Tab~\t~Tcaron~Ť~Tcedil~Åĸ~Tcy~Đĸ~Tfr~𝔗~Therefore~∴~ThickSpace~  ~ThinSpace~ ~Tilde~âˆŧ~TildeEqual~≃~TildeFullEqual~≅~TildeTilde~≈~Topf~𝕋~TripleDot~⃛~Tscr~đ’¯~Tstrok~ÅĻ~Uarr~↟~Uarrocir~âĨ‰~Ubrcy~Ў~Ubreve~ÅŦ~Ucy~ĐŖ~Udblac~Ű~Ufr~𝔘~Umacr~ÅĒ~UnderBar~_~UnderBrace~⏟~UnderBracket~âŽĩ~UnderParenthesis~⏝~Union~⋃~UnionPlus~⊎~Uogon~Ş~Uopf~𝕌~UpArrow~↑~UpArrowBar~⤒~UpArrowDownArrow~⇅~UpDownArrow~↕~UpEquilibrium~âĨŽ~UpTee~âŠĨ~UpTeeArrow~â†Ĩ~Uparrow~⇑~Updownarrow~⇕~UpperLeftArrow~↖~UpperRightArrow~↗~Upsi~Ī’~Uring~ÅŽ~Uscr~𝒰~Utilde~Ũ~VDash~âŠĢ~Vbar~âĢĢ~Vcy~В~Vdash~⊩~Vdashl~âĢĻ~Vee~⋁~Verbar~‖~Vert~‖~VerticalBar~âˆŖ~VerticalLine~|~VerticalSeparator~❘~VerticalTilde~≀~VeryThinSpace~ ~Vfr~𝔙~Vopf~𝕍~Vscr~𝒱~Vvdash~âŠĒ~Wcirc~Å´~Wedge~⋀~Wfr~𝔚~Wopf~𝕎~Wscr~𝒲~Xfr~𝔛~Xopf~𝕏~Xscr~đ’ŗ~YAcy~Đ¯~YIcy~Ї~YUcy~ĐŽ~Ycirc~Åļ~Ycy~ĐĢ~Yfr~𝔜~Yopf~𝕐~Yscr~𝒴~ZHcy~Ж~Zacute~Åš~Zcaron~ÅŊ~Zcy~З~Zdot~Åģ~ZeroWidthSpace~​~Zfr~ℨ~Zopf~ℤ~Zscr~đ’ĩ~abreve~ă~ac~∞~acE~âˆžĖŗ~acd~âˆŋ~acy~а~af~⁥~afr~𝔞~aleph~â„ĩ~amacr~ā~amalg~â¨ŋ~andand~⩕~andd~⩜~andslope~⊘~andv~⩚~ange~âϤ~angle~∠~angmsd~∥~angmsdaa~âύ~angmsdab~âĻŠ~angmsdac~âĻĒ~angmsdad~âĻĢ~angmsdae~âĻŦ~angmsdaf~âĻ­~angmsdag~âĻŽ~angmsdah~âϝ~angrt~∟~angrtvb~⊾~angrtvbd~âĻ~angsph~âˆĸ~angst~Å~angzarr~âŧ~aogon~ą~aopf~𝕒~ap~≈~apE~⊰~apacir~⊯~ape~≊~apid~≋~approx~≈~approxeq~≊~ascr~đ’ļ~ast~*~asympeq~≍~awconint~âˆŗ~awint~⨑~bNot~âĢ­~backcong~≌~backepsilon~Īļ~backprime~â€ĩ~backsim~âˆŊ~backsimeq~⋍~barvee~âŠŊ~barwed~⌅~barwedge~⌅~bbrk~âŽĩ~bbrktbrk~âŽļ~bcong~≌~bcy~Đą~becaus~âˆĩ~because~âˆĩ~bemptyv~âϰ~bepsi~Īļ~bernou~â„Ŧ~beth~â„ļ~between~â‰Ŧ~bfr~𝔟~bigcap~⋂~bigcirc~◯~bigcup~⋃~bigodot~⨀~bigoplus~⨁~bigotimes~⨂~bigsqcup~⨆~bigstar~★~bigtriangledown~â–Ŋ~bigtriangleup~â–ŗ~biguplus~⨄~bigvee~⋁~bigwedge~⋀~bkarow~⤍~blacklozenge~â§Ģ~blacksquare~â–Ē~blacktriangle~▴~blacktriangledown~▾~blacktriangleleft~◂~blacktriangleright~▸~blank~âŖ~blk12~▒~blk14~░~blk34~▓~block~█~bne~=âƒĨ~bnequiv~≡âƒĨ~bnot~⌐~bopf~𝕓~bot~âŠĨ~bottom~âŠĨ~bowtie~⋈~boxDL~╗~boxDR~╔~boxDl~╖~boxDr~╓~boxH~═~boxHD~â•Ļ~boxHU~╩~boxHd~╤~boxHu~╧~boxUL~╝~boxUR~╚~boxUl~╜~boxUr~╙~boxV~║~boxVH~â•Ŧ~boxVL~â•Ŗ~boxVR~╠~boxVh~â•Ģ~boxVl~â•ĸ~boxVr~╟~boxbox~⧉~boxdL~╕~boxdR~╒~boxdl~┐~boxdr~┌~boxh~─~boxhD~â•Ĩ~boxhU~╨~boxhd~â”Ŧ~boxhu~┴~boxminus~⊟~boxplus~⊞~boxtimes~⊠~boxuL~╛~boxuR~╘~boxul~┘~boxur~└~boxv~│~boxvH~â•Ē~boxvL~╡~boxvR~╞~boxvh~â”ŧ~boxvl~┤~boxvr~├~bprime~â€ĩ~breve~˘~bscr~𝒷~bsemi~⁏~bsim~âˆŊ~bsime~⋍~bsol~\\~bsolb~⧅~bsolhsub~⟈~bullet~â€ĸ~bump~≎~bumpE~âĒŽ~bumpe~≏~bumpeq~≏~cacute~ć~capand~⩄~capbrcup~⩉~capcap~⩋~capcup~⩇~capdot~⩀~caps~âˆŠī¸€~caret~⁁~caron~ˇ~ccaps~⊍~ccaron~č~ccirc~ĉ~ccups~⩌~ccupssm~⊐~cdot~ċ~cemptyv~âϞ~centerdot~¡~cfr~𝔠~chcy~҇~check~✓~checkmark~✓~cir~○~cirE~⧃~circeq~≗~circlearrowleft~â†ē~circlearrowright~â†ģ~circledR~ÂŽ~circledS~Ⓢ~circledast~⊛~circledcirc~⊚~circleddash~⊝~cire~≗~cirfnint~⨐~cirmid~â̝~cirscir~⧂~clubsuit~â™Ŗ~colon~:~colone~≔~coloneq~≔~comma~,~commat~@~comp~∁~compfn~∘~complement~∁~complexes~ℂ~congdot~⊭~conint~∎~copf~𝕔~coprod~∐~copysr~℗~cross~✗~cscr~𝒸~csub~âĢ~csube~âĢ‘~csup~â̐~csupe~âĢ’~ctdot~⋯~cudarrl~⤸~cudarrr~â¤ĩ~cuepr~⋞~cuesc~⋟~cularr~â†ļ~cularrp~â¤Ŋ~cupbrcap~⊈~cupcap~⩆~cupcup~⩊~cupdot~⊍~cupor~⩅~cups~âˆĒ~curarr~↷~curarrm~â¤ŧ~curlyeqprec~⋞~curlyeqsucc~⋟~curlyvee~⋎~curlywedge~⋏~curvearrowleft~â†ļ~curvearrowright~↷~cuvee~⋎~cuwed~⋏~cwconint~∲~cwint~∹~cylcty~⌭~dHar~âĨĨ~daleth~ℸ~dash~‐~dashv~âŠŖ~dbkarow~⤏~dblac~˝~dcaron~ď~dcy~Đ´~dd~ⅆ~ddagger~‡~ddarr~⇊~ddotseq~⊡~demptyv~âĻą~dfisht~âĨŋ~dfr~𝔡~dharl~⇃~dharr~⇂~diam~⋄~diamond~⋄~diamondsuit~â™Ļ~die~¨~digamma~Ī~disin~⋲~div~Ãˇ~divideontimes~⋇~divonx~⋇~djcy~Ņ’~dlcorn~⌞~dlcrop~⌍~dollar~$~dopf~𝕕~dot~˙~doteq~≐~doteqdot~≑~dotminus~∸~dotplus~∔~dotsquare~⊡~doublebarwedge~⌆~downarrow~↓~downdownarrows~⇊~downharpoonleft~⇃~downharpoonright~⇂~drbkarow~⤐~drcorn~⌟~drcrop~⌌~dscr~𝒹~dscy~Ņ•~dsol~â§ļ~dstrok~đ~dtdot~⋱~dtri~â–ŋ~dtrif~▾~duarr~â‡ĩ~duhar~âĨ¯~dwangle~âĻĻ~dzcy~ҟ~dzigrarr~âŸŋ~eDDot~⊡~eDot~≑~easter~⊎~ecaron~ě~ecir~≖~ecolon~≕~ecy~Ņ~edot~ė~ee~ⅇ~efDot~≒~efr~đ”ĸ~eg~âǚ~egs~âĒ–~egsdot~âǘ~el~âĒ™~elinters~⏧~ell~ℓ~els~âĒ•~elsdot~âĒ—~emacr~ē~emptyset~∅~emptyv~∅~emsp13~ ~emsp14~ ~eng~ŋ~eogon~ę~eopf~𝕖~epar~⋕~eparsl~â§Ŗ~eplus~⊹~epsi~Îĩ~epsiv~Īĩ~eqcirc~≖~eqcolon~≕~eqsim~≂~eqslantgtr~âĒ–~eqslantless~âĒ•~equals~=~equest~≟~equivDD~⊸~eqvparsl~â§Ĩ~erDot~≓~erarr~âĨą~escr~ℯ~esdot~≐~esim~≂~excl~!~expectation~ℰ~exponentiale~ⅇ~fallingdotseq~≒~fcy~Ņ„~female~♀~ffilig~īŦƒ~fflig~īŦ€~ffllig~īŦ„~ffr~đ”Ŗ~filig~īŦ~fjlig~fj~flat~♭~fllig~īŦ‚~fltns~▱~fopf~𝕗~fork~⋔~forkv~âĢ™~fpartint~⨍~frac13~⅓~frac15~⅕~frac16~⅙~frac18~⅛~frac23~⅔~frac25~⅖~frac35~⅗~frac38~⅜~frac45~⅘~frac56~⅚~frac58~⅝~frac78~⅞~frown~âŒĸ~fscr~đ’ģ~gE~≧~gEl~ânj~gacute~Įĩ~gammad~Ī~gap~âdž~gbreve~ğ~gcirc~ĝ~gcy~Đŗ~gdot~ÄĄ~gel~⋛~geq~â‰Ĩ~geqq~≧~geqslant~⊞~ges~⊞~gescc~âĒŠ~gesdot~âĒ€~gesdoto~âĒ‚~gesdotol~âĒ„~gesl~â‹›ī¸€~gesles~âĒ”~gfr~𝔤~gg~â‰Ģ~ggg~⋙~gimel~ℷ~gjcy~Ņ“~gl~≷~glE~âĒ’~gla~âĒĨ~glj~âǤ~gnE~≩~gnap~âNJ~gnapprox~âNJ~gne~âLj~gneq~âLj~gneqq~≩~gnsim~⋧~gopf~𝕘~grave~`~gscr~ℊ~gsim~â‰ŗ~gsime~âĒŽ~gsiml~âǐ~gtcc~âǧ~gtcir~âŠē~gtdot~⋗~gtlPar~âĻ•~gtquest~âŠŧ~gtrapprox~âdž~gtrarr~âĨ¸~gtrdot~⋗~gtreqless~⋛~gtreqqless~ânj~gtrless~≷~gtrsim~â‰ŗ~gvertneqq~â‰Šī¸€~gvnE~â‰Šī¸€~hairsp~ ~half~ÂŊ~hamilt~ℋ~hardcy~Ҋ~harrcir~âĨˆ~harrw~↭~hbar~ℏ~hcirc~ÄĨ~heartsuit~â™Ĩ~hercon~⊹~hfr~đ”Ĩ~hksearow~â¤Ĩ~hkswarow~â¤Ļ~hoarr~â‡ŋ~homtht~âˆģ~hookleftarrow~↩~hookrightarrow~â†Ē~hopf~𝕙~horbar~―~hscr~đ’Ŋ~hslash~ℏ~hstrok~ħ~hybull~⁃~hyphen~‐~ic~âŖ~icy~и~iecy~Đĩ~iff~⇔~ifr~đ”Ļ~ii~ⅈ~iiiint~⨌~iiint~∭~iinfin~⧜~iiota~℩~ijlig~Äŗ~imacr~ÄĢ~imagline~ℐ~imagpart~ℑ~imath~Äą~imof~⊷~imped~Æĩ~in~∈~incare~℅~infintie~⧝~inodot~Äą~intcal~âŠē~integers~ℤ~intercal~âŠē~intlarhk~⨗~intprod~â¨ŧ~iocy~Ņ‘~iogon~į~iopf~𝕚~iprod~â¨ŧ~iscr~𝒾~isinE~⋹~isindot~â‹ĩ~isins~⋴~isinsv~â‹ŗ~isinv~∈~it~âĸ~itilde~ÄŠ~iukcy~Ņ–~jcirc~Äĩ~jcy~Đš~jfr~𝔧~jmath~ȡ~jopf~𝕛~jscr~đ’ŋ~jsercy~Ҙ~jukcy~Ņ”~kappav~ΰ~kcedil~ġ~kcy~Đē~kfr~𝔨~kgreen~ĸ~khcy~Ņ…~kjcy~Ҝ~kopf~𝕜~kscr~𝓀~lAarr~⇚~lAtail~⤛~lBarr~⤎~lE~â‰Ļ~lEg~âĒ‹~lHar~âĨĸ~lacute~Äē~laemptyv~âĻ´~lagran~ℒ~langd~âĻ‘~langle~⟨~lap~âĒ…~larrb~⇤~larrbfs~⤟~larrfs~⤝~larrhk~↩~larrlp~â†Ģ~larrpl~⤚~larrsim~âĨŗ~larrtl~â†ĸ~lat~âĒĢ~latail~⤙~late~âĒ­~lates~âǭ~lbarr~⤌~lbbrk~❲~lbrace~{~lbrack~[~lbrke~âĻ‹~lbrksld~âĻ~lbrkslu~âĻ~lcaron~Äž~lcedil~Äŧ~lcub~{~lcy~Đģ~ldca~â¤ļ~ldquor~„~ldrdhar~âĨ§~ldrushar~âĨ‹~ldsh~↲~leftarrow~←~leftarrowtail~â†ĸ~leftharpoondown~â†Ŋ~leftharpoonup~â†ŧ~leftleftarrows~⇇~leftrightarrow~↔~leftrightarrows~⇆~leftrightharpoons~⇋~leftrightsquigarrow~↭~leftthreetimes~⋋~leg~⋚~leq~≤~leqq~â‰Ļ~leqslant~âŠŊ~les~âŠŊ~lescc~âǍ~lesdot~âŠŋ~lesdoto~âǁ~lesdotor~âǃ~lesg~â‹šī¸€~lesges~âĒ“~lessapprox~âĒ…~lessdot~⋖~lesseqgtr~⋚~lesseqqgtr~âĒ‹~lessgtr~â‰ļ~lesssim~≲~lfisht~âĨŧ~lfr~𝔩~lg~â‰ļ~lgE~âĒ‘~lhard~â†Ŋ~lharu~â†ŧ~lharul~âĨĒ~lhblk~▄~ljcy~Ņ™~ll~â‰Ē~llarr~⇇~llcorner~⌞~llhard~âĨĢ~lltri~â—ē~lmidot~ŀ~lmoust~⎰~lmoustache~⎰~lnE~≨~lnap~âlj~lnapprox~âlj~lne~âLJ~lneq~âLJ~lneqq~≨~lnsim~â‹Ļ~loang~âŸŦ~loarr~â‡Ŋ~lobrk~âŸĻ~longleftarrow~âŸĩ~longleftrightarrow~⟷~longmapsto~âŸŧ~longrightarrow~âŸļ~looparrowleft~â†Ģ~looparrowright~â†Ŧ~lopar~âĻ…~lopf~𝕝~loplus~⨭~lotimes~⨴~lowbar~_~lozenge~◊~lozf~â§Ģ~lpar~(~lparlt~âĻ“~lrarr~⇆~lrcorner~⌟~lrhar~⇋~lrhard~âĨ­~lrtri~âŠŋ~lscr~𝓁~lsh~↰~lsim~≲~lsime~âĒ~lsimg~âĒ~lsqb~[~lsquor~‚~lstrok~ł~ltcc~âĒĻ~ltcir~⊚~ltdot~⋖~lthree~⋋~ltimes~⋉~ltlarr~âĨļ~ltquest~âŠģ~ltrPar~âĻ–~ltri~◃~ltrie~⊴~ltrif~◂~lurdshar~âĨŠ~luruhar~âĨĻ~lvertneqq~â‰¨ī¸€~lvnE~â‰¨ī¸€~mDDot~âˆē~male~♂~malt~✠~maltese~✠~map~â†Ļ~mapsto~â†Ļ~mapstodown~↧~mapstoleft~↤~mapstoup~â†Ĩ~marker~▮~mcomma~⨊~mcy~Đŧ~measuredangle~∥~mfr~đ”Ē~mho~℧~mid~âˆŖ~midast~*~midcir~â̰~minusb~⊟~minusd~∸~minusdu~â¨Ē~mlcp~âĢ›~mldr~â€Ļ~mnplus~∓~models~⊧~mopf~𝕞~mp~∓~mscr~𝓂~mstpos~∞~multimap~⊸~mumap~⊸~nGg~â‹™Ė¸~nGt~â‰Ģ⃒~nGtv~â‰Ģˏ~nLeftarrow~⇍~nLeftrightarrow~⇎~nLl~â‹˜Ė¸~nLt~â‰Ē⃒~nLtv~â‰Ēˏ~nRightarrow~⇏~nVDash~⊯~nVdash~⊮~nacute~ń~nang~∠⃒~nap~≉~napE~âŠ°Ė¸~napid~â‰‹Ė¸~napos~ʼn~napprox~≉~natur~♮~natural~♮~naturals~ℕ~nbump~â‰ŽĖ¸~nbumpe~â‰Ė¸~ncap~⊃~ncaron~ň~ncedil~ņ~ncong~≇~ncongdot~âŠ­Ė¸~ncup~⩂~ncy~ĐŊ~neArr~⇗~nearhk~⤤~nearr~↗~nearrow~↗~nedot~â‰Ė¸~nequiv~â‰ĸ~nesear~⤨~nesim~â‰‚Ė¸~nexist~∄~nexists~∄~nfr~đ”Ģ~ngE~â‰§Ė¸~nge~≱~ngeq~≱~ngeqq~â‰§Ė¸~ngeqslant~âŠžĖ¸~nges~âŠžĖ¸~ngsim~â‰ĩ~ngt~≯~ngtr~≯~nhArr~⇎~nharr~↮~nhpar~â̞~nis~â‹ŧ~nisd~â‹ē~niv~∋~njcy~Қ~nlArr~⇍~nlE~â‰Ļˏ~nlarr~↚~nldr~â€Ĩ~nle~≰~nleftarrow~↚~nleftrightarrow~↮~nleq~≰~nleqq~â‰Ļˏ~nleqslant~âŠŊˏ~nles~âŠŊˏ~nless~≮~nlsim~≴~nlt~≮~nltri~â‹Ē~nltrie~â‹Ŧ~nmid~∤~nopf~𝕟~notinE~â‹šĖ¸~notindot~â‹ĩˏ~notinva~∉~notinvb~⋷~notinvc~â‹ļ~notni~∌~notniva~∌~notnivb~⋾~notnivc~â‹Ŋ~npar~âˆĻ~nparallel~âˆĻ~nparsl~âĢŊâƒĨ~npart~âˆ‚Ė¸~npolint~⨔~npr~⊀~nprcue~⋠~npre~âǝˏ~nprec~⊀~npreceq~âǝˏ~nrArr~⇏~nrarr~↛~nrarrc~â¤ŗĖ¸~nrarrw~â†Ė¸~nrightarrow~↛~nrtri~â‹Ģ~nrtrie~⋭~nsc~⊁~nsccue~⋡~nsce~âǰˏ~nscr~𝓃~nshortmid~∤~nshortparallel~âˆĻ~nsim~≁~nsime~≄~nsimeq~≄~nsmid~∤~nspar~âˆĻ~nsqsube~â‹ĸ~nsqsupe~â‹Ŗ~nsubE~â̅ˏ~nsube~⊈~nsubset~⊂⃒~nsubseteq~⊈~nsubseteqq~â̅ˏ~nsucc~⊁~nsucceq~âǰˏ~nsup~⊅~nsupE~â̆ˏ~nsupe~⊉~nsupset~⊃⃒~nsupseteq~⊉~nsupseteqq~â̆ˏ~ntgl~≹~ntlg~≸~ntriangleleft~â‹Ē~ntrianglelefteq~â‹Ŧ~ntriangleright~â‹Ģ~ntrianglerighteq~⋭~num~#~numero~№~numsp~ ~nvDash~⊭~nvHarr~⤄~nvap~≍⃒~nvdash~âŠŦ~nvge~â‰Ĩ⃒~nvgt~>⃒~nvinfin~⧞~nvlArr~⤂~nvle~≤⃒~nvlt~<⃒~nvltrie~⊴⃒~nvrArr~⤃~nvrtrie~âŠĩ⃒~nvsim~âˆŧ⃒~nwArr~⇖~nwarhk~â¤Ŗ~nwarr~↖~nwarrow~↖~nwnear~⤧~oS~Ⓢ~oast~⊛~ocir~⊚~ocy~Đž~odash~⊝~odblac~ő~odiv~⨸~odot~⊙~odsold~âĻŧ~ofcir~âĻŋ~ofr~đ”Ŧ~ogon~˛~ogt~⧁~ohbar~âĻĩ~ohm~Ί~oint~∎~olarr~â†ē~olcir~âĻž~olcross~âĻģ~olt~⧀~omacr~ō~omid~âĻļ~ominus~⊖~oopf~𝕠~opar~âώ~operp~âĻš~orarr~â†ģ~ord~⊝~order~ℴ~orderof~ℴ~origof~âŠļ~oror~⩖~orslope~⩗~orv~⩛~oscr~ℴ~osol~⊘~otimesas~â¨ļ~ovbar~âŒŊ~par~âˆĨ~parallel~âˆĨ~parsim~âĢŗ~parsl~âĢŊ~pcy~Đŋ~percnt~%~period~.~pertenk~‱~pfr~𝔭~phiv~Ī•~phmmat~â„ŗ~phone~☎~pitchfork~⋔~planck~ℏ~planckh~ℎ~plankv~ℏ~plus~+~plusacir~â¨Ŗ~plusb~⊞~pluscir~â¨ĸ~plusdo~∔~plusdu~â¨Ĩ~pluse~⊲~plussim~â¨Ļ~plustwo~⨧~pm~Âą~pointint~⨕~popf~𝕡~pr~â‰ē~prE~âĒŗ~prap~âǎ~prcue~â‰ŧ~pre~âǝ~prec~â‰ē~precapprox~âǎ~preccurlyeq~â‰ŧ~preceq~âǝ~precnapprox~âĒš~precneqq~âĒĩ~precnsim~⋨~precsim~≾~primes~ℙ~prnE~âĒĩ~prnap~âĒš~prnsim~⋨~profalar~⌮~profline~⌒~profsurf~⌓~propto~∝~prsim~≾~prurel~⊰~pscr~𝓅~puncsp~ ~qfr~𝔮~qint~⨌~qopf~đ•ĸ~qprime~⁗~qscr~𝓆~quaternions~ℍ~quatint~⨖~quest~?~questeq~≟~rAarr~⇛~rAtail~⤜~rBarr~⤏~rHar~âĨ¤~race~âˆŊĖą~racute~ŕ~raemptyv~âĻŗ~rangd~âĻ’~range~âĻĨ~rangle~⟩~rarrap~âĨĩ~rarrb~â‡Ĩ~rarrbfs~⤠~rarrc~â¤ŗ~rarrfs~⤞~rarrhk~â†Ē~rarrlp~â†Ŧ~rarrpl~âĨ…~rarrsim~âĨ´~rarrtl~â†Ŗ~rarrw~↝~ratail~⤚~ratio~âˆļ~rationals~ℚ~rbarr~⤍~rbbrk~âŗ~rbrace~}~rbrack~]~rbrke~âό~rbrksld~âĻŽ~rbrkslu~âϐ~rcaron~ř~rcedil~ŗ~rcub~}~rcy~Ņ€~rdca~⤡~rdldhar~âĨŠ~rdquor~”~rdsh~â†ŗ~realine~ℛ~realpart~ℜ~reals~ℝ~rect~▭~rfisht~âĨŊ~rfr~đ”¯~rhard~⇁~rharu~⇀~rharul~âĨŦ~rhov~Īą~rightarrow~→~rightarrowtail~â†Ŗ~rightharpoondown~⇁~rightharpoonup~⇀~rightleftarrows~⇄~rightleftharpoons~⇌~rightrightarrows~⇉~rightsquigarrow~↝~rightthreetimes~⋌~ring~˚~risingdotseq~≓~rlarr~⇄~rlhar~⇌~rmoust~⎱~rmoustache~⎱~rnmid~âĢŽ~roang~⟭~roarr~⇾~robrk~⟧~ropar~âφ~ropf~đ•Ŗ~roplus~⨎~rotimes~â¨ĩ~rpar~)~rpargt~âĻ”~rppolint~⨒~rrarr~⇉~rscr~𝓇~rsh~↱~rsqb~]~rsquor~’~rthree~⋌~rtimes~⋊~rtri~▹~rtrie~âŠĩ~rtrif~▸~rtriltri~⧎~ruluhar~âĨ¨~rx~℞~sacute~ś~sc~â‰ģ~scE~âĒ´~scap~âǏ~sccue~â‰Ŋ~sce~âǰ~scedil~ş~scirc~ŝ~scnE~âĒļ~scnap~âĒē~scnsim~⋩~scpolint~⨓~scsim~â‰ŋ~scy~ҁ~sdotb~⊡~sdote~âŠĻ~seArr~⇘~searhk~â¤Ĩ~searr~↘~searrow~↘~semi~;~seswar~⤊~setminus~∖~setmn~∖~sext~âœļ~sfr~𝔰~sfrown~âŒĸ~sharp~♯~shchcy~҉~shcy~҈~shortmid~âˆŖ~shortparallel~âˆĨ~sigmav~Ī‚~simdot~âŠĒ~sime~≃~simeq~≃~simg~âĒž~simgE~âĒ ~siml~âĒ~simlE~âǟ~simne~≆~simplus~⨤~simrarr~âĨ˛~slarr~←~smallsetminus~∖~smashp~â¨ŗ~smeparsl~⧤~smid~âˆŖ~smile~âŒŖ~smt~âĒĒ~smte~âĒŦ~smtes~âĒŦ~softcy~Ҍ~sol~/~solb~⧄~solbar~âŒŋ~sopf~𝕤~spadesuit~♠~spar~âˆĨ~sqcap~⊓~sqcaps~âŠ“ī¸€~sqcup~⊔~sqcups~âŠ”ī¸€~sqsub~⊏~sqsube~⊑~sqsubset~⊏~sqsubseteq~⊑~sqsup~⊐~sqsupe~⊒~sqsupset~⊐~sqsupseteq~⊒~squ~□~square~□~squarf~â–Ē~squf~â–Ē~srarr~→~sscr~𝓈~ssetmn~∖~ssmile~âŒŖ~sstarf~⋆~star~☆~starf~★~straightepsilon~Īĩ~straightphi~Ī•~strns~¯~subE~âĢ…~subdot~âĒŊ~subedot~ẫ~submult~ấ~subnE~âĢ‹~subne~⊊~subplus~âĒŋ~subrarr~âĨš~subset~⊂~subseteq~⊆~subseteqq~âĢ…~subsetneq~⊊~subsetneqq~âĢ‹~subsim~â̇~subsub~âĢ•~subsup~âĢ“~succ~â‰ģ~succapprox~âǏ~succcurlyeq~â‰Ŋ~succeq~âǰ~succnapprox~âĒē~succneqq~âĒļ~succnsim~⋩~succsim~â‰ŋ~sung~â™Ē~supE~â̆~supdot~âĒž~supdsub~â̘~supedot~âĢ„~suphsol~⟉~suphsub~âĢ—~suplarr~âĨģ~supmult~âĢ‚~supnE~â̌~supne~⊋~supplus~âĢ€~supset~⊃~supseteq~⊇~supseteqq~â̆~supsetneq~⊋~supsetneqq~â̌~supsim~â̈~supsub~âĢ”~supsup~âĢ–~swArr~⇙~swarhk~â¤Ļ~swarr~↙~swarrow~↙~swnwar~â¤Ē~target~⌖~tbrk~⎴~tcaron~ÅĨ~tcedil~ÅŖ~tcy~Ņ‚~tdot~⃛~telrec~⌕~tfr~𝔱~therefore~∴~thetav~Ī‘~thickapprox~≈~thicksim~âˆŧ~thkap~≈~thksim~âˆŧ~timesb~⊠~timesbar~⨹~timesd~⨰~tint~∭~toea~⤨~top~⊤~topbot~âŒļ~topcir~âĢą~topf~đ•Ĩ~topfork~â̚~tosa~⤊~tprime~‴~triangle~â–ĩ~triangledown~â–ŋ~triangleleft~◃~trianglelefteq~⊴~triangleq~≜~triangleright~▹~trianglerighteq~âŠĩ~tridot~â—Ŧ~trie~≜~triminus~â¨ē~triplus~⨚~trisb~⧍~tritime~â¨ģ~trpezium~âĸ~tscr~𝓉~tscy~҆~tshcy~Ņ›~tstrok~ŧ~twixt~â‰Ŧ~twoheadleftarrow~↞~twoheadrightarrow~↠~uHar~âĨŖ~ubrcy~Ņž~ubreve~Å­~ucy~҃~udarr~⇅~udblac~Åą~udhar~âĨŽ~ufisht~âĨž~ufr~𝔲~uharl~â†ŋ~uharr~↾~uhblk~▀~ulcorn~⌜~ulcorner~⌜~ulcrop~⌏~ultri~◸~umacr~ÅĢ~uogon~Åŗ~uopf~đ•Ļ~uparrow~↑~updownarrow~↕~upharpoonleft~â†ŋ~upharpoonright~↾~uplus~⊎~upsi~Ī…~upuparrows~⇈~urcorn~⌝~urcorner~⌝~urcrop~⌎~uring~ů~urtri~◹~uscr~𝓊~utdot~⋰~utilde~ÅŠ~utri~â–ĩ~utrif~▴~uuarr~⇈~uwangle~âϧ~vArr~⇕~vBar~â̍~vBarv~âĢŠ~vDash~⊨~vangrt~âϜ~varepsilon~Īĩ~varkappa~ΰ~varnothing~∅~varphi~Ī•~varpi~Ī–~varpropto~∝~varr~↕~varrho~Īą~varsigma~Ī‚~varsubsetneq~âŠŠī¸€~varsubsetneqq~â̋~varsupsetneq~âŠ‹ī¸€~varsupsetneqq~âĢŒī¸€~vartheta~Ī‘~vartriangleleft~⊲~vartriangleright~âŠŗ~vcy~в~vdash~âŠĸ~vee~∨~veebar~âŠģ~veeeq~≚~vellip~⋮~verbar~|~vert~|~vfr~đ”ŗ~vltri~⊲~vnsub~⊂⃒~vnsup~⊃⃒~vopf~𝕧~vprop~∝~vrtri~âŠŗ~vscr~𝓋~vsubnE~â̋~vsubne~âŠŠī¸€~vsupnE~âĢŒī¸€~vsupne~âŠ‹ī¸€~vzigzag~âϚ~wcirc~Åĩ~wedbar~⩟~wedge~∧~wedgeq~≙~wfr~𝔴~wopf~𝕨~wp~℘~wr~≀~wreath~≀~wscr~𝓌~xcap~⋂~xcirc~◯~xcup~⋃~xdtri~â–Ŋ~xfr~đ”ĩ~xhArr~âŸē~xharr~⟷~xlArr~⟸~xlarr~âŸĩ~xmap~âŸŧ~xnis~â‹ģ~xodot~⨀~xopf~𝕩~xoplus~⨁~xotime~⨂~xrArr~⟹~xrarr~âŸļ~xscr~𝓍~xsqcup~⨆~xuplus~⨄~xutri~â–ŗ~xvee~⋁~xwedge~⋀~yacy~Ņ~ycirc~Ŏ~ycy~Ņ‹~yfr~đ”ļ~yicy~Ņ—~yopf~đ•Ē~yscr~𝓎~yucy~ŅŽ~zacute~Åē~zcaron~Åž~zcy~С~zdot~Åŧ~zeetrf~ℨ~zfr~𝔷~zhcy~Đļ~zigrarr~⇝~zopf~đ•Ģ~zscr~𝓏~~AMP~&~COPY~Š~GT~>~LT~<~QUOT~\"~REG~ÂŽ", exports.namedReferences['html4']); +//# sourceMappingURL=named-references.js.map + +/***/ }), + +/***/ 53438: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.numericUnicodeMap = void 0; +exports.numericUnicodeMap = { + 0: 65533, + 128: 8364, + 130: 8218, + 131: 402, + 132: 8222, + 133: 8230, + 134: 8224, + 135: 8225, + 136: 710, + 137: 8240, + 138: 352, + 139: 8249, + 140: 338, + 142: 381, + 145: 8216, + 146: 8217, + 147: 8220, + 148: 8221, + 149: 8226, + 150: 8211, + 151: 8212, + 152: 732, + 153: 8482, + 154: 353, + 155: 8250, + 156: 339, + 158: 382, + 159: 376 +}; +//# sourceMappingURL=numeric-unicode-map.js.map + +/***/ }), + +/***/ 69718: +/***/ ((__unused_webpack_module, exports) => { + +"use strict"; + +Object.defineProperty(exports, "__esModule", ({ value: true })); +exports.highSurrogateTo = exports.highSurrogateFrom = exports.getCodePoint = exports.fromCodePoint = void 0; +exports.fromCodePoint = String.fromCodePoint || + function (astralCodePoint) { + return String.fromCharCode(Math.floor((astralCodePoint - 0x10000) / 0x400) + 0xd800, ((astralCodePoint - 0x10000) % 0x400) + 0xdc00); + }; +// @ts-expect-error - String.prototype.codePointAt might not exist in older node versions +exports.getCodePoint = String.prototype.codePointAt + ? function (input, position) { + return input.codePointAt(position); + } + : function (input, position) { + return (input.charCodeAt(position) - 0xd800) * 0x400 + input.charCodeAt(position + 1) - 0xdc00 + 0x10000; + }; +exports.highSurrogateFrom = 0xd800; +exports.highSurrogateTo = 0xdbff; +//# sourceMappingURL=surrogate-pairs.js.map + +/***/ }), + +/***/ 66390: +/***/ (function(module, exports) { + +// GENERATED FILE. DO NOT EDIT. +(function (global, factory) { + function preferDefault(exports) { + return exports.default || exports; + } + if (typeof define === "function" && define.amd) { + define([], function () { + var exports = {}; + factory(exports); + return preferDefault(exports); + }); + } else if (true) { + factory(exports); + if (true) module.exports = preferDefault(exports); + } else {} +})( + typeof globalThis !== "undefined" + ? globalThis + : typeof self !== "undefined" + ? self + : this, + function (_exports) { + "use strict"; + + Object.defineProperty(_exports, "__esModule", { + value: true, + }); + _exports.default = void 0; + /** + * @license + * Copyright 2009 The Closure Library Authors + * Copyright 2020 Daniel Wirtz / The long.js Authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * SPDX-License-Identifier: Apache-2.0 + */ + + // WebAssembly optimizations to do native i64 multiplication and divide + var wasm = null; + try { + wasm = new WebAssembly.Instance( + new WebAssembly.Module( + new Uint8Array([ + // \0asm + 0, 97, 115, 109, + // version 1 + 1, 0, 0, 0, + // section "type" + 1, 13, 2, + // 0, () => i32 + 96, 0, 1, 127, + // 1, (i32, i32, i32, i32) => i32 + 96, 4, 127, 127, 127, 127, 1, 127, + // section "function" + 3, 7, 6, + // 0, type 0 + 0, + // 1, type 1 + 1, + // 2, type 1 + 1, + // 3, type 1 + 1, + // 4, type 1 + 1, + // 5, type 1 + 1, + // section "global" + 6, 6, 1, + // 0, "high", mutable i32 + 127, 1, 65, 0, 11, + // section "export" + 7, 50, 6, + // 0, "mul" + 3, 109, 117, 108, 0, 1, + // 1, "div_s" + 5, 100, 105, 118, 95, 115, 0, 2, + // 2, "div_u" + 5, 100, 105, 118, 95, 117, 0, 3, + // 3, "rem_s" + 5, 114, 101, 109, 95, 115, 0, 4, + // 4, "rem_u" + 5, 114, 101, 109, 95, 117, 0, 5, + // 5, "get_high" + 8, 103, 101, 116, 95, 104, 105, 103, 104, 0, 0, + // section "code" + 10, 191, 1, 6, + // 0, "get_high" + 4, 0, 35, 0, 11, + // 1, "mul" + 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, + 32, 3, 173, 66, 32, 134, 132, 126, 34, 4, 66, 32, 135, 167, 36, 0, + 32, 4, 167, 11, + // 2, "div_s" + 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, + 32, 3, 173, 66, 32, 134, 132, 127, 34, 4, 66, 32, 135, 167, 36, 0, + 32, 4, 167, 11, + // 3, "div_u" + 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, + 32, 3, 173, 66, 32, 134, 132, 128, 34, 4, 66, 32, 135, 167, 36, 0, + 32, 4, 167, 11, + // 4, "rem_s" + 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, + 32, 3, 173, 66, 32, 134, 132, 129, 34, 4, 66, 32, 135, 167, 36, 0, + 32, 4, 167, 11, + // 5, "rem_u" + 36, 1, 1, 126, 32, 0, 173, 32, 1, 173, 66, 32, 134, 132, 32, 2, 173, + 32, 3, 173, 66, 32, 134, 132, 130, 34, 4, 66, 32, 135, 167, 36, 0, + 32, 4, 167, 11, + ]), + ), + {}, + ).exports; + } catch { + // no wasm support :( + } + + /** + * Constructs a 64 bit two's-complement integer, given its low and high 32 bit values as *signed* integers. + * See the from* functions below for more convenient ways of constructing Longs. + * @exports Long + * @class A Long class for representing a 64 bit two's-complement integer value. + * @param {number} low The low (signed) 32 bits of the long + * @param {number} high The high (signed) 32 bits of the long + * @param {boolean=} unsigned Whether unsigned or not, defaults to signed + * @constructor + */ + function Long(low, high, unsigned) { + /** + * The low 32 bits as a signed value. + * @type {number} + */ + this.low = low | 0; + + /** + * The high 32 bits as a signed value. + * @type {number} + */ + this.high = high | 0; + + /** + * Whether unsigned or not. + * @type {boolean} + */ + this.unsigned = !!unsigned; + } + + // The internal representation of a long is the two given signed, 32-bit values. + // We use 32-bit pieces because these are the size of integers on which + // Javascript performs bit-operations. For operations like addition and + // multiplication, we split each number into 16 bit pieces, which can easily be + // multiplied within Javascript's floating-point representation without overflow + // or change in sign. + // + // In the algorithms below, we frequently reduce the negative case to the + // positive case by negating the input(s) and then post-processing the result. + // Note that we must ALWAYS check specially whether those values are MIN_VALUE + // (-2^63) because -MIN_VALUE == MIN_VALUE (since 2^63 cannot be represented as + // a positive number, it overflows back into a negative). Not handling this + // case would often result in infinite recursion. + // + // Common constant values ZERO, ONE, NEG_ONE, etc. are defined below the from* + // methods on which they depend. + + /** + * An indicator used to reliably determine if an object is a Long or not. + * @type {boolean} + * @const + * @private + */ + Long.prototype.__isLong__; + Object.defineProperty(Long.prototype, "__isLong__", { + value: true, + }); + + /** + * @function + * @param {*} obj Object + * @returns {boolean} + * @inner + */ + function isLong(obj) { + return (obj && obj["__isLong__"]) === true; + } + + /** + * @function + * @param {*} value number + * @returns {number} + * @inner + */ + function ctz32(value) { + var c = Math.clz32(value & -value); + return value ? 31 - c : c; + } + + /** + * Tests if the specified object is a Long. + * @function + * @param {*} obj Object + * @returns {boolean} + */ + Long.isLong = isLong; + + /** + * A cache of the Long representations of small integer values. + * @type {!Object} + * @inner + */ + var INT_CACHE = {}; + + /** + * A cache of the Long representations of small unsigned integer values. + * @type {!Object} + * @inner + */ + var UINT_CACHE = {}; + + /** + * @param {number} value + * @param {boolean=} unsigned + * @returns {!Long} + * @inner + */ + function fromInt(value, unsigned) { + var obj, cachedObj, cache; + if (unsigned) { + value >>>= 0; + if ((cache = 0 <= value && value < 256)) { + cachedObj = UINT_CACHE[value]; + if (cachedObj) return cachedObj; + } + obj = fromBits(value, 0, true); + if (cache) UINT_CACHE[value] = obj; + return obj; + } else { + value |= 0; + if ((cache = -128 <= value && value < 128)) { + cachedObj = INT_CACHE[value]; + if (cachedObj) return cachedObj; + } + obj = fromBits(value, value < 0 ? -1 : 0, false); + if (cache) INT_CACHE[value] = obj; + return obj; + } + } + + /** + * Returns a Long representing the given 32 bit integer value. + * @function + * @param {number} value The 32 bit integer in question + * @param {boolean=} unsigned Whether unsigned or not, defaults to signed + * @returns {!Long} The corresponding Long value + */ + Long.fromInt = fromInt; + + /** + * @param {number} value + * @param {boolean=} unsigned + * @returns {!Long} + * @inner + */ + function fromNumber(value, unsigned) { + if (isNaN(value)) return unsigned ? UZERO : ZERO; + if (unsigned) { + if (value < 0) return UZERO; + if (value >= TWO_PWR_64_DBL) return MAX_UNSIGNED_VALUE; + } else { + if (value <= -TWO_PWR_63_DBL) return MIN_VALUE; + if (value + 1 >= TWO_PWR_63_DBL) return MAX_VALUE; + } + if (value < 0) return fromNumber(-value, unsigned).neg(); + return fromBits( + value % TWO_PWR_32_DBL | 0, + (value / TWO_PWR_32_DBL) | 0, + unsigned, + ); + } + + /** + * Returns a Long representing the given value, provided that it is a finite number. Otherwise, zero is returned. + * @function + * @param {number} value The number in question + * @param {boolean=} unsigned Whether unsigned or not, defaults to signed + * @returns {!Long} The corresponding Long value + */ + Long.fromNumber = fromNumber; + + /** + * @param {number} lowBits + * @param {number} highBits + * @param {boolean=} unsigned + * @returns {!Long} + * @inner + */ + function fromBits(lowBits, highBits, unsigned) { + return new Long(lowBits, highBits, unsigned); + } + + /** + * Returns a Long representing the 64 bit integer that comes by concatenating the given low and high bits. Each is + * assumed to use 32 bits. + * @function + * @param {number} lowBits The low 32 bits + * @param {number} highBits The high 32 bits + * @param {boolean=} unsigned Whether unsigned or not, defaults to signed + * @returns {!Long} The corresponding Long value + */ + Long.fromBits = fromBits; + + /** + * @function + * @param {number} base + * @param {number} exponent + * @returns {number} + * @inner + */ + var pow_dbl = Math.pow; // Used 4 times (4*8 to 15+4) + + /** + * @param {string} str + * @param {(boolean|number)=} unsigned + * @param {number=} radix + * @returns {!Long} + * @inner + */ + function fromString(str, unsigned, radix) { + if (str.length === 0) throw Error("empty string"); + if (typeof unsigned === "number") { + // For goog.math.long compatibility + radix = unsigned; + unsigned = false; + } else { + unsigned = !!unsigned; + } + if ( + str === "NaN" || + str === "Infinity" || + str === "+Infinity" || + str === "-Infinity" + ) + return unsigned ? UZERO : ZERO; + radix = radix || 10; + if (radix < 2 || 36 < radix) throw RangeError("radix"); + var p; + if ((p = str.indexOf("-")) > 0) throw Error("interior hyphen"); + else if (p === 0) { + return fromString(str.substring(1), unsigned, radix).neg(); + } + + // Do several (8) digits each time through the loop, so as to + // minimize the calls to the very expensive emulated div. + var radixToPower = fromNumber(pow_dbl(radix, 8)); + var result = ZERO; + for (var i = 0; i < str.length; i += 8) { + var size = Math.min(8, str.length - i), + value = parseInt(str.substring(i, i + size), radix); + if (size < 8) { + var power = fromNumber(pow_dbl(radix, size)); + result = result.mul(power).add(fromNumber(value)); + } else { + result = result.mul(radixToPower); + result = result.add(fromNumber(value)); + } + } + result.unsigned = unsigned; + return result; + } + + /** + * Returns a Long representation of the given string, written using the specified radix. + * @function + * @param {string} str The textual representation of the Long + * @param {(boolean|number)=} unsigned Whether unsigned or not, defaults to signed + * @param {number=} radix The radix in which the text is written (2-36), defaults to 10 + * @returns {!Long} The corresponding Long value + */ + Long.fromString = fromString; + + /** + * @function + * @param {!Long|number|string|!{low: number, high: number, unsigned: boolean}} val + * @param {boolean=} unsigned + * @returns {!Long} + * @inner + */ + function fromValue(val, unsigned) { + if (typeof val === "number") return fromNumber(val, unsigned); + if (typeof val === "string") return fromString(val, unsigned); + // Throws for non-objects, converts non-instanceof Long: + return fromBits( + val.low, + val.high, + typeof unsigned === "boolean" ? unsigned : val.unsigned, + ); + } + + /** + * Converts the specified value to a Long using the appropriate from* function for its type. + * @function + * @param {!Long|number|bigint|string|!{low: number, high: number, unsigned: boolean}} val Value + * @param {boolean=} unsigned Whether unsigned or not, defaults to signed + * @returns {!Long} + */ + Long.fromValue = fromValue; + + // NOTE: the compiler should inline these constant values below and then remove these variables, so there should be + // no runtime penalty for these. + + /** + * @type {number} + * @const + * @inner + */ + var TWO_PWR_16_DBL = 1 << 16; + + /** + * @type {number} + * @const + * @inner + */ + var TWO_PWR_24_DBL = 1 << 24; + + /** + * @type {number} + * @const + * @inner + */ + var TWO_PWR_32_DBL = TWO_PWR_16_DBL * TWO_PWR_16_DBL; + + /** + * @type {number} + * @const + * @inner + */ + var TWO_PWR_64_DBL = TWO_PWR_32_DBL * TWO_PWR_32_DBL; + + /** + * @type {number} + * @const + * @inner + */ + var TWO_PWR_63_DBL = TWO_PWR_64_DBL / 2; + + /** + * @type {!Long} + * @const + * @inner + */ + var TWO_PWR_24 = fromInt(TWO_PWR_24_DBL); + + /** + * @type {!Long} + * @inner + */ + var ZERO = fromInt(0); + + /** + * Signed zero. + * @type {!Long} + */ + Long.ZERO = ZERO; + + /** + * @type {!Long} + * @inner + */ + var UZERO = fromInt(0, true); + + /** + * Unsigned zero. + * @type {!Long} + */ + Long.UZERO = UZERO; + + /** + * @type {!Long} + * @inner + */ + var ONE = fromInt(1); + + /** + * Signed one. + * @type {!Long} + */ + Long.ONE = ONE; + + /** + * @type {!Long} + * @inner + */ + var UONE = fromInt(1, true); + + /** + * Unsigned one. + * @type {!Long} + */ + Long.UONE = UONE; + + /** + * @type {!Long} + * @inner + */ + var NEG_ONE = fromInt(-1); + + /** + * Signed negative one. + * @type {!Long} + */ + Long.NEG_ONE = NEG_ONE; + + /** + * @type {!Long} + * @inner + */ + var MAX_VALUE = fromBits(0xffffffff | 0, 0x7fffffff | 0, false); + + /** + * Maximum signed value. + * @type {!Long} + */ + Long.MAX_VALUE = MAX_VALUE; + + /** + * @type {!Long} + * @inner + */ + var MAX_UNSIGNED_VALUE = fromBits(0xffffffff | 0, 0xffffffff | 0, true); + + /** + * Maximum unsigned value. + * @type {!Long} + */ + Long.MAX_UNSIGNED_VALUE = MAX_UNSIGNED_VALUE; + + /** + * @type {!Long} + * @inner + */ + var MIN_VALUE = fromBits(0, 0x80000000 | 0, false); + + /** + * Minimum signed value. + * @type {!Long} + */ + Long.MIN_VALUE = MIN_VALUE; + + /** + * @alias Long.prototype + * @inner + */ + var LongPrototype = Long.prototype; + + /** + * Converts the Long to a 32 bit integer, assuming it is a 32 bit integer. + * @this {!Long} + * @returns {number} + */ + LongPrototype.toInt = function toInt() { + return this.unsigned ? this.low >>> 0 : this.low; + }; + + /** + * Converts the Long to a the nearest floating-point representation of this value (double, 53 bit mantissa). + * @this {!Long} + * @returns {number} + */ + LongPrototype.toNumber = function toNumber() { + if (this.unsigned) + return (this.high >>> 0) * TWO_PWR_32_DBL + (this.low >>> 0); + return this.high * TWO_PWR_32_DBL + (this.low >>> 0); + }; + + /** + * Converts the Long to a string written in the specified radix. + * @this {!Long} + * @param {number=} radix Radix (2-36), defaults to 10 + * @returns {string} + * @override + * @throws {RangeError} If `radix` is out of range + */ + LongPrototype.toString = function toString(radix) { + radix = radix || 10; + if (radix < 2 || 36 < radix) throw RangeError("radix"); + if (this.isZero()) return "0"; + if (this.isNegative()) { + // Unsigned Longs are never negative + if (this.eq(MIN_VALUE)) { + // We need to change the Long value before it can be negated, so we remove + // the bottom-most digit in this base and then recurse to do the rest. + var radixLong = fromNumber(radix), + div = this.div(radixLong), + rem1 = div.mul(radixLong).sub(this); + return div.toString(radix) + rem1.toInt().toString(radix); + } else return "-" + this.neg().toString(radix); + } + + // Do several (6) digits each time through the loop, so as to + // minimize the calls to the very expensive emulated div. + var radixToPower = fromNumber(pow_dbl(radix, 6), this.unsigned), + rem = this; + var result = ""; + while (true) { + var remDiv = rem.div(radixToPower), + intval = rem.sub(remDiv.mul(radixToPower)).toInt() >>> 0, + digits = intval.toString(radix); + rem = remDiv; + if (rem.isZero()) return digits + result; + else { + while (digits.length < 6) digits = "0" + digits; + result = "" + digits + result; + } + } + }; + + /** + * Gets the high 32 bits as a signed integer. + * @this {!Long} + * @returns {number} Signed high bits + */ + LongPrototype.getHighBits = function getHighBits() { + return this.high; + }; + + /** + * Gets the high 32 bits as an unsigned integer. + * @this {!Long} + * @returns {number} Unsigned high bits + */ + LongPrototype.getHighBitsUnsigned = function getHighBitsUnsigned() { + return this.high >>> 0; + }; + + /** + * Gets the low 32 bits as a signed integer. + * @this {!Long} + * @returns {number} Signed low bits + */ + LongPrototype.getLowBits = function getLowBits() { + return this.low; + }; + + /** + * Gets the low 32 bits as an unsigned integer. + * @this {!Long} + * @returns {number} Unsigned low bits + */ + LongPrototype.getLowBitsUnsigned = function getLowBitsUnsigned() { + return this.low >>> 0; + }; + + /** + * Gets the number of bits needed to represent the absolute value of this Long. + * @this {!Long} + * @returns {number} + */ + LongPrototype.getNumBitsAbs = function getNumBitsAbs() { + if (this.isNegative()) + // Unsigned Longs are never negative + return this.eq(MIN_VALUE) ? 64 : this.neg().getNumBitsAbs(); + var val = this.high != 0 ? this.high : this.low; + for (var bit = 31; bit > 0; bit--) if ((val & (1 << bit)) != 0) break; + return this.high != 0 ? bit + 33 : bit + 1; + }; + + /** + * Tests if this Long can be safely represented as a JavaScript number. + * @this {!Long} + * @returns {boolean} + */ + LongPrototype.isSafeInteger = function isSafeInteger() { + // 2^53-1 is the maximum safe value + var top11Bits = this.high >> 21; + // [0, 2^53-1] + if (!top11Bits) return true; + // > 2^53-1 + if (this.unsigned) return false; + // [-2^53, -1] except -2^53 + return top11Bits === -1 && !(this.low === 0 && this.high === -0x200000); + }; + + /** + * Tests if this Long's value equals zero. + * @this {!Long} + * @returns {boolean} + */ + LongPrototype.isZero = function isZero() { + return this.high === 0 && this.low === 0; + }; + + /** + * Tests if this Long's value equals zero. This is an alias of {@link Long#isZero}. + * @returns {boolean} + */ + LongPrototype.eqz = LongPrototype.isZero; + + /** + * Tests if this Long's value is negative. + * @this {!Long} + * @returns {boolean} + */ + LongPrototype.isNegative = function isNegative() { + return !this.unsigned && this.high < 0; + }; + + /** + * Tests if this Long's value is positive or zero. + * @this {!Long} + * @returns {boolean} + */ + LongPrototype.isPositive = function isPositive() { + return this.unsigned || this.high >= 0; + }; + + /** + * Tests if this Long's value is odd. + * @this {!Long} + * @returns {boolean} + */ + LongPrototype.isOdd = function isOdd() { + return (this.low & 1) === 1; + }; + + /** + * Tests if this Long's value is even. + * @this {!Long} + * @returns {boolean} + */ + LongPrototype.isEven = function isEven() { + return (this.low & 1) === 0; + }; + + /** + * Tests if this Long's value equals the specified's. + * @this {!Long} + * @param {!Long|number|bigint|string} other Other value + * @returns {boolean} + */ + LongPrototype.equals = function equals(other) { + if (!isLong(other)) other = fromValue(other); + if ( + this.unsigned !== other.unsigned && + this.high >>> 31 === 1 && + other.high >>> 31 === 1 + ) + return false; + return this.high === other.high && this.low === other.low; + }; + + /** + * Tests if this Long's value equals the specified's. This is an alias of {@link Long#equals}. + * @function + * @param {!Long|number|bigint|string} other Other value + * @returns {boolean} + */ + LongPrototype.eq = LongPrototype.equals; + + /** + * Tests if this Long's value differs from the specified's. + * @this {!Long} + * @param {!Long|number|bigint|string} other Other value + * @returns {boolean} + */ + LongPrototype.notEquals = function notEquals(other) { + return !this.eq(/* validates */ other); + }; + + /** + * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}. + * @function + * @param {!Long|number|bigint|string} other Other value + * @returns {boolean} + */ + LongPrototype.neq = LongPrototype.notEquals; + + /** + * Tests if this Long's value differs from the specified's. This is an alias of {@link Long#notEquals}. + * @function + * @param {!Long|number|bigint|string} other Other value + * @returns {boolean} + */ + LongPrototype.ne = LongPrototype.notEquals; + + /** + * Tests if this Long's value is less than the specified's. + * @this {!Long} + * @param {!Long|number|bigint|string} other Other value + * @returns {boolean} + */ + LongPrototype.lessThan = function lessThan(other) { + return this.comp(/* validates */ other) < 0; + }; + + /** + * Tests if this Long's value is less than the specified's. This is an alias of {@link Long#lessThan}. + * @function + * @param {!Long|number|bigint|string} other Other value + * @returns {boolean} + */ + LongPrototype.lt = LongPrototype.lessThan; + + /** + * Tests if this Long's value is less than or equal the specified's. + * @this {!Long} + * @param {!Long|number|bigint|string} other Other value + * @returns {boolean} + */ + LongPrototype.lessThanOrEqual = function lessThanOrEqual(other) { + return this.comp(/* validates */ other) <= 0; + }; + + /** + * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}. + * @function + * @param {!Long|number|bigint|string} other Other value + * @returns {boolean} + */ + LongPrototype.lte = LongPrototype.lessThanOrEqual; + + /** + * Tests if this Long's value is less than or equal the specified's. This is an alias of {@link Long#lessThanOrEqual}. + * @function + * @param {!Long|number|bigint|string} other Other value + * @returns {boolean} + */ + LongPrototype.le = LongPrototype.lessThanOrEqual; + + /** + * Tests if this Long's value is greater than the specified's. + * @this {!Long} + * @param {!Long|number|bigint|string} other Other value + * @returns {boolean} + */ + LongPrototype.greaterThan = function greaterThan(other) { + return this.comp(/* validates */ other) > 0; + }; + + /** + * Tests if this Long's value is greater than the specified's. This is an alias of {@link Long#greaterThan}. + * @function + * @param {!Long|number|bigint|string} other Other value + * @returns {boolean} + */ + LongPrototype.gt = LongPrototype.greaterThan; + + /** + * Tests if this Long's value is greater than or equal the specified's. + * @this {!Long} + * @param {!Long|number|bigint|string} other Other value + * @returns {boolean} + */ + LongPrototype.greaterThanOrEqual = function greaterThanOrEqual(other) { + return this.comp(/* validates */ other) >= 0; + }; + + /** + * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}. + * @function + * @param {!Long|number|bigint|string} other Other value + * @returns {boolean} + */ + LongPrototype.gte = LongPrototype.greaterThanOrEqual; + + /** + * Tests if this Long's value is greater than or equal the specified's. This is an alias of {@link Long#greaterThanOrEqual}. + * @function + * @param {!Long|number|bigint|string} other Other value + * @returns {boolean} + */ + LongPrototype.ge = LongPrototype.greaterThanOrEqual; + + /** + * Compares this Long's value with the specified's. + * @this {!Long} + * @param {!Long|number|bigint|string} other Other value + * @returns {number} 0 if they are the same, 1 if the this is greater and -1 + * if the given one is greater + */ + LongPrototype.compare = function compare(other) { + if (!isLong(other)) other = fromValue(other); + if (this.eq(other)) return 0; + var thisNeg = this.isNegative(), + otherNeg = other.isNegative(); + if (thisNeg && !otherNeg) return -1; + if (!thisNeg && otherNeg) return 1; + // At this point the sign bits are the same + if (!this.unsigned) return this.sub(other).isNegative() ? -1 : 1; + // Both are positive if at least one is unsigned + return other.high >>> 0 > this.high >>> 0 || + (other.high === this.high && other.low >>> 0 > this.low >>> 0) + ? -1 + : 1; + }; + + /** + * Compares this Long's value with the specified's. This is an alias of {@link Long#compare}. + * @function + * @param {!Long|number|bigint|string} other Other value + * @returns {number} 0 if they are the same, 1 if the this is greater and -1 + * if the given one is greater + */ + LongPrototype.comp = LongPrototype.compare; + + /** + * Negates this Long's value. + * @this {!Long} + * @returns {!Long} Negated Long + */ + LongPrototype.negate = function negate() { + if (!this.unsigned && this.eq(MIN_VALUE)) return MIN_VALUE; + return this.not().add(ONE); + }; + + /** + * Negates this Long's value. This is an alias of {@link Long#negate}. + * @function + * @returns {!Long} Negated Long + */ + LongPrototype.neg = LongPrototype.negate; + + /** + * Returns the sum of this and the specified Long. + * @this {!Long} + * @param {!Long|number|bigint|string} addend Addend + * @returns {!Long} Sum + */ + LongPrototype.add = function add(addend) { + if (!isLong(addend)) addend = fromValue(addend); + + // Divide each number into 4 chunks of 16 bits, and then sum the chunks. + + var a48 = this.high >>> 16; + var a32 = this.high & 0xffff; + var a16 = this.low >>> 16; + var a00 = this.low & 0xffff; + var b48 = addend.high >>> 16; + var b32 = addend.high & 0xffff; + var b16 = addend.low >>> 16; + var b00 = addend.low & 0xffff; + var c48 = 0, + c32 = 0, + c16 = 0, + c00 = 0; + c00 += a00 + b00; + c16 += c00 >>> 16; + c00 &= 0xffff; + c16 += a16 + b16; + c32 += c16 >>> 16; + c16 &= 0xffff; + c32 += a32 + b32; + c48 += c32 >>> 16; + c32 &= 0xffff; + c48 += a48 + b48; + c48 &= 0xffff; + return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned); + }; + + /** + * Returns the difference of this and the specified Long. + * @this {!Long} + * @param {!Long|number|bigint|string} subtrahend Subtrahend + * @returns {!Long} Difference + */ + LongPrototype.subtract = function subtract(subtrahend) { + if (!isLong(subtrahend)) subtrahend = fromValue(subtrahend); + return this.add(subtrahend.neg()); + }; + + /** + * Returns the difference of this and the specified Long. This is an alias of {@link Long#subtract}. + * @function + * @param {!Long|number|bigint|string} subtrahend Subtrahend + * @returns {!Long} Difference + */ + LongPrototype.sub = LongPrototype.subtract; + + /** + * Returns the product of this and the specified Long. + * @this {!Long} + * @param {!Long|number|bigint|string} multiplier Multiplier + * @returns {!Long} Product + */ + LongPrototype.multiply = function multiply(multiplier) { + if (this.isZero()) return this; + if (!isLong(multiplier)) multiplier = fromValue(multiplier); + + // use wasm support if present + if (wasm) { + var low = wasm["mul"]( + this.low, + this.high, + multiplier.low, + multiplier.high, + ); + return fromBits(low, wasm["get_high"](), this.unsigned); + } + if (multiplier.isZero()) return this.unsigned ? UZERO : ZERO; + if (this.eq(MIN_VALUE)) return multiplier.isOdd() ? MIN_VALUE : ZERO; + if (multiplier.eq(MIN_VALUE)) return this.isOdd() ? MIN_VALUE : ZERO; + if (this.isNegative()) { + if (multiplier.isNegative()) return this.neg().mul(multiplier.neg()); + else return this.neg().mul(multiplier).neg(); + } else if (multiplier.isNegative()) + return this.mul(multiplier.neg()).neg(); + + // If both longs are small, use float multiplication + if (this.lt(TWO_PWR_24) && multiplier.lt(TWO_PWR_24)) + return fromNumber( + this.toNumber() * multiplier.toNumber(), + this.unsigned, + ); + + // Divide each long into 4 chunks of 16 bits, and then add up 4x4 products. + // We can skip products that would overflow. + + var a48 = this.high >>> 16; + var a32 = this.high & 0xffff; + var a16 = this.low >>> 16; + var a00 = this.low & 0xffff; + var b48 = multiplier.high >>> 16; + var b32 = multiplier.high & 0xffff; + var b16 = multiplier.low >>> 16; + var b00 = multiplier.low & 0xffff; + var c48 = 0, + c32 = 0, + c16 = 0, + c00 = 0; + c00 += a00 * b00; + c16 += c00 >>> 16; + c00 &= 0xffff; + c16 += a16 * b00; + c32 += c16 >>> 16; + c16 &= 0xffff; + c16 += a00 * b16; + c32 += c16 >>> 16; + c16 &= 0xffff; + c32 += a32 * b00; + c48 += c32 >>> 16; + c32 &= 0xffff; + c32 += a16 * b16; + c48 += c32 >>> 16; + c32 &= 0xffff; + c32 += a00 * b32; + c48 += c32 >>> 16; + c32 &= 0xffff; + c48 += a48 * b00 + a32 * b16 + a16 * b32 + a00 * b48; + c48 &= 0xffff; + return fromBits((c16 << 16) | c00, (c48 << 16) | c32, this.unsigned); + }; + + /** + * Returns the product of this and the specified Long. This is an alias of {@link Long#multiply}. + * @function + * @param {!Long|number|bigint|string} multiplier Multiplier + * @returns {!Long} Product + */ + LongPrototype.mul = LongPrototype.multiply; + + /** + * Returns this Long divided by the specified. The result is signed if this Long is signed or + * unsigned if this Long is unsigned. + * @this {!Long} + * @param {!Long|number|bigint|string} divisor Divisor + * @returns {!Long} Quotient + */ + LongPrototype.divide = function divide(divisor) { + if (!isLong(divisor)) divisor = fromValue(divisor); + if (divisor.isZero()) throw Error("division by zero"); + + // use wasm support if present + if (wasm) { + // guard against signed division overflow: the largest + // negative number / -1 would be 1 larger than the largest + // positive number, due to two's complement. + if ( + !this.unsigned && + this.high === -0x80000000 && + divisor.low === -1 && + divisor.high === -1 + ) { + // be consistent with non-wasm code path + return this; + } + var low = (this.unsigned ? wasm["div_u"] : wasm["div_s"])( + this.low, + this.high, + divisor.low, + divisor.high, + ); + return fromBits(low, wasm["get_high"](), this.unsigned); + } + if (this.isZero()) return this.unsigned ? UZERO : ZERO; + var approx, rem, res; + if (!this.unsigned) { + // This section is only relevant for signed longs and is derived from the + // closure library as a whole. + if (this.eq(MIN_VALUE)) { + if (divisor.eq(ONE) || divisor.eq(NEG_ONE)) + return MIN_VALUE; // recall that -MIN_VALUE == MIN_VALUE + else if (divisor.eq(MIN_VALUE)) return ONE; + else { + // At this point, we have |other| >= 2, so |this/other| < |MIN_VALUE|. + var halfThis = this.shr(1); + approx = halfThis.div(divisor).shl(1); + if (approx.eq(ZERO)) { + return divisor.isNegative() ? ONE : NEG_ONE; + } else { + rem = this.sub(divisor.mul(approx)); + res = approx.add(rem.div(divisor)); + return res; + } + } + } else if (divisor.eq(MIN_VALUE)) return this.unsigned ? UZERO : ZERO; + if (this.isNegative()) { + if (divisor.isNegative()) return this.neg().div(divisor.neg()); + return this.neg().div(divisor).neg(); + } else if (divisor.isNegative()) return this.div(divisor.neg()).neg(); + res = ZERO; + } else { + // The algorithm below has not been made for unsigned longs. It's therefore + // required to take special care of the MSB prior to running it. + if (!divisor.unsigned) divisor = divisor.toUnsigned(); + if (divisor.gt(this)) return UZERO; + if (divisor.gt(this.shru(1))) + // 15 >>> 1 = 7 ; with divisor = 8 ; true + return UONE; + res = UZERO; + } + + // Repeat the following until the remainder is less than other: find a + // floating-point that approximates remainder / other *from below*, add this + // into the result, and subtract it from the remainder. It is critical that + // the approximate value is less than or equal to the real value so that the + // remainder never becomes negative. + rem = this; + while (rem.gte(divisor)) { + // Approximate the result of division. This may be a little greater or + // smaller than the actual value. + approx = Math.max(1, Math.floor(rem.toNumber() / divisor.toNumber())); + + // We will tweak the approximate result by changing it in the 48-th digit or + // the smallest non-fractional digit, whichever is larger. + var log2 = Math.ceil(Math.log(approx) / Math.LN2), + delta = log2 <= 48 ? 1 : pow_dbl(2, log2 - 48), + // Decrease the approximation until it is smaller than the remainder. Note + // that if it is too large, the product overflows and is negative. + approxRes = fromNumber(approx), + approxRem = approxRes.mul(divisor); + while (approxRem.isNegative() || approxRem.gt(rem)) { + approx -= delta; + approxRes = fromNumber(approx, this.unsigned); + approxRem = approxRes.mul(divisor); + } + + // We know the answer can't be zero... and actually, zero would cause + // infinite recursion since we would make no progress. + if (approxRes.isZero()) approxRes = ONE; + res = res.add(approxRes); + rem = rem.sub(approxRem); + } + return res; + }; + + /** + * Returns this Long divided by the specified. This is an alias of {@link Long#divide}. + * @function + * @param {!Long|number|bigint|string} divisor Divisor + * @returns {!Long} Quotient + */ + LongPrototype.div = LongPrototype.divide; + + /** + * Returns this Long modulo the specified. + * @this {!Long} + * @param {!Long|number|bigint|string} divisor Divisor + * @returns {!Long} Remainder + */ + LongPrototype.modulo = function modulo(divisor) { + if (!isLong(divisor)) divisor = fromValue(divisor); + + // use wasm support if present + if (wasm) { + var low = (this.unsigned ? wasm["rem_u"] : wasm["rem_s"])( + this.low, + this.high, + divisor.low, + divisor.high, + ); + return fromBits(low, wasm["get_high"](), this.unsigned); + } + return this.sub(this.div(divisor).mul(divisor)); + }; + + /** + * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}. + * @function + * @param {!Long|number|bigint|string} divisor Divisor + * @returns {!Long} Remainder + */ + LongPrototype.mod = LongPrototype.modulo; + + /** + * Returns this Long modulo the specified. This is an alias of {@link Long#modulo}. + * @function + * @param {!Long|number|bigint|string} divisor Divisor + * @returns {!Long} Remainder + */ + LongPrototype.rem = LongPrototype.modulo; + + /** + * Returns the bitwise NOT of this Long. + * @this {!Long} + * @returns {!Long} + */ + LongPrototype.not = function not() { + return fromBits(~this.low, ~this.high, this.unsigned); + }; + + /** + * Returns count leading zeros of this Long. + * @this {!Long} + * @returns {!number} + */ + LongPrototype.countLeadingZeros = function countLeadingZeros() { + return this.high ? Math.clz32(this.high) : Math.clz32(this.low) + 32; + }; + + /** + * Returns count leading zeros. This is an alias of {@link Long#countLeadingZeros}. + * @function + * @param {!Long} + * @returns {!number} + */ + LongPrototype.clz = LongPrototype.countLeadingZeros; + + /** + * Returns count trailing zeros of this Long. + * @this {!Long} + * @returns {!number} + */ + LongPrototype.countTrailingZeros = function countTrailingZeros() { + return this.low ? ctz32(this.low) : ctz32(this.high) + 32; + }; + + /** + * Returns count trailing zeros. This is an alias of {@link Long#countTrailingZeros}. + * @function + * @param {!Long} + * @returns {!number} + */ + LongPrototype.ctz = LongPrototype.countTrailingZeros; + + /** + * Returns the bitwise AND of this Long and the specified. + * @this {!Long} + * @param {!Long|number|bigint|string} other Other Long + * @returns {!Long} + */ + LongPrototype.and = function and(other) { + if (!isLong(other)) other = fromValue(other); + return fromBits( + this.low & other.low, + this.high & other.high, + this.unsigned, + ); + }; + + /** + * Returns the bitwise OR of this Long and the specified. + * @this {!Long} + * @param {!Long|number|bigint|string} other Other Long + * @returns {!Long} + */ + LongPrototype.or = function or(other) { + if (!isLong(other)) other = fromValue(other); + return fromBits( + this.low | other.low, + this.high | other.high, + this.unsigned, + ); + }; + + /** + * Returns the bitwise XOR of this Long and the given one. + * @this {!Long} + * @param {!Long|number|bigint|string} other Other Long + * @returns {!Long} + */ + LongPrototype.xor = function xor(other) { + if (!isLong(other)) other = fromValue(other); + return fromBits( + this.low ^ other.low, + this.high ^ other.high, + this.unsigned, + ); + }; + + /** + * Returns this Long with bits shifted to the left by the given amount. + * @this {!Long} + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Shifted Long + */ + LongPrototype.shiftLeft = function shiftLeft(numBits) { + if (isLong(numBits)) numBits = numBits.toInt(); + if ((numBits &= 63) === 0) return this; + else if (numBits < 32) + return fromBits( + this.low << numBits, + (this.high << numBits) | (this.low >>> (32 - numBits)), + this.unsigned, + ); + else return fromBits(0, this.low << (numBits - 32), this.unsigned); + }; + + /** + * Returns this Long with bits shifted to the left by the given amount. This is an alias of {@link Long#shiftLeft}. + * @function + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Shifted Long + */ + LongPrototype.shl = LongPrototype.shiftLeft; + + /** + * Returns this Long with bits arithmetically shifted to the right by the given amount. + * @this {!Long} + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Shifted Long + */ + LongPrototype.shiftRight = function shiftRight(numBits) { + if (isLong(numBits)) numBits = numBits.toInt(); + if ((numBits &= 63) === 0) return this; + else if (numBits < 32) + return fromBits( + (this.low >>> numBits) | (this.high << (32 - numBits)), + this.high >> numBits, + this.unsigned, + ); + else + return fromBits( + this.high >> (numBits - 32), + this.high >= 0 ? 0 : -1, + this.unsigned, + ); + }; + + /** + * Returns this Long with bits arithmetically shifted to the right by the given amount. This is an alias of {@link Long#shiftRight}. + * @function + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Shifted Long + */ + LongPrototype.shr = LongPrototype.shiftRight; + + /** + * Returns this Long with bits logically shifted to the right by the given amount. + * @this {!Long} + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Shifted Long + */ + LongPrototype.shiftRightUnsigned = function shiftRightUnsigned(numBits) { + if (isLong(numBits)) numBits = numBits.toInt(); + if ((numBits &= 63) === 0) return this; + if (numBits < 32) + return fromBits( + (this.low >>> numBits) | (this.high << (32 - numBits)), + this.high >>> numBits, + this.unsigned, + ); + if (numBits === 32) return fromBits(this.high, 0, this.unsigned); + return fromBits(this.high >>> (numBits - 32), 0, this.unsigned); + }; + + /** + * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}. + * @function + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Shifted Long + */ + LongPrototype.shru = LongPrototype.shiftRightUnsigned; + + /** + * Returns this Long with bits logically shifted to the right by the given amount. This is an alias of {@link Long#shiftRightUnsigned}. + * @function + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Shifted Long + */ + LongPrototype.shr_u = LongPrototype.shiftRightUnsigned; + + /** + * Returns this Long with bits rotated to the left by the given amount. + * @this {!Long} + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Rotated Long + */ + LongPrototype.rotateLeft = function rotateLeft(numBits) { + var b; + if (isLong(numBits)) numBits = numBits.toInt(); + if ((numBits &= 63) === 0) return this; + if (numBits === 32) return fromBits(this.high, this.low, this.unsigned); + if (numBits < 32) { + b = 32 - numBits; + return fromBits( + (this.low << numBits) | (this.high >>> b), + (this.high << numBits) | (this.low >>> b), + this.unsigned, + ); + } + numBits -= 32; + b = 32 - numBits; + return fromBits( + (this.high << numBits) | (this.low >>> b), + (this.low << numBits) | (this.high >>> b), + this.unsigned, + ); + }; + /** + * Returns this Long with bits rotated to the left by the given amount. This is an alias of {@link Long#rotateLeft}. + * @function + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Rotated Long + */ + LongPrototype.rotl = LongPrototype.rotateLeft; + + /** + * Returns this Long with bits rotated to the right by the given amount. + * @this {!Long} + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Rotated Long + */ + LongPrototype.rotateRight = function rotateRight(numBits) { + var b; + if (isLong(numBits)) numBits = numBits.toInt(); + if ((numBits &= 63) === 0) return this; + if (numBits === 32) return fromBits(this.high, this.low, this.unsigned); + if (numBits < 32) { + b = 32 - numBits; + return fromBits( + (this.high << b) | (this.low >>> numBits), + (this.low << b) | (this.high >>> numBits), + this.unsigned, + ); + } + numBits -= 32; + b = 32 - numBits; + return fromBits( + (this.low << b) | (this.high >>> numBits), + (this.high << b) | (this.low >>> numBits), + this.unsigned, + ); + }; + /** + * Returns this Long with bits rotated to the right by the given amount. This is an alias of {@link Long#rotateRight}. + * @function + * @param {number|!Long} numBits Number of bits + * @returns {!Long} Rotated Long + */ + LongPrototype.rotr = LongPrototype.rotateRight; + + /** + * Converts this Long to signed. + * @this {!Long} + * @returns {!Long} Signed long + */ + LongPrototype.toSigned = function toSigned() { + if (!this.unsigned) return this; + return fromBits(this.low, this.high, false); + }; + + /** + * Converts this Long to unsigned. + * @this {!Long} + * @returns {!Long} Unsigned long + */ + LongPrototype.toUnsigned = function toUnsigned() { + if (this.unsigned) return this; + return fromBits(this.low, this.high, true); + }; + + /** + * Converts this Long to its byte representation. + * @param {boolean=} le Whether little or big endian, defaults to big endian + * @this {!Long} + * @returns {!Array.} Byte representation + */ + LongPrototype.toBytes = function toBytes(le) { + return le ? this.toBytesLE() : this.toBytesBE(); + }; + + /** + * Converts this Long to its little endian byte representation. + * @this {!Long} + * @returns {!Array.} Little endian byte representation + */ + LongPrototype.toBytesLE = function toBytesLE() { + var hi = this.high, + lo = this.low; + return [ + lo & 0xff, + (lo >>> 8) & 0xff, + (lo >>> 16) & 0xff, + lo >>> 24, + hi & 0xff, + (hi >>> 8) & 0xff, + (hi >>> 16) & 0xff, + hi >>> 24, + ]; + }; + + /** + * Converts this Long to its big endian byte representation. + * @this {!Long} + * @returns {!Array.} Big endian byte representation + */ + LongPrototype.toBytesBE = function toBytesBE() { + var hi = this.high, + lo = this.low; + return [ + hi >>> 24, + (hi >>> 16) & 0xff, + (hi >>> 8) & 0xff, + hi & 0xff, + lo >>> 24, + (lo >>> 16) & 0xff, + (lo >>> 8) & 0xff, + lo & 0xff, + ]; + }; + + /** + * Creates a Long from its byte representation. + * @param {!Array.} bytes Byte representation + * @param {boolean=} unsigned Whether unsigned or not, defaults to signed + * @param {boolean=} le Whether little or big endian, defaults to big endian + * @returns {Long} The corresponding Long value + */ + Long.fromBytes = function fromBytes(bytes, unsigned, le) { + return le + ? Long.fromBytesLE(bytes, unsigned) + : Long.fromBytesBE(bytes, unsigned); + }; + + /** + * Creates a Long from its little endian byte representation. + * @param {!Array.} bytes Little endian byte representation + * @param {boolean=} unsigned Whether unsigned or not, defaults to signed + * @returns {Long} The corresponding Long value + */ + Long.fromBytesLE = function fromBytesLE(bytes, unsigned) { + return new Long( + bytes[0] | (bytes[1] << 8) | (bytes[2] << 16) | (bytes[3] << 24), + bytes[4] | (bytes[5] << 8) | (bytes[6] << 16) | (bytes[7] << 24), + unsigned, + ); + }; + + /** + * Creates a Long from its big endian byte representation. + * @param {!Array.} bytes Big endian byte representation + * @param {boolean=} unsigned Whether unsigned or not, defaults to signed + * @returns {Long} The corresponding Long value + */ + Long.fromBytesBE = function fromBytesBE(bytes, unsigned) { + return new Long( + (bytes[4] << 24) | (bytes[5] << 16) | (bytes[6] << 8) | bytes[7], + (bytes[0] << 24) | (bytes[1] << 16) | (bytes[2] << 8) | bytes[3], + unsigned, + ); + }; + + // Support conversion to/from BigInt where available + if (typeof BigInt === "function") { + /** + * Returns a Long representing the given big integer. + * @function + * @param {number} value The big integer value + * @param {boolean=} unsigned Whether unsigned or not, defaults to signed + * @returns {!Long} The corresponding Long value + */ + Long.fromBigInt = function fromBigInt(value, unsigned) { + var lowBits = Number(BigInt.asIntN(32, value)); + var highBits = Number(BigInt.asIntN(32, value >> BigInt(32))); + return fromBits(lowBits, highBits, unsigned); + }; + + // Override + Long.fromValue = function fromValueWithBigInt(value, unsigned) { + if (typeof value === "bigint") return Long.fromBigInt(value, unsigned); + return fromValue(value, unsigned); + }; + + /** + * Converts the Long to its big integer representation. + * @this {!Long} + * @returns {bigint} + */ + LongPrototype.toBigInt = function toBigInt() { + var lowBigInt = BigInt(this.low >>> 0); + var highBigInt = BigInt(this.unsigned ? this.high >>> 0 : this.high); + return (highBigInt << BigInt(32)) | lowBigInt; + }; + } + var _default = (_exports.default = Long); + }, +); + + +/***/ }), + +/***/ 82721: +/***/ ((module) => { + +"use strict"; +module.exports = /*#__PURE__*/JSON.parse('{"nested":{"google":{"nested":{"protobuf":{"options":{"go_package":"google.golang.org/protobuf/types/descriptorpb","java_package":"com.google.protobuf","java_outer_classname":"DescriptorProtos","csharp_namespace":"Google.Protobuf.Reflection","objc_class_prefix":"GPB","cc_enable_arenas":true,"optimize_for":"SPEED"},"nested":{"Duration":{"fields":{"seconds":{"type":"int64","id":1},"nanos":{"type":"int32","id":2}}},"FileDescriptorSet":{"edition":"proto2","fields":{"file":{"rule":"repeated","type":"FileDescriptorProto","id":1}}},"Edition":{"edition":"proto2","values":{"EDITION_UNKNOWN":0,"EDITION_PROTO2":998,"EDITION_PROTO3":999,"EDITION_2023":1000,"EDITION_2024":1001,"EDITION_1_TEST_ONLY":1,"EDITION_2_TEST_ONLY":2,"EDITION_99997_TEST_ONLY":99997,"EDITION_99998_TEST_ONLY":99998,"EDITION_99999_TEST_ONLY":99999,"EDITION_MAX":2147483647}},"FileDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"package":{"type":"string","id":2},"dependency":{"rule":"repeated","type":"string","id":3},"publicDependency":{"rule":"repeated","type":"int32","id":10},"weakDependency":{"rule":"repeated","type":"int32","id":11},"messageType":{"rule":"repeated","type":"DescriptorProto","id":4},"enumType":{"rule":"repeated","type":"EnumDescriptorProto","id":5},"service":{"rule":"repeated","type":"ServiceDescriptorProto","id":6},"extension":{"rule":"repeated","type":"FieldDescriptorProto","id":7},"options":{"type":"FileOptions","id":8},"sourceCodeInfo":{"type":"SourceCodeInfo","id":9},"syntax":{"type":"string","id":12},"edition":{"type":"Edition","id":14}}},"DescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"field":{"rule":"repeated","type":"FieldDescriptorProto","id":2},"extension":{"rule":"repeated","type":"FieldDescriptorProto","id":6},"nestedType":{"rule":"repeated","type":"DescriptorProto","id":3},"enumType":{"rule":"repeated","type":"EnumDescriptorProto","id":4},"extensionRange":{"rule":"repeated","type":"ExtensionRange","id":5},"oneofDecl":{"rule":"repeated","type":"OneofDescriptorProto","id":8},"options":{"type":"MessageOptions","id":7},"reservedRange":{"rule":"repeated","type":"ReservedRange","id":9},"reservedName":{"rule":"repeated","type":"string","id":10}},"nested":{"ExtensionRange":{"fields":{"start":{"type":"int32","id":1},"end":{"type":"int32","id":2},"options":{"type":"ExtensionRangeOptions","id":3}}},"ReservedRange":{"fields":{"start":{"type":"int32","id":1},"end":{"type":"int32","id":2}}}}},"ExtensionRangeOptions":{"edition":"proto2","fields":{"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999},"declaration":{"rule":"repeated","type":"Declaration","id":2,"options":{"retention":"RETENTION_SOURCE"}},"features":{"type":"FeatureSet","id":50},"verification":{"type":"VerificationState","id":3,"options":{"default":"UNVERIFIED","retention":"RETENTION_SOURCE"}}},"extensions":[[1000,536870911]],"nested":{"Declaration":{"fields":{"number":{"type":"int32","id":1},"fullName":{"type":"string","id":2},"type":{"type":"string","id":3},"reserved":{"type":"bool","id":5},"repeated":{"type":"bool","id":6}},"reserved":[[4,4]]},"VerificationState":{"values":{"DECLARATION":0,"UNVERIFIED":1}}}},"FieldDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"number":{"type":"int32","id":3},"label":{"type":"Label","id":4},"type":{"type":"Type","id":5},"typeName":{"type":"string","id":6},"extendee":{"type":"string","id":2},"defaultValue":{"type":"string","id":7},"oneofIndex":{"type":"int32","id":9},"jsonName":{"type":"string","id":10},"options":{"type":"FieldOptions","id":8},"proto3Optional":{"type":"bool","id":17}},"nested":{"Type":{"values":{"TYPE_DOUBLE":1,"TYPE_FLOAT":2,"TYPE_INT64":3,"TYPE_UINT64":4,"TYPE_INT32":5,"TYPE_FIXED64":6,"TYPE_FIXED32":7,"TYPE_BOOL":8,"TYPE_STRING":9,"TYPE_GROUP":10,"TYPE_MESSAGE":11,"TYPE_BYTES":12,"TYPE_UINT32":13,"TYPE_ENUM":14,"TYPE_SFIXED32":15,"TYPE_SFIXED64":16,"TYPE_SINT32":17,"TYPE_SINT64":18}},"Label":{"values":{"LABEL_OPTIONAL":1,"LABEL_REPEATED":3,"LABEL_REQUIRED":2}}}},"OneofDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"options":{"type":"OneofOptions","id":2}}},"EnumDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"value":{"rule":"repeated","type":"EnumValueDescriptorProto","id":2},"options":{"type":"EnumOptions","id":3},"reservedRange":{"rule":"repeated","type":"EnumReservedRange","id":4},"reservedName":{"rule":"repeated","type":"string","id":5}},"nested":{"EnumReservedRange":{"fields":{"start":{"type":"int32","id":1},"end":{"type":"int32","id":2}}}}},"EnumValueDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"number":{"type":"int32","id":2},"options":{"type":"EnumValueOptions","id":3}}},"ServiceDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"method":{"rule":"repeated","type":"MethodDescriptorProto","id":2},"options":{"type":"ServiceOptions","id":3}}},"MethodDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"inputType":{"type":"string","id":2},"outputType":{"type":"string","id":3},"options":{"type":"MethodOptions","id":4},"clientStreaming":{"type":"bool","id":5,"options":{"default":false}},"serverStreaming":{"type":"bool","id":6,"options":{"default":false}}}},"FileOptions":{"edition":"proto2","fields":{"javaPackage":{"type":"string","id":1},"javaOuterClassname":{"type":"string","id":8},"javaMultipleFiles":{"type":"bool","id":10,"options":{"default":false}},"javaGenerateEqualsAndHash":{"type":"bool","id":20,"options":{"deprecated":true}},"javaStringCheckUtf8":{"type":"bool","id":27,"options":{"default":false}},"optimizeFor":{"type":"OptimizeMode","id":9,"options":{"default":"SPEED"}},"goPackage":{"type":"string","id":11},"ccGenericServices":{"type":"bool","id":16,"options":{"default":false}},"javaGenericServices":{"type":"bool","id":17,"options":{"default":false}},"pyGenericServices":{"type":"bool","id":18,"options":{"default":false}},"deprecated":{"type":"bool","id":23,"options":{"default":false}},"ccEnableArenas":{"type":"bool","id":31,"options":{"default":true}},"objcClassPrefix":{"type":"string","id":36},"csharpNamespace":{"type":"string","id":37},"swiftPrefix":{"type":"string","id":39},"phpClassPrefix":{"type":"string","id":40},"phpNamespace":{"type":"string","id":41},"phpMetadataNamespace":{"type":"string","id":44},"rubyPackage":{"type":"string","id":45},"features":{"type":"FeatureSet","id":50},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[42,42],[38,38]],"nested":{"OptimizeMode":{"values":{"SPEED":1,"CODE_SIZE":2,"LITE_RUNTIME":3}}}},"MessageOptions":{"edition":"proto2","fields":{"messageSetWireFormat":{"type":"bool","id":1,"options":{"default":false}},"noStandardDescriptorAccessor":{"type":"bool","id":2,"options":{"default":false}},"deprecated":{"type":"bool","id":3,"options":{"default":false}},"mapEntry":{"type":"bool","id":7},"deprecatedLegacyJsonFieldConflicts":{"type":"bool","id":11,"options":{"deprecated":true}},"features":{"type":"FeatureSet","id":12},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[4,4],[5,5],[6,6],[8,8],[9,9]]},"FieldOptions":{"edition":"proto2","fields":{"ctype":{"type":"CType","id":1,"options":{"default":"STRING"}},"packed":{"type":"bool","id":2},"jstype":{"type":"JSType","id":6,"options":{"default":"JS_NORMAL"}},"lazy":{"type":"bool","id":5,"options":{"default":false}},"unverifiedLazy":{"type":"bool","id":15,"options":{"default":false}},"deprecated":{"type":"bool","id":3,"options":{"default":false}},"weak":{"type":"bool","id":10,"options":{"default":false}},"debugRedact":{"type":"bool","id":16,"options":{"default":false}},"retention":{"type":"OptionRetention","id":17},"targets":{"rule":"repeated","type":"OptionTargetType","id":19},"editionDefaults":{"rule":"repeated","type":"EditionDefault","id":20},"features":{"type":"FeatureSet","id":21},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[4,4],[18,18]],"nested":{"CType":{"values":{"STRING":0,"CORD":1,"STRING_PIECE":2}},"JSType":{"values":{"JS_NORMAL":0,"JS_STRING":1,"JS_NUMBER":2}},"OptionRetention":{"values":{"RETENTION_UNKNOWN":0,"RETENTION_RUNTIME":1,"RETENTION_SOURCE":2}},"OptionTargetType":{"values":{"TARGET_TYPE_UNKNOWN":0,"TARGET_TYPE_FILE":1,"TARGET_TYPE_EXTENSION_RANGE":2,"TARGET_TYPE_MESSAGE":3,"TARGET_TYPE_FIELD":4,"TARGET_TYPE_ONEOF":5,"TARGET_TYPE_ENUM":6,"TARGET_TYPE_ENUM_ENTRY":7,"TARGET_TYPE_SERVICE":8,"TARGET_TYPE_METHOD":9}},"EditionDefault":{"fields":{"edition":{"type":"Edition","id":3},"value":{"type":"string","id":2}}}}},"OneofOptions":{"edition":"proto2","fields":{"features":{"type":"FeatureSet","id":1},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]]},"EnumOptions":{"edition":"proto2","fields":{"allowAlias":{"type":"bool","id":2},"deprecated":{"type":"bool","id":3,"options":{"default":false}},"deprecatedLegacyJsonFieldConflicts":{"type":"bool","id":6,"options":{"deprecated":true}},"features":{"type":"FeatureSet","id":7},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[5,5]]},"EnumValueOptions":{"edition":"proto2","fields":{"deprecated":{"type":"bool","id":1,"options":{"default":false}},"features":{"type":"FeatureSet","id":2},"debugRedact":{"type":"bool","id":3,"options":{"default":false}},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]]},"ServiceOptions":{"edition":"proto2","fields":{"features":{"type":"FeatureSet","id":34},"deprecated":{"type":"bool","id":33,"options":{"default":false}},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]]},"MethodOptions":{"edition":"proto2","fields":{"deprecated":{"type":"bool","id":33,"options":{"default":false}},"idempotencyLevel":{"type":"IdempotencyLevel","id":34,"options":{"default":"IDEMPOTENCY_UNKNOWN"}},"features":{"type":"FeatureSet","id":35},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"nested":{"IdempotencyLevel":{"values":{"IDEMPOTENCY_UNKNOWN":0,"NO_SIDE_EFFECTS":1,"IDEMPOTENT":2}}}},"UninterpretedOption":{"edition":"proto2","fields":{"name":{"rule":"repeated","type":"NamePart","id":2},"identifierValue":{"type":"string","id":3},"positiveIntValue":{"type":"uint64","id":4},"negativeIntValue":{"type":"int64","id":5},"doubleValue":{"type":"double","id":6},"stringValue":{"type":"bytes","id":7},"aggregateValue":{"type":"string","id":8}},"nested":{"NamePart":{"fields":{"namePart":{"rule":"required","type":"string","id":1},"isExtension":{"rule":"required","type":"bool","id":2}}}}},"FeatureSet":{"edition":"proto2","fields":{"fieldPresence":{"type":"FieldPresence","id":1,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","edition_defaults.edition":"EDITION_2023","edition_defaults.value":"EXPLICIT"}},"enumType":{"type":"EnumType","id":2,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"OPEN"}},"repeatedFieldEncoding":{"type":"RepeatedFieldEncoding","id":3,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"PACKED"}},"utf8Validation":{"type":"Utf8Validation","id":4,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"VERIFY"}},"messageEncoding":{"type":"MessageEncoding","id":5,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","edition_defaults.edition":"EDITION_PROTO2","edition_defaults.value":"LENGTH_PREFIXED"}},"jsonFormat":{"type":"JsonFormat","id":6,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"ALLOW"}}},"extensions":[[1000,1000],[1001,1001],[1002,1002],[9990,9990],[9995,9999],[10000,10000]],"reserved":[[999,999]],"nested":{"FieldPresence":{"values":{"FIELD_PRESENCE_UNKNOWN":0,"EXPLICIT":1,"IMPLICIT":2,"LEGACY_REQUIRED":3}},"EnumType":{"values":{"ENUM_TYPE_UNKNOWN":0,"OPEN":1,"CLOSED":2}},"RepeatedFieldEncoding":{"values":{"REPEATED_FIELD_ENCODING_UNKNOWN":0,"PACKED":1,"EXPANDED":2}},"Utf8Validation":{"values":{"UTF8_VALIDATION_UNKNOWN":0,"VERIFY":2,"NONE":3}},"MessageEncoding":{"values":{"MESSAGE_ENCODING_UNKNOWN":0,"LENGTH_PREFIXED":1,"DELIMITED":2}},"JsonFormat":{"values":{"JSON_FORMAT_UNKNOWN":0,"ALLOW":1,"LEGACY_BEST_EFFORT":2}}}},"FeatureSetDefaults":{"edition":"proto2","fields":{"defaults":{"rule":"repeated","type":"FeatureSetEditionDefault","id":1},"minimumEdition":{"type":"Edition","id":4},"maximumEdition":{"type":"Edition","id":5}},"nested":{"FeatureSetEditionDefault":{"fields":{"edition":{"type":"Edition","id":3},"features":{"type":"FeatureSet","id":2}}}}},"SourceCodeInfo":{"edition":"proto2","fields":{"location":{"rule":"repeated","type":"Location","id":1}},"nested":{"Location":{"fields":{"path":{"rule":"repeated","type":"int32","id":1,"options":{"packed":true}},"span":{"rule":"repeated","type":"int32","id":2,"options":{"packed":true}},"leadingComments":{"type":"string","id":3},"trailingComments":{"type":"string","id":4},"leadingDetachedComments":{"rule":"repeated","type":"string","id":6}}}}},"GeneratedCodeInfo":{"edition":"proto2","fields":{"annotation":{"rule":"repeated","type":"Annotation","id":1}},"nested":{"Annotation":{"fields":{"path":{"rule":"repeated","type":"int32","id":1,"options":{"packed":true}},"sourceFile":{"type":"string","id":2},"begin":{"type":"int32","id":3},"end":{"type":"int32","id":4},"semantic":{"type":"Semantic","id":5}},"nested":{"Semantic":{"values":{"NONE":0,"SET":1,"ALIAS":2}}}}}},"Struct":{"fields":{"fields":{"keyType":"string","type":"Value","id":1}}},"Value":{"oneofs":{"kind":{"oneof":["nullValue","numberValue","stringValue","boolValue","structValue","listValue"]}},"fields":{"nullValue":{"type":"NullValue","id":1},"numberValue":{"type":"double","id":2},"stringValue":{"type":"string","id":3},"boolValue":{"type":"bool","id":4},"structValue":{"type":"Struct","id":5},"listValue":{"type":"ListValue","id":6}}},"NullValue":{"values":{"NULL_VALUE":0}},"ListValue":{"fields":{"values":{"rule":"repeated","type":"Value","id":1}}},"Any":{"fields":{"type_url":{"type":"string","id":1},"value":{"type":"bytes","id":2}}},"Timestamp":{"fields":{"seconds":{"type":"int64","id":1},"nanos":{"type":"int32","id":2}}},"Empty":{"fields":{}},"FieldMask":{"fields":{"paths":{"rule":"repeated","type":"string","id":1}}}}},"logging":{"nested":{"type":{"options":{"csharp_namespace":"Google.Cloud.Logging.Type","go_package":"google.golang.org/genproto/googleapis/logging/type;ltype","java_multiple_files":true,"java_outer_classname":"LogSeverityProto","java_package":"com.google.logging.type","php_namespace":"Google\\\\Cloud\\\\Logging\\\\Type","ruby_package":"Google::Cloud::Logging::Type","objc_class_prefix":"GLOG"},"nested":{"HttpRequest":{"fields":{"requestMethod":{"type":"string","id":1},"requestUrl":{"type":"string","id":2},"requestSize":{"type":"int64","id":3},"status":{"type":"int32","id":4},"responseSize":{"type":"int64","id":5},"userAgent":{"type":"string","id":6},"remoteIp":{"type":"string","id":7},"serverIp":{"type":"string","id":13},"referer":{"type":"string","id":8},"latency":{"type":"google.protobuf.Duration","id":14},"cacheLookup":{"type":"bool","id":11},"cacheHit":{"type":"bool","id":9},"cacheValidatedWithOriginServer":{"type":"bool","id":10},"cacheFillBytes":{"type":"int64","id":12},"protocol":{"type":"string","id":15}}},"LogSeverity":{"values":{"DEFAULT":0,"DEBUG":100,"INFO":200,"NOTICE":300,"WARNING":400,"ERROR":500,"CRITICAL":600,"ALERT":700,"EMERGENCY":800}}}},"v2":{"options":{"cc_enable_arenas":true,"csharp_namespace":"Google.Cloud.Logging.V2","go_package":"cloud.google.com/go/logging/apiv2/loggingpb;loggingpb","java_multiple_files":true,"java_outer_classname":"LoggingMetricsProto","java_package":"com.google.logging.v2","php_namespace":"Google\\\\Cloud\\\\Logging\\\\V2","ruby_package":"Google::Cloud::Logging::V2","(google.api.resource_definition).type":"logging.googleapis.com/BillingAccountLocation","(google.api.resource_definition).pattern":"billingAccounts/{billing_account}/locations/{location}"},"nested":{"LogEntry":{"options":{"(google.api.resource).type":"logging.googleapis.com/Log","(google.api.resource).pattern":"billingAccounts/{billing_account}/logs/{log}","(google.api.resource).name_field":"log_name"},"oneofs":{"payload":{"oneof":["protoPayload","textPayload","jsonPayload"]}},"fields":{"logName":{"type":"string","id":12,"options":{"(google.api.field_behavior)":"REQUIRED"}},"resource":{"type":"google.api.MonitoredResource","id":8,"options":{"(google.api.field_behavior)":"REQUIRED"}},"protoPayload":{"type":"google.protobuf.Any","id":2},"textPayload":{"type":"string","id":3},"jsonPayload":{"type":"google.protobuf.Struct","id":6},"timestamp":{"type":"google.protobuf.Timestamp","id":9,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"receiveTimestamp":{"type":"google.protobuf.Timestamp","id":24,"options":{"(google.api.field_behavior)":"OUTPUT_ONLY"}},"severity":{"type":"google.logging.type.LogSeverity","id":10,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"insertId":{"type":"string","id":4,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"httpRequest":{"type":"google.logging.type.HttpRequest","id":7,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"labels":{"keyType":"string","type":"string","id":11,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"operation":{"type":"LogEntryOperation","id":15,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"trace":{"type":"string","id":22,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"spanId":{"type":"string","id":27,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"traceSampled":{"type":"bool","id":30,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"sourceLocation":{"type":"LogEntrySourceLocation","id":23,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"split":{"type":"LogSplit","id":35,"options":{"(google.api.field_behavior)":"OPTIONAL"}}}},"LogEntryOperation":{"fields":{"id":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"producer":{"type":"string","id":2,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"first":{"type":"bool","id":3,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"last":{"type":"bool","id":4,"options":{"(google.api.field_behavior)":"OPTIONAL"}}}},"LogEntrySourceLocation":{"fields":{"file":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"line":{"type":"int64","id":2,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"function":{"type":"string","id":3,"options":{"(google.api.field_behavior)":"OPTIONAL"}}}},"LogSplit":{"fields":{"uid":{"type":"string","id":1},"index":{"type":"int32","id":2},"totalSplits":{"type":"int32","id":3}}},"LoggingServiceV2":{"options":{"(google.api.default_host)":"logging.googleapis.com","(google.api.oauth_scopes)":"https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/cloud-platform.read-only,https://www.googleapis.com/auth/logging.admin,https://www.googleapis.com/auth/logging.read,https://www.googleapis.com/auth/logging.write"},"methods":{"DeleteLog":{"requestType":"DeleteLogRequest","responseType":"google.protobuf.Empty","options":{"(google.api.http).delete":"/v2/{log_name=projects/*/logs/*}","(google.api.http).additional_bindings.delete":"/v2/{log_name=billingAccounts/*/logs/*}","(google.api.method_signature)":"log_name"},"parsedOptions":[{"(google.api.http)":{"delete":"/v2/{log_name=projects/*/logs/*}","additional_bindings":[{"delete":"/v2/{log_name=*/*/logs/*}"},{"delete":"/v2/{log_name=organizations/*/logs/*}"},{"delete":"/v2/{log_name=folders/*/logs/*}"},{"delete":"/v2/{log_name=billingAccounts/*/logs/*}"}]}},{"(google.api.method_signature)":"log_name"}]},"WriteLogEntries":{"requestType":"WriteLogEntriesRequest","responseType":"WriteLogEntriesResponse","options":{"(google.api.http).post":"/v2/entries:write","(google.api.http).body":"*","(google.api.method_signature)":"log_name,resource,labels,entries"},"parsedOptions":[{"(google.api.http)":{"post":"/v2/entries:write","body":"*"}},{"(google.api.method_signature)":"log_name,resource,labels,entries"}]},"ListLogEntries":{"requestType":"ListLogEntriesRequest","responseType":"ListLogEntriesResponse","options":{"(google.api.http).post":"/v2/entries:list","(google.api.http).body":"*","(google.api.method_signature)":"resource_names,filter,order_by"},"parsedOptions":[{"(google.api.http)":{"post":"/v2/entries:list","body":"*"}},{"(google.api.method_signature)":"resource_names,filter,order_by"}]},"ListMonitoredResourceDescriptors":{"requestType":"ListMonitoredResourceDescriptorsRequest","responseType":"ListMonitoredResourceDescriptorsResponse","options":{"(google.api.http).get":"/v2/monitoredResourceDescriptors"},"parsedOptions":[{"(google.api.http)":{"get":"/v2/monitoredResourceDescriptors"}}]},"ListLogs":{"requestType":"ListLogsRequest","responseType":"ListLogsResponse","options":{"(google.api.http).get":"/v2/{parent=*/*}/logs","(google.api.http).additional_bindings.get":"/v2/{parent=billingAccounts/*/locations/*/buckets/*/views/*}/logs","(google.api.method_signature)":"parent"},"parsedOptions":[{"(google.api.http)":{"get":"/v2/{parent=*/*}/logs","additional_bindings":[{"get":"/v2/{parent=projects/*}/logs"},{"get":"/v2/{parent=organizations/*}/logs"},{"get":"/v2/{parent=folders/*}/logs"},{"get":"/v2/{parent=billingAccounts/*}/logs"},{"get":"/v2/{parent=projects/*/locations/*/buckets/*/views/*}/logs"},{"get":"/v2/{parent=organizations/*/locations/*/buckets/*/views/*}/logs"},{"get":"/v2/{parent=folders/*/locations/*/buckets/*/views/*}/logs"},{"get":"/v2/{parent=billingAccounts/*/locations/*/buckets/*/views/*}/logs"}]}},{"(google.api.method_signature)":"parent"}]},"TailLogEntries":{"requestType":"TailLogEntriesRequest","requestStream":true,"responseType":"TailLogEntriesResponse","responseStream":true,"options":{"(google.api.http).post":"/v2/entries:tail","(google.api.http).body":"*"},"parsedOptions":[{"(google.api.http)":{"post":"/v2/entries:tail","body":"*"}}]}}},"DeleteLogRequest":{"fields":{"logName":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).type":"logging.googleapis.com/Log"}}}},"WriteLogEntriesRequest":{"fields":{"logName":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"OPTIONAL","(google.api.resource_reference).type":"logging.googleapis.com/Log"}},"resource":{"type":"google.api.MonitoredResource","id":2,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"labels":{"keyType":"string","type":"string","id":3,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"entries":{"rule":"repeated","type":"LogEntry","id":4,"options":{"(google.api.field_behavior)":"REQUIRED"}},"partialSuccess":{"type":"bool","id":5,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"dryRun":{"type":"bool","id":6,"options":{"(google.api.field_behavior)":"OPTIONAL"}}}},"WriteLogEntriesResponse":{"fields":{}},"WriteLogEntriesPartialErrors":{"fields":{"logEntryErrors":{"keyType":"int32","type":"google.rpc.Status","id":1}}},"ListLogEntriesRequest":{"fields":{"resourceNames":{"rule":"repeated","type":"string","id":8,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).child_type":"logging.googleapis.com/Log"}},"filter":{"type":"string","id":2,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"orderBy":{"type":"string","id":3,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"pageSize":{"type":"int32","id":4,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"pageToken":{"type":"string","id":5,"options":{"(google.api.field_behavior)":"OPTIONAL"}}}},"ListLogEntriesResponse":{"fields":{"entries":{"rule":"repeated","type":"LogEntry","id":1},"nextPageToken":{"type":"string","id":2}}},"ListMonitoredResourceDescriptorsRequest":{"fields":{"pageSize":{"type":"int32","id":1,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"pageToken":{"type":"string","id":2,"options":{"(google.api.field_behavior)":"OPTIONAL"}}}},"ListMonitoredResourceDescriptorsResponse":{"fields":{"resourceDescriptors":{"rule":"repeated","type":"google.api.MonitoredResourceDescriptor","id":1},"nextPageToken":{"type":"string","id":2}}},"ListLogsRequest":{"fields":{"parent":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).child_type":"logging.googleapis.com/Log"}},"resourceNames":{"rule":"repeated","type":"string","id":8,"options":{"(google.api.field_behavior)":"OPTIONAL","(google.api.resource_reference).child_type":"logging.googleapis.com/Log"}},"pageSize":{"type":"int32","id":2,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"pageToken":{"type":"string","id":3,"options":{"(google.api.field_behavior)":"OPTIONAL"}}}},"ListLogsResponse":{"fields":{"logNames":{"rule":"repeated","type":"string","id":3},"nextPageToken":{"type":"string","id":2}}},"TailLogEntriesRequest":{"fields":{"resourceNames":{"rule":"repeated","type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED"}},"filter":{"type":"string","id":2,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"bufferWindow":{"type":"google.protobuf.Duration","id":3,"options":{"(google.api.field_behavior)":"OPTIONAL"}}}},"TailLogEntriesResponse":{"fields":{"entries":{"rule":"repeated","type":"LogEntry","id":1},"suppressionInfo":{"rule":"repeated","type":"SuppressionInfo","id":2}},"nested":{"SuppressionInfo":{"fields":{"reason":{"type":"Reason","id":1},"suppressedCount":{"type":"int32","id":2}},"nested":{"Reason":{"values":{"REASON_UNSPECIFIED":0,"RATE_LIMIT":1,"NOT_CONSUMED":2}}}}}},"ConfigServiceV2":{"options":{"(google.api.default_host)":"logging.googleapis.com","(google.api.oauth_scopes)":"https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/cloud-platform.read-only,https://www.googleapis.com/auth/logging.admin,https://www.googleapis.com/auth/logging.read"},"methods":{"ListBuckets":{"requestType":"ListBucketsRequest","responseType":"ListBucketsResponse","options":{"(google.api.http).get":"/v2/{parent=*/*/locations/*}/buckets","(google.api.http).additional_bindings.get":"/v2/{parent=billingAccounts/*/locations/*}/buckets","(google.api.method_signature)":"parent"},"parsedOptions":[{"(google.api.http)":{"get":"/v2/{parent=*/*/locations/*}/buckets","additional_bindings":[{"get":"/v2/{parent=projects/*/locations/*}/buckets"},{"get":"/v2/{parent=organizations/*/locations/*}/buckets"},{"get":"/v2/{parent=folders/*/locations/*}/buckets"},{"get":"/v2/{parent=billingAccounts/*/locations/*}/buckets"}]}},{"(google.api.method_signature)":"parent"}]},"GetBucket":{"requestType":"GetBucketRequest","responseType":"LogBucket","options":{"(google.api.http).get":"/v2/{name=*/*/locations/*/buckets/*}","(google.api.http).additional_bindings.get":"/v2/{name=billingAccounts/*/locations/*/buckets/*}"},"parsedOptions":[{"(google.api.http)":{"get":"/v2/{name=*/*/locations/*/buckets/*}","additional_bindings":[{"get":"/v2/{name=projects/*/locations/*/buckets/*}"},{"get":"/v2/{name=organizations/*/locations/*/buckets/*}"},{"get":"/v2/{name=folders/*/locations/*/buckets/*}"},{"get":"/v2/{name=billingAccounts/*/locations/*/buckets/*}"}]}}]},"CreateBucketAsync":{"requestType":"CreateBucketRequest","responseType":"google.longrunning.Operation","options":{"(google.api.http).post":"/v2/{parent=*/*/locations/*}/buckets:createAsync","(google.api.http).body":"bucket","(google.api.http).additional_bindings.post":"/v2/{parent=billingAccounts/*/locations/*}/buckets:createAsync","(google.api.http).additional_bindings.body":"bucket","(google.longrunning.operation_info).response_type":"LogBucket","(google.longrunning.operation_info).metadata_type":"BucketMetadata"},"parsedOptions":[{"(google.api.http)":{"post":"/v2/{parent=*/*/locations/*}/buckets:createAsync","body":"bucket","additional_bindings":[{"post":"/v2/{parent=projects/*/locations/*}/buckets:createAsync","body":"bucket"},{"post":"/v2/{parent=organizations/*/locations/*}/buckets:createAsync","body":"bucket"},{"post":"/v2/{parent=folders/*/locations/*}/buckets:createAsync","body":"bucket"},{"post":"/v2/{parent=billingAccounts/*/locations/*}/buckets:createAsync","body":"bucket"}]}},{"(google.longrunning.operation_info)":{"response_type":"LogBucket","metadata_type":"BucketMetadata"}}]},"UpdateBucketAsync":{"requestType":"UpdateBucketRequest","responseType":"google.longrunning.Operation","options":{"(google.api.http).post":"/v2/{name=*/*/locations/*/buckets/*}:updateAsync","(google.api.http).body":"bucket","(google.api.http).additional_bindings.post":"/v2/{name=billingAccounts/*/locations/*/buckets/*}:updateAsync","(google.api.http).additional_bindings.body":"bucket","(google.longrunning.operation_info).response_type":"LogBucket","(google.longrunning.operation_info).metadata_type":"BucketMetadata"},"parsedOptions":[{"(google.api.http)":{"post":"/v2/{name=*/*/locations/*/buckets/*}:updateAsync","body":"bucket","additional_bindings":[{"post":"/v2/{name=projects/*/locations/*/buckets/*}:updateAsync","body":"bucket"},{"post":"/v2/{name=organizations/*/locations/*/buckets/*}:updateAsync","body":"bucket"},{"post":"/v2/{name=folders/*/locations/*/buckets/*}:updateAsync","body":"bucket"},{"post":"/v2/{name=billingAccounts/*/locations/*/buckets/*}:updateAsync","body":"bucket"}]}},{"(google.longrunning.operation_info)":{"response_type":"LogBucket","metadata_type":"BucketMetadata"}}]},"CreateBucket":{"requestType":"CreateBucketRequest","responseType":"LogBucket","options":{"(google.api.http).post":"/v2/{parent=*/*/locations/*}/buckets","(google.api.http).body":"bucket","(google.api.http).additional_bindings.post":"/v2/{parent=billingAccounts/*/locations/*}/buckets","(google.api.http).additional_bindings.body":"bucket"},"parsedOptions":[{"(google.api.http)":{"post":"/v2/{parent=*/*/locations/*}/buckets","body":"bucket","additional_bindings":[{"post":"/v2/{parent=projects/*/locations/*}/buckets","body":"bucket"},{"post":"/v2/{parent=organizations/*/locations/*}/buckets","body":"bucket"},{"post":"/v2/{parent=folders/*/locations/*}/buckets","body":"bucket"},{"post":"/v2/{parent=billingAccounts/*/locations/*}/buckets","body":"bucket"}]}}]},"UpdateBucket":{"requestType":"UpdateBucketRequest","responseType":"LogBucket","options":{"(google.api.http).patch":"/v2/{name=*/*/locations/*/buckets/*}","(google.api.http).body":"bucket","(google.api.http).additional_bindings.patch":"/v2/{name=billingAccounts/*/locations/*/buckets/*}","(google.api.http).additional_bindings.body":"bucket"},"parsedOptions":[{"(google.api.http)":{"patch":"/v2/{name=*/*/locations/*/buckets/*}","body":"bucket","additional_bindings":[{"patch":"/v2/{name=projects/*/locations/*/buckets/*}","body":"bucket"},{"patch":"/v2/{name=organizations/*/locations/*/buckets/*}","body":"bucket"},{"patch":"/v2/{name=folders/*/locations/*/buckets/*}","body":"bucket"},{"patch":"/v2/{name=billingAccounts/*/locations/*/buckets/*}","body":"bucket"}]}}]},"DeleteBucket":{"requestType":"DeleteBucketRequest","responseType":"google.protobuf.Empty","options":{"(google.api.http).delete":"/v2/{name=*/*/locations/*/buckets/*}","(google.api.http).additional_bindings.delete":"/v2/{name=billingAccounts/*/locations/*/buckets/*}"},"parsedOptions":[{"(google.api.http)":{"delete":"/v2/{name=*/*/locations/*/buckets/*}","additional_bindings":[{"delete":"/v2/{name=projects/*/locations/*/buckets/*}"},{"delete":"/v2/{name=organizations/*/locations/*/buckets/*}"},{"delete":"/v2/{name=folders/*/locations/*/buckets/*}"},{"delete":"/v2/{name=billingAccounts/*/locations/*/buckets/*}"}]}}]},"UndeleteBucket":{"requestType":"UndeleteBucketRequest","responseType":"google.protobuf.Empty","options":{"(google.api.http).post":"/v2/{name=*/*/locations/*/buckets/*}:undelete","(google.api.http).body":"*","(google.api.http).additional_bindings.post":"/v2/{name=billingAccounts/*/locations/*/buckets/*}:undelete","(google.api.http).additional_bindings.body":"*"},"parsedOptions":[{"(google.api.http)":{"post":"/v2/{name=*/*/locations/*/buckets/*}:undelete","body":"*","additional_bindings":[{"post":"/v2/{name=projects/*/locations/*/buckets/*}:undelete","body":"*"},{"post":"/v2/{name=organizations/*/locations/*/buckets/*}:undelete","body":"*"},{"post":"/v2/{name=folders/*/locations/*/buckets/*}:undelete","body":"*"},{"post":"/v2/{name=billingAccounts/*/locations/*/buckets/*}:undelete","body":"*"}]}}]},"ListViews":{"requestType":"ListViewsRequest","responseType":"ListViewsResponse","options":{"(google.api.http).get":"/v2/{parent=*/*/locations/*/buckets/*}/views","(google.api.http).additional_bindings.get":"/v2/{parent=billingAccounts/*/locations/*/buckets/*}/views","(google.api.method_signature)":"parent"},"parsedOptions":[{"(google.api.http)":{"get":"/v2/{parent=*/*/locations/*/buckets/*}/views","additional_bindings":[{"get":"/v2/{parent=projects/*/locations/*/buckets/*}/views"},{"get":"/v2/{parent=organizations/*/locations/*/buckets/*}/views"},{"get":"/v2/{parent=folders/*/locations/*/buckets/*}/views"},{"get":"/v2/{parent=billingAccounts/*/locations/*/buckets/*}/views"}]}},{"(google.api.method_signature)":"parent"}]},"GetView":{"requestType":"GetViewRequest","responseType":"LogView","options":{"(google.api.http).get":"/v2/{name=*/*/locations/*/buckets/*/views/*}","(google.api.http).additional_bindings.get":"/v2/{name=billingAccounts/*/locations/*/buckets/*/views/*}"},"parsedOptions":[{"(google.api.http)":{"get":"/v2/{name=*/*/locations/*/buckets/*/views/*}","additional_bindings":[{"get":"/v2/{name=projects/*/locations/*/buckets/*/views/*}"},{"get":"/v2/{name=organizations/*/locations/*/buckets/*/views/*}"},{"get":"/v2/{name=folders/*/locations/*/buckets/*/views/*}"},{"get":"/v2/{name=billingAccounts/*/locations/*/buckets/*/views/*}"}]}}]},"CreateView":{"requestType":"CreateViewRequest","responseType":"LogView","options":{"(google.api.http).post":"/v2/{parent=*/*/locations/*/buckets/*}/views","(google.api.http).body":"view","(google.api.http).additional_bindings.post":"/v2/{parent=billingAccounts/*/locations/*/buckets/*}/views","(google.api.http).additional_bindings.body":"view"},"parsedOptions":[{"(google.api.http)":{"post":"/v2/{parent=*/*/locations/*/buckets/*}/views","body":"view","additional_bindings":[{"post":"/v2/{parent=projects/*/locations/*/buckets/*}/views","body":"view"},{"post":"/v2/{parent=organizations/*/locations/*/buckets/*}/views","body":"view"},{"post":"/v2/{parent=folders/*/locations/*/buckets/*}/views","body":"view"},{"post":"/v2/{parent=billingAccounts/*/locations/*/buckets/*}/views","body":"view"}]}}]},"UpdateView":{"requestType":"UpdateViewRequest","responseType":"LogView","options":{"(google.api.http).patch":"/v2/{name=*/*/locations/*/buckets/*/views/*}","(google.api.http).body":"view","(google.api.http).additional_bindings.patch":"/v2/{name=billingAccounts/*/locations/*/buckets/*/views/*}","(google.api.http).additional_bindings.body":"view"},"parsedOptions":[{"(google.api.http)":{"patch":"/v2/{name=*/*/locations/*/buckets/*/views/*}","body":"view","additional_bindings":[{"patch":"/v2/{name=projects/*/locations/*/buckets/*/views/*}","body":"view"},{"patch":"/v2/{name=organizations/*/locations/*/buckets/*/views/*}","body":"view"},{"patch":"/v2/{name=folders/*/locations/*/buckets/*/views/*}","body":"view"},{"patch":"/v2/{name=billingAccounts/*/locations/*/buckets/*/views/*}","body":"view"}]}}]},"DeleteView":{"requestType":"DeleteViewRequest","responseType":"google.protobuf.Empty","options":{"(google.api.http).delete":"/v2/{name=*/*/locations/*/buckets/*/views/*}","(google.api.http).additional_bindings.delete":"/v2/{name=billingAccounts/*/locations/*/buckets/*/views/*}"},"parsedOptions":[{"(google.api.http)":{"delete":"/v2/{name=*/*/locations/*/buckets/*/views/*}","additional_bindings":[{"delete":"/v2/{name=projects/*/locations/*/buckets/*/views/*}"},{"delete":"/v2/{name=organizations/*/locations/*/buckets/*/views/*}"},{"delete":"/v2/{name=folders/*/locations/*/buckets/*/views/*}"},{"delete":"/v2/{name=billingAccounts/*/locations/*/buckets/*/views/*}"}]}}]},"ListSinks":{"requestType":"ListSinksRequest","responseType":"ListSinksResponse","options":{"(google.api.http).get":"/v2/{parent=*/*}/sinks","(google.api.http).additional_bindings.get":"/v2/{parent=billingAccounts/*}/sinks","(google.api.method_signature)":"parent"},"parsedOptions":[{"(google.api.http)":{"get":"/v2/{parent=*/*}/sinks","additional_bindings":[{"get":"/v2/{parent=projects/*}/sinks"},{"get":"/v2/{parent=organizations/*}/sinks"},{"get":"/v2/{parent=folders/*}/sinks"},{"get":"/v2/{parent=billingAccounts/*}/sinks"}]}},{"(google.api.method_signature)":"parent"}]},"GetSink":{"requestType":"GetSinkRequest","responseType":"LogSink","options":{"(google.api.http).get":"/v2/{sink_name=*/*/sinks/*}","(google.api.http).additional_bindings.get":"/v2/{sink_name=billingAccounts/*/sinks/*}","(google.api.method_signature)":"sink_name"},"parsedOptions":[{"(google.api.http)":{"get":"/v2/{sink_name=*/*/sinks/*}","additional_bindings":[{"get":"/v2/{sink_name=projects/*/sinks/*}"},{"get":"/v2/{sink_name=organizations/*/sinks/*}"},{"get":"/v2/{sink_name=folders/*/sinks/*}"},{"get":"/v2/{sink_name=billingAccounts/*/sinks/*}"}]}},{"(google.api.method_signature)":"sink_name"}]},"CreateSink":{"requestType":"CreateSinkRequest","responseType":"LogSink","options":{"(google.api.http).post":"/v2/{parent=*/*}/sinks","(google.api.http).body":"sink","(google.api.http).additional_bindings.post":"/v2/{parent=billingAccounts/*}/sinks","(google.api.http).additional_bindings.body":"sink","(google.api.method_signature)":"parent,sink"},"parsedOptions":[{"(google.api.http)":{"post":"/v2/{parent=*/*}/sinks","body":"sink","additional_bindings":[{"post":"/v2/{parent=projects/*}/sinks","body":"sink"},{"post":"/v2/{parent=organizations/*}/sinks","body":"sink"},{"post":"/v2/{parent=folders/*}/sinks","body":"sink"},{"post":"/v2/{parent=billingAccounts/*}/sinks","body":"sink"}]}},{"(google.api.method_signature)":"parent,sink"}]},"UpdateSink":{"requestType":"UpdateSinkRequest","responseType":"LogSink","options":{"(google.api.http).put":"/v2/{sink_name=*/*/sinks/*}","(google.api.http).body":"sink","(google.api.http).additional_bindings.put":"/v2/{sink_name=billingAccounts/*/sinks/*}","(google.api.http).additional_bindings.body":"sink","(google.api.http).additional_bindings.patch":"/v2/{sink_name=billingAccounts/*/sinks/*}","(google.api.method_signature)":"sink_name,sink"},"parsedOptions":[{"(google.api.http)":{"put":"/v2/{sink_name=*/*/sinks/*}","body":"sink","additional_bindings":[{"put":"/v2/{sink_name=projects/*/sinks/*}","body":"sink"},{"put":"/v2/{sink_name=organizations/*/sinks/*}","body":"sink"},{"put":"/v2/{sink_name=folders/*/sinks/*}","body":"sink"},{"put":"/v2/{sink_name=billingAccounts/*/sinks/*}","body":"sink"},{"patch":"/v2/{sink_name=projects/*/sinks/*}","body":"sink"},{"patch":"/v2/{sink_name=organizations/*/sinks/*}","body":"sink"},{"patch":"/v2/{sink_name=folders/*/sinks/*}","body":"sink"},{"patch":"/v2/{sink_name=billingAccounts/*/sinks/*}","body":"sink"}]}},{"(google.api.method_signature)":"sink_name,sink,update_mask"},{"(google.api.method_signature)":"sink_name,sink"}]},"DeleteSink":{"requestType":"DeleteSinkRequest","responseType":"google.protobuf.Empty","options":{"(google.api.http).delete":"/v2/{sink_name=*/*/sinks/*}","(google.api.http).additional_bindings.delete":"/v2/{sink_name=billingAccounts/*/sinks/*}","(google.api.method_signature)":"sink_name"},"parsedOptions":[{"(google.api.http)":{"delete":"/v2/{sink_name=*/*/sinks/*}","additional_bindings":[{"delete":"/v2/{sink_name=projects/*/sinks/*}"},{"delete":"/v2/{sink_name=organizations/*/sinks/*}"},{"delete":"/v2/{sink_name=folders/*/sinks/*}"},{"delete":"/v2/{sink_name=billingAccounts/*/sinks/*}"}]}},{"(google.api.method_signature)":"sink_name"}]},"CreateLink":{"requestType":"CreateLinkRequest","responseType":"google.longrunning.Operation","options":{"(google.api.http).post":"/v2/{parent=*/*/locations/*/buckets/*}/links","(google.api.http).body":"link","(google.api.http).additional_bindings.post":"/v2/{parent=billingAccounts/*/locations/*/buckets/*}/links","(google.api.http).additional_bindings.body":"link","(google.api.method_signature)":"parent,link,link_id","(google.longrunning.operation_info).response_type":"Link","(google.longrunning.operation_info).metadata_type":"LinkMetadata"},"parsedOptions":[{"(google.api.http)":{"post":"/v2/{parent=*/*/locations/*/buckets/*}/links","body":"link","additional_bindings":[{"post":"/v2/{parent=projects/*/locations/*/buckets/*}/links","body":"link"},{"post":"/v2/{parent=organizations/*/locations/*/buckets/*}/links","body":"link"},{"post":"/v2/{parent=folders/*/locations/*/buckets/*}/links","body":"link"},{"post":"/v2/{parent=billingAccounts/*/locations/*/buckets/*}/links","body":"link"}]}},{"(google.api.method_signature)":"parent,link,link_id"},{"(google.longrunning.operation_info)":{"response_type":"Link","metadata_type":"LinkMetadata"}}]},"DeleteLink":{"requestType":"DeleteLinkRequest","responseType":"google.longrunning.Operation","options":{"(google.api.http).delete":"/v2/{name=*/*/locations/*/buckets/*/links/*}","(google.api.http).additional_bindings.delete":"/v2/{name=billingAccounts/*/locations/*/buckets/*/links/*}","(google.api.method_signature)":"name","(google.longrunning.operation_info).response_type":"google.protobuf.Empty","(google.longrunning.operation_info).metadata_type":"LinkMetadata"},"parsedOptions":[{"(google.api.http)":{"delete":"/v2/{name=*/*/locations/*/buckets/*/links/*}","additional_bindings":[{"delete":"/v2/{name=projects/*/locations/*/buckets/*/links/*}"},{"delete":"/v2/{name=organizations/*/locations/*/buckets/*/links/*}"},{"delete":"/v2/{name=folders/*/locations/*/buckets/*/links/*}"},{"delete":"/v2/{name=billingAccounts/*/locations/*/buckets/*/links/*}"}]}},{"(google.api.method_signature)":"name"},{"(google.longrunning.operation_info)":{"response_type":"google.protobuf.Empty","metadata_type":"LinkMetadata"}}]},"ListLinks":{"requestType":"ListLinksRequest","responseType":"ListLinksResponse","options":{"(google.api.http).get":"/v2/{parent=*/*/locations/*/buckets/*}/links","(google.api.http).additional_bindings.get":"/v2/{parent=billingAccounts/*/locations/*/buckets/*}/links","(google.api.method_signature)":"parent"},"parsedOptions":[{"(google.api.http)":{"get":"/v2/{parent=*/*/locations/*/buckets/*}/links","additional_bindings":[{"get":"/v2/{parent=projects/*/locations/*/buckets/*}/links"},{"get":"/v2/{parent=organizations/*/locations/*/buckets/*}/links"},{"get":"/v2/{parent=folders/*/locations/*/buckets/*}/links"},{"get":"/v2/{parent=billingAccounts/*/locations/*/buckets/*}/links"}]}},{"(google.api.method_signature)":"parent"}]},"GetLink":{"requestType":"GetLinkRequest","responseType":"Link","options":{"(google.api.http).get":"/v2/{name=*/*/locations/*/buckets/*/links/*}","(google.api.http).additional_bindings.get":"/v2/{name=billingAccounts/*/locations/*/buckets/*/links/*}","(google.api.method_signature)":"name"},"parsedOptions":[{"(google.api.http)":{"get":"/v2/{name=*/*/locations/*/buckets/*/links/*}","additional_bindings":[{"get":"/v2/{name=projects/*/locations/*/buckets/*/links/*}"},{"get":"/v2/{name=organizations/*/locations/*/buckets/*/links/*}"},{"get":"/v2/{name=folders/*/locations/*/buckets/*/links/*}"},{"get":"/v2/{name=billingAccounts/*/locations/*/buckets/*/links/*}"}]}},{"(google.api.method_signature)":"name"}]},"ListExclusions":{"requestType":"ListExclusionsRequest","responseType":"ListExclusionsResponse","options":{"(google.api.http).get":"/v2/{parent=*/*}/exclusions","(google.api.http).additional_bindings.get":"/v2/{parent=billingAccounts/*}/exclusions","(google.api.method_signature)":"parent"},"parsedOptions":[{"(google.api.http)":{"get":"/v2/{parent=*/*}/exclusions","additional_bindings":[{"get":"/v2/{parent=projects/*}/exclusions"},{"get":"/v2/{parent=organizations/*}/exclusions"},{"get":"/v2/{parent=folders/*}/exclusions"},{"get":"/v2/{parent=billingAccounts/*}/exclusions"}]}},{"(google.api.method_signature)":"parent"}]},"GetExclusion":{"requestType":"GetExclusionRequest","responseType":"LogExclusion","options":{"(google.api.http).get":"/v2/{name=*/*/exclusions/*}","(google.api.http).additional_bindings.get":"/v2/{name=billingAccounts/*/exclusions/*}","(google.api.method_signature)":"name"},"parsedOptions":[{"(google.api.http)":{"get":"/v2/{name=*/*/exclusions/*}","additional_bindings":[{"get":"/v2/{name=projects/*/exclusions/*}"},{"get":"/v2/{name=organizations/*/exclusions/*}"},{"get":"/v2/{name=folders/*/exclusions/*}"},{"get":"/v2/{name=billingAccounts/*/exclusions/*}"}]}},{"(google.api.method_signature)":"name"}]},"CreateExclusion":{"requestType":"CreateExclusionRequest","responseType":"LogExclusion","options":{"(google.api.http).post":"/v2/{parent=*/*}/exclusions","(google.api.http).body":"exclusion","(google.api.http).additional_bindings.post":"/v2/{parent=billingAccounts/*}/exclusions","(google.api.http).additional_bindings.body":"exclusion","(google.api.method_signature)":"parent,exclusion"},"parsedOptions":[{"(google.api.http)":{"post":"/v2/{parent=*/*}/exclusions","body":"exclusion","additional_bindings":[{"post":"/v2/{parent=projects/*}/exclusions","body":"exclusion"},{"post":"/v2/{parent=organizations/*}/exclusions","body":"exclusion"},{"post":"/v2/{parent=folders/*}/exclusions","body":"exclusion"},{"post":"/v2/{parent=billingAccounts/*}/exclusions","body":"exclusion"}]}},{"(google.api.method_signature)":"parent,exclusion"}]},"UpdateExclusion":{"requestType":"UpdateExclusionRequest","responseType":"LogExclusion","options":{"(google.api.http).patch":"/v2/{name=*/*/exclusions/*}","(google.api.http).body":"exclusion","(google.api.http).additional_bindings.patch":"/v2/{name=billingAccounts/*/exclusions/*}","(google.api.http).additional_bindings.body":"exclusion","(google.api.method_signature)":"name,exclusion,update_mask"},"parsedOptions":[{"(google.api.http)":{"patch":"/v2/{name=*/*/exclusions/*}","body":"exclusion","additional_bindings":[{"patch":"/v2/{name=projects/*/exclusions/*}","body":"exclusion"},{"patch":"/v2/{name=organizations/*/exclusions/*}","body":"exclusion"},{"patch":"/v2/{name=folders/*/exclusions/*}","body":"exclusion"},{"patch":"/v2/{name=billingAccounts/*/exclusions/*}","body":"exclusion"}]}},{"(google.api.method_signature)":"name,exclusion,update_mask"}]},"DeleteExclusion":{"requestType":"DeleteExclusionRequest","responseType":"google.protobuf.Empty","options":{"(google.api.http).delete":"/v2/{name=*/*/exclusions/*}","(google.api.http).additional_bindings.delete":"/v2/{name=billingAccounts/*/exclusions/*}","(google.api.method_signature)":"name"},"parsedOptions":[{"(google.api.http)":{"delete":"/v2/{name=*/*/exclusions/*}","additional_bindings":[{"delete":"/v2/{name=projects/*/exclusions/*}"},{"delete":"/v2/{name=organizations/*/exclusions/*}"},{"delete":"/v2/{name=folders/*/exclusions/*}"},{"delete":"/v2/{name=billingAccounts/*/exclusions/*}"}]}},{"(google.api.method_signature)":"name"}]},"GetCmekSettings":{"requestType":"GetCmekSettingsRequest","responseType":"CmekSettings","options":{"(google.api.http).get":"/v2/{name=*/*}/cmekSettings","(google.api.http).additional_bindings.get":"/v2/{name=billingAccounts/*}/cmekSettings"},"parsedOptions":[{"(google.api.http)":{"get":"/v2/{name=*/*}/cmekSettings","additional_bindings":[{"get":"/v2/{name=projects/*}/cmekSettings"},{"get":"/v2/{name=organizations/*}/cmekSettings"},{"get":"/v2/{name=folders/*}/cmekSettings"},{"get":"/v2/{name=billingAccounts/*}/cmekSettings"}]}}]},"UpdateCmekSettings":{"requestType":"UpdateCmekSettingsRequest","responseType":"CmekSettings","options":{"(google.api.http).patch":"/v2/{name=*/*}/cmekSettings","(google.api.http).body":"cmek_settings","(google.api.http).additional_bindings.patch":"/v2/{name=organizations/*}/cmekSettings","(google.api.http).additional_bindings.body":"cmek_settings"},"parsedOptions":[{"(google.api.http)":{"patch":"/v2/{name=*/*}/cmekSettings","body":"cmek_settings","additional_bindings":{"patch":"/v2/{name=organizations/*}/cmekSettings","body":"cmek_settings"}}}]},"GetSettings":{"requestType":"GetSettingsRequest","responseType":"Settings","options":{"(google.api.http).get":"/v2/{name=*/*}/settings","(google.api.http).additional_bindings.get":"/v2/{name=billingAccounts/*}/settings","(google.api.method_signature)":"name"},"parsedOptions":[{"(google.api.http)":{"get":"/v2/{name=*/*}/settings","additional_bindings":[{"get":"/v2/{name=projects/*}/settings"},{"get":"/v2/{name=organizations/*}/settings"},{"get":"/v2/{name=folders/*}/settings"},{"get":"/v2/{name=billingAccounts/*}/settings"}]}},{"(google.api.method_signature)":"name"}]},"UpdateSettings":{"requestType":"UpdateSettingsRequest","responseType":"Settings","options":{"(google.api.http).patch":"/v2/{name=*/*}/settings","(google.api.http).body":"settings","(google.api.http).additional_bindings.patch":"/v2/{name=folders/*}/settings","(google.api.http).additional_bindings.body":"settings","(google.api.method_signature)":"settings,update_mask"},"parsedOptions":[{"(google.api.http)":{"patch":"/v2/{name=*/*}/settings","body":"settings","additional_bindings":[{"patch":"/v2/{name=organizations/*}/settings","body":"settings"},{"patch":"/v2/{name=folders/*}/settings","body":"settings"}]}},{"(google.api.method_signature)":"settings,update_mask"}]},"CopyLogEntries":{"requestType":"CopyLogEntriesRequest","responseType":"google.longrunning.Operation","options":{"(google.api.http).post":"/v2/entries:copy","(google.api.http).body":"*","(google.longrunning.operation_info).response_type":"CopyLogEntriesResponse","(google.longrunning.operation_info).metadata_type":"CopyLogEntriesMetadata"},"parsedOptions":[{"(google.api.http)":{"post":"/v2/entries:copy","body":"*"}},{"(google.longrunning.operation_info)":{"response_type":"CopyLogEntriesResponse","metadata_type":"CopyLogEntriesMetadata"}}]}}},"IndexConfig":{"fields":{"fieldPath":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED"}},"type":{"type":"IndexType","id":2,"options":{"(google.api.field_behavior)":"REQUIRED"}},"createTime":{"type":"google.protobuf.Timestamp","id":3,"options":{"(google.api.field_behavior)":"OUTPUT_ONLY"}}}},"LogBucket":{"options":{"(google.api.resource).type":"logging.googleapis.com/LogBucket","(google.api.resource).pattern":"billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}"},"fields":{"name":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"OUTPUT_ONLY"}},"description":{"type":"string","id":3},"createTime":{"type":"google.protobuf.Timestamp","id":4,"options":{"(google.api.field_behavior)":"OUTPUT_ONLY"}},"updateTime":{"type":"google.protobuf.Timestamp","id":5,"options":{"(google.api.field_behavior)":"OUTPUT_ONLY"}},"retentionDays":{"type":"int32","id":11},"locked":{"type":"bool","id":9},"lifecycleState":{"type":"LifecycleState","id":12,"options":{"(google.api.field_behavior)":"OUTPUT_ONLY"}},"analyticsEnabled":{"type":"bool","id":14},"restrictedFields":{"rule":"repeated","type":"string","id":15},"indexConfigs":{"rule":"repeated","type":"IndexConfig","id":17},"cmekSettings":{"type":"CmekSettings","id":19}}},"LogView":{"options":{"(google.api.resource).type":"logging.googleapis.com/LogView","(google.api.resource).pattern":"billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/views/{view}"},"fields":{"name":{"type":"string","id":1},"description":{"type":"string","id":3},"createTime":{"type":"google.protobuf.Timestamp","id":4,"options":{"(google.api.field_behavior)":"OUTPUT_ONLY"}},"updateTime":{"type":"google.protobuf.Timestamp","id":5,"options":{"(google.api.field_behavior)":"OUTPUT_ONLY"}},"filter":{"type":"string","id":7}}},"LogSink":{"options":{"(google.api.resource).type":"logging.googleapis.com/LogSink","(google.api.resource).pattern":"billingAccounts/{billing_account}/sinks/{sink}"},"oneofs":{"options":{"oneof":["bigqueryOptions"]}},"fields":{"name":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED"}},"destination":{"type":"string","id":3,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).type":"*"}},"filter":{"type":"string","id":5,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"description":{"type":"string","id":18,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"disabled":{"type":"bool","id":19,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"exclusions":{"rule":"repeated","type":"LogExclusion","id":16,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"outputVersionFormat":{"type":"VersionFormat","id":6,"options":{"deprecated":true}},"writerIdentity":{"type":"string","id":8,"options":{"(google.api.field_behavior)":"OUTPUT_ONLY"}},"includeChildren":{"type":"bool","id":9,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"bigqueryOptions":{"type":"BigQueryOptions","id":12,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"createTime":{"type":"google.protobuf.Timestamp","id":13,"options":{"(google.api.field_behavior)":"OUTPUT_ONLY"}},"updateTime":{"type":"google.protobuf.Timestamp","id":14,"options":{"(google.api.field_behavior)":"OUTPUT_ONLY"}}},"nested":{"VersionFormat":{"values":{"VERSION_FORMAT_UNSPECIFIED":0,"V2":1,"V1":2}}}},"BigQueryDataset":{"fields":{"datasetId":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"OUTPUT_ONLY"}}}},"Link":{"options":{"(google.api.resource).type":"logging.googleapis.com/Link","(google.api.resource).pattern":"billingAccounts/{billing_account}/locations/{location}/buckets/{bucket}/links/{link}"},"fields":{"name":{"type":"string","id":1},"description":{"type":"string","id":2},"createTime":{"type":"google.protobuf.Timestamp","id":3,"options":{"(google.api.field_behavior)":"OUTPUT_ONLY"}},"lifecycleState":{"type":"LifecycleState","id":4,"options":{"(google.api.field_behavior)":"OUTPUT_ONLY"}},"bigqueryDataset":{"type":"BigQueryDataset","id":5}}},"BigQueryOptions":{"fields":{"usePartitionedTables":{"type":"bool","id":1,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"usesTimestampColumnPartitioning":{"type":"bool","id":3,"options":{"(google.api.field_behavior)":"OUTPUT_ONLY"}}}},"ListBucketsRequest":{"fields":{"parent":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).child_type":"logging.googleapis.com/LogBucket"}},"pageToken":{"type":"string","id":2,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"pageSize":{"type":"int32","id":3,"options":{"(google.api.field_behavior)":"OPTIONAL"}}}},"ListBucketsResponse":{"fields":{"buckets":{"rule":"repeated","type":"LogBucket","id":1},"nextPageToken":{"type":"string","id":2}}},"CreateBucketRequest":{"fields":{"parent":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).child_type":"logging.googleapis.com/LogBucket"}},"bucketId":{"type":"string","id":2,"options":{"(google.api.field_behavior)":"REQUIRED"}},"bucket":{"type":"LogBucket","id":3,"options":{"(google.api.field_behavior)":"REQUIRED"}}}},"UpdateBucketRequest":{"fields":{"name":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).type":"logging.googleapis.com/LogBucket"}},"bucket":{"type":"LogBucket","id":2,"options":{"(google.api.field_behavior)":"REQUIRED"}},"updateMask":{"type":"google.protobuf.FieldMask","id":4,"options":{"(google.api.field_behavior)":"REQUIRED"}}}},"GetBucketRequest":{"fields":{"name":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).type":"logging.googleapis.com/LogBucket"}}}},"DeleteBucketRequest":{"fields":{"name":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).type":"logging.googleapis.com/LogBucket"}}}},"UndeleteBucketRequest":{"fields":{"name":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).type":"logging.googleapis.com/LogBucket"}}}},"ListViewsRequest":{"fields":{"parent":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED"}},"pageToken":{"type":"string","id":2,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"pageSize":{"type":"int32","id":3,"options":{"(google.api.field_behavior)":"OPTIONAL"}}}},"ListViewsResponse":{"fields":{"views":{"rule":"repeated","type":"LogView","id":1},"nextPageToken":{"type":"string","id":2}}},"CreateViewRequest":{"fields":{"parent":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED"}},"viewId":{"type":"string","id":2,"options":{"(google.api.field_behavior)":"REQUIRED"}},"view":{"type":"LogView","id":3,"options":{"(google.api.field_behavior)":"REQUIRED"}}}},"UpdateViewRequest":{"fields":{"name":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED"}},"view":{"type":"LogView","id":2,"options":{"(google.api.field_behavior)":"REQUIRED"}},"updateMask":{"type":"google.protobuf.FieldMask","id":4,"options":{"(google.api.field_behavior)":"OPTIONAL"}}}},"GetViewRequest":{"fields":{"name":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).type":"logging.googleapis.com/LogView"}}}},"DeleteViewRequest":{"fields":{"name":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).type":"logging.googleapis.com/LogView"}}}},"ListSinksRequest":{"fields":{"parent":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).child_type":"logging.googleapis.com/LogSink"}},"pageToken":{"type":"string","id":2,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"pageSize":{"type":"int32","id":3,"options":{"(google.api.field_behavior)":"OPTIONAL"}}}},"ListSinksResponse":{"fields":{"sinks":{"rule":"repeated","type":"LogSink","id":1},"nextPageToken":{"type":"string","id":2}}},"GetSinkRequest":{"fields":{"sinkName":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).type":"logging.googleapis.com/LogSink"}}}},"CreateSinkRequest":{"fields":{"parent":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).child_type":"logging.googleapis.com/LogSink"}},"sink":{"type":"LogSink","id":2,"options":{"(google.api.field_behavior)":"REQUIRED"}},"uniqueWriterIdentity":{"type":"bool","id":3,"options":{"(google.api.field_behavior)":"OPTIONAL"}}}},"UpdateSinkRequest":{"fields":{"sinkName":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).type":"logging.googleapis.com/LogSink"}},"sink":{"type":"LogSink","id":2,"options":{"(google.api.field_behavior)":"REQUIRED"}},"uniqueWriterIdentity":{"type":"bool","id":3,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"updateMask":{"type":"google.protobuf.FieldMask","id":4,"options":{"(google.api.field_behavior)":"OPTIONAL"}}}},"DeleteSinkRequest":{"fields":{"sinkName":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).type":"logging.googleapis.com/LogSink"}}}},"CreateLinkRequest":{"fields":{"parent":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).child_type":"logging.googleapis.com/Link"}},"link":{"type":"Link","id":2,"options":{"(google.api.field_behavior)":"REQUIRED"}},"linkId":{"type":"string","id":3,"options":{"(google.api.field_behavior)":"REQUIRED"}}}},"DeleteLinkRequest":{"fields":{"name":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).type":"logging.googleapis.com/Link"}}}},"ListLinksRequest":{"fields":{"parent":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).child_type":"logging.googleapis.com/Link"}},"pageToken":{"type":"string","id":2,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"pageSize":{"type":"int32","id":3,"options":{"(google.api.field_behavior)":"OPTIONAL"}}}},"ListLinksResponse":{"fields":{"links":{"rule":"repeated","type":"Link","id":1},"nextPageToken":{"type":"string","id":2}}},"GetLinkRequest":{"fields":{"name":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).type":"logging.googleapis.com/Link"}}}},"LogExclusion":{"options":{"(google.api.resource).type":"logging.googleapis.com/LogExclusion","(google.api.resource).pattern":"billingAccounts/{billing_account}/exclusions/{exclusion}"},"fields":{"name":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED"}},"description":{"type":"string","id":2,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"filter":{"type":"string","id":3,"options":{"(google.api.field_behavior)":"REQUIRED"}},"disabled":{"type":"bool","id":4,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"createTime":{"type":"google.protobuf.Timestamp","id":5,"options":{"(google.api.field_behavior)":"OUTPUT_ONLY"}},"updateTime":{"type":"google.protobuf.Timestamp","id":6,"options":{"(google.api.field_behavior)":"OUTPUT_ONLY"}}}},"ListExclusionsRequest":{"fields":{"parent":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).child_type":"logging.googleapis.com/LogExclusion"}},"pageToken":{"type":"string","id":2,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"pageSize":{"type":"int32","id":3,"options":{"(google.api.field_behavior)":"OPTIONAL"}}}},"ListExclusionsResponse":{"fields":{"exclusions":{"rule":"repeated","type":"LogExclusion","id":1},"nextPageToken":{"type":"string","id":2}}},"GetExclusionRequest":{"fields":{"name":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).type":"logging.googleapis.com/LogExclusion"}}}},"CreateExclusionRequest":{"fields":{"parent":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).child_type":"logging.googleapis.com/LogExclusion"}},"exclusion":{"type":"LogExclusion","id":2,"options":{"(google.api.field_behavior)":"REQUIRED"}}}},"UpdateExclusionRequest":{"fields":{"name":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).type":"logging.googleapis.com/LogExclusion"}},"exclusion":{"type":"LogExclusion","id":2,"options":{"(google.api.field_behavior)":"REQUIRED"}},"updateMask":{"type":"google.protobuf.FieldMask","id":3,"options":{"(google.api.field_behavior)":"REQUIRED"}}}},"DeleteExclusionRequest":{"fields":{"name":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).type":"logging.googleapis.com/LogExclusion"}}}},"GetCmekSettingsRequest":{"fields":{"name":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).type":"logging.googleapis.com/CmekSettings"}}}},"UpdateCmekSettingsRequest":{"fields":{"name":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED"}},"cmekSettings":{"type":"CmekSettings","id":2,"options":{"(google.api.field_behavior)":"REQUIRED"}},"updateMask":{"type":"google.protobuf.FieldMask","id":3,"options":{"(google.api.field_behavior)":"OPTIONAL"}}}},"CmekSettings":{"options":{"(google.api.resource).type":"logging.googleapis.com/CmekSettings","(google.api.resource).pattern":"billingAccounts/{billing_account}/cmekSettings"},"fields":{"name":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"OUTPUT_ONLY"}},"kmsKeyName":{"type":"string","id":2},"kmsKeyVersionName":{"type":"string","id":4},"serviceAccountId":{"type":"string","id":3,"options":{"(google.api.field_behavior)":"OUTPUT_ONLY"}}}},"GetSettingsRequest":{"fields":{"name":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).type":"logging.googleapis.com/Settings"}}}},"UpdateSettingsRequest":{"fields":{"name":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED"}},"settings":{"type":"Settings","id":2,"options":{"(google.api.field_behavior)":"REQUIRED"}},"updateMask":{"type":"google.protobuf.FieldMask","id":3,"options":{"(google.api.field_behavior)":"OPTIONAL"}}}},"Settings":{"options":{"(google.api.resource).type":"logging.googleapis.com/Settings","(google.api.resource).pattern":"billingAccounts/{billing_account}/settings"},"fields":{"name":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"OUTPUT_ONLY"}},"kmsKeyName":{"type":"string","id":2,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"kmsServiceAccountId":{"type":"string","id":3,"options":{"(google.api.field_behavior)":"OUTPUT_ONLY"}},"storageLocation":{"type":"string","id":4,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"disableDefaultSink":{"type":"bool","id":5,"options":{"(google.api.field_behavior)":"OPTIONAL"}}}},"CopyLogEntriesRequest":{"fields":{"name":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED"}},"filter":{"type":"string","id":3,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"destination":{"type":"string","id":4,"options":{"(google.api.field_behavior)":"REQUIRED"}}}},"CopyLogEntriesMetadata":{"fields":{"startTime":{"type":"google.protobuf.Timestamp","id":1},"endTime":{"type":"google.protobuf.Timestamp","id":2},"state":{"type":"OperationState","id":3},"cancellationRequested":{"type":"bool","id":4},"request":{"type":"CopyLogEntriesRequest","id":5},"progress":{"type":"int32","id":6},"writerIdentity":{"type":"string","id":7}}},"CopyLogEntriesResponse":{"fields":{"logEntriesCopiedCount":{"type":"int64","id":1}}},"BucketMetadata":{"oneofs":{"request":{"oneof":["createBucketRequest","updateBucketRequest"]}},"fields":{"startTime":{"type":"google.protobuf.Timestamp","id":1},"endTime":{"type":"google.protobuf.Timestamp","id":2},"state":{"type":"OperationState","id":3},"createBucketRequest":{"type":"CreateBucketRequest","id":4},"updateBucketRequest":{"type":"UpdateBucketRequest","id":5}}},"LinkMetadata":{"oneofs":{"request":{"oneof":["createLinkRequest","deleteLinkRequest"]}},"fields":{"startTime":{"type":"google.protobuf.Timestamp","id":1},"endTime":{"type":"google.protobuf.Timestamp","id":2},"state":{"type":"OperationState","id":3},"createLinkRequest":{"type":"CreateLinkRequest","id":4},"deleteLinkRequest":{"type":"DeleteLinkRequest","id":5}}},"OperationState":{"values":{"OPERATION_STATE_UNSPECIFIED":0,"OPERATION_STATE_SCHEDULED":1,"OPERATION_STATE_WAITING_FOR_PERMISSIONS":2,"OPERATION_STATE_RUNNING":3,"OPERATION_STATE_SUCCEEDED":4,"OPERATION_STATE_FAILED":5,"OPERATION_STATE_CANCELLED":6}},"LifecycleState":{"values":{"LIFECYCLE_STATE_UNSPECIFIED":0,"ACTIVE":1,"DELETE_REQUESTED":2,"UPDATING":3,"CREATING":4,"FAILED":5}},"IndexType":{"values":{"INDEX_TYPE_UNSPECIFIED":0,"INDEX_TYPE_STRING":1,"INDEX_TYPE_INTEGER":2}},"LocationMetadata":{"fields":{"logAnalyticsEnabled":{"type":"bool","id":1}}},"MetricsServiceV2":{"options":{"(google.api.default_host)":"logging.googleapis.com","(google.api.oauth_scopes)":"https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/cloud-platform.read-only,https://www.googleapis.com/auth/logging.admin,https://www.googleapis.com/auth/logging.read,https://www.googleapis.com/auth/logging.write"},"methods":{"ListLogMetrics":{"requestType":"ListLogMetricsRequest","responseType":"ListLogMetricsResponse","options":{"(google.api.http).get":"/v2/{parent=projects/*}/metrics","(google.api.method_signature)":"parent"},"parsedOptions":[{"(google.api.http)":{"get":"/v2/{parent=projects/*}/metrics"}},{"(google.api.method_signature)":"parent"}]},"GetLogMetric":{"requestType":"GetLogMetricRequest","responseType":"LogMetric","options":{"(google.api.http).get":"/v2/{metric_name=projects/*/metrics/*}","(google.api.method_signature)":"metric_name"},"parsedOptions":[{"(google.api.http)":{"get":"/v2/{metric_name=projects/*/metrics/*}"}},{"(google.api.method_signature)":"metric_name"}]},"CreateLogMetric":{"requestType":"CreateLogMetricRequest","responseType":"LogMetric","options":{"(google.api.http).post":"/v2/{parent=projects/*}/metrics","(google.api.http).body":"metric","(google.api.method_signature)":"parent,metric"},"parsedOptions":[{"(google.api.http)":{"post":"/v2/{parent=projects/*}/metrics","body":"metric"}},{"(google.api.method_signature)":"parent,metric"}]},"UpdateLogMetric":{"requestType":"UpdateLogMetricRequest","responseType":"LogMetric","options":{"(google.api.http).put":"/v2/{metric_name=projects/*/metrics/*}","(google.api.http).body":"metric","(google.api.method_signature)":"metric_name,metric"},"parsedOptions":[{"(google.api.http)":{"put":"/v2/{metric_name=projects/*/metrics/*}","body":"metric"}},{"(google.api.method_signature)":"metric_name,metric"}]},"DeleteLogMetric":{"requestType":"DeleteLogMetricRequest","responseType":"google.protobuf.Empty","options":{"(google.api.http).delete":"/v2/{metric_name=projects/*/metrics/*}","(google.api.method_signature)":"metric_name"},"parsedOptions":[{"(google.api.http)":{"delete":"/v2/{metric_name=projects/*/metrics/*}"}},{"(google.api.method_signature)":"metric_name"}]}}},"LogMetric":{"options":{"(google.api.resource).type":"logging.googleapis.com/LogMetric","(google.api.resource).pattern":"projects/{project}/metrics/{metric}"},"fields":{"name":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED"}},"description":{"type":"string","id":2,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"filter":{"type":"string","id":3,"options":{"(google.api.field_behavior)":"REQUIRED"}},"bucketName":{"type":"string","id":13,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"disabled":{"type":"bool","id":12,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"metricDescriptor":{"type":"google.api.MetricDescriptor","id":5,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"valueExtractor":{"type":"string","id":6,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"labelExtractors":{"keyType":"string","type":"string","id":7,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"bucketOptions":{"type":"google.api.Distribution.BucketOptions","id":8,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"createTime":{"type":"google.protobuf.Timestamp","id":9,"options":{"(google.api.field_behavior)":"OUTPUT_ONLY"}},"updateTime":{"type":"google.protobuf.Timestamp","id":10,"options":{"(google.api.field_behavior)":"OUTPUT_ONLY"}},"version":{"type":"ApiVersion","id":4,"options":{"deprecated":true}}},"nested":{"ApiVersion":{"values":{"V2":0,"V1":1}}}},"ListLogMetricsRequest":{"fields":{"parent":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).type":"cloudresourcemanager.googleapis.com/Project"}},"pageToken":{"type":"string","id":2,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"pageSize":{"type":"int32","id":3,"options":{"(google.api.field_behavior)":"OPTIONAL"}}}},"ListLogMetricsResponse":{"fields":{"metrics":{"rule":"repeated","type":"LogMetric","id":1},"nextPageToken":{"type":"string","id":2}}},"GetLogMetricRequest":{"fields":{"metricName":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).type":"logging.googleapis.com/LogMetric"}}}},"CreateLogMetricRequest":{"fields":{"parent":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).child_type":"logging.googleapis.com/LogMetric"}},"metric":{"type":"LogMetric","id":2,"options":{"(google.api.field_behavior)":"REQUIRED"}}}},"UpdateLogMetricRequest":{"fields":{"metricName":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).type":"logging.googleapis.com/LogMetric"}},"metric":{"type":"LogMetric","id":2,"options":{"(google.api.field_behavior)":"REQUIRED"}}}},"DeleteLogMetricRequest":{"fields":{"metricName":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).type":"logging.googleapis.com/LogMetric"}}}}}}}},"api":{"options":{"go_package":"google.golang.org/genproto/googleapis/api/metric;metric","java_multiple_files":true,"java_outer_classname":"MetricProto","java_package":"com.google.api","objc_class_prefix":"GAPI","cc_enable_arenas":true},"nested":{"fieldBehavior":{"rule":"repeated","type":"google.api.FieldBehavior","id":1052,"extend":"google.protobuf.FieldOptions","options":{"packed":false}},"FieldBehavior":{"values":{"FIELD_BEHAVIOR_UNSPECIFIED":0,"OPTIONAL":1,"REQUIRED":2,"OUTPUT_ONLY":3,"INPUT_ONLY":4,"IMMUTABLE":5,"UNORDERED_LIST":6,"NON_EMPTY_DEFAULT":7,"IDENTIFIER":8}},"MonitoredResourceDescriptor":{"fields":{"name":{"type":"string","id":5},"type":{"type":"string","id":1},"displayName":{"type":"string","id":2},"description":{"type":"string","id":3},"labels":{"rule":"repeated","type":"LabelDescriptor","id":4},"launchStage":{"type":"LaunchStage","id":7}}},"MonitoredResource":{"fields":{"type":{"type":"string","id":1},"labels":{"keyType":"string","type":"string","id":2}}},"MonitoredResourceMetadata":{"fields":{"systemLabels":{"type":"google.protobuf.Struct","id":1},"userLabels":{"keyType":"string","type":"string","id":2}}},"LabelDescriptor":{"fields":{"key":{"type":"string","id":1},"valueType":{"type":"ValueType","id":2},"description":{"type":"string","id":3}},"nested":{"ValueType":{"values":{"STRING":0,"BOOL":1,"INT64":2}}}},"LaunchStage":{"values":{"LAUNCH_STAGE_UNSPECIFIED":0,"UNIMPLEMENTED":6,"PRELAUNCH":7,"EARLY_ACCESS":1,"ALPHA":2,"BETA":3,"GA":4,"DEPRECATED":5}},"resourceReference":{"type":"google.api.ResourceReference","id":1055,"extend":"google.protobuf.FieldOptions"},"resourceDefinition":{"rule":"repeated","type":"google.api.ResourceDescriptor","id":1053,"extend":"google.protobuf.FileOptions"},"resource":{"type":"google.api.ResourceDescriptor","id":1053,"extend":"google.protobuf.MessageOptions"},"ResourceDescriptor":{"fields":{"type":{"type":"string","id":1},"pattern":{"rule":"repeated","type":"string","id":2},"nameField":{"type":"string","id":3},"history":{"type":"History","id":4},"plural":{"type":"string","id":5},"singular":{"type":"string","id":6},"style":{"rule":"repeated","type":"Style","id":10}},"nested":{"History":{"values":{"HISTORY_UNSPECIFIED":0,"ORIGINALLY_SINGLE_PATTERN":1,"FUTURE_MULTI_PATTERN":2}},"Style":{"values":{"STYLE_UNSPECIFIED":0,"DECLARATIVE_FRIENDLY":1}}}},"ResourceReference":{"fields":{"type":{"type":"string","id":1},"childType":{"type":"string","id":2}}},"http":{"type":"HttpRule","id":72295728,"extend":"google.protobuf.MethodOptions"},"Http":{"fields":{"rules":{"rule":"repeated","type":"HttpRule","id":1},"fullyDecodeReservedExpansion":{"type":"bool","id":2}}},"HttpRule":{"oneofs":{"pattern":{"oneof":["get","put","post","delete","patch","custom"]}},"fields":{"selector":{"type":"string","id":1},"get":{"type":"string","id":2},"put":{"type":"string","id":3},"post":{"type":"string","id":4},"delete":{"type":"string","id":5},"patch":{"type":"string","id":6},"custom":{"type":"CustomHttpPattern","id":8},"body":{"type":"string","id":7},"responseBody":{"type":"string","id":12},"additionalBindings":{"rule":"repeated","type":"HttpRule","id":11}}},"CustomHttpPattern":{"fields":{"kind":{"type":"string","id":1},"path":{"type":"string","id":2}}},"methodSignature":{"rule":"repeated","type":"string","id":1051,"extend":"google.protobuf.MethodOptions"},"defaultHost":{"type":"string","id":1049,"extend":"google.protobuf.ServiceOptions"},"oauthScopes":{"type":"string","id":1050,"extend":"google.protobuf.ServiceOptions"},"apiVersion":{"type":"string","id":525000001,"extend":"google.protobuf.ServiceOptions"},"CommonLanguageSettings":{"fields":{"referenceDocsUri":{"type":"string","id":1,"options":{"deprecated":true}},"destinations":{"rule":"repeated","type":"ClientLibraryDestination","id":2}}},"ClientLibrarySettings":{"fields":{"version":{"type":"string","id":1},"launchStage":{"type":"LaunchStage","id":2},"restNumericEnums":{"type":"bool","id":3},"javaSettings":{"type":"JavaSettings","id":21},"cppSettings":{"type":"CppSettings","id":22},"phpSettings":{"type":"PhpSettings","id":23},"pythonSettings":{"type":"PythonSettings","id":24},"nodeSettings":{"type":"NodeSettings","id":25},"dotnetSettings":{"type":"DotnetSettings","id":26},"rubySettings":{"type":"RubySettings","id":27},"goSettings":{"type":"GoSettings","id":28}}},"Publishing":{"fields":{"methodSettings":{"rule":"repeated","type":"MethodSettings","id":2},"newIssueUri":{"type":"string","id":101},"documentationUri":{"type":"string","id":102},"apiShortName":{"type":"string","id":103},"githubLabel":{"type":"string","id":104},"codeownerGithubTeams":{"rule":"repeated","type":"string","id":105},"docTagPrefix":{"type":"string","id":106},"organization":{"type":"ClientLibraryOrganization","id":107},"librarySettings":{"rule":"repeated","type":"ClientLibrarySettings","id":109},"protoReferenceDocumentationUri":{"type":"string","id":110},"restReferenceDocumentationUri":{"type":"string","id":111}}},"JavaSettings":{"fields":{"libraryPackage":{"type":"string","id":1},"serviceClassNames":{"keyType":"string","type":"string","id":2},"common":{"type":"CommonLanguageSettings","id":3}}},"CppSettings":{"fields":{"common":{"type":"CommonLanguageSettings","id":1}}},"PhpSettings":{"fields":{"common":{"type":"CommonLanguageSettings","id":1}}},"PythonSettings":{"fields":{"common":{"type":"CommonLanguageSettings","id":1}}},"NodeSettings":{"fields":{"common":{"type":"CommonLanguageSettings","id":1}}},"DotnetSettings":{"fields":{"common":{"type":"CommonLanguageSettings","id":1},"renamedServices":{"keyType":"string","type":"string","id":2},"renamedResources":{"keyType":"string","type":"string","id":3},"ignoredResources":{"rule":"repeated","type":"string","id":4},"forcedNamespaceAliases":{"rule":"repeated","type":"string","id":5},"handwrittenSignatures":{"rule":"repeated","type":"string","id":6}}},"RubySettings":{"fields":{"common":{"type":"CommonLanguageSettings","id":1}}},"GoSettings":{"fields":{"common":{"type":"CommonLanguageSettings","id":1}}},"MethodSettings":{"fields":{"selector":{"type":"string","id":1},"longRunning":{"type":"LongRunning","id":2},"autoPopulatedFields":{"rule":"repeated","type":"string","id":3}},"nested":{"LongRunning":{"fields":{"initialPollDelay":{"type":"google.protobuf.Duration","id":1},"pollDelayMultiplier":{"type":"float","id":2},"maxPollDelay":{"type":"google.protobuf.Duration","id":3},"totalPollTimeout":{"type":"google.protobuf.Duration","id":4}}}}},"ClientLibraryOrganization":{"values":{"CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED":0,"CLOUD":1,"ADS":2,"PHOTOS":3,"STREET_VIEW":4,"SHOPPING":5,"GEO":6,"GENERATIVE_AI":7}},"ClientLibraryDestination":{"values":{"CLIENT_LIBRARY_DESTINATION_UNSPECIFIED":0,"GITHUB":10,"PACKAGE_MANAGER":20}},"Distribution":{"fields":{"count":{"type":"int64","id":1},"mean":{"type":"double","id":2},"sumOfSquaredDeviation":{"type":"double","id":3},"range":{"type":"Range","id":4},"bucketOptions":{"type":"BucketOptions","id":6},"bucketCounts":{"rule":"repeated","type":"int64","id":7},"exemplars":{"rule":"repeated","type":"Exemplar","id":10}},"nested":{"Range":{"fields":{"min":{"type":"double","id":1},"max":{"type":"double","id":2}}},"BucketOptions":{"oneofs":{"options":{"oneof":["linearBuckets","exponentialBuckets","explicitBuckets"]}},"fields":{"linearBuckets":{"type":"Linear","id":1},"exponentialBuckets":{"type":"Exponential","id":2},"explicitBuckets":{"type":"Explicit","id":3}},"nested":{"Linear":{"fields":{"numFiniteBuckets":{"type":"int32","id":1},"width":{"type":"double","id":2},"offset":{"type":"double","id":3}}},"Exponential":{"fields":{"numFiniteBuckets":{"type":"int32","id":1},"growthFactor":{"type":"double","id":2},"scale":{"type":"double","id":3}}},"Explicit":{"fields":{"bounds":{"rule":"repeated","type":"double","id":1}}}}},"Exemplar":{"fields":{"value":{"type":"double","id":1},"timestamp":{"type":"google.protobuf.Timestamp","id":2},"attachments":{"rule":"repeated","type":"google.protobuf.Any","id":3}}}}},"MetricDescriptor":{"fields":{"name":{"type":"string","id":1},"type":{"type":"string","id":8},"labels":{"rule":"repeated","type":"LabelDescriptor","id":2},"metricKind":{"type":"MetricKind","id":3},"valueType":{"type":"ValueType","id":4},"unit":{"type":"string","id":5},"description":{"type":"string","id":6},"displayName":{"type":"string","id":7},"metadata":{"type":"MetricDescriptorMetadata","id":10},"launchStage":{"type":"LaunchStage","id":12},"monitoredResourceTypes":{"rule":"repeated","type":"string","id":13}},"nested":{"MetricKind":{"values":{"METRIC_KIND_UNSPECIFIED":0,"GAUGE":1,"DELTA":2,"CUMULATIVE":3}},"ValueType":{"values":{"VALUE_TYPE_UNSPECIFIED":0,"BOOL":1,"INT64":2,"DOUBLE":3,"STRING":4,"DISTRIBUTION":5,"MONEY":6}},"MetricDescriptorMetadata":{"fields":{"launchStage":{"type":"LaunchStage","id":1,"options":{"deprecated":true}},"samplePeriod":{"type":"google.protobuf.Duration","id":2},"ingestDelay":{"type":"google.protobuf.Duration","id":3}}}}},"Metric":{"fields":{"type":{"type":"string","id":3},"labels":{"keyType":"string","type":"string","id":2}}}}},"rpc":{"options":{"cc_enable_arenas":true,"go_package":"google.golang.org/genproto/googleapis/rpc/status;status","java_multiple_files":true,"java_outer_classname":"StatusProto","java_package":"com.google.rpc","objc_class_prefix":"RPC"},"nested":{"Status":{"fields":{"code":{"type":"int32","id":1},"message":{"type":"string","id":2},"details":{"rule":"repeated","type":"google.protobuf.Any","id":3}}}}},"longrunning":{"options":{"cc_enable_arenas":true,"csharp_namespace":"Google.LongRunning","go_package":"cloud.google.com/go/longrunning/autogen/longrunningpb;longrunningpb","java_multiple_files":true,"java_outer_classname":"OperationsProto","java_package":"com.google.longrunning","php_namespace":"Google\\\\LongRunning"},"nested":{"operationInfo":{"type":"google.longrunning.OperationInfo","id":1049,"extend":"google.protobuf.MethodOptions"},"Operations":{"options":{"(google.api.default_host)":"longrunning.googleapis.com"},"methods":{"ListOperations":{"requestType":"ListOperationsRequest","responseType":"ListOperationsResponse","options":{"(google.api.http).get":"/v1/{name=operations}","(google.api.method_signature)":"name,filter"},"parsedOptions":[{"(google.api.http)":{"get":"/v1/{name=operations}"}},{"(google.api.method_signature)":"name,filter"}]},"GetOperation":{"requestType":"GetOperationRequest","responseType":"Operation","options":{"(google.api.http).get":"/v1/{name=operations/**}","(google.api.method_signature)":"name"},"parsedOptions":[{"(google.api.http)":{"get":"/v1/{name=operations/**}"}},{"(google.api.method_signature)":"name"}]},"DeleteOperation":{"requestType":"DeleteOperationRequest","responseType":"google.protobuf.Empty","options":{"(google.api.http).delete":"/v1/{name=operations/**}","(google.api.method_signature)":"name"},"parsedOptions":[{"(google.api.http)":{"delete":"/v1/{name=operations/**}"}},{"(google.api.method_signature)":"name"}]},"CancelOperation":{"requestType":"CancelOperationRequest","responseType":"google.protobuf.Empty","options":{"(google.api.http).post":"/v1/{name=operations/**}:cancel","(google.api.http).body":"*","(google.api.method_signature)":"name"},"parsedOptions":[{"(google.api.http)":{"post":"/v1/{name=operations/**}:cancel","body":"*"}},{"(google.api.method_signature)":"name"}]},"WaitOperation":{"requestType":"WaitOperationRequest","responseType":"Operation"}}},"Operation":{"oneofs":{"result":{"oneof":["error","response"]}},"fields":{"name":{"type":"string","id":1},"metadata":{"type":"google.protobuf.Any","id":2},"done":{"type":"bool","id":3},"error":{"type":"google.rpc.Status","id":4},"response":{"type":"google.protobuf.Any","id":5}}},"GetOperationRequest":{"fields":{"name":{"type":"string","id":1}}},"ListOperationsRequest":{"fields":{"name":{"type":"string","id":4},"filter":{"type":"string","id":1},"pageSize":{"type":"int32","id":2},"pageToken":{"type":"string","id":3}}},"ListOperationsResponse":{"fields":{"operations":{"rule":"repeated","type":"Operation","id":1},"nextPageToken":{"type":"string","id":2}}},"CancelOperationRequest":{"fields":{"name":{"type":"string","id":1}}},"DeleteOperationRequest":{"fields":{"name":{"type":"string","id":1}}},"WaitOperationRequest":{"fields":{"name":{"type":"string","id":1},"timeout":{"type":"google.protobuf.Duration","id":2}}},"OperationInfo":{"fields":{"responseType":{"type":"string","id":1},"metadataType":{"type":"string","id":2}}}}}}}}}'); + +/***/ }), + +/***/ 61240: +/***/ ((module) => { + +"use strict"; +module.exports = /*#__PURE__*/JSON.parse('{"interfaces":{"google.logging.v2.ConfigServiceV2":{"retry_codes":{"non_idempotent":[],"idempotent":["DEADLINE_EXCEEDED","UNAVAILABLE"],"deadline_exceeded_internal_unavailable":["DEADLINE_EXCEEDED","INTERNAL","UNAVAILABLE"]},"retry_params":{"default":{"initial_retry_delay_millis":100,"retry_delay_multiplier":1.3,"max_retry_delay_millis":60000,"initial_rpc_timeout_millis":60000,"rpc_timeout_multiplier":1,"max_rpc_timeout_millis":60000,"total_timeout_millis":600000}},"methods":{"ListBuckets":{"retry_codes_name":"non_idempotent","retry_params_name":"default"},"GetBucket":{"retry_codes_name":"non_idempotent","retry_params_name":"default"},"CreateBucketAsync":{"retry_codes_name":"non_idempotent","retry_params_name":"default"},"UpdateBucketAsync":{"retry_codes_name":"non_idempotent","retry_params_name":"default"},"CreateBucket":{"retry_codes_name":"non_idempotent","retry_params_name":"default"},"UpdateBucket":{"retry_codes_name":"non_idempotent","retry_params_name":"default"},"DeleteBucket":{"retry_codes_name":"non_idempotent","retry_params_name":"default"},"UndeleteBucket":{"retry_codes_name":"non_idempotent","retry_params_name":"default"},"ListViews":{"retry_codes_name":"non_idempotent","retry_params_name":"default"},"GetView":{"retry_codes_name":"non_idempotent","retry_params_name":"default"},"CreateView":{"retry_codes_name":"non_idempotent","retry_params_name":"default"},"UpdateView":{"retry_codes_name":"non_idempotent","retry_params_name":"default"},"DeleteView":{"retry_codes_name":"non_idempotent","retry_params_name":"default"},"ListSinks":{"timeout_millis":60000,"retry_codes_name":"deadline_exceeded_internal_unavailable","retry_params_name":"default"},"GetSink":{"timeout_millis":60000,"retry_codes_name":"deadline_exceeded_internal_unavailable","retry_params_name":"default"},"CreateSink":{"timeout_millis":120000,"retry_codes_name":"non_idempotent","retry_params_name":"default"},"UpdateSink":{"timeout_millis":60000,"retry_codes_name":"deadline_exceeded_internal_unavailable","retry_params_name":"default"},"DeleteSink":{"timeout_millis":60000,"retry_codes_name":"deadline_exceeded_internal_unavailable","retry_params_name":"default"},"CreateLink":{"retry_codes_name":"non_idempotent","retry_params_name":"default"},"DeleteLink":{"retry_codes_name":"non_idempotent","retry_params_name":"default"},"ListLinks":{"retry_codes_name":"non_idempotent","retry_params_name":"default"},"GetLink":{"retry_codes_name":"non_idempotent","retry_params_name":"default"},"ListExclusions":{"timeout_millis":60000,"retry_codes_name":"deadline_exceeded_internal_unavailable","retry_params_name":"default"},"GetExclusion":{"timeout_millis":60000,"retry_codes_name":"deadline_exceeded_internal_unavailable","retry_params_name":"default"},"CreateExclusion":{"timeout_millis":120000,"retry_codes_name":"non_idempotent","retry_params_name":"default"},"UpdateExclusion":{"timeout_millis":120000,"retry_codes_name":"non_idempotent","retry_params_name":"default"},"DeleteExclusion":{"timeout_millis":60000,"retry_codes_name":"deadline_exceeded_internal_unavailable","retry_params_name":"default"},"GetCmekSettings":{"retry_codes_name":"non_idempotent","retry_params_name":"default"},"UpdateCmekSettings":{"retry_codes_name":"non_idempotent","retry_params_name":"default"},"GetSettings":{"retry_codes_name":"non_idempotent","retry_params_name":"default"},"UpdateSettings":{"retry_codes_name":"non_idempotent","retry_params_name":"default"},"CopyLogEntries":{"retry_codes_name":"non_idempotent","retry_params_name":"default"}}}}}'); + +/***/ }), + +/***/ 58921: +/***/ ((module) => { + +"use strict"; +module.exports = /*#__PURE__*/JSON.parse('{"interfaces":{"google.logging.v2.LoggingServiceV2":{"retry_codes":{"non_idempotent":[],"idempotent":["DEADLINE_EXCEEDED","UNAVAILABLE"],"deadline_exceeded_internal_unavailable":["DEADLINE_EXCEEDED","INTERNAL","UNAVAILABLE"]},"retry_params":{"default":{"initial_retry_delay_millis":100,"retry_delay_multiplier":1.3,"max_retry_delay_millis":60000,"initial_rpc_timeout_millis":60000,"rpc_timeout_multiplier":1,"max_rpc_timeout_millis":60000,"total_timeout_millis":600000}},"methods":{"DeleteLog":{"timeout_millis":60000,"retry_codes_name":"deadline_exceeded_internal_unavailable","retry_params_name":"default"},"WriteLogEntries":{"timeout_millis":60000,"retry_codes_name":"deadline_exceeded_internal_unavailable","retry_params_name":"default","bundling":{"element_count_threshold":1000,"request_byte_threshold":1048576,"delay_threshold_millis":50,"element_count_limit":1000000}},"ListLogEntries":{"timeout_millis":60000,"retry_codes_name":"deadline_exceeded_internal_unavailable","retry_params_name":"default"},"ListMonitoredResourceDescriptors":{"timeout_millis":60000,"retry_codes_name":"deadline_exceeded_internal_unavailable","retry_params_name":"default"},"ListLogs":{"timeout_millis":60000,"retry_codes_name":"deadline_exceeded_internal_unavailable","retry_params_name":"default"},"TailLogEntries":{"timeout_millis":3600000,"retry_codes_name":"deadline_exceeded_internal_unavailable","retry_params_name":"default"}}}}}'); + +/***/ }), + +/***/ 95061: +/***/ ((module) => { + +"use strict"; +module.exports = /*#__PURE__*/JSON.parse('{"interfaces":{"google.logging.v2.MetricsServiceV2":{"retry_codes":{"non_idempotent":[],"idempotent":["DEADLINE_EXCEEDED","UNAVAILABLE"],"deadline_exceeded_internal_unavailable":["DEADLINE_EXCEEDED","INTERNAL","UNAVAILABLE"]},"retry_params":{"default":{"initial_retry_delay_millis":100,"retry_delay_multiplier":1.3,"max_retry_delay_millis":60000,"initial_rpc_timeout_millis":60000,"rpc_timeout_multiplier":1,"max_rpc_timeout_millis":60000,"total_timeout_millis":600000}},"methods":{"ListLogMetrics":{"timeout_millis":60000,"retry_codes_name":"deadline_exceeded_internal_unavailable","retry_params_name":"default"},"GetLogMetric":{"timeout_millis":60000,"retry_codes_name":"deadline_exceeded_internal_unavailable","retry_params_name":"default"},"CreateLogMetric":{"timeout_millis":60000,"retry_codes_name":"non_idempotent","retry_params_name":"default"},"UpdateLogMetric":{"timeout_millis":60000,"retry_codes_name":"deadline_exceeded_internal_unavailable","retry_params_name":"default"},"DeleteLogMetric":{"timeout_millis":60000,"retry_codes_name":"deadline_exceeded_internal_unavailable","retry_params_name":"default"}}}}}'); + +/***/ }), + +/***/ 38105: +/***/ ((module) => { + +"use strict"; +module.exports = {"rE":"11.2.1"}; + +/***/ }), + +/***/ 3093: +/***/ ((module) => { + +"use strict"; +module.exports = /*#__PURE__*/JSON.parse('{"options":{"syntax":"proto3"},"nested":{"google":{"nested":{"devtools":{"nested":{"cloudtrace":{"nested":{"v2":{"options":{"csharp_namespace":"Google.Cloud.Trace.V2","go_package":"cloud.google.com/go/trace/apiv2/tracepb;tracepb","java_multiple_files":true,"java_outer_classname":"TraceProto","java_package":"com.google.devtools.cloudtrace.v2","php_namespace":"Google\\\\Cloud\\\\Trace\\\\V2","ruby_package":"Google::Cloud::Trace::V2"},"nested":{"TraceService":{"options":{"(google.api.default_host)":"cloudtrace.googleapis.com","(google.api.oauth_scopes)":"https://www.googleapis.com/auth/cloud-platform,https://www.googleapis.com/auth/trace.append"},"methods":{"BatchWriteSpans":{"requestType":"BatchWriteSpansRequest","responseType":"google.protobuf.Empty","options":{"(google.api.http).post":"/v2/{name=projects/*}/traces:batchWrite","(google.api.http).body":"*","(google.api.method_signature)":"name,spans"},"parsedOptions":[{"(google.api.http)":{"post":"/v2/{name=projects/*}/traces:batchWrite","body":"*"}},{"(google.api.method_signature)":"name,spans"}]},"CreateSpan":{"requestType":"Span","responseType":"Span","options":{"(google.api.http).post":"/v2/{name=projects/*/traces/*/spans/*}","(google.api.http).body":"*"},"parsedOptions":[{"(google.api.http)":{"post":"/v2/{name=projects/*/traces/*/spans/*}","body":"*"}}]}}},"BatchWriteSpansRequest":{"fields":{"name":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).type":"cloudresourcemanager.googleapis.com/Project"}},"spans":{"rule":"repeated","type":"Span","id":2,"options":{"(google.api.field_behavior)":"REQUIRED"}}}},"Span":{"options":{"(google.api.resource).type":"cloudtrace.googleapis.com/Span","(google.api.resource).pattern":"projects/{project}/traces/{trace}/spans/{span}"},"fields":{"name":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED"}},"spanId":{"type":"string","id":2,"options":{"(google.api.field_behavior)":"REQUIRED"}},"parentSpanId":{"type":"string","id":3},"displayName":{"type":"TruncatableString","id":4,"options":{"(google.api.field_behavior)":"REQUIRED"}},"startTime":{"type":"google.protobuf.Timestamp","id":5,"options":{"(google.api.field_behavior)":"REQUIRED"}},"endTime":{"type":"google.protobuf.Timestamp","id":6,"options":{"(google.api.field_behavior)":"REQUIRED"}},"attributes":{"type":"Attributes","id":7},"stackTrace":{"type":"StackTrace","id":8},"timeEvents":{"type":"TimeEvents","id":9},"links":{"type":"Links","id":10},"status":{"type":"google.rpc.Status","id":11,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"sameProcessAsParentSpan":{"type":"google.protobuf.BoolValue","id":12,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"childSpanCount":{"type":"google.protobuf.Int32Value","id":13,"options":{"(google.api.field_behavior)":"OPTIONAL"}},"spanKind":{"type":"SpanKind","id":14,"options":{"(google.api.field_behavior)":"OPTIONAL"}}},"nested":{"Attributes":{"fields":{"attributeMap":{"keyType":"string","type":"AttributeValue","id":1},"droppedAttributesCount":{"type":"int32","id":2}}},"TimeEvent":{"oneofs":{"value":{"oneof":["annotation","messageEvent"]}},"fields":{"time":{"type":"google.protobuf.Timestamp","id":1},"annotation":{"type":"Annotation","id":2},"messageEvent":{"type":"MessageEvent","id":3}},"nested":{"Annotation":{"fields":{"description":{"type":"TruncatableString","id":1},"attributes":{"type":"Attributes","id":2}}},"MessageEvent":{"fields":{"type":{"type":"Type","id":1},"id":{"type":"int64","id":2},"uncompressedSizeBytes":{"type":"int64","id":3},"compressedSizeBytes":{"type":"int64","id":4}},"nested":{"Type":{"values":{"TYPE_UNSPECIFIED":0,"SENT":1,"RECEIVED":2}}}}}},"TimeEvents":{"fields":{"timeEvent":{"rule":"repeated","type":"TimeEvent","id":1},"droppedAnnotationsCount":{"type":"int32","id":2},"droppedMessageEventsCount":{"type":"int32","id":3}}},"Link":{"fields":{"traceId":{"type":"string","id":1},"spanId":{"type":"string","id":2},"type":{"type":"Type","id":3},"attributes":{"type":"Attributes","id":4}},"nested":{"Type":{"values":{"TYPE_UNSPECIFIED":0,"CHILD_LINKED_SPAN":1,"PARENT_LINKED_SPAN":2}}}},"Links":{"fields":{"link":{"rule":"repeated","type":"Link","id":1},"droppedLinksCount":{"type":"int32","id":2}}},"SpanKind":{"values":{"SPAN_KIND_UNSPECIFIED":0,"INTERNAL":1,"SERVER":2,"CLIENT":3,"PRODUCER":4,"CONSUMER":5}}}},"AttributeValue":{"oneofs":{"value":{"oneof":["stringValue","intValue","boolValue"]}},"fields":{"stringValue":{"type":"TruncatableString","id":1},"intValue":{"type":"int64","id":2},"boolValue":{"type":"bool","id":3}}},"StackTrace":{"fields":{"stackFrames":{"type":"StackFrames","id":1},"stackTraceHashId":{"type":"int64","id":2}},"nested":{"StackFrame":{"fields":{"functionName":{"type":"TruncatableString","id":1},"originalFunctionName":{"type":"TruncatableString","id":2},"fileName":{"type":"TruncatableString","id":3},"lineNumber":{"type":"int64","id":4},"columnNumber":{"type":"int64","id":5},"loadModule":{"type":"Module","id":6},"sourceVersion":{"type":"TruncatableString","id":7}}},"StackFrames":{"fields":{"frame":{"rule":"repeated","type":"StackFrame","id":1},"droppedFramesCount":{"type":"int32","id":2}}}}},"Module":{"fields":{"module":{"type":"TruncatableString","id":1},"buildId":{"type":"TruncatableString","id":2}}},"TruncatableString":{"fields":{"value":{"type":"string","id":1},"truncatedByteCount":{"type":"int32","id":2}}}}}}}}},"api":{"options":{"go_package":"google.golang.org/genproto/googleapis/api/annotations;annotations","java_multiple_files":true,"java_outer_classname":"ResourceProto","java_package":"com.google.api","objc_class_prefix":"GAPI","cc_enable_arenas":true},"nested":{"http":{"type":"HttpRule","id":72295728,"extend":"google.protobuf.MethodOptions"},"Http":{"fields":{"rules":{"rule":"repeated","type":"HttpRule","id":1},"fullyDecodeReservedExpansion":{"type":"bool","id":2}}},"HttpRule":{"oneofs":{"pattern":{"oneof":["get","put","post","delete","patch","custom"]}},"fields":{"selector":{"type":"string","id":1},"get":{"type":"string","id":2},"put":{"type":"string","id":3},"post":{"type":"string","id":4},"delete":{"type":"string","id":5},"patch":{"type":"string","id":6},"custom":{"type":"CustomHttpPattern","id":8},"body":{"type":"string","id":7},"responseBody":{"type":"string","id":12},"additionalBindings":{"rule":"repeated","type":"HttpRule","id":11}}},"CustomHttpPattern":{"fields":{"kind":{"type":"string","id":1},"path":{"type":"string","id":2}}},"methodSignature":{"rule":"repeated","type":"string","id":1051,"extend":"google.protobuf.MethodOptions"},"defaultHost":{"type":"string","id":1049,"extend":"google.protobuf.ServiceOptions"},"oauthScopes":{"type":"string","id":1050,"extend":"google.protobuf.ServiceOptions"},"apiVersion":{"type":"string","id":525000001,"extend":"google.protobuf.ServiceOptions"},"CommonLanguageSettings":{"fields":{"referenceDocsUri":{"type":"string","id":1,"options":{"deprecated":true}},"destinations":{"rule":"repeated","type":"ClientLibraryDestination","id":2}}},"ClientLibrarySettings":{"fields":{"version":{"type":"string","id":1},"launchStage":{"type":"LaunchStage","id":2},"restNumericEnums":{"type":"bool","id":3},"javaSettings":{"type":"JavaSettings","id":21},"cppSettings":{"type":"CppSettings","id":22},"phpSettings":{"type":"PhpSettings","id":23},"pythonSettings":{"type":"PythonSettings","id":24},"nodeSettings":{"type":"NodeSettings","id":25},"dotnetSettings":{"type":"DotnetSettings","id":26},"rubySettings":{"type":"RubySettings","id":27},"goSettings":{"type":"GoSettings","id":28}}},"Publishing":{"fields":{"methodSettings":{"rule":"repeated","type":"MethodSettings","id":2},"newIssueUri":{"type":"string","id":101},"documentationUri":{"type":"string","id":102},"apiShortName":{"type":"string","id":103},"githubLabel":{"type":"string","id":104},"codeownerGithubTeams":{"rule":"repeated","type":"string","id":105},"docTagPrefix":{"type":"string","id":106},"organization":{"type":"ClientLibraryOrganization","id":107},"librarySettings":{"rule":"repeated","type":"ClientLibrarySettings","id":109},"protoReferenceDocumentationUri":{"type":"string","id":110},"restReferenceDocumentationUri":{"type":"string","id":111}}},"JavaSettings":{"fields":{"libraryPackage":{"type":"string","id":1},"serviceClassNames":{"keyType":"string","type":"string","id":2},"common":{"type":"CommonLanguageSettings","id":3}}},"CppSettings":{"fields":{"common":{"type":"CommonLanguageSettings","id":1}}},"PhpSettings":{"fields":{"common":{"type":"CommonLanguageSettings","id":1}}},"PythonSettings":{"fields":{"common":{"type":"CommonLanguageSettings","id":1}}},"NodeSettings":{"fields":{"common":{"type":"CommonLanguageSettings","id":1}}},"DotnetSettings":{"fields":{"common":{"type":"CommonLanguageSettings","id":1},"renamedServices":{"keyType":"string","type":"string","id":2},"renamedResources":{"keyType":"string","type":"string","id":3},"ignoredResources":{"rule":"repeated","type":"string","id":4},"forcedNamespaceAliases":{"rule":"repeated","type":"string","id":5},"handwrittenSignatures":{"rule":"repeated","type":"string","id":6}}},"RubySettings":{"fields":{"common":{"type":"CommonLanguageSettings","id":1}}},"GoSettings":{"fields":{"common":{"type":"CommonLanguageSettings","id":1}}},"MethodSettings":{"fields":{"selector":{"type":"string","id":1},"longRunning":{"type":"LongRunning","id":2},"autoPopulatedFields":{"rule":"repeated","type":"string","id":3}},"nested":{"LongRunning":{"fields":{"initialPollDelay":{"type":"google.protobuf.Duration","id":1},"pollDelayMultiplier":{"type":"float","id":2},"maxPollDelay":{"type":"google.protobuf.Duration","id":3},"totalPollTimeout":{"type":"google.protobuf.Duration","id":4}}}}},"ClientLibraryOrganization":{"values":{"CLIENT_LIBRARY_ORGANIZATION_UNSPECIFIED":0,"CLOUD":1,"ADS":2,"PHOTOS":3,"STREET_VIEW":4,"SHOPPING":5,"GEO":6,"GENERATIVE_AI":7}},"ClientLibraryDestination":{"values":{"CLIENT_LIBRARY_DESTINATION_UNSPECIFIED":0,"GITHUB":10,"PACKAGE_MANAGER":20}},"LaunchStage":{"values":{"LAUNCH_STAGE_UNSPECIFIED":0,"UNIMPLEMENTED":6,"PRELAUNCH":7,"EARLY_ACCESS":1,"ALPHA":2,"BETA":3,"GA":4,"DEPRECATED":5}},"fieldBehavior":{"rule":"repeated","type":"google.api.FieldBehavior","id":1052,"extend":"google.protobuf.FieldOptions","options":{"packed":false}},"FieldBehavior":{"values":{"FIELD_BEHAVIOR_UNSPECIFIED":0,"OPTIONAL":1,"REQUIRED":2,"OUTPUT_ONLY":3,"INPUT_ONLY":4,"IMMUTABLE":5,"UNORDERED_LIST":6,"NON_EMPTY_DEFAULT":7,"IDENTIFIER":8}},"resourceReference":{"type":"google.api.ResourceReference","id":1055,"extend":"google.protobuf.FieldOptions"},"resourceDefinition":{"rule":"repeated","type":"google.api.ResourceDescriptor","id":1053,"extend":"google.protobuf.FileOptions"},"resource":{"type":"google.api.ResourceDescriptor","id":1053,"extend":"google.protobuf.MessageOptions"},"ResourceDescriptor":{"fields":{"type":{"type":"string","id":1},"pattern":{"rule":"repeated","type":"string","id":2},"nameField":{"type":"string","id":3},"history":{"type":"History","id":4},"plural":{"type":"string","id":5},"singular":{"type":"string","id":6},"style":{"rule":"repeated","type":"Style","id":10}},"nested":{"History":{"values":{"HISTORY_UNSPECIFIED":0,"ORIGINALLY_SINGLE_PATTERN":1,"FUTURE_MULTI_PATTERN":2}},"Style":{"values":{"STYLE_UNSPECIFIED":0,"DECLARATIVE_FRIENDLY":1}}}},"ResourceReference":{"fields":{"type":{"type":"string","id":1},"childType":{"type":"string","id":2}}}}},"protobuf":{"options":{"go_package":"google.golang.org/protobuf/types/descriptorpb","java_package":"com.google.protobuf","java_outer_classname":"DescriptorProtos","csharp_namespace":"Google.Protobuf.Reflection","objc_class_prefix":"GPB","cc_enable_arenas":true,"optimize_for":"SPEED"},"nested":{"FileDescriptorSet":{"fields":{"file":{"rule":"repeated","type":"FileDescriptorProto","id":1}}},"Edition":{"values":{"EDITION_UNKNOWN":0,"EDITION_PROTO2":998,"EDITION_PROTO3":999,"EDITION_2023":1000,"EDITION_2024":1001,"EDITION_1_TEST_ONLY":1,"EDITION_2_TEST_ONLY":2,"EDITION_99997_TEST_ONLY":99997,"EDITION_99998_TEST_ONLY":99998,"EDITION_99999_TEST_ONLY":99999,"EDITION_MAX":2147483647}},"FileDescriptorProto":{"fields":{"name":{"type":"string","id":1},"package":{"type":"string","id":2},"dependency":{"rule":"repeated","type":"string","id":3},"publicDependency":{"rule":"repeated","type":"int32","id":10,"options":{"packed":false}},"weakDependency":{"rule":"repeated","type":"int32","id":11,"options":{"packed":false}},"messageType":{"rule":"repeated","type":"DescriptorProto","id":4},"enumType":{"rule":"repeated","type":"EnumDescriptorProto","id":5},"service":{"rule":"repeated","type":"ServiceDescriptorProto","id":6},"extension":{"rule":"repeated","type":"FieldDescriptorProto","id":7},"options":{"type":"FileOptions","id":8},"sourceCodeInfo":{"type":"SourceCodeInfo","id":9},"syntax":{"type":"string","id":12},"edition":{"type":"Edition","id":14}}},"DescriptorProto":{"fields":{"name":{"type":"string","id":1},"field":{"rule":"repeated","type":"FieldDescriptorProto","id":2},"extension":{"rule":"repeated","type":"FieldDescriptorProto","id":6},"nestedType":{"rule":"repeated","type":"DescriptorProto","id":3},"enumType":{"rule":"repeated","type":"EnumDescriptorProto","id":4},"extensionRange":{"rule":"repeated","type":"ExtensionRange","id":5},"oneofDecl":{"rule":"repeated","type":"OneofDescriptorProto","id":8},"options":{"type":"MessageOptions","id":7},"reservedRange":{"rule":"repeated","type":"ReservedRange","id":9},"reservedName":{"rule":"repeated","type":"string","id":10}},"nested":{"ExtensionRange":{"fields":{"start":{"type":"int32","id":1},"end":{"type":"int32","id":2},"options":{"type":"ExtensionRangeOptions","id":3}}},"ReservedRange":{"fields":{"start":{"type":"int32","id":1},"end":{"type":"int32","id":2}}}}},"ExtensionRangeOptions":{"fields":{"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999},"declaration":{"rule":"repeated","type":"Declaration","id":2,"options":{"retention":"RETENTION_SOURCE"}},"features":{"type":"FeatureSet","id":50},"verification":{"type":"VerificationState","id":3,"options":{"default":"UNVERIFIED","retention":"RETENTION_SOURCE"}}},"extensions":[[1000,536870911]],"nested":{"Declaration":{"fields":{"number":{"type":"int32","id":1},"fullName":{"type":"string","id":2},"type":{"type":"string","id":3},"reserved":{"type":"bool","id":5},"repeated":{"type":"bool","id":6}},"reserved":[[4,4]]},"VerificationState":{"values":{"DECLARATION":0,"UNVERIFIED":1}}}},"FieldDescriptorProto":{"fields":{"name":{"type":"string","id":1},"number":{"type":"int32","id":3},"label":{"type":"Label","id":4},"type":{"type":"Type","id":5},"typeName":{"type":"string","id":6},"extendee":{"type":"string","id":2},"defaultValue":{"type":"string","id":7},"oneofIndex":{"type":"int32","id":9},"jsonName":{"type":"string","id":10},"options":{"type":"FieldOptions","id":8},"proto3Optional":{"type":"bool","id":17}},"nested":{"Type":{"values":{"TYPE_DOUBLE":1,"TYPE_FLOAT":2,"TYPE_INT64":3,"TYPE_UINT64":4,"TYPE_INT32":5,"TYPE_FIXED64":6,"TYPE_FIXED32":7,"TYPE_BOOL":8,"TYPE_STRING":9,"TYPE_GROUP":10,"TYPE_MESSAGE":11,"TYPE_BYTES":12,"TYPE_UINT32":13,"TYPE_ENUM":14,"TYPE_SFIXED32":15,"TYPE_SFIXED64":16,"TYPE_SINT32":17,"TYPE_SINT64":18}},"Label":{"values":{"LABEL_OPTIONAL":1,"LABEL_REPEATED":3,"LABEL_REQUIRED":2}}}},"OneofDescriptorProto":{"fields":{"name":{"type":"string","id":1},"options":{"type":"OneofOptions","id":2}}},"EnumDescriptorProto":{"fields":{"name":{"type":"string","id":1},"value":{"rule":"repeated","type":"EnumValueDescriptorProto","id":2},"options":{"type":"EnumOptions","id":3},"reservedRange":{"rule":"repeated","type":"EnumReservedRange","id":4},"reservedName":{"rule":"repeated","type":"string","id":5}},"nested":{"EnumReservedRange":{"fields":{"start":{"type":"int32","id":1},"end":{"type":"int32","id":2}}}}},"EnumValueDescriptorProto":{"fields":{"name":{"type":"string","id":1},"number":{"type":"int32","id":2},"options":{"type":"EnumValueOptions","id":3}}},"ServiceDescriptorProto":{"fields":{"name":{"type":"string","id":1},"method":{"rule":"repeated","type":"MethodDescriptorProto","id":2},"options":{"type":"ServiceOptions","id":3}}},"MethodDescriptorProto":{"fields":{"name":{"type":"string","id":1},"inputType":{"type":"string","id":2},"outputType":{"type":"string","id":3},"options":{"type":"MethodOptions","id":4},"clientStreaming":{"type":"bool","id":5,"options":{"default":false}},"serverStreaming":{"type":"bool","id":6,"options":{"default":false}}}},"FileOptions":{"fields":{"javaPackage":{"type":"string","id":1},"javaOuterClassname":{"type":"string","id":8},"javaMultipleFiles":{"type":"bool","id":10,"options":{"default":false}},"javaGenerateEqualsAndHash":{"type":"bool","id":20,"options":{"deprecated":true}},"javaStringCheckUtf8":{"type":"bool","id":27,"options":{"default":false}},"optimizeFor":{"type":"OptimizeMode","id":9,"options":{"default":"SPEED"}},"goPackage":{"type":"string","id":11},"ccGenericServices":{"type":"bool","id":16,"options":{"default":false}},"javaGenericServices":{"type":"bool","id":17,"options":{"default":false}},"pyGenericServices":{"type":"bool","id":18,"options":{"default":false}},"deprecated":{"type":"bool","id":23,"options":{"default":false}},"ccEnableArenas":{"type":"bool","id":31,"options":{"default":true}},"objcClassPrefix":{"type":"string","id":36},"csharpNamespace":{"type":"string","id":37},"swiftPrefix":{"type":"string","id":39},"phpClassPrefix":{"type":"string","id":40},"phpNamespace":{"type":"string","id":41},"phpMetadataNamespace":{"type":"string","id":44},"rubyPackage":{"type":"string","id":45},"features":{"type":"FeatureSet","id":50},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[42,42],[38,38]],"nested":{"OptimizeMode":{"values":{"SPEED":1,"CODE_SIZE":2,"LITE_RUNTIME":3}}}},"MessageOptions":{"fields":{"messageSetWireFormat":{"type":"bool","id":1,"options":{"default":false}},"noStandardDescriptorAccessor":{"type":"bool","id":2,"options":{"default":false}},"deprecated":{"type":"bool","id":3,"options":{"default":false}},"mapEntry":{"type":"bool","id":7},"deprecatedLegacyJsonFieldConflicts":{"type":"bool","id":11,"options":{"deprecated":true}},"features":{"type":"FeatureSet","id":12},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[4,4],[5,5],[6,6],[8,8],[9,9]]},"FieldOptions":{"fields":{"ctype":{"type":"CType","id":1,"options":{"default":"STRING"}},"packed":{"type":"bool","id":2},"jstype":{"type":"JSType","id":6,"options":{"default":"JS_NORMAL"}},"lazy":{"type":"bool","id":5,"options":{"default":false}},"unverifiedLazy":{"type":"bool","id":15,"options":{"default":false}},"deprecated":{"type":"bool","id":3,"options":{"default":false}},"weak":{"type":"bool","id":10,"options":{"default":false}},"debugRedact":{"type":"bool","id":16,"options":{"default":false}},"retention":{"type":"OptionRetention","id":17},"targets":{"rule":"repeated","type":"OptionTargetType","id":19,"options":{"packed":false}},"editionDefaults":{"rule":"repeated","type":"EditionDefault","id":20},"features":{"type":"FeatureSet","id":21},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[4,4],[18,18]],"nested":{"CType":{"values":{"STRING":0,"CORD":1,"STRING_PIECE":2}},"JSType":{"values":{"JS_NORMAL":0,"JS_STRING":1,"JS_NUMBER":2}},"OptionRetention":{"values":{"RETENTION_UNKNOWN":0,"RETENTION_RUNTIME":1,"RETENTION_SOURCE":2}},"OptionTargetType":{"values":{"TARGET_TYPE_UNKNOWN":0,"TARGET_TYPE_FILE":1,"TARGET_TYPE_EXTENSION_RANGE":2,"TARGET_TYPE_MESSAGE":3,"TARGET_TYPE_FIELD":4,"TARGET_TYPE_ONEOF":5,"TARGET_TYPE_ENUM":6,"TARGET_TYPE_ENUM_ENTRY":7,"TARGET_TYPE_SERVICE":8,"TARGET_TYPE_METHOD":9}},"EditionDefault":{"fields":{"edition":{"type":"Edition","id":3},"value":{"type":"string","id":2}}}}},"OneofOptions":{"fields":{"features":{"type":"FeatureSet","id":1},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]]},"EnumOptions":{"fields":{"allowAlias":{"type":"bool","id":2},"deprecated":{"type":"bool","id":3,"options":{"default":false}},"deprecatedLegacyJsonFieldConflicts":{"type":"bool","id":6,"options":{"deprecated":true}},"features":{"type":"FeatureSet","id":7},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[5,5]]},"EnumValueOptions":{"fields":{"deprecated":{"type":"bool","id":1,"options":{"default":false}},"features":{"type":"FeatureSet","id":2},"debugRedact":{"type":"bool","id":3,"options":{"default":false}},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]]},"ServiceOptions":{"fields":{"features":{"type":"FeatureSet","id":34},"deprecated":{"type":"bool","id":33,"options":{"default":false}},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]]},"MethodOptions":{"fields":{"deprecated":{"type":"bool","id":33,"options":{"default":false}},"idempotencyLevel":{"type":"IdempotencyLevel","id":34,"options":{"default":"IDEMPOTENCY_UNKNOWN"}},"features":{"type":"FeatureSet","id":35},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"nested":{"IdempotencyLevel":{"values":{"IDEMPOTENCY_UNKNOWN":0,"NO_SIDE_EFFECTS":1,"IDEMPOTENT":2}}}},"UninterpretedOption":{"fields":{"name":{"rule":"repeated","type":"NamePart","id":2},"identifierValue":{"type":"string","id":3},"positiveIntValue":{"type":"uint64","id":4},"negativeIntValue":{"type":"int64","id":5},"doubleValue":{"type":"double","id":6},"stringValue":{"type":"bytes","id":7},"aggregateValue":{"type":"string","id":8}},"nested":{"NamePart":{"fields":{"namePart":{"rule":"required","type":"string","id":1},"isExtension":{"rule":"required","type":"bool","id":2}}}}},"FeatureSet":{"fields":{"fieldPresence":{"type":"FieldPresence","id":1,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","edition_defaults.edition":"EDITION_2023","edition_defaults.value":"EXPLICIT"}},"enumType":{"type":"EnumType","id":2,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"OPEN"}},"repeatedFieldEncoding":{"type":"RepeatedFieldEncoding","id":3,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"PACKED"}},"utf8Validation":{"type":"Utf8Validation","id":4,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"VERIFY"}},"messageEncoding":{"type":"MessageEncoding","id":5,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","edition_defaults.edition":"EDITION_PROTO2","edition_defaults.value":"LENGTH_PREFIXED"}},"jsonFormat":{"type":"JsonFormat","id":6,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"ALLOW"}}},"extensions":[[1000,1000],[1001,1001],[1002,1002],[9990,9990],[9995,9999],[10000,10000]],"reserved":[[999,999]],"nested":{"FieldPresence":{"values":{"FIELD_PRESENCE_UNKNOWN":0,"EXPLICIT":1,"IMPLICIT":2,"LEGACY_REQUIRED":3}},"EnumType":{"values":{"ENUM_TYPE_UNKNOWN":0,"OPEN":1,"CLOSED":2}},"RepeatedFieldEncoding":{"values":{"REPEATED_FIELD_ENCODING_UNKNOWN":0,"PACKED":1,"EXPANDED":2}},"Utf8Validation":{"values":{"UTF8_VALIDATION_UNKNOWN":0,"VERIFY":2,"NONE":3}},"MessageEncoding":{"values":{"MESSAGE_ENCODING_UNKNOWN":0,"LENGTH_PREFIXED":1,"DELIMITED":2}},"JsonFormat":{"values":{"JSON_FORMAT_UNKNOWN":0,"ALLOW":1,"LEGACY_BEST_EFFORT":2}}}},"FeatureSetDefaults":{"fields":{"defaults":{"rule":"repeated","type":"FeatureSetEditionDefault","id":1},"minimumEdition":{"type":"Edition","id":4},"maximumEdition":{"type":"Edition","id":5}},"nested":{"FeatureSetEditionDefault":{"fields":{"edition":{"type":"Edition","id":3},"features":{"type":"FeatureSet","id":2}}}}},"SourceCodeInfo":{"fields":{"location":{"rule":"repeated","type":"Location","id":1}},"nested":{"Location":{"fields":{"path":{"rule":"repeated","type":"int32","id":1},"span":{"rule":"repeated","type":"int32","id":2},"leadingComments":{"type":"string","id":3},"trailingComments":{"type":"string","id":4},"leadingDetachedComments":{"rule":"repeated","type":"string","id":6}}}}},"GeneratedCodeInfo":{"fields":{"annotation":{"rule":"repeated","type":"Annotation","id":1}},"nested":{"Annotation":{"fields":{"path":{"rule":"repeated","type":"int32","id":1},"sourceFile":{"type":"string","id":2},"begin":{"type":"int32","id":3},"end":{"type":"int32","id":4},"semantic":{"type":"Semantic","id":5}},"nested":{"Semantic":{"values":{"NONE":0,"SET":1,"ALIAS":2}}}}}},"Duration":{"fields":{"seconds":{"type":"int64","id":1},"nanos":{"type":"int32","id":2}}},"Timestamp":{"fields":{"seconds":{"type":"int64","id":1},"nanos":{"type":"int32","id":2}}},"DoubleValue":{"fields":{"value":{"type":"double","id":1}}},"FloatValue":{"fields":{"value":{"type":"float","id":1}}},"Int64Value":{"fields":{"value":{"type":"int64","id":1}}},"UInt64Value":{"fields":{"value":{"type":"uint64","id":1}}},"Int32Value":{"fields":{"value":{"type":"int32","id":1}}},"UInt32Value":{"fields":{"value":{"type":"uint32","id":1}}},"BoolValue":{"fields":{"value":{"type":"bool","id":1}}},"StringValue":{"fields":{"value":{"type":"string","id":1}}},"BytesValue":{"fields":{"value":{"type":"bytes","id":1}}},"Any":{"fields":{"type_url":{"type":"string","id":1},"value":{"type":"bytes","id":2}}},"Empty":{"fields":{}}}},"rpc":{"options":{"cc_enable_arenas":true,"go_package":"google.golang.org/genproto/googleapis/rpc/status;status","java_multiple_files":true,"java_outer_classname":"StatusProto","java_package":"com.google.rpc","objc_class_prefix":"RPC"},"nested":{"Status":{"fields":{"code":{"type":"int32","id":1},"message":{"type":"string","id":2},"details":{"rule":"repeated","type":"google.protobuf.Any","id":3}}}}}}}}}'); + +/***/ }), + +/***/ 9943: +/***/ ((module) => { + +"use strict"; +module.exports = {"rE":"1.14.0"}; + /***/ }), /***/ 66495: @@ -88026,6 +204647,78 @@ module.exports = /*#__PURE__*/JSON.parse('{"name":"google-auth-library","version /***/ }), +/***/ 70192: +/***/ ((module) => { + +"use strict"; +module.exports = /*#__PURE__*/JSON.parse('{"nested":{"google":{"nested":{"iam":{"nested":{"v1":{"options":{"cc_enable_arenas":true,"csharp_namespace":"Google.Cloud.Iam.V1","go_package":"google.golang.org/genproto/googleapis/iam/v1;iam","java_multiple_files":true,"java_outer_classname":"PolicyProto","java_package":"com.google.iam.v1","php_namespace":"Google\\\\Cloud\\\\Iam\\\\V1"},"nested":{"IAMPolicy":{"options":{"(google.api.default_host)":"iam-meta-api.googleapis.com"},"methods":{"SetIamPolicy":{"requestType":"SetIamPolicyRequest","responseType":"Policy","options":{"(google.api.http).post":"/v1/{resource=**}:setIamPolicy","(google.api.http).body":"*"},"parsedOptions":[{"(google.api.http)":{"post":"/v1/{resource=**}:setIamPolicy","body":"*"}}]},"GetIamPolicy":{"requestType":"GetIamPolicyRequest","responseType":"Policy","options":{"(google.api.http).post":"/v1/{resource=**}:getIamPolicy","(google.api.http).body":"*"},"parsedOptions":[{"(google.api.http)":{"post":"/v1/{resource=**}:getIamPolicy","body":"*"}}]},"TestIamPermissions":{"requestType":"TestIamPermissionsRequest","responseType":"TestIamPermissionsResponse","options":{"(google.api.http).post":"/v1/{resource=**}:testIamPermissions","(google.api.http).body":"*"},"parsedOptions":[{"(google.api.http)":{"post":"/v1/{resource=**}:testIamPermissions","body":"*"}}]}}},"SetIamPolicyRequest":{"fields":{"resource":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).type":"*"}},"policy":{"type":"Policy","id":2,"options":{"(google.api.field_behavior)":"REQUIRED"}}}},"GetIamPolicyRequest":{"fields":{"resource":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).type":"*"}},"options":{"type":"GetPolicyOptions","id":2}}},"TestIamPermissionsRequest":{"fields":{"resource":{"type":"string","id":1,"options":{"(google.api.field_behavior)":"REQUIRED","(google.api.resource_reference).type":"*"}},"permissions":{"rule":"repeated","type":"string","id":2,"options":{"(google.api.field_behavior)":"REQUIRED"}}}},"TestIamPermissionsResponse":{"fields":{"permissions":{"rule":"repeated","type":"string","id":1}}},"GetPolicyOptions":{"fields":{"requestedPolicyVersion":{"type":"int32","id":1}}},"Policy":{"fields":{"version":{"type":"int32","id":1},"bindings":{"rule":"repeated","type":"Binding","id":4},"etag":{"type":"bytes","id":3}}},"Binding":{"fields":{"role":{"type":"string","id":1},"members":{"rule":"repeated","type":"string","id":2},"condition":{"type":"google.type.Expr","id":3}}},"PolicyDelta":{"fields":{"bindingDeltas":{"rule":"repeated","type":"BindingDelta","id":1},"auditConfigDeltas":{"rule":"repeated","type":"AuditConfigDelta","id":2}}},"BindingDelta":{"fields":{"action":{"type":"Action","id":1},"role":{"type":"string","id":2},"member":{"type":"string","id":3},"condition":{"type":"google.type.Expr","id":4}},"nested":{"Action":{"values":{"ACTION_UNSPECIFIED":0,"ADD":1,"REMOVE":2}}}},"AuditConfigDelta":{"fields":{"action":{"type":"Action","id":1},"service":{"type":"string","id":2},"exemptedMember":{"type":"string","id":3},"logType":{"type":"string","id":4}},"nested":{"Action":{"values":{"ACTION_UNSPECIFIED":0,"ADD":1,"REMOVE":2}}}},"logging":{"options":{"csharp_namespace":"Google.Cloud.Iam.V1.Logging","go_package":"google.golang.org/genproto/googleapis/iam/v1/logging;logging","java_multiple_files":true,"java_outer_classname":"AuditDataProto","java_package":"com.google.iam.v1.logging"},"nested":{"AuditData":{"fields":{"policyDelta":{"type":"google.iam.v1.PolicyDelta","id":2}}}}}}}}},"api":{"options":{"go_package":"google.golang.org/genproto/googleapis/api/annotations;annotations","java_multiple_files":true,"java_outer_classname":"ResourceProto","java_package":"com.google.api","objc_class_prefix":"GAPI","cc_enable_arenas":true},"nested":{"http":{"type":"HttpRule","id":72295728,"extend":"google.protobuf.MethodOptions"},"Http":{"fields":{"rules":{"rule":"repeated","type":"HttpRule","id":1},"fullyDecodeReservedExpansion":{"type":"bool","id":2}}},"HttpRule":{"oneofs":{"pattern":{"oneof":["get","put","post","delete","patch","custom"]}},"fields":{"selector":{"type":"string","id":1},"get":{"type":"string","id":2},"put":{"type":"string","id":3},"post":{"type":"string","id":4},"delete":{"type":"string","id":5},"patch":{"type":"string","id":6},"custom":{"type":"CustomHttpPattern","id":8},"body":{"type":"string","id":7},"responseBody":{"type":"string","id":12},"additionalBindings":{"rule":"repeated","type":"HttpRule","id":11}}},"CustomHttpPattern":{"fields":{"kind":{"type":"string","id":1},"path":{"type":"string","id":2}}},"methodSignature":{"rule":"repeated","type":"string","id":1051,"extend":"google.protobuf.MethodOptions"},"defaultHost":{"type":"string","id":1049,"extend":"google.protobuf.ServiceOptions"},"oauthScopes":{"type":"string","id":1050,"extend":"google.protobuf.ServiceOptions"},"fieldBehavior":{"rule":"repeated","type":"google.api.FieldBehavior","id":1052,"extend":"google.protobuf.FieldOptions"},"FieldBehavior":{"values":{"FIELD_BEHAVIOR_UNSPECIFIED":0,"OPTIONAL":1,"REQUIRED":2,"OUTPUT_ONLY":3,"INPUT_ONLY":4,"IMMUTABLE":5}},"resourceReference":{"type":"google.api.ResourceReference","id":1055,"extend":"google.protobuf.FieldOptions"},"resourceDefinition":{"rule":"repeated","type":"google.api.ResourceDescriptor","id":1053,"extend":"google.protobuf.FileOptions"},"resource":{"type":"google.api.ResourceDescriptor","id":1053,"extend":"google.protobuf.MessageOptions"},"ResourceDescriptor":{"fields":{"type":{"type":"string","id":1},"pattern":{"rule":"repeated","type":"string","id":2},"nameField":{"type":"string","id":3},"history":{"type":"History","id":4},"plural":{"type":"string","id":5},"singular":{"type":"string","id":6}},"nested":{"History":{"values":{"HISTORY_UNSPECIFIED":0,"ORIGINALLY_SINGLE_PATTERN":1,"FUTURE_MULTI_PATTERN":2}}}},"ResourceReference":{"fields":{"type":{"type":"string","id":1},"childType":{"type":"string","id":2}}}}},"protobuf":{"options":{"go_package":"github.com/golang/protobuf/protoc-gen-go/descriptor;descriptor","java_package":"com.google.protobuf","java_outer_classname":"DescriptorProtos","csharp_namespace":"Google.Protobuf.Reflection","objc_class_prefix":"GPB","cc_enable_arenas":true,"optimize_for":"SPEED"},"nested":{"FileDescriptorSet":{"fields":{"file":{"rule":"repeated","type":"FileDescriptorProto","id":1}}},"FileDescriptorProto":{"fields":{"name":{"type":"string","id":1},"package":{"type":"string","id":2},"dependency":{"rule":"repeated","type":"string","id":3},"publicDependency":{"rule":"repeated","type":"int32","id":10,"options":{"packed":false}},"weakDependency":{"rule":"repeated","type":"int32","id":11,"options":{"packed":false}},"messageType":{"rule":"repeated","type":"DescriptorProto","id":4},"enumType":{"rule":"repeated","type":"EnumDescriptorProto","id":5},"service":{"rule":"repeated","type":"ServiceDescriptorProto","id":6},"extension":{"rule":"repeated","type":"FieldDescriptorProto","id":7},"options":{"type":"FileOptions","id":8},"sourceCodeInfo":{"type":"SourceCodeInfo","id":9},"syntax":{"type":"string","id":12}}},"DescriptorProto":{"fields":{"name":{"type":"string","id":1},"field":{"rule":"repeated","type":"FieldDescriptorProto","id":2},"extension":{"rule":"repeated","type":"FieldDescriptorProto","id":6},"nestedType":{"rule":"repeated","type":"DescriptorProto","id":3},"enumType":{"rule":"repeated","type":"EnumDescriptorProto","id":4},"extensionRange":{"rule":"repeated","type":"ExtensionRange","id":5},"oneofDecl":{"rule":"repeated","type":"OneofDescriptorProto","id":8},"options":{"type":"MessageOptions","id":7},"reservedRange":{"rule":"repeated","type":"ReservedRange","id":9},"reservedName":{"rule":"repeated","type":"string","id":10}},"nested":{"ExtensionRange":{"fields":{"start":{"type":"int32","id":1},"end":{"type":"int32","id":2},"options":{"type":"ExtensionRangeOptions","id":3}}},"ReservedRange":{"fields":{"start":{"type":"int32","id":1},"end":{"type":"int32","id":2}}}}},"ExtensionRangeOptions":{"fields":{"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]]},"FieldDescriptorProto":{"fields":{"name":{"type":"string","id":1},"number":{"type":"int32","id":3},"label":{"type":"Label","id":4},"type":{"type":"Type","id":5},"typeName":{"type":"string","id":6},"extendee":{"type":"string","id":2},"defaultValue":{"type":"string","id":7},"oneofIndex":{"type":"int32","id":9},"jsonName":{"type":"string","id":10},"options":{"type":"FieldOptions","id":8},"proto3Optional":{"type":"bool","id":17}},"nested":{"Type":{"values":{"TYPE_DOUBLE":1,"TYPE_FLOAT":2,"TYPE_INT64":3,"TYPE_UINT64":4,"TYPE_INT32":5,"TYPE_FIXED64":6,"TYPE_FIXED32":7,"TYPE_BOOL":8,"TYPE_STRING":9,"TYPE_GROUP":10,"TYPE_MESSAGE":11,"TYPE_BYTES":12,"TYPE_UINT32":13,"TYPE_ENUM":14,"TYPE_SFIXED32":15,"TYPE_SFIXED64":16,"TYPE_SINT32":17,"TYPE_SINT64":18}},"Label":{"values":{"LABEL_OPTIONAL":1,"LABEL_REQUIRED":2,"LABEL_REPEATED":3}}}},"OneofDescriptorProto":{"fields":{"name":{"type":"string","id":1},"options":{"type":"OneofOptions","id":2}}},"EnumDescriptorProto":{"fields":{"name":{"type":"string","id":1},"value":{"rule":"repeated","type":"EnumValueDescriptorProto","id":2},"options":{"type":"EnumOptions","id":3},"reservedRange":{"rule":"repeated","type":"EnumReservedRange","id":4},"reservedName":{"rule":"repeated","type":"string","id":5}},"nested":{"EnumReservedRange":{"fields":{"start":{"type":"int32","id":1},"end":{"type":"int32","id":2}}}}},"EnumValueDescriptorProto":{"fields":{"name":{"type":"string","id":1},"number":{"type":"int32","id":2},"options":{"type":"EnumValueOptions","id":3}}},"ServiceDescriptorProto":{"fields":{"name":{"type":"string","id":1},"method":{"rule":"repeated","type":"MethodDescriptorProto","id":2},"options":{"type":"ServiceOptions","id":3}}},"MethodDescriptorProto":{"fields":{"name":{"type":"string","id":1},"inputType":{"type":"string","id":2},"outputType":{"type":"string","id":3},"options":{"type":"MethodOptions","id":4},"clientStreaming":{"type":"bool","id":5,"options":{"default":false}},"serverStreaming":{"type":"bool","id":6,"options":{"default":false}}}},"FileOptions":{"fields":{"javaPackage":{"type":"string","id":1},"javaOuterClassname":{"type":"string","id":8},"javaMultipleFiles":{"type":"bool","id":10,"options":{"default":false}},"javaGenerateEqualsAndHash":{"type":"bool","id":20,"options":{"deprecated":true}},"javaStringCheckUtf8":{"type":"bool","id":27,"options":{"default":false}},"optimizeFor":{"type":"OptimizeMode","id":9,"options":{"default":"SPEED"}},"goPackage":{"type":"string","id":11},"ccGenericServices":{"type":"bool","id":16,"options":{"default":false}},"javaGenericServices":{"type":"bool","id":17,"options":{"default":false}},"pyGenericServices":{"type":"bool","id":18,"options":{"default":false}},"phpGenericServices":{"type":"bool","id":42,"options":{"default":false}},"deprecated":{"type":"bool","id":23,"options":{"default":false}},"ccEnableArenas":{"type":"bool","id":31,"options":{"default":true}},"objcClassPrefix":{"type":"string","id":36},"csharpNamespace":{"type":"string","id":37},"swiftPrefix":{"type":"string","id":39},"phpClassPrefix":{"type":"string","id":40},"phpNamespace":{"type":"string","id":41},"phpMetadataNamespace":{"type":"string","id":44},"rubyPackage":{"type":"string","id":45},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[38,38]],"nested":{"OptimizeMode":{"values":{"SPEED":1,"CODE_SIZE":2,"LITE_RUNTIME":3}}}},"MessageOptions":{"fields":{"messageSetWireFormat":{"type":"bool","id":1,"options":{"default":false}},"noStandardDescriptorAccessor":{"type":"bool","id":2,"options":{"default":false}},"deprecated":{"type":"bool","id":3,"options":{"default":false}},"mapEntry":{"type":"bool","id":7},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[8,8],[9,9]]},"FieldOptions":{"fields":{"ctype":{"type":"CType","id":1,"options":{"default":"STRING"}},"packed":{"type":"bool","id":2},"jstype":{"type":"JSType","id":6,"options":{"default":"JS_NORMAL"}},"lazy":{"type":"bool","id":5,"options":{"default":false}},"deprecated":{"type":"bool","id":3,"options":{"default":false}},"weak":{"type":"bool","id":10,"options":{"default":false}},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[4,4]],"nested":{"CType":{"values":{"STRING":0,"CORD":1,"STRING_PIECE":2}},"JSType":{"values":{"JS_NORMAL":0,"JS_STRING":1,"JS_NUMBER":2}}}},"OneofOptions":{"fields":{"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]]},"EnumOptions":{"fields":{"allowAlias":{"type":"bool","id":2},"deprecated":{"type":"bool","id":3,"options":{"default":false}},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[5,5]]},"EnumValueOptions":{"fields":{"deprecated":{"type":"bool","id":1,"options":{"default":false}},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]]},"ServiceOptions":{"fields":{"deprecated":{"type":"bool","id":33,"options":{"default":false}},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]]},"MethodOptions":{"fields":{"deprecated":{"type":"bool","id":33,"options":{"default":false}},"idempotencyLevel":{"type":"IdempotencyLevel","id":34,"options":{"default":"IDEMPOTENCY_UNKNOWN"}},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"nested":{"IdempotencyLevel":{"values":{"IDEMPOTENCY_UNKNOWN":0,"NO_SIDE_EFFECTS":1,"IDEMPOTENT":2}}}},"UninterpretedOption":{"fields":{"name":{"rule":"repeated","type":"NamePart","id":2},"identifierValue":{"type":"string","id":3},"positiveIntValue":{"type":"uint64","id":4},"negativeIntValue":{"type":"int64","id":5},"doubleValue":{"type":"double","id":6},"stringValue":{"type":"bytes","id":7},"aggregateValue":{"type":"string","id":8}},"nested":{"NamePart":{"fields":{"namePart":{"rule":"required","type":"string","id":1},"isExtension":{"rule":"required","type":"bool","id":2}}}}},"SourceCodeInfo":{"fields":{"location":{"rule":"repeated","type":"Location","id":1}},"nested":{"Location":{"fields":{"path":{"rule":"repeated","type":"int32","id":1},"span":{"rule":"repeated","type":"int32","id":2},"leadingComments":{"type":"string","id":3},"trailingComments":{"type":"string","id":4},"leadingDetachedComments":{"rule":"repeated","type":"string","id":6}}}}},"GeneratedCodeInfo":{"fields":{"annotation":{"rule":"repeated","type":"Annotation","id":1}},"nested":{"Annotation":{"fields":{"path":{"rule":"repeated","type":"int32","id":1},"sourceFile":{"type":"string","id":2},"begin":{"type":"int32","id":3},"end":{"type":"int32","id":4}}}}}}},"type":{"options":{"go_package":"google.golang.org/genproto/googleapis/type/expr;expr","java_multiple_files":true,"java_outer_classname":"ExprProto","java_package":"com.google.type","objc_class_prefix":"GTP"},"nested":{"Expr":{"fields":{"expression":{"type":"string","id":1},"title":{"type":"string","id":2},"description":{"type":"string","id":3},"location":{"type":"string","id":4}}}}}}}}}'); + +/***/ }), + +/***/ 44909: +/***/ ((module) => { + +"use strict"; +module.exports = /*#__PURE__*/JSON.parse('{"nested":{"google":{"nested":{"cloud":{"nested":{"location":{"options":{"cc_enable_arenas":true,"go_package":"google.golang.org/genproto/googleapis/cloud/location;location","java_multiple_files":true,"java_outer_classname":"LocationsProto","java_package":"com.google.cloud.location"},"nested":{"Locations":{"options":{"(google.api.default_host)":"cloud.googleapis.com","(google.api.oauth_scopes)":"https://www.googleapis.com/auth/cloud-platform"},"methods":{"ListLocations":{"requestType":"ListLocationsRequest","responseType":"ListLocationsResponse","options":{"(google.api.http).get":"/v1/{name=locations}","(google.api.http).additional_bindings.get":"/v1/{name=projects/*}/locations"},"parsedOptions":[{"(google.api.http)":{"get":"/v1/{name=locations}","additional_bindings":{"get":"/v1/{name=projects/*}/locations"}}}]},"GetLocation":{"requestType":"GetLocationRequest","responseType":"Location","options":{"(google.api.http).get":"/v1/{name=locations/*}","(google.api.http).additional_bindings.get":"/v1/{name=projects/*/locations/*}"},"parsedOptions":[{"(google.api.http)":{"get":"/v1/{name=locations/*}","additional_bindings":{"get":"/v1/{name=projects/*/locations/*}"}}}]}}},"ListLocationsRequest":{"fields":{"name":{"type":"string","id":1},"filter":{"type":"string","id":2},"pageSize":{"type":"int32","id":3},"pageToken":{"type":"string","id":4}}},"ListLocationsResponse":{"fields":{"locations":{"rule":"repeated","type":"Location","id":1},"nextPageToken":{"type":"string","id":2}}},"GetLocationRequest":{"fields":{"name":{"type":"string","id":1}}},"Location":{"fields":{"name":{"type":"string","id":1},"locationId":{"type":"string","id":4},"displayName":{"type":"string","id":5},"labels":{"keyType":"string","type":"string","id":2},"metadata":{"type":"google.protobuf.Any","id":3}}}}}}},"api":{"options":{"go_package":"google.golang.org/genproto/googleapis/api/annotations;annotations","java_multiple_files":true,"java_outer_classname":"ClientProto","java_package":"com.google.api","objc_class_prefix":"GAPI","cc_enable_arenas":true},"nested":{"http":{"type":"HttpRule","id":72295728,"extend":"google.protobuf.MethodOptions"},"Http":{"fields":{"rules":{"rule":"repeated","type":"HttpRule","id":1},"fullyDecodeReservedExpansion":{"type":"bool","id":2}}},"HttpRule":{"oneofs":{"pattern":{"oneof":["get","put","post","delete","patch","custom"]}},"fields":{"selector":{"type":"string","id":1},"get":{"type":"string","id":2},"put":{"type":"string","id":3},"post":{"type":"string","id":4},"delete":{"type":"string","id":5},"patch":{"type":"string","id":6},"custom":{"type":"CustomHttpPattern","id":8},"body":{"type":"string","id":7},"responseBody":{"type":"string","id":12},"additionalBindings":{"rule":"repeated","type":"HttpRule","id":11}}},"CustomHttpPattern":{"fields":{"kind":{"type":"string","id":1},"path":{"type":"string","id":2}}},"methodSignature":{"rule":"repeated","type":"string","id":1051,"extend":"google.protobuf.MethodOptions"},"defaultHost":{"type":"string","id":1049,"extend":"google.protobuf.ServiceOptions"},"oauthScopes":{"type":"string","id":1050,"extend":"google.protobuf.ServiceOptions"}}},"protobuf":{"options":{"go_package":"google.golang.org/protobuf/types/descriptorpb","java_package":"com.google.protobuf","java_outer_classname":"DescriptorProtos","csharp_namespace":"Google.Protobuf.Reflection","objc_class_prefix":"GPB","cc_enable_arenas":true,"optimize_for":"SPEED"},"nested":{"FileDescriptorSet":{"fields":{"file":{"rule":"repeated","type":"FileDescriptorProto","id":1}}},"FileDescriptorProto":{"fields":{"name":{"type":"string","id":1},"package":{"type":"string","id":2},"dependency":{"rule":"repeated","type":"string","id":3},"publicDependency":{"rule":"repeated","type":"int32","id":10,"options":{"packed":false}},"weakDependency":{"rule":"repeated","type":"int32","id":11,"options":{"packed":false}},"messageType":{"rule":"repeated","type":"DescriptorProto","id":4},"enumType":{"rule":"repeated","type":"EnumDescriptorProto","id":5},"service":{"rule":"repeated","type":"ServiceDescriptorProto","id":6},"extension":{"rule":"repeated","type":"FieldDescriptorProto","id":7},"options":{"type":"FileOptions","id":8},"sourceCodeInfo":{"type":"SourceCodeInfo","id":9},"syntax":{"type":"string","id":12}}},"DescriptorProto":{"fields":{"name":{"type":"string","id":1},"field":{"rule":"repeated","type":"FieldDescriptorProto","id":2},"extension":{"rule":"repeated","type":"FieldDescriptorProto","id":6},"nestedType":{"rule":"repeated","type":"DescriptorProto","id":3},"enumType":{"rule":"repeated","type":"EnumDescriptorProto","id":4},"extensionRange":{"rule":"repeated","type":"ExtensionRange","id":5},"oneofDecl":{"rule":"repeated","type":"OneofDescriptorProto","id":8},"options":{"type":"MessageOptions","id":7},"reservedRange":{"rule":"repeated","type":"ReservedRange","id":9},"reservedName":{"rule":"repeated","type":"string","id":10}},"nested":{"ExtensionRange":{"fields":{"start":{"type":"int32","id":1},"end":{"type":"int32","id":2},"options":{"type":"ExtensionRangeOptions","id":3}}},"ReservedRange":{"fields":{"start":{"type":"int32","id":1},"end":{"type":"int32","id":2}}}}},"ExtensionRangeOptions":{"fields":{"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]]},"FieldDescriptorProto":{"fields":{"name":{"type":"string","id":1},"number":{"type":"int32","id":3},"label":{"type":"Label","id":4},"type":{"type":"Type","id":5},"typeName":{"type":"string","id":6},"extendee":{"type":"string","id":2},"defaultValue":{"type":"string","id":7},"oneofIndex":{"type":"int32","id":9},"jsonName":{"type":"string","id":10},"options":{"type":"FieldOptions","id":8},"proto3Optional":{"type":"bool","id":17}},"nested":{"Type":{"values":{"TYPE_DOUBLE":1,"TYPE_FLOAT":2,"TYPE_INT64":3,"TYPE_UINT64":4,"TYPE_INT32":5,"TYPE_FIXED64":6,"TYPE_FIXED32":7,"TYPE_BOOL":8,"TYPE_STRING":9,"TYPE_GROUP":10,"TYPE_MESSAGE":11,"TYPE_BYTES":12,"TYPE_UINT32":13,"TYPE_ENUM":14,"TYPE_SFIXED32":15,"TYPE_SFIXED64":16,"TYPE_SINT32":17,"TYPE_SINT64":18}},"Label":{"values":{"LABEL_OPTIONAL":1,"LABEL_REQUIRED":2,"LABEL_REPEATED":3}}}},"OneofDescriptorProto":{"fields":{"name":{"type":"string","id":1},"options":{"type":"OneofOptions","id":2}}},"EnumDescriptorProto":{"fields":{"name":{"type":"string","id":1},"value":{"rule":"repeated","type":"EnumValueDescriptorProto","id":2},"options":{"type":"EnumOptions","id":3},"reservedRange":{"rule":"repeated","type":"EnumReservedRange","id":4},"reservedName":{"rule":"repeated","type":"string","id":5}},"nested":{"EnumReservedRange":{"fields":{"start":{"type":"int32","id":1},"end":{"type":"int32","id":2}}}}},"EnumValueDescriptorProto":{"fields":{"name":{"type":"string","id":1},"number":{"type":"int32","id":2},"options":{"type":"EnumValueOptions","id":3}}},"ServiceDescriptorProto":{"fields":{"name":{"type":"string","id":1},"method":{"rule":"repeated","type":"MethodDescriptorProto","id":2},"options":{"type":"ServiceOptions","id":3}}},"MethodDescriptorProto":{"fields":{"name":{"type":"string","id":1},"inputType":{"type":"string","id":2},"outputType":{"type":"string","id":3},"options":{"type":"MethodOptions","id":4},"clientStreaming":{"type":"bool","id":5,"options":{"default":false}},"serverStreaming":{"type":"bool","id":6,"options":{"default":false}}}},"FileOptions":{"fields":{"javaPackage":{"type":"string","id":1},"javaOuterClassname":{"type":"string","id":8},"javaMultipleFiles":{"type":"bool","id":10,"options":{"default":false}},"javaGenerateEqualsAndHash":{"type":"bool","id":20,"options":{"deprecated":true}},"javaStringCheckUtf8":{"type":"bool","id":27,"options":{"default":false}},"optimizeFor":{"type":"OptimizeMode","id":9,"options":{"default":"SPEED"}},"goPackage":{"type":"string","id":11},"ccGenericServices":{"type":"bool","id":16,"options":{"default":false}},"javaGenericServices":{"type":"bool","id":17,"options":{"default":false}},"pyGenericServices":{"type":"bool","id":18,"options":{"default":false}},"phpGenericServices":{"type":"bool","id":42,"options":{"default":false}},"deprecated":{"type":"bool","id":23,"options":{"default":false}},"ccEnableArenas":{"type":"bool","id":31,"options":{"default":true}},"objcClassPrefix":{"type":"string","id":36},"csharpNamespace":{"type":"string","id":37},"swiftPrefix":{"type":"string","id":39},"phpClassPrefix":{"type":"string","id":40},"phpNamespace":{"type":"string","id":41},"phpMetadataNamespace":{"type":"string","id":44},"rubyPackage":{"type":"string","id":45},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[38,38]],"nested":{"OptimizeMode":{"values":{"SPEED":1,"CODE_SIZE":2,"LITE_RUNTIME":3}}}},"MessageOptions":{"fields":{"messageSetWireFormat":{"type":"bool","id":1,"options":{"default":false}},"noStandardDescriptorAccessor":{"type":"bool","id":2,"options":{"default":false}},"deprecated":{"type":"bool","id":3,"options":{"default":false}},"mapEntry":{"type":"bool","id":7},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[8,8],[9,9]]},"FieldOptions":{"fields":{"ctype":{"type":"CType","id":1,"options":{"default":"STRING"}},"packed":{"type":"bool","id":2},"jstype":{"type":"JSType","id":6,"options":{"default":"JS_NORMAL"}},"lazy":{"type":"bool","id":5,"options":{"default":false}},"deprecated":{"type":"bool","id":3,"options":{"default":false}},"weak":{"type":"bool","id":10,"options":{"default":false}},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[4,4]],"nested":{"CType":{"values":{"STRING":0,"CORD":1,"STRING_PIECE":2}},"JSType":{"values":{"JS_NORMAL":0,"JS_STRING":1,"JS_NUMBER":2}}}},"OneofOptions":{"fields":{"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]]},"EnumOptions":{"fields":{"allowAlias":{"type":"bool","id":2},"deprecated":{"type":"bool","id":3,"options":{"default":false}},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[5,5]]},"EnumValueOptions":{"fields":{"deprecated":{"type":"bool","id":1,"options":{"default":false}},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]]},"ServiceOptions":{"fields":{"deprecated":{"type":"bool","id":33,"options":{"default":false}},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]]},"MethodOptions":{"fields":{"deprecated":{"type":"bool","id":33,"options":{"default":false}},"idempotencyLevel":{"type":"IdempotencyLevel","id":34,"options":{"default":"IDEMPOTENCY_UNKNOWN"}},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"nested":{"IdempotencyLevel":{"values":{"IDEMPOTENCY_UNKNOWN":0,"NO_SIDE_EFFECTS":1,"IDEMPOTENT":2}}}},"UninterpretedOption":{"fields":{"name":{"rule":"repeated","type":"NamePart","id":2},"identifierValue":{"type":"string","id":3},"positiveIntValue":{"type":"uint64","id":4},"negativeIntValue":{"type":"int64","id":5},"doubleValue":{"type":"double","id":6},"stringValue":{"type":"bytes","id":7},"aggregateValue":{"type":"string","id":8}},"nested":{"NamePart":{"fields":{"namePart":{"rule":"required","type":"string","id":1},"isExtension":{"rule":"required","type":"bool","id":2}}}}},"SourceCodeInfo":{"fields":{"location":{"rule":"repeated","type":"Location","id":1}},"nested":{"Location":{"fields":{"path":{"rule":"repeated","type":"int32","id":1},"span":{"rule":"repeated","type":"int32","id":2},"leadingComments":{"type":"string","id":3},"trailingComments":{"type":"string","id":4},"leadingDetachedComments":{"rule":"repeated","type":"string","id":6}}}}},"GeneratedCodeInfo":{"fields":{"annotation":{"rule":"repeated","type":"Annotation","id":1}},"nested":{"Annotation":{"fields":{"path":{"rule":"repeated","type":"int32","id":1},"sourceFile":{"type":"string","id":2},"begin":{"type":"int32","id":3},"end":{"type":"int32","id":4}}}}},"Any":{"fields":{"type_url":{"type":"string","id":1},"value":{"type":"bytes","id":2}}}}}}}}}'); + +/***/ }), + +/***/ 9961: +/***/ ((module) => { + +"use strict"; +module.exports = /*#__PURE__*/JSON.parse('{"nested":{"google":{"nested":{"longrunning":{"options":{"cc_enable_arenas":true,"csharp_namespace":"Google.LongRunning","go_package":"google.golang.org/genproto/googleapis/longrunning;longrunning","java_multiple_files":true,"java_outer_classname":"OperationsProto","java_package":"com.google.longrunning","php_namespace":"Google\\\\LongRunning"},"nested":{"operationInfo":{"type":"google.longrunning.OperationInfo","id":1049,"extend":"google.protobuf.MethodOptions"},"Operations":{"options":{"(google.api.default_host)":"longrunning.googleapis.com"},"methods":{"ListOperations":{"requestType":"ListOperationsRequest","responseType":"ListOperationsResponse","options":{"(google.api.http).get":"/v1/{name=operations}","(google.api.method_signature)":"name,filter"},"parsedOptions":[{"(google.api.http)":{"get":"/v1/{name=operations}"}},{"(google.api.method_signature)":"name,filter"}]},"GetOperation":{"requestType":"GetOperationRequest","responseType":"Operation","options":{"(google.api.http).get":"/v1/operations/{name}","(google.api.method_signature)":"name"},"parsedOptions":[{"(google.api.http)":{"get":"/v1/operations/{name}"}},{"(google.api.method_signature)":"name"}]},"DeleteOperation":{"requestType":"DeleteOperationRequest","responseType":"google.protobuf.Empty","options":{"(google.api.http).delete":"/v1/{name=operations/**}","(google.api.method_signature)":"name"},"parsedOptions":[{"(google.api.http)":{"delete":"/v1/{name=operations/**}"}},{"(google.api.method_signature)":"name"}]},"CancelOperation":{"requestType":"CancelOperationRequest","responseType":"google.protobuf.Empty","options":{"(google.api.http).post":"/v1/{name=operations/**}:cancel","(google.api.http).body":"*","(google.api.method_signature)":"name"},"parsedOptions":[{"(google.api.http)":{"post":"/v1/{name=operations/**}:cancel","body":"*"}},{"(google.api.method_signature)":"name"}]},"WaitOperation":{"requestType":"WaitOperationRequest","responseType":"Operation"}}},"Operation":{"oneofs":{"result":{"oneof":["error","response"]}},"fields":{"name":{"type":"string","id":1},"metadata":{"type":"google.protobuf.Any","id":2},"done":{"type":"bool","id":3},"error":{"type":"google.rpc.Status","id":4},"response":{"type":"google.protobuf.Any","id":5}}},"GetOperationRequest":{"fields":{"name":{"type":"string","id":1}}},"ListOperationsRequest":{"fields":{"name":{"type":"string","id":4},"filter":{"type":"string","id":1},"pageSize":{"type":"int32","id":2},"pageToken":{"type":"string","id":3}}},"ListOperationsResponse":{"fields":{"operations":{"rule":"repeated","type":"Operation","id":1},"nextPageToken":{"type":"string","id":2}}},"CancelOperationRequest":{"fields":{"name":{"type":"string","id":1}}},"DeleteOperationRequest":{"fields":{"name":{"type":"string","id":1}}},"WaitOperationRequest":{"fields":{"name":{"type":"string","id":1},"timeout":{"type":"google.protobuf.Duration","id":2}}},"OperationInfo":{"fields":{"responseType":{"type":"string","id":1},"metadataType":{"type":"string","id":2}}}}},"api":{"options":{"go_package":"google.golang.org/genproto/googleapis/api/annotations;annotations","java_multiple_files":true,"java_outer_classname":"ClientProto","java_package":"com.google.api","objc_class_prefix":"GAPI","cc_enable_arenas":true},"nested":{"http":{"type":"HttpRule","id":72295728,"extend":"google.protobuf.MethodOptions"},"Http":{"fields":{"rules":{"rule":"repeated","type":"HttpRule","id":1},"fullyDecodeReservedExpansion":{"type":"bool","id":2}}},"HttpRule":{"oneofs":{"pattern":{"oneof":["get","put","post","delete","patch","custom"]}},"fields":{"selector":{"type":"string","id":1},"get":{"type":"string","id":2},"put":{"type":"string","id":3},"post":{"type":"string","id":4},"delete":{"type":"string","id":5},"patch":{"type":"string","id":6},"custom":{"type":"CustomHttpPattern","id":8},"body":{"type":"string","id":7},"responseBody":{"type":"string","id":12},"additionalBindings":{"rule":"repeated","type":"HttpRule","id":11}}},"CustomHttpPattern":{"fields":{"kind":{"type":"string","id":1},"path":{"type":"string","id":2}}},"methodSignature":{"rule":"repeated","type":"string","id":1051,"extend":"google.protobuf.MethodOptions"},"defaultHost":{"type":"string","id":1049,"extend":"google.protobuf.ServiceOptions"},"oauthScopes":{"type":"string","id":1050,"extend":"google.protobuf.ServiceOptions"}}},"protobuf":{"options":{"go_package":"github.com/golang/protobuf/protoc-gen-go/descriptor;descriptor","java_package":"com.google.protobuf","java_outer_classname":"DescriptorProtos","csharp_namespace":"Google.Protobuf.Reflection","objc_class_prefix":"GPB","cc_enable_arenas":true,"optimize_for":"SPEED"},"nested":{"FileDescriptorSet":{"fields":{"file":{"rule":"repeated","type":"FileDescriptorProto","id":1}}},"FileDescriptorProto":{"fields":{"name":{"type":"string","id":1},"package":{"type":"string","id":2},"dependency":{"rule":"repeated","type":"string","id":3},"publicDependency":{"rule":"repeated","type":"int32","id":10,"options":{"packed":false}},"weakDependency":{"rule":"repeated","type":"int32","id":11,"options":{"packed":false}},"messageType":{"rule":"repeated","type":"DescriptorProto","id":4},"enumType":{"rule":"repeated","type":"EnumDescriptorProto","id":5},"service":{"rule":"repeated","type":"ServiceDescriptorProto","id":6},"extension":{"rule":"repeated","type":"FieldDescriptorProto","id":7},"options":{"type":"FileOptions","id":8},"sourceCodeInfo":{"type":"SourceCodeInfo","id":9},"syntax":{"type":"string","id":12}}},"DescriptorProto":{"fields":{"name":{"type":"string","id":1},"field":{"rule":"repeated","type":"FieldDescriptorProto","id":2},"extension":{"rule":"repeated","type":"FieldDescriptorProto","id":6},"nestedType":{"rule":"repeated","type":"DescriptorProto","id":3},"enumType":{"rule":"repeated","type":"EnumDescriptorProto","id":4},"extensionRange":{"rule":"repeated","type":"ExtensionRange","id":5},"oneofDecl":{"rule":"repeated","type":"OneofDescriptorProto","id":8},"options":{"type":"MessageOptions","id":7},"reservedRange":{"rule":"repeated","type":"ReservedRange","id":9},"reservedName":{"rule":"repeated","type":"string","id":10}},"nested":{"ExtensionRange":{"fields":{"start":{"type":"int32","id":1},"end":{"type":"int32","id":2},"options":{"type":"ExtensionRangeOptions","id":3}}},"ReservedRange":{"fields":{"start":{"type":"int32","id":1},"end":{"type":"int32","id":2}}}}},"ExtensionRangeOptions":{"fields":{"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]]},"FieldDescriptorProto":{"fields":{"name":{"type":"string","id":1},"number":{"type":"int32","id":3},"label":{"type":"Label","id":4},"type":{"type":"Type","id":5},"typeName":{"type":"string","id":6},"extendee":{"type":"string","id":2},"defaultValue":{"type":"string","id":7},"oneofIndex":{"type":"int32","id":9},"jsonName":{"type":"string","id":10},"options":{"type":"FieldOptions","id":8},"proto3Optional":{"type":"bool","id":17}},"nested":{"Type":{"values":{"TYPE_DOUBLE":1,"TYPE_FLOAT":2,"TYPE_INT64":3,"TYPE_UINT64":4,"TYPE_INT32":5,"TYPE_FIXED64":6,"TYPE_FIXED32":7,"TYPE_BOOL":8,"TYPE_STRING":9,"TYPE_GROUP":10,"TYPE_MESSAGE":11,"TYPE_BYTES":12,"TYPE_UINT32":13,"TYPE_ENUM":14,"TYPE_SFIXED32":15,"TYPE_SFIXED64":16,"TYPE_SINT32":17,"TYPE_SINT64":18}},"Label":{"values":{"LABEL_OPTIONAL":1,"LABEL_REQUIRED":2,"LABEL_REPEATED":3}}}},"OneofDescriptorProto":{"fields":{"name":{"type":"string","id":1},"options":{"type":"OneofOptions","id":2}}},"EnumDescriptorProto":{"fields":{"name":{"type":"string","id":1},"value":{"rule":"repeated","type":"EnumValueDescriptorProto","id":2},"options":{"type":"EnumOptions","id":3},"reservedRange":{"rule":"repeated","type":"EnumReservedRange","id":4},"reservedName":{"rule":"repeated","type":"string","id":5}},"nested":{"EnumReservedRange":{"fields":{"start":{"type":"int32","id":1},"end":{"type":"int32","id":2}}}}},"EnumValueDescriptorProto":{"fields":{"name":{"type":"string","id":1},"number":{"type":"int32","id":2},"options":{"type":"EnumValueOptions","id":3}}},"ServiceDescriptorProto":{"fields":{"name":{"type":"string","id":1},"method":{"rule":"repeated","type":"MethodDescriptorProto","id":2},"options":{"type":"ServiceOptions","id":3}}},"MethodDescriptorProto":{"fields":{"name":{"type":"string","id":1},"inputType":{"type":"string","id":2},"outputType":{"type":"string","id":3},"options":{"type":"MethodOptions","id":4},"clientStreaming":{"type":"bool","id":5,"options":{"default":false}},"serverStreaming":{"type":"bool","id":6,"options":{"default":false}}}},"FileOptions":{"fields":{"javaPackage":{"type":"string","id":1},"javaOuterClassname":{"type":"string","id":8},"javaMultipleFiles":{"type":"bool","id":10,"options":{"default":false}},"javaGenerateEqualsAndHash":{"type":"bool","id":20,"options":{"deprecated":true}},"javaStringCheckUtf8":{"type":"bool","id":27,"options":{"default":false}},"optimizeFor":{"type":"OptimizeMode","id":9,"options":{"default":"SPEED"}},"goPackage":{"type":"string","id":11},"ccGenericServices":{"type":"bool","id":16,"options":{"default":false}},"javaGenericServices":{"type":"bool","id":17,"options":{"default":false}},"pyGenericServices":{"type":"bool","id":18,"options":{"default":false}},"phpGenericServices":{"type":"bool","id":42,"options":{"default":false}},"deprecated":{"type":"bool","id":23,"options":{"default":false}},"ccEnableArenas":{"type":"bool","id":31,"options":{"default":true}},"objcClassPrefix":{"type":"string","id":36},"csharpNamespace":{"type":"string","id":37},"swiftPrefix":{"type":"string","id":39},"phpClassPrefix":{"type":"string","id":40},"phpNamespace":{"type":"string","id":41},"phpMetadataNamespace":{"type":"string","id":44},"rubyPackage":{"type":"string","id":45},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[38,38]],"nested":{"OptimizeMode":{"values":{"SPEED":1,"CODE_SIZE":2,"LITE_RUNTIME":3}}}},"MessageOptions":{"fields":{"messageSetWireFormat":{"type":"bool","id":1,"options":{"default":false}},"noStandardDescriptorAccessor":{"type":"bool","id":2,"options":{"default":false}},"deprecated":{"type":"bool","id":3,"options":{"default":false}},"mapEntry":{"type":"bool","id":7},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[8,8],[9,9]]},"FieldOptions":{"fields":{"ctype":{"type":"CType","id":1,"options":{"default":"STRING"}},"packed":{"type":"bool","id":2},"jstype":{"type":"JSType","id":6,"options":{"default":"JS_NORMAL"}},"lazy":{"type":"bool","id":5,"options":{"default":false}},"deprecated":{"type":"bool","id":3,"options":{"default":false}},"weak":{"type":"bool","id":10,"options":{"default":false}},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[4,4]],"nested":{"CType":{"values":{"STRING":0,"CORD":1,"STRING_PIECE":2}},"JSType":{"values":{"JS_NORMAL":0,"JS_STRING":1,"JS_NUMBER":2}}}},"OneofOptions":{"fields":{"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]]},"EnumOptions":{"fields":{"allowAlias":{"type":"bool","id":2},"deprecated":{"type":"bool","id":3,"options":{"default":false}},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[5,5]]},"EnumValueOptions":{"fields":{"deprecated":{"type":"bool","id":1,"options":{"default":false}},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]]},"ServiceOptions":{"fields":{"deprecated":{"type":"bool","id":33,"options":{"default":false}},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]]},"MethodOptions":{"fields":{"deprecated":{"type":"bool","id":33,"options":{"default":false}},"idempotencyLevel":{"type":"IdempotencyLevel","id":34,"options":{"default":"IDEMPOTENCY_UNKNOWN"}},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"nested":{"IdempotencyLevel":{"values":{"IDEMPOTENCY_UNKNOWN":0,"NO_SIDE_EFFECTS":1,"IDEMPOTENT":2}}}},"UninterpretedOption":{"fields":{"name":{"rule":"repeated","type":"NamePart","id":2},"identifierValue":{"type":"string","id":3},"positiveIntValue":{"type":"uint64","id":4},"negativeIntValue":{"type":"int64","id":5},"doubleValue":{"type":"double","id":6},"stringValue":{"type":"bytes","id":7},"aggregateValue":{"type":"string","id":8}},"nested":{"NamePart":{"fields":{"namePart":{"rule":"required","type":"string","id":1},"isExtension":{"rule":"required","type":"bool","id":2}}}}},"SourceCodeInfo":{"fields":{"location":{"rule":"repeated","type":"Location","id":1}},"nested":{"Location":{"fields":{"path":{"rule":"repeated","type":"int32","id":1},"span":{"rule":"repeated","type":"int32","id":2},"leadingComments":{"type":"string","id":3},"trailingComments":{"type":"string","id":4},"leadingDetachedComments":{"rule":"repeated","type":"string","id":6}}}}},"GeneratedCodeInfo":{"fields":{"annotation":{"rule":"repeated","type":"Annotation","id":1}},"nested":{"Annotation":{"fields":{"path":{"rule":"repeated","type":"int32","id":1},"sourceFile":{"type":"string","id":2},"begin":{"type":"int32","id":3},"end":{"type":"int32","id":4}}}}},"Any":{"fields":{"type_url":{"type":"string","id":1},"value":{"type":"bytes","id":2}}},"Duration":{"fields":{"seconds":{"type":"int64","id":1},"nanos":{"type":"int32","id":2}}},"Empty":{"fields":{}}}},"rpc":{"options":{"cc_enable_arenas":true,"go_package":"google.golang.org/genproto/googleapis/rpc/status;status","java_multiple_files":true,"java_outer_classname":"StatusProto","java_package":"com.google.rpc","objc_class_prefix":"RPC"},"nested":{"Status":{"fields":{"code":{"type":"int32","id":1},"message":{"type":"string","id":2},"details":{"rule":"repeated","type":"google.protobuf.Any","id":3}}}}}}}}}'); + +/***/ }), + +/***/ 64765: +/***/ ((module) => { + +"use strict"; +module.exports = /*#__PURE__*/JSON.parse('{"nested":{"google":{"nested":{"protobuf":{"nested":{"Any":{"fields":{"type_url":{"type":"string","id":1},"value":{"type":"bytes","id":2}}},"Duration":{"fields":{"seconds":{"type":"int64","id":1},"nanos":{"type":"int32","id":2}}}}},"rpc":{"options":{"cc_enable_arenas":true,"go_package":"google.golang.org/genproto/googleapis/rpc/errdetails;errdetails","java_multiple_files":true,"java_outer_classname":"ErrorDetailsProto","java_package":"com.google.rpc","objc_class_prefix":"RPC"},"nested":{"Status":{"fields":{"code":{"type":"int32","id":1},"message":{"type":"string","id":2},"details":{"rule":"repeated","type":"google.protobuf.Any","id":3}}},"RetryInfo":{"fields":{"retryDelay":{"type":"google.protobuf.Duration","id":1}}},"DebugInfo":{"fields":{"stackEntries":{"rule":"repeated","type":"string","id":1},"detail":{"type":"string","id":2}}},"QuotaFailure":{"fields":{"violations":{"rule":"repeated","type":"Violation","id":1}},"nested":{"Violation":{"fields":{"subject":{"type":"string","id":1},"description":{"type":"string","id":2}}}}},"ErrorInfo":{"fields":{"reason":{"type":"string","id":1},"domain":{"type":"string","id":2},"metadata":{"keyType":"string","type":"string","id":3}}},"PreconditionFailure":{"fields":{"violations":{"rule":"repeated","type":"Violation","id":1}},"nested":{"Violation":{"fields":{"type":{"type":"string","id":1},"subject":{"type":"string","id":2},"description":{"type":"string","id":3}}}}},"BadRequest":{"fields":{"fieldViolations":{"rule":"repeated","type":"FieldViolation","id":1}},"nested":{"FieldViolation":{"fields":{"field":{"type":"string","id":1},"description":{"type":"string","id":2}}}}},"RequestInfo":{"fields":{"requestId":{"type":"string","id":1},"servingData":{"type":"string","id":2}}},"ResourceInfo":{"fields":{"resourceType":{"type":"string","id":1},"resourceName":{"type":"string","id":2},"owner":{"type":"string","id":3},"description":{"type":"string","id":4}}},"Help":{"fields":{"links":{"rule":"repeated","type":"Link","id":1}},"nested":{"Link":{"fields":{"description":{"type":"string","id":1},"url":{"type":"string","id":2}}}}},"LocalizedMessage":{"fields":{"locale":{"type":"string","id":1},"message":{"type":"string","id":2}}}}}}}}}'); + +/***/ }), + +/***/ 55083: +/***/ ((module) => { + +"use strict"; +module.exports = /*#__PURE__*/JSON.parse('{"interfaces":{"google.iam.v1.IAMPolicy":{"retry_codes":{"non_idempotent":[],"idempotent":["DEADLINE_EXCEEDED","UNAVAILABLE"]},"retry_params":{"default":{"initial_retry_delay_millis":100,"retry_delay_multiplier":1.3,"max_retry_delay_millis":60000,"initial_rpc_timeout_millis":20000,"rpc_timeout_multiplier":1,"max_rpc_timeout_millis":20000,"total_timeout_millis":600000}},"methods":{"GetIamPolicy":{"retry_codes_name":"non_idempotent","retry_params_name":"default"},"SetIamPolicy":{"retry_codes_name":"non_idempotent","retry_params_name":"default"},"TestIamPermissions":{"retry_codes_name":"non_idempotent","retry_params_name":"default"}}}}}'); + +/***/ }), + +/***/ 29343: +/***/ ((module) => { + +"use strict"; +module.exports = /*#__PURE__*/JSON.parse('{"interfaces":{"google.cloud.location.Locations":{"retry_codes":{"non_idempotent":[],"idempotent":["DEADLINE_EXCEEDED","UNAVAILABLE"]},"retry_params":{"default":{"initial_retry_delay_millis":100,"retry_delay_multiplier":1.3,"max_retry_delay_millis":60000,"initial_rpc_timeout_millis":60000,"rpc_timeout_multiplier":1,"max_rpc_timeout_millis":60000,"total_timeout_millis":600000}},"methods":{"ListLocations":{"retry_codes_name":"non_idempotent","retry_params_name":"default"},"GetLocation":{"retry_codes_name":"non_idempotent","retry_params_name":"default"}}}}}'); + +/***/ }), + +/***/ 25365: +/***/ ((module) => { + +"use strict"; +module.exports = /*#__PURE__*/JSON.parse('{"interfaces":{"google.longrunning.Operations":{"retry_codes":{"idempotent":["DEADLINE_EXCEEDED","UNAVAILABLE"],"non_idempotent":[]},"retry_params":{"default":{"initial_retry_delay_millis":100,"retry_delay_multiplier":1.3,"max_retry_delay_millis":60000,"initial_rpc_timeout_millis":90000,"rpc_timeout_multiplier":1,"max_rpc_timeout_millis":90000,"total_timeout_millis":600000}},"methods":{"GetOperation":{"timeout_millis":60000,"retry_codes_name":"idempotent","retry_params_name":"default"},"ListOperations":{"timeout_millis":60000,"retry_codes_name":"idempotent","retry_params_name":"default"},"CancelOperation":{"timeout_millis":60000,"retry_codes_name":"idempotent","retry_params_name":"default"},"DeleteOperation":{"timeout_millis":60000,"retry_codes_name":"idempotent","retry_params_name":"default"}}}}}'); + +/***/ }), + +/***/ 7085: +/***/ ((module) => { + +"use strict"; +module.exports = /*#__PURE__*/JSON.parse('["google/api/annotations.proto","google/api/apikeys/v2/apikeys.proto","google/api/apikeys/v2/resources.proto","google/api/auth.proto","google/api/backend.proto","google/api/billing.proto","google/api/client.proto","google/api/cloudquotas/v1/cloudquotas.proto","google/api/cloudquotas/v1/resources.proto","google/api/config_change.proto","google/api/consumer.proto","google/api/context.proto","google/api/control.proto","google/api/distribution.proto","google/api/documentation.proto","google/api/endpoint.proto","google/api/error_reason.proto","google/api/expr/conformance/v1alpha1/conformance_service.proto","google/api/expr/v1alpha1/checked.proto","google/api/expr/v1alpha1/eval.proto","google/api/expr/v1alpha1/explain.proto","google/api/expr/v1alpha1/syntax.proto","google/api/expr/v1alpha1/value.proto","google/api/expr/v1beta1/decl.proto","google/api/expr/v1beta1/eval.proto","google/api/expr/v1beta1/expr.proto","google/api/expr/v1beta1/source.proto","google/api/expr/v1beta1/value.proto","google/api/field_behavior.proto","google/api/field_info.proto","google/api/http.proto","google/api/httpbody.proto","google/api/label.proto","google/api/launch_stage.proto","google/api/log.proto","google/api/logging.proto","google/api/metric.proto","google/api/monitored_resource.proto","google/api/monitoring.proto","google/api/policy.proto","google/api/quota.proto","google/api/resource.proto","google/api/routing.proto","google/api/service.proto","google/api/servicecontrol/v1/check_error.proto","google/api/servicecontrol/v1/distribution.proto","google/api/servicecontrol/v1/http_request.proto","google/api/servicecontrol/v1/log_entry.proto","google/api/servicecontrol/v1/metric_value.proto","google/api/servicecontrol/v1/operation.proto","google/api/servicecontrol/v1/quota_controller.proto","google/api/servicecontrol/v1/service_controller.proto","google/api/servicecontrol/v2/service_controller.proto","google/api/servicemanagement/v1/resources.proto","google/api/servicemanagement/v1/servicemanager.proto","google/api/serviceusage/v1/resources.proto","google/api/serviceusage/v1/serviceusage.proto","google/api/serviceusage/v1beta1/resources.proto","google/api/serviceusage/v1beta1/serviceusage.proto","google/api/source_info.proto","google/api/system_parameter.proto","google/api/usage.proto","google/api/visibility.proto","google/cloud/location/locations.proto","google/iam/v1/iam_policy.proto","google/iam/v1/logging/audit_data.proto","google/iam/v1/options.proto","google/iam/v1/policy.proto","google/logging/type/http_request.proto","google/logging/type/log_severity.proto","google/longrunning/operations.proto","google/monitoring/v3/alert.proto","google/monitoring/v3/alert_service.proto","google/monitoring/v3/common.proto","google/monitoring/v3/dropped_labels.proto","google/monitoring/v3/group.proto","google/monitoring/v3/group_service.proto","google/monitoring/v3/metric.proto","google/monitoring/v3/metric_service.proto","google/monitoring/v3/mutation_record.proto","google/monitoring/v3/notification.proto","google/monitoring/v3/notification_service.proto","google/monitoring/v3/query_service.proto","google/monitoring/v3/service.proto","google/monitoring/v3/service_service.proto","google/monitoring/v3/snooze.proto","google/monitoring/v3/snooze_service.proto","google/monitoring/v3/span_context.proto","google/monitoring/v3/uptime.proto","google/monitoring/v3/uptime_service.proto","google/protobuf/any.proto","google/protobuf/api.proto","google/protobuf/bridge/message_set.proto","google/protobuf/compiler/plugin.proto","google/protobuf/compiler/ruby/ruby_generated_code.proto","google/protobuf/compiler/ruby/ruby_generated_code_proto2.proto","google/protobuf/compiler/ruby/ruby_generated_code_proto2_import.proto","google/protobuf/compiler/ruby/ruby_generated_pkg_explicit.proto","google/protobuf/compiler/ruby/ruby_generated_pkg_explicit_legacy.proto","google/protobuf/compiler/ruby/ruby_generated_pkg_implicit.proto","google/protobuf/cpp_features.proto","google/protobuf/descriptor.proto","google/protobuf/duration.proto","google/protobuf/empty.proto","google/protobuf/field_mask.proto","google/protobuf/source_context.proto","google/protobuf/struct.proto","google/protobuf/timestamp.proto","google/protobuf/type.proto","google/protobuf/util/json_format.proto","google/protobuf/util/json_format_proto3.proto","google/protobuf/wrappers.proto","google/rpc/code.proto","google/rpc/context/attribute_context.proto","google/rpc/context/audit_context.proto","google/rpc/error_details.proto","google/rpc/http.proto","google/rpc/status.proto","google/type/calendar_period.proto","google/type/color.proto","google/type/date.proto","google/type/datetime.proto","google/type/dayofweek.proto","google/type/decimal.proto","google/type/expr.proto","google/type/fraction.proto","google/type/interval.proto","google/type/latlng.proto","google/type/localized_text.proto","google/type/money.proto","google/type/month.proto","google/type/phone_number.proto","google/type/postal_address.proto","google/type/quaternion.proto","google/type/timeofday.proto"]'); + +/***/ }), + +/***/ 57564: +/***/ ((module) => { + +"use strict"; +module.exports = {"version":"4.6.1"}; + +/***/ }), + /***/ 11540: /***/ ((module) => { @@ -88034,6 +204727,38 @@ module.exports = /*#__PURE__*/JSON.parse('{"name":"googleapis-common","version": /***/ }), +/***/ 15434: +/***/ ((module) => { + +"use strict"; +module.exports = /*#__PURE__*/JSON.parse('{"nested":{"google":{"nested":{"protobuf":{"nested":{"Api":{"fields":{"name":{"type":"string","id":1},"methods":{"rule":"repeated","type":"Method","id":2},"options":{"rule":"repeated","type":"Option","id":3},"version":{"type":"string","id":4},"sourceContext":{"type":"SourceContext","id":5},"mixins":{"rule":"repeated","type":"Mixin","id":6},"syntax":{"type":"Syntax","id":7}}},"Method":{"fields":{"name":{"type":"string","id":1},"requestTypeUrl":{"type":"string","id":2},"requestStreaming":{"type":"bool","id":3},"responseTypeUrl":{"type":"string","id":4},"responseStreaming":{"type":"bool","id":5},"options":{"rule":"repeated","type":"Option","id":6},"syntax":{"type":"Syntax","id":7}}},"Mixin":{"fields":{"name":{"type":"string","id":1},"root":{"type":"string","id":2}}},"SourceContext":{"fields":{"fileName":{"type":"string","id":1}}},"Option":{"fields":{"name":{"type":"string","id":1},"value":{"type":"Any","id":2}}},"Syntax":{"values":{"SYNTAX_PROTO2":0,"SYNTAX_PROTO3":1}}}}}}}}'); + +/***/ }), + +/***/ 93951: +/***/ ((module) => { + +"use strict"; +module.exports = /*#__PURE__*/JSON.parse('{"nested":{"google":{"nested":{"protobuf":{"options":{"go_package":"google.golang.org/protobuf/types/descriptorpb","java_package":"com.google.protobuf","java_outer_classname":"DescriptorProtos","csharp_namespace":"Google.Protobuf.Reflection","objc_class_prefix":"GPB","cc_enable_arenas":true,"optimize_for":"SPEED"},"nested":{"FileDescriptorSet":{"edition":"proto2","fields":{"file":{"rule":"repeated","type":"FileDescriptorProto","id":1}},"extensions":[[536000000,536000000]]},"Edition":{"edition":"proto2","values":{"EDITION_UNKNOWN":0,"EDITION_LEGACY":900,"EDITION_PROTO2":998,"EDITION_PROTO3":999,"EDITION_2023":1000,"EDITION_2024":1001,"EDITION_1_TEST_ONLY":1,"EDITION_2_TEST_ONLY":2,"EDITION_99997_TEST_ONLY":99997,"EDITION_99998_TEST_ONLY":99998,"EDITION_99999_TEST_ONLY":99999,"EDITION_MAX":2147483647}},"FileDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"package":{"type":"string","id":2},"dependency":{"rule":"repeated","type":"string","id":3},"publicDependency":{"rule":"repeated","type":"int32","id":10},"weakDependency":{"rule":"repeated","type":"int32","id":11},"optionDependency":{"rule":"repeated","type":"string","id":15},"messageType":{"rule":"repeated","type":"DescriptorProto","id":4},"enumType":{"rule":"repeated","type":"EnumDescriptorProto","id":5},"service":{"rule":"repeated","type":"ServiceDescriptorProto","id":6},"extension":{"rule":"repeated","type":"FieldDescriptorProto","id":7},"options":{"type":"FileOptions","id":8},"sourceCodeInfo":{"type":"SourceCodeInfo","id":9},"syntax":{"type":"string","id":12},"edition":{"type":"Edition","id":14}}},"DescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"field":{"rule":"repeated","type":"FieldDescriptorProto","id":2},"extension":{"rule":"repeated","type":"FieldDescriptorProto","id":6},"nestedType":{"rule":"repeated","type":"DescriptorProto","id":3},"enumType":{"rule":"repeated","type":"EnumDescriptorProto","id":4},"extensionRange":{"rule":"repeated","type":"ExtensionRange","id":5},"oneofDecl":{"rule":"repeated","type":"OneofDescriptorProto","id":8},"options":{"type":"MessageOptions","id":7},"reservedRange":{"rule":"repeated","type":"ReservedRange","id":9},"reservedName":{"rule":"repeated","type":"string","id":10},"visibility":{"type":"SymbolVisibility","id":11}},"nested":{"ExtensionRange":{"fields":{"start":{"type":"int32","id":1},"end":{"type":"int32","id":2},"options":{"type":"ExtensionRangeOptions","id":3}}},"ReservedRange":{"fields":{"start":{"type":"int32","id":1},"end":{"type":"int32","id":2}}}}},"ExtensionRangeOptions":{"edition":"proto2","fields":{"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999},"declaration":{"rule":"repeated","type":"Declaration","id":2,"options":{"retention":"RETENTION_SOURCE"}},"features":{"type":"FeatureSet","id":50},"verification":{"type":"VerificationState","id":3,"options":{"default":"UNVERIFIED","retention":"RETENTION_SOURCE"}}},"extensions":[[1000,536870911]],"nested":{"Declaration":{"fields":{"number":{"type":"int32","id":1},"fullName":{"type":"string","id":2},"type":{"type":"string","id":3},"reserved":{"type":"bool","id":5},"repeated":{"type":"bool","id":6}},"reserved":[[4,4]]},"VerificationState":{"values":{"DECLARATION":0,"UNVERIFIED":1}}}},"FieldDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"number":{"type":"int32","id":3},"label":{"type":"Label","id":4},"type":{"type":"Type","id":5},"typeName":{"type":"string","id":6},"extendee":{"type":"string","id":2},"defaultValue":{"type":"string","id":7},"oneofIndex":{"type":"int32","id":9},"jsonName":{"type":"string","id":10},"options":{"type":"FieldOptions","id":8},"proto3Optional":{"type":"bool","id":17}},"nested":{"Type":{"values":{"TYPE_DOUBLE":1,"TYPE_FLOAT":2,"TYPE_INT64":3,"TYPE_UINT64":4,"TYPE_INT32":5,"TYPE_FIXED64":6,"TYPE_FIXED32":7,"TYPE_BOOL":8,"TYPE_STRING":9,"TYPE_GROUP":10,"TYPE_MESSAGE":11,"TYPE_BYTES":12,"TYPE_UINT32":13,"TYPE_ENUM":14,"TYPE_SFIXED32":15,"TYPE_SFIXED64":16,"TYPE_SINT32":17,"TYPE_SINT64":18}},"Label":{"values":{"LABEL_OPTIONAL":1,"LABEL_REPEATED":3,"LABEL_REQUIRED":2}}}},"OneofDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"options":{"type":"OneofOptions","id":2}}},"EnumDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"value":{"rule":"repeated","type":"EnumValueDescriptorProto","id":2},"options":{"type":"EnumOptions","id":3},"reservedRange":{"rule":"repeated","type":"EnumReservedRange","id":4},"reservedName":{"rule":"repeated","type":"string","id":5},"visibility":{"type":"SymbolVisibility","id":6}},"nested":{"EnumReservedRange":{"fields":{"start":{"type":"int32","id":1},"end":{"type":"int32","id":2}}}}},"EnumValueDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"number":{"type":"int32","id":2},"options":{"type":"EnumValueOptions","id":3}}},"ServiceDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"method":{"rule":"repeated","type":"MethodDescriptorProto","id":2},"options":{"type":"ServiceOptions","id":3}}},"MethodDescriptorProto":{"edition":"proto2","fields":{"name":{"type":"string","id":1},"inputType":{"type":"string","id":2},"outputType":{"type":"string","id":3},"options":{"type":"MethodOptions","id":4},"clientStreaming":{"type":"bool","id":5},"serverStreaming":{"type":"bool","id":6}}},"FileOptions":{"edition":"proto2","fields":{"javaPackage":{"type":"string","id":1},"javaOuterClassname":{"type":"string","id":8},"javaMultipleFiles":{"type":"bool","id":10},"javaGenerateEqualsAndHash":{"type":"bool","id":20,"options":{"deprecated":true}},"javaStringCheckUtf8":{"type":"bool","id":27},"optimizeFor":{"type":"OptimizeMode","id":9,"options":{"default":"SPEED"}},"goPackage":{"type":"string","id":11},"ccGenericServices":{"type":"bool","id":16},"javaGenericServices":{"type":"bool","id":17},"pyGenericServices":{"type":"bool","id":18},"deprecated":{"type":"bool","id":23},"ccEnableArenas":{"type":"bool","id":31,"options":{"default":true}},"objcClassPrefix":{"type":"string","id":36},"csharpNamespace":{"type":"string","id":37},"swiftPrefix":{"type":"string","id":39},"phpClassPrefix":{"type":"string","id":40},"phpNamespace":{"type":"string","id":41},"phpMetadataNamespace":{"type":"string","id":44},"rubyPackage":{"type":"string","id":45},"features":{"type":"FeatureSet","id":50},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[42,42],[38,38],"php_generic_services"],"nested":{"OptimizeMode":{"values":{"SPEED":1,"CODE_SIZE":2,"LITE_RUNTIME":3}}}},"MessageOptions":{"edition":"proto2","fields":{"messageSetWireFormat":{"type":"bool","id":1},"noStandardDescriptorAccessor":{"type":"bool","id":2},"deprecated":{"type":"bool","id":3},"mapEntry":{"type":"bool","id":7},"deprecatedLegacyJsonFieldConflicts":{"type":"bool","id":11,"options":{"deprecated":true}},"features":{"type":"FeatureSet","id":12},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[4,4],[5,5],[6,6],[8,8],[9,9]]},"FieldOptions":{"edition":"proto2","fields":{"ctype":{"type":"CType","id":1,"options":{"default":"STRING"}},"packed":{"type":"bool","id":2},"jstype":{"type":"JSType","id":6,"options":{"default":"JS_NORMAL"}},"lazy":{"type":"bool","id":5},"unverifiedLazy":{"type":"bool","id":15},"deprecated":{"type":"bool","id":3},"weak":{"type":"bool","id":10,"options":{"deprecated":true}},"debugRedact":{"type":"bool","id":16},"retention":{"type":"OptionRetention","id":17},"targets":{"rule":"repeated","type":"OptionTargetType","id":19},"editionDefaults":{"rule":"repeated","type":"EditionDefault","id":20},"features":{"type":"FeatureSet","id":21},"featureSupport":{"type":"FeatureSupport","id":22},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[4,4],[18,18]],"nested":{"CType":{"values":{"STRING":0,"CORD":1,"STRING_PIECE":2}},"JSType":{"values":{"JS_NORMAL":0,"JS_STRING":1,"JS_NUMBER":2}},"OptionRetention":{"values":{"RETENTION_UNKNOWN":0,"RETENTION_RUNTIME":1,"RETENTION_SOURCE":2}},"OptionTargetType":{"values":{"TARGET_TYPE_UNKNOWN":0,"TARGET_TYPE_FILE":1,"TARGET_TYPE_EXTENSION_RANGE":2,"TARGET_TYPE_MESSAGE":3,"TARGET_TYPE_FIELD":4,"TARGET_TYPE_ONEOF":5,"TARGET_TYPE_ENUM":6,"TARGET_TYPE_ENUM_ENTRY":7,"TARGET_TYPE_SERVICE":8,"TARGET_TYPE_METHOD":9}},"EditionDefault":{"fields":{"edition":{"type":"Edition","id":3},"value":{"type":"string","id":2}}},"FeatureSupport":{"fields":{"editionIntroduced":{"type":"Edition","id":1},"editionDeprecated":{"type":"Edition","id":2},"deprecationWarning":{"type":"string","id":3},"editionRemoved":{"type":"Edition","id":4}}}}},"OneofOptions":{"edition":"proto2","fields":{"features":{"type":"FeatureSet","id":1},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]]},"EnumOptions":{"edition":"proto2","fields":{"allowAlias":{"type":"bool","id":2},"deprecated":{"type":"bool","id":3},"deprecatedLegacyJsonFieldConflicts":{"type":"bool","id":6,"options":{"deprecated":true}},"features":{"type":"FeatureSet","id":7},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"reserved":[[5,5]]},"EnumValueOptions":{"edition":"proto2","fields":{"deprecated":{"type":"bool","id":1},"features":{"type":"FeatureSet","id":2},"debugRedact":{"type":"bool","id":3},"featureSupport":{"type":"FieldOptions.FeatureSupport","id":4},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]]},"ServiceOptions":{"edition":"proto2","fields":{"features":{"type":"FeatureSet","id":34},"deprecated":{"type":"bool","id":33},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]]},"MethodOptions":{"edition":"proto2","fields":{"deprecated":{"type":"bool","id":33},"idempotencyLevel":{"type":"IdempotencyLevel","id":34,"options":{"default":"IDEMPOTENCY_UNKNOWN"}},"features":{"type":"FeatureSet","id":35},"uninterpretedOption":{"rule":"repeated","type":"UninterpretedOption","id":999}},"extensions":[[1000,536870911]],"nested":{"IdempotencyLevel":{"values":{"IDEMPOTENCY_UNKNOWN":0,"NO_SIDE_EFFECTS":1,"IDEMPOTENT":2}}}},"UninterpretedOption":{"edition":"proto2","fields":{"name":{"rule":"repeated","type":"NamePart","id":2},"identifierValue":{"type":"string","id":3},"positiveIntValue":{"type":"uint64","id":4},"negativeIntValue":{"type":"int64","id":5},"doubleValue":{"type":"double","id":6},"stringValue":{"type":"bytes","id":7},"aggregateValue":{"type":"string","id":8}},"nested":{"NamePart":{"fields":{"namePart":{"rule":"required","type":"string","id":1},"isExtension":{"rule":"required","type":"bool","id":2}}}}},"FeatureSet":{"edition":"proto2","fields":{"fieldPresence":{"type":"FieldPresence","id":1,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_2023","edition_defaults.value":"EXPLICIT"}},"enumType":{"type":"EnumType","id":2,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"OPEN"}},"repeatedFieldEncoding":{"type":"RepeatedFieldEncoding","id":3,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"PACKED"}},"utf8Validation":{"type":"Utf8Validation","id":4,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"VERIFY"}},"messageEncoding":{"type":"MessageEncoding","id":5,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_LEGACY","edition_defaults.value":"LENGTH_PREFIXED"}},"jsonFormat":{"type":"JsonFormat","id":6,"options":{"retention":"RETENTION_RUNTIME","targets":"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2023","edition_defaults.edition":"EDITION_PROTO3","edition_defaults.value":"ALLOW"}},"enforceNamingStyle":{"type":"EnforceNamingStyle","id":7,"options":{"retention":"RETENTION_SOURCE","targets":"TARGET_TYPE_METHOD","feature_support.edition_introduced":"EDITION_2024","edition_defaults.edition":"EDITION_2024","edition_defaults.value":"STYLE2024"}},"defaultSymbolVisibility":{"type":"VisibilityFeature.DefaultSymbolVisibility","id":8,"options":{"retention":"RETENTION_SOURCE","targets":"TARGET_TYPE_FILE","feature_support.edition_introduced":"EDITION_2024","edition_defaults.edition":"EDITION_2024","edition_defaults.value":"EXPORT_TOP_LEVEL"}}},"extensions":[[1000,9994],[9995,9999],[10000,10000]],"reserved":[[999,999]],"nested":{"FieldPresence":{"values":{"FIELD_PRESENCE_UNKNOWN":0,"EXPLICIT":1,"IMPLICIT":2,"LEGACY_REQUIRED":3}},"EnumType":{"values":{"ENUM_TYPE_UNKNOWN":0,"OPEN":1,"CLOSED":2}},"RepeatedFieldEncoding":{"values":{"REPEATED_FIELD_ENCODING_UNKNOWN":0,"PACKED":1,"EXPANDED":2}},"Utf8Validation":{"values":{"UTF8_VALIDATION_UNKNOWN":0,"VERIFY":2,"NONE":3}},"MessageEncoding":{"values":{"MESSAGE_ENCODING_UNKNOWN":0,"LENGTH_PREFIXED":1,"DELIMITED":2}},"JsonFormat":{"values":{"JSON_FORMAT_UNKNOWN":0,"ALLOW":1,"LEGACY_BEST_EFFORT":2}},"EnforceNamingStyle":{"values":{"ENFORCE_NAMING_STYLE_UNKNOWN":0,"STYLE2024":1,"STYLE_LEGACY":2}},"VisibilityFeature":{"fields":{},"reserved":[[1,536870911]],"nested":{"DefaultSymbolVisibility":{"values":{"DEFAULT_SYMBOL_VISIBILITY_UNKNOWN":0,"EXPORT_ALL":1,"EXPORT_TOP_LEVEL":2,"LOCAL_ALL":3,"STRICT":4}}}}}},"FeatureSetDefaults":{"edition":"proto2","fields":{"defaults":{"rule":"repeated","type":"FeatureSetEditionDefault","id":1},"minimumEdition":{"type":"Edition","id":4},"maximumEdition":{"type":"Edition","id":5}},"nested":{"FeatureSetEditionDefault":{"fields":{"edition":{"type":"Edition","id":3},"overridableFeatures":{"type":"FeatureSet","id":4},"fixedFeatures":{"type":"FeatureSet","id":5}},"reserved":[[1,1],[2,2],"features"]}}},"SourceCodeInfo":{"edition":"proto2","fields":{"location":{"rule":"repeated","type":"Location","id":1}},"extensions":[[536000000,536000000]],"nested":{"Location":{"fields":{"path":{"rule":"repeated","type":"int32","id":1,"options":{"packed":true}},"span":{"rule":"repeated","type":"int32","id":2,"options":{"packed":true}},"leadingComments":{"type":"string","id":3},"trailingComments":{"type":"string","id":4},"leadingDetachedComments":{"rule":"repeated","type":"string","id":6}}}}},"GeneratedCodeInfo":{"edition":"proto2","fields":{"annotation":{"rule":"repeated","type":"Annotation","id":1}},"nested":{"Annotation":{"fields":{"path":{"rule":"repeated","type":"int32","id":1,"options":{"packed":true}},"sourceFile":{"type":"string","id":2},"begin":{"type":"int32","id":3},"end":{"type":"int32","id":4},"semantic":{"type":"Semantic","id":5}},"nested":{"Semantic":{"values":{"NONE":0,"SET":1,"ALIAS":2}}}}}},"SymbolVisibility":{"edition":"proto2","values":{"VISIBILITY_UNSET":0,"VISIBILITY_LOCAL":1,"VISIBILITY_EXPORT":2}}}}}}}}'); + +/***/ }), + +/***/ 92939: +/***/ ((module) => { + +"use strict"; +module.exports = /*#__PURE__*/JSON.parse('{"nested":{"google":{"nested":{"protobuf":{"nested":{"SourceContext":{"fields":{"fileName":{"type":"string","id":1}}}}}}}}}'); + +/***/ }), + +/***/ 36710: +/***/ ((module) => { + +"use strict"; +module.exports = /*#__PURE__*/JSON.parse('{"nested":{"google":{"nested":{"protobuf":{"nested":{"Type":{"fields":{"name":{"type":"string","id":1},"fields":{"rule":"repeated","type":"Field","id":2},"oneofs":{"rule":"repeated","type":"string","id":3},"options":{"rule":"repeated","type":"Option","id":4},"sourceContext":{"type":"SourceContext","id":5},"syntax":{"type":"Syntax","id":6}}},"Field":{"fields":{"kind":{"type":"Kind","id":1},"cardinality":{"type":"Cardinality","id":2},"number":{"type":"int32","id":3},"name":{"type":"string","id":4},"typeUrl":{"type":"string","id":6},"oneofIndex":{"type":"int32","id":7},"packed":{"type":"bool","id":8},"options":{"rule":"repeated","type":"Option","id":9},"jsonName":{"type":"string","id":10},"defaultValue":{"type":"string","id":11}},"nested":{"Kind":{"values":{"TYPE_UNKNOWN":0,"TYPE_DOUBLE":1,"TYPE_FLOAT":2,"TYPE_INT64":3,"TYPE_UINT64":4,"TYPE_INT32":5,"TYPE_FIXED64":6,"TYPE_FIXED32":7,"TYPE_BOOL":8,"TYPE_STRING":9,"TYPE_GROUP":10,"TYPE_MESSAGE":11,"TYPE_BYTES":12,"TYPE_UINT32":13,"TYPE_ENUM":14,"TYPE_SFIXED32":15,"TYPE_SFIXED64":16,"TYPE_SINT32":17,"TYPE_SINT64":18}},"Cardinality":{"values":{"CARDINALITY_UNKNOWN":0,"CARDINALITY_OPTIONAL":1,"CARDINALITY_REQUIRED":2,"CARDINALITY_REPEATED":3}}}},"Enum":{"fields":{"name":{"type":"string","id":1},"enumvalue":{"rule":"repeated","type":"EnumValue","id":2},"options":{"rule":"repeated","type":"Option","id":3},"sourceContext":{"type":"SourceContext","id":4},"syntax":{"type":"Syntax","id":5}}},"EnumValue":{"fields":{"name":{"type":"string","id":1},"number":{"type":"int32","id":2},"options":{"rule":"repeated","type":"Option","id":3}}},"Option":{"fields":{"name":{"type":"string","id":1},"value":{"type":"Any","id":2}}},"Syntax":{"values":{"SYNTAX_PROTO2":0,"SYNTAX_PROTO3":1}},"Any":{"fields":{"type_url":{"type":"string","id":1},"value":{"type":"bytes","id":2}}},"SourceContext":{"fields":{"fileName":{"type":"string","id":1}}}}}}}}}'); + +/***/ }), + /***/ 92472: /***/ ((module) => { @@ -88056,8 +204781,8 @@ module.exports = /*#__PURE__*/JSON.parse('[[[0,44],"disallowed_STD3_valid"],[[45 /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { -/******/ // no module.id needed -/******/ // no module.loaded needed +/******/ id: moduleId, +/******/ loaded: false, /******/ exports: {} /******/ }; /******/ @@ -88070,11 +204795,23 @@ module.exports = /*#__PURE__*/JSON.parse('[[[0,44],"disallowed_STD3_valid"],[[45 /******/ if(threw) delete __webpack_module_cache__[moduleId]; /******/ } /******/ +/******/ // Flag the module as loaded +/******/ module.loaded = true; +/******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ +/******/ /* webpack/runtime/node module decorator */ +/******/ (() => { +/******/ __nccwpck_require__.nmd = (module) => { +/******/ module.paths = []; +/******/ if (!module.children) module.children = []; +/******/ return module; +/******/ }; +/******/ })(); +/******/ /******/ /* webpack/runtime/compat */ /******/ /******/ if (typeof __nccwpck_require__ !== 'undefined') __nccwpck_require__.ab = __dirname + "/"; @@ -88084,18 +204821,28 @@ var __webpack_exports__ = {}; const core = __nccwpck_require__(37484); const github = __nccwpck_require__(93228); const { getConfig } = __nccwpck_require__(26472); -const { collectMetrics } = __nccwpck_require__(70219); -const { createMeterProvider, recordMetrics, shutdown } = __nccwpck_require__(22803); +const { collectMetrics, collectLogs } = __nccwpck_require__(70219); +const { + createMeterProvider, + recordMetrics, + shutdown, + createTracerProvider, + recordTraces, + shutdownTracer, + createLogger, + recordLogs, +} = __nccwpck_require__(22803); /** * Post-action entry point - * Collects workflow metrics and exports them to Google Cloud Monitoring + * Collects workflow metrics/traces/logs and exports them to Google Cloud */ async function run() { let meterProvider; + let tracerProvider; try { - core.info('Starting OpenTelemetry metrics collection post-action'); + core.info('Starting OpenTelemetry data collection post-action'); // Get configuration const config = await getConfig(); @@ -88107,16 +204854,32 @@ async function run() { // Collect metrics from GitHub API const metrics = await collectMetrics(octokit, github.context); - // Initialize OpenTelemetry and export metrics + // Collect detailed job logs + const logLines = await collectLogs(octokit, github.context, metrics.job.id); + + // Initialize OpenTelemetry providers and Cloud Logging const { meterProvider: provider, meter } = createMeterProvider(config); meterProvider = provider; + const { tracerProvider: tProvider, tracer } = createTracerProvider(config); + tracerProvider = tProvider; + + const { log } = createLogger(config); + + // Record metrics recordMetrics(meter, metrics, config.metricPrefix); - // Force flush and shutdown to ensure metrics are exported - await shutdown(meterProvider); + // Record traces + recordTraces(tracer, metrics); - core.info('Metrics successfully exported to Google Cloud Monitoring'); + // Record logs (with detailed log lines if available) + await recordLogs(log, metrics, logLines); + + // Force flush and shutdown to ensure data is exported + await shutdown(meterProvider); + await shutdownTracer(tracerProvider); + + core.info('✓ Metrics, traces, and logs successfully exported to Google Cloud'); } catch (error) { core.error(`Post-action failed: ${error.message}`); core.error(error.stack); @@ -88126,12 +204889,20 @@ async function run() { try { await shutdown(meterProvider); } catch (shutdownError) { - core.error(`Error during shutdown: ${shutdownError.message}`); + core.error(`Error during metrics shutdown: ${shutdownError.message}`); } } - // Don't fail the workflow if metrics export fails - core.warning('Metrics export failed, but workflow will continue'); + if (tracerProvider) { + try { + await shutdownTracer(tracerProvider); + } catch (shutdownError) { + core.error(`Error during trace shutdown: ${shutdownError.message}`); + } + } + + // Don't fail the workflow if export fails + core.warning('Telemetry export failed, but workflow will continue'); } } diff --git a/lib/collector.js b/lib/collector.js index 32017b6..7717157 100644 --- a/lib/collector.js +++ b/lib/collector.js @@ -94,4 +94,71 @@ async function collectMetrics(octokit, context) { } } -module.exports = { collectMetrics }; +/** + * Collects job logs from GitHub Actions workflow + * @param {Object} octokit - Authenticated Octokit instance + * @param {Object} context - GitHub context + * @param {number} jobId - Job ID + * @returns {Promise} Parsed log entries with timestamps + */ +async function collectLogs(octokit, context, jobId) { + const { owner, repo } = context.repo; + + core.info(`Collecting logs for job ${jobId}`); + + try { + // Download job logs + const response = await octokit.rest.actions.downloadJobLogsForWorkflowRun({ + owner, + repo, + job_id: jobId, + }); + + // The response is a redirect URL or direct log content + const logText = response.data; + + if (!logText || typeof logText !== 'string') { + core.warning('No logs available or unexpected log format'); + return []; + } + + // Parse logs - GitHub Actions logs have format: + // 2025-11-05T15:49:00.1234567Z log message here + const logLines = logText.split('\n'); + const parsedLogs = []; + + let currentStep = 'unknown'; + + for (const line of logLines) { + // Extract timestamp from log line (ISO 8601 format) + const timestampMatch = line.match(/^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d+Z)\s+(.*)$/); + + if (timestampMatch) { + const [, timestamp, message] = timestampMatch; + + // Detect step boundaries (GitHub Actions marks these) + if (message.includes('##[group]Run ')) { + const stepMatch = message.match(/##\[group\]Run (.+)/); + if (stepMatch) { + currentStep = stepMatch[1]; + } + } + + parsedLogs.push({ + timestamp: new Date(timestamp), + message: message, + step: currentStep, + }); + } + } + + core.info(`Parsed ${parsedLogs.length} log lines`); + return parsedLogs; + + } catch (error) { + core.warning(`Failed to collect logs: ${error.message}`); + return []; + } +} + +module.exports = { collectMetrics, collectLogs }; diff --git a/lib/config.js b/lib/config.js index dfb4a93..d1ded77 100644 --- a/lib/config.js +++ b/lib/config.js @@ -71,7 +71,11 @@ async function checkServiceAccountPermissions(projectId, serviceAccountEmail, cr core.info(`Service account has ${serviceAccountRoles.length} role(s): ${serviceAccountRoles.join(', ')}`); // Check for excessive permissions - const allowedRoles = ['roles/monitoring.metricWriter']; + const allowedRoles = [ + 'roles/monitoring.metricWriter', + 'roles/cloudtrace.agent', + 'roles/logging.logWriter', + ]; const excessiveRoles = serviceAccountRoles.filter(role => !allowedRoles.includes(role)); if (excessiveRoles.length > 0) { @@ -86,7 +90,9 @@ async function checkServiceAccountPermissions(projectId, serviceAccountEmail, cr excessiveRoles.forEach(role => core.error(` - ${role}`)); core.error(''); core.error('This service account should ONLY have:'); - core.error(' - roles/monitoring.metricWriter'); + core.error(' - roles/monitoring.metricWriter (for metrics)'); + core.error(' - roles/cloudtrace.agent (for traces)'); + core.error(' - roles/logging.logWriter (for logs)'); core.error(''); core.error('To fix, remove excessive roles:'); excessiveRoles.forEach(role => { @@ -111,7 +117,10 @@ async function checkServiceAccountPermissions(projectId, serviceAccountEmail, cr // Don't fail on API errors (service account likely doesn't have permission to check IAM) core.info('â„šī¸ Could not verify service account permissions via IAM API'); core.info(' This is expected when the service account has minimal permissions'); - core.info(' Ensure the service account ONLY has: roles/monitoring.metricWriter'); + core.info(' Ensure the service account has ONLY:'); + core.info(' - roles/monitoring.metricWriter (for metrics)'); + core.info(' - roles/cloudtrace.agent (for traces)'); + core.info(' - roles/logging.logWriter (for logs)'); core.debug(`Permission check error: ${error.message}`); } } diff --git a/lib/exporter.js b/lib/exporter.js index e30b075..15c5a66 100644 --- a/lib/exporter.js +++ b/lib/exporter.js @@ -1,8 +1,11 @@ const core = require('@actions/core'); const { MeterProvider, PeriodicExportingMetricReader } = require('@opentelemetry/sdk-metrics'); const { MetricExporter } = require('@google-cloud/opentelemetry-cloud-monitoring-exporter'); +const { TraceExporter } = require('@google-cloud/opentelemetry-cloud-trace-exporter'); +const { BasicTracerProvider, BatchSpanProcessor } = require('@opentelemetry/sdk-trace-base'); const { Resource } = require('@opentelemetry/resources'); const { ATTR_SERVICE_NAME, ATTR_SERVICE_NAMESPACE, ATTR_SERVICE_INSTANCE_ID } = require('@opentelemetry/semantic-conventions'); +const { Logging } = require('@google-cloud/logging'); /** * Creates and configures an OpenTelemetry MeterProvider with GCP exporter @@ -154,4 +157,304 @@ async function shutdown(meterProvider) { } } -module.exports = { createMeterProvider, recordMetrics, shutdown }; +/** + * Creates and configures an OpenTelemetry TracerProvider with GCP exporter + * @param {Object} config - Configuration object + * @returns {Object} TracerProvider and tracer + */ +function createTracerProvider(config) { + core.info('Initializing OpenTelemetry TracerProvider with Google Cloud Trace exporter'); + + const resource = new Resource({ + [ATTR_SERVICE_NAME]: config.serviceName, + [ATTR_SERVICE_NAMESPACE]: config.serviceNamespace, + [ATTR_SERVICE_INSTANCE_ID]: process.env.GITHUB_RUN_ID || 'unknown', + }); + + const exporterOptions = { + projectId: config.gcpProjectId, + }; + + if (config.gcpServiceAccountKey) { + try { + const credentials = JSON.parse(config.gcpServiceAccountKey); + exporterOptions.credentials = credentials; + } catch (error) { + core.error(`Failed to parse service account key for traces: ${error.message}`); + throw new Error('Invalid service account key JSON'); + } + } + + const exporter = new TraceExporter(exporterOptions); + const spanProcessor = new BatchSpanProcessor(exporter); + + const tracerProvider = new BasicTracerProvider({ + resource, + }); + + tracerProvider.addSpanProcessor(spanProcessor); + + const tracer = tracerProvider.getTracer(config.metricPrefix); + + return { tracerProvider, tracer }; +} + +/** + * Records traces for collected workflow data + * @param {Object} tracer - OpenTelemetry tracer + * @param {Object} metrics - Collected metrics from GitHub + * @returns {Object} Root span for the job + */ +function recordTraces(tracer, metrics) { + core.info('Recording traces to OpenTelemetry'); + + const baseAttributes = { + 'workflow.name': metrics.workflow, + 'repository.owner': metrics.repository.owner, + 'repository.name': metrics.repository.repo, + 'repository.full_name': metrics.repository.fullName, + 'run.id': metrics.run.id.toString(), + 'run.number': metrics.run.number.toString(), + 'run.attempt': metrics.run.attempt, + }; + + // Create a span for the entire job + const jobSpan = tracer.startSpan(`Job: ${metrics.job.name}`, { + startTime: metrics.job.startedAt, + attributes: { + ...baseAttributes, + 'job.name': metrics.job.name, + 'job.id': metrics.job.id.toString(), + 'job.status': metrics.job.status, + 'job.conclusion': metrics.job.conclusion || 'unknown', + }, + }); + + // Create child spans for each step + for (const step of metrics.steps) { + if (step.startedAt && step.completedAt) { + const stepSpan = tracer.startSpan(`Step: ${step.name}`, { + startTime: step.startedAt, + attributes: { + ...baseAttributes, + 'job.name': metrics.job.name, + 'step.name': step.name, + 'step.number': step.number.toString(), + 'step.status': step.status, + 'step.conclusion': step.conclusion || 'unknown', + }, + }, { + parent: jobSpan, + }); + + // Mark span as error if step failed + if (step.conclusion === 'failure') { + stepSpan.setStatus({ code: 2, message: 'Step failed' }); // SpanStatusCode.ERROR = 2 + stepSpan.recordException(new Error(`Step "${step.name}" failed`)); + } + + stepSpan.end(step.completedAt); + core.debug(`Created span for step: ${step.name}`); + } + } + + // End the job span + if (metrics.job.completedAt) { + if (metrics.job.conclusion === 'failure') { + jobSpan.setStatus({ code: 2, message: 'Job failed' }); + } + jobSpan.end(metrics.job.completedAt); + } + + core.info(`Recorded traces for job and ${metrics.steps.length} steps`); + return jobSpan; +} + +/** + * Shuts down tracer provider + * @param {Object} tracerProvider - TracerProvider instance + * @returns {Promise} + */ +async function shutdownTracer(tracerProvider) { + core.info('Exporting traces and shutting down TracerProvider'); + try { + core.info('Triggering trace export...'); + await tracerProvider.forceFlush(); + core.info('Traces exported successfully'); + + core.info('Shutting down TracerProvider...'); + await tracerProvider.shutdown(); + core.info('TracerProvider shut down successfully'); + } catch (error) { + core.error(`Error during trace export/shutdown: ${error.message}`); + core.error(`Stack trace: ${error.stack}`); + throw error; + } +} + +/** + * Creates Google Cloud Logging client + * @param {Object} config - Configuration object + * @returns {Object} Logging client and log instance + */ +function createLogger(config) { + core.info('Initializing Google Cloud Logging client'); + + const loggingOptions = { + projectId: config.gcpProjectId, + }; + + if (config.gcpServiceAccountKey) { + try { + const credentials = JSON.parse(config.gcpServiceAccountKey); + loggingOptions.credentials = credentials; + } catch (error) { + core.error(`Failed to parse service account key for logging: ${error.message}`); + throw new Error('Invalid service account key JSON'); + } + } + + const logging = new Logging(loggingOptions); + const log = logging.log('github-actions'); + + return { logging, log }; +} + +/** + * Writes logs for collected workflow data + * @param {Object} log - Cloud Logging instance + * @param {Object} metrics - Collected metrics from GitHub + * @param {Array} logLines - Parsed log lines from job execution (optional) + * @returns {Promise} + */ +async function recordLogs(log, metrics, logLines = []) { + core.info('Writing logs to Google Cloud Logging'); + + const baseMetadata = { + resource: { + type: 'generic_task', + labels: { + project_id: metrics.repository.owner, + location: 'global', + namespace: metrics.repository.repo, + job: metrics.job.name, + task_id: metrics.run.id.toString(), + }, + }, + labels: { + workflow: metrics.workflow, + repository: metrics.repository.fullName, + run_number: metrics.run.number.toString(), + run_attempt: metrics.run.attempt, + job_name: metrics.job.name, + }, + }; + + const entries = []; + + // If we have detailed log lines, write them with accurate timestamps + if (logLines && logLines.length > 0) { + core.info(`Writing ${logLines.length} detailed log lines`); + + for (const logLine of logLines) { + // Determine severity from log content + let severity = 'INFO'; + if (logLine.message.includes('::error::') || logLine.message.includes('ERROR')) { + severity = 'ERROR'; + } else if (logLine.message.includes('::warning::') || logLine.message.includes('WARNING')) { + severity = 'WARNING'; + } else if (logLine.message.includes('::debug::')) { + severity = 'DEBUG'; + } + + entries.push(log.entry( + { + ...baseMetadata, + severity, + timestamp: logLine.timestamp, + labels: { + ...baseMetadata.labels, + step: logLine.step || 'unknown', + }, + }, + { + message: logLine.message, + step: logLine.step, + } + )); + } + } else { + // Fallback: Write summary entries if detailed logs not available + core.info('Writing summary log entries (detailed logs not available)'); + + // Log job-level entry + entries.push(log.entry( + { + ...baseMetadata, + severity: metrics.job.conclusion === 'success' ? 'INFO' : 'ERROR', + timestamp: metrics.job.completedAt || new Date(), + }, + { + message: `Job ${metrics.job.name} ${metrics.job.conclusion}`, + job: { + name: metrics.job.name, + id: metrics.job.id, + status: metrics.job.status, + conclusion: metrics.job.conclusion, + duration_ms: metrics.job.durationMs, + }, + } + )); + + // Log step-level entries + for (const step of metrics.steps) { + entries.push(log.entry( + { + ...baseMetadata, + severity: step.conclusion === 'success' ? 'INFO' : step.conclusion === 'failure' ? 'ERROR' : 'WARNING', + timestamp: step.completedAt || new Date(), + labels: { + ...baseMetadata.labels, + step_name: step.name, + step_number: step.number.toString(), + }, + }, + { + message: `Step "${step.name}" ${step.conclusion}`, + step: { + name: step.name, + number: step.number, + conclusion: step.conclusion, + duration_ms: step.durationMs, + }, + } + )); + } + } + + // Write all log entries in batches (Cloud Logging has limits) + const batchSize = 100; + for (let i = 0; i < entries.length; i += batchSize) { + const batch = entries.slice(i, i + batchSize); + try { + await log.write(batch); + core.debug(`Wrote batch of ${batch.length} log entries`); + } catch (error) { + core.error(`Failed to write log batch: ${error.message}`); + throw error; + } + } + + core.info(`✓ Wrote ${entries.length} log entries to Cloud Logging`); +} + +module.exports = { + createMeterProvider, + recordMetrics, + shutdown, + createTracerProvider, + recordTraces, + shutdownTracer, + createLogger, + recordLogs, +}; diff --git a/package-lock.json b/package-lock.json index 789e9cc..55fe62a 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,10 +11,13 @@ "dependencies": { "@actions/core": "^1.11.1", "@actions/github": "^6.0.0", + "@google-cloud/logging": "^11.2.0", "@google-cloud/opentelemetry-cloud-monitoring-exporter": "^0.19.0", + "@google-cloud/opentelemetry-cloud-trace-exporter": "^2.4.1", "@opentelemetry/api": "^1.9.0", "@opentelemetry/resources": "^1.28.0", "@opentelemetry/sdk-metrics": "^1.28.0", + "@opentelemetry/sdk-trace-base": "^1.28.0", "@opentelemetry/semantic-conventions": "^1.28.0", "google-auth-library": "^9.15.0" }, @@ -75,6 +78,51 @@ "node": ">=14" } }, + "node_modules/@google-cloud/common": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@google-cloud/common/-/common-5.0.2.tgz", + "integrity": "sha512-V7bmBKYQyu0eVG2BFejuUjlBt+zrya6vtsKdY+JxMM/dNntPF41vZ9+LhOshEUH01zOHEqBSvI7Dad7ZS6aUeA==", + "dependencies": { + "@google-cloud/projectify": "^4.0.0", + "@google-cloud/promisify": "^4.0.0", + "arrify": "^2.0.1", + "duplexify": "^4.1.1", + "extend": "^3.0.2", + "google-auth-library": "^9.0.0", + "html-entities": "^2.5.2", + "retry-request": "^7.0.0", + "teeny-request": "^9.0.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@google-cloud/logging": { + "version": "11.2.1", + "resolved": "https://registry.npmjs.org/@google-cloud/logging/-/logging-11.2.1.tgz", + "integrity": "sha512-2h9HBJG3OAsvzXmb81qXmaTPfXYU7KJTQUxunoOKFGnY293YQ/eCkW1Y5mHLocwpEqeqQYT/Qvl6Tk+Q7PfStw==", + "dependencies": { + "@google-cloud/common": "^5.0.0", + "@google-cloud/paginator": "^5.0.0", + "@google-cloud/projectify": "^4.0.0", + "@google-cloud/promisify": "4.0.0", + "@opentelemetry/api": "^1.7.0", + "arrify": "^2.0.1", + "dot-prop": "^6.0.0", + "eventid": "^2.0.0", + "extend": "^3.0.2", + "gcp-metadata": "^6.0.0", + "google-auth-library": "^9.0.0", + "google-gax": "^4.0.3", + "on-finished": "^2.3.0", + "pumpify": "^2.0.1", + "stream-events": "^1.0.5", + "uuid": "^9.0.0" + }, + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/@google-cloud/opentelemetry-cloud-monitoring-exporter": { "version": "0.19.0", "resolved": "https://registry.npmjs.org/@google-cloud/opentelemetry-cloud-monitoring-exporter/-/opentelemetry-cloud-monitoring-exporter-0.19.0.tgz", @@ -95,6 +143,26 @@ "@opentelemetry/sdk-metrics": "^1.0.0" } }, + "node_modules/@google-cloud/opentelemetry-cloud-trace-exporter": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/@google-cloud/opentelemetry-cloud-trace-exporter/-/opentelemetry-cloud-trace-exporter-2.4.1.tgz", + "integrity": "sha512-Dq2IyAyA9PCjbjLOn86i2byjkYPC59b5ic8k/L4q5bBWH0Jro8lzMs8C0G5pJfqh2druj8HF+oAIAlSdWQ+Z9Q==", + "dependencies": { + "@google-cloud/opentelemetry-resource-util": "^2.4.0", + "@grpc/grpc-js": "^1.1.8", + "@grpc/proto-loader": "^0.7.0", + "google-auth-library": "^9.0.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": "^1.0.0", + "@opentelemetry/core": "^1.0.0", + "@opentelemetry/resources": "^1.0.0", + "@opentelemetry/sdk-trace-base": "^1.0.0" + } + }, "node_modules/@google-cloud/opentelemetry-resource-util": { "version": "2.4.0", "resolved": "https://registry.npmjs.org/@google-cloud/opentelemetry-resource-util/-/opentelemetry-resource-util-2.4.0.tgz", @@ -110,6 +178,18 @@ "@opentelemetry/resources": "^1.0.0" } }, + "node_modules/@google-cloud/paginator": { + "version": "5.0.2", + "resolved": "https://registry.npmjs.org/@google-cloud/paginator/-/paginator-5.0.2.tgz", + "integrity": "sha512-DJS3s0OVH4zFDB1PzjxAsHqJT6sKVbRwwML0ZBP9PbU7Yebtu/7SWMRzvO2J3nUi9pRNITCfu4LJeooM2w4pjg==", + "dependencies": { + "arrify": "^2.0.0", + "extend": "^3.0.2" + }, + "engines": { + "node": ">=14.0.0" + } + }, "node_modules/@google-cloud/precise-date": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@google-cloud/precise-date/-/precise-date-4.0.0.tgz", @@ -118,6 +198,77 @@ "node": ">=14.0.0" } }, + "node_modules/@google-cloud/projectify": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@google-cloud/projectify/-/projectify-4.0.0.tgz", + "integrity": "sha512-MmaX6HeSvyPbWGwFq7mXdo0uQZLGBYCwziiLIGq5JVX+/bdI3SAq6bP98trV5eTWfLuvsMcIC1YJOF2vfteLFA==", + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/@google-cloud/promisify": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/@google-cloud/promisify/-/promisify-4.0.0.tgz", + "integrity": "sha512-Orxzlfb9c67A15cq2JQEyVc7wEsmFBmHjZWZYQMUyJ1qivXyMwdyNOs9odi79hze+2zqdTtu1E19IM/FtqZ10g==", + "engines": { + "node": ">=14" + } + }, + "node_modules/@grpc/grpc-js": { + "version": "1.14.0", + "resolved": "https://registry.npmjs.org/@grpc/grpc-js/-/grpc-js-1.14.0.tgz", + "integrity": "sha512-N8Jx6PaYzcTRNzirReJCtADVoq4z7+1KQ4E70jTg/koQiMoUSN1kbNjPOqpPbhMFhfU1/l7ixspPl8dNY+FoUg==", + "dependencies": { + "@grpc/proto-loader": "^0.8.0", + "@js-sdsl/ordered-map": "^4.4.2" + }, + "engines": { + "node": ">=12.10.0" + } + }, + "node_modules/@grpc/grpc-js/node_modules/@grpc/proto-loader": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.8.0.tgz", + "integrity": "sha512-rc1hOQtjIWGxcxpb9aHAfLpIctjEnsDehj0DAiVfBlmT84uvR0uUtN2hEi/ecvWVjXUGf5qPF4qEgiLOx1YIMQ==", + "dependencies": { + "lodash.camelcase": "^4.3.0", + "long": "^5.0.0", + "protobufjs": "^7.5.3", + "yargs": "^17.7.2" + }, + "bin": { + "proto-loader-gen-types": "build/bin/proto-loader-gen-types.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@grpc/proto-loader": { + "version": "0.7.15", + "resolved": "https://registry.npmjs.org/@grpc/proto-loader/-/proto-loader-0.7.15.tgz", + "integrity": "sha512-tMXdRCfYVixjuFK+Hk0Q1s38gV9zDiDJfWL3h1rv4Qc39oILCu1TRTDt7+fGUI8K4G1Fj125Hx/ru3azECWTyQ==", + "dependencies": { + "lodash.camelcase": "^4.3.0", + "long": "^5.0.0", + "protobufjs": "^7.2.5", + "yargs": "^17.7.2" + }, + "bin": { + "proto-loader-gen-types": "build/bin/proto-loader-gen-types.js" + }, + "engines": { + "node": ">=6" + } + }, + "node_modules/@js-sdsl/ordered-map": { + "version": "4.4.2", + "resolved": "https://registry.npmjs.org/@js-sdsl/ordered-map/-/ordered-map-4.4.2.tgz", + "integrity": "sha512-iUKgm52T8HOE/makSxjqoWhe95ZJA1/G1sYsGev2JDKUSS14KAgg1LHb+Ba+IPow0xflbnSkOsZcO08C7w1gYw==", + "funding": { + "type": "opencollective", + "url": "https://opencollective.com/js-sdsl" + } + }, "node_modules/@octokit/auth-token": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/@octokit/auth-token/-/auth-token-4.0.0.tgz", @@ -330,6 +481,30 @@ "@opentelemetry/api": ">=1.3.0 <1.10.0" } }, + "node_modules/@opentelemetry/sdk-trace-base": { + "version": "1.30.1", + "resolved": "https://registry.npmjs.org/@opentelemetry/sdk-trace-base/-/sdk-trace-base-1.30.1.tgz", + "integrity": "sha512-jVPgBbH1gCy2Lb7X0AVQ8XAfgg0pJ4nvl8/IiQA6nxOsPvS+0zMJaFSs2ltXe0J6C8dqjcnpyqINDJmU30+uOg==", + "dependencies": { + "@opentelemetry/core": "1.30.1", + "@opentelemetry/resources": "1.30.1", + "@opentelemetry/semantic-conventions": "1.28.0" + }, + "engines": { + "node": ">=14" + }, + "peerDependencies": { + "@opentelemetry/api": ">=1.0.0 <1.10.0" + } + }, + "node_modules/@opentelemetry/sdk-trace-base/node_modules/@opentelemetry/semantic-conventions": { + "version": "1.28.0", + "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.28.0.tgz", + "integrity": "sha512-lp4qAiMTD4sNWW4DbKLBkfiMZ4jbAboJIGOQr5DvciMRI494OapieI9qiODpOt0XBr1LjIDy1xAGAnVs5supTA==", + "engines": { + "node": ">=14" + } + }, "node_modules/@opentelemetry/semantic-conventions": { "version": "1.37.0", "resolved": "https://registry.npmjs.org/@opentelemetry/semantic-conventions/-/semantic-conventions-1.37.0.tgz", @@ -338,6 +513,102 @@ "node": ">=14" } }, + "node_modules/@protobufjs/aspromise": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz", + "integrity": "sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ==" + }, + "node_modules/@protobufjs/base64": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz", + "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg==" + }, + "node_modules/@protobufjs/codegen": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz", + "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg==" + }, + "node_modules/@protobufjs/eventemitter": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz", + "integrity": "sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q==" + }, + "node_modules/@protobufjs/fetch": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz", + "integrity": "sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ==", + "dependencies": { + "@protobufjs/aspromise": "^1.1.1", + "@protobufjs/inquire": "^1.1.0" + } + }, + "node_modules/@protobufjs/float": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz", + "integrity": "sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ==" + }, + "node_modules/@protobufjs/inquire": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz", + "integrity": "sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q==" + }, + "node_modules/@protobufjs/path": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz", + "integrity": "sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA==" + }, + "node_modules/@protobufjs/pool": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz", + "integrity": "sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw==" + }, + "node_modules/@protobufjs/utf8": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", + "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" + }, + "node_modules/@tootallnate/once": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/@tootallnate/once/-/once-2.0.0.tgz", + "integrity": "sha512-XCuKFP5PS55gnMVu3dty8KPatLqUoy/ZYzDzAGCQ8JNFCkLXzmI7vNHCR+XpbZaMWQK/vQubr7PkYq8g470J/A==", + "engines": { + "node": ">= 10" + } + }, + "node_modules/@types/caseless": { + "version": "0.12.5", + "resolved": "https://registry.npmjs.org/@types/caseless/-/caseless-0.12.5.tgz", + "integrity": "sha512-hWtVTC2q7hc7xZ/RLbxapMvDMgUnDvKvMOpKal4DrMyfGBUfB1oKaZlIRr6mJL+If3bAP6sV/QneGzF6tJjZDg==" + }, + "node_modules/@types/long": { + "version": "4.0.2", + "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.2.tgz", + "integrity": "sha512-MqTGEo5bj5t157U6fA/BiDynNkn0YknVdh48CMPkTSpFTVmvao5UQmm7uEF6xBEo7qIMAlY/JSleYaE6VOdpaA==" + }, + "node_modules/@types/node": { + "version": "24.10.0", + "resolved": "https://registry.npmjs.org/@types/node/-/node-24.10.0.tgz", + "integrity": "sha512-qzQZRBqkFsYyaSWXuEHc2WR9c0a0CXwiE5FWUvn7ZM+vdy1uZLfCunD38UzhuB7YN/J11ndbDBcTmOdxJo9Q7A==", + "dependencies": { + "undici-types": "~7.16.0" + } + }, + "node_modules/@types/request": { + "version": "2.48.13", + "resolved": "https://registry.npmjs.org/@types/request/-/request-2.48.13.tgz", + "integrity": "sha512-FGJ6udDNUCjd19pp0Q3iTiDkwhYup7J8hpMW9c4k53NrccQFFWKRho6hvtPPEhnXWKvukfwAlB6DbDz4yhH5Gg==", + "dependencies": { + "@types/caseless": "*", + "@types/node": "*", + "@types/tough-cookie": "*", + "form-data": "^2.5.5" + } + }, + "node_modules/@types/tough-cookie": { + "version": "4.0.5", + "resolved": "https://registry.npmjs.org/@types/tough-cookie/-/tough-cookie-4.0.5.tgz", + "integrity": "sha512-/Ad8+nIOV7Rl++6f1BdKxFSMgmoqEoYbHRpPcx3JEfv8VRsQe9Z4mCXeJBzxs7mbHY/XOZZuXlRNfhpVPbs6ZA==" + }, "node_modules/@vercel/ncc": { "version": "0.38.4", "resolved": "https://registry.npmjs.org/@vercel/ncc/-/ncc-0.38.4.tgz", @@ -347,6 +618,17 @@ "ncc": "dist/ncc/cli.js" } }, + "node_modules/abort-controller": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", + "integrity": "sha512-h8lQ8tacZYnR3vNQTgibj+tODHI5/+l06Au2Pcriv/Gmet0eaj4TwWH41sO9wnHDiQsEj19q0drzdWdeAHtweg==", + "dependencies": { + "event-target-shim": "^5.0.0" + }, + "engines": { + "node": ">=6.5" + } + }, "node_modules/agent-base": { "version": "7.1.4", "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-7.1.4.tgz", @@ -355,6 +637,41 @@ "node": ">= 14" } }, + "node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/arrify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/arrify/-/arrify-2.0.1.tgz", + "integrity": "sha512-3duEwti880xqi4eAMN8AyR4a0ByT90zoYdLlevfrvU43vb0YZwZVfxOgxWrLXXXpyugL0hNZc9G6BiB5B3nUug==", + "engines": { + "node": ">=8" + } + }, + "node_modules/asynckit": { + "version": "0.4.0", + "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz", + "integrity": "sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q==" + }, "node_modules/base64-js": { "version": "1.5.1", "resolved": "https://registry.npmjs.org/base64-js/-/base64-js-1.5.1.tgz", @@ -419,6 +736,46 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/cliui": { + "version": "8.0.1", + "resolved": "https://registry.npmjs.org/cliui/-/cliui-8.0.1.tgz", + "integrity": "sha512-BSeNnyus75C4//NQ9gQt1/csTXyo/8Sb+afLAkzAptFuMsod9HFokGNudZpi/oQV73hnVK+sR+5PVRMd+Dr7YQ==", + "dependencies": { + "string-width": "^4.2.0", + "strip-ansi": "^6.0.1", + "wrap-ansi": "^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/combined-stream": { + "version": "1.0.8", + "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz", + "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==", + "dependencies": { + "delayed-stream": "~1.0.0" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/debug": { "version": "4.4.3", "resolved": "https://registry.npmjs.org/debug/-/debug-4.4.3.tgz", @@ -435,11 +792,33 @@ } } }, + "node_modules/delayed-stream": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz", + "integrity": "sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ==", + "engines": { + "node": ">=0.4.0" + } + }, "node_modules/deprecation": { "version": "2.3.1", "resolved": "https://registry.npmjs.org/deprecation/-/deprecation-2.3.1.tgz", "integrity": "sha512-xmHIy4F3scKVwMsQ4WnVaS8bHOx0DmVwRywosKhaILI0ywMDWPtBSku2HNxRvF7jtwDRsoEwYQSfbxj8b7RlJQ==" }, + "node_modules/dot-prop": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/dot-prop/-/dot-prop-6.0.1.tgz", + "integrity": "sha512-tE7ztYzXHIeyvc7N+hR3oi7FIbf/NIjVP9hmAt3yMXzrQ072/fpjGLx2GxNxGxUl5V73MEqYzioOMoVhGMJ5cA==", + "dependencies": { + "is-obj": "^2.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, "node_modules/dunder-proto": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/dunder-proto/-/dunder-proto-1.0.1.tgz", @@ -453,6 +832,17 @@ "node": ">= 0.4" } }, + "node_modules/duplexify": { + "version": "4.1.3", + "resolved": "https://registry.npmjs.org/duplexify/-/duplexify-4.1.3.tgz", + "integrity": "sha512-M3BmBhwJRZsSx38lZyhE53Csddgzl5R7xGJNk7CVddZD6CcmwMCH8J+7AprIrQKH7TonKxaCjcv27Qmf+sQ+oA==", + "dependencies": { + "end-of-stream": "^1.4.1", + "inherits": "^2.0.3", + "readable-stream": "^3.1.1", + "stream-shift": "^1.0.2" + } + }, "node_modules/ecdsa-sig-formatter": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", @@ -461,6 +851,24 @@ "safe-buffer": "^5.0.1" } }, + "node_modules/ee-first": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz", + "integrity": "sha512-WMwm9LhRUo+WUaRN+vRuETqG89IgZphVSNkdFgeb6sS/E4OrDIN7t48CAewSHXc6C8lefD8KKfr5vY61brQlow==" + }, + "node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "node_modules/end-of-stream": { + "version": "1.4.5", + "resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.5.tgz", + "integrity": "sha512-ooEGc6HP26xXq/N+GCGOT0JKCLDGrq2bQUZrQ7gyrJiZANJ/8YDTxTpQBXGMn+WbIQXNVpyWymm7KYVICQnyOg==", + "dependencies": { + "once": "^1.4.0" + } + }, "node_modules/es-define-property": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/es-define-property/-/es-define-property-1.0.1.tgz", @@ -488,11 +896,76 @@ "node": ">= 0.4" } }, + "node_modules/es-set-tostringtag": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/es-set-tostringtag/-/es-set-tostringtag-2.1.0.tgz", + "integrity": "sha512-j6vWzfrGVfyXxge+O0x5sh6cvxAog0a/4Rdd2K36zCMV5eJ+/+tOAngRO8cODMNWbVRdVlmGZQL2YS3yR8bIUA==", + "dependencies": { + "es-errors": "^1.3.0", + "get-intrinsic": "^1.2.6", + "has-tostringtag": "^1.0.2", + "hasown": "^2.0.2" + }, + "engines": { + "node": ">= 0.4" + } + }, + "node_modules/escalade": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.2.0.tgz", + "integrity": "sha512-WUj2qlxaQtO4g6Pq5c29GTcWGDyd8itL8zTlipgECz3JesAiiOKotd8JU6otB3PACgG6xkJUyVhboMS+bje/jA==", + "engines": { + "node": ">=6" + } + }, + "node_modules/event-target-shim": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/event-target-shim/-/event-target-shim-5.0.1.tgz", + "integrity": "sha512-i/2XbnSz/uxRCU6+NdVJgKWDTM427+MqYbkQzD321DuCQJUqOuJKIA0IM2+W2xtYHdKOmZ4dR6fExsd4SXL+WQ==", + "engines": { + "node": ">=6" + } + }, + "node_modules/eventid": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/eventid/-/eventid-2.0.1.tgz", + "integrity": "sha512-sPNTqiMokAvV048P2c9+foqVJzk49o6d4e0D/sq5jog3pw+4kBgyR0gaM1FM7Mx6Kzd9dztesh9oYz1LWWOpzw==", + "dependencies": { + "uuid": "^8.0.0" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/eventid/node_modules/uuid": { + "version": "8.3.2", + "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.2.tgz", + "integrity": "sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==", + "bin": { + "uuid": "dist/bin/uuid" + } + }, "node_modules/extend": { "version": "3.0.2", "resolved": "https://registry.npmjs.org/extend/-/extend-3.0.2.tgz", "integrity": "sha512-fjquC59cD7CyW6urNXK0FBufkZcoiGG80wTuPujX590cB5Ttln20E2UB4S/WARVqhXffZl2LNgS+gQdPIIim/g==" }, + "node_modules/form-data": { + "version": "2.5.5", + "resolved": "https://registry.npmjs.org/form-data/-/form-data-2.5.5.tgz", + "integrity": "sha512-jqdObeR2rxZZbPSGL+3VckHMYtu+f9//KXBsVny6JSX/pa38Fy+bGjuG8eW/H6USNQWhLi8Num++cU2yOCNz4A==", + "dependencies": { + "asynckit": "^0.4.0", + "combined-stream": "^1.0.8", + "es-set-tostringtag": "^2.1.0", + "hasown": "^2.0.2", + "mime-types": "^2.1.35", + "safe-buffer": "^5.2.1" + }, + "engines": { + "node": ">= 0.12" + } + }, "node_modules/function-bind": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.2.tgz", @@ -529,6 +1002,14 @@ "node": ">=14" } }, + "node_modules/get-caller-file": { + "version": "2.0.5", + "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz", + "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg==", + "engines": { + "node": "6.* || 8.* || >= 10.*" + } + }, "node_modules/get-intrinsic": { "version": "1.3.0", "resolved": "https://registry.npmjs.org/get-intrinsic/-/get-intrinsic-1.3.0.tgz", @@ -580,6 +1061,28 @@ "node": ">=14" } }, + "node_modules/google-gax": { + "version": "4.6.1", + "resolved": "https://registry.npmjs.org/google-gax/-/google-gax-4.6.1.tgz", + "integrity": "sha512-V6eky/xz2mcKfAd1Ioxyd6nmA61gao3n01C+YeuIwu3vzM9EDR6wcVzMSIbLMDXWeoi9SHYctXuKYC5uJUT3eQ==", + "dependencies": { + "@grpc/grpc-js": "^1.10.9", + "@grpc/proto-loader": "^0.7.13", + "@types/long": "^4.0.0", + "abort-controller": "^3.0.0", + "duplexify": "^4.0.0", + "google-auth-library": "^9.3.0", + "node-fetch": "^2.7.0", + "object-hash": "^3.0.0", + "proto3-json-serializer": "^2.0.2", + "protobufjs": "^7.3.2", + "retry-request": "^7.0.0", + "uuid": "^9.0.1" + }, + "engines": { + "node": ">=14" + } + }, "node_modules/google-logging-utils": { "version": "0.0.2", "resolved": "https://registry.npmjs.org/google-logging-utils/-/google-logging-utils-0.0.2.tgz", @@ -650,6 +1153,20 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/has-tostringtag": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/has-tostringtag/-/has-tostringtag-1.0.2.tgz", + "integrity": "sha512-NqADB8VjPFLM2V0VvHUewwwsw0ZWBaIdgo+ieHtK3hasLz4qeCRjYcqfB6AQrBggRKppKF8L52/VqdVsO47Dlw==", + "dependencies": { + "has-symbols": "^1.0.3" + }, + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, "node_modules/hasown": { "version": "2.0.2", "resolved": "https://registry.npmjs.org/hasown/-/hasown-2.0.2.tgz", @@ -661,6 +1178,45 @@ "node": ">= 0.4" } }, + "node_modules/html-entities": { + "version": "2.6.0", + "resolved": "https://registry.npmjs.org/html-entities/-/html-entities-2.6.0.tgz", + "integrity": "sha512-kig+rMn/QOVRvr7c86gQ8lWXq+Hkv6CbAH1hLu+RG338StTpE8Z0b44SDVaqVu7HGKf27frdmUYEs9hTUX/cLQ==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/mdevils" + }, + { + "type": "patreon", + "url": "https://patreon.com/mdevils" + } + ] + }, + "node_modules/http-proxy-agent": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz", + "integrity": "sha512-n2hY8YdoRE1i7r6M0w9DIw5GgZN0G25P8zLCRQ8rjXtTU3vsNFBI/vWK/UIeE6g5MUUz6avwAPXmL6Fy9D/90w==", + "dependencies": { + "@tootallnate/once": "2", + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/http-proxy-agent/node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, "node_modules/https-proxy-agent": { "version": "7.0.6", "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-7.0.6.tgz", @@ -673,6 +1229,27 @@ "node": ">= 14" } }, + "node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/is-obj": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/is-obj/-/is-obj-2.0.0.tgz", + "integrity": "sha512-drqDG3cbczxxEJRoOXcOjtdp1J/lyp1mNn0xaznRs8+muBhgQcrnbspox5X5fOw0HnMnbfDzvnEMEtqDEJEo8w==", + "engines": { + "node": ">=8" + } + }, "node_modules/is-stream": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/is-stream/-/is-stream-2.0.1.tgz", @@ -711,6 +1288,16 @@ "safe-buffer": "^5.0.1" } }, + "node_modules/lodash.camelcase": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/lodash.camelcase/-/lodash.camelcase-4.3.0.tgz", + "integrity": "sha512-TwuEnCnxbc3rAvhf/LbG7tJUDzhqXyFnv3dtzLOPgCG/hODL7WFnsbwktkD7yUV0RrreP/l1PALq/YSg6VvjlA==" + }, + "node_modules/long": { + "version": "5.3.2", + "resolved": "https://registry.npmjs.org/long/-/long-5.3.2.tgz", + "integrity": "sha512-mNAgZ1GmyNhD7AuqnTG3/VQ26o760+ZYBPKjPvugO8+nLbYfX6TVpJPseBvopbdY+qpZ/lKUnmEc1LeZYS3QAA==" + }, "node_modules/math-intrinsics": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/math-intrinsics/-/math-intrinsics-1.1.0.tgz", @@ -719,6 +1306,25 @@ "node": ">= 0.4" } }, + "node_modules/mime-db": { + "version": "1.52.0", + "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.52.0.tgz", + "integrity": "sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg==", + "engines": { + "node": ">= 0.6" + } + }, + "node_modules/mime-types": { + "version": "2.1.35", + "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.35.tgz", + "integrity": "sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw==", + "dependencies": { + "mime-db": "1.52.0" + }, + "engines": { + "node": ">= 0.6" + } + }, "node_modules/ms": { "version": "2.1.3", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz", @@ -743,6 +1349,14 @@ } } }, + "node_modules/object-hash": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-3.0.0.tgz", + "integrity": "sha512-RSn9F68PjH9HqtltsSnqYC1XXoWe9Bju5+213R98cNGttag9q9yAOTzdbsqvIa7aNm5WffBZFpWYr2aWrklWAw==", + "engines": { + "node": ">= 6" + } + }, "node_modules/object-inspect": { "version": "1.13.4", "resolved": "https://registry.npmjs.org/object-inspect/-/object-inspect-1.13.4.tgz", @@ -754,6 +1368,17 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/on-finished": { + "version": "2.4.1", + "resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.4.1.tgz", + "integrity": "sha512-oVlzkg3ENAhCk2zdv7IJwd/QUD4z2RxRwpkcGY8psCVcCYZNq4wYnVWALHM+brtuJjePWiYF/ClmuDr8Ch5+kg==", + "dependencies": { + "ee-first": "1.1.1" + }, + "engines": { + "node": ">= 0.8" + } + }, "node_modules/once": { "version": "1.4.0", "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", @@ -762,6 +1387,59 @@ "wrappy": "1" } }, + "node_modules/proto3-json-serializer": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/proto3-json-serializer/-/proto3-json-serializer-2.0.2.tgz", + "integrity": "sha512-SAzp/O4Yh02jGdRc+uIrGoe87dkN/XtwxfZ4ZyafJHymd79ozp5VG5nyZ7ygqPM5+cpLDjjGnYFUkngonyDPOQ==", + "dependencies": { + "protobufjs": "^7.2.5" + }, + "engines": { + "node": ">=14.0.0" + } + }, + "node_modules/protobufjs": { + "version": "7.5.4", + "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-7.5.4.tgz", + "integrity": "sha512-CvexbZtbov6jW2eXAvLukXjXUW1TzFaivC46BpWc/3BpcCysb5Vffu+B3XHMm8lVEuy2Mm4XGex8hBSg1yapPg==", + "hasInstallScript": true, + "dependencies": { + "@protobufjs/aspromise": "^1.1.2", + "@protobufjs/base64": "^1.1.2", + "@protobufjs/codegen": "^2.0.4", + "@protobufjs/eventemitter": "^1.1.0", + "@protobufjs/fetch": "^1.1.0", + "@protobufjs/float": "^1.0.2", + "@protobufjs/inquire": "^1.1.0", + "@protobufjs/path": "^1.1.2", + "@protobufjs/pool": "^1.1.0", + "@protobufjs/utf8": "^1.1.0", + "@types/node": ">=13.7.0", + "long": "^5.0.0" + }, + "engines": { + "node": ">=12.0.0" + } + }, + "node_modules/pump": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/pump/-/pump-3.0.3.tgz", + "integrity": "sha512-todwxLMY7/heScKmntwQG8CXVkWUOdYxIvY2s0VWAAMh/nd8SoYiRaKjlr7+iCs984f2P8zvrfWcDDYVb73NfA==", + "dependencies": { + "end-of-stream": "^1.1.0", + "once": "^1.3.1" + } + }, + "node_modules/pumpify": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/pumpify/-/pumpify-2.0.1.tgz", + "integrity": "sha512-m7KOje7jZxrmutanlkS1daj1dS6z6BgslzOXmcSEpIlCxM3VJH7lG5QLeck/6hgF6F4crFf01UtQmNsJfweTAw==", + "dependencies": { + "duplexify": "^4.1.1", + "inherits": "^2.0.3", + "pump": "^3.0.0" + } + }, "node_modules/qs": { "version": "6.14.0", "resolved": "https://registry.npmjs.org/qs/-/qs-6.14.0.tgz", @@ -776,6 +1454,40 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/readable-stream": { + "version": "3.6.2", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-3.6.2.tgz", + "integrity": "sha512-9u/sniCrY3D5WdsERHzHE4G2YCXqoG5FTHUiCC4SIbr6XcLZBY05ya9EKjYek9O5xOAwjGq+1JdGBAS7Q9ScoA==", + "dependencies": { + "inherits": "^2.0.3", + "string_decoder": "^1.1.1", + "util-deprecate": "^1.0.1" + }, + "engines": { + "node": ">= 6" + } + }, + "node_modules/require-directory": { + "version": "2.1.1", + "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz", + "integrity": "sha512-fGxEI7+wsG9xrvdjsrlmL22OMTTiHRwAMroiEeMgq8gzoLC/PQr7RsRDSTLUg/bZAZtF+TVIkHc6/4RIKrui+Q==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/retry-request": { + "version": "7.0.2", + "resolved": "https://registry.npmjs.org/retry-request/-/retry-request-7.0.2.tgz", + "integrity": "sha512-dUOvLMJ0/JJYEn8NrpOaGNE7X3vpI5XlZS/u0ANjqtcZVKnIxP7IgCFwrKTxENw29emmwug53awKtaMm4i9g5w==", + "dependencies": { + "@types/request": "^2.48.8", + "extend": "^3.0.2", + "teeny-request": "^9.0.0" + }, + "engines": { + "node": ">=14" + } + }, "node_modules/safe-buffer": { "version": "5.2.1", "resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz", @@ -863,6 +1575,94 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/stream-events": { + "version": "1.0.5", + "resolved": "https://registry.npmjs.org/stream-events/-/stream-events-1.0.5.tgz", + "integrity": "sha512-E1GUzBSgvct8Jsb3v2X15pjzN1tYebtbLaMg+eBOUOAxgbLoSbT2NS91ckc5lJD1KfLjId+jXJRgo0qnV5Nerg==", + "dependencies": { + "stubs": "^3.0.0" + } + }, + "node_modules/stream-shift": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/stream-shift/-/stream-shift-1.0.3.tgz", + "integrity": "sha512-76ORR0DO1o1hlKwTbi/DM3EXWGf3ZJYO8cXX5RJwnul2DEg2oyoZyjLNoQM8WsvZiFKCRfC1O0J7iCvie3RZmQ==" + }, + "node_modules/string_decoder": { + "version": "1.3.0", + "resolved": "https://registry.npmjs.org/string_decoder/-/string_decoder-1.3.0.tgz", + "integrity": "sha512-hkRX8U1WjJFd8LsDJ2yQ/wWWxaopEsABU1XfkM8A+j0+85JAGppt16cr1Whg6KIbb4okU6Mql6BOj+uup/wKeA==", + "dependencies": { + "safe-buffer": "~5.2.0" + } + }, + "node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/stubs": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/stubs/-/stubs-3.0.0.tgz", + "integrity": "sha512-PdHt7hHUJKxvTCgbKX9C1V/ftOcjJQgz8BZwNfV5c4B6dcGqlpelTbJ999jBGZ2jYiPAwcX5dP6oBwVlBlUbxw==" + }, + "node_modules/teeny-request": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/teeny-request/-/teeny-request-9.0.0.tgz", + "integrity": "sha512-resvxdc6Mgb7YEThw6G6bExlXKkv6+YbuzGg9xuXxSgxJF7Ozs+o8Y9+2R3sArdWdW8nOokoQb1yrpFB0pQK2g==", + "dependencies": { + "http-proxy-agent": "^5.0.0", + "https-proxy-agent": "^5.0.0", + "node-fetch": "^2.6.9", + "stream-events": "^1.0.5", + "uuid": "^9.0.0" + }, + "engines": { + "node": ">=14" + } + }, + "node_modules/teeny-request/node_modules/agent-base": { + "version": "6.0.2", + "resolved": "https://registry.npmjs.org/agent-base/-/agent-base-6.0.2.tgz", + "integrity": "sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==", + "dependencies": { + "debug": "4" + }, + "engines": { + "node": ">= 6.0.0" + } + }, + "node_modules/teeny-request/node_modules/https-proxy-agent": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/https-proxy-agent/-/https-proxy-agent-5.0.1.tgz", + "integrity": "sha512-dFcAjpTQFgoLMzC2VwU+C/CbS7uRL0lWmxDITmqm7C+7F0Odmj6s9l6alZc6AELXhrnggM2CeWSXHGOdX2YtwA==", + "dependencies": { + "agent-base": "6", + "debug": "4" + }, + "engines": { + "node": ">= 6" + } + }, "node_modules/tr46": { "version": "0.0.3", "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz", @@ -887,6 +1687,11 @@ "node": ">=14.0" } }, + "node_modules/undici-types": { + "version": "7.16.0", + "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-7.16.0.tgz", + "integrity": "sha512-Zz+aZWSj8LE6zoxD+xrjh4VfkIG8Ya6LvYkZqtUQGJPZjYl53ypCaUwWqo7eI0x66KBGeRo+mlBEkMSeSZ38Nw==" + }, "node_modules/universal-user-agent": { "version": "6.0.1", "resolved": "https://registry.npmjs.org/universal-user-agent/-/universal-user-agent-6.0.1.tgz", @@ -897,6 +1702,11 @@ "resolved": "https://registry.npmjs.org/url-template/-/url-template-2.0.8.tgz", "integrity": "sha512-XdVKMF4SJ0nP/O7XIPB0JwAEuT9lDIYnNsK8yGVe43y0AWoKeJNdv3ZNWh7ksJ6KqQFjOO6ox/VEitLnaVNufw==" }, + "node_modules/util-deprecate": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/util-deprecate/-/util-deprecate-1.0.2.tgz", + "integrity": "sha512-EPD5q1uXyFxJpCrLnCc1nHnq3gOa6DZBocAIiI2TaSCA7VCJ1UJDMagCzIkXNsUYfD1daK//LTEQ8xiIbrHtcw==" + }, "node_modules/uuid": { "version": "9.0.1", "resolved": "https://registry.npmjs.org/uuid/-/uuid-9.0.1.tgz", @@ -923,10 +1733,59 @@ "webidl-conversions": "^3.0.0" } }, + "node_modules/wrap-ansi": { + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "node_modules/y18n": { + "version": "5.0.8", + "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.8.tgz", + "integrity": "sha512-0pfFzegeDWJHJIAmTLRP2DwHjdF5s7jo9tuztdQxAhINCdvS+3nGINqPd00AphqJR/0LhANUS6/+7SCb98YOfA==", + "engines": { + "node": ">=10" + } + }, + "node_modules/yargs": { + "version": "17.7.2", + "resolved": "https://registry.npmjs.org/yargs/-/yargs-17.7.2.tgz", + "integrity": "sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==", + "dependencies": { + "cliui": "^8.0.1", + "escalade": "^3.1.1", + "get-caller-file": "^2.0.5", + "require-directory": "^2.1.1", + "string-width": "^4.2.3", + "y18n": "^5.0.5", + "yargs-parser": "^21.1.1" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/yargs-parser": { + "version": "21.1.1", + "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-21.1.1.tgz", + "integrity": "sha512-tVpsJW7DdjecAiFpbIB1e3qxIQsE6NoPc5/eTdrbbIC4h0LVsWhnoa3g+m2HclBIujHzsxZ4VJVA+GUuc2/LBw==", + "engines": { + "node": ">=12" + } } } } diff --git a/package.json b/package.json index 6c1f703..5f85c9c 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "otel-action", "version": "1.0.0", - "description": "GitHub Action that collects workflow step metrics and exports them to OpenTelemetry/Google Cloud Monitoring", + "description": "GitHub Action that exports complete workflow observability (metrics, traces, and detailed logs with accurate timestamps) to Google Cloud", "main": "index.js", "scripts": { "test": "node --test test/collector.test.js test/exporter.test.js", @@ -18,10 +18,13 @@ "dependencies": { "@actions/core": "^1.11.1", "@actions/github": "^6.0.0", + "@google-cloud/logging": "^11.2.0", "@google-cloud/opentelemetry-cloud-monitoring-exporter": "^0.19.0", + "@google-cloud/opentelemetry-cloud-trace-exporter": "^2.4.1", "@opentelemetry/api": "^1.9.0", "@opentelemetry/resources": "^1.28.0", "@opentelemetry/sdk-metrics": "^1.28.0", + "@opentelemetry/sdk-trace-base": "^1.28.0", "@opentelemetry/semantic-conventions": "^1.28.0", "google-auth-library": "^9.15.0" }, diff --git a/post.js b/post.js index 43050c6..a03f243 100644 --- a/post.js +++ b/post.js @@ -1,18 +1,28 @@ const core = require('@actions/core'); const github = require('@actions/github'); const { getConfig } = require('./lib/config'); -const { collectMetrics } = require('./lib/collector'); -const { createMeterProvider, recordMetrics, shutdown } = require('./lib/exporter'); +const { collectMetrics, collectLogs } = require('./lib/collector'); +const { + createMeterProvider, + recordMetrics, + shutdown, + createTracerProvider, + recordTraces, + shutdownTracer, + createLogger, + recordLogs, +} = require('./lib/exporter'); /** * Post-action entry point - * Collects workflow metrics and exports them to Google Cloud Monitoring + * Collects workflow metrics/traces/logs and exports them to Google Cloud */ async function run() { let meterProvider; + let tracerProvider; try { - core.info('Starting OpenTelemetry metrics collection post-action'); + core.info('Starting OpenTelemetry data collection post-action'); // Get configuration const config = await getConfig(); @@ -24,16 +34,32 @@ async function run() { // Collect metrics from GitHub API const metrics = await collectMetrics(octokit, github.context); - // Initialize OpenTelemetry and export metrics + // Collect detailed job logs + const logLines = await collectLogs(octokit, github.context, metrics.job.id); + + // Initialize OpenTelemetry providers and Cloud Logging const { meterProvider: provider, meter } = createMeterProvider(config); meterProvider = provider; + const { tracerProvider: tProvider, tracer } = createTracerProvider(config); + tracerProvider = tProvider; + + const { log } = createLogger(config); + + // Record metrics recordMetrics(meter, metrics, config.metricPrefix); - // Force flush and shutdown to ensure metrics are exported - await shutdown(meterProvider); + // Record traces + recordTraces(tracer, metrics); - core.info('Metrics successfully exported to Google Cloud Monitoring'); + // Record logs (with detailed log lines if available) + await recordLogs(log, metrics, logLines); + + // Force flush and shutdown to ensure data is exported + await shutdown(meterProvider); + await shutdownTracer(tracerProvider); + + core.info('✓ Metrics, traces, and logs successfully exported to Google Cloud'); } catch (error) { core.error(`Post-action failed: ${error.message}`); core.error(error.stack); @@ -43,12 +69,20 @@ async function run() { try { await shutdown(meterProvider); } catch (shutdownError) { - core.error(`Error during shutdown: ${shutdownError.message}`); + core.error(`Error during metrics shutdown: ${shutdownError.message}`); } } - // Don't fail the workflow if metrics export fails - core.warning('Metrics export failed, but workflow will continue'); + if (tracerProvider) { + try { + await shutdownTracer(tracerProvider); + } catch (shutdownError) { + core.error(`Error during trace shutdown: ${shutdownError.message}`); + } + } + + // Don't fail the workflow if export fails + core.warning('Telemetry export failed, but workflow will continue'); } }