|
| 1 | +# Upgrading to ibm-watson@6.0 |
| 2 | + |
| 3 | +_Note: If migrating from a version less than 5.0, also see the [v5 migration guide wiki](https://github.com/watson-developer-cloud/node-sdk/wiki/v5-Migration-Guide)._ |
| 4 | + |
| 5 | +- [Breaking Changes](#breaking-changes) |
| 6 | + - [Support for callbacks dropped](#support-for-callbacks-dropped) |
| 7 | + - [Support for Node v10 dropped](#support-for-node-v10-dropped) |
| 8 | + - [Breaking changes by service](#breaking-changes-by-service) |
| 9 | + |
| 10 | +- [New Features by Service](#new-features-by-service) |
| 11 | + |
| 12 | +## Breaking changes |
| 13 | + |
| 14 | +#### Promises |
| 15 | +The detailed response is always returned. The `return_response` parameter is removed. |
| 16 | +```js |
| 17 | +const response = await listWorkspaces(); |
| 18 | +console.log(response.result); // prints the body |
| 19 | +console.log(response.headers); // prints the headers |
| 20 | +``` |
| 21 | + |
| 22 | +#### Support for Callbacks Dropped |
| 23 | +Support for callbacks has been dropped in favor of promises. All functions will no longer accept a callback parameter. An example of replacing a callback with a promise using `await` is shown below |
| 24 | +```js |
| 25 | +//Callback |
| 26 | +const assistant = new AssistantV2(options); |
| 27 | +assistant.message(params, (err, res) => { |
| 28 | + if(err){ |
| 29 | + console.log(err) //Print out error |
| 30 | + return |
| 31 | + } |
| 32 | + console.log(res.result) //Print out body |
| 33 | +}); |
| 34 | +``` |
| 35 | +```js |
| 36 | +//Promise |
| 37 | +const assistant = new AssistantV2(options); |
| 38 | +try{ |
| 39 | + await res = assistant.message(params); |
| 40 | + console.log(res.result) //Print out body |
| 41 | +} catch(err){ |
| 42 | + console.log(err) //Print out error |
| 43 | +} |
| 44 | + |
| 45 | +``` |
| 46 | + |
| 47 | +### Support for Node v10 Dropped |
| 48 | +The SDK no longer supports Node version 10, as reflected in the `engines` property in the package.json file. Version 6 reached end of life in April 2019 and Version 8 reaches end of life on 31 December 2019. |
| 49 | + |
| 50 | +### Breaking changes by service |
| 51 | +#### Assistant v1 |
| 52 | +- Parameter `context` type changed from `JsonObject` to `DialogNodeContext` in `createDialogNode()` |
| 53 | +- Parameter `newContext` type changed from `JsonObject` to `DialogNodeContext` in `updateDialogNode()` |
| 54 | +- Interface `Context` property `system` type changed from `SystemResponse` to `JsonObject` |
| 55 | +- Interface `DialogNode` property `context` type changed from `JsonObject` to `DialogNodeContext` |
| 56 | +- Interface `DialogSuggestion` property `output` type changed from `DialogSuggestionOutput` to `JsonObject` |
| 57 | +- Interface `SystemResponse` removed |
| 58 | +- Interface `DialogSuggestionOuput` removed |
| 59 | +- Interface `DialogNodeOutputGeneric` expanded into multiple interfaces |
| 60 | +- Interface `RuntimeResponseGeneric` expanded into multiple interfaces |
| 61 | + |
| 62 | +#### Assistant v2 |
| 63 | +- Interface `MessageContext` property `skills` type changed from `MessageContextSkills` to `JsonObject` |
| 64 | +- Interface `MessageContextStateless` property `skills` type changed from `MessageContextSkills` to `JsonObject` |
| 65 | +- Interface `MessageInputOptions` property `_export` renamed to `export` |
| 66 | +- Interface `MessageContextSkills` removed |
| 67 | +- Interface `RuntimeResponseGeneric` expanded into multiple interfaces |
| 68 | + |
| 69 | +#### Compare Comply |
| 70 | +- Parameter `before` and `after` removed in `listFeedback()` |
| 71 | +- Interface `OriginalLabelsOut` property `modification` removed |
| 72 | +- Interface `UpdatedLabelsOut` property `modification` removed |
| 73 | +- Interface `BatchStatus` property `_function` renamed to `function` |
| 74 | + |
| 75 | +#### Discovery v1 |
| 76 | +- Interface `NluEnrichmentCategories` removed |
| 77 | +- Interface `NluEnrichmentFeatures` property `categories` type changed from `NluEnrichmentCategories` to `JsonObject` |
| 78 | + |
| 79 | +#### Discovery v2 |
| 80 | +- Interface `DefaultQueryParams` property `_return` renamed `return` |
| 81 | + |
| 82 | +#### Natural Language Understanding |
| 83 | +- Interface `AnalysisResults` property `metadata` type changed from `AnalysisResultsMetadata` to `FeaturesResultsMetadata` |
| 84 | +- Interface `Features` property `metadata` type changed from `MetadataOptions` to `JsonObject` |
| 85 | +- Interface `AnalysisResultsMetadata` removed |
| 86 | +- Interface `MetadataOptions` removed |
| 87 | + |
| 88 | +#### Personality Insights |
| 89 | +- Interface `Content` property `content_items` renamed `contentItems` |
| 90 | + |
| 91 | +#### Text to Speech |
| 92 | +- Interface `CreateVoiceModelParams` renamed to `CreateCustomModelParams` |
| 93 | +- Interface `ListVoiceModelParams` renamed to `ListCustomModelParams` |
| 94 | +- Interface `GetVoiceModelParams` renamed to `GetCustomModelParams` |
| 95 | +- Interface `UpdateVoiceModelParams` renamed to `UpdateCustomModelParams` |
| 96 | +- Interface `DeleteVoiceModelParams` renamed to `DeleteCustomModelParams` |
| 97 | +- Interface `CreateVoiceModelConstants` renamed to `CreateCustomModelConstants` |
| 98 | +- Interface `ListVoiceModelConstants` renamed to `ListCustomModelConstants` |
| 99 | +- Interface `VoiceModel` renamed to `CustomModel` |
| 100 | +- Use of `VoiceModel[]` replaced with interface `CustomModels` |
| 101 | + |
| 102 | +#### Visual Recognition v3 |
| 103 | +- Interface `Class` property `_class` renamed `class` |
| 104 | +- Interface `ClassResult` property `_class` renamed `class` |
| 105 | + |
| 106 | +#### Visual Recognition v4 |
| 107 | +- Interface `Collection` property `training_status` type changed from `TrainingStatus` to `CollectionTrainingStatus` |
| 108 | +- Interface `ObjectDetail` property `location` type changed from `Location` to `ObjectDetailLocation` |
| 109 | + |
| 110 | + |
| 111 | +### New Features by Service |
| 112 | + |
| 113 | +#### Assistant v1 |
| 114 | +- `includeCount` parameter added to several methods: Whether to include information about the number of records that satisfy the request, regardless of the page limit. |
| 115 | +- `bulkClassify()` method added: Identify intents and entities in multiple user utterances. |
| 116 | +- Interface `DialogNodeContext` added |
| 117 | +- Interface `DialogNodeOutput` property `integrations` added: Output intended for specific integrations. For more information, see the [documentation](https://cloud.ibm.com/docs/assistant?topic=assistant-dialog-responses-json) |
| 118 | + |
| 119 | +#### Assistant v2 |
| 120 | +- `bulkClassify()` method added: Identify intents and entities in multiple user utterances. |
| 121 | + |
| 122 | +#### Compare Comply |
| 123 | +- Interface `Category` property `modification` added: The type of modification of the feedback entry in the updated labels response. |
| 124 | +- Interface `TypeLabel` property `modification` added: The type of modification of the feedback entry in the updated labels response. |
| 125 | + |
| 126 | +#### Discovery v2 |
| 127 | +- `analyzeDocument()` method added: Process a document using the specified collection's settings and return it for realtime use. **Note: This method is only supported on IBM Cloud Pak for Data instances of Discovery.** |
| 128 | +- Interface `QueryResponsePassage` added |
| 129 | +- Interface `QueryResponse` property `passages` added: Passages returned by Discovery. |
| 130 | + |
| 131 | +#### Language Translator |
| 132 | +- `translateDocument()` now supports these subtitle/caption formats: `text/sbv`, `text/srt`, and `text/vtt` |
| 133 | + |
| 134 | +#### Natural Language Understanding |
| 135 | +- Interface `FeaturesResultsMetadata` added: Webpage metadata, such as the author and the title of the page. |
| 136 | + |
| 137 | +##### Speech to Text |
| 138 | +- `recognize()` and `createJob()` now support Canadian French broadband and narrowband models |
| 139 | +- `createLanguageModel()` and `createAcousticModel()` now supports Australian English broadband and narrowband models |
| 140 | +- `addGrammar()` parameter `grammarFile` now supports `ReadableStream` and `Buffer` |
| 141 | + |
| 142 | +#### Visual Recognition v4 |
| 143 | +- `createCollection()` parameter `trainingStatus` added: Training status information for the collection. |
| 144 | +- `updateCollection()` parameter `trainingStatus` added: Training status information for the collection. |
| 145 | +- Interface `CollectionTrainingStatus` added: Training status information for the collection. |
| 146 | +- Interface `ObjectDetailLocation` added: Defines the location of the bounding box around the object. |
0 commit comments