telnyx 2.0.1-beta.0 → 2.1.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +5 -0
- package/README.md +7 -0
- package/VERSION +1 -1
- package/dist/Error.js +34 -16
- package/dist/TelnyxMethod.basic.js +12 -6
- package/dist/TelnyxMethod.js +34 -6
- package/dist/TelnyxResource.js +37 -9
- package/dist/Webhooks.js +32 -4
- package/dist/autoPagination.js +33 -4
- package/dist/makeRequest.js +27 -2
- package/dist/multipart.js +7 -4
- package/dist/resources/AccessIpAddress.js +8 -2
- package/dist/resources/AccessIpRanges.js +8 -2
- package/dist/resources/Actions.js +10 -4
- package/dist/resources/ActionsSimCards.js +9 -3
- package/dist/resources/ActivateDeactivateBulkCredentials.js +33 -4
- package/dist/resources/Addresses.js +33 -4
- package/dist/resources/AiAssistants.js +9 -3
- package/dist/resources/AiAudioTranscriptions.js +8 -2
- package/dist/resources/AiChatCompletions.js +8 -2
- package/dist/resources/AiEmbeddings.js +9 -3
- package/dist/resources/AiEmbeddingsBuckets.js +9 -3
- package/dist/resources/AiEmbeddingsSimilaritySearch.js +8 -2
- package/dist/resources/AiModels.js +8 -2
- package/dist/resources/AiSummarize.js +8 -2
- package/dist/resources/AuditEvents.js +8 -2
- package/dist/resources/AuthenticationProviders.js +8 -2
- package/dist/resources/AvailablePhoneNumbers.js +8 -2
- package/dist/resources/AvailablePhoneNumbersBlocks.js +8 -2
- package/dist/resources/Balance.js +9 -3
- package/dist/resources/BillingGroups.js +8 -2
- package/dist/resources/Brands.js +9 -3
- package/dist/resources/BulkCredentials.js +9 -3
- package/dist/resources/BulkSoleProprietorCreation.js +9 -3
- package/dist/resources/BulkTelephonyCredentials.js +33 -4
- package/dist/resources/CallControlApplications.js +33 -4
- package/dist/resources/CallEvents.js +8 -2
- package/dist/resources/CallRecordings.js +9 -3
- package/dist/resources/Calls.js +33 -4
- package/dist/resources/Campaign.js +33 -4
- package/dist/resources/CampaignBuilder.js +33 -4
- package/dist/resources/CdrUsageReports.js +9 -3
- package/dist/resources/Channelzones.js +9 -3
- package/dist/resources/Conferences.js +33 -4
- package/dist/resources/Connections.js +9 -3
- package/dist/resources/CredentialConnections.js +8 -2
- package/dist/resources/CustomerServiceRecords.js +9 -3
- package/dist/resources/DetailRecords.js +9 -3
- package/dist/resources/DialogflowConnections.js +9 -3
- package/dist/resources/DocumentLinks.js +8 -2
- package/dist/resources/Documents.js +9 -3
- package/dist/resources/DynamicEmergency.js +12 -6
- package/dist/resources/DynamicEmergencyAddresses.js +8 -2
- package/dist/resources/DynamicEmergencyEndpoints.js +8 -2
- package/dist/resources/ExternalConnections.js +9 -3
- package/dist/resources/FaxApplications.js +33 -4
- package/dist/resources/Faxes.js +33 -4
- package/dist/resources/FqdnConnections.js +33 -4
- package/dist/resources/Fqdns.js +33 -4
- package/dist/resources/GlobalIps.js +9 -3
- package/dist/resources/InboundChannels.js +9 -3
- package/dist/resources/InventoryCoverage.js +9 -3
- package/dist/resources/IpConnections.js +33 -4
- package/dist/resources/Ips.js +33 -4
- package/dist/resources/ManagedAccounts.js +33 -4
- package/dist/resources/MdrDetailReports.js +9 -3
- package/dist/resources/MdrUsageReports.js +9 -3
- package/dist/resources/MediaStorageApi.js +9 -3
- package/dist/resources/Messages.js +9 -3
- package/dist/resources/MessagingHostedNumberOrders.js +8 -2
- package/dist/resources/MessagingHostedNumbers.js +8 -2
- package/dist/resources/MessagingProfiles.js +33 -4
- package/dist/resources/MessagingShortCodes.js +8 -2
- package/dist/resources/MessagingTollfreeVerification.js +9 -3
- package/dist/resources/MessagingUrlDomains.js +9 -3
- package/dist/resources/MobileNetworkOperators.js +9 -3
- package/dist/resources/MobileOperatorNetworks.js +8 -2
- package/dist/resources/Networks.js +9 -3
- package/dist/resources/NotificationEvents.js +8 -2
- package/dist/resources/NumberBackgroundJobs.js +9 -3
- package/dist/resources/NumberLookup.js +8 -2
- package/dist/resources/NumberOrders.js +33 -4
- package/dist/resources/NumberPortouts.js +33 -4
- package/dist/resources/NumberReservations.js +33 -4
- package/dist/resources/NumbersFeatures.js +9 -3
- package/dist/resources/Object.js +9 -3
- package/dist/resources/OtaUpdates.js +9 -3
- package/dist/resources/OutboundVoiceProfiles.js +33 -4
- package/dist/resources/Payment.js +9 -3
- package/dist/resources/PhoneNumberAssignmentByProfile.js +33 -4
- package/dist/resources/PhoneNumberBlockOrders.js +9 -3
- package/dist/resources/PhoneNumberBlocksBackgroundJobs.js +9 -3
- package/dist/resources/PhoneNumberCampaigns.js +9 -3
- package/dist/resources/PhoneNumbers.js +37 -8
- package/dist/resources/PhoneNumbersCsvDownloads.js +8 -2
- package/dist/resources/PhoneNumbersMessaging.js +8 -2
- package/dist/resources/PhoneNumbersRegulatoryRequirements.js +8 -2
- package/dist/resources/PhoneNumbersSlim.js +8 -2
- package/dist/resources/PhoneNumbersVoice.js +8 -2
- package/dist/resources/PortabilityChecks.js +9 -3
- package/dist/resources/PortingEvents.js +9 -3
- package/dist/resources/PortingLoaConfigurations.js +9 -3
- package/dist/resources/PortingOrders.js +33 -4
- package/dist/resources/PortingPhoneNumbers.js +8 -2
- package/dist/resources/PortingReports.js +8 -2
- package/dist/resources/PortoutEvents.js +9 -3
- package/dist/resources/PortoutRequests.js +9 -3
- package/dist/resources/PresignedObjectUrls.js +9 -3
- package/dist/resources/PrivateWirelessGateways.js +9 -3
- package/dist/resources/PublicInternetGateways.js +9 -3
- package/dist/resources/PushCredentials.js +9 -3
- package/dist/resources/Queues.js +33 -4
- package/dist/resources/RecordingsCommands.js +9 -3
- package/dist/resources/Regions.js +9 -3
- package/dist/resources/RegulatoryRequirements.js +8 -2
- package/dist/resources/Reporting.js +9 -3
- package/dist/resources/Reports.js +9 -3
- package/dist/resources/ReportsMdrs.js +8 -2
- package/dist/resources/RequirementTypes.js +9 -3
- package/dist/resources/Requirements.js +9 -3
- package/dist/resources/RoomCompositions.js +8 -2
- package/dist/resources/RoomParticipants.js +8 -2
- package/dist/resources/RoomRecordings.js +9 -3
- package/dist/resources/RoomSessions.js +9 -3
- package/dist/resources/Rooms.js +8 -2
- package/dist/resources/RoomsClientToken.js +9 -3
- package/dist/resources/RoomsClientTokens.js +9 -3
- package/dist/resources/SharedCampaigns.js +9 -3
- package/dist/resources/ShortCodes.js +33 -4
- package/dist/resources/SimCardActions.js +9 -3
- package/dist/resources/SimCardGroupActions.js +9 -3
- package/dist/resources/SimCardGroups.js +33 -4
- package/dist/resources/SimCardOrders.js +8 -2
- package/dist/resources/SimCards.js +33 -4
- package/dist/resources/StorageBuckets.js +9 -3
- package/dist/resources/TelephonyCredentials.js +33 -4
- package/dist/resources/Texml.js +9 -3
- package/dist/resources/TexmlApplications.js +33 -4
- package/dist/resources/Verifications.js +33 -4
- package/dist/resources/VerifiedNumbers.js +33 -4
- package/dist/resources/VerifyProfiles.js +9 -3
- package/dist/resources/VirtualCrossConnects.js +9 -3
- package/dist/resources/WdrDetailReports.js +9 -3
- package/dist/resources/Webhooks.js +8 -2
- package/dist/resources/WireguardInterfaces.js +9 -3
- package/dist/resources/WirelessDetailRecordReports.js +8 -2
- package/dist/telnyx.js +313 -284
- package/dist/telnyx.node.js +6 -3
- package/dist/types/DocumentsResource.d.ts +1 -1
- package/dist/types/TelnyxAPI.d.ts +6826 -2933
- package/dist/utils.js +64 -20
- package/package.json +15 -4
package/CHANGELOG.md
CHANGED
package/README.md
CHANGED
|
@@ -335,6 +335,13 @@ Now inject envs into terminal:
|
|
|
335
335
|
|
|
336
336
|
> Feel free to use Node `--env-file` parameter to [setup envs](https://nodejs.org/en/learn/command-line/how-to-read-environment-variables-from-nodejs) if you prefer
|
|
337
337
|
|
|
338
|
+
|
|
339
|
+
Update global types based off Telnyx OpenAPI spec with the following command:
|
|
340
|
+
|
|
341
|
+
```bash
|
|
342
|
+
npx openapi-typescript https://raw.githubusercontent.com/team-telnyx/openapi/master/openapi/spec3.json -o ./types/TelnyxAPI.d.ts
|
|
343
|
+
```
|
|
344
|
+
|
|
338
345
|
The test suite depends on the [Prism Mock Server](https://github.com/stoplightio/prism).
|
|
339
346
|
|
|
340
347
|
Start the prism mock service with the following command:
|
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.0
|
|
1
|
+
2.1.0-beta.0
|
package/dist/Error.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TelnyxSignatureVerificationError = exports.TelnyxConnectionError = exports.TelnyxServiceUnavailableError = exports.TelnyxRateLimitError = exports.TelnyxInvalidParametersError = exports.TelnyxUnsupportedMediaTypeError = exports.TelnyxTimeoutError = exports.TelnyxMethodNotSupportedError = exports.TelnyxResourceNotFoundError = exports.TelnyxPermissionError = exports.TelnyxAuthenticationError = exports.TelnyxAPIError = exports.TelnyxInvalidRequestError = exports.TelnyxError = exports.generate = void 0;
|
|
4
|
+
const generate = (rawTelnyxError) => {
|
|
2
5
|
switch (rawTelnyxError.statusCode) {
|
|
3
6
|
case 400:
|
|
4
7
|
return new TelnyxInvalidRequestError(rawTelnyxError);
|
|
@@ -25,11 +28,12 @@ export const generate = (rawTelnyxError) => {
|
|
|
25
28
|
}
|
|
26
29
|
return new TelnyxError({ type: 'Generic', message: 'Unknown Error' });
|
|
27
30
|
};
|
|
31
|
+
exports.generate = generate;
|
|
28
32
|
/**
|
|
29
33
|
* TelnyxError is the base error from which all other more specific Telnyx errors derive.
|
|
30
34
|
* Specifically for errors returned from Telnyx's REST API.
|
|
31
35
|
*/
|
|
32
|
-
|
|
36
|
+
class TelnyxError extends Error {
|
|
33
37
|
message;
|
|
34
38
|
type;
|
|
35
39
|
raw;
|
|
@@ -55,102 +59,116 @@ export class TelnyxError extends Error {
|
|
|
55
59
|
/**
|
|
56
60
|
* Helper factory which takes raw Telnyx errors and outputs wrapping instances
|
|
57
61
|
*/
|
|
58
|
-
static generate = generate;
|
|
62
|
+
static generate = exports.generate;
|
|
59
63
|
}
|
|
64
|
+
exports.TelnyxError = TelnyxError;
|
|
60
65
|
/**
|
|
61
66
|
* InvalidRequestError is raised when a request is initiated with invalid
|
|
62
67
|
* parameters.
|
|
63
68
|
*/
|
|
64
|
-
|
|
69
|
+
class TelnyxInvalidRequestError extends TelnyxError {
|
|
65
70
|
constructor(raw = {}) {
|
|
66
71
|
super(raw, 'TelnyxInvalidRequestError');
|
|
67
72
|
}
|
|
68
73
|
}
|
|
74
|
+
exports.TelnyxInvalidRequestError = TelnyxInvalidRequestError;
|
|
69
75
|
/**
|
|
70
76
|
* APIError is a generic error that may be raised in cases where none of the
|
|
71
77
|
* other named errors cover the problem. It could also be raised in the case
|
|
72
78
|
* that a new error has been introduced in the API, but this version of the
|
|
73
79
|
* Node.JS SDK doesn't know how to handle it.
|
|
74
80
|
*/
|
|
75
|
-
|
|
81
|
+
class TelnyxAPIError extends TelnyxError {
|
|
76
82
|
constructor(raw = {}) {
|
|
77
83
|
super(raw, 'TelnyxAPIError');
|
|
78
84
|
}
|
|
79
85
|
}
|
|
86
|
+
exports.TelnyxAPIError = TelnyxAPIError;
|
|
80
87
|
/**
|
|
81
88
|
* AuthenticationError is raised when invalid credentials are used to connect
|
|
82
89
|
* to Telnyx's servers.
|
|
83
90
|
*/
|
|
84
|
-
|
|
91
|
+
class TelnyxAuthenticationError extends TelnyxError {
|
|
85
92
|
constructor(raw = {}) {
|
|
86
93
|
super(raw, 'TelnyxAuthenticationError');
|
|
87
94
|
}
|
|
88
95
|
}
|
|
96
|
+
exports.TelnyxAuthenticationError = TelnyxAuthenticationError;
|
|
89
97
|
/**
|
|
90
98
|
* PermissionError is raised in cases where access was attempted on a resource
|
|
91
99
|
* that wasn't allowed.
|
|
92
100
|
*/
|
|
93
|
-
|
|
101
|
+
class TelnyxPermissionError extends TelnyxError {
|
|
94
102
|
constructor(raw = {}) {
|
|
95
103
|
super(raw, 'TelnyxPermissionError');
|
|
96
104
|
}
|
|
97
105
|
}
|
|
98
|
-
|
|
106
|
+
exports.TelnyxPermissionError = TelnyxPermissionError;
|
|
107
|
+
class TelnyxResourceNotFoundError extends TelnyxError {
|
|
99
108
|
constructor(raw = {}) {
|
|
100
109
|
super(raw, 'TelnyxResourceNotFoundError');
|
|
101
110
|
}
|
|
102
111
|
}
|
|
103
|
-
|
|
112
|
+
exports.TelnyxResourceNotFoundError = TelnyxResourceNotFoundError;
|
|
113
|
+
class TelnyxMethodNotSupportedError extends TelnyxError {
|
|
104
114
|
constructor(raw = {}) {
|
|
105
115
|
super(raw, 'TelnyxMethodNotSupportedError');
|
|
106
116
|
}
|
|
107
117
|
}
|
|
108
|
-
|
|
118
|
+
exports.TelnyxMethodNotSupportedError = TelnyxMethodNotSupportedError;
|
|
119
|
+
class TelnyxTimeoutError extends TelnyxError {
|
|
109
120
|
constructor(raw = {}) {
|
|
110
121
|
super(raw, 'TelnyxTimeoutError');
|
|
111
122
|
}
|
|
112
123
|
}
|
|
113
|
-
|
|
124
|
+
exports.TelnyxTimeoutError = TelnyxTimeoutError;
|
|
125
|
+
class TelnyxUnsupportedMediaTypeError extends TelnyxError {
|
|
114
126
|
constructor(raw = {}) {
|
|
115
127
|
super(raw, 'TelnyxUnsupportedMediaTypeError');
|
|
116
128
|
}
|
|
117
129
|
}
|
|
118
|
-
|
|
130
|
+
exports.TelnyxUnsupportedMediaTypeError = TelnyxUnsupportedMediaTypeError;
|
|
131
|
+
class TelnyxInvalidParametersError extends TelnyxError {
|
|
119
132
|
constructor(raw = {}) {
|
|
120
133
|
super(raw, 'TelnyxInvalidParametersError');
|
|
121
134
|
}
|
|
122
135
|
}
|
|
136
|
+
exports.TelnyxInvalidParametersError = TelnyxInvalidParametersError;
|
|
123
137
|
/**
|
|
124
138
|
* RateLimitError is raised in cases where an account is putting too much load
|
|
125
139
|
* on Telnyx's API servers (usually by performing too many requests). Please
|
|
126
140
|
* back off on request rate.
|
|
127
141
|
*/
|
|
128
|
-
|
|
142
|
+
class TelnyxRateLimitError extends TelnyxError {
|
|
129
143
|
constructor(raw = {}) {
|
|
130
144
|
super(raw, 'TelnyxRateLimitError');
|
|
131
145
|
}
|
|
132
146
|
}
|
|
133
|
-
|
|
147
|
+
exports.TelnyxRateLimitError = TelnyxRateLimitError;
|
|
148
|
+
class TelnyxServiceUnavailableError extends TelnyxError {
|
|
134
149
|
constructor(raw = {}) {
|
|
135
150
|
super(raw, 'TelnyxServiceUnavailableError');
|
|
136
151
|
}
|
|
137
152
|
}
|
|
153
|
+
exports.TelnyxServiceUnavailableError = TelnyxServiceUnavailableError;
|
|
138
154
|
/**
|
|
139
155
|
* TelnyxConnectionError is raised in the event that the SDK can't connect to
|
|
140
156
|
* Telnyx's servers. That can be for a variety of different reasons from a
|
|
141
157
|
* downed network to a bad TLS certificate.
|
|
142
158
|
*/
|
|
143
|
-
|
|
159
|
+
class TelnyxConnectionError extends TelnyxError {
|
|
144
160
|
constructor(raw = {}) {
|
|
145
161
|
super(raw, 'TelnyxConnectionError');
|
|
146
162
|
}
|
|
147
163
|
}
|
|
164
|
+
exports.TelnyxConnectionError = TelnyxConnectionError;
|
|
148
165
|
/**
|
|
149
166
|
* SignatureVerificationError is raised when the signature verification for a
|
|
150
167
|
* webhook fails
|
|
151
168
|
*/
|
|
152
|
-
|
|
169
|
+
class TelnyxSignatureVerificationError extends TelnyxError {
|
|
153
170
|
constructor(raw = {}) {
|
|
154
171
|
super(raw, 'TelnyxSignatureVerificationError');
|
|
155
172
|
}
|
|
156
173
|
}
|
|
174
|
+
exports.TelnyxSignatureVerificationError = TelnyxSignatureVerificationError;
|
|
@@ -1,23 +1,29 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.del = exports.update = exports.retrieve = exports.list = exports.create = void 0;
|
|
7
|
+
const TelnyxMethod_js_1 = __importDefault(require("./TelnyxMethod.js"));
|
|
8
|
+
exports.create = (0, TelnyxMethod_js_1.default)({
|
|
3
9
|
method: 'POST',
|
|
4
10
|
});
|
|
5
|
-
|
|
11
|
+
exports.list = (0, TelnyxMethod_js_1.default)({
|
|
6
12
|
method: 'GET',
|
|
7
13
|
methodType: 'list',
|
|
8
14
|
});
|
|
9
|
-
|
|
15
|
+
exports.retrieve = (0, TelnyxMethod_js_1.default)({
|
|
10
16
|
method: 'GET',
|
|
11
17
|
path: '/{id}',
|
|
12
18
|
urlParams: ['id'],
|
|
13
19
|
});
|
|
14
|
-
|
|
20
|
+
exports.update = (0, TelnyxMethod_js_1.default)({
|
|
15
21
|
method: 'PATCH',
|
|
16
22
|
path: '{id}',
|
|
17
23
|
urlParams: ['id'],
|
|
18
24
|
});
|
|
19
25
|
// Avoid 'delete' keyword in JS
|
|
20
|
-
|
|
26
|
+
exports.del = (0, TelnyxMethod_js_1.default)({
|
|
21
27
|
method: 'DELETE',
|
|
22
28
|
path: '{id}',
|
|
23
29
|
urlParams: ['id'],
|
package/dist/TelnyxMethod.js
CHANGED
|
@@ -1,6 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const utils = __importStar(require("./utils.js"));
|
|
30
|
+
const makeRequest_js_1 = __importDefault(require("./makeRequest.js"));
|
|
31
|
+
const autoPagination_js_1 = require("./autoPagination.js");
|
|
4
32
|
/**
|
|
5
33
|
* Create an API method from the declared spec.
|
|
6
34
|
*
|
|
@@ -29,9 +57,9 @@ function telnyxMethod(spec) {
|
|
|
29
57
|
populateUrlParamsWithResource(this, args, spec);
|
|
30
58
|
}
|
|
31
59
|
const callback = typeof args[args.length - 1] == 'function' && args.pop();
|
|
32
|
-
const requestPromise = utils.callbackifyPromiseWithTimeout(
|
|
60
|
+
const requestPromise = utils.callbackifyPromiseWithTimeout((0, makeRequest_js_1.default)(this, args, spec, {}), callback);
|
|
33
61
|
if (spec.methodType === 'list') {
|
|
34
|
-
const autoPaginationMethods = makeAutoPaginationMethods(this, args, spec, requestPromise);
|
|
62
|
+
const autoPaginationMethods = (0, autoPagination_js_1.makeAutoPaginationMethods)(this, args, spec, requestPromise);
|
|
35
63
|
Object.assign(requestPromise, autoPaginationMethods);
|
|
36
64
|
}
|
|
37
65
|
return requestPromise;
|
|
@@ -58,4 +86,4 @@ function populateUrlParamsWithResource(self, args, spec) {
|
|
|
58
86
|
args.unshift(spec.paramsValues);
|
|
59
87
|
}
|
|
60
88
|
}
|
|
61
|
-
|
|
89
|
+
exports.default = telnyxMethod;
|
package/dist/TelnyxResource.js
CHANGED
|
@@ -1,15 +1,43 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const http = __importStar(require("http"));
|
|
30
|
+
const https = __importStar(require("https"));
|
|
31
|
+
const path = __importStar(require("path"));
|
|
32
|
+
const utils = __importStar(require("./utils.js"));
|
|
33
|
+
const TelnyxError = __importStar(require("./Error.js"));
|
|
34
|
+
const TelnyxMethod_js_1 = __importDefault(require("./TelnyxMethod.js"));
|
|
35
|
+
const basicMethods = __importStar(require("./TelnyxMethod.basic.js"));
|
|
8
36
|
const hasOwn = {}.hasOwnProperty;
|
|
9
37
|
// Provide extension mechanism for Telnyx Resource Sub-Classes
|
|
10
38
|
TelnyxResource.extend = utils.protoExtend;
|
|
11
39
|
// Expose method-creator & prepared (basic) methods
|
|
12
|
-
TelnyxResource.method =
|
|
40
|
+
TelnyxResource.method = TelnyxMethod_js_1.default;
|
|
13
41
|
TelnyxResource.BASIC_METHODS = basicMethods;
|
|
14
42
|
TelnyxResource.MAX_BUFFERED_REQUEST_METRICS = 100;
|
|
15
43
|
/**
|
|
@@ -394,4 +422,4 @@ TelnyxResource.prototype = {
|
|
|
394
422
|
}
|
|
395
423
|
},
|
|
396
424
|
};
|
|
397
|
-
|
|
425
|
+
exports.default = TelnyxResource;
|
package/dist/Webhooks.js
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const tweetnacl_1 = __importDefault(require("tweetnacl"));
|
|
30
|
+
const TelnyxError = __importStar(require("./Error.js"));
|
|
3
31
|
const Webhooks = {
|
|
4
32
|
DEFAULT_TOLERANCE: 300, // 5 minutes
|
|
5
33
|
decoder: new TextDecoder('utf8'),
|
|
@@ -15,7 +43,7 @@ const Webhooks = {
|
|
|
15
43
|
let verification;
|
|
16
44
|
try {
|
|
17
45
|
// https://bun.sh/guides/binary/buffer-to-typedarray
|
|
18
|
-
verification =
|
|
46
|
+
verification = tweetnacl_1.default.sign.detached.verify(payloadBuffer, signature, publicKey);
|
|
19
47
|
}
|
|
20
48
|
catch (_e) {
|
|
21
49
|
console.log(_e);
|
|
@@ -49,4 +77,4 @@ function throwSignatureVerificationError(payload, signatureHeader, timestampHead
|
|
|
49
77
|
},
|
|
50
78
|
});
|
|
51
79
|
}
|
|
52
|
-
|
|
80
|
+
exports.default = Webhooks;
|
package/dist/autoPagination.js
CHANGED
|
@@ -1,6 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.makeAutoPaginationMethods = makeAutoPaginationMethods;
|
|
30
|
+
const makeRequest_js_1 = __importDefault(require("./makeRequest.js"));
|
|
31
|
+
const utils = __importStar(require("./utils.js"));
|
|
32
|
+
function makeAutoPaginationMethods(self, requestArgs, spec, firstPagePromise) {
|
|
4
33
|
const promiseCache = { currentPromise: null };
|
|
5
34
|
let listPromise = firstPagePromise;
|
|
6
35
|
let i = 0;
|
|
@@ -20,7 +49,7 @@ export function makeAutoPaginationMethods(self, requestArgs, spec, firstPageProm
|
|
|
20
49
|
i = 0;
|
|
21
50
|
const nextPageNumber = getNextPageNumber(listResult);
|
|
22
51
|
const pageSize = getPageSize(listResult);
|
|
23
|
-
listPromise =
|
|
52
|
+
listPromise = (0, makeRequest_js_1.default)(self, requestArgs, spec, {
|
|
24
53
|
page: { number: nextPageNumber, size: pageSize },
|
|
25
54
|
});
|
|
26
55
|
return listPromise.then(iterate);
|
package/dist/makeRequest.js
CHANGED
|
@@ -1,4 +1,29 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const utils = __importStar(require("./utils.js"));
|
|
2
27
|
const OPTIONAL_REGEX = /^optional!/;
|
|
3
28
|
function _getRequestOpts(self, requestArgs, spec, overrideData) {
|
|
4
29
|
// Extract spec values with defaults.
|
|
@@ -105,4 +130,4 @@ function makeRequest(self, requestArgs, spec, overrideData) {
|
|
|
105
130
|
self._request(opts.requestMethod, opts.host, opts.requestPath, opts.data, opts.auth, { headers: opts.headers }, requestCallback);
|
|
106
131
|
});
|
|
107
132
|
}
|
|
108
|
-
|
|
133
|
+
exports.default = makeRequest;
|
package/dist/multipart.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.multipartRequestDataProcessor = multipartRequestDataProcessor;
|
|
4
|
+
const utils_js_1 = require("./utils.js");
|
|
2
5
|
// Method for formatting HTTP body for the multipart/form-data specification
|
|
3
6
|
// Mostly taken from Fermata.js
|
|
4
7
|
// https://github.com/natevw/fermata/blob/5d9732a33d776ce925013a265935facd1626cc88/fermata.js#L315-L343
|
|
@@ -19,7 +22,7 @@ function multipartDataGenerator(_method, data, headers = {}) {
|
|
|
19
22
|
function q(s) {
|
|
20
23
|
return `"${s.replace(/"|"/g, '%22').replace(/\r\n|\r|\n/g, ' ')}"`;
|
|
21
24
|
}
|
|
22
|
-
const flattenedData = flattenAndStringify(data);
|
|
25
|
+
const flattenedData = (0, utils_js_1.flattenAndStringify)(data);
|
|
23
26
|
for (const k in flattenedData) {
|
|
24
27
|
if (!Object.prototype.hasOwnProperty.call(flattenedData, k)) {
|
|
25
28
|
continue;
|
|
@@ -45,10 +48,10 @@ function multipartDataGenerator(_method, data, headers = {}) {
|
|
|
45
48
|
push('--' + segno + '--');
|
|
46
49
|
return buffer;
|
|
47
50
|
}
|
|
48
|
-
|
|
51
|
+
function multipartRequestDataProcessor(method, data, headers, callback) {
|
|
49
52
|
data = data || {};
|
|
50
53
|
if (method !== 'POST') {
|
|
51
|
-
return callback(null, stringifyRequestData(data));
|
|
54
|
+
return callback(null, (0, utils_js_1.stringifyRequestData)(data));
|
|
52
55
|
}
|
|
53
56
|
this._telnyx._platformFunctions
|
|
54
57
|
.tryBufferData(data)
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AccessIpAddress = void 0;
|
|
7
|
+
const TelnyxResource_js_1 = __importDefault(require("../TelnyxResource.js"));
|
|
8
|
+
exports.AccessIpAddress = TelnyxResource_js_1.default.extend({
|
|
3
9
|
path: 'access_ip_address',
|
|
4
10
|
includeBasic: ['list', 'create', 'retrieve', 'del'],
|
|
5
11
|
});
|
|
@@ -1,5 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AccessIpRanges = void 0;
|
|
7
|
+
const TelnyxResource_js_1 = __importDefault(require("../TelnyxResource.js"));
|
|
8
|
+
exports.AccessIpRanges = TelnyxResource_js_1.default.extend({
|
|
3
9
|
path: 'access_ip_ranges',
|
|
4
10
|
includeBasic: ['list', 'create', 'retrieve', 'del'],
|
|
5
11
|
});
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.Actions = void 0;
|
|
7
|
+
const TelnyxResource_js_1 = __importDefault(require("../TelnyxResource.js"));
|
|
8
|
+
const ActionsSimCards_js_1 = require("./ActionsSimCards.js");
|
|
9
|
+
exports.Actions = TelnyxResource_js_1.default.extend({
|
|
4
10
|
path: 'actions',
|
|
5
11
|
nestedResources: {
|
|
6
|
-
SimCards: ActionsSimCards,
|
|
12
|
+
SimCards: ActionsSimCards_js_1.ActionsSimCards,
|
|
7
13
|
},
|
|
8
14
|
});
|
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.ActionsSimCards = void 0;
|
|
7
|
+
const TelnyxResource_js_1 = __importDefault(require("../TelnyxResource.js"));
|
|
8
|
+
const telnyxMethod = TelnyxResource_js_1.default.method;
|
|
9
|
+
exports.ActionsSimCards = TelnyxResource_js_1.default.extend({
|
|
4
10
|
path: 'actions',
|
|
5
11
|
register: telnyxMethod({
|
|
6
12
|
method: 'POST',
|
|
@@ -1,10 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.ActivateDeactivateBulkCredentials = void 0;
|
|
30
|
+
const TelnyxResource_js_1 = __importDefault(require("../TelnyxResource.js"));
|
|
31
|
+
const utils = __importStar(require("../utils.js"));
|
|
32
|
+
const telnyxMethod = TelnyxResource_js_1.default.method;
|
|
4
33
|
function transformResponseData(response, telnyx) {
|
|
5
34
|
return utils.addResourceToResponseData(response, telnyx, 'actions', {});
|
|
6
35
|
}
|
|
7
|
-
|
|
36
|
+
exports.ActivateDeactivateBulkCredentials = TelnyxResource_js_1.default.extend({
|
|
8
37
|
path: 'actions',
|
|
9
38
|
create: telnyxMethod({
|
|
10
39
|
method: 'POST',
|