diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 7db0f1c51..3bf06e83b 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -87,9 +87,8 @@ jobs: - name: SIP Connect v1.1 Compliance Tests if: github.event.inputs.with_tests == 'true' run: | - docker-compose -f compose.yaml -f compose.dev.yaml up \ - --build --abort-on-container-exit --exit-code-from compliance \ - compliance edgeport01 edgeport02 dispatcher registry requester apiserver connect location + docker compose -f compose.yaml -f compose.dev.yaml up \ + --build --abort-on-container-exit --exit-code-from compliance compliance publish-to-docker-hub: name: Publish to Docker Hub diff --git a/compose.dev.yaml b/compose.dev.yaml index 87d6d9fdd..a6fc287f5 100644 --- a/compose.dev.yaml +++ b/compose.dev.yaml @@ -156,12 +156,12 @@ services: # # SIP End to End Test (SEET) compliance test for SIPConnect v1.1 support - # docker-compose -f compose.yaml -f compose.dev.yaml up \ - # --abort-on-container-exit --exit-code-from compliance + # docker compose -f compose.yaml -f compose.dev.yaml up \ + # --build --abort-on-container-exit --exit-code-from compliance compliance # compliance: container_name: compliance - image: fonoster/seet:1.1.1 + image: fonoster/seet:1.2.0 depends_on: - edgeport01 - edgeport02 @@ -170,6 +170,7 @@ services: - requester - apiserver - connect + - location environment: SCENARIOS: /seet.json ports: diff --git a/etc/scenarios/rr/uac_invite_callee_bye.xml b/etc/scenarios/rr/uac_invite_callee_bye.xml index 325e1ba7b..395290387 100644 --- a/etc/scenarios/rr/uac_invite_callee_bye.xml +++ b/etc/scenarios/rr/uac_invite_callee_bye.xml @@ -1,7 +1,7 @@ - + @@ -87,7 +87,8 @@ - + - + diff --git a/etc/seet.json b/etc/seet.json index 24f59428b..7228fd7e3 100644 --- a/etc/seet.json +++ b/etc/seet.json @@ -83,7 +83,7 @@ }, { "name": "=== Registering sip.provider.net for 1200 seconds to prevent collisions ===", - "description": "Hack to prevent trunk from sending additional REGISTER meesages.", + "description": "Hack to prevent trunk from sending additional REGISTER messages.", "transportMode": "u1", "userAgents": [ { @@ -607,7 +607,7 @@ ] }, { - "name": "RR.Tst.Plan.1.4.1: Sending a SIP Message to a Peer with Load Balacing in Round Robin Mode", + "name": "RR.Tst.Plan.1.4.1: Sending a SIP Message to a Peer with Load Balancing in Round Robin Mode", "description": "This test verifies that Routr correctly routes a SIP message to a Peer with load balancing in Round Robin Mode", "transportMode": "u1", "target": "sip01.edgeport.net:5060", @@ -674,8 +674,8 @@ ] }, { - "name": "RR.Tst.Plan.1.4.2: Sending a SIP Message to a Peer with Load Balacing using Least-Sessions Mode", - "description": "Unsupported scenario. Please enable and visualy inspect the signaling!", + "name": "RR.Tst.Plan.1.4.2: Sending a SIP Message to a Peer with Load Balancing using Least-Sessions Mode", + "description": "Unsupported scenario. Please enable and visually inspect the signaling!", "transportMode": "u1", "target": "sip01.edgeport.net:5060", "enabled": false, diff --git a/lerna.json b/lerna.json index 65636293d..357f017ab 100644 --- a/lerna.json +++ b/lerna.json @@ -1,4 +1,4 @@ { "packages": ["mods/*"], - "version": "2.12.1" + "version": "2.13.4" } diff --git a/mods/common/.lerna-changed-buster-27550 b/mods/common/.lerna-changed-buster-8289 similarity index 100% rename from mods/common/.lerna-changed-buster-27550 rename to mods/common/.lerna-changed-buster-8289 diff --git a/mods/common/package.json b/mods/common/package.json index 4f87ed474..0eaf0ed85 100644 --- a/mods/common/package.json +++ b/mods/common/package.json @@ -1,6 +1,6 @@ { "name": "@routr/common", - "version": "2.12.1", + "version": "2.13.4", "description": "Common package", "author": "Pedro Sanders ", "homepage": "https://github.com/fonoster/routr#readme", diff --git a/mods/common/src/connect/api/types.ts b/mods/common/src/connect/api/types.ts index 4f28a5036..46b41afae 100644 --- a/mods/common/src/connect/api/types.ts +++ b/mods/common/src/connect/api/types.ts @@ -17,7 +17,6 @@ * limitations under the License. */ import * as grpc from "@grpc/grpc-js" -import { JsonObject } from "pb-util/build" import { AccessControlList, Agent, @@ -71,7 +70,7 @@ export type APIClient = { numbers: ServiceAPI } -export type ServiceAPI = { +export type ServiceAPI }> = { create: (request: unknown) => Promise update: (request: unknown) => Promise get: (ref: string) => Promise diff --git a/mods/common/src/connect/assertions.ts b/mods/common/src/connect/assertions.ts index 1596e2922..1c81ef51a 100644 --- a/mods/common/src/connect/assertions.ts +++ b/mods/common/src/connect/assertions.ts @@ -81,7 +81,7 @@ export const hasValidACLRulesOrThrow = (acl: { allow: string[] }) => validOrThrow(hasValidACLRules, acl) -export const hasRefenceOrThrow = (ref: string) => +export const hasReferenceOrThrow = (ref: string) => validOrThrow(hasReference, ref) export const hasNameOrThrow = (name: string) => validOrThrow(hasName, name) diff --git a/mods/common/src/connect/client.ts b/mods/common/src/connect/client.ts index 4c6cb419d..f2bcaa909 100644 --- a/mods/common/src/connect/client.ts +++ b/mods/common/src/connect/client.ts @@ -21,14 +21,7 @@ import * as grpc from "@grpc/grpc-js" import { toPascalCase } from "../helper" import { Kind, KindWithoutUnknown } from "./types" import protoLoader = require("@grpc/proto-loader") - -const protoOptions = { - keepCase: false, - longs: String, - enums: String, - defaults: true, - oneofs: true -} +import { protoLoadOptions } from "../service" function getProtoPath(kind: Kind): string { switch (kind) { @@ -46,7 +39,7 @@ export function createConnectClient(options: { credentials: grpc.ChannelCredentials apiAddr: string }) { - const def = protoLoader.loadSync(getProtoPath(options.kind), protoOptions) + const def = protoLoader.loadSync(getProtoPath(options.kind), protoLoadOptions) const descriptor = grpc.loadPackageDefinition(def) as any const base = descriptor.fonoster.routr.connect @@ -69,7 +62,12 @@ export function createConnectClient(options: { } export function createConnectService(kind: KindWithoutUnknown) { - const def = protoLoader.loadSync(getProtoPath(kind), protoOptions) + // Here we set defaults to simplify partial updates + const actualProtoOptions = { + ...protoLoadOptions, + defaults: false + } + const def = protoLoader.loadSync(getProtoPath(kind), actualProtoOptions) const descriptor = grpc.loadPackageDefinition(def) as any const base = descriptor.fonoster.routr.connect diff --git a/mods/common/src/connect/config.ts b/mods/common/src/connect/config.ts index bc1cbe00d..793327109 100644 --- a/mods/common/src/connect/config.ts +++ b/mods/common/src/connect/config.ts @@ -17,10 +17,10 @@ * limitations under the License. */ import { LoadBalancingAlgorithm, Privacy, Transport } from "../types" -import { Kind } from "./types" +import { APIVersion, Kind } from "./types" export interface ConfigBase { - apiVersion: string + apiVersion: APIVersion ref: string metadata: { name: string } } diff --git a/mods/common/src/connect/mappers/acl.ts b/mods/common/src/connect/mappers/acl.ts index b324684e1..4439a05d5 100644 --- a/mods/common/src/connect/mappers/acl.ts +++ b/mods/common/src/connect/mappers/acl.ts @@ -32,6 +32,8 @@ export function mapToACL(config: AccessControlListConfig): AccessControlList { ref: config.ref, name: config.metadata.name, allow: config.spec.accessControlList?.allow ?? [], - deny: config.spec.accessControlList?.deny ?? [] + deny: config.spec.accessControlList?.deny ?? [], + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } } diff --git a/mods/common/src/connect/mappers/agent.ts b/mods/common/src/connect/mappers/agent.ts index 7f0708508..eaa5a870c 100644 --- a/mods/common/src/connect/mappers/agent.ts +++ b/mods/common/src/connect/mappers/agent.ts @@ -34,10 +34,12 @@ export function mapToAgent(config: AgentConfig): Agent { name: config.metadata.name, username: config.spec.username, privacy: config.spec.privacy ?? Privacy.NONE, - enabled: config.spec.enabled as boolean, + enabled: config.spec.enabled, domainRef: config.spec.domainRef, credentialsRef: config.spec.credentialsRef, maxContacts: config.spec.maxContacts, - expires: config.spec.expires + expires: config.spec.expires, + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } } diff --git a/mods/common/src/connect/mappers/credentials.ts b/mods/common/src/connect/mappers/credentials.ts index 36a1ff097..b1bab3578 100644 --- a/mods/common/src/connect/mappers/credentials.ts +++ b/mods/common/src/connect/mappers/credentials.ts @@ -32,6 +32,8 @@ export function mapToCredentials(config: CredentialsConfig): Credentials { ref: config.ref, name: config.metadata.name, username: config.spec.credentials.username, - password: config.spec.credentials.password + password: config.spec.credentials.password, + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } } diff --git a/mods/common/src/connect/mappers/domain.ts b/mods/common/src/connect/mappers/domain.ts index dfaf4958b..43b4ca504 100644 --- a/mods/common/src/connect/mappers/domain.ts +++ b/mods/common/src/connect/mappers/domain.ts @@ -33,6 +33,8 @@ export function mapToDomain(config: DomainConfig): Domain { name: config.metadata.name, domainUri: config.spec.context.domainUri, accessControlListRef: config.spec.accessControlListRef, - egressPolicies: config.spec.context.egressPolicies + egressPolicies: config.spec.context.egressPolicies, + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } } diff --git a/mods/common/src/connect/mappers/number.ts b/mods/common/src/connect/mappers/number.ts index 9e841a4d1..582f588d7 100644 --- a/mods/common/src/connect/mappers/number.ts +++ b/mods/common/src/connect/mappers/number.ts @@ -41,6 +41,8 @@ export function mapToNumber(config: NumberConfig): INumber { aorLink: location.aorLink, sessionAffinityHeader: location.sessionAffinityHeader, extraHeaders: location.extraHeaders, - trunkRef: config.spec.trunkRef + trunkRef: config.spec.trunkRef, + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } } diff --git a/mods/common/src/connect/mappers/peer.ts b/mods/common/src/connect/mappers/peer.ts index 428efa5ef..dedfbcb04 100644 --- a/mods/common/src/connect/mappers/peer.ts +++ b/mods/common/src/connect/mappers/peer.ts @@ -44,6 +44,8 @@ export function mapToPeer(config: PeerConfig): Peer { ), withSessionAffinity: config.spec.loadBalancing?.withSessionAffinity, maxContacts: config.spec.maxContacts, - expires: config.spec.expires + expires: config.spec.expires, + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } } diff --git a/mods/common/src/connect/mappers/trunk.ts b/mods/common/src/connect/mappers/trunk.ts index 2605b8f34..3e1b16d0f 100644 --- a/mods/common/src/connect/mappers/trunk.ts +++ b/mods/common/src/connect/mappers/trunk.ts @@ -47,6 +47,8 @@ export function mapToTrunk(config: TrunkConfig): Trunk { weight: entry.weight, priority: entry.priority } - }) + }), + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } } diff --git a/mods/common/src/connect/types.ts b/mods/common/src/connect/types.ts index 179942506..0d76a438b 100644 --- a/mods/common/src/connect/types.ts +++ b/mods/common/src/connect/types.ts @@ -16,7 +16,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { JsonObject } from "pb-util/build" import { LoadBalancingAlgorithm, Privacy, Transport } from "../types" export enum Kind { @@ -33,17 +32,17 @@ export enum Kind { export type KindWithoutUnknown = Exclude export enum APIVersion { - v2beta1 = "v2beta1", + V2BETA1 = "v2beta1", V2 = "v2" } export interface BaseConnectModel { - apiVersion: string + apiVersion: APIVersion ref: string name: string - createdAt?: number - updatedAt?: number - extended?: JsonObject + createdAt: number + updatedAt: number + extended?: Record } export interface AccessControlList extends BaseConnectModel { @@ -87,8 +86,8 @@ export interface INumber extends BaseConnectModel { city: string country: string countryIsoCode: string - sessionAffinityHeader: string - extraHeaders: { name: string; value: string }[] + sessionAffinityHeader?: string + extraHeaders?: { name: string; value: string }[] trunkRef?: string trunk?: Trunk } diff --git a/mods/common/src/connect/validations.ts b/mods/common/src/connect/validations.ts index dcca3be0c..4ee1d360c 100644 --- a/mods/common/src/connect/validations.ts +++ b/mods/common/src/connect/validations.ts @@ -96,7 +96,9 @@ export const isValidHeader = (header: string) => { : true } -export const hasValidHeaders = (headers: { name: string; value: string }[]) => { +export const hasValidHeaders = ( + headers: { name: string; value: string }[] = [] +) => { // eslint-disable-next-line no-loops/no-loops for (const header of headers) { const E = isValidHeader(header.name) as true | BadRequestError @@ -159,7 +161,7 @@ export const hasACLRules = (acl: { deny: string[]; allow: string[] }) => { return true } -export const isValidACLRule = (rules: string[]) => { +export const isValidACLRule = (rules: string[] = []) => { // eslint-disable-next-line no-loops/no-loops for (const cidr of rules) { if ( diff --git a/mods/common/src/protos/location.proto b/mods/common/src/protos/location.proto index 1a0765eb3..52314847f 100644 --- a/mods/common/src/protos/location.proto +++ b/mods/common/src/protos/location.proto @@ -65,13 +65,13 @@ message AddRouteRequest { message FindRoutesRequest { message Backend { - enum Algoritm { + enum Algorithm { ROUND_ROBIN = 0; LEAST_SESSIONS = 1; } string ref = 1; bool with_session_affinity = 2; - Algoritm algorithm = 3; + Algorithm algorithm = 3; } string call_id = 1; string aor = 2; diff --git a/mods/common/src/requester/grpc_client.ts b/mods/common/src/requester/grpc_client.ts index da1870c12..6e06abdf1 100644 --- a/mods/common/src/requester/grpc_client.ts +++ b/mods/common/src/requester/grpc_client.ts @@ -18,16 +18,11 @@ */ import * as grpc from "@grpc/grpc-js" import protoLoader = require("@grpc/proto-loader") +import { protoLoadOptions } from "../service" const packageDefinition = protoLoader.loadSync( __dirname + "/../protos/requester.proto", - { - keepCase: false, - longs: String, - enums: String, - defaults: true, - oneofs: true - } + protoLoadOptions ) // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/mods/common/src/response.ts b/mods/common/src/response.ts index 653f3f39f..90c4a1a80 100644 --- a/mods/common/src/response.ts +++ b/mods/common/src/response.ts @@ -67,7 +67,7 @@ export const createServerInternalErrorResponse = ( } } -export const createForbideenResponse = (metadata?: Record) => { +export const createForbiddenResponse = (metadata?: Record) => { return { metadata, message: { diff --git a/mods/common/src/service.ts b/mods/common/src/service.ts index 694627662..dce9dddab 100644 --- a/mods/common/src/service.ts +++ b/mods/common/src/service.ts @@ -26,7 +26,7 @@ import { GRPC_SERVING_STATUS, statusMap } from "@fonoster/common" const logger = getLogger({ service: "common", filePath: __filename }) -const loadOptions = { +export const protoLoadOptions = { keepCase: false, longs: String, enums: String, @@ -58,7 +58,7 @@ export const LOCATION_OBJECT_PROTO = getObjectProto({ export function getObjectProto( objectProto: ObjectProto ): A | ServiceDefinitionNotFoundError { - const definitions = protoLoader.loadSync(objectProto.path, loadOptions) + const definitions = protoLoader.loadSync(objectProto.path, protoLoadOptions) // eslint-disable-next-line @typescript-eslint/no-explicit-any const objProto = (grpc.loadPackageDefinition(definitions) as any)?.fonoster ?.routr[objectProto.name] diff --git a/mods/common/src/types.ts b/mods/common/src/types.ts index 81295b011..5631d6824 100644 --- a/mods/common/src/types.ts +++ b/mods/common/src/types.ts @@ -67,7 +67,8 @@ export enum ExtraHeader { SESSION_COUNT = "X-Session-Count", DOD_NUMBER = "X-DOD-Number", DOD_PRIVACY = "X-DOD-Privacy", - CONNECT_TOKEN = "X-Connect-Token" + CONNECT_TOKEN = "X-Connect-Token", + CALL_DIRECTION = "X-Call-Direction" } export enum Privacy { diff --git a/mods/common/src/verifier/grpc_client.ts b/mods/common/src/verifier/grpc_client.ts index 07a89c6b2..c1030a62c 100644 --- a/mods/common/src/verifier/grpc_client.ts +++ b/mods/common/src/verifier/grpc_client.ts @@ -18,16 +18,11 @@ */ import * as grpc from "@grpc/grpc-js" import protoLoader = require("@grpc/proto-loader") +import { protoLoadOptions } from "../service" const packageDefinition = protoLoader.loadSync( __dirname + "/../protos/verifier.proto", - { - keepCase: false, - longs: String, - enums: String, - defaults: true, - oneofs: true - } + protoLoadOptions ) // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/mods/common/test/mappers.unit.test.ts b/mods/common/test/mappers.unit.test.ts index 9921c3c75..03de64f92 100644 --- a/mods/common/test/mappers.unit.test.ts +++ b/mods/common/test/mappers.unit.test.ts @@ -39,6 +39,7 @@ import { } from "../src/connect/config" import { mapToAgent } from "../src/connect/mappers/agent" import { Privacy, Transport } from "../src/types" +import { APIVersion } from "../src/connect/types" const expect = chai.expect chai.use(sinonChai) @@ -51,7 +52,7 @@ describe("@routr/common/connect/mappers", () => { // Arrange const agentConfig: AgentConfig = { kind: Kind.AGENT, - apiVersion: "v2beta1", + apiVersion: APIVersion.V2BETA1, ref: "agent-1", metadata: { name: "John Doe" @@ -86,7 +87,7 @@ describe("@routr/common/connect/mappers", () => { // Arrange const peerConfig: PeerConfig = { kind: Kind.PEER, - apiVersion: "v2beta1", + apiVersion: APIVersion.V2BETA1, ref: "peer-1", metadata: { name: "peer-1" @@ -118,7 +119,7 @@ describe("@routr/common/connect/mappers", () => { // Arrange const domainConfig: DomainConfig = { kind: Kind.DOMAIN, - apiVersion: "v2beta1", + apiVersion: APIVersion.V2BETA1, ref: "domain-1", metadata: { name: "domain-1" @@ -157,7 +158,7 @@ describe("@routr/common/connect/mappers", () => { // Arrange const numberConfig: NumberConfig = { kind: Kind.NUMBER, - apiVersion: "v2beta1", + apiVersion: APIVersion.V2BETA1, ref: "number-1", metadata: { name: "number-1", @@ -209,7 +210,7 @@ describe("@routr/common/connect/mappers", () => { // Arrange const trunkConfig: TrunkConfig = { kind: Kind.TRUNK, - apiVersion: "v2beta1", + apiVersion: APIVersion.V2BETA1, ref: "trunk-1", metadata: { name: "trunk-1" @@ -298,7 +299,7 @@ describe("@routr/common/connect/mappers", () => { // Arrange const aclConfig: AccessControlListConfig = { kind: Kind.ACL, - apiVersion: "v2beta1", + apiVersion: APIVersion.V2BETA1, ref: "acl-1", metadata: { name: "local access" @@ -329,7 +330,7 @@ describe("@routr/common/connect/mappers", () => { // Arrange const credentialsConfig: CredentialsConfig = { kind: Kind.CREDENTIALS, - apiVersion: "v2beta1", + apiVersion: APIVersion.V2BETA1, ref: "credentials-1", metadata: { name: "credentials-1" diff --git a/mods/connect/.lerna-changed-buster-27550 b/mods/connect/.lerna-changed-buster-8289 similarity index 100% rename from mods/connect/.lerna-changed-buster-27550 rename to mods/connect/.lerna-changed-buster-8289 diff --git a/mods/connect/package.json b/mods/connect/package.json index 21999cb97..839092112 100644 --- a/mods/connect/package.json +++ b/mods/connect/package.json @@ -1,6 +1,6 @@ { "name": "@routr/connect", - "version": "2.12.1", + "version": "2.13.4", "description": "Default processor", "author": "Pedro Sanders ", "homepage": "https://github.com/fonoster/routr#readme", @@ -28,9 +28,9 @@ "@opentelemetry/sdk-trace-base": "^1.0.4", "@opentelemetry/sdk-trace-node": "^1.0.4", "@opentelemetry/semantic-conventions": "^1.0.4", - "@routr/common": "^2.12.1", - "@routr/location": "^2.12.1", - "@routr/processor": "^2.12.1", + "@routr/common": "^2.13.4", + "@routr/location": "^2.13.4", + "@routr/processor": "^2.13.4", "jsonwebtoken": "^9.0.0" }, "devDependencies": { diff --git a/mods/connect/src/access.ts b/mods/connect/src/access.ts index 3454b1642..7529f050e 100644 --- a/mods/connect/src/access.ts +++ b/mods/connect/src/access.ts @@ -45,7 +45,7 @@ export const checkAccess = async (accessRequest: { case RoutingDirection.FROM_PSTN: return checkAccessFromPSTN(apiClient, request, callee as CC.INumber) case RoutingDirection.UNKNOWN: - return CR.createForbideenResponse() + return CR.createForbiddenResponse() } } @@ -91,11 +91,11 @@ export const checkAccessFromPSTN = async ( // If the Trunk or Number doesn't exist reject the call if (!callee || !trunk) { - return CR.createForbideenResponse() + return CR.createForbiddenResponse() } if (callee.trunk.ref !== trunk.ref) { - return CR.createForbideenResponse() + return CR.createForbiddenResponse() } // Verify that the IP is allowlist which means getting the access control list for the trunk diff --git a/mods/connect/src/errors.ts b/mods/connect/src/errors.ts index 9344089b3..6f0653f09 100644 --- a/mods/connect/src/errors.ts +++ b/mods/connect/src/errors.ts @@ -41,7 +41,7 @@ export class ServiceUnavailableError extends Error { /** * Throw when the route is not supported. */ -export class UnsuportedRoutingError extends Error { +export class UnsupportedRoutingError extends Error { code: number /** diff --git a/mods/connect/src/handlers/register.ts b/mods/connect/src/handlers/register.ts index 11c5aad0b..6a013d86f 100644 --- a/mods/connect/src/handlers/register.ts +++ b/mods/connect/src/handlers/register.ts @@ -60,7 +60,7 @@ export const handleRegister = ( )) as CC.Peer | CC.Agent if (!peerOrAgent) { - return res.send(CR.createForbideenResponse()) + return res.send(CR.createForbiddenResponse()) } const credentials = ( @@ -111,7 +111,7 @@ export const handleRegister = ( )) as Verifier.VerifyResponse if (!payload.allowedMethods.includes(Method.REGISTER)) { - return res.send(CR.createForbideenResponse()) + return res.send(CR.createForbiddenResponse()) } await location.addRoute({ @@ -125,7 +125,7 @@ export const handleRegister = ( logger.verbose("unable to validate connect token", { originalError: e.message }) - res.send(CR.createForbideenResponse()) + res.send(CR.createForbiddenResponse()) } } else { res.send(CR.createUnauthorizedResponse(request.message.requestUri.host)) diff --git a/mods/connect/src/handlers/request.ts b/mods/connect/src/handlers/request.ts index 02e669317..6afd4eaeb 100644 --- a/mods/connect/src/handlers/request.ts +++ b/mods/connect/src/handlers/request.ts @@ -17,7 +17,6 @@ * limitations under the License. */ import * as grpc from "@grpc/grpc-js" -import { Helper as H } from "@routr/location" import { tailor } from "../tailor" import { Alterations as A, @@ -27,11 +26,12 @@ import { } from "@routr/processor" import { pipe } from "fp-ts/function" import { router } from "../router" -import { ILocationService } from "@routr/location" +import { ILocationService, Helper as H } from "@routr/location" import { CommonConnect as CC, CommonTypes as CT, - Environment + Environment, + HeaderModifier } from "@routr/common" import { getLogger } from "@fonoster/logger" import { RoutingDirection } from "./../types" @@ -54,17 +54,27 @@ export const handleRequest = route = H.createRouteFromLastMessage(req) } else { const routerResult = await router(location, apiClient)(req) - const direction = routerResult.direction + const direction = routerResult.direction as RoutingDirection route = routerResult.route as CT.Route // If direction is not present result is an error response if (!("direction" in routerResult)) { - return res.send(routerResult as Record) + return res.send(routerResult) } else if (!route && direction === RoutingDirection.AGENT_TO_PSTN) { return res.sendNotFound() } else if (!routerResult.route) { return res.sendTemporarilyUnavailable() } + + const p: HeaderModifier = { + name: CT.ExtraHeader.CALL_DIRECTION, + value: direction, + action: CT.HeaderModifierAction.ADD + } + + if (!route.headers) route.headers = [] + + route.headers.push(p) } // Forward request to peer edgeport @@ -72,11 +82,11 @@ export const handleRequest = return res.send( pipe( req, - A.addSelfVia(route as CT.Route), - A.addSelfRecordRoute(route as CT.Route), + A.addSelfVia(route), + A.addSelfRecordRoute(route), // The order of the routes is important - A.addRouteToPeerEdgePort(route as CT.Route), - A.addRouteToNextHop(route as CT.Route), + A.addRouteToPeerEdgePort(route), + A.addRouteToNextHop(route), A.addXEdgePortRef, A.decreaseMaxForwards ) @@ -84,9 +94,9 @@ export const handleRequest = } // TODO: We should add this the Tailor API - req.metadata = route.metadata as Record + req.metadata = route.metadata - res.send(tailor(route as CT.Route, req)) + res.send(tailor(route, req)) } catch (err) { if (err.code === grpc.status.NOT_FOUND) { return res.sendTemporarilyUnavailable() diff --git a/mods/connect/src/router.ts b/mods/connect/src/router.ts index 6d37d3cf1..bdcdbb840 100644 --- a/mods/connect/src/router.ts +++ b/mods/connect/src/router.ts @@ -34,14 +34,14 @@ import { findNumberByTelUrl, findResource, getRoutingDirection, - getSIPURI, + getSipUri, getTrunkURI, getVerifierImpl, hasXConnectObjectHeader } from "./utils" import { MessageRequest, Target as T, Extensions as E } from "@routr/processor" import { ILocationService, Backend } from "@routr/location" -import { UnsuportedRoutingError } from "./errors" +import { UnsupportedRoutingError } from "./errors" import { getLogger } from "@fonoster/logger" import { checkAccess } from "./access" @@ -78,7 +78,7 @@ export function router(location: ILocationService, apiClient: CC.APIClient) { const domain = await findDomain(apiClient, payload.domain) if (!payload.allowedMethods.includes(Method.INVITE)) { - return CR.createForbideenResponse() + return CR.createForbiddenResponse() } caller = { @@ -116,7 +116,7 @@ export function router(location: ILocationService, apiClient: CC.APIClient) { logger.verbose("unable to validate connect token", { originalError: e.message }) - return CR.createForbideenResponse() + return CR.createForbiddenResponse() } } else { caller = await findResource(apiClient, fromURI.host, fromURI.user) @@ -127,12 +127,12 @@ export function router(location: ILocationService, apiClient: CC.APIClient) { logger.verbose( "routing request from: " + - getSIPURI(fromURI) + + getSipUri(fromURI) + ", to: " + - getSIPURI(requestURI), + getSipUri(requestURI), { - fromURI: getSIPURI(fromURI), - requestURI: getSIPURI(requestURI), + fromURI: getSipUri(fromURI), + requestURI: getSipUri(requestURI), routingDirection } ) @@ -206,7 +206,7 @@ export function router(location: ILocationService, apiClient: CC.APIClient) { callee?.extended ) default: - throw new UnsuportedRoutingError(routingDirection) + throw new UnsupportedRoutingError(routingDirection) } } } diff --git a/mods/connect/src/utils.ts b/mods/connect/src/utils.ts index 324c1fd37..741c9f8e8 100644 --- a/mods/connect/src/utils.ts +++ b/mods/connect/src/utils.ts @@ -213,7 +213,7 @@ export const getTrunkURI = ( } } -export const getSIPURI = (uri: { user?: string; host: string }) => +export const getSipUri = (uri: { user?: string; host: string }) => uri.user ? `sip:${uri.user}@${uri.host}` : `sip:${uri.host}` export const hasXConnectObjectHeader = (req: MessageRequest) => diff --git a/mods/ctl/.lerna-changed-buster-27550 b/mods/ctl/.lerna-changed-buster-8289 similarity index 100% rename from mods/ctl/.lerna-changed-buster-27550 rename to mods/ctl/.lerna-changed-buster-8289 diff --git a/mods/ctl/README.md b/mods/ctl/README.md index ae715b382..92359ee67 100644 --- a/mods/ctl/README.md +++ b/mods/ctl/README.md @@ -19,7 +19,7 @@ $ npm install -g @routr/ctl $ rctl COMMAND running command... $ rctl (--version) -@routr/ctl/2.12.1 linux-x64 node-v20.14.0 +@routr/ctl/2.13.4 linux-x64 node-v20.16.0 $ rctl --help [COMMAND] USAGE $ rctl COMMAND @@ -95,7 +95,7 @@ EXAMPLES Creating ACL US Eeast... b148b4b4-6884-4c06-bb7e-bd098f5fe793 ``` -_See code: [src/commands/acl/create.ts](https://github.com/fonoster/routr/blob/v2.12.1/mods/ctl/src/commands/acl/create.ts)_ +_See code: [src/commands/acl/create.ts](https://github.com/fonoster/routr/blob/v2.13.4/mods/ctl/src/commands/acl/create.ts)_ ## `rctl acl delete [REF]` @@ -118,7 +118,7 @@ EXAMPLES Deleting item 80181ca6-d4aa-4575-9375-8f72b071111... Done ``` -_See code: [src/commands/acl/delete.ts](https://github.com/fonoster/routr/blob/v2.12.1/mods/ctl/src/commands/acl/delete.ts)_ +_See code: [src/commands/acl/delete.ts](https://github.com/fonoster/routr/blob/v2.13.4/mods/ctl/src/commands/acl/delete.ts)_ ## `rctl acl describe [REF]` @@ -140,7 +140,7 @@ DESCRIPTION shows details of an ACL ``` -_See code: [src/commands/acl/describe.ts](https://github.com/fonoster/routr/blob/v2.12.1/mods/ctl/src/commands/acl/describe.ts)_ +_See code: [src/commands/acl/describe.ts](https://github.com/fonoster/routr/blob/v2.13.4/mods/ctl/src/commands/acl/describe.ts)_ ## `rctl acl get [REF]` @@ -169,7 +169,7 @@ EXAMPLES 9e7a88f0-8390-42f5-a2cb-689583ba9f4f Local Network ACL 0.0.0.0/0 10.0.0.28 ``` -_See code: [src/commands/acl/get.ts](https://github.com/fonoster/routr/blob/v2.12.1/mods/ctl/src/commands/acl/get.ts)_ +_See code: [src/commands/acl/get.ts](https://github.com/fonoster/routr/blob/v2.13.4/mods/ctl/src/commands/acl/get.ts)_ ## `rctl acl update REF` @@ -195,7 +195,7 @@ EXAMPLES Updating ACL US East... 80181ca6-d4aa-4575-9375-8f72b07d5555 ``` -_See code: [src/commands/acl/update.ts](https://github.com/fonoster/routr/blob/v2.12.1/mods/ctl/src/commands/acl/update.ts)_ +_See code: [src/commands/acl/update.ts](https://github.com/fonoster/routr/blob/v2.13.4/mods/ctl/src/commands/acl/update.ts)_ ## `rctl agents create` @@ -218,7 +218,7 @@ EXAMPLES Creating Agent Jhon Doe... b148b4b4-6884-4c06-bb7e-bd098f5fe793 ``` -_See code: [src/commands/agents/create.ts](https://github.com/fonoster/routr/blob/v2.12.1/mods/ctl/src/commands/agents/create.ts)_ +_See code: [src/commands/agents/create.ts](https://github.com/fonoster/routr/blob/v2.13.4/mods/ctl/src/commands/agents/create.ts)_ ## `rctl agents delete [REF]` @@ -241,7 +241,7 @@ EXAMPLES Deleting item 80181ca6-d4aa-4575-9375-8f72b071111... Done ``` -_See code: [src/commands/agents/delete.ts](https://github.com/fonoster/routr/blob/v2.12.1/mods/ctl/src/commands/agents/delete.ts)_ +_See code: [src/commands/agents/delete.ts](https://github.com/fonoster/routr/blob/v2.13.4/mods/ctl/src/commands/agents/delete.ts)_ ## `rctl agents describe [REF]` @@ -263,7 +263,7 @@ DESCRIPTION shows details of an Agent ``` -_See code: [src/commands/agents/describe.ts](https://github.com/fonoster/routr/blob/v2.12.1/mods/ctl/src/commands/agents/describe.ts)_ +_See code: [src/commands/agents/describe.ts](https://github.com/fonoster/routr/blob/v2.13.4/mods/ctl/src/commands/agents/describe.ts)_ ## `rctl agents get [REF]` @@ -292,7 +292,7 @@ EXAMPLES d31f5fb8-e367-42f7-9884-1a7999f53fe8 John Doe jdoe sip.local 1 PRIVATE Yes ``` -_See code: [src/commands/agents/get.ts](https://github.com/fonoster/routr/blob/v2.12.1/mods/ctl/src/commands/agents/get.ts)_ +_See code: [src/commands/agents/get.ts](https://github.com/fonoster/routr/blob/v2.13.4/mods/ctl/src/commands/agents/get.ts)_ ## `rctl agents update REF` @@ -318,7 +318,7 @@ EXAMPLES Updating Agent John Doe... 80181ca6-d4aa-4575-9375-8f72b07d5555 ``` -_See code: [src/commands/agents/update.ts](https://github.com/fonoster/routr/blob/v2.12.1/mods/ctl/src/commands/agents/update.ts)_ +_See code: [src/commands/agents/update.ts](https://github.com/fonoster/routr/blob/v2.13.4/mods/ctl/src/commands/agents/update.ts)_ ## `rctl autocomplete [SHELL]` @@ -370,7 +370,7 @@ EXAMPLES Creating Credentials JDoe Access... b148b4b4-6884-4c06-bb7e-bd098f5fe793 ``` -_See code: [src/commands/credentials/create.ts](https://github.com/fonoster/routr/blob/v2.12.1/mods/ctl/src/commands/credentials/create.ts)_ +_See code: [src/commands/credentials/create.ts](https://github.com/fonoster/routr/blob/v2.13.4/mods/ctl/src/commands/credentials/create.ts)_ ## `rctl credentials delete [REF]` @@ -393,7 +393,7 @@ EXAMPLES Deleting item 80181ca6-d4aa-4575-9375-8f72b071111... Done ``` -_See code: [src/commands/credentials/delete.ts](https://github.com/fonoster/routr/blob/v2.12.1/mods/ctl/src/commands/credentials/delete.ts)_ +_See code: [src/commands/credentials/delete.ts](https://github.com/fonoster/routr/blob/v2.13.4/mods/ctl/src/commands/credentials/delete.ts)_ ## `rctl credentials describe [REF]` @@ -415,7 +415,7 @@ DESCRIPTION shows details for a set of Credentials ``` -_See code: [src/commands/credentials/describe.ts](https://github.com/fonoster/routr/blob/v2.12.1/mods/ctl/src/commands/credentials/describe.ts)_ +_See code: [src/commands/credentials/describe.ts](https://github.com/fonoster/routr/blob/v2.13.4/mods/ctl/src/commands/credentials/describe.ts)_ ## `rctl credentials get [REF]` @@ -444,7 +444,7 @@ EXAMPLES 80181ca6-d4aa-4575-9375-8f72b07d6666 Europe ACL 0.0.0.0/0 10.0.0.25 ``` -_See code: [src/commands/credentials/get.ts](https://github.com/fonoster/routr/blob/v2.12.1/mods/ctl/src/commands/credentials/get.ts)_ +_See code: [src/commands/credentials/get.ts](https://github.com/fonoster/routr/blob/v2.13.4/mods/ctl/src/commands/credentials/get.ts)_ ## `rctl credentials update REF` @@ -470,7 +470,7 @@ EXAMPLES Updating Credentials JDoe Credentials... 80181ca6-d4aa-4575-9375-8f72b07d5555 ``` -_See code: [src/commands/credentials/update.ts](https://github.com/fonoster/routr/blob/v2.12.1/mods/ctl/src/commands/credentials/update.ts)_ +_See code: [src/commands/credentials/update.ts](https://github.com/fonoster/routr/blob/v2.13.4/mods/ctl/src/commands/credentials/update.ts)_ ## `rctl domains create` @@ -493,7 +493,7 @@ EXAMPLES Creating Domain Local Domain... b148b4b4-6884-4c06-bb7e-bd098f5fe793 ``` -_See code: [src/commands/domains/create.ts](https://github.com/fonoster/routr/blob/v2.12.1/mods/ctl/src/commands/domains/create.ts)_ +_See code: [src/commands/domains/create.ts](https://github.com/fonoster/routr/blob/v2.13.4/mods/ctl/src/commands/domains/create.ts)_ ## `rctl domains delete [REF]` @@ -516,7 +516,7 @@ EXAMPLES Deleting item 80181ca6-d4aa-4575-9375-8f72b071111... Done ``` -_See code: [src/commands/domains/delete.ts](https://github.com/fonoster/routr/blob/v2.12.1/mods/ctl/src/commands/domains/delete.ts)_ +_See code: [src/commands/domains/delete.ts](https://github.com/fonoster/routr/blob/v2.13.4/mods/ctl/src/commands/domains/delete.ts)_ ## `rctl domains describe [REF]` @@ -538,7 +538,7 @@ DESCRIPTION show details of a Domain ``` -_See code: [src/commands/domains/describe.ts](https://github.com/fonoster/routr/blob/v2.12.1/mods/ctl/src/commands/domains/describe.ts)_ +_See code: [src/commands/domains/describe.ts](https://github.com/fonoster/routr/blob/v2.13.4/mods/ctl/src/commands/domains/describe.ts)_ ## `rctl domains get [REF]` @@ -567,7 +567,7 @@ EXAMPLES ab2b6959-f497-4b14-903b-85a7c464b564 Local Domain sip.local ``` -_See code: [src/commands/domains/get.ts](https://github.com/fonoster/routr/blob/v2.12.1/mods/ctl/src/commands/domains/get.ts)_ +_See code: [src/commands/domains/get.ts](https://github.com/fonoster/routr/blob/v2.13.4/mods/ctl/src/commands/domains/get.ts)_ ## `rctl domains update REF` @@ -593,7 +593,7 @@ EXAMPLES Updating Domain Local... 80181ca6-d4aa-4575-9375-8f72b07d5555 ``` -_See code: [src/commands/domains/update.ts](https://github.com/fonoster/routr/blob/v2.12.1/mods/ctl/src/commands/domains/update.ts)_ +_See code: [src/commands/domains/update.ts](https://github.com/fonoster/routr/blob/v2.13.4/mods/ctl/src/commands/domains/update.ts)_ ## `rctl numbers create` @@ -616,7 +616,7 @@ EXAMPLES Creating Number (784) 317-8170... a134487f-a668-4509-9ddd-dcbc98175468 ``` -_See code: [src/commands/numbers/create.ts](https://github.com/fonoster/routr/blob/v2.12.1/mods/ctl/src/commands/numbers/create.ts)_ +_See code: [src/commands/numbers/create.ts](https://github.com/fonoster/routr/blob/v2.13.4/mods/ctl/src/commands/numbers/create.ts)_ ## `rctl numbers delete [REF]` @@ -639,7 +639,7 @@ EXAMPLES Deleting item 80181ca6-d4aa-4575-9375-8f72b071111... Done ``` -_See code: [src/commands/numbers/delete.ts](https://github.com/fonoster/routr/blob/v2.12.1/mods/ctl/src/commands/numbers/delete.ts)_ +_See code: [src/commands/numbers/delete.ts](https://github.com/fonoster/routr/blob/v2.13.4/mods/ctl/src/commands/numbers/delete.ts)_ ## `rctl numbers describe [REF]` @@ -661,7 +661,7 @@ DESCRIPTION shows details for a Number ``` -_See code: [src/commands/numbers/describe.ts](https://github.com/fonoster/routr/blob/v2.12.1/mods/ctl/src/commands/numbers/describe.ts)_ +_See code: [src/commands/numbers/describe.ts](https://github.com/fonoster/routr/blob/v2.13.4/mods/ctl/src/commands/numbers/describe.ts)_ ## `rctl numbers get [REF]` @@ -690,7 +690,7 @@ EXAMPLES a134487f-a668-4509-9ddd-dcbc98175468 (785) 317-8070 +17853178070 sip:1001@sip.local Cameron, USA (US) ``` -_See code: [src/commands/numbers/get.ts](https://github.com/fonoster/routr/blob/v2.12.1/mods/ctl/src/commands/numbers/get.ts)_ +_See code: [src/commands/numbers/get.ts](https://github.com/fonoster/routr/blob/v2.13.4/mods/ctl/src/commands/numbers/get.ts)_ ## `rctl numbers update REF` @@ -716,7 +716,7 @@ EXAMPLES Updating Number (785) 317-8070... 80181ca6-d4aa-4575-9375-8f72b07d5555 ``` -_See code: [src/commands/numbers/update.ts](https://github.com/fonoster/routr/blob/v2.12.1/mods/ctl/src/commands/numbers/update.ts)_ +_See code: [src/commands/numbers/update.ts](https://github.com/fonoster/routr/blob/v2.13.4/mods/ctl/src/commands/numbers/update.ts)_ ## `rctl peers create` @@ -739,7 +739,7 @@ EXAMPLES Creating Peer Asterisk Conference... b148b4b4-6884-4c06-bb7e-bd098f5fe793 ``` -_See code: [src/commands/peers/create.ts](https://github.com/fonoster/routr/blob/v2.12.1/mods/ctl/src/commands/peers/create.ts)_ +_See code: [src/commands/peers/create.ts](https://github.com/fonoster/routr/blob/v2.13.4/mods/ctl/src/commands/peers/create.ts)_ ## `rctl peers delete [REF]` @@ -762,7 +762,7 @@ EXAMPLES Deleting item 80181ca6-d4aa-4575-9375-8f72b071111... Done ``` -_See code: [src/commands/peers/delete.ts](https://github.com/fonoster/routr/blob/v2.12.1/mods/ctl/src/commands/peers/delete.ts)_ +_See code: [src/commands/peers/delete.ts](https://github.com/fonoster/routr/blob/v2.13.4/mods/ctl/src/commands/peers/delete.ts)_ ## `rctl peers describe [REF]` @@ -784,7 +784,7 @@ DESCRIPTION shows details for a Peer ``` -_See code: [src/commands/peers/describe.ts](https://github.com/fonoster/routr/blob/v2.12.1/mods/ctl/src/commands/peers/describe.ts)_ +_See code: [src/commands/peers/describe.ts](https://github.com/fonoster/routr/blob/v2.13.4/mods/ctl/src/commands/peers/describe.ts)_ ## `rctl peers get [REF]` @@ -813,7 +813,7 @@ EXAMPLES 6f941c63-880c-419a-a72a-4a107cbaf5c5 Asterisk Conference conference sip:conference@sip.local 1 Round Robin Yes ``` -_See code: [src/commands/peers/get.ts](https://github.com/fonoster/routr/blob/v2.12.1/mods/ctl/src/commands/peers/get.ts)_ +_See code: [src/commands/peers/get.ts](https://github.com/fonoster/routr/blob/v2.13.4/mods/ctl/src/commands/peers/get.ts)_ ## `rctl peers update REF` @@ -839,7 +839,7 @@ EXAMPLES Updating Peer Asterisk Conf... 80181ca6-d4aa-4575-9375-8f72b07d5555 ``` -_See code: [src/commands/peers/update.ts](https://github.com/fonoster/routr/blob/v2.12.1/mods/ctl/src/commands/peers/update.ts)_ +_See code: [src/commands/peers/update.ts](https://github.com/fonoster/routr/blob/v2.13.4/mods/ctl/src/commands/peers/update.ts)_ ## `rctl plugins` @@ -1105,7 +1105,7 @@ EXAMPLES Creating Trunk T01... b148b4b4-6884-4c06-bb7e-bd098f5fe793 ``` -_See code: [src/commands/trunks/create.ts](https://github.com/fonoster/routr/blob/v2.12.1/mods/ctl/src/commands/trunks/create.ts)_ +_See code: [src/commands/trunks/create.ts](https://github.com/fonoster/routr/blob/v2.13.4/mods/ctl/src/commands/trunks/create.ts)_ ## `rctl trunks delete [REF]` @@ -1128,7 +1128,7 @@ EXAMPLES Deleting item 80181ca6-d4aa-4575-9375-8f72b071111... Done ``` -_See code: [src/commands/trunks/delete.ts](https://github.com/fonoster/routr/blob/v2.12.1/mods/ctl/src/commands/trunks/delete.ts)_ +_See code: [src/commands/trunks/delete.ts](https://github.com/fonoster/routr/blob/v2.13.4/mods/ctl/src/commands/trunks/delete.ts)_ ## `rctl trunks describe [REF]` @@ -1150,7 +1150,7 @@ DESCRIPTION shows details for a Trunk ``` -_See code: [src/commands/trunks/describe.ts](https://github.com/fonoster/routr/blob/v2.12.1/mods/ctl/src/commands/trunks/describe.ts)_ +_See code: [src/commands/trunks/describe.ts](https://github.com/fonoster/routr/blob/v2.13.4/mods/ctl/src/commands/trunks/describe.ts)_ ## `rctl trunks get [REF]` @@ -1179,7 +1179,7 @@ EXAMPLES 8cde8ea9-3c58-4dbe-b2cf-23c4413dd4cc Local sip.t01.provider.net ``` -_See code: [src/commands/trunks/get.ts](https://github.com/fonoster/routr/blob/v2.12.1/mods/ctl/src/commands/trunks/get.ts)_ +_See code: [src/commands/trunks/get.ts](https://github.com/fonoster/routr/blob/v2.13.4/mods/ctl/src/commands/trunks/get.ts)_ ## `rctl trunks update REF` @@ -1205,5 +1205,5 @@ EXAMPLES Updating Trunk T01... 80181ca6-d4aa-4575-9375-8f72b07d5555 ``` -_See code: [src/commands/trunks/update.ts](https://github.com/fonoster/routr/blob/v2.12.1/mods/ctl/src/commands/trunks/update.ts)_ +_See code: [src/commands/trunks/update.ts](https://github.com/fonoster/routr/blob/v2.13.4/mods/ctl/src/commands/trunks/update.ts)_ diff --git a/mods/ctl/package.json b/mods/ctl/package.json index 96544995f..b43d78c4f 100644 --- a/mods/ctl/package.json +++ b/mods/ctl/package.json @@ -1,6 +1,6 @@ { "name": "@routr/ctl", - "version": "2.12.1", + "version": "2.13.4", "description": "Routr Command-Line Tool", "author": "Pedro Sanders ", "bin": { @@ -25,8 +25,8 @@ "@oclif/plugin-help": "^5", "@oclif/plugin-plugins": "^2.1.12", "@oclif/plugin-warn-if-update-available": "^2.0.19", - "@routr/common": "^2.12.1", - "@routr/sdk": "^2.12.1", + "@routr/common": "^2.13.4", + "@routr/sdk": "^2.13.4", "figlet": "^1.5.2", "fuzzy-search": "^3.2.1", "inquirer": "^8.2.6", diff --git a/mods/ctl/src/commands/acl/create.ts b/mods/ctl/src/commands/acl/create.ts index 218a0a827..35b9620b6 100644 --- a/mods/ctl/src/commands/acl/create.ts +++ b/mods/ctl/src/commands/acl/create.ts @@ -22,7 +22,7 @@ import { CliUx } from "@oclif/core" import { BaseCommand } from "../../base" import { CLIError } from "@oclif/core/lib/errors" import { aclRuleValidator, nameValidator } from "../../validators" -import { stringToACL } from "../../utils" +import { stringToAcl } from "../../utils" import SDK from "@routr/sdk" // NOTE: Newer versions of inquirer have a bug that causes the following error: @@ -74,15 +74,15 @@ Creating ACL US Eeast... b148b4b4-6884-4c06-bb7e-bd098f5fe793 ]) // Re-assign allow and deny rules as arrays - answers.allow = stringToACL(answers.allow) - answers.deny = stringToACL(answers.deny) + answers.allow = stringToAcl(answers.allow) + answers.deny = stringToAcl(answers.deny) if (!answers.confirm) { this.warn("Aborted") } else { CliUx.ux.action.start(`Creating ACL ${answers.name}`) - const api = new SDK.ACL({ endpoint, insecure, cacert }) - const acl = await api.createACL(answers) + const api = new SDK.Acls({ endpoint, insecure, cacert }) + const acl = await api.createAcl(answers) await CliUx.ux.wait(1000) CliUx.ux.action.stop(acl.ref) diff --git a/mods/ctl/src/commands/acl/delete.ts b/mods/ctl/src/commands/acl/delete.ts index 8caf3a840..51aafbe1d 100644 --- a/mods/ctl/src/commands/acl/delete.ts +++ b/mods/ctl/src/commands/acl/delete.ts @@ -21,9 +21,9 @@ import DeleteCommand from "../../delete" import SDK from "@routr/sdk" export default class CreateCommand extends DeleteCommand { - static description = "Deletes an Access Control List" + static readonly description = "Deletes an Access Control List" - static examples = [ + static readonly examples = [ `<%= config.bin %> <%= command.id %> Deleting item 80181ca6-d4aa-4575-9375-8f72b071111... Done ` @@ -34,7 +34,7 @@ Deleting item 80181ca6-d4aa-4575-9375-8f72b071111... Done const { endpoint, insecure, cacert } = flags await super.deleteResource( - new SDK.ACL({ endpoint, insecure, cacert }), + new SDK.Acls({ endpoint, insecure, cacert }), "deleteACL" ) } diff --git a/mods/ctl/src/commands/acl/describe.ts b/mods/ctl/src/commands/acl/describe.ts index d0c63c663..2cf69b0b3 100644 --- a/mods/ctl/src/commands/acl/describe.ts +++ b/mods/ctl/src/commands/acl/describe.ts @@ -37,10 +37,10 @@ export default class DescribeCommand extends BaseCommand { const { args, flags } = await this.parse(DescribeCommand) const { endpoint, insecure, cacert } = flags - const api = new SDK.ACL({ endpoint, insecure, cacert }) + const api = new SDK.Acls({ endpoint, insecure, cacert }) try { - const acl = await api.getACL(args.ref) + const acl = await api.getAcl(args.ref) const jsonObj = { Ref: acl.ref, @@ -49,8 +49,8 @@ export default class DescribeCommand extends BaseCommand { Deny: acl.deny.join(","), Allow: acl.allow.join(","), Extended: acl.extended, - Created: moment(new Date(acl.createdAt * 1000)).toISOString(), - Updated: moment(new Date(acl.updatedAt * 1000)).toISOString() + Created: moment(acl.createdAt).toISOString(), + Updated: moment(acl.updatedAt).toISOString() } this.log(render(jsonObj, { noColor: true })) diff --git a/mods/ctl/src/commands/acl/update.ts b/mods/ctl/src/commands/acl/update.ts index 3cbcb8787..246739c21 100644 --- a/mods/ctl/src/commands/acl/update.ts +++ b/mods/ctl/src/commands/acl/update.ts @@ -21,7 +21,7 @@ import { CliUx } from "@oclif/core" import { BaseCommand } from "../../base" import { CLIError } from "@oclif/core/lib/errors" import { aclRuleValidator, nameValidator } from "../../validators" -import { stringToACL } from "../../utils" +import { stringToAcl } from "../../utils" import SDK from "@routr/sdk" // NOTE: Newer versions of inquirer have a bug that causes the following error: @@ -37,17 +37,17 @@ Updating ACL US East... 80181ca6-d4aa-4575-9375-8f72b07d5555 ` ] - static args = [ + static readonly args = [ { name: "ref", required: true, description: "reference to an ACL" } ] async run(): Promise { const { args, flags } = await this.parse(UpdateCommand) const { endpoint, insecure, cacert } = flags - const api = new SDK.ACL({ endpoint, insecure, cacert }) + const api = new SDK.Acls({ endpoint, insecure, cacert }) try { - const aclFromDB = await api.getACL(args.ref) + const aclFromDB = await api.getAcl(args.ref) this.log("This utility will help you update an existing ACL.") this.log("Press ^C at any time to quit.") @@ -84,14 +84,14 @@ Updating ACL US East... 80181ca6-d4aa-4575-9375-8f72b07d5555 answers.ref = args.ref // Re-assign allow and deny rules as arrays - answers.allow = stringToACL(answers.allow) - answers.deny = stringToACL(answers.deny) + answers.allow = stringToAcl(answers.allow) + answers.deny = stringToAcl(answers.deny) if (!answers.confirm) { this.warn("Aborted") } else { CliUx.ux.action.start(`Updating ACL ${answers.name}`) - const acl = await api.updateACL(answers) + const acl = await api.updateAcl(answers) await CliUx.ux.wait(1000) CliUx.ux.action.stop(acl.ref) } diff --git a/mods/ctl/src/commands/agents/describe.ts b/mods/ctl/src/commands/agents/describe.ts index 83ea7c9e3..1465f88f2 100644 --- a/mods/ctl/src/commands/agents/describe.ts +++ b/mods/ctl/src/commands/agents/describe.ts @@ -59,8 +59,8 @@ export default class DescribeCommand extends BaseCommand { : "None", Enabled: agent.enabled ? "Yes" : "No", Extended: agent.extended, - Created: moment(new Date(agent.createdAt * 1000)).toISOString(), - Updated: moment(new Date(agent.updatedAt * 1000)).toISOString() + Created: moment(agent.createdAt).toISOString(), + Updated: moment(agent.updatedAt).toISOString() } this.log(render(jsonObj, { noColor: true })) diff --git a/mods/ctl/src/commands/credentials/delete.ts b/mods/ctl/src/commands/credentials/delete.ts index 19c79cacd..b1db04d64 100644 --- a/mods/ctl/src/commands/credentials/delete.ts +++ b/mods/ctl/src/commands/credentials/delete.ts @@ -20,17 +20,17 @@ import DeleteCommand from "../../delete" import SDK from "@routr/sdk" -export default class DeleteCrendentialsCommand extends DeleteCommand { - static description = "Deletes a set of Credentials" +export default class DeleteCredentialsCommand extends DeleteCommand { + static readonly description = "Deletes a set of Credentials" - static examples = [ + static readonly examples = [ `<%= config.bin %> <%= command.id %> Deleting item 80181ca6-d4aa-4575-9375-8f72b071111... Done ` ] async run() { - const { flags } = await this.parse(DeleteCrendentialsCommand) + const { flags } = await this.parse(DeleteCredentialsCommand) const { endpoint, insecure, cacert } = flags await super.deleteResource( new SDK.Credentials({ endpoint, insecure, cacert }), diff --git a/mods/ctl/src/commands/credentials/describe.ts b/mods/ctl/src/commands/credentials/describe.ts index abc4db5f4..3cf07761f 100644 --- a/mods/ctl/src/commands/credentials/describe.ts +++ b/mods/ctl/src/commands/credentials/describe.ts @@ -47,8 +47,8 @@ export default class DescribeCommand extends BaseCommand { Name: credentials.name, Username: credentials.username, Extended: credentials.extended, - Created: moment(new Date(credentials.createdAt * 1000)).toISOString(), - Updated: moment(new Date(credentials.updatedAt * 1000)).toISOString() + Created: moment(credentials.createdAt).toISOString(), + Updated: moment(credentials.updatedAt).toISOString() } this.log(render(jsonObj, { noColor: true })) diff --git a/mods/ctl/src/commands/domains/create.ts b/mods/ctl/src/commands/domains/create.ts index 1d3be0963..a7f9b01be 100644 --- a/mods/ctl/src/commands/domains/create.ts +++ b/mods/ctl/src/commands/domains/create.ts @@ -44,7 +44,7 @@ Creating Domain Local Domain... b148b4b4-6884-4c06-bb7e-bd098f5fe793 try { // TODO: Fix hardcoded pageSize - const acls = await new SDK.ACL({ endpoint, insecure, cacert }).listACLs({ + const acls = await new SDK.Acls({ endpoint, insecure, cacert }).listAcls({ pageSize: 25, pageToken: "" }) diff --git a/mods/ctl/src/commands/domains/describe.ts b/mods/ctl/src/commands/domains/describe.ts index 8fab84ee1..47bd61901 100644 --- a/mods/ctl/src/commands/domains/describe.ts +++ b/mods/ctl/src/commands/domains/describe.ts @@ -66,8 +66,8 @@ export default class DescribeCommand extends BaseCommand { }) : "None", Extended: domain.extended, - Created: moment(new Date(domain.createdAt * 1000)).toISOString(), - Updated: moment(new Date(domain.updatedAt * 1000)).toISOString() + Created: moment(domain.createdAt).toISOString(), + Updated: moment(domain.updatedAt).toISOString() } this.log(render(jsonObj, { noColor: true })) diff --git a/mods/ctl/src/commands/domains/update.ts b/mods/ctl/src/commands/domains/update.ts index bc7f57942..452a78e03 100644 --- a/mods/ctl/src/commands/domains/update.ts +++ b/mods/ctl/src/commands/domains/update.ts @@ -54,7 +54,7 @@ Updating Domain Local... 80181ca6-d4aa-4575-9375-8f72b07d5555 const domainFromDB = await api.getDomain(args.ref) // TODO: Fix hardcoded pageSize - const acls = await new SDK.ACL({ endpoint, insecure, cacert }).listACLs({ + const acls = await new SDK.Acls({ endpoint, insecure, cacert }).listAcls({ pageSize: 25, pageToken: "" }) diff --git a/mods/ctl/src/commands/numbers/describe.ts b/mods/ctl/src/commands/numbers/describe.ts index d1d8fb05b..7250a7c99 100644 --- a/mods/ctl/src/commands/numbers/describe.ts +++ b/mods/ctl/src/commands/numbers/describe.ts @@ -58,8 +58,8 @@ export default class DescribeCommand extends BaseCommand { ? number.extraHeaders.join(",") : "None", Extended: number.extended, - Created: moment(new Date(number.createdAt * 1000)).toISOString(), - Updated: moment(new Date(number.updatedAt * 1000)).toISOString() + Created: moment(number.createdAt).toISOString(), + Updated: moment(number.updatedAt).toISOString() } this.log(render(jsonObj, { noColor: true })) diff --git a/mods/ctl/src/commands/peers/create.ts b/mods/ctl/src/commands/peers/create.ts index f263a1431..5adf1fdd2 100644 --- a/mods/ctl/src/commands/peers/create.ts +++ b/mods/ctl/src/commands/peers/create.ts @@ -50,11 +50,11 @@ Creating Peer Asterisk Conference... b148b4b4-6884-4c06-bb7e-bd098f5fe793 try { // TODO: Fix hardcoded pageSize - const acls = await new SDK.ACL({ + const acls = await new SDK.Acls({ endpoint, insecure, cacert - }).listACLs({ + }).listAcls({ pageSize: 25, pageToken: "" }) diff --git a/mods/ctl/src/commands/peers/describe.ts b/mods/ctl/src/commands/peers/describe.ts index d9f3b2c36..4de5830df 100644 --- a/mods/ctl/src/commands/peers/describe.ts +++ b/mods/ctl/src/commands/peers/describe.ts @@ -70,8 +70,8 @@ export default class DescribeCommand extends BaseCommand { } : "None", Extended: peer.extended, - Created: moment(new Date(peer.createdAt * 1000)).toISOString(), - Updated: moment(new Date(peer.updatedAt * 1000)).toISOString() + Created: moment(peer.createdAt).toISOString(), + Updated: moment(peer.updatedAt).toISOString() } this.log(render(jsonObj, { noColor: true })) diff --git a/mods/ctl/src/commands/peers/update.ts b/mods/ctl/src/commands/peers/update.ts index 122773b52..0a29cd899 100644 --- a/mods/ctl/src/commands/peers/update.ts +++ b/mods/ctl/src/commands/peers/update.ts @@ -59,7 +59,7 @@ Updating Peer Asterisk Conf... 80181ca6-d4aa-4575-9375-8f72b07d5555 const peerFromDB = await api.getPeer(args.ref) // TODO: Fix hardcoded pageSize - const acls = await new SDK.ACL({ endpoint, insecure, cacert }).listACLs({ + const acls = await new SDK.Acls({ endpoint, insecure, cacert }).listAcls({ pageSize: 25, pageToken: "" }) diff --git a/mods/ctl/src/commands/trunks/create.ts b/mods/ctl/src/commands/trunks/create.ts index 9ca5a0068..70c3a9371 100644 --- a/mods/ctl/src/commands/trunks/create.ts +++ b/mods/ctl/src/commands/trunks/create.ts @@ -52,12 +52,12 @@ Creating Trunk T01... b148b4b4-6884-4c06-bb7e-bd098f5fe793 try { // TODO: Add support for pagination - const acls = await new SDK.ACL({ endpoint, insecure, cacert }).listACLs({ + const acls = await new SDK.Acls({ endpoint, insecure, cacert }).listAcls({ pageSize: 25, pageToken: "" }) - const aclChoices = acls.items.map((acl) => { + const aclChoices = acls.items.map((acl: CC.AccessControlList) => { return { name: acl.name, value: acl.ref @@ -73,12 +73,14 @@ Creating Trunk T01... b148b4b4-6884-4c06-bb7e-bd098f5fe793 pageToken: "" }) - const credentialsChoice = credentials.items.map((acl) => { - return { - name: acl.name, - value: acl.ref + const credentialsChoice = credentials.items.map( + (credentials: CC.Credentials) => { + return { + name: credentials.name, + value: credentials.ref + } } - }) + ) this.log("This utility will help you create a new Trunk.") this.log("Press ^C at any time to quit.") diff --git a/mods/ctl/src/commands/trunks/describe.ts b/mods/ctl/src/commands/trunks/describe.ts index 8a8ae01e6..bb738903e 100644 --- a/mods/ctl/src/commands/trunks/describe.ts +++ b/mods/ctl/src/commands/trunks/describe.ts @@ -75,8 +75,8 @@ export default class DescribeCommand extends BaseCommand { .join(",") || "None", "Send Register": trunk.sendRegister, Extended: trunk.extended, - Created: moment(new Date(trunk.createdAt * 1000)).toISOString(), - Updated: moment(new Date(trunk.updatedAt * 1000)).toISOString() + Created: moment(trunk.createdAt).toISOString(), + Updated: moment(trunk.createdAt).toISOString() } this.log(render(jsonObj, { noColor: true })) diff --git a/mods/ctl/src/commands/trunks/update.ts b/mods/ctl/src/commands/trunks/update.ts index ae641a49e..6e6b66e40 100644 --- a/mods/ctl/src/commands/trunks/update.ts +++ b/mods/ctl/src/commands/trunks/update.ts @@ -62,12 +62,12 @@ Updating Trunk T01... 80181ca6-d4aa-4575-9375-8f72b07d5555 const trunkFromDB = await api.getTrunk(args.ref) // TODO: Add support for pagination - const acls = await new SDK.ACL({ endpoint, insecure, cacert }).listACLs({ + const acls = await new SDK.Acls({ endpoint, insecure, cacert }).listAcls({ pageSize: 25, pageToken: "" }) - const aclChoices = acls.items.map((acl) => { + const aclChoices = acls.items.map((acl: CC.AccessControlList) => { return { name: acl.name, value: acl.ref @@ -83,12 +83,14 @@ Updating Trunk T01... 80181ca6-d4aa-4575-9375-8f72b07d5555 pageToken: "" }) - const credentialsChoice = credentials.items.map((acl) => { - return { - name: acl.name, - value: acl.ref + const credentialsChoice = credentials.items.map( + (creds: CC.Credentials) => { + return { + name: creds.name, + value: creds.ref + } } - }) + ) this.log("This utility will help you update an existing Trunk.") this.log("Press ^C at any time to quit.") diff --git a/mods/ctl/src/utils.ts b/mods/ctl/src/utils.ts index 089928c2e..669a984b4 100644 --- a/mods/ctl/src/utils.ts +++ b/mods/ctl/src/utils.ts @@ -29,11 +29,11 @@ export function capitalize(s: string) { return s.charAt(0).toUpperCase() + s.slice(1).toLowerCase() } -export const stringToACL = (aclRule: string) => +export const stringToAcl = (aclRule: string) => aclRule.split(",").map((rule: string) => rule.trim()) type APIName = - | "ACL" + | "Acls" | "Credentials" | "Domains" | "Agents" @@ -55,7 +55,7 @@ function getFunctionMapping(kind: CC.Kind): { } { switch (kind) { case CC.Kind.ACL: - return { api: "ACL", get: "getACL", list: "listACLs" } + return { api: "Acls", get: "getAcl", list: "listAcls" } case CC.Kind.CREDENTIALS: return { api: "Credentials", diff --git a/mods/ctl/src/validators.ts b/mods/ctl/src/validators.ts index 4893de2d8..b7c83a5a8 100644 --- a/mods/ctl/src/validators.ts +++ b/mods/ctl/src/validators.ts @@ -18,7 +18,7 @@ */ /* eslint-disable require-jsdoc */ import { CommonConnect as CC } from "@routr/common" -import { stringToACL, stringToHeaders } from "./utils" +import { stringToAcl, stringToHeaders } from "./utils" export function nameValidator(value: string) { const hasName = CC.hasName(value) @@ -34,9 +34,9 @@ export function nameValidator(value: string) { } export function aclRuleValidator(value: string) { - const hasValidACLRules = CC.isValidACLRule(stringToACL(value)) + const hasValidACLRules = CC.isValidACLRule(stringToAcl(value)) - if (stringToACL(value).length === 0) { + if (stringToAcl(value).length === 0) { return "acl rules are required" } else if (hasValidACLRules instanceof Error) { return hasValidACLRules.message diff --git a/mods/ctl/test/commands/acl/get.test.ts b/mods/ctl/test/commands/acl/get.test.ts index 0cc151a76..1ab4f45e7 100644 --- a/mods/ctl/test/commands/acl/get.test.ts +++ b/mods/ctl/test/commands/acl/get.test.ts @@ -19,9 +19,9 @@ import { expect, test } from "@oclif/test" import SDK from "@routr/sdk" -describe("@routr/ctl/acl/get", () => { +describe("@routr/ctl/acls/get", () => { test - .stub(SDK.ACL.prototype, "listACLs", () => { + .stub(SDK.Acls.prototype, "listACLs", () => { return { items: [ { diff --git a/mods/dispatcher/.lerna-changed-buster-27550 b/mods/dispatcher/.lerna-changed-buster-8289 similarity index 100% rename from mods/dispatcher/.lerna-changed-buster-27550 rename to mods/dispatcher/.lerna-changed-buster-8289 diff --git a/mods/dispatcher/package.json b/mods/dispatcher/package.json index f83d0c89a..c15599cad 100644 --- a/mods/dispatcher/package.json +++ b/mods/dispatcher/package.json @@ -1,6 +1,6 @@ { "name": "@routr/dispatcher", - "version": "2.12.1", + "version": "2.13.4", "description": "Receives SIP messages and forwards them to the corresponding Message Processor", "author": "Pedro Sanders ", "homepage": "https://github.com/fonoster/routr#readme", @@ -35,8 +35,8 @@ "@opentelemetry/sdk-trace-base": "^1.0.4", "@opentelemetry/sdk-trace-node": "^1.0.4", "@opentelemetry/semantic-conventions": "^1.0.4", - "@routr/common": "^2.12.1", - "@routr/processor": "^2.12.1", + "@routr/common": "^2.13.4", + "@routr/processor": "^2.13.4", "ajv": "^6.12.6", "fp-ts": "^2.11.8" }, diff --git a/mods/echo/.lerna-changed-buster-27550 b/mods/echo/.lerna-changed-buster-8289 similarity index 100% rename from mods/echo/.lerna-changed-buster-27550 rename to mods/echo/.lerna-changed-buster-8289 diff --git a/mods/echo/package.json b/mods/echo/package.json index 3a55f1bbd..011324784 100644 --- a/mods/echo/package.json +++ b/mods/echo/package.json @@ -1,6 +1,6 @@ { "name": "@routr/echo", - "version": "2.12.1", + "version": "2.13.4", "description": "Dummy implementation of a Processor service", "author": "Pedro Sanders ", "homepage": "https://github.com/fonoster/routr#readme", @@ -28,8 +28,8 @@ "@opentelemetry/sdk-trace-base": "^1.0.4", "@opentelemetry/sdk-trace-node": "^1.0.4", "@opentelemetry/semantic-conventions": "^1.0.4", - "@routr/common": "^2.12.1", - "@routr/processor": "^2.12.1" + "@routr/common": "^2.13.4", + "@routr/processor": "^2.13.4" }, "files": [ "dist" diff --git a/mods/edgeport/.lerna-changed-buster-27550 b/mods/edgeport/.lerna-changed-buster-8289 similarity index 100% rename from mods/edgeport/.lerna-changed-buster-27550 rename to mods/edgeport/.lerna-changed-buster-8289 diff --git a/mods/edgeport/package.json b/mods/edgeport/package.json index 755aa0a83..df163d0a2 100644 --- a/mods/edgeport/package.json +++ b/mods/edgeport/package.json @@ -1,6 +1,6 @@ { "name": "@routr/edgeport", - "version": "2.12.1", + "version": "2.13.4", "description": "SIP endpoint at the edge of the network", "author": "Pedro Sanders ", "homepage": "https://github.com/fonoster/routr#readme", @@ -29,7 +29,7 @@ "url": "https://github.com/fonoster/routr/issues" }, "dependencies": { - "@routr/common": "^2.12.1", + "@routr/common": "^2.13.4", "ajv": "^6.12.6", "fp-ts": "^2.11.8", "js-yaml": "^4.1.0", diff --git a/mods/edgeport/src/main/java/io/routr/events/ConsolePublisher.java b/mods/edgeport/src/main/java/io/routr/events/ConsolePublisher.java index ebd20b87f..4e8892554 100644 --- a/mods/edgeport/src/main/java/io/routr/events/ConsolePublisher.java +++ b/mods/edgeport/src/main/java/io/routr/events/ConsolePublisher.java @@ -26,6 +26,6 @@ public class ConsolePublisher implements EventsPublisher { private static final Logger LOG = LogManager.getLogger(ConsolePublisher.class); public void publish(String eventName, Map message) { - LOG.info("event: " + eventName + " message: " + message); + LOG.debug("event: " + eventName + " message: " + message); } } diff --git a/mods/edgeport/src/main/java/io/routr/events/NATSPublisher.java b/mods/edgeport/src/main/java/io/routr/events/NATSPublisher.java index 1d4cf9340..4b81d1b60 100644 --- a/mods/edgeport/src/main/java/io/routr/events/NATSPublisher.java +++ b/mods/edgeport/src/main/java/io/routr/events/NATSPublisher.java @@ -45,6 +45,7 @@ public void publish(String eventName, Map message) { try { ObjectMapper mapper = new ObjectMapper(); String messageAsJson = mapper.writeValueAsString(message); + LOG.debug("event: " + eventName + " message: " + messageAsJson); this.connection.publish(this.subject + "." + eventName, messageAsJson.getBytes()); } catch(JsonProcessingException e) { LOG.error("error publishing event: " + e.getMessage()); diff --git a/mods/location/.lerna-changed-buster-27550 b/mods/location/.lerna-changed-buster-8289 similarity index 100% rename from mods/location/.lerna-changed-buster-27550 rename to mods/location/.lerna-changed-buster-8289 diff --git a/mods/location/package.json b/mods/location/package.json index 20a5626ed..49ff2c371 100644 --- a/mods/location/package.json +++ b/mods/location/package.json @@ -1,6 +1,6 @@ { "name": "@routr/location", - "version": "2.12.1", + "version": "2.13.4", "description": "Creates and maintains a list of routes to all registered endpoints", "author": "Pedro Sanders ", "homepage": "https://github.com/fonoster/routr#readme", @@ -35,8 +35,8 @@ "@opentelemetry/sdk-trace-base": "^1.0.4", "@opentelemetry/sdk-trace-node": "^1.0.4", "@opentelemetry/semantic-conventions": "^1.0.4", - "@routr/common": "^2.12.1", - "@routr/processor": "^2.12.1", + "@routr/common": "^2.13.4", + "@routr/processor": "^2.13.4", "ajv": "^6.12.6", "fp-ts": "^2.11.8", "redis": "^4.0.4" diff --git a/mods/one/.lerna-changed-buster-27550 b/mods/one/.lerna-changed-buster-8289 similarity index 100% rename from mods/one/.lerna-changed-buster-27550 rename to mods/one/.lerna-changed-buster-8289 diff --git a/mods/one/package.json b/mods/one/package.json index 1c3a1f40f..ccfdfbe6f 100644 --- a/mods/one/package.json +++ b/mods/one/package.json @@ -1,6 +1,6 @@ { "name": "@routr/one", - "version": "2.12.1", + "version": "2.13.4", "description": "Bundle server with everything needed to run Routr Connect", "author": "Pedro Sanders ", "homepage": "https://github.com/fonoster/routr#readme", @@ -20,12 +20,12 @@ }, "dependencies": { "@fonoster/logger": "0.6.0", - "@routr/common": "^2.12.1", - "@routr/connect": "^2.12.1", - "@routr/dispatcher": "^2.12.1", - "@routr/location": "^2.12.1", - "@routr/pgdata": "^2.12.1", - "@routr/rtprelay": "^2.12.1" + "@routr/common": "^2.13.4", + "@routr/connect": "^2.13.4", + "@routr/dispatcher": "^2.13.4", + "@routr/location": "^2.13.4", + "@routr/pgdata": "^2.13.4", + "@routr/rtprelay": "^2.13.4" }, "files": [ "dist" diff --git a/mods/pgdata/.lerna-changed-buster-27550 b/mods/pgdata/.lerna-changed-buster-8289 similarity index 100% rename from mods/pgdata/.lerna-changed-buster-27550 rename to mods/pgdata/.lerna-changed-buster-8289 diff --git a/mods/pgdata/package.json b/mods/pgdata/package.json index 0561550bd..cb7403d26 100644 --- a/mods/pgdata/package.json +++ b/mods/pgdata/package.json @@ -1,6 +1,6 @@ { "name": "@routr/pgdata", - "version": "2.12.1", + "version": "2.13.4", "description": "Postgres API Server for Routr Connect", "author": "Pedro Sanders ", "homepage": "https://github.com/fonoster/routr#readme", @@ -31,8 +31,8 @@ "@opentelemetry/sdk-trace-node": "^1.0.4", "@opentelemetry/semantic-conventions": "^1.0.4", "@prisma/client": "^5.9.1", - "@routr/common": "^2.12.1", - "@routr/processor": "^2.12.1", + "@routr/common": "^2.13.4", + "@routr/processor": "^2.13.4", "google-protobuf": "^3.9.2", "grpc-health-check": "^2.0.2", "pb-util": "^1.0.3", diff --git a/mods/pgdata/src/api/update.ts b/mods/pgdata/src/api/update.ts index f67946ed4..1230a6af7 100644 --- a/mods/pgdata/src/api/update.ts +++ b/mods/pgdata/src/api/update.ts @@ -44,7 +44,7 @@ export function update( manager.validOrThrowUpdate() - if (kind === CC.Kind.DOMAIN) { + if (kind === CC.Kind.DOMAIN && request.egressPolicy) { await prisma.egressPolicy.deleteMany({ where: { domainRef: request.ref @@ -52,7 +52,7 @@ export function update( }) } - if (kind === CC.Kind.TRUNK) { + if (kind === CC.Kind.TRUNK && request.uris) { await prisma.trunkURI.deleteMany({ where: { trunkRef: request.ref diff --git a/mods/pgdata/src/mappers/acl.ts b/mods/pgdata/src/mappers/acl.ts index 20a988664..1c3e4cd72 100644 --- a/mods/pgdata/src/mappers/acl.ts +++ b/mods/pgdata/src/mappers/acl.ts @@ -19,15 +19,15 @@ /* eslint-disable require-jsdoc */ import { AccessControlList as ACLPrismaModel, APIVersion } from "@prisma/client" import { CommonConnect as CC } from "@routr/common" -import { JsonObject } from "pb-util/build" import { EntityManager } from "./manager" +import { JsonValue } from "@prisma/client/runtime/library" export class ACLManager extends EntityManager { constructor(private acl: CC.AccessControlList) { super() } - static includeFields(): JsonObject { + static includeFields(): Record { return null } @@ -39,7 +39,7 @@ export class ACLManager extends EntityManager { } validOrThrowUpdate() { - CC.hasRefenceOrThrow(this.acl.ref) + CC.hasReferenceOrThrow(this.acl.ref) CC.isValidNameOrThrow(this.acl.name) CC.hasValidACLRulesOrThrow(this.acl) } @@ -47,18 +47,11 @@ export class ACLManager extends EntityManager { mapToPrisma(): ACLPrismaModel { return { // TODO: Create a default value for apiVersion + ...this.acl, apiVersion: "v2" as APIVersion, - ref: this.acl.ref, - name: this.acl.name, - allow: this.acl.allow, - deny: this.acl.deny, - createdAt: this.acl.createdAt - ? new Date(this.acl.createdAt * 1000) - : undefined, - updatedAt: this.acl.updatedAt - ? new Date(this.acl.updatedAt * 1000) - : undefined, - extended: this.acl.extended || {} + createdAt: undefined, + updatedAt: undefined, + extended: this.acl.extended as JsonValue } } @@ -66,9 +59,10 @@ export class ACLManager extends EntityManager { return acl ? { ...acl, + apiVersion: acl.apiVersion as CC.APIVersion, createdAt: acl.createdAt.getTime() / 1000, updatedAt: acl.updatedAt.getTime() / 1000, - extended: acl.extended as JsonObject + extended: acl.extended as Record } : undefined } diff --git a/mods/pgdata/src/mappers/agent.ts b/mods/pgdata/src/mappers/agent.ts index 427de0cc4..52cd68d14 100644 --- a/mods/pgdata/src/mappers/agent.ts +++ b/mods/pgdata/src/mappers/agent.ts @@ -24,10 +24,10 @@ import { Privacy } from "@prisma/client" import { CommonConnect as CC, CommonTypes as CT } from "@routr/common" -import { JsonObject } from "pb-util/build" import { CredentialsManager } from "./credentials" import { DomainManager } from "./domain" import { EntityManager } from "./manager" +import { JsonValue } from "@prisma/client/runtime/library" type AgentWithDomainAndCredentials = Prisma.AgentGetPayload<{ include: { @@ -51,7 +51,7 @@ export class AgentManager extends EntityManager { super() } - static includeFields(): JsonObject { + static includeFields(): Record { return { domain: { include: { @@ -70,51 +70,36 @@ export class AgentManager extends EntityManager { } validOrThrowUpdate() { - CC.hasRefenceOrThrow(this.agent.ref) + CC.hasReferenceOrThrow(this.agent.ref) CC.isValidNameOrThrow(this.agent.name) } mapToPrisma(): AgentPrismaModel { return { // TODO: Set a default value for apiVersion + ...this.agent, apiVersion: "v2" as APIVersion, - ref: this.agent.ref, - name: this.agent.name, - username: this.agent.username, privacy: (this.agent.privacy as Privacy) ?? Privacy.NONE, - enabled: this.agent.enabled, domainRef: this.agent.domainRef || null, credentialsRef: this.agent.credentialsRef || null, - createdAt: this.agent.createdAt - ? new Date(this.agent.createdAt * 1000) - : undefined, - updatedAt: this.agent.updatedAt - ? new Date(this.agent.updatedAt * 1000) - : undefined, - maxContacts: this.agent.maxContacts, - expires: this.agent.expires, - extended: this.agent.extended || {} + expires: this.agent.expires || 0, + createdAt: undefined, + updatedAt: undefined, + extended: this.agent.extended as JsonValue } } static mapToDto(agent: AgentWithDomainAndCredentials): CC.Agent { return agent ? { - apiVersion: agent.apiVersion, - ref: agent.ref, - name: agent.name, - username: agent.username, + ...agent, + apiVersion: agent.apiVersion as CC.APIVersion, privacy: agent.privacy as CT.Privacy, - enabled: agent.enabled, - domainRef: agent.domainRef, - credentialsRef: agent.credentialsRef, domain: DomainManager.mapToDto(agent.domain), credentials: CredentialsManager.mapToDto(agent.credentials), - maxContacts: agent.maxContacts, - expires: agent.expires, - extended: (agent.extended || {}) as JsonObject, createdAt: agent.createdAt.getTime() / 1000, - updatedAt: agent.updatedAt.getTime() / 1000 + updatedAt: agent.updatedAt.getTime() / 1000, + extended: agent.extended as Record } : undefined } diff --git a/mods/pgdata/src/mappers/credentials.ts b/mods/pgdata/src/mappers/credentials.ts index 336d623f7..8ae764a3c 100644 --- a/mods/pgdata/src/mappers/credentials.ts +++ b/mods/pgdata/src/mappers/credentials.ts @@ -22,8 +22,8 @@ import { APIVersion } from "@prisma/client" import { CommonConnect as CC } from "@routr/common" -import { JsonObject } from "pb-util/build" import { EntityManager } from "./manager" +import { JsonValue } from "@prisma/client/runtime/library" // Needs testing export class CredentialsManager extends EntityManager { @@ -31,7 +31,7 @@ export class CredentialsManager extends EntityManager { super() } - static includeFields(): JsonObject { + static includeFields(): Record { return null } @@ -44,7 +44,7 @@ export class CredentialsManager extends EntityManager { } validOrThrowUpdate() { - CC.hasRefenceOrThrow(this.credentials.ref) + CC.hasReferenceOrThrow(this.credentials.ref) CC.isValidNameOrThrow(this.credentials.name) CC.isValidUsernameOrThrow(this.credentials.username) } @@ -52,32 +52,22 @@ export class CredentialsManager extends EntityManager { mapToPrisma(): CredentialsPrismaModel { return { // TODO: Set a default value for apiVersion + ...this.credentials, apiVersion: "v2" as APIVersion, - ref: this.credentials.ref, - name: this.credentials.name, - username: this.credentials.username, - password: this.credentials.password || undefined, - createdAt: this.credentials.createdAt - ? new Date(this.credentials.createdAt * 1000) - : undefined, - updatedAt: this.credentials.updatedAt - ? new Date(this.credentials.updatedAt * 1000) - : undefined, - extended: this.credentials.extended || {} + createdAt: undefined, + updatedAt: undefined, + extended: this.credentials.extended as JsonValue } } static mapToDto(credentials: CredentialsPrismaModel): CC.Credentials { return credentials ? { - apiVersion: credentials.apiVersion, - ref: credentials.ref, - name: credentials.name, - username: credentials.username, - password: credentials.password, + ...credentials, + apiVersion: credentials.apiVersion as CC.APIVersion, createdAt: credentials.createdAt.getTime() / 1000, updatedAt: credentials.updatedAt.getTime() / 1000, - extended: credentials.extended as JsonObject + extended: credentials.extended as Record } : undefined } diff --git a/mods/pgdata/src/mappers/domain.ts b/mods/pgdata/src/mappers/domain.ts index 0db95e255..5be403569 100644 --- a/mods/pgdata/src/mappers/domain.ts +++ b/mods/pgdata/src/mappers/domain.ts @@ -24,10 +24,10 @@ import { EgressPolicy } from "@prisma/client" import { CommonConnect as CC } from "@routr/common" -import { JsonObject } from "pb-util/build" import { ACLManager } from "./acl" import { EntityManager } from "./manager" import { NumberManager } from "./number" +import { JsonValue } from "@prisma/client/runtime/library" type DomainWithACL = Prisma.DomainGetPayload<{ include: { @@ -46,7 +46,7 @@ export class DomainManager extends EntityManager { super() } - static includeFields(): JsonObject { + static includeFields(): Record { return { accessControlList: true, egressPolicies: { @@ -64,7 +64,7 @@ export class DomainManager extends EntityManager { } validOrThrowUpdate() { - CC.hasRefenceOrThrow(this.domain.ref) + CC.hasReferenceOrThrow(this.domain.ref) CC.isValidNameOrThrow(this.domain.name) } @@ -75,24 +75,18 @@ export class DomainManager extends EntityManager { } { return { // TODO: Set a default value for apiVersion + ...this.domain, apiVersion: "v2" as APIVersion, - ref: this.domain.ref, - name: this.domain.name, accessControlListRef: this.domain.accessControlListRef || null, - domainUri: this.domain.domainUri, - extended: this.domain.extended || {}, - createdAt: this.domain.createdAt - ? new Date(this.domain.createdAt * 1000) - : undefined, - updatedAt: this.domain.updatedAt - ? new Date(this.domain.updatedAt * 1000) - : undefined, + extended: this.domain.extended as JsonValue, egressPolicies: { create: this.domain.egressPolicies?.map((policy) => ({ rule: policy.rule, numberRef: policy.numberRef })) - } + }, + createdAt: undefined, + updatedAt: undefined } } @@ -100,6 +94,7 @@ export class DomainManager extends EntityManager { return domain ? { ...domain, + apiVersion: domain.apiVersion as CC.APIVersion, accessControlListRef: domain.accessControlList?.ref, accessControlList: ACLManager.mapToDto(domain.accessControlList), egressPolicies: domain.egressPolicies?.map((policy) => ({ @@ -107,9 +102,9 @@ export class DomainManager extends EntityManager { numberRef: policy.numberRef, number: NumberManager.mapToDtoWithoutTrunk(policy.number) })), - extended: domain.extended as JsonObject, createdAt: domain.createdAt.getTime() / 1000, - updatedAt: domain.updatedAt.getTime() / 1000 + updatedAt: domain.updatedAt.getTime() / 1000, + extended: domain.extended as Record } : undefined } diff --git a/mods/pgdata/src/mappers/manager.ts b/mods/pgdata/src/mappers/manager.ts index 479e64731..c80f83414 100644 --- a/mods/pgdata/src/mappers/manager.ts +++ b/mods/pgdata/src/mappers/manager.ts @@ -17,10 +17,8 @@ * limitations under the License. */ /* eslint-disable require-jsdoc */ -import { JsonObject } from "pb-util/build" - export abstract class EntityManager { - static readonly includeFields: () => JsonObject + static readonly includeFields: () => Record abstract validOrThrowCreate(): void abstract validOrThrowUpdate(): void } diff --git a/mods/pgdata/src/mappers/number.ts b/mods/pgdata/src/mappers/number.ts index 5f8f74b2b..4cf3a22ce 100644 --- a/mods/pgdata/src/mappers/number.ts +++ b/mods/pgdata/src/mappers/number.ts @@ -18,11 +18,10 @@ */ /* eslint-disable require-jsdoc */ import { Number as NumberPrismaModel, APIVersion, Prisma } from "@prisma/client" -import { CommonConnect as CC } from "@routr/common" -import { JsonObject } from "pb-util/build" +import { CommonConnect as CC, Environment } from "@routr/common" import { EntityManager } from "./manager" import { TrunkManager } from "./trunk" -import { Environment } from "@routr/common" +import { JsonValue } from "@prisma/client/runtime/library" type NumberWithTrunk = Prisma.NumberGetPayload<{ include: { @@ -43,7 +42,7 @@ export class NumberManager extends EntityManager { super() } - static includeFields(): JsonObject { + static includeFields(): Record { return { trunk: { include: { @@ -77,7 +76,7 @@ export class NumberManager extends EntityManager { } validOrThrowUpdate() { - CC.hasRefenceOrThrow(this.number.ref) + CC.hasReferenceOrThrow(this.number.ref) CC.isValidNameOrThrow(this.number.name) CC.isValidAORLinkOrThrow(this.number.aorLink) CC.hasValidHeadersOrThrow(this.number.extraHeaders) @@ -87,48 +86,30 @@ export class NumberManager extends EntityManager { mapToPrisma(): NumberPrismaModel { return { // TODO: Set a default value for apiVersion + ...this.number, apiVersion: "v2" as APIVersion, - ref: this.number.ref, - name: this.number.name, - trunkRef: this.number.trunkRef || null, - telUrl: this.number.telUrl, - aorLink: this.number.aorLink || null, - city: this.number.city || undefined, - country: this.number.country, - countryIsoCode: this.number.countryIsoCode, - sessionAffinityHeader: this.number.sessionAffinityHeader || null, - extraHeaders: this.number.extraHeaders || null, - createdAt: this.number.createdAt - ? new Date(this.number.createdAt * 1000) - : undefined, - updatedAt: this.number.updatedAt - ? new Date(this.number.updatedAt * 1000) - : undefined, - extended: this.number.extended || {} + trunkRef: this.number.trunkRef, + sessionAffinityHeader: this.number.sessionAffinityHeader, + extraHeaders: this.number.extraHeaders, + createdAt: undefined, + updatedAt: undefined, + extended: this.number.extended as JsonValue } } static mapToDto(number: NumberWithTrunk): CC.INumber { return number ? { - apiVersion: number.apiVersion, - ref: number.ref, - name: number.name, - trunkRef: number.trunkRef, + ...number, + apiVersion: number.apiVersion as CC.APIVersion, trunk: TrunkManager.mapToDto(number.trunk), - telUrl: number.telUrl, - aorLink: number.aorLink, - city: number.city, - country: number.country, - countryIsoCode: number.countryIsoCode, - sessionAffinityHeader: number.sessionAffinityHeader, extraHeaders: number.extraHeaders as { name: string value: string }[], - extended: number.extended as JsonObject, createdAt: number.createdAt.getTime() / 1000, - updatedAt: number.updatedAt.getTime() / 1000 + updatedAt: number.updatedAt.getTime() / 1000, + extended: number.extended as Record } : undefined } @@ -136,23 +117,15 @@ export class NumberManager extends EntityManager { static mapToDtoWithoutTrunk(number: NumberPrismaModel): CC.INumber { return number ? { - apiVersion: number.apiVersion, - ref: number.ref, - name: number.name, - trunkRef: number.trunkRef, - telUrl: number.telUrl, - aorLink: number.aorLink, - city: number.city, - country: number.country, - countryIsoCode: number.countryIsoCode, - sessionAffinityHeader: number.sessionAffinityHeader, + ...number, + apiVersion: number.apiVersion as CC.APIVersion, extraHeaders: number.extraHeaders as { name: string value: string }[], - extended: number.extended as JsonObject, createdAt: number.createdAt.getTime() / 1000, - updatedAt: number.updatedAt.getTime() / 1000 + updatedAt: number.updatedAt.getTime() / 1000, + extended: number.extended as Record } : undefined } diff --git a/mods/pgdata/src/mappers/peer.ts b/mods/pgdata/src/mappers/peer.ts index 2f04b7a98..1c7885e98 100644 --- a/mods/pgdata/src/mappers/peer.ts +++ b/mods/pgdata/src/mappers/peer.ts @@ -19,10 +19,10 @@ /* eslint-disable require-jsdoc */ import { Peer as PeerPrismaModel, APIVersion, Prisma } from "@prisma/client" import { CommonConnect as CC, CommonTypes as CT } from "@routr/common" -import { JsonObject } from "pb-util/build" import { ACLManager } from "./acl" import { CredentialsManager } from "./credentials" import { EntityManager } from "./manager" +import { JsonValue } from "@prisma/client/runtime/library" type PeerWithDomainAndCredentials = Prisma.PeerGetPayload<{ include: { @@ -37,7 +37,7 @@ export class PeerManager extends EntityManager { super() } - static includeFields(): JsonObject { + static includeFields(): Record { return { accessControlList: true, credentials: true @@ -55,7 +55,7 @@ export class PeerManager extends EntityManager { } validOrThrowUpdate() { - CC.hasRefenceOrThrow(this.peer.ref) + CC.hasReferenceOrThrow(this.peer.ref) CC.isValidNameOrThrow(this.peer.name) CC.isValidUsernameOrThrow(this.peer.username) CC.isValidAOROrThrow(this.peer.aor) @@ -70,51 +70,31 @@ export class PeerManager extends EntityManager { return { // TODO: Set a default value for apiVersion + ...this.peer, apiVersion: "v2" as APIVersion, - ref: this.peer.ref, - name: this.peer.name, - username: this.peer.username, - aor: this.peer.aor, - contactAddr: this.peer.contactAddr, balancingAlgorithm: normalizeAlgorithm(this.peer.balancingAlgorithm), withSessionAffinity: this.peer.withSessionAffinity, - enabled: this.peer.enabled, credentialsRef: this.peer.credentialsRef || null, accessControlListRef: this.peer.accessControlListRef || null, - createdAt: this.peer.createdAt - ? new Date(this.peer.createdAt * 1000) - : undefined, - updatedAt: this.peer.updatedAt - ? new Date(this.peer.updatedAt * 1000) - : undefined, - maxContacts: this.peer.maxContacts, - expires: this.peer.expires, - extended: this.peer.extended || {} + expires: this.peer.expires || 0, + createdAt: undefined, + updatedAt: undefined, + extended: this.peer.extended as JsonValue } } static mapToDto(peer: PeerWithDomainAndCredentials): CC.Peer { return peer ? { - apiVersion: peer.apiVersion, - ref: peer.ref, - name: peer.name, - username: peer.username, - aor: peer.aor, - contactAddr: peer.contactAddr, + ...peer, + apiVersion: peer.apiVersion as CC.APIVersion, balancingAlgorithm: peer.balancingAlgorithm as CT.LoadBalancingAlgorithm, - withSessionAffinity: peer.withSessionAffinity, - enabled: peer.enabled, - credentialsRef: peer.credentialsRef, credentials: CredentialsManager.mapToDto(peer.credentials), - accessControlListRef: peer.accessControlListRef, accessControlList: ACLManager.mapToDto(peer.accessControlList), createdAt: peer.createdAt.getTime() / 1000, updatedAt: peer.updatedAt.getTime() / 1000, - maxContacts: peer.maxContacts, - expires: peer.expires, - extended: peer.extended as JsonObject + extended: peer.extended as Record } : undefined } diff --git a/mods/pgdata/src/mappers/trunk.ts b/mods/pgdata/src/mappers/trunk.ts index a64fdcdca..423febe89 100644 --- a/mods/pgdata/src/mappers/trunk.ts +++ b/mods/pgdata/src/mappers/trunk.ts @@ -24,10 +24,10 @@ import { TrunkURI } from "@prisma/client" import { CommonConnect as CC, CommonTypes as CT } from "@routr/common" -import { JsonObject } from "pb-util/build" import { ACLManager } from "./acl" import { CredentialsManager } from "./credentials" import { EntityManager } from "./manager" +import { JsonValue } from "@prisma/client/runtime/library" type TrunkWithEagerLoading = Prisma.TrunkGetPayload<{ include: { @@ -44,7 +44,7 @@ export class TrunkManager extends EntityManager { super() } - static includeFields(): JsonObject { + static includeFields(): Record { return { accessControlList: true, inboundCredentials: true, @@ -62,7 +62,7 @@ export class TrunkManager extends EntityManager { } validOrThrowUpdate() { - CC.hasRefenceOrThrow(this.trunk.ref) + CC.hasReferenceOrThrow(this.trunk.ref) CC.isValidNameOrThrow(this.trunk.name) CC.isValidInboundUriOrThrow(this.trunk.inboundUri) } @@ -72,44 +72,25 @@ export class TrunkManager extends EntityManager { } { return { // TODO: Set a default value for apiVersion + ...this.trunk, apiVersion: "v2" as APIVersion, - ref: this.trunk.ref, - name: this.trunk.name, accessControlListRef: this.trunk.accessControlListRef || null, - inboundUri: this.trunk.inboundUri, inboundCredentialsRef: this.trunk.inboundCredentialsRef || null, outboundCredentialsRef: this.trunk.outboundCredentialsRef || null, - sendRegister: this.trunk.sendRegister, - createdAt: this.trunk.createdAt - ? new Date(this.trunk.createdAt * 1000) - : undefined, - updatedAt: this.trunk.updatedAt - ? new Date(this.trunk.updatedAt * 1000) - : undefined, - extended: this.trunk.extended || {}, uris: { - create: this.trunk.uris?.map((uri) => { - return { - host: uri.host, - port: uri.port, - transport: uri.transport, - user: uri.user, - weight: uri.weight, - priority: uri.priority, - enabled: uri.enabled - } - }) - } + create: this.trunk.uris + }, + extended: this.trunk.extended as JsonValue, + createdAt: undefined, + updatedAt: undefined } } static mapToDto(trunk: TrunkWithEagerLoading): CC.Trunk { return trunk ? { - apiVersion: trunk.apiVersion, - ref: trunk.ref, - name: trunk.name, - inboundUri: trunk.inboundUri, + ...trunk, + apiVersion: trunk.apiVersion as CC.APIVersion, accessControlListRef: trunk.accessControlList?.ref, inboundCredentialsRef: trunk.inboundCredentials?.ref, outboundCredentialsRef: trunk.outboundCredentials?.ref, @@ -120,23 +101,15 @@ export class TrunkManager extends EntityManager { outboundCredentials: CredentialsManager.mapToDto( trunk.outboundCredentials ), - extended: trunk.extended as JsonObject, - sendRegister: trunk.sendRegister, uris: trunk.uris.map((uri) => { return { - ref: uri.ref, - trunkRef: uri.trunkRef, - host: uri.host, - port: uri.port, - transport: uri.transport.toUpperCase() as CT.Transport, - user: uri.user, - weight: uri.weight, - priority: uri.priority, - enabled: uri.enabled + ...uri, + transport: uri.transport.toUpperCase() as CT.Transport } }), createdAt: trunk.createdAt.getTime() / 1000, - updatedAt: trunk.updatedAt.getTime() / 1000 + updatedAt: trunk.updatedAt.getTime() / 1000, + extended: trunk.extended as Record } : undefined } diff --git a/mods/pgdata/src/runner.ts b/mods/pgdata/src/runner.ts index 6c2e0f031..9969d881d 100644 --- a/mods/pgdata/src/runner.ts +++ b/mods/pgdata/src/runner.ts @@ -18,7 +18,7 @@ * limitations under the License. */ // eslint-disable-next-line @typescript-eslint/no-var-requires -require("./tracer").init("simpleauth") +require("./tracer").init("pgdata") import { getLogger } from "@fonoster/logger" import { BIND_ADDR, EXTERNAL_SERVER_BIND_ADDR } from "./envs" import pgDataService from "./service" diff --git a/mods/pgdata/src/service.ts b/mods/pgdata/src/service.ts index 62e5584ea..9dab48c24 100644 --- a/mods/pgdata/src/service.ts +++ b/mods/pgdata/src/service.ts @@ -20,7 +20,6 @@ import * as grpc from "@grpc/grpc-js" import { DBDelegate, PostgresDataConfig } from "./types" import { CommonConnect as CC } from "@routr/common" import { getLogger } from "@fonoster/logger" -import { PrismaClient } from "@prisma/client" import { create } from "./api/create" import { update } from "./api/update" import { get } from "./api/get" @@ -42,7 +41,7 @@ import { prisma } from "./db" const logger = getLogger({ service: "pgdata", filePath: __filename }) /** - * Starts a new posgres data service. + * Starts a new postgres data service. * * @param {PostgresDataConfig} config - the configuration of the service */ diff --git a/mods/pgdata/src/types.ts b/mods/pgdata/src/types.ts index 9c88bbff5..0eda275f6 100644 --- a/mods/pgdata/src/types.ts +++ b/mods/pgdata/src/types.ts @@ -17,7 +17,6 @@ * limitations under the License. */ import { CommonConnect as CC } from "@routr/common" -import { JsonObject } from "pb-util/build" export interface PostgresDataConfig { bindAddr: string @@ -32,14 +31,14 @@ export type PrismaOperation = (request: { where: { ref: string } - include?: JsonObject + include?: Record }) => unknown export type PrismaFindByOperation = (request: { where: { [key: string]: boolean | string | number } - include?: JsonObject + include?: Record }) => unknown export type PrismaListOperation = (request: { @@ -48,13 +47,13 @@ export type PrismaListOperation = (request: { cursor: { ref: string } - orderBy: JsonObject - include?: JsonObject + orderBy: Record + include?: Record }) => unknown export type PrismaCreateOperation = (request: { data: any - include?: JsonObject + include?: Record }) => unknown export type PrismaUpdateOperation = (request: { @@ -62,5 +61,5 @@ export type PrismaUpdateOperation = (request: { ref: string } data: unknown - include?: JsonObject + include?: Record }) => unknown diff --git a/mods/pgdata/test/acl.mapper.unit.test.ts b/mods/pgdata/test/acl.mapper.unit.test.ts index 40e3c2184..9658e6dd2 100644 --- a/mods/pgdata/test/acl.mapper.unit.test.ts +++ b/mods/pgdata/test/acl.mapper.unit.test.ts @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { APIVersion } from "@prisma/client" +import { CommonConnect as CC } from "@routr/common" import { ACLManager } from "../src/mappers/acl" import chai from "chai" import sinon from "sinon" @@ -34,13 +34,13 @@ describe("@routr/pgdata/mappers/acl", () => { it("takes a dto object and converts it to prisma model", () => { // Arrange const acl = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "acl-01", name: "Local Network ACL", allow: ["192.168.1.3/31"], deny: ["0.0.0.0/1"], - createdAt: new Date().getTime() / 1000, - updatedAt: new Date().getTime() / 1000, + createdAt: new Date().getTime(), + updatedAt: new Date().getTime(), extended: { test: "test" } @@ -56,7 +56,7 @@ describe("@routr/pgdata/mappers/acl", () => { it("takes a prisma model and converts it to dto object", () => { // Arrange const acl = { - apiVersion: "v2" as APIVersion, + apiVersion: CC.APIVersion.V2, ref: "acl-01", name: "Local Network ACL", allow: ["192.168.1.3/31"], @@ -79,14 +79,16 @@ describe("@routr/pgdata/mappers/acl", () => { it("when the friendly name is not provided for create operations", () => { // Arrange const acl = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "acl-01", name: "", allow: ["192.168.1.3/31"], deny: ["0.0.0.0/1"], extended: { test: "test" - } + }, + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } // Act @@ -101,14 +103,16 @@ describe("@routr/pgdata/mappers/acl", () => { it("when the friendly name has more than 60 characters", () => { // Arrange const acl = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "acl-01", name: "a".repeat(65), allow: ["192.168.1.3/31"], deny: ["0.0.0.0/1"], extended: { test: "test" - } + }, + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } // Act @@ -127,14 +131,16 @@ describe("@routr/pgdata/mappers/acl", () => { it("when the reference is not provided for an update operation", () => { // Arrange const acl = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "", name: "Local Network ACL", allow: ["192.168.1.3/31"], deny: ["0.0.0.0/1"], extended: { test: "test" - } + }, + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } // Act @@ -147,14 +153,16 @@ describe("@routr/pgdata/mappers/acl", () => { it("when it finds an invalid allow or deny rule", () => { // Arrange const acl = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "acl-01", name: "Local Network ACL", allow: ["19x.168.1.3/31"], deny: ["0.0.0.0/1"], extended: { test: "test" - } + }, + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } // Act @@ -169,14 +177,16 @@ describe("@routr/pgdata/mappers/acl", () => { it("when missing deny or allow values", () => { // Arrange const acl = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "acl-01", name: "test", allow: [] as string[], deny: ["0.0.0.0/1"], extended: { test: "test" - } + }, + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } // Act diff --git a/mods/pgdata/test/agent.mapper.unit.test.ts b/mods/pgdata/test/agent.mapper.unit.test.ts index c224c74d0..e0934f07f 100644 --- a/mods/pgdata/test/agent.mapper.unit.test.ts +++ b/mods/pgdata/test/agent.mapper.unit.test.ts @@ -16,7 +16,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { APIVersion, Privacy as PrismaPrivacy, Prisma } from "@prisma/client" +import { Privacy as PrismaPrivacy, Prisma } from "@prisma/client" +import { CommonConnect as CC } from "@routr/common" import { Privacy } from "@routr/common/src/types" import { AgentManager } from "../src/mappers/agent" import chai from "chai" @@ -35,9 +36,9 @@ describe("@routr/pgdata/mappers/agent", () => { it("takes a dto object and converts it to prisma model", () => { // Arrange const agent = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "agent-01", - name: "Jhon Doe", + name: "John Doe", username: "1001", privacy: Privacy.PRIVATE, enabled: true, @@ -48,8 +49,8 @@ describe("@routr/pgdata/mappers/agent", () => { }, maxContacts: 1, expires: 3600, - createdAt: new Date().getTime() / 1000, - updatedAt: new Date().getTime() / 1000 + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } // Act @@ -78,9 +79,9 @@ describe("@routr/pgdata/mappers/agent", () => { }> const agent: AgentWithDomainAndCredentials = { - apiVersion: "v2" as APIVersion, + apiVersion: CC.APIVersion.V2, ref: "agent-01", - name: "Jhon Doe", + name: "John Doe", username: "1001", privacy: PrismaPrivacy.PRIVATE, enabled: true, @@ -94,13 +95,13 @@ describe("@routr/pgdata/mappers/agent", () => { maxContacts: 1, expires: 3600, domain: { - apiVersion: "v2" as APIVersion, + apiVersion: CC.APIVersion.V2, ref: "domain-01", name: "test", domainUri: "test", accessControlListRef: "acl-01", accessControlList: { - apiVersion: "v2" as APIVersion, + apiVersion: CC.APIVersion.V2, ref: "acl-01", name: "test", allow: ["0.0.0.0/1"], @@ -119,7 +120,7 @@ describe("@routr/pgdata/mappers/agent", () => { updatedAt: new Date() }, credentials: { - apiVersion: "v2" as APIVersion, + apiVersion: CC.APIVersion.V2, ref: "credentials-01", name: "test", username: "1001", @@ -145,7 +146,7 @@ describe("@routr/pgdata/mappers/agent", () => { it("when the friendly name is not provided for agent creation", () => { // Arrange const agent = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "agent-01", name: "", username: "1001", @@ -157,8 +158,8 @@ describe("@routr/pgdata/mappers/agent", () => { extended: { test: "test" }, - createdAt: new Date().getTime() / 1000, - updatedAt: new Date().getTime() / 1000 + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } // Act @@ -173,7 +174,7 @@ describe("@routr/pgdata/mappers/agent", () => { it("when the friendly name has more than 60 characters", () => { // Arrange const agent = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "agent-01", name: "a".repeat(65), username: "1001", @@ -185,8 +186,8 @@ describe("@routr/pgdata/mappers/agent", () => { extended: { test: "test" }, - createdAt: new Date().getTime() / 1000, - updatedAt: new Date().getTime() / 1000 + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } // Act @@ -205,9 +206,9 @@ describe("@routr/pgdata/mappers/agent", () => { it("when the reference is not provided for an update operation", () => { // Arrange const agent = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "", - name: "Jhon Doe", + name: "John Doe", username: "1001", privacy: Privacy.PRIVATE, enabled: true, @@ -217,8 +218,8 @@ describe("@routr/pgdata/mappers/agent", () => { extended: { test: "test" }, - createdAt: new Date().getTime() / 1000, - updatedAt: new Date().getTime() / 1000 + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } // Act @@ -231,9 +232,9 @@ describe("@routr/pgdata/mappers/agent", () => { it("when username is not present", () => { // Arrange const agent = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "agent-01", - name: "Jhon Doe", + name: "John Doe", username: "", privacy: Privacy.PRIVATE, enabled: true, @@ -243,8 +244,8 @@ describe("@routr/pgdata/mappers/agent", () => { extended: { test: "test" }, - createdAt: new Date().getTime() / 1000, - updatedAt: new Date().getTime() / 1000 + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } // Act @@ -257,9 +258,9 @@ describe("@routr/pgdata/mappers/agent", () => { it("when username is not alphanumeric without spaces", () => { // Arrange const agent = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "agent-01", - name: "Jhon Doe", + name: "John Doe", username: "1 0 0 1", privacy: Privacy.PRIVATE, enabled: true, @@ -269,8 +270,8 @@ describe("@routr/pgdata/mappers/agent", () => { extended: { test: "test" }, - createdAt: new Date().getTime() / 1000, - updatedAt: new Date().getTime() / 1000 + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } // Act diff --git a/mods/pgdata/test/credentials.mapper.unit.test.ts b/mods/pgdata/test/credentials.mapper.unit.test.ts index 3102821f3..d7051c898 100644 --- a/mods/pgdata/test/credentials.mapper.unit.test.ts +++ b/mods/pgdata/test/credentials.mapper.unit.test.ts @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { APIVersion } from "@prisma/client" +import { CommonConnect as CC } from "@routr/common" import { CredentialsManager } from "../src/mappers/credentials" import chai from "chai" import sinon from "sinon" @@ -34,13 +34,13 @@ describe("@routr/pgdata/mappers/credentials", () => { it("takes a dto object and converts it to prisma model", () => { // Arrange const credentials = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "credentials-01", name: "Global Credentials", username: "1001", password: "1234", - createdAt: new Date().getTime() / 1000, - updatedAt: new Date().getTime() / 1000, + createdAt: new Date().getTime(), + updatedAt: new Date().getTime(), extended: { test: "test" } @@ -58,7 +58,7 @@ describe("@routr/pgdata/mappers/credentials", () => { it("takes a prisma model and converts it to dto object", () => { // Arrange const credentials = { - apiVersion: "v2" as APIVersion, + apiVersion: CC.APIVersion.V2, ref: "credentials-01", name: "Global Credentials", username: "1001", @@ -83,14 +83,16 @@ describe("@routr/pgdata/mappers/credentials", () => { it("when the friendly name is not provided for credentials creation", () => { // Arrange const credentials = { - apiVersion: "v2" as APIVersion, + apiVersion: CC.APIVersion.V2, ref: "credentials-01", name: "", username: "1001", password: "1234", extended: { test: "test" - } + }, + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } // Act @@ -106,14 +108,16 @@ describe("@routr/pgdata/mappers/credentials", () => { it("when the friendly name has more than 60 characters", () => { // Arrange const credentials = { - apiVersion: "v2" as APIVersion, + apiVersion: CC.APIVersion.V2BETA1, ref: "credentials-01", name: "a".repeat(65), username: "1001", password: "1234", extended: { test: "test" - } + }, + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } // Act @@ -134,14 +138,16 @@ describe("@routr/pgdata/mappers/credentials", () => { it("when the reference is not provided for an update operation", () => { // Arrange const credentials = { - apiVersion: "v2" as APIVersion, + apiVersion: CC.APIVersion.V2, ref: "", name: "Global Credentials", username: "1001", password: "1234", extended: { test: "test" - } + }, + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } // Act @@ -155,14 +161,16 @@ describe("@routr/pgdata/mappers/credentials", () => { it("when request is missing the username", () => { // Arrange const credentials = { - apiVersion: "v2" as APIVersion, + apiVersion: CC.APIVersion.V2, ref: "credentials-01", name: "Global Credentials", username: "", password: "1234", extended: { test: "test" - } + }, + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } // Act @@ -176,14 +184,16 @@ describe("@routr/pgdata/mappers/credentials", () => { it("when the username is non-alphanumeric or has spaces", () => { // Arrange const credentials = { - apiVersion: "v2" as APIVersion, + apiVersion: CC.APIVersion.V2, ref: "credentials-01", name: "Global Credentials", username: "1001 #", password: "1234", extended: { test: "test" - } + }, + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } // Act @@ -200,14 +210,16 @@ describe("@routr/pgdata/mappers/credentials", () => { it("when request is missing the password", () => { // Arrange const credentials = { - apiVersion: "v2" as APIVersion, + apiVersion: CC.APIVersion.V2, ref: "credentials-01", name: "Global Credentials", username: "1234", password: "", extended: { test: "test" - } + }, + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } // Act diff --git a/mods/pgdata/test/domain.mapper.unit.test.ts b/mods/pgdata/test/domain.mapper.unit.test.ts index ea1475f03..b05cf9619 100644 --- a/mods/pgdata/test/domain.mapper.unit.test.ts +++ b/mods/pgdata/test/domain.mapper.unit.test.ts @@ -16,7 +16,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { APIVersion, Prisma } from "@prisma/client" +import { Prisma } from "@prisma/client" +import { CommonConnect as CC } from "@routr/common" import { DomainManager } from "../src/mappers/domain" import chai from "chai" import sinon from "sinon" @@ -34,7 +35,7 @@ describe("@routr/pgdata/mappers/domain", () => { it("takes a dto object and converts it to prisma model", () => { // Arrange const domain = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "domain-01", name: "Local Domain", accessControlListRef: "acl-01", @@ -42,8 +43,8 @@ describe("@routr/pgdata/mappers/domain", () => { extended: { test: "test" }, - createdAt: new Date().getTime() / 1000, - updatedAt: new Date().getTime() / 1000 + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } // Act @@ -69,7 +70,7 @@ describe("@routr/pgdata/mappers/domain", () => { }> const domain: DomainWithACL = { - apiVersion: "v2" as APIVersion, + apiVersion: CC.APIVersion.V2, ref: "domain-01", name: "Local Domain", accessControlListRef: "acl-01", @@ -80,7 +81,7 @@ describe("@routr/pgdata/mappers/domain", () => { test: "test" }, accessControlList: { - apiVersion: "v2" as APIVersion, + apiVersion: CC.APIVersion.V2, ref: "acl-01", name: "test", allow: ["192.168.1.2/31"], @@ -107,7 +108,7 @@ describe("@routr/pgdata/mappers/domain", () => { it("when the friendly name is not provided for domain creation", () => { // Arrange const domain = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "domain-01", name: "", accessControlListRef: "acl-01", @@ -115,8 +116,8 @@ describe("@routr/pgdata/mappers/domain", () => { extended: { test: "test" }, - createdAt: new Date().getTime() / 1000, - updatedAt: new Date().getTime() / 1000 + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } // Act @@ -131,7 +132,7 @@ describe("@routr/pgdata/mappers/domain", () => { it("when the friendly name has more than 60 characters", () => { // Arrange const domain = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "domain-01", name: "a".repeat(65), accessControlListRef: "acl-01", @@ -139,8 +140,8 @@ describe("@routr/pgdata/mappers/domain", () => { extended: { test: "test" }, - createdAt: new Date().getTime() / 1000, - updatedAt: new Date().getTime() / 1000 + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } // Act @@ -159,7 +160,7 @@ describe("@routr/pgdata/mappers/domain", () => { it("when the reference is not provided for an update operation", () => { // Arrange const domain = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "", name: "Local Domain", accessControlListRef: "acl-01", @@ -167,8 +168,8 @@ describe("@routr/pgdata/mappers/domain", () => { extended: { test: "test" }, - createdAt: new Date().getTime() / 1000, - updatedAt: new Date().getTime() / 1000 + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } // Act @@ -181,7 +182,7 @@ describe("@routr/pgdata/mappers/domain", () => { it("when domainUri is not a valid FQDN", () => { // Arrange const domain = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "domain-01", name: "Local Domain", accessControlListRef: "acl-01", @@ -189,8 +190,8 @@ describe("@routr/pgdata/mappers/domain", () => { extended: { test: "test" }, - createdAt: new Date().getTime() / 1000, - updatedAt: new Date().getTime() / 1000 + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } // Act diff --git a/mods/pgdata/test/number.mapper.unit.test.ts b/mods/pgdata/test/number.mapper.unit.test.ts index b09583990..9c9cfe074 100644 --- a/mods/pgdata/test/number.mapper.unit.test.ts +++ b/mods/pgdata/test/number.mapper.unit.test.ts @@ -16,7 +16,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { APIVersion, Prisma, Transport } from "@prisma/client" +import { Prisma, Transport } from "@prisma/client" +import { CommonConnect as CC } from "@routr/common" import { NumberManager } from "../src/mappers/number" import chai from "chai" import sinon from "sinon" @@ -34,7 +35,7 @@ describe("@routr/pgdata/mappers/number", () => { it("takes a dto object and converts it to prisma model", () => { // Arrange const number = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "number-01", trunkRef: "trunk-01", name: "(785)317-8070", @@ -53,8 +54,8 @@ describe("@routr/pgdata/mappers/number", () => { extended: { test: "test" }, - createdAt: new Date().getTime() / 1000, - updatedAt: new Date().getTime() / 1000 + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } // Act @@ -83,7 +84,7 @@ describe("@routr/pgdata/mappers/number", () => { }> const number: NumberWithTrunk = { - apiVersion: "v2" as APIVersion, + apiVersion: CC.APIVersion.V2, ref: "number-01", trunkRef: "trunk-01", name: "(785)317-8070", @@ -100,7 +101,7 @@ describe("@routr/pgdata/mappers/number", () => { createdAt: new Date(), updatedAt: new Date(), trunk: { - apiVersion: "v2" as APIVersion, + apiVersion: CC.APIVersion.V2, ref: "trunk-01", name: "Global Trunk", accessControlListRef: "acl-01", @@ -108,7 +109,7 @@ describe("@routr/pgdata/mappers/number", () => { inboundUri: "sip:sip.local", inboundCredentialsRef: "inbound-01", inboundCredentials: { - apiVersion: "v2" as APIVersion, + apiVersion: CC.APIVersion.V2, ref: "inbound-01", name: "test", username: "test", @@ -121,7 +122,7 @@ describe("@routr/pgdata/mappers/number", () => { }, outboundCredentialsRef: "outbound-01", outboundCredentials: { - apiVersion: "v2" as APIVersion, + apiVersion: CC.APIVersion.V2, ref: "outbound-01", name: "test", username: "test", @@ -133,7 +134,7 @@ describe("@routr/pgdata/mappers/number", () => { } }, accessControlList: { - apiVersion: "v2" as APIVersion, + apiVersion: CC.APIVersion.V2, ref: "acl-01", name: "test", allow: ["0.0.0.1/1"], @@ -179,7 +180,7 @@ describe("@routr/pgdata/mappers/number", () => { it("when the friendly name is not provided for create operations", () => { // Arrange const number = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "number-01", trunkRef: "trunk-01", name: "", @@ -198,8 +199,8 @@ describe("@routr/pgdata/mappers/number", () => { extended: { test: "test" }, - createdAt: new Date().getTime() / 1000, - updatedAt: new Date().getTime() / 1000 + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } // Act @@ -214,7 +215,7 @@ describe("@routr/pgdata/mappers/number", () => { it("when the friendly name has more than 60 characters", () => { // Arrange const number = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "number-01", trunkRef: "trunk-01", name: "a".repeat(65), @@ -233,8 +234,8 @@ describe("@routr/pgdata/mappers/number", () => { extended: { test: "test" }, - createdAt: new Date().getTime() / 1000, - updatedAt: new Date().getTime() / 1000 + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } // Act @@ -253,7 +254,7 @@ describe("@routr/pgdata/mappers/number", () => { it("when the reference is not provided for an update operation", () => { // Arrange const number = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "", trunkRef: "trunk-01", name: "(785)317-8070", @@ -272,8 +273,8 @@ describe("@routr/pgdata/mappers/number", () => { extended: { test: "test" }, - createdAt: new Date().getTime() / 1000, - updatedAt: new Date().getTime() / 1000 + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } // Act @@ -286,7 +287,7 @@ describe("@routr/pgdata/mappers/number", () => { it("when the request is missing the telUrl", () => { // Arrange const number = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "number-01", trunkRef: "trunk-01", name: "(785)317-8070", @@ -305,8 +306,8 @@ describe("@routr/pgdata/mappers/number", () => { extended: { test: "test" }, - createdAt: new Date().getTime() / 1000, - updatedAt: new Date().getTime() / 1000 + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } // Act const result = () => new NumberManager(number).validOrThrowCreate() @@ -318,7 +319,7 @@ describe("@routr/pgdata/mappers/number", () => { it("when sessionAffinityHeader is not alphanumeric or has spaces", () => { // Arrange const number = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "number-01", trunkRef: "trunk-01", name: "(785)317-8070", @@ -337,8 +338,8 @@ describe("@routr/pgdata/mappers/number", () => { extended: { test: "test" }, - createdAt: new Date().getTime() / 1000, - updatedAt: new Date().getTime() / 1000 + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } // Act const createResult = () => new NumberManager(number).validOrThrowCreate() @@ -356,7 +357,7 @@ describe("@routr/pgdata/mappers/number", () => { it("when aor link doesn't start with backend: or sip:", () => { // Arrange const number = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "number-01", trunkRef: "trunk-01", name: "(785)317-8070", @@ -375,8 +376,8 @@ describe("@routr/pgdata/mappers/number", () => { extended: { test: "test" }, - createdAt: new Date().getTime() / 1000, - updatedAt: new Date().getTime() / 1000 + createdAt: new Date().getTime(), + updatedAt: new Date().getTime() } // Act const createResult = () => new NumberManager(number).validOrThrowCreate() diff --git a/mods/pgdata/test/peer.mapper.unit.test.ts b/mods/pgdata/test/peer.mapper.unit.test.ts index 21da46869..a5aef308f 100644 --- a/mods/pgdata/test/peer.mapper.unit.test.ts +++ b/mods/pgdata/test/peer.mapper.unit.test.ts @@ -16,8 +16,8 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import { APIVersion, LoadBalancingAlgorithm, Prisma } from "@prisma/client" -import { CommonTypes as CT } from "@routr/common" +import { LoadBalancingAlgorithm, Prisma } from "@prisma/client" +import { CommonTypes as CT, CommonConnect as CC } from "@routr/common" import { PeerManager } from "../src/mappers/peer" import chai from "chai" import sinon from "sinon" @@ -35,7 +35,7 @@ describe("@routr/pgdata/mappers/peer", () => { it("takes a dto object and converts it to prisma model", () => { // Arrange const peer = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "peer-01", credentialsRef: "credentials-01", accessControlListRef: "acl-01", @@ -46,8 +46,8 @@ describe("@routr/pgdata/mappers/peer", () => { balancingAlgorithm: CT.LoadBalancingAlgorithm.ROUND_ROBIN, withSessionAffinity: false, enabled: true, - createdAt: new Date().getTime() / 1000, - updatedAt: new Date().getTime() / 1000, + createdAt: new Date().getTime(), + updatedAt: new Date().getTime(), maxContacts: 1, expires: 3600, extended: { @@ -72,7 +72,7 @@ describe("@routr/pgdata/mappers/peer", () => { }> const peer: PeerWithDomainAndCredentials = { - apiVersion: "v2" as APIVersion, + apiVersion: CC.APIVersion.V2, ref: "peer-01", credentialsRef: "credentials-01", name: "Asterisk Media Server", @@ -83,7 +83,7 @@ describe("@routr/pgdata/mappers/peer", () => { withSessionAffinity: false, enabled: true, credentials: { - apiVersion: "v2" as APIVersion, + apiVersion: CC.APIVersion.V2, name: "test", ref: "credentials-01", username: "asterisk", @@ -98,7 +98,7 @@ describe("@routr/pgdata/mappers/peer", () => { expires: 3600, accessControlListRef: "acl-01", accessControlList: { - apiVersion: "v2" as APIVersion, + apiVersion: CC.APIVersion.V2, ref: "acl-01", name: "test", allow: ["0.0.0.1/16"], @@ -129,7 +129,7 @@ describe("@routr/pgdata/mappers/peer", () => { it("when the friendly name is not provided for peer creation", () => { // Arrange const peer = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "peer-01", credentialsRef: "credentials-01", accessControlListRef: "acl-01", @@ -139,8 +139,8 @@ describe("@routr/pgdata/mappers/peer", () => { contactAddr: "192.168.1.12", enabled: true, maxContacts: -1, - createdAt: new Date().getTime() / 1000, - updatedAt: new Date().getTime() / 1000, + createdAt: new Date().getTime(), + updatedAt: new Date().getTime(), extended: { test: "test" } @@ -158,7 +158,7 @@ describe("@routr/pgdata/mappers/peer", () => { it("when the friendly name has more than 60 characters", () => { // Arrange const peer = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "peer-01", credentialsRef: "credentials-01", accessControlListRef: "acl-01", @@ -167,8 +167,8 @@ describe("@routr/pgdata/mappers/peer", () => { aor: "sip:1001@sip.local", contactAddr: "192.168.1.12", enabled: true, - createdAt: new Date().getTime() / 1000, - updatedAt: new Date().getTime() / 1000, + createdAt: new Date().getTime(), + updatedAt: new Date().getTime(), maxContacts: -1, extended: { test: "test" @@ -191,7 +191,7 @@ describe("@routr/pgdata/mappers/peer", () => { it("when the reference is not provided for an update operation", () => { // Arrange const peer = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "", credentialsRef: "credentials-01", accessControlListRef: "acl-01", @@ -201,8 +201,8 @@ describe("@routr/pgdata/mappers/peer", () => { contactAddr: "192.168.1.12", maxContacts: -1, enabled: true, - createdAt: new Date().getTime() / 1000, - updatedAt: new Date().getTime() / 1000, + createdAt: new Date().getTime(), + updatedAt: new Date().getTime(), extended: { test: "test" } @@ -218,7 +218,7 @@ describe("@routr/pgdata/mappers/peer", () => { it("when the request is missing the username", () => { // Arrange const peer = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "peer-01", credentialsRef: "credentials-01", accessControlListRef: "acl-01", @@ -228,8 +228,8 @@ describe("@routr/pgdata/mappers/peer", () => { contactAddr: "192.168.1.12", maxContacts: -1, enabled: true, - createdAt: new Date().getTime() / 1000, - updatedAt: new Date().getTime() / 1000, + createdAt: new Date().getTime(), + updatedAt: new Date().getTime(), extended: { test: "test" } @@ -245,7 +245,7 @@ describe("@routr/pgdata/mappers/peer", () => { it("when the username is not alphanumeric or has spaces", () => { // Arrange const peer = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "peer-01", credentialsRef: "credentials-01", accessControlListRef: "acl-01", @@ -255,8 +255,8 @@ describe("@routr/pgdata/mappers/peer", () => { contactAddr: "192.168.1.12", maxContacts: -1, enabled: true, - createdAt: new Date().getTime() / 1000, - updatedAt: new Date().getTime() / 1000, + createdAt: new Date().getTime(), + updatedAt: new Date().getTime(), extended: { test: "test" } @@ -272,7 +272,7 @@ describe("@routr/pgdata/mappers/peer", () => { it("when the request is missing the aor", () => { // Arrange const peer = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "peer-01", credentialsRef: "credentials-01", accessControlListRef: "acl-01", @@ -282,8 +282,8 @@ describe("@routr/pgdata/mappers/peer", () => { contactAddr: "192.168.1.12", maxContacts: -1, enabled: true, - createdAt: new Date().getTime() / 1000, - updatedAt: new Date().getTime() / 1000, + createdAt: new Date().getTime(), + updatedAt: new Date().getTime(), extended: { test: "test" } @@ -299,7 +299,7 @@ describe("@routr/pgdata/mappers/peer", () => { it("when the aor doesn't start with backend: or sip:", () => { // Arrange const peer = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "peer-01", credentialsRef: "credentials-01", accessControlListRef: "acl-01", @@ -309,8 +309,8 @@ describe("@routr/pgdata/mappers/peer", () => { contactAddr: "192.168.1.12:5060", maxContacts: -1, enabled: true, - createdAt: new Date().getTime() / 1000, - updatedAt: new Date().getTime() / 1000, + createdAt: new Date().getTime(), + updatedAt: new Date().getTime(), extended: { test: "test" } diff --git a/mods/pgdata/test/trunk.mapper.unit.test.ts b/mods/pgdata/test/trunk.mapper.unit.test.ts index 8c6532ee3..662ab3a5a 100644 --- a/mods/pgdata/test/trunk.mapper.unit.test.ts +++ b/mods/pgdata/test/trunk.mapper.unit.test.ts @@ -18,7 +18,7 @@ */ import { TrunkManager } from "../src/mappers/trunk" import { CommonConnect as CC, CommonTypes as CT } from "@routr/common" -import { APIVersion, Prisma } from "@prisma/client" +import { Prisma } from "@prisma/client" import chai from "chai" import sinon from "sinon" import chaiExclude from "chai-exclude" @@ -35,7 +35,7 @@ describe("@routr/pgdata/mappers/trunk", () => { it("takes a dto object and converts it to prisma model", () => { // Arrange const trunk = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "trunk-01", name: "Global Trunk", accessControlListRef: "acl-01", @@ -43,8 +43,8 @@ describe("@routr/pgdata/mappers/trunk", () => { inboundCredentialsRef: "credentials-01", outboundCredentialsRef: "credentials-01", sendRegister: true, - createdAt: new Date().getTime() / 1000, - updatedAt: new Date().getTime() / 1000, + createdAt: new Date().getTime(), + updatedAt: new Date().getTime(), extended: { test: "test" } @@ -71,7 +71,7 @@ describe("@routr/pgdata/mappers/trunk", () => { }> const trunk: TrunkWithEagerLoading = { - apiVersion: "v2" as APIVersion, + apiVersion: CC.APIVersion.V2, ref: "trunk-01", name: "Global Trunk", accessControlListRef: "acl-01", @@ -85,7 +85,7 @@ describe("@routr/pgdata/mappers/trunk", () => { test: "test" }, accessControlList: { - apiVersion: "v2" as APIVersion, + apiVersion: CC.APIVersion.V2, ref: "acl-01", name: "Global ACL", allow: [""], @@ -97,7 +97,7 @@ describe("@routr/pgdata/mappers/trunk", () => { } }, inboundCredentials: { - apiVersion: "v2" as APIVersion, + apiVersion: CC.APIVersion.V2, ref: "credentials-01", name: "test", username: "trunk01", @@ -109,7 +109,7 @@ describe("@routr/pgdata/mappers/trunk", () => { } }, outboundCredentials: { - apiVersion: "v2" as APIVersion, + apiVersion: CC.APIVersion.V2, ref: "credentials-01", name: "test", username: "trunk01", @@ -148,7 +148,7 @@ describe("@routr/pgdata/mappers/trunk", () => { it("when the friendly name is not provided for trunk creation", () => { // Arrange const trunk: Omit = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "trunk-01", name: "", accessControlListRef: "acl-01", @@ -156,8 +156,8 @@ describe("@routr/pgdata/mappers/trunk", () => { inboundCredentialsRef: "credentials-01", outboundCredentialsRef: "credentials-01", sendRegister: true, - createdAt: new Date().getTime() / 1000, - updatedAt: new Date().getTime() / 1000, + createdAt: new Date().getTime(), + updatedAt: new Date().getTime(), extended: { test: "test" } @@ -175,7 +175,7 @@ describe("@routr/pgdata/mappers/trunk", () => { it("when the friendly name has more than 60 characters", () => { // Arrange const trunk: Omit = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "trunk-01", name: "a".repeat(65), accessControlListRef: "acl-01", @@ -183,8 +183,8 @@ describe("@routr/pgdata/mappers/trunk", () => { inboundCredentialsRef: "credentials-01", outboundCredentialsRef: "credentials-01", sendRegister: true, - createdAt: new Date().getTime() / 1000, - updatedAt: new Date().getTime() / 1000, + createdAt: new Date().getTime(), + updatedAt: new Date().getTime(), extended: { test: "test" } @@ -206,7 +206,7 @@ describe("@routr/pgdata/mappers/trunk", () => { it("when the reference is not provided for an update operation", () => { // Arrange const trunk: Omit = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "", name: "Global Trunk", accessControlListRef: "acl-01", @@ -214,8 +214,8 @@ describe("@routr/pgdata/mappers/trunk", () => { inboundCredentialsRef: "credentials-01", outboundCredentialsRef: "credentials-01", sendRegister: true, - createdAt: new Date().getTime() / 1000, - updatedAt: new Date().getTime() / 1000, + createdAt: new Date().getTime(), + updatedAt: new Date().getTime(), extended: { test: "test" } @@ -232,7 +232,7 @@ describe("@routr/pgdata/mappers/trunk", () => { it("when the request is missing the inboundUri", () => { // Arrange const trunk: CC.Trunk = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "trunk-01", name: "Global Trunk", accessControlListRef: "acl-01", @@ -240,8 +240,8 @@ describe("@routr/pgdata/mappers/trunk", () => { inboundCredentialsRef: "credentials-01", outboundCredentialsRef: "credentials-01", sendRegister: true, - createdAt: new Date().getTime() / 1000, - updatedAt: new Date().getTime() / 1000, + createdAt: new Date().getTime(), + updatedAt: new Date().getTime(), extended: { test: "test" } @@ -257,7 +257,7 @@ describe("@routr/pgdata/mappers/trunk", () => { it("when inboundUri is not a FQDN", () => { // Arrange const trunk: Omit = { - apiVersion: "v2", + apiVersion: CC.APIVersion.V2, ref: "trunk-01", name: "Global Trunk", accessControlListRef: "acl-01", @@ -265,8 +265,8 @@ describe("@routr/pgdata/mappers/trunk", () => { inboundCredentialsRef: "credentials-01", outboundCredentialsRef: "credentials-01", sendRegister: true, - createdAt: new Date().getTime() / 1000, - updatedAt: new Date().getTime() / 1000, + createdAt: new Date().getTime(), + updatedAt: new Date().getTime(), extended: { test: "test" } diff --git a/mods/processor/.lerna-changed-buster-27550 b/mods/processor/.lerna-changed-buster-8289 similarity index 100% rename from mods/processor/.lerna-changed-buster-27550 rename to mods/processor/.lerna-changed-buster-8289 diff --git a/mods/processor/package.json b/mods/processor/package.json index afd15411c..77a78b193 100644 --- a/mods/processor/package.json +++ b/mods/processor/package.json @@ -1,6 +1,6 @@ { "name": "@routr/processor", - "version": "2.12.1", + "version": "2.13.4", "description": "Processor server and API", "author": "Pedro Sanders ", "homepage": "https://github.com/fonoster/routr#readme", @@ -23,7 +23,7 @@ "@opentelemetry/sdk-trace-base": "^1.0.4", "@opentelemetry/sdk-trace-node": "^1.0.4", "@opentelemetry/semantic-conventions": "^1.0.4", - "@routr/common": "^2.12.1", + "@routr/common": "^2.13.4", "fp-ts": "^2.11.8", "phone": "^3.1.32" }, diff --git a/mods/processor/src/alterations.ts b/mods/processor/src/alterations.ts index 69e34bcdc..60a072145 100644 --- a/mods/processor/src/alterations.ts +++ b/mods/processor/src/alterations.ts @@ -146,7 +146,7 @@ export const applyXHeaders = (route: Route) => (request: MessageRequest): MessageRequest => { const req = H.deepCopy(request) - if (route.headers && route.headers.length > 0) { + if (route.headers?.length > 0) { const headersToRemove = route.headers .filter( (h: HeaderModifier) => diff --git a/mods/registry/.lerna-changed-buster-27550 b/mods/registry/.lerna-changed-buster-8289 similarity index 100% rename from mods/registry/.lerna-changed-buster-27550 rename to mods/registry/.lerna-changed-buster-8289 diff --git a/mods/registry/package.json b/mods/registry/package.json index a6484ee87..e0f2abea7 100644 --- a/mods/registry/package.json +++ b/mods/registry/package.json @@ -1,6 +1,6 @@ { "name": "@routr/registry", - "version": "2.12.1", + "version": "2.13.4", "description": "Sends trunks registrations and maintains their bindings", "author": "Pedro Sanders ", "homepage": "https://github.com/fonoster/routr#readme", @@ -35,8 +35,8 @@ "@opentelemetry/sdk-trace-base": "^1.0.4", "@opentelemetry/sdk-trace-node": "^1.0.4", "@opentelemetry/semantic-conventions": "^1.0.4", - "@routr/common": "^2.12.1", - "@routr/processor": "^2.12.1", + "@routr/common": "^2.13.4", + "@routr/processor": "^2.13.4", "ajv": "^6.12.6", "express": "^4.18.2", "fp-ts": "^2.11.8", diff --git a/mods/requester/.lerna-changed-buster-27550 b/mods/requester/.lerna-changed-buster-8289 similarity index 100% rename from mods/requester/.lerna-changed-buster-27550 rename to mods/requester/.lerna-changed-buster-8289 diff --git a/mods/requester/package.json b/mods/requester/package.json index 64b926f39..de453df10 100644 --- a/mods/requester/package.json +++ b/mods/requester/package.json @@ -1,6 +1,6 @@ { "name": "@routr/requester", - "version": "2.12.1", + "version": "2.13.4", "description": "SIP requests as an API", "author": "Pedro Sanders ", "homepage": "https://github.com/fonoster/routr#readme", diff --git a/mods/rtprelay/.lerna-changed-buster-27550 b/mods/rtprelay/.lerna-changed-buster-8289 similarity index 100% rename from mods/rtprelay/.lerna-changed-buster-27550 rename to mods/rtprelay/.lerna-changed-buster-8289 diff --git a/mods/rtprelay/package.json b/mods/rtprelay/package.json index 5204d8994..ea000368c 100644 --- a/mods/rtprelay/package.json +++ b/mods/rtprelay/package.json @@ -1,6 +1,6 @@ { "name": "@routr/rtprelay", - "version": "2.12.1", + "version": "2.13.4", "description": "Media Relay for Routr using RTPengine", "author": "Pedro Sanders ", "homepage": "https://github.com/fonoster/routr#readme", @@ -29,8 +29,8 @@ "@opentelemetry/sdk-trace-base": "^1.0.4", "@opentelemetry/sdk-trace-node": "^1.0.4", "@opentelemetry/semantic-conventions": "^1.0.4", - "@routr/common": "^2.12.1", - "@routr/processor": "^2.12.1", + "@routr/common": "^2.13.4", + "@routr/processor": "^2.13.4", "rtpengine-client": "^0.4.11" }, "files": [ diff --git a/mods/sdk/.intro.md b/mods/sdk/.intro.md index f2499d67a..dd6d1c93d 100644 --- a/mods/sdk/.intro.md +++ b/mods/sdk/.intro.md @@ -20,7 +20,7 @@ $ npm install --save @routr/sdk # APIs -* [`Access Control List`](#acl--apiclient) +* [`Acls`](#acl--apiclient) * [`Agents`](#agents--apiclient) * [`Credentials`](#credentials--apiclient) * [`Domains`](#domains--apiclient) diff --git a/mods/sdk/.lerna-changed-buster-27550 b/mods/sdk/.lerna-changed-buster-8289 similarity index 100% rename from mods/sdk/.lerna-changed-buster-27550 rename to mods/sdk/.lerna-changed-buster-8289 diff --git a/mods/sdk/README.md b/mods/sdk/README.md index ad5084ff2..69ce47e10 100644 --- a/mods/sdk/README.md +++ b/mods/sdk/README.md @@ -20,7 +20,7 @@ $ npm install --save @routr/sdk # APIs -* [`Access Control List`](#acl--apiclient) +* [`Acls`](#acl--apiclient) * [`Agents`](#agents--apiclient) * [`Credentials`](#credentials--apiclient) * [`Domains`](#domains--apiclient) @@ -29,9 +29,9 @@ $ npm install --save @routr/sdk * [`Trunks`](#trunks--apiclient) - + -## ACL ⇐ APIClient +## Acls ⇐ APIClient Use Routr ACL, a capability of Routr SIP Proxy, to create, update, get and delete Access Control Lists. The ACL API requires of a running Routr deployment. @@ -39,18 +39,18 @@ and delete Access Control Lists. The ACL API requires of a running Routr deploym **Extends**: APIClient **See**: module:core:APIClient -* [ACL](#ACL) ⇐ APIClient - * [new ACL(options)](#new_ACL_new) - * [.createACL(request)](#ACL+createACL) ⇒ Promise.<CreateACLResponse> - * [.updateACL(request)](#ACL+updateACL) ⇒ Promise.<UpdateACLResponse> - * [.getACL(ref)](#ACL+getACL) ⇒ Promise.<GetACLResponse> - * [.deleteACL(ref)](#ACL+deleteACL) ⇒ Promise.<void> - * [.listACLs(request)](#ACL+listACLs) ⇒ Promise.<ListACLResponse> +* [Acls](#Acls) ⇐ APIClient + * [new Acls(options)](#new_Acls_new) + * [.createAcl(request)](#Acls+createAcl) ⇒ Promise.<CreateAclResponse> + * [.updateAcl(request)](#Acls+updateAcl) ⇒ Promise.<UpdateAclResponse> + * [.getAcl(ref)](#Acls+getAcl) ⇒ Promise.<GetAclResponse> + * [.deleteAcl(ref)](#Acls+deleteAcl) ⇒ Promise.<void> + * [.listAcls(request)](#Acls+listAcls) ⇒ Promise.<ListAclResponse> - + -### new ACL(options) -Constructs a new ACL API object. +### new Acls(options) +Constructs a new API object. | Param | Type | Description | @@ -60,7 +60,7 @@ Constructs a new ACL API object. **Example** ```js const SDK = require("@routr/sdk") -const acl = new SDK.ACL() +const acl = new SDK.Acls() const request = { name: "Peer network", @@ -68,17 +68,17 @@ const request = { deny: "0.0.0.0/0" } -acl.createACL(request) +acl.createAcl(request) .then(console.log) .catch(console.error) // an error occurred ``` - + -### acL.createACL(request) ⇒ Promise.<CreateACLResponse> +### acls.createAcl(request) ⇒ Promise.<CreateAclResponse> Creates a new AccessControlList on Routr. -**Kind**: instance method of [ACL](#ACL) -**Returns**: Promise.<CreateACLResponse> - The newly created AccessControlList +**Kind**: instance method of [Acls](#Acls) +**Returns**: Promise.<CreateAclResponse> - The newly created AccessControlList **Throws**: - if request is null @@ -86,7 +86,7 @@ Creates a new AccessControlList on Routr. | Param | Type | Description | | --- | --- | --- | -| request | CreateACLRequest | The request to create an ACL | +| request | CreateAclRequest | The request to create an ACL | | request.name | string | Name of the ACL | | request.allow | Array.<string> | List of IP addresses or CIDR blocks to allow | | request.deny | Array.<string> | List of IP addresses or CIDR blocks to deny | @@ -100,21 +100,21 @@ const request = { deny: "0.0.0.0/0" } -acl.createACL(request) +acl.createAcl(request) .then(console.log) .catch(console.error) // an error occurred ``` - + -### acL.updateACL(request) ⇒ Promise.<UpdateACLResponse> +### acls.updateAcl(request) ⇒ Promise.<UpdateAclResponse> Updates an already existing AccessControlList on Routr. -**Kind**: instance method of [ACL](#ACL) -**Returns**: Promise.<UpdateACLResponse> - The AccessControlList +**Kind**: instance method of [Acls](#Acls) +**Returns**: Promise.<UpdateAclResponse> - The AccessControlList | Param | Type | Description | | --- | --- | --- | -| request | UpdateACLRequest | Partial with the fields to update | +| request | UpdateAclRequest | Partial with the fields to update | | request.name | string | Name of the ACL | | request.allow | Array.<string> | List of IP addresses or CIDR blocks to allow | | request.deny | Array.<string> | List of IP addresses or CIDR blocks to deny | @@ -127,17 +127,17 @@ const request = { name: "Peer network updated", } -acl.updateACL(request) +acl.updateAcl(request) .then(console.log) .catch(console.error) // an error occurred ``` - + -### acL.getACL(ref) ⇒ Promise.<GetACLResponse> +### acls.getAcl(ref) ⇒ Promise.<GetAclResponse> Gets an AccessControlList from Routr. -**Kind**: instance method of [ACL](#ACL) -**Returns**: Promise.<GetACLResponse> - The AccessControlList +**Kind**: instance method of [Acls](#Acls) +**Returns**: Promise.<GetAclResponse> - The AccessControlList | Param | Type | Description | | --- | --- | --- | @@ -147,16 +147,16 @@ Gets an AccessControlList from Routr. ```js const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3" -acl.getACL(ref) +acl.getAcl(ref) .then(console.log) .catch(console.error) // an error occurred ``` - + -### acL.deleteACL(ref) ⇒ Promise.<void> +### acls.deleteAcl(ref) ⇒ Promise.<void> Deletes an AccessControlList from Routr. -**Kind**: instance method of [ACL](#ACL) +**Kind**: instance method of [Acls](#Acls) | Param | Type | Description | | --- | --- | --- | @@ -166,21 +166,21 @@ Deletes an AccessControlList from Routr. ```js const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3" -acl.deleteACL(ref) +acl.deleteAcl(ref) .then(console.log) .catch(console.error) // an error occurred ``` - + -### acL.listACLs(request) ⇒ Promise.<ListACLResponse> +### acls.listAcls(request) ⇒ Promise.<ListAclResponse> Lists all AccessControlLists from Routr with pagination. -**Kind**: instance method of [ACL](#ACL) -**Returns**: Promise.<ListACLResponse> - The list of AccessControlLists +**Kind**: instance method of [Acls](#Acls) +**Returns**: Promise.<ListAclResponse> - The list of AccessControlLists | Param | Type | Description | | --- | --- | --- | -| request | ListACLRequest | The request to list ACLs | +| request | ListAclRequest | The request to list ACLs | | request.pageSize | number | The number of ACLs to return | | request.pageToken | string | The page token to use for pagination | @@ -190,7 +190,7 @@ const request = { pageSize: 10 } -acl.listACLs(request) +acl.listAcls(request) .then(console.log) .catch(console.error) // an error occurred ``` @@ -808,7 +808,7 @@ Creates a new Number on Routr. | request.city | string | The city where the number is located | | request.country | string | The country where the number is located | | request.countryIsoCode | string | The country ISO code where the number is located | -| request.extraHeaders | Array.<JsonObject> | Extra headers to be used (e.g., [\{name: "X-Room-Id", value: "abc-us-123"\}]) | +| | Array.<{name: string, value: string}> | Extra headers to be used (e.g., [\{name: "X-Room-Id", value: "abc-us-123"\}]) | | request.trunkRef | string | The Trunk reference to be used | | request.sessionAffinityHeader | string | Optional session affinity header | | request.extended | string | Optional extended attributes | @@ -850,7 +850,7 @@ Updates an already existing Number on Routr. | request | UpdateNumberRequest | Partial with the fields to update | | request.name | string | Name of the Number | | request.aorLink | string | The AOR link to be used (e.g., sip:1001@sip.local) | -| request.extraHeaders | Array.<JsonObject> | Extra headers to be used (e.g., [\{name: "X-Room-Id", value: "abc-us-123"\}]) | +| request.extraHeaders | Array.<{name: string, value: string}> | Extra headers to be used (e.g., [\{name: "X-Room-Id", value: "abc-us-123"\}]) | | request.trunkRef | string | The Trunk reference to be used | | request.sessionAffinityHeader | string | Optional session affinity header | | request.extended | string | Optional extended attributes | diff --git a/mods/sdk/package.json b/mods/sdk/package.json index f1300661f..080cc2fb7 100644 --- a/mods/sdk/package.json +++ b/mods/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@routr/sdk", - "version": "2.12.1", + "version": "2.13.4", "description": "The Routr SDK for Node.js", "author": "Pedro Sanders ", "homepage": "https://github.com/fonoster/routr#readme", @@ -27,7 +27,7 @@ "@opentelemetry/sdk-trace-base": "^1.0.4", "@opentelemetry/sdk-trace-node": "^1.0.4", "@opentelemetry/semantic-conventions": "^1.0.4", - "@routr/common": "^2.12.1", + "@routr/common": "^2.13.4", "google-protobuf": "^3.9.2", "pb-util": "^1.0.3" }, diff --git a/mods/sdk/src/acl/acl.ts b/mods/sdk/src/acls/acl.ts similarity index 75% rename from mods/sdk/src/acl/acl.ts rename to mods/sdk/src/acls/acl.ts index 6e025365c..88f62164f 100644 --- a/mods/sdk/src/acl/acl.ts +++ b/mods/sdk/src/acls/acl.ts @@ -19,13 +19,13 @@ import { APIClient } from "../client" import { ClientOptions } from "../types" import { - CreateACLRequest, - CreateACLResponse, - GetACLResponse, - ListACLRequest, - ListACLResponse, - UpdateACLRequest, - UpdateACLResponse + CreateAclRequest, + CreateAclResponse, + GetAclResponse, + ListAclRequest, + ListAclResponse, + UpdateAclRequest, + UpdateAclResponse } from "./types" /** @@ -36,7 +36,7 @@ import { * @example * * const SDK = require("@routr/sdk") - * const acl = new SDK.ACL() + * const acl = new SDK.Acls() * * const request = { * name: "Peer network", @@ -44,13 +44,13 @@ import { * deny: "0.0.0.0/0" * } * - * acl.createACL(request) + * acl.createAcl(request) * .then(console.log) * .catch(console.error) // an error occurred */ -export class ACL extends APIClient { +export class Acls extends APIClient { /** - * Constructs a new ACL API object. + * Constructs a new API object. * * @param {ClientOptions} options - Options to indicate the objects endpoint * @see module:core:APIClient @@ -62,12 +62,12 @@ export class ACL extends APIClient { /** * Creates a new AccessControlList on Routr. * - * @param {CreateACLRequest} request - The request to create an ACL + * @param {CreateAclRequest} request - The request to create an ACL * @param {string} request.name - Name of the ACL * @param {string[]} request.allow - List of IP addresses or CIDR blocks to allow * @param {string[]} request.deny - List of IP addresses or CIDR blocks to deny * @param {Object} request.extended - Optional extended attributes - * @return {Promise} The newly created AccessControlList + * @return {Promise} The newly created AccessControlList * @throws if request is null * @example * @@ -77,23 +77,23 @@ export class ACL extends APIClient { * deny: "0.0.0.0/0" * } * - * acl.createACL(request) + * acl.createAcl(request) * .then(console.log) * .catch(console.error) // an error occurred */ - async createACL(request: CreateACLRequest): Promise { - return this.client.acl.create(request) + async createAcl(request: CreateAclRequest): Promise { + return await this.client.acl.create(request) } /** * Updates an already existing AccessControlList on Routr. * - * @param {UpdateACLRequest} request - Partial with the fields to update + * @param {UpdateAclRequest} request - Partial with the fields to update * @param {string} request.name - Name of the ACL * @param {string[]} request.allow - List of IP addresses or CIDR blocks to allow * @param {string[]} request.deny - List of IP addresses or CIDR blocks to deny * @param {Object} request.extended - Optional extended attributes - * @return {Promise} The AccessControlList + * @return {Promise} The AccessControlList * @example * * const request = { @@ -101,11 +101,11 @@ export class ACL extends APIClient { * name: "Peer network updated", * } * - * acl.updateACL(request) + * acl.updateAcl(request) * .then(console.log) * .catch(console.error) // an error occurred */ - async updateACL(request: UpdateACLRequest): Promise { + async updateAcl(request: UpdateAclRequest): Promise { return this.client.acl.update(request) } @@ -113,17 +113,17 @@ export class ACL extends APIClient { * Gets an AccessControlList from Routr. * * @param {string} ref - The ACL reference - * @return {Promise} The AccessControlList + * @return {Promise} The AccessControlList * @example * * const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3" * - * acl.getACL(ref) + * acl.getAcl(ref) * .then(console.log) * .catch(console.error) // an error occurred */ - async getACL(ref: string): Promise { - return this.client.acl.get(ref) + async getAcl(ref: string): Promise { + return await this.client.acl.get(ref) } /** @@ -135,32 +135,32 @@ export class ACL extends APIClient { * * const ref = "4671371b-ff5d-48b1-aabe-d3c5ca5317a3" * - * acl.deleteACL(ref) + * acl.deleteAcl(ref) * .then(console.log) * .catch(console.error) // an error occurred */ - async deleteACL(ref: string): Promise { + async deleteAcl(ref: string): Promise { return this.client.acl.del(ref) } /** * Lists all AccessControlLists from Routr with pagination. * - * @param {ListACLRequest} request - The request to list ACLs + * @param {ListAclRequest} request - The request to list ACLs * @param {number} request.pageSize - The number of ACLs to return * @param {string} request.pageToken - The page token to use for pagination - * @return {Promise} The list of AccessControlLists + * @return {Promise} The list of AccessControlLists * @example * * const request = { * pageSize: 10 * } * - * acl.listACLs(request) + * acl.listAcls(request) * .then(console.log) * .catch(console.error) // an error occurred */ - async listACLs(request: ListACLRequest): Promise { + async listAcls(request: ListAclRequest): Promise { return this.client.acl.list(request) } } diff --git a/mods/sdk/src/acl/index.ts b/mods/sdk/src/acls/index.ts similarity index 94% rename from mods/sdk/src/acl/index.ts rename to mods/sdk/src/acls/index.ts index b670f4a54..e96aca38b 100644 --- a/mods/sdk/src/acl/index.ts +++ b/mods/sdk/src/acls/index.ts @@ -17,4 +17,4 @@ * limitations under the License. */ export * from "./acl" -export { ACL as default } from "./acl" +export { Acls as default } from "./acl" diff --git a/mods/sdk/src/acl/types.ts b/mods/sdk/src/acls/types.ts similarity index 58% rename from mods/sdk/src/acl/types.ts rename to mods/sdk/src/acls/types.ts index 8b30aac26..08c0a547d 100644 --- a/mods/sdk/src/acl/types.ts +++ b/mods/sdk/src/acls/types.ts @@ -17,18 +17,20 @@ * limitations under the License. */ import { CommonConnect as CC } from "@routr/common" -import { CreateBaseOmit } from "../types" +import { CreateBaseOmit, Flatten } from "../types" -export type CreateACLRequest = Omit +export type CreateAclRequest = Omit -export type CreateACLResponse = CC.AccessControlList +export type CreateAclResponse = Flatten -export type UpdateACLRequest = { ref: string } & Partial +export type UpdateAclRequest = Flatten< + { ref: string } & Partial +> -export type UpdateACLResponse = CC.AccessControlList +export type UpdateAclResponse = Flatten -export type ListACLRequest = CC.ListRequest +export type ListAclRequest = Flatten -export type ListACLResponse = CC.ListResponse +export type ListAclResponse = Flatten> -export type GetACLResponse = CC.AccessControlList +export type GetAclResponse = Flatten diff --git a/mods/sdk/src/index.ts b/mods/sdk/src/index.ts index 9584a621a..78b0101e4 100644 --- a/mods/sdk/src/index.ts +++ b/mods/sdk/src/index.ts @@ -16,7 +16,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -import ACL from "./acl" +import Acls from "./acls" import Agents from "./agents" import Domains from "./domains" import Credentials from "./credentials" @@ -25,7 +25,7 @@ import Numbers from "./numbers" import Trunks from "./trunks" const SDK = { - ACL, + Acls, Agents, Domains, Numbers, diff --git a/mods/sdk/src/numbers/numbers.ts b/mods/sdk/src/numbers/numbers.ts index f2e5b8976..86fc801e6 100644 --- a/mods/sdk/src/numbers/numbers.ts +++ b/mods/sdk/src/numbers/numbers.ts @@ -81,7 +81,7 @@ export class Numbers extends APIClient { * @param {string} request.city - The city where the number is located * @param {string} request.country - The country where the number is located * @param {string} request.countryIsoCode - The country ISO code where the number is located - * @param {JsonObject[]} request.extraHeaders - Extra headers to be used (e.g., [\{name: "X-Room-Id", value: "abc-us-123"\}]) + * @param {Array<{name: string, value: string}>} - Extra headers to be used (e.g., [\{name: "X-Room-Id", value: "abc-us-123"\}]) * @param {string} request.trunkRef - The Trunk reference to be used * @param {string} request.sessionAffinityHeader - Optional session affinity header * @param {string} request.extended - Optional extended attributes @@ -123,7 +123,7 @@ export class Numbers extends APIClient { * @param {UpdateNumberRequest} request - Partial with the fields to update * @param {string} request.name - Name of the Number * @param {string} request.aorLink - The AOR link to be used (e.g., sip:1001@sip.local) - * @param {JsonObject[]} request.extraHeaders - Extra headers to be used (e.g., [\{name: "X-Room-Id", value: "abc-us-123"\}]) + * @param {Array<{name: string, value: string}>} request.extraHeaders - Extra headers to be used (e.g., [\{name: "X-Room-Id", value: "abc-us-123"\}]) * @param {string} request.trunkRef - The Trunk reference to be used * @param {string} request.sessionAffinityHeader - Optional session affinity header * @param {string} request.extended - Optional extended attributes diff --git a/mods/sdk/src/trunks/types.ts b/mods/sdk/src/trunks/types.ts index e3b770748..41e2575c1 100644 --- a/mods/sdk/src/trunks/types.ts +++ b/mods/sdk/src/trunks/types.ts @@ -17,7 +17,7 @@ * limitations under the License. */ import { CommonConnect as CC } from "@routr/common" -import { CreateBaseOmit } from "../types" +import { CreateBaseOmit, Flatten } from "../types" export type CreateTrunkRequest = Omit< CC.Trunk, @@ -27,14 +27,16 @@ export type CreateTrunkRequest = Omit< | "outboundCredentials" > -export type CreateTrunkResponse = CC.Trunk +export type CreateTrunkResponse = Flatten -export type UpdateTrunkRequest = { ref: string } & Partial +export type UpdateTrunkRequest = Flatten< + { ref: string } & Partial +> -export type UpdateTrunkResponse = CC.Trunk +export type UpdateTrunkResponse = Flatten -export type ListTrunkRequest = CC.ListRequest +export type ListTrunkRequest = Flatten -export type ListTrunkResponse = CC.ListResponse +export type ListTrunkResponse = Flatten> -export type GetTrunkResponse = CC.Trunk +export type GetTrunkResponse = Flatten diff --git a/mods/sdk/src/types.ts b/mods/sdk/src/types.ts index 70e06edea..42660310b 100644 --- a/mods/sdk/src/types.ts +++ b/mods/sdk/src/types.ts @@ -24,5 +24,7 @@ export interface ClientOptions { cacert?: string } +export type Flatten = { [K in keyof T]: T[K] } + // The base type to omit from BaseConnectModel export type CreateBaseOmit = "ref" | "apiVersion" | "createdAt" | "updatedAt" diff --git a/mods/simpleauth/.lerna-changed-buster-27550 b/mods/simpleauth/.lerna-changed-buster-8289 similarity index 100% rename from mods/simpleauth/.lerna-changed-buster-27550 rename to mods/simpleauth/.lerna-changed-buster-8289 diff --git a/mods/simpleauth/package.json b/mods/simpleauth/package.json index 14564ec70..391d4cebc 100644 --- a/mods/simpleauth/package.json +++ b/mods/simpleauth/package.json @@ -1,6 +1,6 @@ { "name": "@routr/simpleauth", - "version": "2.12.1", + "version": "2.13.4", "description": "This middleware delegates authentication to an external service", "author": "Pedro Sanders ", "homepage": "https://github.com/fonoster/routr#readme", @@ -29,8 +29,8 @@ "@opentelemetry/sdk-trace-base": "^1.0.4", "@opentelemetry/sdk-trace-node": "^1.0.4", "@opentelemetry/semantic-conventions": "^1.0.4", - "@routr/common": "^2.12.1", - "@routr/processor": "^2.12.1", + "@routr/common": "^2.13.4", + "@routr/processor": "^2.13.4", "google-protobuf": "^3.9.2" }, "files": [ diff --git a/mods/simpledata/.lerna-changed-buster-27550 b/mods/simpledata/.lerna-changed-buster-8289 similarity index 100% rename from mods/simpledata/.lerna-changed-buster-27550 rename to mods/simpledata/.lerna-changed-buster-8289 diff --git a/mods/simpledata/package.json b/mods/simpledata/package.json index 5b9193ab3..ea6551eda 100644 --- a/mods/simpledata/package.json +++ b/mods/simpledata/package.json @@ -1,6 +1,6 @@ { "name": "@routr/simpledata", - "version": "2.12.1", + "version": "2.13.4", "description": "Files-based API Server for Routr Connect", "author": "Pedro Sanders ", "homepage": "https://github.com/fonoster/routr#readme", @@ -30,8 +30,8 @@ "@opentelemetry/sdk-trace-base": "^1.0.4", "@opentelemetry/sdk-trace-node": "^1.0.4", "@opentelemetry/semantic-conventions": "^1.0.4", - "@routr/common": "^2.12.1", - "@routr/processor": "^2.12.1", + "@routr/common": "^2.13.4", + "@routr/processor": "^2.13.4", "google-protobuf": "^3.9.2", "jsonpath": "^1.1.1", "pb-util": "^1.0.3" diff --git a/mods/simpledata/test/examples.ts b/mods/simpledata/test/examples.ts index 784a4157b..92b626cc6 100644 --- a/mods/simpledata/test/examples.ts +++ b/mods/simpledata/test/examples.ts @@ -20,17 +20,21 @@ import { CommonConnect as CC } from "@routr/common" export const configs: CC.ConnectModel[] = [ { - apiVersion: "v2beta1", + apiVersion: CC.APIVersion.V2BETA1, ref: "credentials-01", name: "my-secret-credential", username: "myusername", - password: "password" + password: "password", + createdAt: new Date().getTime() / 1000, + updatedAt: new Date().getTime() / 1000 }, { - apiVersion: "v2beta1", + apiVersion: CC.APIVersion.V2BETA1, ref: "acl2c77f4", name: "Europe ACL", deny: ["0.0.0.0/1"], - allow: ["192.168.0.1/31"] + allow: ["192.168.0.1/31"], + createdAt: new Date().getTime() / 1000, + updatedAt: new Date().getTime() / 1000 } ] diff --git a/package-lock.json b/package-lock.json index 8fbded86d..e76236009 100644 --- a/package-lock.json +++ b/package-lock.json @@ -59,7 +59,7 @@ }, "mods/common": { "name": "@routr/common", - "version": "2.12.1", + "version": "2.13.4", "license": "MIT", "dependencies": { "@fonoster/common": "0.6.0", @@ -109,7 +109,7 @@ }, "mods/connect": { "name": "@routr/connect", - "version": "2.12.1", + "version": "2.13.4", "license": "MIT", "dependencies": { "@fonoster/logger": "0.6.0", @@ -121,9 +121,9 @@ "@opentelemetry/sdk-trace-base": "^1.0.4", "@opentelemetry/sdk-trace-node": "^1.0.4", "@opentelemetry/semantic-conventions": "^1.0.4", - "@routr/common": "^2.12.1", - "@routr/location": "^2.12.1", - "@routr/processor": "^2.12.1", + "@routr/common": "^2.13.4", + "@routr/location": "^2.13.4", + "@routr/processor": "^2.13.4", "jsonwebtoken": "^9.0.0" }, "bin": { @@ -135,7 +135,7 @@ }, "mods/ctl": { "name": "@routr/ctl", - "version": "2.12.1", + "version": "2.13.4", "license": "MIT", "dependencies": { "@oclif/core": "^1.24.0", @@ -143,8 +143,8 @@ "@oclif/plugin-help": "^5", "@oclif/plugin-plugins": "^2.1.12", "@oclif/plugin-warn-if-update-available": "^2.0.19", - "@routr/common": "^2.12.1", - "@routr/sdk": "^2.12.1", + "@routr/common": "^2.13.4", + "@routr/sdk": "^2.13.4", "figlet": "^1.5.2", "fuzzy-search": "^3.2.1", "inquirer": "^8.2.6", @@ -179,7 +179,7 @@ }, "mods/dispatcher": { "name": "@routr/dispatcher", - "version": "2.12.1", + "version": "2.13.4", "license": "MIT", "dependencies": { "@fonoster/logger": "0.6.0", @@ -192,8 +192,8 @@ "@opentelemetry/sdk-trace-base": "^1.0.4", "@opentelemetry/sdk-trace-node": "^1.0.4", "@opentelemetry/semantic-conventions": "^1.0.4", - "@routr/common": "^2.12.1", - "@routr/processor": "^2.12.1", + "@routr/common": "^2.13.4", + "@routr/processor": "^2.13.4", "ajv": "^6.12.6", "fp-ts": "^2.11.8" }, @@ -222,7 +222,7 @@ }, "mods/echo": { "name": "@routr/echo", - "version": "2.12.1", + "version": "2.13.4", "license": "MIT", "dependencies": { "@fonoster/logger": "0.6.0", @@ -234,8 +234,8 @@ "@opentelemetry/sdk-trace-base": "^1.0.4", "@opentelemetry/sdk-trace-node": "^1.0.4", "@opentelemetry/semantic-conventions": "^1.0.4", - "@routr/common": "^2.12.1", - "@routr/processor": "^2.12.1" + "@routr/common": "^2.13.4", + "@routr/processor": "^2.13.4" }, "bin": { "run_echo": "dist/runner.js" @@ -243,10 +243,10 @@ }, "mods/edgeport": { "name": "@routr/edgeport", - "version": "2.12.1", + "version": "2.13.4", "license": "MIT", "dependencies": { - "@routr/common": "^2.12.1", + "@routr/common": "^2.13.4", "ajv": "^6.12.6", "fp-ts": "^2.11.8", "js-yaml": "^4.1.0", @@ -274,7 +274,7 @@ }, "mods/location": { "name": "@routr/location", - "version": "2.12.1", + "version": "2.13.4", "license": "MIT", "dependencies": { "@fonoster/logger": "0.6.0", @@ -287,8 +287,8 @@ "@opentelemetry/sdk-trace-base": "^1.0.4", "@opentelemetry/sdk-trace-node": "^1.0.4", "@opentelemetry/semantic-conventions": "^1.0.4", - "@routr/common": "^2.12.1", - "@routr/processor": "^2.12.1", + "@routr/common": "^2.13.4", + "@routr/processor": "^2.13.4", "ajv": "^6.12.6", "fp-ts": "^2.11.8", "redis": "^4.0.4" @@ -318,16 +318,16 @@ }, "mods/one": { "name": "@routr/one", - "version": "2.12.1", + "version": "2.13.4", "license": "MIT", "dependencies": { "@fonoster/logger": "0.6.0", - "@routr/common": "^2.12.1", - "@routr/connect": "^2.12.1", - "@routr/dispatcher": "^2.12.1", - "@routr/location": "^2.12.1", - "@routr/pgdata": "^2.12.1", - "@routr/rtprelay": "^2.12.1" + "@routr/common": "^2.13.4", + "@routr/connect": "^2.13.4", + "@routr/dispatcher": "^2.13.4", + "@routr/location": "^2.13.4", + "@routr/pgdata": "^2.13.4", + "@routr/rtprelay": "^2.13.4" }, "bin": { "run_echo": "dist/runner.js" @@ -335,7 +335,7 @@ }, "mods/pgdata": { "name": "@routr/pgdata", - "version": "2.12.1", + "version": "2.13.4", "license": "MIT", "dependencies": { "@fonoster/common": "0.6.0", @@ -350,8 +350,8 @@ "@opentelemetry/sdk-trace-node": "^1.0.4", "@opentelemetry/semantic-conventions": "^1.0.4", "@prisma/client": "^5.9.1", - "@routr/common": "^2.12.1", - "@routr/processor": "^2.12.1", + "@routr/common": "^2.13.4", + "@routr/processor": "^2.13.4", "google-protobuf": "^3.9.2", "grpc-health-check": "^2.0.2", "pb-util": "^1.0.3", @@ -370,7 +370,7 @@ }, "mods/processor": { "name": "@routr/processor", - "version": "2.12.1", + "version": "2.13.4", "license": "MIT", "dependencies": { "@fonoster/logger": "0.6.0", @@ -384,14 +384,14 @@ "@opentelemetry/sdk-trace-base": "^1.0.4", "@opentelemetry/sdk-trace-node": "^1.0.4", "@opentelemetry/semantic-conventions": "^1.0.4", - "@routr/common": "^2.12.1", + "@routr/common": "^2.13.4", "fp-ts": "^2.11.8", "phone": "^3.1.32" } }, "mods/registry": { "name": "@routr/registry", - "version": "2.12.1", + "version": "2.13.4", "license": "MIT", "dependencies": { "@grpc/grpc-js": "~1.10.1", @@ -403,8 +403,8 @@ "@opentelemetry/sdk-trace-base": "^1.0.4", "@opentelemetry/sdk-trace-node": "^1.0.4", "@opentelemetry/semantic-conventions": "^1.0.4", - "@routr/common": "^2.12.1", - "@routr/processor": "^2.12.1", + "@routr/common": "^2.13.4", + "@routr/processor": "^2.13.4", "ajv": "^6.12.6", "express": "^4.18.2", "fp-ts": "^2.11.8", @@ -442,7 +442,7 @@ }, "mods/requester": { "name": "@routr/requester", - "version": "2.12.1", + "version": "2.13.4", "license": "MIT", "dependencies": { "fp-ts": "^2.11.8" @@ -450,7 +450,7 @@ }, "mods/rtprelay": { "name": "@routr/rtprelay", - "version": "2.12.1", + "version": "2.13.4", "license": "MIT", "dependencies": { "@fonoster/logger": "0.6.0", @@ -463,8 +463,8 @@ "@opentelemetry/sdk-trace-base": "^1.0.4", "@opentelemetry/sdk-trace-node": "^1.0.4", "@opentelemetry/semantic-conventions": "^1.0.4", - "@routr/common": "^2.12.1", - "@routr/processor": "^2.12.1", + "@routr/common": "^2.13.4", + "@routr/processor": "^2.13.4", "rtpengine-client": "^0.4.11" }, "bin": { @@ -473,7 +473,7 @@ }, "mods/sdk": { "name": "@routr/sdk", - "version": "2.12.1", + "version": "2.13.4", "license": "MIT", "dependencies": { "@fonoster/logger": "0.6.0", @@ -486,7 +486,7 @@ "@opentelemetry/sdk-trace-base": "^1.0.4", "@opentelemetry/sdk-trace-node": "^1.0.4", "@opentelemetry/semantic-conventions": "^1.0.4", - "@routr/common": "^2.12.1", + "@routr/common": "^2.13.4", "google-protobuf": "^3.9.2", "pb-util": "^1.0.3" }, @@ -496,7 +496,7 @@ }, "mods/simpleauth": { "name": "@routr/simpleauth", - "version": "2.12.1", + "version": "2.13.4", "license": "MIT", "dependencies": { "@fonoster/logger": "0.6.0", @@ -509,8 +509,8 @@ "@opentelemetry/sdk-trace-base": "^1.0.4", "@opentelemetry/sdk-trace-node": "^1.0.4", "@opentelemetry/semantic-conventions": "^1.0.4", - "@routr/common": "^2.12.1", - "@routr/processor": "^2.12.1", + "@routr/common": "^2.13.4", + "@routr/processor": "^2.13.4", "google-protobuf": "^3.9.2" }, "bin": { @@ -519,7 +519,7 @@ }, "mods/simpledata": { "name": "@routr/simpledata", - "version": "2.12.1", + "version": "2.13.4", "license": "MIT", "dependencies": { "@fonoster/logger": "0.6.0", @@ -532,8 +532,8 @@ "@opentelemetry/sdk-trace-base": "^1.0.4", "@opentelemetry/sdk-trace-node": "^1.0.4", "@opentelemetry/semantic-conventions": "^1.0.4", - "@routr/common": "^2.12.1", - "@routr/processor": "^2.12.1", + "@routr/common": "^2.13.4", + "@routr/processor": "^2.13.4", "google-protobuf": "^3.9.2", "jsonpath": "^1.1.1", "pb-util": "^1.0.3" diff --git a/package.json b/package.json index e0d2d1f7c..170879367 100644 --- a/package.json +++ b/package.json @@ -19,8 +19,8 @@ "start:requester": "cross-env NODE_ENV=dev LOGS_LEVEL=verbose ./mods/requester/requester.sh", "start:rtprelay": "cross-env NODE_ENV=dev LOGS_LEVEL=verbose nodemon mods/rtprelay/src/runner", "start:docs": "cd docs && npm start", - "start:deps": "docker-compose -f compose.dev.yaml up rtpengine redis postgres adminer -d", - "stop:deps": "docker-compose -f compose.dev.yaml down rtpengine redis postgres adminer", + "start:deps": "docker compose -f compose.dev.yaml up rtpengine redis postgres adminer -d", + "stop:deps": "docker compose -f compose.dev.yaml down rtpengine redis postgres adminer", "db:migrate": "npx prisma migrate dev --schema ./mods/pgdata/schema.prisma --name changeme", "generate:certs": "./.scripts/generate-certs.sh", "convert:certs": "./.scripts/convert-to-p12.sh && mv signaling.p12 etc/certs/",