Skip to content

Commit

Permalink
Merge branch 'main' into improve-gettextdescription
Browse files Browse the repository at this point in the history
  • Loading branch information
olivercsr committed Nov 6, 2024
2 parents a2f24bd + 9561dcd commit 10c9926
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 11 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sipgate/integration-bridge",
"version": "1.0.4",
"version": "1.0.9",
"description": "sipgate Integration Bridge Framework",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion src/models/adapter.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export interface Adapter {
createCallLogForPhoneNumber?: (
config: Config,
body: CallEvent,
) => Promise<LoggedIntegrationEntity>;
) => Promise<LoggedIntegrationEntity | null>;
getCallLogMetadata?: (config: Config) => Promise<IntegrationDefinedOptions>;
getEntity?: (
providerConfig: Config,
Expand Down
2 changes: 1 addition & 1 deletion src/models/call-event.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ export enum CallState {
export interface CallEvent {
id: string;
startTime: number;
endTime: number;
direction: CallDirection;
participants: CallParticipant[];
note: string;
state: CallState;
endTime?: number;
outcome?: string;
}

Expand Down
6 changes: 3 additions & 3 deletions src/schemas/contacts.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { z } from 'zod';
import { IntegrationEntityType } from '../models/integration-entity.model';
import { IntegrationEntityType } from '../models/integration-entity.model'; // export const contactsSchema: ValidationSchema = {

// export const contactsSchema: ValidationSchema = {
// title: 'Contacts',
Expand Down Expand Up @@ -70,8 +70,8 @@ const integrationEntitySchema = z.object({
id: z.string(),
type: z.nativeEnum(IntegrationEntityType),
source: z.string(),
label: z.string().optional(),
logId: z.string().optional(),
label: z.string().optional().nullable(),
logId: z.string().optional().nullable(),
});

export const contactSchema = z.object({
Expand Down
5 changes: 3 additions & 2 deletions src/util/callEventHelper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,9 @@ const getGermanTextDescriptionForCallEvent = (
locale: string,
): string => {
const date = new Date(callEvent.startTime);

const duration = formatDuration(
callEvent.endTime - callEvent.startTime,
callEvent.endTime ? callEvent.endTime - callEvent.startTime : 0,
locale,
);

Expand Down Expand Up @@ -84,7 +85,7 @@ const getEnglishTextDescriptionForCallEvent = (
): string => {
const date = new Date(callEvent.startTime);
const duration = formatDuration(
callEvent.endTime - callEvent.startTime,
callEvent.endTime ? callEvent.endTime - callEvent.startTime : 0,
locale,
);

Expand Down
5 changes: 4 additions & 1 deletion src/util/logger.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ function addMessageToTraceSpan(
) {
const span = trace.getSpan(context.active());
if (span) {
span.addEvent(method, { message, args: args ? args.join(',') : '' });
span.addEvent(method, {
message,
args: args ? args.map((arg) => JSON.stringify(arg)).join(',') : '',
});
}
}

Expand Down

0 comments on commit 10c9926

Please sign in to comment.