@ptkl/sdk 1.1.0 → 1.3.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.
@@ -0,0 +1,155 @@
1
+ /**
2
+ * Represents the status of an email in the system.
3
+ */
4
+ export type EmailStatus = "pending" | "sent" | "failed";
5
+ /**
6
+ * Represents a mail log entry returned by the API.
7
+ */
8
+ export type MailLog = {
9
+ /** Unique message identifier (UUID) */
10
+ message_id: string;
11
+ /** Project scope UUID */
12
+ project_uuid: string;
13
+ /** Tenant scope UUID */
14
+ tenant_uuid: string;
15
+ /** Associated workflow component UUID */
16
+ component_uuid?: string;
17
+ /** Environment: "dev" or "live" */
18
+ env: string;
19
+ /** Sender address (auto-generated from tenant) */
20
+ from: string;
21
+ /** Recipient email addresses */
22
+ to: string[];
23
+ /** CC email addresses */
24
+ cc: string[];
25
+ /** BCC email addresses */
26
+ bcc: string[];
27
+ /** Reply-to email address */
28
+ reply_to?: string;
29
+ /** Email subject line */
30
+ subject: string;
31
+ /** Email body (HTML) */
32
+ body: string;
33
+ /** Attachment metadata as JSON string */
34
+ attachments?: string;
35
+ /** Current sending status */
36
+ status: EmailStatus;
37
+ /** Number of send retry attempts */
38
+ retry_count: number;
39
+ /** Maximum allowed retries */
40
+ max_retries: number;
41
+ /** Error message from last failed attempt */
42
+ error_message?: string;
43
+ /** Timestamp when email was successfully sent */
44
+ sent_at?: string;
45
+ /** Timestamp when email was opened (tracking pixel) */
46
+ read_at?: string;
47
+ /** IP address of reader */
48
+ read_ip?: string;
49
+ /** User agent of reader */
50
+ read_user_agent?: string;
51
+ /** Whether the email was reported as spam */
52
+ spam_reported: boolean;
53
+ /** Timestamp of spam report */
54
+ spam_reported_at?: string;
55
+ /** Who reported the spam */
56
+ spam_reported_by?: string;
57
+ /** IP address of spam reporter */
58
+ spam_report_ip?: string;
59
+ /** Record creation timestamp */
60
+ created_at: string;
61
+ /** Record update timestamp */
62
+ updated_at: string;
63
+ };
64
+ /**
65
+ * Attachment input for sending an email.
66
+ */
67
+ export type AttachmentInput = {
68
+ /** DMS file ID reference */
69
+ file_id?: string;
70
+ /** File name */
71
+ file_name: string;
72
+ /** MIME type (e.g. "application/pdf") */
73
+ mime_type: string;
74
+ /** Base64-encoded file content */
75
+ content?: string;
76
+ /** File size in bytes */
77
+ size?: number;
78
+ };
79
+ /**
80
+ * Request payload for sending an email.
81
+ */
82
+ export type SendEmailRequest = {
83
+ /** Recipient email addresses (required) */
84
+ to: string[];
85
+ /** CC email addresses */
86
+ cc?: string[];
87
+ /** BCC email addresses */
88
+ bcc?: string[];
89
+ /** Email subject (required) */
90
+ subject: string;
91
+ /** Email body in HTML (required) */
92
+ body: string;
93
+ /** Reply-to email address */
94
+ reply_to?: string;
95
+ /** Custom sender display name */
96
+ sender_name?: string;
97
+ /** File attachments */
98
+ attachments?: AttachmentInput[];
99
+ };
100
+ /**
101
+ * Response from the send email endpoint.
102
+ */
103
+ export type SendEmailResponse = {
104
+ /** Whether the operation succeeded */
105
+ status: boolean;
106
+ /** The generated message ID (UUID) */
107
+ message_id: string;
108
+ /** Human-readable status message */
109
+ message: string;
110
+ };
111
+ /**
112
+ * Paginated list response for emails.
113
+ */
114
+ export type EmailListResponse = {
115
+ /** Array of mail log entries */
116
+ data: MailLog[];
117
+ /** Total number of matching emails */
118
+ total: number;
119
+ /** Current page number */
120
+ page: number;
121
+ /** Number of items per page */
122
+ limit: number;
123
+ };
124
+ /**
125
+ * Query parameters for listing emails.
126
+ */
127
+ export type ListEmailsParams = {
128
+ /** Filter by email status */
129
+ status?: EmailStatus;
130
+ /** Page number (1-indexed) */
131
+ page?: number;
132
+ /** Items per page (max 100, default 20) */
133
+ limit?: number;
134
+ };
135
+ /**
136
+ * Attachment metadata returned by the list attachments endpoint.
137
+ */
138
+ export type AttachmentMeta = {
139
+ /** Attachment record UUID */
140
+ uuid: string;
141
+ /** Linked message ID */
142
+ message_id: string;
143
+ /** File name */
144
+ file_name: string;
145
+ /** MIME type */
146
+ mime_type: string;
147
+ /** File size in bytes */
148
+ file_size: number;
149
+ /** Record creation timestamp */
150
+ created_at: string;
151
+ };
152
+ /**
153
+ * Events published by the mail system for workflow triggers.
154
+ */
155
+ export type MailEventType = "protokol-mail.email.sent" | "protokol-mail.email.failed" | "protokol-mail.email.opened" | "protokol-mail.email.spam_reported";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptkl/sdk",
3
- "version": "1.1.0",
3
+ "version": "1.3.0",
4
4
  "scripts": {
5
5
  "build": "rollup -c",
6
6
  "build:monaco": "npm run build && node scripts/generate-monaco-types.cjs",