@opencxh/domain 1.39.0 → 1.40.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/index.d.ts CHANGED
@@ -36,4 +36,5 @@ export * from './platform/services';
36
36
  export * from './platform/ui';
37
37
  export * from './platform/media';
38
38
  export * from './platform/provider';
39
+ export * from './platform/push';
39
40
  export * from './platform/storage';
@@ -0,0 +1,57 @@
1
+ export type PushTransport = "webpush" | "apns" | "apns-voip" | "fcm" | "tauri";
2
+ export type PushPlatform = "web" | "ios" | "android" | "desktop";
3
+ export interface PushSubscription {
4
+ id: string;
5
+ userId: string;
6
+ transport: PushTransport;
7
+ token: string;
8
+ keys?: {
9
+ p256dh: string;
10
+ auth: string;
11
+ };
12
+ platform: PushPlatform;
13
+ appVersion: string;
14
+ providerId?: string;
15
+ createdAt: number;
16
+ lastSeenAt: number;
17
+ }
18
+ export type PushKind = "wake" | "incoming-call" | "message" | "presence" | "notification" | "custom";
19
+ export interface PushDisplay {
20
+ title: string;
21
+ body?: string;
22
+ icon?: string;
23
+ tag?: string;
24
+ actions?: {
25
+ id: string;
26
+ title: string;
27
+ }[];
28
+ url?: string;
29
+ }
30
+ export interface PushEnvelope<P = unknown> {
31
+ providerId: string;
32
+ accountId?: string;
33
+ kind: PushKind;
34
+ display?: PushDisplay;
35
+ payload: P;
36
+ ts: number;
37
+ ttl?: number;
38
+ voip?: boolean;
39
+ }
40
+ export type PushSubscribeInput = Omit<PushSubscription, "id" | "userId" | "createdAt" | "lastSeenAt">;
41
+ export interface PushSendRequest<P = unknown> {
42
+ to: {
43
+ userIds: string[];
44
+ } | {
45
+ userId: string;
46
+ };
47
+ envelope: Omit<PushEnvelope<P>, "ts">;
48
+ platforms?: PushPlatform[];
49
+ collapseKey?: string;
50
+ }
51
+ export interface PushSendResult {
52
+ delivered: number;
53
+ }
54
+ export interface IPushChannel {
55
+ readonly providerId: string;
56
+ handle(env: PushEnvelope): Promise<void>;
57
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opencxh/domain",
3
- "version": "1.39.0",
3
+ "version": "1.40.0",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.js",