@sentroy-co/client-sdk 1.1.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/README.md ADDED
@@ -0,0 +1,178 @@
1
+ <p align="center">
2
+ <img src="https://sentroy.com/business/sentroy-logo-light.png" alt="Sentroy" width="240" />
3
+ </p>
4
+
5
+ <h3 align="center">Sentroy Client SDK for TypeScript</h3>
6
+
7
+ <p align="center">
8
+ Server-side SDK to interact with the Sentroy platform API.<br />
9
+ List domains, manage mailboxes, fetch templates, read inbox, and send emails.
10
+ </p>
11
+
12
+ <p align="center">
13
+ <a href="https://www.npmjs.com/package/@sentroy-co/client-sdk"><img src="https://img.shields.io/npm/v/@sentroy-co/client-sdk.svg" alt="npm version" /></a>
14
+ <a href="https://www.npmjs.com/package/@sentroy-co/client-sdk"><img src="https://img.shields.io/npm/dm/@sentroy-co/client-sdk.svg" alt="npm downloads" /></a>
15
+ <a href="https://github.com/Sentroy-Co/client-sdk/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/@sentroy-co/client-sdk.svg" alt="license" /></a>
16
+ </p>
17
+
18
+ ---
19
+
20
+ ## Installation
21
+
22
+ ```bash
23
+ npm install @sentroy-co/client-sdk
24
+ ```
25
+
26
+ ## Quick Start
27
+
28
+ ```ts
29
+ import { Sentroy } from "@sentroy-co/client-sdk"
30
+
31
+ const sentroy = new Sentroy({
32
+ baseUrl: "https://sentroy.com",
33
+ companySlug: "my-company",
34
+ accessToken: "stk_...",
35
+ })
36
+ ```
37
+
38
+ > Access tokens can be created from **Admin > Access Tokens** in the Sentroy dashboard.
39
+
40
+ ## Usage
41
+
42
+ ### Domains
43
+
44
+ ```ts
45
+ // List all domains
46
+ const domains = await sentroy.domains.list()
47
+
48
+ // Get a single domain
49
+ const domain = await sentroy.domains.get("domain-id")
50
+ ```
51
+
52
+ ### Mailboxes
53
+
54
+ ```ts
55
+ // List all mailbox accounts
56
+ const mailboxes = await sentroy.mailboxes.list()
57
+ ```
58
+
59
+ ### Templates
60
+
61
+ ```ts
62
+ // List all templates
63
+ const templates = await sentroy.templates.list()
64
+
65
+ // Get a template by ID
66
+ const template = await sentroy.templates.get("template-id")
67
+ ```
68
+
69
+ ### Inbox
70
+
71
+ ```ts
72
+ // List messages
73
+ const messages = await sentroy.inbox.list({
74
+ mailbox: "info@example.com",
75
+ folder: "INBOX",
76
+ page: 1,
77
+ limit: 20,
78
+ })
79
+
80
+ // Get a single message
81
+ const message = await sentroy.inbox.get(1234, {
82
+ mailbox: "info@example.com",
83
+ })
84
+
85
+ // List IMAP folders
86
+ const folders = await sentroy.inbox.listFolders("info@example.com")
87
+
88
+ // Get a thread by subject
89
+ const thread = await sentroy.inbox.getThread("Re: Project update", "info@example.com")
90
+
91
+ // Mark as read / unread
92
+ await sentroy.inbox.markAsRead(1234, { mailbox: "info@example.com" })
93
+ await sentroy.inbox.markAsUnread(1234, { mailbox: "info@example.com" })
94
+
95
+ // Move message
96
+ await sentroy.inbox.move(1234, "Trash", {
97
+ from: "INBOX",
98
+ mailbox: "info@example.com",
99
+ })
100
+
101
+ // Delete message
102
+ await sentroy.inbox.delete(1234, { mailbox: "info@example.com" })
103
+ ```
104
+
105
+ ### Send Email
106
+
107
+ ```ts
108
+ // Send with a template
109
+ const result = await sentroy.send.email({
110
+ to: "user@example.com",
111
+ from: "info@example.com",
112
+ subject: "Welcome!",
113
+ domainId: "domain-id",
114
+ templateId: "template-id",
115
+ variables: {
116
+ name: "John",
117
+ company: "Acme",
118
+ },
119
+ })
120
+
121
+ // Send with raw HTML
122
+ const result = await sentroy.send.email({
123
+ to: ["user1@example.com", "user2@example.com"],
124
+ from: "info@example.com",
125
+ subject: "Hello",
126
+ domainId: "domain-id",
127
+ html: "<h1>Hello World</h1>",
128
+ })
129
+
130
+ // Send with attachments
131
+ const result = await sentroy.send.email({
132
+ to: "user@example.com",
133
+ from: "info@example.com",
134
+ subject: "Invoice",
135
+ domainId: "domain-id",
136
+ html: "<p>Please find your invoice attached.</p>",
137
+ attachments: [
138
+ {
139
+ filename: "invoice.pdf",
140
+ content: base64String,
141
+ contentType: "application/pdf",
142
+ },
143
+ ],
144
+ })
145
+ ```
146
+
147
+ ## Error Handling
148
+
149
+ ```ts
150
+ import { Sentroy, SentroyError } from "@sentroy-co/client-sdk"
151
+
152
+ try {
153
+ await sentroy.send.email({ ... })
154
+ } catch (err) {
155
+ if (err instanceof SentroyError) {
156
+ console.error(err.statusCode) // 401, 403, 500, etc.
157
+ console.error(err.message) // Human-readable error
158
+ }
159
+ }
160
+ ```
161
+
162
+ ## Configuration
163
+
164
+ | Option | Type | Required | Description |
165
+ |--------|------|----------|-------------|
166
+ | `baseUrl` | `string` | Yes | Sentroy instance URL (e.g. `https://sentroy.com`) |
167
+ | `companySlug` | `string` | Yes | Your company slug |
168
+ | `accessToken` | `string` | Yes | Access token (`stk_...`) |
169
+ | `timeout` | `number` | No | Request timeout in ms (default: `30000`) |
170
+
171
+ ## Requirements
172
+
173
+ - Node.js 18+ (uses native `fetch`)
174
+ - Server-side only
175
+
176
+ ## License
177
+
178
+ [MIT](LICENSE)
package/dist/http.d.ts ADDED
@@ -0,0 +1,18 @@
1
+ export declare class SentroyError extends Error {
2
+ readonly statusCode: number;
3
+ readonly body: unknown;
4
+ constructor(statusCode: number, body: unknown, message?: string);
5
+ }
6
+ export declare class HttpClient {
7
+ private baseUrl;
8
+ private token;
9
+ private timeout;
10
+ constructor(baseUrl: string, token: string, timeout?: number);
11
+ private buildUrl;
12
+ private request;
13
+ get<T>(path: string, query?: Record<string, unknown>): Promise<T>;
14
+ post<T>(path: string, body?: unknown): Promise<T>;
15
+ put<T>(path: string, body?: unknown): Promise<T>;
16
+ del<T>(path: string, query?: Record<string, unknown>): Promise<T>;
17
+ }
18
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":"AAEA,qBAAa,YAAa,SAAQ,KAAK;aAEnB,UAAU,EAAE,MAAM;aAClB,IAAI,EAAE,OAAO;gBADb,UAAU,EAAE,MAAM,EAClB,IAAI,EAAE,OAAO,EAC7B,OAAO,CAAC,EAAE,MAAM;CAKnB;AAED,qBAAa,UAAU;IACrB,OAAO,CAAC,OAAO,CAAQ;IACvB,OAAO,CAAC,KAAK,CAAQ;IACrB,OAAO,CAAC,OAAO,CAAQ;gBAEX,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,SAAS;IAM5D,OAAO,CAAC,QAAQ;YAYF,OAAO;IA2Cf,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;IAIjE,IAAI,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAIjD,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,CAAC,CAAC;IAIhD,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC;CAGxE"}
package/dist/http.js ADDED
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.HttpClient = exports.SentroyError = void 0;
4
+ class SentroyError extends Error {
5
+ statusCode;
6
+ body;
7
+ constructor(statusCode, body, message) {
8
+ super(message || `Sentroy API error (${statusCode})`);
9
+ this.statusCode = statusCode;
10
+ this.body = body;
11
+ this.name = "SentroyError";
12
+ }
13
+ }
14
+ exports.SentroyError = SentroyError;
15
+ class HttpClient {
16
+ baseUrl;
17
+ token;
18
+ timeout;
19
+ constructor(baseUrl, token, timeout = 30_000) {
20
+ this.baseUrl = baseUrl.replace(/\/+$/, "");
21
+ this.token = token;
22
+ this.timeout = timeout;
23
+ }
24
+ buildUrl(path, query) {
25
+ const url = new URL(`${this.baseUrl}${path}`);
26
+ if (query) {
27
+ for (const [key, value] of Object.entries(query)) {
28
+ if (value !== undefined && value !== null) {
29
+ url.searchParams.set(key, String(value));
30
+ }
31
+ }
32
+ }
33
+ return url.toString();
34
+ }
35
+ async request(method, path, options) {
36
+ const url = this.buildUrl(path, options?.query);
37
+ const controller = new AbortController();
38
+ const timer = setTimeout(() => controller.abort(), this.timeout);
39
+ try {
40
+ const headers = {
41
+ Authorization: `Bearer ${this.token}`,
42
+ };
43
+ if (options?.body) {
44
+ headers["Content-Type"] = "application/json";
45
+ }
46
+ const res = await fetch(url, {
47
+ method,
48
+ headers,
49
+ body: options?.body ? JSON.stringify(options.body) : undefined,
50
+ signal: controller.signal,
51
+ });
52
+ const json = (await res.json());
53
+ if (!res.ok) {
54
+ throw new SentroyError(res.status, json, json.error || `Request failed with status ${res.status}`);
55
+ }
56
+ return json.data;
57
+ }
58
+ finally {
59
+ clearTimeout(timer);
60
+ }
61
+ }
62
+ async get(path, query) {
63
+ return this.request("GET", path, { query });
64
+ }
65
+ async post(path, body) {
66
+ return this.request("POST", path, { body });
67
+ }
68
+ async put(path, body) {
69
+ return this.request("PUT", path, { body });
70
+ }
71
+ async del(path, query) {
72
+ return this.request("DELETE", path, { query });
73
+ }
74
+ }
75
+ exports.HttpClient = HttpClient;
76
+ //# sourceMappingURL=http.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.js","sourceRoot":"","sources":["../src/http.ts"],"names":[],"mappings":";;;AAEA,MAAa,YAAa,SAAQ,KAAK;IAEnB;IACA;IAFlB,YACkB,UAAkB,EAClB,IAAa,EAC7B,OAAgB;QAEhB,KAAK,CAAC,OAAO,IAAI,sBAAsB,UAAU,GAAG,CAAC,CAAA;QAJrC,eAAU,GAAV,UAAU,CAAQ;QAClB,S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AC,OAAO,CAAI,KAAK,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,CAAA;IAC/C,CAAC;IAED,KAAK,CAAC,GAAG,CAAI,IAAY,EAAE,KAA+B;QACxD,OAAO,IAAI,CAAC,OAAO,CAAI,QAAQ,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,CAAC,CAAA;IACnD,CAAC;CACF;AAjFD,gCAiFC"}
@@ -0,0 +1,31 @@
1
+ import { Domains } from "./resources/domains";
2
+ import { Mailboxes } from "./resources/mailboxes";
3
+ import { Templates } from "./resources/templates";
4
+ import { Inbox } from "./resources/inbox";
5
+ import { Send } from "./resources/send";
6
+ import type { SentroyClientConfig } from "./types";
7
+ export declare class Sentroy {
8
+ readonly domains: Domains;
9
+ readonly mailboxes: Mailboxes;
10
+ readonly templates: Templates;
11
+ readonly inbox: Inbox;
12
+ readonly send: Send;
13
+ /**
14
+ * Create a new Sentroy client.
15
+ *
16
+ * @example
17
+ * ```ts
18
+ * const sentroy = new Sentroy({
19
+ * baseUrl: "https://sentroy.com",
20
+ * companySlug: "my-company",
21
+ * accessToken: "stk_abc123...",
22
+ * })
23
+ *
24
+ * const domains = await sentroy.domains.list()
25
+ * ```
26
+ */
27
+ constructor(config: SentroyClientConfig);
28
+ }
29
+ export type { SentroyClientConfig, ApiResponse, Domain, MailboxUser, Template, LocalizedString, MessageAddress, MessageSummary, MessageDetail, AttachmentInfo, Mailbox, InboxListParams, Attachment, SendParams, SendResult, } from "./types";
30
+ export { SentroyError } from "./http";
31
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAA;AAC7C,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAA;AACjD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAA;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AACvC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,SAAS,CAAA;AAElD,qBAAa,OAAO;IAClB,SAAgB,OAAO,EAAE,OAAO,CAAA;IAChC,SAAgB,SAAS,EAAE,SAAS,CAAA;IACpC,SAAgB,SAAS,EAAE,SAAS,CAAA;IACpC,SAAgB,KAAK,EAAE,KAAK,CAAA;IAC5B,SAAgB,IAAI,EAAE,IAAI,CAAA;IAE1B;;;;;;;;;;;;;OAaG;gBACS,MAAM,EAAE,mBAAmB;CAWxC;AAGD,YAAY,EACV,mBAAmB,EACnB,WAAW,EACX,MAAM,EACN,WAAW,EACX,QAAQ,EACR,eAAe,EACf,cAAc,EACd,cAAc,EACd,aAAa,EACb,cAAc,EACd,OAAO,EACP,eAAe,EACf,UAAU,EACV,UAAU,EACV,UAAU,GACX,MAAM,SAAS,CAAA;AAEhB,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAA"}
package/dist/index.js ADDED
@@ -0,0 +1,44 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SentroyError = exports.Sentroy = void 0;
4
+ const http_1 = require("./http");
5
+ const domains_1 = require("./resources/domains");
6
+ const mailboxes_1 = require("./resources/mailboxes");
7
+ const templates_1 = require("./resources/templates");
8
+ const inbox_1 = require("./resources/inbox");
9
+ const send_1 = require("./resources/send");
10
+ class Sentroy {
11
+ domains;
12
+ mailboxes;
13
+ templates;
14
+ inbox;
15
+ send;
16
+ /**
17
+ * Create a new Sentroy client.
18
+ *
19
+ * @example
20
+ * ```ts
21
+ * const sentroy = new Sentroy({
22
+ * baseUrl: "https://sentroy.com",
23
+ * companySlug: "my-company",
24
+ * accessToken: "stk_abc123...",
25
+ * })
26
+ *
27
+ * const domains = await sentroy.domains.list()
28
+ * ```
29
+ */
30
+ constructor(config) {
31
+ const base = config.baseUrl.replace(/\/+$/, "");
32
+ const apiBase = `${base}/api/companies/${encodeURIComponent(config.companySlug)}`;
33
+ const http = new http_1.HttpClient(apiBase, config.accessToken, config.timeout);
34
+ this.domains = new domains_1.Domains(http);
35
+ this.mailboxes = new mailboxes_1.Mailboxes(http);
36
+ this.templates = new templates_1.Templates(http);
37
+ this.inbox = new inbox_1.Inbox(http);
38
+ this.send = new send_1.Send(http);
39
+ }
40
+ }
41
+ exports.Sentroy = Sentroy;
42
+ var http_2 = require("./http");
43
+ Object.defineProperty(exports, "SentroyError", { enumerable: true, get: function () { return http_2.SentroyError; } });
44
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,iCAAmC;AACnC,iDAA6C;AAC7C,qDAAiD;AACjD,qDAAiD;AACjD,6CAAyC;AACzC,2CAAuC;AAGvC,MAAa,OAAO;IACF,OAAO,CAAS;IAChB,SAAS,CAAW;IACpB,SAAS,CAAW;IACpB,KAAK,CAAO;IACZ,IAAI,CAAM;IAE1B;;;;;;;;;;;;;OAaG;IACH,YAAY,MAA2B;QACrC,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAA;QAC/C,MAAM,OAAO,GAAG,GAAG,IAAI,kBAAkB,kBAAkB,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAA;QACjF,MAAM,IAAI,GAAG,IAAI,iBAAU,CAAC,OAAO,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CAAC,OAAO,CAAC,CAAA;QAExE,IAAI,CAAC,OAAO,GAAG,IAAI,iBAAO,CAAC,IAAI,CAAC,CAAA;QAChC,IAAI,CAAC,SAAS,GAAG,IAAI,qBAAS,CAAC,IAAI,CAAC,CAAA;QACpC,IAAI,CAAC,SAAS,GAAG,IAAI,qBAAS,CAAC,IAAI,CAAC,CAAA;QACpC,IAAI,CAAC,KAAK,GAAG,IAAI,aAAK,CAAC,IAAI,CAAC,CAAA;QAC5B,IAAI,CAAC,IAAI,GAAG,IAAI,WAAI,CAAC,IAAI,CAAC,CAAA;IAC5B,CAAC;CACF;AAhCD,0BAgCC;AAqBD,+BAAqC;AAA5B,oGAAA,YAAY,OAAA"}
@@ -0,0 +1,11 @@
1
+ import type { HttpClient } from "../http";
2
+ import type { Domain } from "../types";
3
+ export declare class Domains {
4
+ private http;
5
+ constructor(http: HttpClient);
6
+ /** List all verified domains for the company */
7
+ list(): Promise<Domain[]>;
8
+ /** Get a single domain by ID */
9
+ get(id: string): Promise<Domain>;
10
+ }
11
+ //# sourceMappingURL=domains.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domains.d.ts","sourceRoot":"","sources":["../../src/resources/domains.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEtC,qBAAa,OAAO;IACN,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAEpC,gDAAgD;IAC1C,IAAI,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC;IAI/B,gCAAgC;IAC1B,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;CAGvC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Domains = void 0;
4
+ class Domains {
5
+ http;
6
+ constructor(http) {
7
+ this.http = http;
8
+ }
9
+ /** List all verified domains for the company */
10
+ async list() {
11
+ return this.http.get("/domains");
12
+ }
13
+ /** Get a single domain by ID */
14
+ async get(id) {
15
+ return this.http.get(`/domains/${encodeURIComponent(id)}`);
16
+ }
17
+ }
18
+ exports.Domains = Domains;
19
+ //# sourceMappingURL=domains.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"domains.js","sourceRoot":"","sources":["../../src/resources/domains.ts"],"names":[],"mappings":";;;AAGA,MAAa,OAAO;IACE;IAApB,YAAoB,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAExC,gDAAgD;IAChD,KAAK,CAAC,IAAI;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAW,UAAU,CAAC,CAAA;IAC5C,CAAC;IAED,gCAAgC;IAChC,KAAK,CAAC,GAAG,CAAC,EAAU;QAClB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAS,YAAY,kBAAkB,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;IACpE,CAAC;CACF;AAZD,0BAYC"}
@@ -0,0 +1,40 @@
1
+ import type { HttpClient } from "../http";
2
+ import type { MessageSummary, MessageDetail, Mailbox, InboxListParams } from "../types";
3
+ export declare class Inbox {
4
+ private http;
5
+ constructor(http: HttpClient);
6
+ /** List messages in a mailbox folder */
7
+ list(params?: InboxListParams): Promise<MessageSummary[]>;
8
+ /** Get a single message detail */
9
+ get(uid: number, options?: {
10
+ mailbox?: string;
11
+ folder?: string;
12
+ }): Promise<MessageDetail>;
13
+ /** List IMAP folders (mailboxes) for a given email account */
14
+ listFolders(mailbox?: string): Promise<Mailbox[]>;
15
+ /** Get thread messages by subject */
16
+ getThread(subject: string, mailbox?: string): Promise<(MessageDetail & {
17
+ folder: string;
18
+ })[]>;
19
+ /** Mark a message as read */
20
+ markAsRead(uid: number, options?: {
21
+ mailbox?: string;
22
+ folder?: string;
23
+ }): Promise<void>;
24
+ /** Mark a message as unread */
25
+ markAsUnread(uid: number, options?: {
26
+ mailbox?: string;
27
+ folder?: string;
28
+ }): Promise<void>;
29
+ /** Move a message to another folder */
30
+ move(uid: number, to: string, options?: {
31
+ from?: string;
32
+ mailbox?: string;
33
+ }): Promise<void>;
34
+ /** Delete a message */
35
+ delete(uid: number, options?: {
36
+ mailbox?: string;
37
+ folder?: string;
38
+ }): Promise<void>;
39
+ }
40
+ //# sourceMappingUR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uCAAuC;IACjC,IAAI,CACR,GAAG,EAAE,MAAM,EACX,EAAE,EAAE,MAAM,EACV,OAAO,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAC5C,OAAO,CAAC,IAAI,CAAC;IAQhB,uBAAuB;IACjB,MAAM,CACV,GAAG,EAAE,MAAM,EACX,OAAO,CAAC,EAAE;QAAE,OAAO,CAAC,EAAE,MAAM,CAAC;QAAC,MAAM,CAAC,EAAE,MAAM,CAAA;KAAE,GAC9C,OAAO,CAAC,IAAI,CAAC;CAMjB"}
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Inbox = void 0;
4
+ class Inbox {
5
+ http;
6
+ constructor(http) {
7
+ this.http = http;
8
+ }
9
+ /** List messages in a mailbox folder */
10
+ async list(params) {
11
+ const query = {};
12
+ if (params?.mailbox)
13
+ query.mailbox = params.mailbox;
14
+ if (params?.folder)
15
+ query.folder = params.folder;
16
+ if (params?.page)
17
+ query.page = params.page;
18
+ if (params?.limit)
19
+ query.limit = params.limit;
20
+ if (params?.unreadOnly)
21
+ query.unreadOnly = "true";
22
+ return this.http.get("/inbox", query);
23
+ }
24
+ /** Get a single message detail */
25
+ async get(uid, options) {
26
+ const query = {};
27
+ if (options?.mailbox)
28
+ query.mailbox = options.mailbox;
29
+ if (options?.folder)
30
+ query.folder = options.folder;
31
+ return this.http.get(`/inbox/${uid}`, query);
32
+ }
33
+ /** List IMAP folders (mailboxes) for a given email account */
34
+ async listFolders(mailbox) {
35
+ const query = {};
36
+ if (mailbox)
37
+ query.mailbox = mailbox;
38
+ return this.http.get("/inbox/mailboxes", query);
39
+ }
40
+ /** Get thread messages by subject */
41
+ async getThread(subject, mailbox) {
42
+ const query = { subject };
43
+ if (mailbox)
44
+ query.mailbox = mailbox;
45
+ return this.http.get("/inbox/thread", query);
46
+ }
47
+ /** Mark a message as read */
48
+ async markAsRead(uid, options) {
49
+ await this.http.post(`/inbox/${uid}/read`, {
50
+ mailbox: options?.mailbox,
51
+ folder: options?.folder,
52
+ });
53
+ }
54
+ /** Mark a message as unread */
55
+ async markAsUnread(uid, options) {
56
+ await this.http.del(`/inbox/${uid}/read`, {
57
+ mailbox: options?.mailbox,
58
+ folder: options?.folder,
59
+ });
60
+ }
61
+ /** Move a message to another folder */
62
+ async move(uid, to, options) {
63
+ await this.http.post(`/inbox/${uid}/move`, {
64
+ to,
65
+ from: options?.from,
66
+ mailbox: options?.mailbox,
67
+ });
68
+ }
69
+ /** Delete a message */
70
+ async delete(uid, options) {
71
+ const query = {};
72
+ if (options?.mailbox)
73
+ query.mailbox = options.mailbox;
74
+ if (options?.folder)
75
+ query.folder = options.folder;
76
+ await this.http.del(`/inbox/${uid}`, query);
77
+ }
78
+ }
79
+ exports.Inbox = Inbox;
80
+ //# sourceMappingURL=inbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"inbox.js","sourceRoot":"","sources":["../../src/resources/inbox.ts"],"names":[],"mappings":";;;AAQA,MAAa,KAAK;IACI;IAApB,YAAoB,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAExC,wCAAwC;IACxC,KAAK,CAAC,IAAI,CAAC,MAAwB;QACjC,MAAM,KAAK,GAA4B,EAAE,CAAA;QACzC,IAAI,MAAM,EAAE,OAAO;YAAE,KAAK,CAAC,OAAO,GAAG,MAAM,CAAC,OAAO,CAAA;QACnD,IAAI,MAAM,EAAE,MAAM;YAAE,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAA;QAChD,IAAI,MAAM,EAAE,IAAI;YAAE,KAAK,CAAC,IAAI,GAAG,MAAM,CAAC,IAAI,CAAA;QAC1C,IAAI,MAAM,EAAE,KAAK;YAAE,KAAK,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAA;QAC7C,IAAI,MAAM,EAAE,UAAU;YAAE,KAAK,CAA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,+BAA+B;IAC/B,KAAK,CAAC,YAAY,CAChB,GAAW,EACX,OAA+C;QAE/C,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,GAAG,OAAO,EAAE;YACxC,OAAO,EAAE,OAAO,EAAE,OAAO;YACzB,MAAM,EAAE,OAAO,EAAE,MAAM;SACxB,CAAC,CAAA;IACJ,CAAC;IAED,uCAAuC;IACvC,KAAK,CAAC,IAAI,CACR,GAAW,EACX,EAAU,EACV,OAA6C;QAE7C,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,OAAO,EAAE;YACzC,EAAE;YACF,IAAI,EAAE,OAAO,EAAE,IAAI;YACnB,OAAO,EAAE,OAAO,EAAE,OAAO;SAC1B,CAAC,CAAA;IACJ,CAAC;IAED,uBAAuB;IACvB,KAAK,CAAC,MAAM,CACV,GAAW,EACX,OAA+C;QAE/C,MAAM,KAAK,GAA4B,EAAE,CAAA;QACzC,IAAI,OAAO,EAAE,OAAO;YAAE,KAAK,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAA;QACrD,IAAI,OAAO,EAAE,MAAM;YAAE,KAAK,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,CAAA;QAClD,MAAM,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,GAAG,EAAE,EAAE,KAAK,CAAC,CAAA;IAC7C,CAAC;CACF;AA1FD,sBA0FC"}
@@ -0,0 +1,9 @@
1
+ import type { HttpClient } from "../http";
2
+ import type { MailboxUser } from "../types";
3
+ export declare class Mailboxes {
4
+ private http;
5
+ constructor(http: HttpClient);
6
+ /** List all mailbox accounts for the company */
7
+ list(): Promise<MailboxUser[]>;
8
+ }
9
+ //# sourceMappingURL=mailboxes.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mailboxes.d.ts","sourceRoot":"","sources":["../../src/resources/mailboxes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,UAAU,CAAA;AAE3C,qBAAa,SAAS;IACR,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAEpC,gDAAgD;IAC1C,IAAI,IAAI,OAAO,CAAC,WAAW,EAAE,CAAC;CAGrC"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Mailboxes = void 0;
4
+ class Mailboxes {
5
+ http;
6
+ constructor(http) {
7
+ this.http = http;
8
+ }
9
+ /** List all mailbox accounts for the company */
10
+ async list() {
11
+ return this.http.get("/mailboxes");
12
+ }
13
+ }
14
+ exports.Mailboxes = Mailboxes;
15
+ //# sourceMappingURL=mailboxes.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mailboxes.js","sourceRoot":"","sources":["../../src/resources/mailboxes.ts"],"names":[],"mappings":";;;AAGA,MAAa,SAAS;IACA;IAApB,YAAoB,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAExC,gDAAgD;IAChD,KAAK,CAAC,IAAI;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAgB,YAAY,CAAC,CAAA;IACnD,CAAC;CACF;AAPD,8BAOC"}
@@ -0,0 +1,9 @@
1
+ import type { HttpClient } from "../http";
2
+ import type { SendParams, SendResult } from "../types";
3
+ export declare class Send {
4
+ private http;
5
+ constructor(http: HttpClient);
6
+ /** Send an email */
7
+ email(params: SendParams): Promise<SendResult>;
8
+ }
9
+ //# sourceMappingURL=send.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../src/resources/send.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,UAAU,CAAA;AAEtD,qBAAa,IAAI;IACH,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAEpC,oBAAoB;IACd,KAAK,CAAC,MAAM,EAAE,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;CAGrD"}
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Send = void 0;
4
+ class Send {
5
+ http;
6
+ constructor(http) {
7
+ this.http = http;
8
+ }
9
+ /** Send an email */
10
+ async email(params) {
11
+ return this.http.post("/send", params);
12
+ }
13
+ }
14
+ exports.Send = Send;
15
+ //# sourceMappingURL=send.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"send.js","sourceRoot":"","sources":["../../src/resources/send.ts"],"names":[],"mappings":";;;AAGA,MAAa,IAAI;IACK;IAApB,YAAoB,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAExC,oBAAoB;IACpB,KAAK,CAAC,KAAK,CAAC,MAAkB;QAC5B,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,CAAa,OAAO,EAAE,MAAM,CAAC,CAAA;IACpD,CAAC;CACF;AAPD,oBAOC"}
@@ -0,0 +1,11 @@
1
+ import type { HttpClient } from "../http";
2
+ import type { Template } from "../types";
3
+ export declare class Templates {
4
+ private http;
5
+ constructor(http: HttpClient);
6
+ /** List all templates */
7
+ list(): Promise<Template[]>;
8
+ /** Get a single template by ID */
9
+ get(id: string): Promise<Template>;
10
+ }
11
+ //# sourceMappingURL=templates.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/resources/templates.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAA;AACzC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAA;AAExC,qBAAa,SAAS;IACR,OAAO,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAEpC,yBAAyB;IACnB,IAAI,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;IAIjC,kCAAkC;IAC5B,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC;CAGzC"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Templates = void 0;
4
+ class Templates {
5
+ http;
6
+ constructor(http) {
7
+ this.http = http;
8
+ }
9
+ /** List all templates */
10
+ async list() {
11
+ return this.http.get("/templates");
12
+ }
13
+ /** Get a single template by ID */
14
+ async get(id) {
15
+ return this.http.get(`/templates/${encodeURIComponent(id)}`);
16
+ }
17
+ }
18
+ exports.Templates = Templates;
19
+ //# sourceMappingURL=templates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/resources/templates.ts"],"names":[],"mappings":";;;AAGA,MAAa,SAAS;IACA;IAApB,YAAoB,IAAgB;QAAhB,SAAI,GAAJ,IAAI,CAAY;IAAG,CAAC;IAExC,yBAAyB;IACzB,KAAK,CAAC,IAAI;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAa,YAAY,CAAC,CAAA;IAChD,CAAC;IAED,kCAAkC;IAClC,KAAK,CAAC,GAAG,CAAC,EAAU;QAClB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAW,cAAc,kBAAkB,CAAC,EAAE,CAAC,EAAE,CAAC,CAAA;IACxE,CAAC;CACF;AAZD,8BAYC"}
@@ -0,0 +1,130 @@
1
+ export interface SentroyClientConfig {
2
+ /** Sentroy instance base URL (e.g. "https://sentroy.com") */
3
+ baseUrl: string;
4
+ /** Company slug */
5
+ companySlug: string;
6
+ /** Access token (stk_...) */
7
+ accessToken: string;
8
+ /** Request timeout in milliseconds (default: 30000) */
9
+ timeout?: number;
10
+ }
11
+ export interface ApiResponse<T> {
12
+ data: T;
13
+ error?: string;
14
+ }
15
+ export interface Domain {
16
+ id: string;
17
+ domain: string;
18
+ status: "pending" | "verifying" | "active" | "failed";
19
+ spfVerified: boolean;
20
+ dkimVerified: boolean;
21
+ dmarcVerified: boolean;
22
+ createdAt: string;
23
+ updatedAt: string;
24
+ }
25
+ export interface MailboxUser {
26
+ email: string;
27
+ domain: string;
28
+ username: string;
29
+ }
30
+ export type LocalizedString = string | Record<string, string>;
31
+ export interface Template {
32
+ id: string;
33
+ name: LocalizedString;
34
+ subject: LocalizedString;
35
+ mjmlBody: LocalizedString;
36
+ htmlBody?: LocalizedString;
37
+ variables?: string[];
38
+ domainId?: string;
39
+ domainName?: string;
40
+ createdAt: string;
41
+ updatedAt: string;
42
+ }
43
+ export interface MessageAddress {
44
+ name: string;
45
+ address: string;
46
+ }
47
+ export interface MessageSummary {
48
+ uid: number;
49
+ subject: string;
50
+ from: MessageAddress;
51
+ to: MessageAddress[];
52
+ date: string;
53
+ seen: boolean;
54
+ flagged: boolean;
55
+ size: number;
56
+ hasAttachments: boolean;
57
+ preview: string;
58
+ messageId: string | null;
59
+ inReplyTo: string | null;
60
+ category: string;
61
+ }
62
+ export interface MessageDetail {
63
+ uid: number;
64
+ subject: string;
65
+ from: MessageAddress;
66
+ to: MessageAddress[];
67
+ cc: MessageAddress[];
68
+ replyTo: MessageAddress | null;
69
+ date: string;
70
+ seen: boolean;
71
+ flagged: boolean;
72
+ textBody: string | null;
73
+ htmlBody: string | null;
74
+ attachments: AttachmentInfo[];
75
+ headers: Record<string, string>;
76
+ messageId: string | null;
77
+ inReplyTo: string | null;
78
+ references: string[];
79
+ folder?: string;
80
+ }
81
+ export interface AttachmentInfo {
82
+ partId: string;
83
+ filename: string;
84
+ size: number;
85
+ contentType: string;
86
+ contentId: string | null;
87
+ }
88
+ export interface Mailbox {
89
+ name: string;
90
+ path: string;
91
+ specialUse: string | null;
92
+ totalMessages: number;
93
+ unreadMessages: number;
94
+ }
95
+ export interface InboxListParams {
96
+ mailbox?: string;
97
+ folder?: string;
98
+ page?: number;
99
+ limit?: number;
100
+ unreadOnly?: boolean;
101
+ }
102
+ export interface Attachment {
103
+ filename: string;
104
+ content: string;
105
+ contentType?: string;
106
+ }
107
+ export interface SendParams {
108
+ to: string | string[];
109
+ from: string;
110
+ subject: string;
111
+ domainId: string;
112
+ cc?: string | string[];
113
+ templateId?: string;
114
+ html?: string;
115
+ text?: string;
116
+ variables?: Record<string, string>;
117
+ replyTo?: string;
118
+ attachments?: Attachment[];
119
+ scheduledAt?: string;
120
+ headers?: Record<string, string>;
121
+ inReplyTo?: string;
122
+ references?: string[];
123
+ }
124
+ export interface SendResult {
125
+ jobId: string;
126
+ mailLogId: string;
127
+ status: string;
128
+ scheduledAt?: string;
129
+ }
130
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,mBAAmB;IAClC,6DAA6D;IAC7D,OAAO,EAAE,MAAM,CAAA;IACf,mBAAmB;IACnB,WAAW,EAAE,MAAM,CAAA;IACnB,6BAA6B;IAC7B,WAAW,EAAE,MAAM,CAAA;IACnB,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB;AAID,MAAM,WAAW,WAAW,CAAC,CAAC;IAC5B,IAAI,EAAE,CAAC,CAAA;IACP,KAAK,CAAC,EAAE,MAAM,CAAA;CACf;AAID,MAAM,WAAW,MAAM;IACrB,EAAE,EAAE,MAAM,CAAA;IACV,MAAM,EAAE,MAAM,CAAA;IACd,MAAM,EAAE,SAAS,GAAG,WAAW,GAAG,QAAQ,GAAG,QAAQ,CAAA;IACrD,WAAW,EAAE,OAAO,CAAA;IACpB,YAAY,EAAE,OAAO,CAAA;IACrB,aAAa,EAAE,OAAO,CAAA;IACtB,SAAS,EAAE,MAAM,CAAA;IACjB,SAAS,EAAE,MAAM,CAAA;CAClB;AAID,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAA;IACb,MAAM,EAAE,MAAM,CAAA;IACd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,CAAA;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,MAAM,CAAA;IACf,QAAQ,EAAE,MAAM,CAAA;IAChB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAA;IACtB,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAClC,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,WAAW,CAAC,EAAE,UAAU,EAAE,CAAA;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;IAChC,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAA;CACtB;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAA;IACb,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB"}
package/dist/types.js ADDED
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+ // ── Configuration ──────────────────────────────────────────────────────────
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA,8EAA8E"}
package/package.json ADDED
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "@sentroy-co/client-sdk",
3
+ "version": "1.1.0",
4
+ "description": "Server-side TypeScript SDK for Sentroy platform API",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "dist"
9
+ ],
10
+ "scripts": {
11
+ "build": "tsc",
12
+ "prepublishOnly": "npm run build"
13
+ },
14
+ "keywords": [
15
+ "sentroy",
16
+ "email",
17
+ "sdk",
18
+ "api",
19
+ "mail",
20
+ "typescript"
21
+ ],
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/Sentroy-Co/client-sdk.git",
25
+ "directory": "typescript"
26
+ },
27
+ "homepage": "https://github.com/Sentroy-Co/client-sdk#readme",
28
+ "bugs": {
29
+ "url": "https://github.com/Sentroy-Co/client-sdk/issues"
30
+ },
31
+ "license": "MIT",
32
+ "engines": {
33
+ "node": ">=18.0.0"
34
+ },
35
+ "devDependencies": {
36
+ "@types/node": "^25.6.0",
37
+ "typescript": "^5.5.4"
38
+ }
39
+ }