@hermeticacomms/sdk-node 0.0.0-stage → 0.4.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.
Files changed (73) hide show
  1. package/LICENSE +9 -0
  2. package/README.md +12 -2
  3. package/dist/contracts/analytics.d.ts +405 -0
  4. package/dist/contracts/analytics.js +77 -0
  5. package/dist/contracts/auth.d.ts +363 -0
  6. package/dist/contracts/auth.js +130 -0
  7. package/dist/contracts/billing.d.ts +143 -0
  8. package/dist/contracts/billing.js +32 -0
  9. package/dist/contracts/campaigns.d.ts +915 -0
  10. package/dist/contracts/campaigns.js +276 -0
  11. package/dist/contracts/common.d.ts +57 -0
  12. package/dist/contracts/common.js +35 -0
  13. package/dist/contracts/connectors.d.ts +179 -0
  14. package/dist/contracts/connectors.js +46 -0
  15. package/dist/contracts/consent.d.ts +628 -0
  16. package/dist/contracts/consent.js +194 -0
  17. package/dist/contracts/content-blocks.d.ts +165 -0
  18. package/dist/contracts/content-blocks.js +62 -0
  19. package/dist/contracts/content-library.d.ts +347 -0
  20. package/dist/contracts/content-library.js +52 -0
  21. package/dist/contracts/content.d.ts +955 -0
  22. package/dist/contracts/content.js +194 -0
  23. package/dist/contracts/delivery.d.ts +602 -0
  24. package/dist/contracts/delivery.js +220 -0
  25. package/dist/contracts/events.d.ts +514 -0
  26. package/dist/contracts/events.js +180 -0
  27. package/dist/contracts/experiments.d.ts +378 -0
  28. package/dist/contracts/experiments.js +140 -0
  29. package/dist/contracts/identity.d.ts +761 -0
  30. package/dist/contracts/identity.js +226 -0
  31. package/dist/contracts/index.d.ts +15 -0
  32. package/dist/contracts/index.js +15 -0
  33. package/dist/contracts/integrations.d.ts +445 -0
  34. package/dist/contracts/integrations.js +139 -0
  35. package/dist/contracts/leads.d.ts +733 -0
  36. package/dist/contracts/leads.js +125 -0
  37. package/dist/contracts/metrics.d.ts +465 -0
  38. package/dist/contracts/metrics.js +96 -0
  39. package/dist/contracts/outbound.d.ts +15535 -0
  40. package/dist/contracts/outbound.js +432 -0
  41. package/dist/contracts/pickers.d.ts +12 -0
  42. package/dist/contracts/pickers.js +20 -0
  43. package/dist/contracts/platform-admin.d.ts +244 -0
  44. package/dist/contracts/platform-admin.js +98 -0
  45. package/dist/contracts/postcards.d.ts +79 -0
  46. package/dist/contracts/postcards.js +29 -0
  47. package/dist/contracts/push.d.ts +530 -0
  48. package/dist/contracts/push.js +102 -0
  49. package/dist/contracts/rcs.d.ts +39 -0
  50. package/dist/contracts/rcs.js +19 -0
  51. package/dist/contracts/segments.d.ts +3187 -0
  52. package/dist/contracts/segments.js +421 -0
  53. package/dist/contracts/workflow-nodes.d.ts +2130 -0
  54. package/dist/contracts/workflow-nodes.js +346 -0
  55. package/dist/contracts/workflows.d.ts +46811 -0
  56. package/dist/contracts/workflows.js +350 -0
  57. package/dist/contracts/x10-platform.d.ts +2603 -0
  58. package/dist/contracts/x10-platform.js +129 -0
  59. package/dist/http.d.ts +30 -0
  60. package/dist/http.js +65 -0
  61. package/dist/index.d.ts +11631 -0
  62. package/dist/index.js +63 -0
  63. package/dist/platform.d.ts +163 -0
  64. package/dist/platform.js +40 -0
  65. package/dist/resources.d.ts +1338 -0
  66. package/dist/resources.js +56 -0
  67. package/dist/signature.d.ts +5 -0
  68. package/dist/signature.js +19 -0
  69. package/dist/x10.d.ts +1608 -0
  70. package/dist/x10.js +66 -0
  71. package/dist/z10.d.ts +256 -0
  72. package/dist/z10.js +46 -0
  73. package/package.json +40 -4
package/dist/x10.js ADDED
@@ -0,0 +1,66 @@
1
+ const enc = encodeURIComponent;
2
+ /** Agency groups, permission matrix, jobs, budgets, marketing events, company notes/lists and AI bulk jobs. Mutations take `idempotencyKey` through the usual RequestOptions. */
3
+ export function x10Resources(http) {
4
+ const q = (v) => v;
5
+ return {
6
+ agencyGroups: {
7
+ list: () => http('GET', '/v1/agency/groups'),
8
+ create: (body) => http('POST', '/v1/agency/groups', { body }),
9
+ update: (id, body) => http('PUT', `/v1/agency/groups/${enc(id)}`, { body }),
10
+ unlink: (id, workspaceIds) => http('POST', `/v1/agency/groups/${enc(id)}/unlink`, { body: { workspaceIds } }),
11
+ remove: (id) => http('DELETE', `/v1/agency/groups/${enc(id)}`),
12
+ setQuota: (body) => http('PUT', '/v1/agency/quota', { body }),
13
+ /** Mints a key inside a client workspace. Plaintext is returned once. */
14
+ createClientApiKey: (workspaceId, body) => http('POST', `/v1/agency/clients/${enc(workspaceId)}/api-keys`, { body }),
15
+ },
16
+ permissions: {
17
+ matrix: () => http('GET', '/v1/roles/matrix'),
18
+ setRoleMatrix: (roleId, matrix) => http('PUT', `/v1/roles/${enc(roleId)}/matrix`, { body: { matrix } }),
19
+ userGroups: {
20
+ list: () => http('GET', '/v1/user-groups'),
21
+ create: (body) => http('POST', '/v1/user-groups', { body }),
22
+ remove: (id) => http('DELETE', `/v1/user-groups/${enc(id)}`),
23
+ },
24
+ invitations: {
25
+ list: () => http('GET', '/v1/invitations'),
26
+ cancel: (id) => http('DELETE', `/v1/invitations/${enc(id)}`),
27
+ },
28
+ },
29
+ /** Any async job (bulk, export, import, catalog, lead, AI, account export, estimate) by id. */
30
+ jobs: { get: (id) => http('GET', `/v1/jobs/${enc(id)}`) },
31
+ budgets: {
32
+ list: (campaignRef) => http('GET', '/v1/budgets', { query: q({ campaignRef }) }),
33
+ get: (id) => http('GET', `/v1/budgets/${enc(id)}`),
34
+ create: (body) => http('POST', '/v1/budgets', { body }),
35
+ update: (id, body) => http('PATCH', `/v1/budgets/${enc(id)}`, { body }),
36
+ spend: (id) => http('GET', `/v1/budgets/${enc(id)}/spend`),
37
+ addSpend: (id, body, o) => http('POST', `/v1/budgets/${enc(id)}/spend`, { body, ...o }),
38
+ },
39
+ marketingEvents: {
40
+ list: (query = {}) => http('GET', '/v1/marketing-events', { query: q(query) }),
41
+ get: (id) => http('GET', `/v1/marketing-events/${enc(id)}`),
42
+ create: (body) => http('POST', '/v1/marketing-events', { body }),
43
+ update: (id, body) => http('PATCH', `/v1/marketing-events/${enc(id)}`, { body }),
44
+ registrations: (id, query = {}) => http('GET', `/v1/marketing-events/${enc(id)}/registrations`, { query: q(query) }),
45
+ register: (id, emails) => http('POST', `/v1/marketing-events/${enc(id)}/registrations`, { body: { emails } }),
46
+ attendance: (id, body) => http('POST', `/v1/marketing-events/${enc(id)}/attendance`, { body }),
47
+ },
48
+ companies: {
49
+ notes: (id, query = {}) => http('GET', `/v1/leads/companies/${enc(id)}/notes`, { query: q(query) }),
50
+ addNote: (id, body) => http('POST', `/v1/leads/companies/${enc(id)}/notes`, { body }),
51
+ merge: (id, mergeIds) => http('POST', `/v1/leads/companies/${enc(id)}/merge`, { body: { mergeIds } }),
52
+ sourceContacts: (id, body) => http('POST', `/v1/leads/companies/${enc(id)}/source-contacts`, { body }),
53
+ unifyAccounts: () => http('POST', '/v1/leads/companies/unify-accounts'),
54
+ lists: {
55
+ list: () => http('GET', '/v1/leads/company-lists'),
56
+ create: (body) => http('POST', '/v1/leads/company-lists', { body }),
57
+ add: (id, companyIds) => http('POST', `/v1/leads/company-lists/${enc(id)}/companies`, { body: { companyIds } }),
58
+ },
59
+ },
60
+ ai: {
61
+ firstLines: (body) => http('POST', '/v1/ai/bulk/first-lines', { body }),
62
+ job: (id) => http('GET', `/v1/ai/jobs/${enc(id)}`),
63
+ draftSequence: (body) => http('POST', '/v1/ai/sequence-draft', { body }),
64
+ },
65
+ };
66
+ }
package/dist/z10.d.ts ADDED
@@ -0,0 +1,256 @@
1
+ import type { z } from 'zod';
2
+ import type { MemberDto, PlanDto, ShopifyDiscountBody, WarehouseRowsBody, X10AiCustomBody, X10PromptTemplateBody, X10PromptTemplateDto } from './contracts/index.ts';
3
+ import type { createTransport, RequestOptions } from './http.ts';
4
+ type In<S extends z.ZodType> = z.input<S>;
5
+ type Out<S extends z.ZodType> = z.infer<S>;
6
+ /** Team, ownership, billing plans, test mode, AI prompt templates, webhook operations and connector actions. */
7
+ export declare function z10Resources(http: ReturnType<typeof createTransport>): {
8
+ members: {
9
+ list: () => Promise<{
10
+ items: Out<typeof MemberDto>[];
11
+ nextCursor: string | null;
12
+ }>;
13
+ get: (userId: string) => Promise<{
14
+ userId: string;
15
+ email: string;
16
+ name: string;
17
+ role: "admin" | "analyst" | "marketer" | "owner" | "sales" | "viewer";
18
+ listIds?: string[] | null | undefined;
19
+ }>;
20
+ /** Emails the invitee when the server has a platform mailer; the one-time token is returned either way. */
21
+ invite: (email: string, role: Out<typeof MemberDto>['role']) => Promise<{
22
+ id: string;
23
+ email: string;
24
+ role: "admin" | "analyst" | "marketer" | "owner" | "sales" | "viewer";
25
+ token: string;
26
+ expiresAt: string;
27
+ emailed?: boolean | undefined;
28
+ }>;
29
+ resendInvitation: (id: string) => Promise<{
30
+ id: string;
31
+ email: string;
32
+ role: "admin" | "analyst" | "marketer" | "owner" | "sales" | "viewer";
33
+ token: string;
34
+ expiresAt: string;
35
+ emailed?: boolean | undefined;
36
+ }>;
37
+ transferOwnership: (userId: string) => Promise<{
38
+ ok: true;
39
+ }>;
40
+ };
41
+ testMode: {
42
+ get: () => Promise<{
43
+ enabled: boolean;
44
+ }>;
45
+ set: (enabled: boolean) => Promise<{
46
+ enabled: boolean;
47
+ }>;
48
+ };
49
+ billingPlans: {
50
+ list: () => Promise<{
51
+ items: Out<typeof PlanDto>[];
52
+ }>;
53
+ summary: () => Promise<{
54
+ plan: {
55
+ id: string;
56
+ name: string;
57
+ limits: {
58
+ sends_email: number | null;
59
+ sends_sms: number | null;
60
+ sends_whatsapp: number | null;
61
+ sends_push: number | null;
62
+ sends_postcard: number | null;
63
+ ai_tokens: number | null;
64
+ seats: number | null;
65
+ profiles: number | null;
66
+ mailboxes: number | null;
67
+ };
68
+ monthlyUsd: number | null;
69
+ includedProfiles: number | null;
70
+ profileOveragePer1kUsd: number | null;
71
+ };
72
+ status: string;
73
+ period: string;
74
+ currentPeriodEnd: string | null;
75
+ limits: {
76
+ sends_email: number | null;
77
+ sends_sms: number | null;
78
+ sends_whatsapp: number | null;
79
+ sends_push: number | null;
80
+ sends_postcard: number | null;
81
+ ai_tokens: number | null;
82
+ seats: number | null;
83
+ profiles: number | null;
84
+ mailboxes: number | null;
85
+ };
86
+ usage: {
87
+ metric: "ai_tokens" | "profiles" | "sends_email" | "sends_postcard" | "sends_push" | "sends_sms" | "sends_whatsapp";
88
+ used: number;
89
+ limit: number | null;
90
+ softLimit: number | null;
91
+ }[];
92
+ managedByProvider: boolean;
93
+ }>;
94
+ /** Self-hosted servers only; with a billing provider use `checkout`. */
95
+ setPlan: (planId: string) => Promise<{
96
+ plan: {
97
+ id: string;
98
+ name: string;
99
+ limits: {
100
+ sends_email: number | null;
101
+ sends_sms: number | null;
102
+ sends_whatsapp: number | null;
103
+ sends_push: number | null;
104
+ sends_postcard: number | null;
105
+ ai_tokens: number | null;
106
+ seats: number | null;
107
+ profiles: number | null;
108
+ mailboxes: number | null;
109
+ };
110
+ monthlyUsd: number | null;
111
+ includedProfiles: number | null;
112
+ profileOveragePer1kUsd: number | null;
113
+ };
114
+ status: string;
115
+ period: string;
116
+ currentPeriodEnd: string | null;
117
+ limits: {
118
+ sends_email: number | null;
119
+ sends_sms: number | null;
120
+ sends_whatsapp: number | null;
121
+ sends_push: number | null;
122
+ sends_postcard: number | null;
123
+ ai_tokens: number | null;
124
+ seats: number | null;
125
+ profiles: number | null;
126
+ mailboxes: number | null;
127
+ };
128
+ usage: {
129
+ metric: "ai_tokens" | "profiles" | "sends_email" | "sends_postcard" | "sends_push" | "sends_sms" | "sends_whatsapp";
130
+ used: number;
131
+ limit: number | null;
132
+ softLimit: number | null;
133
+ }[];
134
+ managedByProvider: boolean;
135
+ }>;
136
+ checkout: (planId: string, successUrl: string, cancelUrl: string) => Promise<{
137
+ url: string;
138
+ }>;
139
+ };
140
+ aiPrompts: {
141
+ list: (resourceRef?: string) => Promise<{
142
+ items: Out<typeof X10PromptTemplateDto>[];
143
+ }>;
144
+ save: (body: In<typeof X10PromptTemplateBody>, id?: string) => Promise<{
145
+ id: string;
146
+ name: string;
147
+ prompt: string;
148
+ resourceRef: string | null;
149
+ createdAt: string;
150
+ }>;
151
+ remove: (id: string) => Promise<{
152
+ ok: true;
153
+ }>;
154
+ /** Runs your prompt over each row as a background job; poll with `ai.job`. */
155
+ runCustom: (body: In<typeof X10AiCustomBody>) => Promise<{
156
+ id: string;
157
+ kind: "custom" | "first_line";
158
+ status: "done" | "failed" | "queued" | "running";
159
+ total: number;
160
+ processed: number;
161
+ results: {
162
+ key: string;
163
+ text: string | null;
164
+ error?: string | undefined;
165
+ }[];
166
+ model: string | null;
167
+ error: string | null;
168
+ createdAt: string;
169
+ }>;
170
+ };
171
+ webhookOps: {
172
+ resume: (id: string) => Promise<{
173
+ id: string;
174
+ url: string;
175
+ topics: string[];
176
+ description: string | null;
177
+ filters: {
178
+ id?: string | undefined;
179
+ path: string;
180
+ op: "contains" | "eq" | "exists" | "gt" | "in" | "lt" | "neq";
181
+ value?: unknown;
182
+ }[];
183
+ listIds: string[];
184
+ sources: string[];
185
+ sequenceIds: string[];
186
+ bodyTemplate: string | null;
187
+ authHeaders: {
188
+ header: string;
189
+ secretName: string;
190
+ prefix?: string | undefined;
191
+ }[];
192
+ throttleSeconds: number;
193
+ throttleTopics: string[];
194
+ autoDisableAfter: number;
195
+ retryWindowHours: number;
196
+ status: "active" | "disabled";
197
+ app?: string | null | undefined;
198
+ preset?: {
199
+ kind: "watchtower";
200
+ environment: string;
201
+ } | null | undefined;
202
+ consecutiveFailures: number;
203
+ createdAt: string;
204
+ updatedAt: string;
205
+ }>;
206
+ retriggerFailed: (id: string) => Promise<{
207
+ requeued: number;
208
+ }>;
209
+ journal: (query?: {
210
+ after?: number;
211
+ limit?: number;
212
+ endpointId?: string;
213
+ }) => Promise<{
214
+ items: {
215
+ offset: number;
216
+ id: string;
217
+ topic: string;
218
+ createdAt: string;
219
+ data: unknown;
220
+ }[];
221
+ nextOffset: number | null;
222
+ }>;
223
+ journalBounds: () => Promise<{
224
+ earliest: number | null;
225
+ latest: number | null;
226
+ }>;
227
+ summary: (query?: {
228
+ from?: string;
229
+ to?: string;
230
+ }) => Promise<{
231
+ total: number;
232
+ succeeded: number;
233
+ failed: number;
234
+ pending: number;
235
+ avgLatencyMs: number | null;
236
+ }>;
237
+ };
238
+ connectorActions: {
239
+ registerHubspotWebhooks: (connectionId: string) => Promise<{
240
+ registered: boolean;
241
+ }>;
242
+ createShopifyDiscountCodes: (connectionId: string, body: In<typeof ShopifyDiscountBody>, o?: RequestOptions) => Promise<{
243
+ created: number;
244
+ addedToPool: number;
245
+ }>;
246
+ /** Reverse-ETL: upsert profiles and events from warehouse rows. */
247
+ warehouseRows: (body: In<typeof WarehouseRowsBody>, o?: RequestOptions) => Promise<{
248
+ applied: number;
249
+ failed: {
250
+ index: number;
251
+ reason: string;
252
+ }[];
253
+ }>;
254
+ };
255
+ };
256
+ export {};
package/dist/z10.js ADDED
@@ -0,0 +1,46 @@
1
+ const enc = encodeURIComponent;
2
+ /** Team, ownership, billing plans, test mode, AI prompt templates, webhook operations and connector actions. */
3
+ export function z10Resources(http) {
4
+ const q = (v) => v;
5
+ return {
6
+ members: {
7
+ list: () => http('GET', '/v1/members'),
8
+ get: (userId) => http('GET', `/v1/members/${enc(userId)}`),
9
+ /** Emails the invitee when the server has a platform mailer; the one-time token is returned either way. */
10
+ invite: (email, role) => http('POST', '/v1/members', { body: { email, role } }),
11
+ resendInvitation: (id) => http('POST', `/v1/invitations/${enc(id)}/resend`),
12
+ transferOwnership: (userId) => http('POST', '/v1/workspace/transfer-ownership', { body: { userId } }),
13
+ },
14
+ testMode: {
15
+ get: () => http('GET', '/v1/workspace/test-mode'),
16
+ set: (enabled) => http('PUT', '/v1/workspace/test-mode', { body: { enabled } }),
17
+ },
18
+ billingPlans: {
19
+ list: () => http('GET', '/v1/billing/plans'),
20
+ summary: () => http('GET', '/v1/billing'),
21
+ /** Self-hosted servers only; with a billing provider use `checkout`. */
22
+ setPlan: (planId) => http('PUT', '/v1/billing/plan', { body: { planId } }),
23
+ checkout: (planId, successUrl, cancelUrl) => http('POST', '/v1/billing/checkout', { body: { planId, successUrl, cancelUrl } }),
24
+ },
25
+ aiPrompts: {
26
+ list: (resourceRef) => http('GET', '/v1/ai/prompt-templates', { query: q({ resourceRef }) }),
27
+ save: (body, id) => http(id ? 'PUT' : 'POST', id ? `/v1/ai/prompt-templates/${enc(id)}` : '/v1/ai/prompt-templates', { body }),
28
+ remove: (id) => http('DELETE', `/v1/ai/prompt-templates/${enc(id)}`),
29
+ /** Runs your prompt over each row as a background job; poll with `ai.job`. */
30
+ runCustom: (body) => http('POST', '/v1/ai/bulk/custom', { body }),
31
+ },
32
+ webhookOps: {
33
+ resume: (id) => http('POST', `/v1/webhooks/endpoints/${enc(id)}/resume`),
34
+ retriggerFailed: (id) => http('POST', `/v1/webhooks/endpoints/${enc(id)}/retrigger-failed`),
35
+ journal: (query = {}) => http('GET', '/v1/webhooks/journal', { query: q(query) }),
36
+ journalBounds: () => http('GET', '/v1/webhooks/journal/bounds'),
37
+ summary: (query = {}) => http('GET', '/v1/webhooks/summary', { query: q(query) }),
38
+ },
39
+ connectorActions: {
40
+ registerHubspotWebhooks: (connectionId) => http('POST', `/v1/integrations/connections/${enc(connectionId)}/hubspot/webhooks`),
41
+ createShopifyDiscountCodes: (connectionId, body, o) => http('POST', `/v1/integrations/connections/${enc(connectionId)}/shopify/discount-codes`, { body, ...o }),
42
+ /** Reverse-ETL: upsert profiles and events from warehouse rows. */
43
+ warehouseRows: (body, o) => http('POST', '/v1/integrations/warehouse/rows', { body, ...o }),
44
+ },
45
+ };
46
+ }
package/package.json CHANGED
@@ -1,6 +1,42 @@
1
1
  {
2
2
  "name": "@hermeticacomms/sdk-node",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.4.0",
4
+ "description": "Typed Node.js client for the Hermetica API",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/hermeticacomms/hermetica-node.git"
10
+ },
11
+ "homepage": "https://github.com/hermeticacomms/hermetica-node#readme",
12
+ "publishConfig": {
13
+ "access": "public",
14
+ "provenance": true
15
+ },
16
+ "exports": {
17
+ ".": {
18
+ "types": "./dist/index.d.ts",
19
+ "default": "./dist/index.js"
20
+ }
21
+ },
22
+ "files": [
23
+ "dist"
24
+ ],
25
+ "engines": {
26
+ "node": ">=20"
27
+ },
28
+ "scripts": {
29
+ "prepare": "npm run build",
30
+ "build": "tsc -p tsconfig.json",
31
+ "test": "vitest run",
32
+ "typecheck": "tsc -p tsconfig.json --noEmit"
33
+ },
34
+ "dependencies": {
35
+ "zod": "^4.6.7"
36
+ },
37
+ "devDependencies": {
38
+ "@types/node": "^26.6.6",
39
+ "typescript": "^7.0.2",
40
+ "vitest": "^5.0.5"
41
+ }
42
+ }