Skip to content

Commit

Permalink
update tsconfig and lib to include js extension
Browse files Browse the repository at this point in the history
  • Loading branch information
lucasassisrosa committed Jan 7, 2025
1 parent 097a9b4 commit 4ace4e9
Show file tree
Hide file tree
Showing 151 changed files with 374 additions and 369 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
- Update `ManagedAccounts` resource tests
- Remove network preferences endpoints from `SimCards` resource
- Remove unused `NumberOrderDocuments` resource
- Update `tsconfig.json` to use `Node16` module
- Update relative lib files to include js extension according to [moduleResolution](https://www.typescriptlang.org/tsconfig/#Modules_6244) config

### v2.0.0-beta.4

Expand Down
4 changes: 4 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ export default {
coverageDirectory: 'coverage',
reporters: ['default', ['github-actions', {silent: false}], 'summary'],
roots: ['<rootDir>/src/'],
moduleNameMapper: {
'(.+)\\.js': '$1',
},
extensionsToTreatAsEsm: ['.ts'],
};
2 changes: 1 addition & 1 deletion src/TelnyxMethod.basic.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import telnyxMethod from './TelnyxMethod';
import telnyxMethod from './TelnyxMethod.js';

export const create = telnyxMethod({
method: 'POST',
Expand Down
8 changes: 4 additions & 4 deletions src/TelnyxMethod.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {MethodSpec, TelnyxResourceObject} from './Types';
import * as utils from './utils';
import makeRequest from './makeRequest';
import {makeAutoPaginationMethods} from './autoPagination';
import {MethodSpec, TelnyxResourceObject} from './Types.js';
import * as utils from './utils.js';
import makeRequest from './makeRequest.js';
import {makeAutoPaginationMethods} from './autoPagination.js';

/**
* Create an API method from the declared spec.
Expand Down
10 changes: 5 additions & 5 deletions src/TelnyxResource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import * as http from 'http';
import * as https from 'https';
import * as path from 'path';

import * as utils from './utils';
import * as TelnyxError from './Error';
import TelnyxMethod from './TelnyxMethod';
import * as basicMethods from './TelnyxMethod.basic';
import * as utils from './utils.js';
import * as TelnyxError from './Error.js';
import TelnyxMethod from './TelnyxMethod.js';
import * as basicMethods from './TelnyxMethod.basic.js';
import {
MethodSpec,
ReqHandler,
Expand All @@ -19,7 +19,7 @@ import {
TelnyxIncomingHttpHeaders,
TelnyxObject,
TelnyxResourceObject,
} from './Types';
} from './Types.js';

const hasOwn = {}.hasOwnProperty;

Expand Down
4 changes: 2 additions & 2 deletions src/Types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {
IncomingMessage,
} from 'http';
import {Agent as HttpsAgent} from 'https';
import {TelnyxRawError} from './Error';
import Webhooks from './Webhooks';
import {TelnyxRawError} from './Error.js';
import Webhooks from './Webhooks.js';

export type AppInfo = {name?: string; version?: string; url?: string} & Record<
string,
Expand Down
2 changes: 1 addition & 1 deletion src/Webhooks.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import nacl from 'tweetnacl';
import * as TelnyxError from './Error';
import * as TelnyxError from './Error.js';

type WebhookPayload = string;
type WebhookHeader = Uint8Array;
Expand Down
6 changes: 3 additions & 3 deletions src/autoPagination.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import {
PromiseCache,
RequestArgs,
TelnyxResourceObject,
} from './Types';
import makeRequest from './makeRequest';
import * as utils from './utils';
} from './Types.js';
import makeRequest from './makeRequest.js';
import * as utils from './utils.js';

type IterationResult = {
done: boolean;
Expand Down
4 changes: 2 additions & 2 deletions src/makeRequest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
RequestData,
ResponsePayload,
TelnyxResourceObject,
} from './Types';
import * as utils from './utils';
} from './Types.js';
import * as utils from './utils.js';
const OPTIONAL_REGEX = /^optional!/;

function _getRequestOpts(
Expand Down
4 changes: 2 additions & 2 deletions src/multipart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
RequestHeaders,
TelnyxResourceObject,
TypedData,
} from './Types';
import {flattenAndStringify, stringifyRequestData} from './utils';
} from './Types.js';
import {flattenAndStringify, stringifyRequestData} from './utils.js';

type MultipartCallbackReturn = unknown;
type MultipartCallback = (
Expand Down
2 changes: 1 addition & 1 deletion src/resources/AccessIpAddress.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TelnyxResource from '../TelnyxResource';
import TelnyxResource from '../TelnyxResource.js';

export const AccessIpAddress = TelnyxResource.extend({
path: 'access_ip_address',
Expand Down
2 changes: 1 addition & 1 deletion src/resources/AccessIpRanges.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TelnyxResource from '../TelnyxResource';
import TelnyxResource from '../TelnyxResource.js';

export const AccessIpRanges = TelnyxResource.extend({
path: 'access_ip_ranges',
Expand Down
4 changes: 2 additions & 2 deletions src/resources/Actions.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import TelnyxResource from '../TelnyxResource';
import {ActionsSimCards} from './ActionsSimCards';
import TelnyxResource from '../TelnyxResource.js';
import {ActionsSimCards} from './ActionsSimCards.js';
export const Actions = TelnyxResource.extend({
path: 'actions',

Expand Down
2 changes: 1 addition & 1 deletion src/resources/ActionsSimCards.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TelnyxResource from '../TelnyxResource';
import TelnyxResource from '../TelnyxResource.js';
const telnyxMethod = TelnyxResource.method;

export const ActionsSimCards = TelnyxResource.extend({
Expand Down
6 changes: 3 additions & 3 deletions src/resources/ActivateDeactivateBulkCredentials.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import TelnyxResource from '../TelnyxResource';
import {ResponsePayload, TelnyxObject} from '../Types';
import * as utils from '../utils';
import TelnyxResource from '../TelnyxResource.js';
import {ResponsePayload, TelnyxObject} from '../Types.js';
import * as utils from '../utils.js';
const telnyxMethod = TelnyxResource.method;

function transformResponseData(
Expand Down
6 changes: 3 additions & 3 deletions src/resources/Addresses.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import TelnyxResource from '../TelnyxResource';
import * as utils from '../utils';
import TelnyxResource from '../TelnyxResource.js';
import * as utils from '../utils.js';
const telnyxMethod = TelnyxResource.method;

import {ResponsePayload, TelnyxObject} from '../Types';
import {ResponsePayload, TelnyxObject} from '../Types.js';

function transformResponseData(
response: ResponsePayload,
Expand Down
2 changes: 1 addition & 1 deletion src/resources/AiAssistants.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TelnyxResource from '../TelnyxResource';
import TelnyxResource from '../TelnyxResource.js';
const telnyxMethod = TelnyxResource.method;

export const AiAssistants = TelnyxResource.extend({
Expand Down
2 changes: 1 addition & 1 deletion src/resources/AiAudioTranscriptions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TelnyxResource from '../TelnyxResource';
import TelnyxResource from '../TelnyxResource.js';

export const AiAudioTranscriptions = TelnyxResource.extend({
path: 'ai/audio/transcriptions',
Expand Down
2 changes: 1 addition & 1 deletion src/resources/AiChatCompletions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TelnyxResource from '../TelnyxResource';
import TelnyxResource from '../TelnyxResource.js';

export const AiChatCompletions = TelnyxResource.extend({
path: 'ai/chat/completions',
Expand Down
2 changes: 1 addition & 1 deletion src/resources/AiEmbeddings.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TelnyxResource from '../TelnyxResource';
import TelnyxResource from '../TelnyxResource.js';
const telnyxMethod = TelnyxResource.method;

export const AiEmbeddings = TelnyxResource.extend({
Expand Down
2 changes: 1 addition & 1 deletion src/resources/AiEmbeddingsBuckets.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TelnyxResource from '../TelnyxResource';
import TelnyxResource from '../TelnyxResource.js';
const telnyxMethod = TelnyxResource.method;

export const AiEmbeddingsBuckets = TelnyxResource.extend({
Expand Down
2 changes: 1 addition & 1 deletion src/resources/AiEmbeddingsSimilaritySearch.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TelnyxResource from '../TelnyxResource';
import TelnyxResource from '../TelnyxResource.js';

export const AiEmbeddingsSimilaritySearch = TelnyxResource.extend({
path: 'ai/embeddings/similarity-search',
Expand Down
2 changes: 1 addition & 1 deletion src/resources/AiModels.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TelnyxResource from '../TelnyxResource';
import TelnyxResource from '../TelnyxResource.js';

export const AiModels = TelnyxResource.extend({
path: 'ai/models',
Expand Down
2 changes: 1 addition & 1 deletion src/resources/AiSummarize.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TelnyxResource from '../TelnyxResource';
import TelnyxResource from '../TelnyxResource.js';

export const AiSummarize = TelnyxResource.extend({
path: 'ai/summarize',
Expand Down
2 changes: 1 addition & 1 deletion src/resources/AuditEvents.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TelnyxResource from '../TelnyxResource';
import TelnyxResource from '../TelnyxResource.js';

export const AuditEvents = TelnyxResource.extend({
path: 'audit_events',
Expand Down
2 changes: 1 addition & 1 deletion src/resources/AuthenticationProviders.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TelnyxResource from '../TelnyxResource';
import TelnyxResource from '../TelnyxResource.js';

export const AuthenticationProviders = TelnyxResource.extend({
path: 'authentication_providers',
Expand Down
2 changes: 1 addition & 1 deletion src/resources/AvailablePhoneNumbers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TelnyxResource from '../TelnyxResource';
import TelnyxResource from '../TelnyxResource.js';

export const AvailablePhoneNumbers = TelnyxResource.extend({
path: 'available_phone_numbers',
Expand Down
2 changes: 1 addition & 1 deletion src/resources/AvailablePhoneNumbersBlocks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TelnyxResource from '../TelnyxResource';
import TelnyxResource from '../TelnyxResource.js';

export const AvailablePhoneNumbersBlocks = TelnyxResource.extend({
path: 'available_phone_number_blocks',
Expand Down
2 changes: 1 addition & 1 deletion src/resources/Balance.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TelnyxResource from '../TelnyxResource';
import TelnyxResource from '../TelnyxResource.js';
export const Balance = TelnyxResource.extend({
path: 'balance',

Expand Down
2 changes: 1 addition & 1 deletion src/resources/BillingGroups.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TelnyxResource from '../TelnyxResource';
import TelnyxResource from '../TelnyxResource.js';

export const BillingGroups = TelnyxResource.extend({
path: 'billing_groups',
Expand Down
2 changes: 1 addition & 1 deletion src/resources/Brands.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TelnyxResource from '../TelnyxResource';
import TelnyxResource from '../TelnyxResource.js';
const telnyxMethod = TelnyxResource.method;

export const Brands = TelnyxResource.extend({
Expand Down
2 changes: 1 addition & 1 deletion src/resources/BulkCredentials.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TelnyxResource from '../TelnyxResource';
import TelnyxResource from '../TelnyxResource.js';
const telnyxMethod = TelnyxResource.method;

export const BulkCredentials = TelnyxResource.extend({
Expand Down
2 changes: 1 addition & 1 deletion src/resources/BulkSoleProprietorCreation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TelnyxResource from '../TelnyxResource';
import TelnyxResource from '../TelnyxResource.js';
const telnyxMethod = TelnyxResource.method;

export const BulkSoleProprietorCreation = TelnyxResource.extend({
Expand Down
6 changes: 3 additions & 3 deletions src/resources/BulkTelephonyCredentials.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import TelnyxResource from '../TelnyxResource';
import * as utils from '../utils';
import TelnyxResource from '../TelnyxResource.js';
import * as utils from '../utils.js';
const telnyxMethod = TelnyxResource.method;

import {ResponsePayload, TelnyxObject} from '../Types';
import {ResponsePayload, TelnyxObject} from '../Types.js';

function transformResponseData(
response: ResponsePayload,
Expand Down
6 changes: 3 additions & 3 deletions src/resources/CallControlApplications.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import TelnyxResource from '../TelnyxResource';
import * as utils from '../utils';
import TelnyxResource from '../TelnyxResource.js';
import * as utils from '../utils.js';
const telnyxMethod = TelnyxResource.method;

import {ResponsePayload, TelnyxObject} from '../Types';
import {ResponsePayload, TelnyxObject} from '../Types.js';

function transformResponseData(
response: ResponsePayload,
Expand Down
2 changes: 1 addition & 1 deletion src/resources/CallEvents.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TelnyxResource from '../TelnyxResource';
import TelnyxResource from '../TelnyxResource.js';

export const CallEvents = TelnyxResource.extend({
path: 'call_events',
Expand Down
2 changes: 1 addition & 1 deletion src/resources/CallRecordings.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TelnyxResource from '../TelnyxResource';
import TelnyxResource from '../TelnyxResource.js';
const telnyxMethod = TelnyxResource.method;

export const CallRecordings = TelnyxResource.extend({
Expand Down
4 changes: 2 additions & 2 deletions src/resources/Calls.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import TelnyxResource from '../TelnyxResource';
import * as utils from '../utils';
import TelnyxResource from '../TelnyxResource.js';
import * as utils from '../utils.js';
const telnyxMethod = TelnyxResource.method;

const CALL_COMMANDS = [
Expand Down
6 changes: 3 additions & 3 deletions src/resources/Campaign.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import TelnyxResource from '../TelnyxResource';
import * as utils from '../utils';
import TelnyxResource from '../TelnyxResource.js';
import * as utils from '../utils.js';
const telnyxMethod = TelnyxResource.method;

import {ResponsePayload, TelnyxObject} from '../Types';
import {ResponsePayload, TelnyxObject} from '../Types.js';

function transformResponseData(
response: ResponsePayload,
Expand Down
6 changes: 3 additions & 3 deletions src/resources/CampaignBuilder.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import TelnyxResource from '../TelnyxResource';
import * as utils from '../utils';
import TelnyxResource from '../TelnyxResource.js';
import * as utils from '../utils.js';
const telnyxMethod = TelnyxResource.method;

import {ResponsePayload, TelnyxObject} from '../Types';
import {ResponsePayload, TelnyxObject} from '../Types.js';

function transformResponseData(
response: ResponsePayload,
Expand Down
2 changes: 1 addition & 1 deletion src/resources/CdrUsageReports.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TelnyxResource from '../TelnyxResource';
import TelnyxResource from '../TelnyxResource.js';
const telnyxMethod = TelnyxResource.method;

export const CdrUsageReports = TelnyxResource.extend({
Expand Down
2 changes: 1 addition & 1 deletion src/resources/Channelzones.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TelnyxResource from '../TelnyxResource';
import TelnyxResource from '../TelnyxResource.js';
const telnyxMethod = TelnyxResource.method;

export const Channelzones = TelnyxResource.extend({
Expand Down
6 changes: 3 additions & 3 deletions src/resources/Conferences.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import TelnyxResource from '../TelnyxResource';
import {ResponsePayload, TelnyxObject} from '../Types';
import * as utils from '../utils';
import TelnyxResource from '../TelnyxResource.js';
import {ResponsePayload, TelnyxObject} from '../Types.js';
import * as utils from '../utils.js';
const telnyxMethod = TelnyxResource.method;

const CONFERENCES_COMMANDS = [
Expand Down
2 changes: 1 addition & 1 deletion src/resources/Connections.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TelnyxResource from '../TelnyxResource';
import TelnyxResource from '../TelnyxResource.js';
const telnyxMethod = TelnyxResource.method;

export const Connections = TelnyxResource.extend({
Expand Down
2 changes: 1 addition & 1 deletion src/resources/CredentialConnections.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TelnyxResource from '../TelnyxResource';
import TelnyxResource from '../TelnyxResource.js';

export const CredentialConnections = TelnyxResource.extend({
path: 'credential_connections',
Expand Down
2 changes: 1 addition & 1 deletion src/resources/CustomerServiceRecords.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TelnyxResource from '../TelnyxResource';
import TelnyxResource from '../TelnyxResource.js';
const telnyxMethod = TelnyxResource.method;

export const CustomerServiceRecords = TelnyxResource.extend({
Expand Down
2 changes: 1 addition & 1 deletion src/resources/DetailRecords.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TelnyxResource from '../TelnyxResource';
import TelnyxResource from '../TelnyxResource.js';
const telnyxMethod = TelnyxResource.method;

export const DetailRecords = TelnyxResource.extend({
Expand Down
2 changes: 1 addition & 1 deletion src/resources/DialogflowConnections.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TelnyxResource from '../TelnyxResource';
import TelnyxResource from '../TelnyxResource.js';
const telnyxMethod = TelnyxResource.method;

export const DialogflowConnections = TelnyxResource.extend({
Expand Down
2 changes: 1 addition & 1 deletion src/resources/DocumentLinks.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TelnyxResource from '../TelnyxResource';
import TelnyxResource from '../TelnyxResource.js';

export const DocumentLinks = TelnyxResource.extend({
path: '/document_links',
Expand Down
2 changes: 1 addition & 1 deletion src/resources/Documents.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import TelnyxResource from '../TelnyxResource';
import TelnyxResource from '../TelnyxResource.js';

const telnyxMethod = TelnyxResource.method;

Expand Down
Loading

0 comments on commit 4ace4e9

Please sign in to comment.