@opencxh/domain 1.23.2 → 1.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/entities/calendar-event/index.d.ts +1 -0
- package/dist/entities/calendar-event/types.d.ts +55 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.js +12 -12
- package/dist/platform/capabilities.d.ts +1 -1
- package/dist/platform/communication.d.ts +11 -1
- package/dist/platform/provider.d.ts +34 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './types';
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { OwnerScope } from '../contact/types';
|
|
2
|
+
export type CalendarEventStatus = "confirmed" | "cancelled" | "tentative";
|
|
3
|
+
export type AttendeeResponse = "accepted" | "declined" | "tentative" | "none";
|
|
4
|
+
export interface EventAttendee {
|
|
5
|
+
email: string;
|
|
6
|
+
name?: string;
|
|
7
|
+
response?: AttendeeResponse;
|
|
8
|
+
optional?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export interface EventConferencing {
|
|
11
|
+
provider: "teams" | "meet" | "zoom" | "other";
|
|
12
|
+
joinUrl: string;
|
|
13
|
+
conferenceId?: string;
|
|
14
|
+
passcode?: string;
|
|
15
|
+
}
|
|
16
|
+
export type RecurrenceFrequency = "daily" | "weekly" | "monthly" | "yearly";
|
|
17
|
+
/**
|
|
18
|
+
* RFC5545-subset. MVP: read-only — provider supplies, we display.
|
|
19
|
+
*/
|
|
20
|
+
export interface RecurrenceRule {
|
|
21
|
+
frequency: RecurrenceFrequency;
|
|
22
|
+
interval?: number;
|
|
23
|
+
count?: number;
|
|
24
|
+
until?: number;
|
|
25
|
+
byWeekday?: ("MO" | "TU" | "WE" | "TH" | "FR" | "SA" | "SU")[];
|
|
26
|
+
}
|
|
27
|
+
export interface EventReminder {
|
|
28
|
+
minutesBefore: number;
|
|
29
|
+
}
|
|
30
|
+
export interface CalendarEvent {
|
|
31
|
+
id: string;
|
|
32
|
+
organizationId: string;
|
|
33
|
+
ownerScope: OwnerScope;
|
|
34
|
+
title: string;
|
|
35
|
+
description?: string;
|
|
36
|
+
location?: string;
|
|
37
|
+
startTime: number;
|
|
38
|
+
endTime: number;
|
|
39
|
+
allDay?: boolean;
|
|
40
|
+
timezone?: string;
|
|
41
|
+
organizer?: EventAttendee;
|
|
42
|
+
attendees?: EventAttendee[];
|
|
43
|
+
/** Link to a communication Interaction (e.g. Teams meeting chat). */
|
|
44
|
+
interactionId?: string;
|
|
45
|
+
/** Channel used for external sync (provider-resolved). */
|
|
46
|
+
channelId?: string;
|
|
47
|
+
/** Provider-side IDs for dedupe (e.g. Graph event id, iCalUId). */
|
|
48
|
+
externalIds?: string[];
|
|
49
|
+
status: CalendarEventStatus;
|
|
50
|
+
recurrence?: RecurrenceRule;
|
|
51
|
+
reminders?: EventReminder[];
|
|
52
|
+
conferencing?: EventConferencing;
|
|
53
|
+
createdAt?: number;
|
|
54
|
+
updatedAt?: number;
|
|
55
|
+
}
|
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function c(t){return t.endpoints??[]}const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});function c(t){return t.endpoints??[]}const d=t=>!!t.assignedUserId||!!t.assignedInboxId,u=t=>t.status==="closed",g=t=>({urgent:10,high:5,normal:2,low:1})[t.priority]||0,p=(t,n=30)=>t.title?.length<=n?t.title:`${t.title.substring(0,n)}...`;function l(t,n){const r=new Set(t.disabledIntents??[]),i=t.intentOverrides??{},e=n.intents.filter(s=>!r.has(s.intent)).map(s=>I(s,i[s.intent]));if(!t.extraIntents||t.extraIntents.length===0)return e;const o=new Set(e.map(s=>s.intent));for(const s of t.extraIntents)o.has(s.intent)||(e.push(s),o.add(s.intent));return e}function I(t,n){return n?{intent:n.intent??t.intent,targetSchemes:n.targetSchemes??t.targetSchemes,transport:n.transport??t.transport}:t}function y(t,n){const r=[];for(const i of t){if(!i.enabled)continue;const e=n[i.providerId];if(e)for(const o of l(i,e))r.push({channel:i,description:e,capability:o})}return r}function b(t,n){return n.filter(r=>r.capability.intent===t)}function a(t,n){return n.filter(r=>r.capability.targetSchemes.includes(t))}function h(t,n){return a(t.scheme,n)}function E(t,n,r){const i=[];for(const e of t)for(const o of r)o.capability.intent===n&&o.capability.targetSchemes.includes(e.scheme)&&i.push({channelIntent:o,endpoint:e});return i}var f=(t=>(t.MAILTO="mailto",t.SIP="sip",t.TEL="tel",t.WEBHOOK="webhook",t.USERNAME="username",t.ID="id",t.CUSTOM="custom",t.URL="url",t.TELEGRAM="telegram",t.WHATSAPP="whatsapp",t.VIBER="viber",t.SMS="sms",t.FAX="fax",t.TEAMS="teams",t.CALENDAR="calendar",t))(f||{});exports.CommunicationScheme=f;exports.buildChannelIntents=y;exports.filterByEndpoint=h;exports.filterByIntent=b;exports.filterByTargetScheme=a;exports.getContactEndpoints=c;exports.getShortTitle=p;exports.getUrgencyScore=g;exports.isAssigned=d;exports.isClosed=u;exports.matchContactToIntents=E;exports.resolveChannelIntents=l;
|
package/dist/index.d.ts
CHANGED
|
@@ -8,6 +8,7 @@ export * from './entities/ai-profile';
|
|
|
8
8
|
export * from './entities/channel';
|
|
9
9
|
export * from './entities/communication';
|
|
10
10
|
export * from './entities/contact';
|
|
11
|
+
export * from './entities/calendar-event';
|
|
11
12
|
export * from './entities/inbox';
|
|
12
13
|
export * from './entities/interaction';
|
|
13
14
|
export * from './entities/note';
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
function
|
|
1
|
+
function d(t) {
|
|
2
2
|
return t.endpoints ?? [];
|
|
3
3
|
}
|
|
4
|
-
const
|
|
4
|
+
const p = (t) => !!t.assignedUserId || !!t.assignedInboxId, c = (t) => t.status === "closed", g = (t) => ({
|
|
5
5
|
urgent: 10,
|
|
6
6
|
high: 5,
|
|
7
7
|
normal: 2,
|
|
@@ -33,34 +33,34 @@ function b(t, n) {
|
|
|
33
33
|
}
|
|
34
34
|
return r;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function E(t, n) {
|
|
37
37
|
return n.filter((r) => r.capability.intent === t);
|
|
38
38
|
}
|
|
39
39
|
function a(t, n) {
|
|
40
40
|
return n.filter((r) => r.capability.targetSchemes.includes(t));
|
|
41
41
|
}
|
|
42
|
-
function
|
|
42
|
+
function y(t, n) {
|
|
43
43
|
return a(t.scheme, n);
|
|
44
44
|
}
|
|
45
|
-
function
|
|
45
|
+
function A(t, n, r) {
|
|
46
46
|
const i = [];
|
|
47
47
|
for (const e of t)
|
|
48
48
|
for (const o of r)
|
|
49
49
|
o.capability.intent === n && o.capability.targetSchemes.includes(e.scheme) && i.push({ channelIntent: o, endpoint: e });
|
|
50
50
|
return i;
|
|
51
51
|
}
|
|
52
|
-
var u = /* @__PURE__ */ ((t) => (t.MAILTO = "mailto", t.SIP = "sip", t.TEL = "tel", t.WEBHOOK = "webhook", t.USERNAME = "username", t.ID = "id", t.CUSTOM = "custom", t.URL = "url", t.TELEGRAM = "telegram", t.WHATSAPP = "whatsapp", t.VIBER = "viber", t.SMS = "sms", t.FAX = "fax", t.TEAMS = "teams", t))(u || {});
|
|
52
|
+
var u = /* @__PURE__ */ ((t) => (t.MAILTO = "mailto", t.SIP = "sip", t.TEL = "tel", t.WEBHOOK = "webhook", t.USERNAME = "username", t.ID = "id", t.CUSTOM = "custom", t.URL = "url", t.TELEGRAM = "telegram", t.WHATSAPP = "whatsapp", t.VIBER = "viber", t.SMS = "sms", t.FAX = "fax", t.TEAMS = "teams", t.CALENDAR = "calendar", t))(u || {});
|
|
53
53
|
export {
|
|
54
54
|
u as CommunicationScheme,
|
|
55
55
|
b as buildChannelIntents,
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
y as filterByEndpoint,
|
|
57
|
+
E as filterByIntent,
|
|
58
58
|
a as filterByTargetScheme,
|
|
59
|
-
|
|
59
|
+
d as getContactEndpoints,
|
|
60
60
|
I as getShortTitle,
|
|
61
61
|
g as getUrgencyScore,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
p as isAssigned,
|
|
63
|
+
c as isClosed,
|
|
64
|
+
A as matchContactToIntents,
|
|
65
65
|
f as resolveChannelIntents
|
|
66
66
|
};
|
|
@@ -6,7 +6,7 @@ import { CommunicationScheme, IntentCapability, ProviderDescription, Uri } from
|
|
|
6
6
|
* default composers). Intent itself is an open string — providers may
|
|
7
7
|
* declare anything. Unknown intents render as generic actions.
|
|
8
8
|
*/
|
|
9
|
-
export type CommunicationIntent = "call" | "mail" | "message" | "video";
|
|
9
|
+
export type CommunicationIntent = "call" | "mail" | "message" | "video" | "calendar";
|
|
10
10
|
/**
|
|
11
11
|
* A channel's effective intent — the resolved IntentCapability for this
|
|
12
12
|
* specific channel, ready for routing/UI decisions.
|
|
@@ -55,7 +55,8 @@ export declare enum CommunicationScheme {
|
|
|
55
55
|
VIBER = "viber",
|
|
56
56
|
SMS = "sms",
|
|
57
57
|
FAX = "fax",
|
|
58
|
-
TEAMS = "teams"
|
|
58
|
+
TEAMS = "teams",
|
|
59
|
+
CALENDAR = "calendar"
|
|
59
60
|
}
|
|
60
61
|
/**
|
|
61
62
|
* Account selector for `transport: session` intents. Tells the frontend
|
|
@@ -89,6 +90,15 @@ export type TransportConfig = {
|
|
|
89
90
|
canvas: `${string}:${string}`;
|
|
90
91
|
actionTray?: `${string}:${string}`;
|
|
91
92
|
};
|
|
93
|
+
} | {
|
|
94
|
+
/**
|
|
95
|
+
* CRUD-on-external-resource transport. Used for entities with a
|
|
96
|
+
* lifecycle (create/update/cancel) on the provider side — e.g.
|
|
97
|
+
* calendar events, tasks. Provider exposes a handler-set instead
|
|
98
|
+
* of a single send. Distinct from `compose` (fire-and-forget) and
|
|
99
|
+
* `session` (stateful realtime).
|
|
100
|
+
*/
|
|
101
|
+
kind: "schedule";
|
|
92
102
|
};
|
|
93
103
|
/**
|
|
94
104
|
* One user-facing intent a provider/channel can perform on a target.
|
|
@@ -69,6 +69,40 @@ export interface FindActivityByExternalProviderIdPayload {
|
|
|
69
69
|
activityType: string;
|
|
70
70
|
interactionId?: string;
|
|
71
71
|
}
|
|
72
|
+
/**
|
|
73
|
+
* Calendar/schedule transport payloads. Providers that declare an intent
|
|
74
|
+
* with `transport: { kind: "schedule" }` implement `/provider/schedule/*`
|
|
75
|
+
* routes. Communication-server dispatches CRUD on CalendarEvents to the
|
|
76
|
+
* corresponding provider via these payloads.
|
|
77
|
+
*/
|
|
78
|
+
export type ScheduleResponse = "accepted" | "declined" | "tentative";
|
|
79
|
+
export interface SchedulePayload {
|
|
80
|
+
channelId: string;
|
|
81
|
+
/** Local CalendarEvent without storage-managed fields. */
|
|
82
|
+
event: any;
|
|
83
|
+
}
|
|
84
|
+
export interface ScheduleUpdatePayload {
|
|
85
|
+
channelId: string;
|
|
86
|
+
externalId: string;
|
|
87
|
+
patch: any;
|
|
88
|
+
}
|
|
89
|
+
export interface ScheduleCancelPayload {
|
|
90
|
+
channelId: string;
|
|
91
|
+
externalId: string;
|
|
92
|
+
comment?: string;
|
|
93
|
+
}
|
|
94
|
+
export interface ScheduleRespondPayload {
|
|
95
|
+
channelId: string;
|
|
96
|
+
externalId: string;
|
|
97
|
+
response: ScheduleResponse;
|
|
98
|
+
comment?: string;
|
|
99
|
+
sendResponse?: boolean;
|
|
100
|
+
}
|
|
101
|
+
export interface ScheduleResult {
|
|
102
|
+
externalId?: string;
|
|
103
|
+
/** Provider-side echo for caller persistence (e.g. Graph event id). */
|
|
104
|
+
providerData?: Record<string, unknown>;
|
|
105
|
+
}
|
|
72
106
|
export interface FileUploadPayload {
|
|
73
107
|
file: Uint8Array;
|
|
74
108
|
filename: string;
|