Auto-commit 2026-04-29 16:31

This commit is contained in:
2026-04-29 16:31:27 -04:00
parent e8687bb6b2
commit 0495ee5bd2
19691 changed files with 3272886 additions and 138 deletions

View File

@@ -0,0 +1,8 @@
import TokenManager from "./TokenManager";
import { TokenListInstanceCreateOptions } from "../../rest/oauth/v2/token";
export default class ApiTokenManager implements TokenManager {
private params;
constructor(params: TokenListInstanceCreateOptions);
getParams(): TokenListInstanceCreateOptions;
fetchToken(): Promise<string>;
}

View File

@@ -0,0 +1,33 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const token_1 = require("../../rest/oauth/v2/token");
const OauthBase_1 = __importDefault(require("../../rest/OauthBase"));
const V2_1 = __importDefault(require("../../rest/oauth/V2"));
const NoAuthCredentialProvider_1 = __importDefault(require("../../credential_provider/NoAuthCredentialProvider"));
const BaseTwilio_1 = require("../../base/BaseTwilio");
class ApiTokenManager {
constructor(params) {
this.params = params;
}
getParams() {
return this.params;
}
async fetchToken() {
const noAuthCredentialProvider = new NoAuthCredentialProvider_1.default.NoAuthCredentialProvider();
const client = new BaseTwilio_1.Client();
client.setCredentialProvider(noAuthCredentialProvider);
const tokenListInstance = (0, token_1.TokenListInstance)(new V2_1.default(new OauthBase_1.default(client)));
return tokenListInstance
.create(this.params)
.then((token) => {
return token.accessToken;
})
.catch((error) => {
throw new Error(`Error Status Code: ${error.status}\nFailed to fetch access token: ${error.message}`);
});
}
}
exports.default = ApiTokenManager;

View File

@@ -0,0 +1,8 @@
import TokenManager from "./TokenManager";
import { TokenListInstanceCreateOptions } from "../../rest/oauth/v2/token";
export default class OrgsTokenManager implements TokenManager {
private readonly params;
constructor(params: TokenListInstanceCreateOptions);
getParams(): TokenListInstanceCreateOptions;
fetchToken(): Promise<string>;
}

View File

@@ -0,0 +1,33 @@
"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const token_1 = require("../../rest/oauth/v2/token");
const OauthBase_1 = __importDefault(require("../../rest/OauthBase"));
const V2_1 = __importDefault(require("../../rest/oauth/V2"));
const NoAuthCredentialProvider_1 = __importDefault(require("../../credential_provider/NoAuthCredentialProvider"));
const BaseTwilio_1 = require("../../base/BaseTwilio");
class OrgsTokenManager {
constructor(params) {
this.params = params;
}
getParams() {
return this.params;
}
async fetchToken() {
const noAuthCredentialProvider = new NoAuthCredentialProvider_1.default.NoAuthCredentialProvider();
const client = new BaseTwilio_1.Client();
client.setCredentialProvider(noAuthCredentialProvider);
const tokenListInstance = (0, token_1.TokenListInstance)(new V2_1.default(new OauthBase_1.default(client)));
return tokenListInstance
.create(this.params)
.then((token) => {
return token.accessToken;
})
.catch((error) => {
throw new Error(`Error Status Code: ${error.status}\nFailed to fetch access token: ${error.message}`);
});
}
}
exports.default = OrgsTokenManager;

View File

@@ -0,0 +1,3 @@
export default abstract class TokenManager {
abstract fetchToken(): Promise<string>;
}

View File

@@ -0,0 +1,5 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class TokenManager {
}
exports.default = TokenManager;

25
node_modules/twilio/lib/http/request.d.ts generated vendored Normal file
View File

@@ -0,0 +1,25 @@
import { HttpMethod } from "../interfaces";
export interface RequestOptions<TData> {
method?: HttpMethod | "*";
url?: string;
auth?: string;
params?: object | "*";
data?: TData | "*";
headers?: Headers;
}
export interface Headers {
[header: string]: string;
}
export default class Request<TData> {
method: HttpMethod | "*";
url: string;
auth: string;
params: object | "*";
data: TData | "*";
headers: Headers | "*";
constructor(opts?: RequestOptions<TData>);
get ANY(): "*";
attributeEqual(lhs: any, rhs: any): boolean;
isEqual(other: Request<any>): boolean;
toString(): string;
}

85
node_modules/twilio/lib/http/request.js generated vendored Normal file
View File

@@ -0,0 +1,85 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class Request {
constructor(opts) {
opts = opts || {};
this.method = opts.method || this.ANY;
this.url = opts.url || this.ANY;
this.auth = opts.auth || this.ANY;
this.params = opts.params || this.ANY;
this.data = opts.data || this.ANY;
this.headers = opts.headers || this.ANY;
}
get ANY() {
return "*";
}
attributeEqual(lhs, rhs) {
if (lhs === this.ANY || rhs === this.ANY) {
return true;
}
lhs = lhs || undefined;
rhs = rhs || undefined;
if (typeof lhs !== typeof rhs) {
return false;
}
if (typeof lhs !== "object") {
return lhs === rhs;
}
return (Object.entries(lhs)
.sort((a, b) => a[0].localeCompare(b[0]))
.toString() ===
Object.entries(rhs)
.sort((a, b) => a[0].localeCompare(b[0]))
.toString());
}
isEqual(other) {
return (this.attributeEqual(this.method, other.method) &&
this.attributeEqual(this.url, other.url) &&
this.attributeEqual(this.auth, other.auth) &&
this.attributeEqual(this.params, other.params) &&
this.attributeEqual(this.data, other.data) &&
this.attributeEqual(this.headers, other.headers));
}
toString() {
var auth = "";
if (this.auth && this.auth !== this.ANY) {
auth = this.auth + " ";
}
var params = "";
if (this.params && this.params !== this.ANY) {
params =
"?" +
Object.keys(this.params)
.map((key) => function () {
return key + "=" + this.params[key];
}.bind(this)())
.join("&");
}
var data = "";
if (this.data && this.data !== this.ANY) {
if (this.method === "get") {
data = "\n -G";
}
data =
data +
"\n" +
Object.entries(this.data)
.map((d) => {
return " -d " + d[0] + "=" + d[1];
})
.join("\n");
}
var headers = "";
if (this.headers && this.headers !== this.ANY) {
headers =
"\n" +
Object.entries(this.headers)
.map((header) => {
return " -H " + header[0] + "=" + header[1];
})
.join("\n");
}
return auth + this.method + " " + this.url + params + data + headers;
}
}
exports.default = Request;

7
node_modules/twilio/lib/http/response.d.ts generated vendored Normal file
View File

@@ -0,0 +1,7 @@
export default class Response<TPayload> {
statusCode: number;
body: TPayload;
headers: any;
constructor(statusCode: number, body: TPayload, headers: any);
toString(): string;
}

13
node_modules/twilio/lib/http/response.js generated vendored Normal file
View File

@@ -0,0 +1,13 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class Response {
constructor(statusCode, body, headers) {
this.statusCode = statusCode;
this.body = body;
this.headers = headers;
}
toString() {
return "HTTP " + this.statusCode + " " + this.body;
}
}
exports.default = Response;