Skip to content

Commit

Permalink
feat!: drop node8 support, support for async iterators (#364)
Browse files Browse the repository at this point in the history
BREAKING CHANGE: The library now supports Node.js v10+. The last version to support Node.js v8 is tagged legacy-8 on npm.
  • Loading branch information
alexander-fenster authored and Ace Nassri committed Nov 14, 2022
1 parent 899bbd4 commit 297faeb
Show file tree
Hide file tree
Showing 106 changed files with 430 additions and 416 deletions.
4 changes: 2 additions & 2 deletions automl/batch_predict.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function main(
// const outputUri = 'gs://YOUR_BUCKET_ID/path_to_save_results/';

// Imports the Google Cloud AutoML library
const {PredictionServiceClient} = require(`@google-cloud/automl`).v1;
const {PredictionServiceClient} = require('@google-cloud/automl').v1;

// Instantiates a client
const client = new PredictionServiceClient();
Expand All @@ -55,7 +55,7 @@ function main(

const [operation] = await client.batchPredict(request);

console.log(`Waiting for operation to complete...`);
console.log('Waiting for operation to complete...');
// Wait for operation to complete.
const [response] = await operation.promise();
console.log(
Expand Down
4 changes: 2 additions & 2 deletions automl/beta/batch_predict.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function main(
// const outputUri = 'gs://YOUR_BUCKET_ID/path_to_save_results/';

// Imports the Google Cloud AutoML library
const {PredictionServiceClient} = require(`@google-cloud/automl`).v1beta1;
const {PredictionServiceClient} = require('@google-cloud/automl').v1beta1;

// Instantiates a client
const client = new PredictionServiceClient();
Expand All @@ -55,7 +55,7 @@ function main(

const [operation] = await client.batchPredict(request);

console.log(`Waiting for operation to complete...`);
console.log('Waiting for operation to complete...');
// Wait for operation to complete.
const [response] = await operation.promise();
console.log(
Expand Down
2 changes: 1 addition & 1 deletion automl/beta/delete-dataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function main(
// const datasetId = 'YOUR_DATASET_ID';

// Imports the Google Cloud AutoML library
const {AutoMlClient} = require(`@google-cloud/automl`).v1beta1;
const {AutoMlClient} = require('@google-cloud/automl').v1beta1;

// Instantiates a client
const client = new AutoMlClient();
Expand Down
2 changes: 1 addition & 1 deletion automl/beta/delete-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function main(
// const modelId = 'YOUR_MODEL_ID';

// Imports the Google Cloud AutoML library
const {AutoMlClient} = require(`@google-cloud/automl`).v1beta1;
const {AutoMlClient} = require('@google-cloud/automl').v1beta1;

// Instantiates a client
const client = new AutoMlClient();
Expand Down
4 changes: 2 additions & 2 deletions automl/beta/get-model-evaluation.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ function main(
// const modelEvaluationId = 'YOUR_MODEL_EVALUATION_ID';

// Imports the Google Cloud AutoML library
const {AutoMlClient} = require(`@google-cloud/automl`).v1beta1;
const {AutoMlClient} = require('@google-cloud/automl').v1beta1;

// Instantiates a client
const client = new AutoMlClient();
Expand All @@ -52,7 +52,7 @@ function main(
console.log(`Model evaluation name: ${response.name}`);
console.log(`Model annotation spec id: ${response.annotationSpecId}`);
console.log(`Model display name: ${response.displayName}`);
console.log(`Model create time`);
console.log('Model create time');
console.log(`\tseconds ${response.createTime.seconds}`);
console.log(`\tnanos ${response.createTime.nanos / 1e9}`);
console.log(`Evaluation example count: ${response.evaluatedExampleCount}`);
Expand Down
4 changes: 2 additions & 2 deletions automl/beta/get-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function main(
// const modelId = 'YOUR_MODEL_ID';

// Imports the Google Cloud AutoML library
const {AutoMlClient} = require(`@google-cloud/automl`).v1beta1;
const {AutoMlClient} = require('@google-cloud/automl').v1beta1;

// Instantiates a client
const client = new AutoMlClient();
Expand All @@ -48,7 +48,7 @@ function main(
}`
);
console.log(`Model display name: ${response.displayName}`);
console.log(`Model create time`);
console.log('Model create time');
console.log(`\tseconds ${response.createTime.seconds}`);
console.log(`\tnanos ${response.createTime.nanos / 1e9}`);
console.log(`Model deployment state: ${response.deploymentState}`);
Expand Down
4 changes: 2 additions & 2 deletions automl/beta/get-operation-status.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function main(
// const operationId = 'YOUR_OPERATION_ID';

// Imports the Google Cloud AutoML library
const {AutoMlClient} = require(`@google-cloud/automl`).v1beta1;
const {AutoMlClient} = require('@google-cloud/automl').v1beta1;

// Instantiates a client
const client = new AutoMlClient();
Expand All @@ -42,7 +42,7 @@ function main(
const [response] = await client.operationsClient.getOperation(request);

console.log(`Name: ${response.name}`);
console.log(`Operation details:`);
console.log('Operation details:');
console.log(response);
}

Expand Down
4 changes: 2 additions & 2 deletions automl/beta/import-dataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function main(
// const path = 'gs://BUCKET_ID/path_to_training_data.csv';

// Imports the Google Cloud AutoML library
const {AutoMlClient} = require(`@google-cloud/automl`).v1beta1;
const {AutoMlClient} = require('@google-cloud/automl').v1beta1;

// Instantiates a client
const client = new AutoMlClient();
Expand All @@ -47,7 +47,7 @@ function main(
};

// Import dataset
console.log(`Proccessing import`);
console.log('Proccessing import');
const [operation] = await client.importData(request);

// Wait for operation to complete.
Expand Down
6 changes: 3 additions & 3 deletions automl/beta/list-datasets.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ function main(projectId = 'YOUR_PROJECT_ID', location = 'us-central1') {
// const location = 'us-central1';

// Imports the Google Cloud AutoML library
const {AutoMlClient} = require(`@google-cloud/automl`).v1beta1;
const {AutoMlClient} = require('@google-cloud/automl').v1beta1;

// Instantiates a client
const client = new AutoMlClient();
Expand All @@ -38,7 +38,7 @@ function main(projectId = 'YOUR_PROJECT_ID', location = 'us-central1') {

const [response] = await client.listDatasets(request);

console.log(`List of datasets:`);
console.log('List of datasets:');
for (const dataset of response) {
console.log(`Dataset name: ${dataset.name}`);
console.log(
Expand All @@ -47,7 +47,7 @@ function main(projectId = 'YOUR_PROJECT_ID', location = 'us-central1') {
}`
);
console.log(`Dataset display name: ${dataset.displayName}`);
console.log(`Dataset create time`);
console.log('Dataset create time');
console.log(`\tseconds ${dataset.createTime.seconds}`);
console.log(`\tnanos ${dataset.createTime.nanos / 1e9}`);

Expand Down
6 changes: 3 additions & 3 deletions automl/beta/list-models.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ function main(projectId = 'YOUR_PROJECT_ID', location = 'us-central1') {
// const location = 'us-central1';

// Imports the Google Cloud AutoML library
const {AutoMlClient} = require(`@google-cloud/automl`).v1beta1;
const {AutoMlClient} = require('@google-cloud/automl').v1beta1;

// Instantiates a client
const client = new AutoMlClient();
Expand All @@ -37,13 +37,13 @@ function main(projectId = 'YOUR_PROJECT_ID', location = 'us-central1') {

const [response] = await client.listModels(request);

console.log(`List of models:`);
console.log('List of models:');
for (const model of response) {
console.log(`Model name: ${model.name}`);
console.log(`
Model id: ${model.name.split('/')[model.name.split('/').length - 1]}`);
console.log(`Model display name: ${model.displayName}`);
console.log(`Model create time`);
console.log('Model create time');
console.log(`\tseconds ${model.createTime.seconds}`);
console.log(`\tnanos ${model.createTime.nanos / 1e9}`);
console.log(`Model deployment state: ${model.deploymentState}`);
Expand Down
2 changes: 1 addition & 1 deletion automl/beta/video-classification-create-dataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function main(
// const displayName = 'YOUR_DISPLAY_NAME';

// Imports the Google Cloud AutoML library
const {AutoMlClient} = require(`@google-cloud/automl`).v1beta1;
const {AutoMlClient} = require('@google-cloud/automl').v1beta1;

// Instantiates a client
const client = new AutoMlClient();
Expand Down
2 changes: 1 addition & 1 deletion automl/beta/video-classification-create-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function main(
// const displayName = 'YOUR_DISPLAY_NAME';

// Imports the Google Cloud AutoML library
const {AutoMlClient} = require(`@google-cloud/automl`).v1beta1;
const {AutoMlClient} = require('@google-cloud/automl').v1beta1;

// Instantiates a client
const client = new AutoMlClient();
Expand Down
2 changes: 1 addition & 1 deletion automl/beta/video-object-tracking-create-dataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function main(
// const displayName = 'YOUR_DISPLAY_NAME';

// Imports the Google Cloud AutoML library
const {AutoMlClient} = require(`@google-cloud/automl`).v1beta1;
const {AutoMlClient} = require('@google-cloud/automl').v1beta1;

// Instantiates a client
const client = new AutoMlClient();
Expand Down
2 changes: 1 addition & 1 deletion automl/beta/video-object-tracking-create-model.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function main(
// const displayName = 'YOUR_DISPLAY_NAME';

// Imports the Google Cloud AutoML library
const {AutoMlClient} = require(`@google-cloud/automl`).v1beta1;
const {AutoMlClient} = require('@google-cloud/automl').v1beta1;

// Instantiates a client
const client = new AutoMlClient();
Expand Down
2 changes: 1 addition & 1 deletion automl/delete_dataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function main(
// const datasetId = 'YOUR_DATASET_ID';

// Imports the Google Cloud AutoML library
const {AutoMlClient} = require(`@google-cloud/automl`).v1;
const {AutoMlClient} = require('@google-cloud/automl').v1;

// Instantiates a client
const client = new AutoMlClient();
Expand Down
2 changes: 1 addition & 1 deletion automl/delete_model.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function main(
// const modelId = 'YOUR_MODEL_ID';

// Imports the Google Cloud AutoML library
const {AutoMlClient} = require(`@google-cloud/automl`).v1;
const {AutoMlClient} = require('@google-cloud/automl').v1;

// Instantiates a client
const client = new AutoMlClient();
Expand Down
2 changes: 1 addition & 1 deletion automl/deploy_model.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function main(
// const modelId = 'YOUR_MODEL_ID';

// Imports the Google Cloud AutoML library
const {AutoMlClient} = require(`@google-cloud/automl`).v1;
const {AutoMlClient} = require('@google-cloud/automl').v1;

// Instantiates a client
const client = new AutoMlClient();
Expand Down
2 changes: 1 addition & 1 deletion automl/export_dataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function main(
// const gcsUri = 'gs://BUCKET_ID/path_to_export/';

// Imports the Google Cloud AutoML library
const {AutoMlClient} = require(`@google-cloud/automl`).v1;
const {AutoMlClient} = require('@google-cloud/automl').v1;

// Instantiates a client
const client = new AutoMlClient();
Expand Down
6 changes: 3 additions & 3 deletions automl/get_dataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function main(
// const datasetId = 'YOUR_DATASET_ID';

// Imports the Google Cloud AutoML library
const {AutoMlClient} = require(`@google-cloud/automl`).v1;
const {AutoMlClient} = require('@google-cloud/automl').v1;

// Instantiates a client
const client = new AutoMlClient();
Expand All @@ -53,7 +53,7 @@ function main(
}`
);
console.log(`Dataset display name: ${response.displayName}`);
console.log(`Dataset create time`);
console.log('Dataset create time');
console.log(`\tseconds ${response.createTime.seconds}`);
console.log(`\tnanos ${response.createTime.nanos / 1e9}`);
// [END automl_language_sentiment_analysis_get_dataset]
Expand All @@ -80,7 +80,7 @@ function main(

// [START automl_translate_get_dataset]
if (response.translationDatasetMetadata !== undefined) {
console.log(`Translation dataset metadata:`);
console.log('Translation dataset metadata:');
console.log(
`\tSource language code: ${response.translationDatasetMetadata.sourceLanguageCode}`
);
Expand Down
4 changes: 2 additions & 2 deletions automl/get_model.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function main(
// const modelId = 'YOUR_MODEL_ID';

// Imports the Google Cloud AutoML library
const {AutoMlClient} = require(`@google-cloud/automl`).v1;
const {AutoMlClient} = require('@google-cloud/automl').v1;

// Instantiates a client
const client = new AutoMlClient();
Expand All @@ -48,7 +48,7 @@ function main(
}`
);
console.log(`Model display name: ${response.displayName}`);
console.log(`Model create time`);
console.log('Model create time');
console.log(`\tseconds ${response.createTime.seconds}`);
console.log(`\tnanos ${response.createTime.nanos / 1e9}`);
console.log(`Model deployment state: ${response.deploymentState}`);
Expand Down
4 changes: 2 additions & 2 deletions automl/get_model_evaluation.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ function main(
// const modelEvaluationId = 'YOUR_MODEL_EVALUATION_ID';

// Imports the Google Cloud AutoML library
const {AutoMlClient} = require(`@google-cloud/automl`).v1;
const {AutoMlClient} = require('@google-cloud/automl').v1;

// Instantiates a client
const client = new AutoMlClient();
Expand All @@ -56,7 +56,7 @@ function main(
console.log(`Model evaluation name: ${response.name}`);
console.log(`Model annotation spec id: ${response.annotationSpecId}`);
console.log(`Model display name: ${response.displayName}`);
console.log(`Model create time`);
console.log('Model create time');
console.log(`\tseconds ${response.createTime.seconds}`);
console.log(`\tnanos ${response.createTime.nanos / 1e9}`);
console.log(`Evaluation example count: ${response.evaluatedExampleCount}`);
Expand Down
4 changes: 2 additions & 2 deletions automl/get_operation_status.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function main(
// const operationId = 'YOUR_OPERATION_ID';

// Imports the Google Cloud AutoML library
const {AutoMlClient} = require(`@google-cloud/automl`).v1;
const {AutoMlClient} = require('@google-cloud/automl').v1;

// Instantiates a client
const client = new AutoMlClient();
Expand All @@ -42,7 +42,7 @@ function main(
const [response] = await client.operationsClient.getOperation(request);

console.log(`Name: ${response.name}`);
console.log(`Operation details:`);
console.log('Operation details:');
console.log(`${response}`);
}

Expand Down
4 changes: 2 additions & 2 deletions automl/import_dataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function main(
// const path = 'gs://BUCKET_ID/path_to_training_data.csv';

// Imports the Google Cloud AutoML library
const {AutoMlClient} = require(`@google-cloud/automl`).v1;
const {AutoMlClient} = require('@google-cloud/automl').v1;

// Instantiates a client
const client = new AutoMlClient();
Expand All @@ -47,7 +47,7 @@ function main(
};

// Import dataset
console.log(`Proccessing import`);
console.log('Proccessing import');
const [operation] = await client.importData(request);

// Wait for operation to complete.
Expand Down
2 changes: 1 addition & 1 deletion automl/language_entity_extraction_create_dataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function main(
// const displayName = 'YOUR_DISPLAY_NAME';

// Imports the Google Cloud AutoML library
const {AutoMlClient} = require(`@google-cloud/automl`).v1;
const {AutoMlClient} = require('@google-cloud/automl').v1;

// Instantiates a client
const client = new AutoMlClient();
Expand Down
2 changes: 1 addition & 1 deletion automl/language_entity_extraction_create_model.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function main(
// const displayName = 'YOUR_DISPLAY_NAME';

// Imports the Google Cloud AutoML library
const {AutoMlClient} = require(`@google-cloud/automl`).v1;
const {AutoMlClient} = require('@google-cloud/automl').v1;

// Instantiates a client
const client = new AutoMlClient();
Expand Down
2 changes: 1 addition & 1 deletion automl/language_entity_extraction_predict.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function main(
// const content = 'text to predict'

// Imports the Google Cloud AutoML library
const {PredictionServiceClient} = require(`@google-cloud/automl`).v1;
const {PredictionServiceClient} = require('@google-cloud/automl').v1;

// Instantiates a client
const client = new PredictionServiceClient();
Expand Down
2 changes: 1 addition & 1 deletion automl/language_sentiment_analysis_create_dataset.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ function main(
// const displayName = 'YOUR_DISPLAY_NAME';

// Imports the Google Cloud AutoML library
const {AutoMlClient} = require(`@google-cloud/automl`).v1;
const {AutoMlClient} = require('@google-cloud/automl').v1;

// Instantiates a client
const client = new AutoMlClient();
Expand Down
2 changes: 1 addition & 1 deletion automl/language_sentiment_analysis_create_model.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function main(
// const displayName = 'YOUR_DISPLAY_NAME';

// Imports the Google Cloud AutoML library
const {AutoMlClient} = require(`@google-cloud/automl`).v1;
const {AutoMlClient} = require('@google-cloud/automl').v1;

// Instantiates a client
const client = new AutoMlClient();
Expand Down
Loading

0 comments on commit 297faeb

Please sign in to comment.