@drawbridge/drawbridge-utils 0.0.134 → 0.0.136
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/dist/connections/index.cjs +230 -106
- package/dist/connections/index.d.cts +167 -17
- package/dist/connections/index.d.ts +167 -17
- package/dist/connections/index.js +230 -106
- package/dist/connections/oauth.cjs +8 -2
- package/dist/connections/oauth.d.cts +14 -3
- package/dist/connections/oauth.d.ts +14 -3
- package/dist/connections/oauth.js +8 -2
- package/dist/pricing.cjs +727 -695
- package/dist/pricing.d.cts +53 -5
- package/dist/pricing.d.ts +53 -5
- package/dist/pricing.js +726 -695
- package/dist/providers.cjs +230 -106
- package/dist/providers.d.cts +4 -4
- package/dist/providers.d.ts +4 -4
- package/dist/providers.js +230 -106
- package/dist/twilio.cjs +51 -0
- package/dist/twilio.d.cts +67 -0
- package/dist/twilio.d.ts +67 -0
- package/dist/twilio.js +51 -0
- package/package.json +2 -2
package/dist/twilio.js
CHANGED
|
@@ -149,6 +149,57 @@ var twilio = {
|
|
|
149
149
|
sid: result == null ? void 0 : result.sid
|
|
150
150
|
};
|
|
151
151
|
},
|
|
152
|
+
// THE NUMBER AS TWILIO HOLDS IT NOW. Same IncomingPhoneNumber resource the
|
|
153
|
+
// purchase and release above use (api.twilio.com 2010-04-01, GET
|
|
154
|
+
// /IncomingPhoneNumbers/{sid}.json) — a 404 means the number is no longer
|
|
155
|
+
// on the account, which the health sweep must distinguish from a transient,
|
|
156
|
+
// so it is answered as { gone : true } rather than thrown.
|
|
157
|
+
numberConfig: async ({ accountSid, authToken, request: request2 = request, sid }) => {
|
|
158
|
+
if (!accountSid || !authToken) throw new Error("Twilio credentials missing \u2014 accountSid, authToken");
|
|
159
|
+
if (!sid) throw new Error("Twilio config read needs the IncomingPhoneNumber sid");
|
|
160
|
+
let result;
|
|
161
|
+
try {
|
|
162
|
+
result = await request2({
|
|
163
|
+
method: "GET",
|
|
164
|
+
url: "https://api.twilio.com/2010-04-01/Accounts/" + accountSid + "/IncomingPhoneNumbers/" + sid + ".json",
|
|
165
|
+
headers: {
|
|
166
|
+
"Authorization": "Basic " + Buffer.from(accountSid + ":" + authToken).toString("base64")
|
|
167
|
+
}
|
|
168
|
+
});
|
|
169
|
+
} catch (error) {
|
|
170
|
+
if ((error == null ? void 0 : error.status) === 404) return { gone: true };
|
|
171
|
+
throw error;
|
|
172
|
+
}
|
|
173
|
+
return {
|
|
174
|
+
gone: false,
|
|
175
|
+
number: result == null ? void 0 : result.phone_number,
|
|
176
|
+
smsMethod: result == null ? void 0 : result.sms_method,
|
|
177
|
+
smsUrl: result == null ? void 0 : result.sms_url,
|
|
178
|
+
status: result == null ? void 0 : result.status
|
|
179
|
+
};
|
|
180
|
+
},
|
|
181
|
+
// RE-POINT AN OWNED NUMBER'S INBOUND WEBHOOK — POST on the same resource,
|
|
182
|
+
// the exact fields purchase sets. The health sweep's repair arm.
|
|
183
|
+
updateNumber: async ({ accountSid, authToken, request: request2 = request, sid, smsUrl }) => {
|
|
184
|
+
if (!accountSid || !authToken) throw new Error("Twilio credentials missing \u2014 accountSid, authToken");
|
|
185
|
+
if (!sid) throw new Error("Twilio update needs the IncomingPhoneNumber sid");
|
|
186
|
+
if (!smsUrl) throw new Error("Twilio update needs the smsUrl to point the number at");
|
|
187
|
+
const result = await request2({
|
|
188
|
+
method: "POST",
|
|
189
|
+
type: "form",
|
|
190
|
+
url: "https://api.twilio.com/2010-04-01/Accounts/" + accountSid + "/IncomingPhoneNumbers/" + sid + ".json",
|
|
191
|
+
headers: {
|
|
192
|
+
"Authorization": "Basic " + Buffer.from(accountSid + ":" + authToken).toString("base64")
|
|
193
|
+
},
|
|
194
|
+
body: {
|
|
195
|
+
SmsUrl: smsUrl,
|
|
196
|
+
SmsMethod: "POST"
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
return {
|
|
200
|
+
smsUrl: result == null ? void 0 : result.sms_url
|
|
201
|
+
};
|
|
202
|
+
},
|
|
152
203
|
releaseNumber: async ({ accountSid, authToken, request: request2 = request, sid }) => {
|
|
153
204
|
if (!accountSid || !authToken) throw new Error("Twilio credentials missing \u2014 accountSid, authToken");
|
|
154
205
|
if (!sid) throw new Error("Twilio release needs the IncomingPhoneNumber sid");
|
package/package.json
CHANGED
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"tinycolor2": "1.6.0"
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
|
-
"@drawbridge/drawbridge-agents": "0.1.
|
|
16
|
+
"@drawbridge/drawbridge-agents": "0.1.47",
|
|
17
17
|
"@node-oauth/oauth2-server": "5.3.0",
|
|
18
18
|
"tsup": "8.5.1",
|
|
19
19
|
"typescript": "5.9.3",
|
|
@@ -215,5 +215,5 @@
|
|
|
215
215
|
"test": ". \"$HOME/.nvm/nvm.sh\" && nvm use && node --test"
|
|
216
216
|
},
|
|
217
217
|
"types": "dist/index.d.ts",
|
|
218
|
-
"version": "0.0.
|
|
218
|
+
"version": "0.0.136"
|
|
219
219
|
}
|