Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: twilio/twilio-node
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: d9244e3021e824efa254f69f5d96ae396cbe4aa4
Choose a base ref
...
head repository: twilio/twilio-node
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: ccbb504e50a53775ea1e21ead4eb97933a5c51bc
Choose a head ref
  • 9 commits
  • 2,221 files changed
  • 5 contributors

Commits on Jan 13, 2023

  1. feat!: Merge branch '4.0.0-rc' to main (#883)

    childish-sambino authored Jan 13, 2023
    Copy the full SHA
    b471067 View commit details
  2. chore: readd ts tests to test rule (#888)

    Bilal Boussayoud authored Jan 13, 2023
    Copy the full SHA
    6dff2f9 View commit details

Commits on Jan 19, 2023

  1. Copy the full SHA
    3c68014 View commit details
  2. docs: add relevant Refer/Say/ssml links to upgrade guide; formatting (#…

    …895)
    
    Updates the UPGRADE.md doc to provide docs links to relevant resources for changes that could be confusing to customers. Fixes a few markdownlint warnings.
    stern-shawn authored Jan 19, 2023
    Copy the full SHA
    8da34f6 View commit details

Commits on Jan 24, 2023

  1. docs: use long property descriptions if available (#899)

    childish-sambino authored Jan 24, 2023
    Copy the full SHA
    449f5b2 View commit details
  2. Copy the full SHA
    21ad190 View commit details

Commits on Jan 25, 2023

  1. fix: remove Flex shortcuts for removed APIs (#902)

    childish-sambino authored Jan 25, 2023
    Copy the full SHA
    3e712b0 View commit details
  2. Copy the full SHA
    32a9a06 View commit details
  3. Release 4.0.0

    twilio-dx committed Jan 25, 2023
    Copy the full SHA
    ccbb504 View commit details
Showing 2,221 changed files with 279,337 additions and 600,809 deletions.
2 changes: 1 addition & 1 deletion .eslintrc.json
Original file line number Diff line number Diff line change
@@ -117,7 +117,7 @@
],
"quotes": [
2,
"single"
"double"
],
"indent": [
2,
12 changes: 11 additions & 1 deletion .github/workflows/test-and-deploy.yml
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ jobs:
timeout-minutes: 20
strategy:
matrix:
node: [ 6, 8, 10, 12, 14, 16, lts/* ]
node: [ 14, 16, 18, lts/* ]
steps:
- name: Checkout twilio-node
uses: actions/checkout@v3
@@ -33,6 +33,16 @@ jobs:
- name: Run Unit Tests
run: npm run ci

- name: Run Cluster Tests
if: (!github.event.pull_request.head.repo.fork)
env:
TWILIO_ACCOUNT_SID: ${{ secrets.TWILIO_ACCOUNT_SID }}
TWILIO_API_KEY: ${{ secrets.TWILIO_CLUSTER_TEST_API_KEY}}
TWILIO_API_SECRET: ${{ secrets.TWILIO_CLUSTER_TEST_API_KEY_SECRET }}
TWILIO_FROM_NUMBER: ${{ secrets.TWILIO_FROM_NUMBER }}
TWILIO_TO_NUMBER: ${{ secrets.TWILIO_TO_NUMBER }}
run: npm run cluster

- name: SonarCloud Scan
if: ${{ (github.event_name == 'pull_request' || github.ref_type == 'branch') && matrix.node == 'lts/*' && !github.event.pull_request.head.repo.fork }}
uses: SonarSource/sonarcloud-github-action@master
9 changes: 6 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
### Logs ###
### Logs ###
logs
*.log

@@ -14,13 +14,13 @@ pids
node_modules

### Test coverage ###
spec/coverage
coverage

### Custom ignores ###
config.js
.idea

### jsdoc dir ###
### typedoc dir ###
docs

### ide / editors ###
@@ -29,3 +29,6 @@ docs
### Libraries don't need locks files ###
yarn.lock
package-lock.json

**/.openapi-generator*
dist
2 changes: 1 addition & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
@@ -44,7 +44,7 @@
"newcap": true,

// Enforce use of single quotation marks for strings.
"quotmark": "single",
"quotmark": "double",

// Enforce placing 'use strict' at the top function scope
"strict": true,
8 changes: 8 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.github
coverage
dist
docs

babel.config.js
*.md
*.json
32 changes: 32 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,38 @@
twilio-node changelog
=====================

[2023-01-25] Version 4.0.0
--------------------------
**Note:** This release contains breaking changes, check our [upgrade guide](./UPGRADE.md###-2023-01-25-3xx-to-4xx) for detailed migration notes.

**Library - Fix**
- [PR #902](https://github.com/twilio/twilio-node/pull/902): remove Flex shortcuts for removed APIs. Thanks to [@childish-sambino](https://github.com/childish-sambino)!
- [PR #897](https://github.com/twilio/twilio-node/pull/897): use break() for method names rather than break_(). Thanks to [@mattcole19](https://github.com/mattcole19)!

**Library - Docs**
- [PR #901](https://github.com/twilio/twilio-node/pull/901): update README link to exceptions example for 4.x release. Thanks to [@stern-shawn](https://github.com/stern-shawn)!
- [PR #899](https://github.com/twilio/twilio-node/pull/899): use long property descriptions if available. Thanks to [@childish-sambino](https://github.com/childish-sambino)!
- [PR #895](https://github.com/twilio/twilio-node/pull/895): add relevant Refer/Say/ssml links to upgrade guide; formatting. Thanks to [@stern-shawn](https://github.com/stern-shawn)!

**Library - Chore**
- [PR #888](https://github.com/twilio/twilio-node/pull/888): re-add test:typescript to test rule. Thanks to [@beebzz](https://github.com/beebzz)!

**Library - Feature**
- [PR #883](https://github.com/twilio/twilio-node/pull/883): Merge branch '4.0.0-rc' to main. Thanks to [@childish-sambino](https://github.com/childish-sambino)! **(breaking change)**

**Api**
- Add `public_application_connect_enabled` param to Application resource

**Messaging**
- Add new tollfree verification API property (ExternalReferenceId)]

**Verify**
- Add `device_ip` parameter and channel `auto` for sna/sms orchestration

**Twiml**
- Add support for `<Application>` noun and `<ApplicationSid>` noun, nested `<Parameter>` to `<Hangup>` and `<Leave>` verb


[2023-01-11] Version 3.84.1
---------------------------
**Library - Test**
8 changes: 5 additions & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:12.17
FROM node:14

RUN mkdir /twilio
WORKDIR /twilio
@@ -8,7 +8,9 @@ ENV NODE_PATH /usr/local/lib/node_modules
COPY lib ./lib
COPY spec ./spec
COPY examples ./examples
COPY index.js .
COPY package* ./
COPY index.ts package.json babel.config.js tsconfig.json ./

RUN npm config set unsafe-perm true # Needed to run prepublish as root.

RUN npm install . --include=dev
RUN npm install -g .
15 changes: 7 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,25 +1,24 @@
.PHONY: test-install install test test-docker docs clean
.PHONY: test-install install test test-docker docs clean prettier

test-install:
npm install --only=dev

install:
@node --version || (echo "Node is not installed, please install Node >= 0.12"; exit 1);
@node --version || (echo "Node is not installed, please install Node >= 14"; exit 1);
rm -f package-lock.json
npm install

test:
npm test

test-docker:
docker build -t twilio/twilio-node .
docker run twilio/twilio-node npm run ci

docs:
npm run jsdoc
npm run typedoc

clean:
rm -rf node_modules
rm -rf node_modules dist

prettier:
npm run prettier

API_DEFINITIONS_SHA=$(shell git log --oneline | grep Regenerated | head -n1 | cut -d ' ' -f 5)
CURRENT_TAG=$(shell expr "${GITHUB_TAG}" : ".*-rc.*" >/dev/null && echo "rc" || echo "latest")
2 changes: 2 additions & 0 deletions PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -12,6 +12,8 @@ Please enter each Issue number you are resolving in your PR after one of the fol
e.g.
Fixes #1
Closes #2
Note: If you made changes to the Request Validation logic, please run `npm run webhook-test` locally and ensure all test cases pass
-->

# Fixes #
46 changes: 33 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
@@ -19,25 +19,16 @@ The Node library documentation can be found [here][libdocs].

This library supports the following Node.js implementations:

* Node.js 6
* Node.js 8
* Node.js 10
* Node.js 12
* Node.js 14
* Node.js 16
* Node.js 18

TypeScript is supported for TypeScript version 2.9 and above.

## Installation

`npm install twilio` or `yarn add twilio`

### Installing Release Candidates

Or, if you're wanting to install the latest release candidate use:

`npm install twilio@rc` or `yarn add twilio@rc`

## Sample Usage

Check out these [code examples](examples) in JavaScript and TypeScript to get up and running quickly.
@@ -48,15 +39,44 @@ Check out these [code examples](examples) in JavaScript and TypeScript to get up

If your environment requires SSL decryption, you can set the path to CA bundle in the env var `TWILIO_CA_BUNDLE`.

### Client Initialization
If you invoke any V2010 operations without specifying an account SID, `twilio-node` will automatically use the `TWILIO_ACCOUNT_SID` value that the client was initialized with. This is useful for when you'd like to, for example, fetch resources for your main account but also your subaccount. See below:

```javascript
var accountSid = process.env.TWILIO_ACCOUNT_SID; // Your Account SID from www.twilio.com/console
var authToken = process.env.TWILIO_AUTH_TOKEN; // Your Auth Token from www.twilio.com/console
var subaccountSid = process.env.TWILIO_ACCOUNT_SUBACCOUNT_SID; // Your Subaccount SID from www.twilio.com/console

const client = require('twilio')(accountSid, authToken);
const mainAccountCalls = client.api.v2010.account.calls.list; // SID not specified, so defaults to accountSid
const subaccountCalls = client.api.v2010.account(subaccountSid).calls.list // SID specified as subaccountSid
```

### Lazy Loading

`twilio-node` supports lazy loading required modules for faster loading time. Lazy loading is disabled by default. To enable lazy loading, simply instantiate the Twilio client with the `lazyLoading` flag set to `true`:
`twilio-node` supports lazy loading required modules for faster loading time. Lazy loading is enabled by default. To disable lazy loading, simply instantiate the Twilio client with the `lazyLoading` flag set to `false`:
```javascript
var accountSid = process.env.TWILIO_ACCOUNT_SID; // Your Account SID from www.twilio.com/console
var authToken = process.env.TWILIO_AUTH_TOKEN; // Your Auth Token from www.twilio.com/console

const client = require('twilio')(accountSid, authToken, {
lazyLoading: false
});
```

### Enable Auto-Retry with Exponential Backoff

`twilio-node` supports automatic retry with exponential backoff when API requests receive an [Error 429 response](https://support.twilio.com/hc/en-us/articles/360044308153-Twilio-API-response-Error-429-Too-Many-Requests-). This retry with exponential backoff feature is disabled by default. To enable this feature, instantiate the Twilio client with the `autoRetry` flag set to `true`.

Optionally, the maximum number of retries performed by this feature can be set with the `maxRetries` flag. The default maximum number of retries is `3`.

```javascript
var accountSid = process.env.TWILIO_ACCOUNT_SID; // Your Account SID from www.twilio.com/console
var authToken = process.env.TWILIO_AUTH_TOKEN; // Your Auth Token from www.twilio.com/console

const client = require('twilio')(accountSid, authToken, {
lazyLoading: true
autoRetry: true,
maxRetries: 3
});
```

@@ -105,7 +125,7 @@ See [example](examples/express.js) for a code sample for incoming Twilio request

## Handling Exceptions

For an example on how to handle exceptions in this helper library, please see the [Twilio documentation](https://www.twilio.com/docs/libraries/node/usage-guide#exceptions).
For an example on how to handle exceptions in this helper library, please see the [Twilio documentation](https://www.twilio.com/docs/libraries/node#exceptions).

## Using a Custom HTTP Client

76 changes: 70 additions & 6 deletions UPGRADE.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,76 @@
Upgrade Guide
# Upgrade Guide

After 3.0.0 all MINOR and MAJOR version bumps will have upgrade notes posted here.
_All `MAJOR` version bumps will have upgrade notes posted here._

[2017-05-22] 3.1.x to 3.2.x
---------------------------
## [2023-01-25] 3.x.x to 4.x.x

---

* Supported Node.js versions updated
* Upgrade to Node.js >= 14
* Dropped support for Node.js < 14 ([#791](https://github.com/twilio/twilio-node/pull/791))
* Added support for Node.js 18 ([#794](https://github.com/twilio/twilio-node/pull/794))
* Lazy loading enabled by default ([#752](https://github.com/twilio/twilio-node/pull/752))
* Required Twilio modules now lazy load by default
* See the [README](README.md#lazy-loading) for how to disable lazy loading
* Type changes from `object` to `Record` ([#873](https://github.com/twilio/twilio-node/pull/873))
* Certain response properties now use the `Record` type with `string` keys
* Including the `subresourceUris` property for v2010 APIs and the `links` properties for non-v2010 APIs
* Access Tokens
* Creating an [AccessToken](https://www.twilio.com/docs/iam/access-tokens) requires an `identity` in the options ([#875](https://github.com/twilio/twilio-node/pull/875))
* `ConversationsGrant` has been deprecated in favor of `VoiceGrant` ([#783](https://github.com/twilio/twilio-node/pull/783))
* `IpMessagingGrant` has been removed ([#784](https://github.com/twilio/twilio-node/pull/784))
* TwiML function deprecations ([#788](https://github.com/twilio/twilio-node/pull/788))
* [`<Refer>`](https://www.twilio.com/docs/voice/twiml/refer)
* `Refer.referSip()` replaced by `Refer.sip()`
* [`<Say>`](https://www.twilio.com/docs/voice/twiml/say/text-speech#generating-ssml-via-helper-libraries)
* `Say.ssmlBreak()` replaced by `Say.break()`
* `Say.ssmlEmphasis()` replaced by `Say.emphasis()`
* `Say.ssmlLang()` replaced by `Say.lang()`
* `Say.ssmlP()` replaced by `Say.p()`
* `Say.ssmlPhoneme()` replaced by `Say.phoneme()`
* `Say.ssmlProsody()` replaced by `Say.prosody()`
* `Say.ssmlS()` replaced by `Say.s()`
* `Say.ssmlSayAs()` replaced by `Say.sayAs()`
* `Say.ssmlSub()` replaced by `Say.sub()`
* `Say.ssmlW()` replaced by `Say.w()`

Old:

```js
const response = new VoiceResponse();
const say = response.say("Hello");
say.ssmlEmphasis("you");
```

New:

```js
const response = new VoiceResponse();
const say = response.say("Hello");
say.emphasis("you");
```

* [TaskRouter Workers Statistics](https://www.twilio.com/docs/taskrouter/api/worker/statistics) operations updated ([#820](https://github.com/twilio/twilio-node/pull/820))
* Cumulative and Real-Time Workers Statistics no longer accept a WorkerSid
* `GET /v1/Workspaces/{WorkspaceSid}/Workers/CumulativeStatistics`

Old: `client.taskrouter.v1.workspaces('WS...').workers('WK...).cumulativeStatistics()`

New: `client.taskrouter.v1.workspaces('WS...').workers.cumulativeStatistics()`
* `GET /v1/Workspaces/{WorkspaceSid}/Workers/RealTimeStatistics`

Old: `client.taskrouter.v1.workspaces('WS...').workers('WK...).realTimeStatistics()`

New: `client.taskrouter.v1.workspaces('WS...').workers.realTimeStatistics()`

## [2017-05-22] 3.1.x to 3.2.x

---

### CHANGED - Rename video room `Recordings` class to `RoomRecordings`

#### Rationale
- This was done to avoid a class name conflict with another resource.
- Client code should be unaffected unless you manipulate the Recording/RoomRecordings class directly. Accessing room recording metadata via the client should work the same way as before.

* This was done to avoid a class name conflict with another resource.
* Client code should be unaffected unless you manipulate the Recording/RoomRecordings class directly. Accessing room recording metadata via the client should work the same way as before.
9 changes: 9 additions & 0 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
module.exports = {
presets: [
['@babel/preset-env', {targets: {node: 'current'}}],
'@babel/preset-typescript',
],
plugins: [
'babel-plugin-replace-ts-export-assignment',
],
};
Loading