migma 1.3.1 → 1.3.2

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 CHANGED
@@ -27,7 +27,7 @@ const { data: project } = await migma.projects.importAndWait({
27
27
  urls: ['https://yourcompany.com'],
28
28
  });
29
29
 
30
- // Generate an email design with AI — returns the finished HTML directly
30
+ // Generate an email design with AI — returns the finished HTML directly.
31
31
  const { data: email } = await migma.emails.generateAndWait({
32
32
  projectId: project.projectId,
33
33
  prompt: 'Create a welcome email for new subscribers',
@@ -35,7 +35,8 @@ const { data: email } = await migma.emails.generateAndWait({
35
35
 
36
36
  if (email?.status === 'completed') {
37
37
  console.log('Subject:', email.result.subject);
38
- console.log('HTML:', email.result.html); // production-ready HTML
38
+ console.log('HTML:', email.result.html); // primary email HTML
39
+ console.log('Artifact:', email.result.emails[0].artifactId);
39
40
  }
40
41
  ```
41
42
 
@@ -63,18 +64,22 @@ const { data: email } = await migma.emails.generateAndWait({
63
64
  prompt: 'Create a summer sale email with 30% off everything',
64
65
  });
65
66
 
66
- // 3. Send it — conversationId works for single-email conversations
67
+ if (!email?.result) throw new Error('Email generation failed');
68
+
69
+ // 3. Send it — artifactId works for single emails and series slots
70
+ const selectedEmail = email.result.emails[0];
71
+ if (!selectedEmail.artifactId) throw new Error('No artifactId returned');
67
72
  await migma.sending.send({
68
73
  recipientType: 'email',
69
74
  recipientEmail: 'sarah@example.com',
70
75
  from: 'hello@yourcompany.migma.email',
71
76
  fromName: 'Your Company',
72
- subject: email.result.subject,
73
- conversationId: email.conversationId,
77
+ subject: selectedEmail.subject,
78
+ artifactId: selectedEmail.artifactId,
74
79
  });
75
80
 
76
- // For multi-slot emails or series, use the selected slot's artifactId instead.
77
- // Copy it from Publish -> Send via API in the app.
81
+ // conversationId also works for single-email conversations.
82
+ // For multi-slot emails or series, use result.emails[].artifactId.
78
83
  ```
79
84
 
80
85
  [Full OpenClaw tutorial](https://docs.migma.ai/tutorials/send-emails-from-openclaw)
@@ -92,7 +97,7 @@ await migma.sending.send({
92
97
 
93
98
  ## Features
94
99
 
95
- - Full coverage of all Migma API v1 endpoints (80+ methods across 14 resources)
100
+ - Full coverage of all Migma API v1 endpoints (80+ methods across 15 resources)
96
101
  - TypeScript-first with complete type definitions
97
102
  - `{ data, error }` return pattern — methods never throw
98
103
  - Automatic retries with exponential backoff on 5xx/429
@@ -223,25 +228,23 @@ const { data: result } = await migma.contacts.bulkImport({
223
228
  Send to a single recipient, segment, tag, or full audience.
224
229
 
225
230
  ```typescript
226
- // Send a single-email conversation by conversationId
231
+ // Send a generated email by artifactId
227
232
  await migma.sending.send({
228
233
  recipientType: 'email',
229
234
  recipientEmail: 'user@example.com',
230
235
  from: 'hello@yourdomain.com',
231
236
  fromName: 'Your Company',
232
237
  subject: 'Welcome!',
233
- conversationId: 'conv_abc123',
238
+ artifactId: 'artifact_abc123',
234
239
  });
235
240
 
236
- // For a multi-slot conversation or series, send one slot by artifactId.
237
- // In the app, open the focused slot and use Publish -> Send via API to copy it.
241
+ // Single-email conversations can also be sent by conversationId.
238
242
  await migma.sending.send({
239
243
  recipientType: 'email',
240
244
  recipientEmail: 'user@example.com',
241
245
  from: 'hello@yourdomain.com',
242
246
  fromName: 'Your Company',
243
247
  subject: 'Welcome!',
244
- artifactId: 'artifact_abc123',
245
248
  conversationId: 'conv_abc123',
246
249
  });
247
250
 
@@ -252,7 +255,7 @@ await migma.sending.send({
252
255
  from: 'hello@yourdomain.com',
253
256
  fromName: 'Your Company',
254
257
  subject: 'Big Announcement',
255
- conversationId: 'conv_abc123',
258
+ artifactId: 'artifact_abc123',
256
259
  });
257
260
 
258
261
  // Single sends are automatically transactional — no flag needed
@@ -270,6 +273,33 @@ await migma.sending.send({
270
273
 
271
274
  [Sending API Reference](https://docs.migma.ai/api-reference/sending/send-email)
272
275
 
276
+ ### Generated Series and Editing
277
+
278
+ Generate a series with `count`, then use each email's `artifactId` to fetch, compile, update, or send one slot.
279
+
280
+ ```typescript
281
+ const { data: series } = await migma.emails.generateAndWait({
282
+ projectId: 'proj_abc123',
283
+ prompt: 'Create a three-email onboarding series',
284
+ count: 3,
285
+ });
286
+
287
+ for (const generated of series?.result?.emails ?? []) {
288
+ console.log(generated.slot, generated.artifactId, generated.html);
289
+ }
290
+
291
+ const { data: email } = await migma.emails.get('artifact_abc123');
292
+ if (!email?.source) throw new Error('Editable source unavailable');
293
+
294
+ await migma.emails.compile('artifact_abc123', {
295
+ source: email.source.replace('Start now', 'Start your trial'),
296
+ });
297
+
298
+ await migma.emails.update('artifact_abc123', {
299
+ source: email.source.replace('Start now', 'Start your trial'),
300
+ });
301
+ ```
302
+
273
303
  ### Email Validation
274
304
 
275
305
  Run preflight checks — compatibility, links, spelling, and deliverability.
package/dist/index.d.mts CHANGED
@@ -243,7 +243,6 @@ declare class Tags {
243
243
 
244
244
  interface SegmentFilters {
245
245
  tags?: string[];
246
- excludeTags?: string[];
247
246
  status?: 'subscribed' | 'unsubscribed' | 'non-subscribed' | 'bounced';
248
247
  customFields?: Record<string, string[]>;
249
248
  }
@@ -477,24 +476,6 @@ interface RetryImportResponse {
477
476
  status: string;
478
477
  message: string;
479
478
  }
480
- type FieldCatalogValueType = 'string' | 'number' | 'boolean' | 'date' | 'url' | 'unknown';
481
- interface FieldCatalogEntry {
482
- key: string;
483
- label: string;
484
- type: FieldCatalogValueType;
485
- fillRate: number;
486
- sample: string[];
487
- auto: boolean;
488
- }
489
- interface FieldCatalogResponse {
490
- entries: FieldCatalogEntry[];
491
- totalSubscribers: number;
492
- computedAt: string;
493
- }
494
- interface FieldCatalogParams {
495
- segmentId?: string;
496
- tag?: string;
497
- }
498
479
 
499
480
  interface PollingOptions {
500
481
  /** Polling interval in ms. Default: 2000 */
@@ -521,12 +502,6 @@ declare class Projects {
521
502
  import(params: ImportProjectParams): Promise<MigmaResult<ImportProjectResponse>>;
522
503
  getImportStatus(projectId: string): Promise<MigmaResult<ImportStatusResponse>>;
523
504
  retryImport(projectId: string): Promise<MigmaResult<RetryImportResponse>>;
524
- /**
525
- * Get the project's subscriber field catalog: which fields exist, how often
526
- * each is populated, example values, and whether it's auto-filled at send
527
- * time. Optionally scope by segment or tag.
528
- */
529
- fieldCatalog(projectId: string, params?: FieldCatalogParams): Promise<MigmaResult<FieldCatalogResponse>>;
530
505
  /**
531
506
  * Import a project and wait for completion.
532
507
  * Polls getImportStatus until status is 'active' or 'error'.
@@ -549,17 +524,28 @@ interface GenerateEmailParams {
549
524
  languages?: string[];
550
525
  visibility?: 'private' | 'unlisted' | 'public';
551
526
  referenceId?: string;
527
+ /** Optional target email count. Omit to let Migma infer single vs series from the prompt. */
528
+ count?: number;
552
529
  }
553
530
  interface GenerateEmailResponse {
554
531
  conversationId: string;
555
532
  status: 'pending';
556
533
  message: string;
557
534
  link: string;
535
+ count?: number;
536
+ referenceId?: string;
558
537
  }
559
538
  interface EmailGenerationResult {
560
539
  subject: string;
561
540
  previewText: string;
562
541
  html: string;
542
+ source?: string;
543
+ emails: GeneratedEmailArtifact[];
544
+ seriesPlan?: {
545
+ name?: string;
546
+ count?: number;
547
+ themeId?: string;
548
+ };
563
549
  screenshotUrl: string | null;
564
550
  screenshotFullUrl: string | null;
565
551
  stats: {
@@ -569,6 +555,22 @@ interface EmailGenerationResult {
569
555
  colors: string[];
570
556
  };
571
557
  languages: string[];
558
+ templateVariables?: unknown[];
559
+ }
560
+ interface GeneratedEmailArtifact {
561
+ artifactId: string | null;
562
+ conversationId: string;
563
+ messageId: string | null;
564
+ slotIdx: number;
565
+ slot: number;
566
+ subject: string;
567
+ preheader: string;
568
+ html: string;
569
+ source?: string;
570
+ sendOffsetDays?: number;
571
+ status: 'ready' | 'processing' | 'failed';
572
+ thumbnailUrl?: string | null;
573
+ templateVariables?: unknown[];
572
574
  }
573
575
  interface EmailGenerationStatus {
574
576
  conversationId: string;
@@ -615,6 +617,40 @@ interface SendTestEmailResponse {
615
617
  sentAt: string;
616
618
  subject: string;
617
619
  }
620
+ interface EmailArtifact {
621
+ artifactId: string;
622
+ conversationId: string;
623
+ messageId: string | null;
624
+ slotIdx: number;
625
+ slotUuid: string | null;
626
+ status: string;
627
+ engine: 'zinn' | 'react-email';
628
+ subject: string;
629
+ preheader: string;
630
+ html: string;
631
+ source?: string;
632
+ templateVariables: unknown[];
633
+ warnings: string[];
634
+ thumbnailUrl: string | null;
635
+ updatedAt: string;
636
+ }
637
+ interface UpdateEmailArtifactParams {
638
+ source: string;
639
+ vars?: Record<string, unknown>;
640
+ lang?: string;
641
+ label?: string;
642
+ }
643
+ interface CompileEmailArtifactParams {
644
+ source?: string;
645
+ vars?: Record<string, unknown>;
646
+ lang?: string;
647
+ }
648
+ interface CompileEmailArtifactResponse {
649
+ artifactId: string;
650
+ html: string;
651
+ warnings: string[];
652
+ metadata?: Record<string, unknown>;
653
+ }
618
654
 
619
655
  declare class Emails {
620
656
  private readonly client;
@@ -625,6 +661,12 @@ declare class Emails {
625
661
  generate(params: GenerateEmailParams): Promise<MigmaResult<GenerateEmailResponse>>;
626
662
  /** Check email generation status */
627
663
  getGenerationStatus(conversationId: string): Promise<MigmaResult<EmailGenerationStatus>>;
664
+ /** Fetch one generated email by artifact id */
665
+ get(artifactId: string): Promise<MigmaResult<EmailArtifact>>;
666
+ /** Replace one generated email's Migma Email source and persist compiled HTML */
667
+ update(artifactId: string, params: UpdateEmailArtifactParams): Promise<MigmaResult<EmailArtifact>>;
668
+ /** Compile an email artifact's source without persisting */
669
+ compile(artifactId: string, params?: CompileEmailArtifactParams): Promise<MigmaResult<CompileEmailArtifactResponse>>;
628
670
  /**
629
671
  * Generate an email and wait for completion.
630
672
  * Polls getGenerationStatus until status is 'completed' or 'failed'.
@@ -1136,8 +1178,6 @@ interface Campaign {
1136
1178
  sentAt?: string | null;
1137
1179
  completedAt?: string | null;
1138
1180
  error?: string | null;
1139
- archived?: boolean;
1140
- archivedAt?: string | null;
1141
1181
  triggeredBy?: 'manual' | 'api' | 'automation';
1142
1182
  createdAt: string;
1143
1183
  updatedAt: string;
@@ -1162,7 +1202,6 @@ interface ListCampaignsParams {
1162
1202
  status?: CampaignStatus;
1163
1203
  page?: number;
1164
1204
  limit?: number;
1165
- archived?: boolean;
1166
1205
  }
1167
1206
  interface ListCampaignsResponse {
1168
1207
  campaigns: Campaign[];
@@ -1182,338 +1221,6 @@ declare class Campaigns {
1182
1221
  send(id: string): Promise<MigmaResult<Campaign>>;
1183
1222
  schedule(id: string, params: ScheduleCampaignParams): Promise<MigmaResult<Campaign>>;
1184
1223
  cancel(id: string): Promise<MigmaResult<Campaign>>;
1185
- archive(id: string): Promise<MigmaResult<Campaign>>;
1186
- unarchive(id: string): Promise<MigmaResult<Campaign>>;
1187
- }
1188
-
1189
- /**
1190
- * Design v2 — SDK types for the `/v1/flows/*` and `/v1/emails/*` REST surface
1191
- * shipped in P5 of the design-v2 plan.
1192
- *
1193
- * Mongo ObjectIds and Dates serialize to JSON strings on the wire, so every
1194
- * id and timestamp on this surface is `string`. These types intentionally do
1195
- * not import from the backend — the SDK is versioned independently and must
1196
- * not take a peer dep on the backend package.
1197
- */
1198
- type FlowStatus = 'draft' | 'generating' | 'ready' | 'archived';
1199
- type EmailStatus = 'pending' | 'streaming' | 'ready' | 'failed' | 'sent';
1200
- type ImageGenMode = 'auto' | 'manual' | 'off';
1201
- type EmailVariableSource = 'persona' | 'manual' | 'system';
1202
- type EmailEditKind = 'chat' | 'visual' | 'tool';
1203
- type ImageJobStatus = 'queued' | 'running' | 'succeeded' | 'failed';
1204
- interface FlowToolPolicy {
1205
- localization: boolean;
1206
- validate: boolean;
1207
- imageGen: ImageGenMode;
1208
- mcpEnabled: {
1209
- shopify: boolean;
1210
- notion: boolean;
1211
- };
1212
- }
1213
- interface FlowReferenceSelection {
1214
- selected: string[];
1215
- autoIncluded: string[];
1216
- }
1217
- interface FlowMeta {
1218
- creditsSpent: number;
1219
- tokensIn: number;
1220
- tokensOut: number;
1221
- model: string;
1222
- }
1223
- interface Flow {
1224
- _id: string;
1225
- userId: string;
1226
- projectId: string;
1227
- title: string;
1228
- goal: string;
1229
- status: FlowStatus;
1230
- emailIds: string[];
1231
- references: FlowReferenceSelection;
1232
- agentSessionId: string | null;
1233
- toolPolicy: FlowToolPolicy;
1234
- meta: FlowMeta;
1235
- createdAt: string;
1236
- updatedAt: string;
1237
- archivedAt?: string;
1238
- }
1239
- interface ListFlowsParams {
1240
- projectId?: string;
1241
- limit?: number;
1242
- cursor?: string;
1243
- }
1244
- interface ListFlowsResponse {
1245
- items: Flow[];
1246
- nextCursor: string | null;
1247
- }
1248
- interface CreateFlowParams {
1249
- projectId: string;
1250
- title?: string;
1251
- description?: string;
1252
- }
1253
- interface FlowPatch {
1254
- title?: string;
1255
- description?: string;
1256
- status?: FlowStatus;
1257
- toolPolicy?: Partial<FlowToolPolicy>;
1258
- references?: {
1259
- selected?: string[];
1260
- autoIncluded?: string[];
1261
- };
1262
- }
1263
- interface DeleteFlowResponse {
1264
- archived: true;
1265
- }
1266
- interface EmailVariable {
1267
- name: string;
1268
- defaultValue: string;
1269
- source: EmailVariableSource;
1270
- required?: boolean;
1271
- }
1272
- interface EmailAsset {
1273
- url: string;
1274
- type: string;
1275
- alt?: string;
1276
- w?: number;
1277
- h?: number;
1278
- sourceTool?: string;
1279
- replicateId?: string;
1280
- }
1281
- interface EmailEdit {
1282
- at: string;
1283
- kind: EmailEditKind;
1284
- summary: string;
1285
- astPatch: Record<string, unknown>;
1286
- }
1287
- interface ImageJob {
1288
- jobId: string;
1289
- status: ImageJobStatus;
1290
- prompt: string;
1291
- replicateUrl?: string;
1292
- finalUrl?: string;
1293
- }
1294
- interface EmailExport {
1295
- at: string;
1296
- format: string;
1297
- platform?: string;
1298
- url?: string;
1299
- }
1300
- interface EmailSend {
1301
- lastSentAt?: string;
1302
- recipients: number;
1303
- esp?: string;
1304
- }
1305
- interface EmailDesign {
1306
- _id: string;
1307
- flowId: string | null;
1308
- userId: string;
1309
- projectId: string;
1310
- index: number;
1311
- title: string;
1312
- subject: string;
1313
- preheader: string;
1314
- /**
1315
- * Internal-only on the backend, but exposed through the REST surface for
1316
- * SDK consumers. Treat as canonical source of truth for the email content.
1317
- */
1318
- zinnSource: string;
1319
- ast: Record<string, unknown>;
1320
- html: string;
1321
- htmlPartial: string | null;
1322
- text: string;
1323
- markdown: string;
1324
- assets: EmailAsset[];
1325
- compatibility: Record<string, unknown>;
1326
- warnings: string[];
1327
- status: EmailStatus;
1328
- agentSessionId: string | null;
1329
- edits: EmailEdit[];
1330
- imageJobs: ImageJob[];
1331
- exports: EmailExport[];
1332
- send: EmailSend;
1333
- variables: EmailVariable[];
1334
- firstCompileAt?: string | null;
1335
- createdAt: string;
1336
- updatedAt: string;
1337
- }
1338
- /**
1339
- * Response envelope from `GET /v1/emails/:id`. Mirrors the backend
1340
- * `EmailWithHistory` shape so callers don't have to make a second call to
1341
- * `history()` for the most recent edit.
1342
- */
1343
- interface EmailWithHistory {
1344
- email: EmailDesign;
1345
- history: {
1346
- count: number;
1347
- latest: EmailEdit | null;
1348
- };
1349
- }
1350
- interface EmailDesignPatch {
1351
- title?: string;
1352
- subject?: string;
1353
- preheader?: string;
1354
- zinnSource?: string;
1355
- status?: EmailStatus;
1356
- }
1357
- interface UpdateEmailParams {
1358
- /** Apply a structured patch to email fields (synchronous). */
1359
- patch?: EmailDesignPatch;
1360
- /**
1361
- * Natural-language instruction routed to the design agent (async). Mutually
1362
- * exclusive with `patch`. The SDK does NOT enforce the exclusion — pass one
1363
- * or the other; passing both makes `instruction` win at the controller.
1364
- */
1365
- instruction?: string;
1366
- }
1367
- interface EmailRevisionRef {
1368
- blobId: string;
1369
- by: 'user' | 'agent';
1370
- summary: string;
1371
- at: string;
1372
- }
1373
- /**
1374
- * One revision returned from `GET /v1/emails/:id/history`. Carries the same
1375
- * payload as `EmailEdit` for now — the backend writes both `flow_emails.edits`
1376
- * (ring buffer, capped at 50) and the design-history store, and the history
1377
- * endpoint reads from the latter. Defined separately so the wire shape can
1378
- * diverge from `edits[]` without a SDK break.
1379
- */
1380
- type EmailRevision = EmailEdit;
1381
- /**
1382
- * Synchronous result of `PATCH /v1/emails/:id` with a `patch` body.
1383
- */
1384
- interface UpdateEmailPatchResult {
1385
- mode: 'patch';
1386
- email: EmailDesign;
1387
- revision: EmailRevisionRef | null;
1388
- }
1389
- /**
1390
- * Async-accepted result of `PATCH /v1/emails/:id` with an `instruction` body.
1391
- * The HTTP layer returns 202 Accepted; the SDK surfaces `status: 202` in the
1392
- * body for symmetry with the spec, even though the SDK does not expose raw
1393
- * HTTP status codes elsewhere.
1394
- *
1395
- * **`sessionId` is a P2 stub.** Until the agent runtime from P2 wires up,
1396
- * the controller returns `stub_p2_<emailId>_<timestamp>` instead of a real
1397
- * session id. Consumers detecting `sessionId.startsWith('stub_p2_')` should
1398
- * display a "pending" indicator and not open an SSE stream until P2 ships.
1399
- */
1400
- interface UpdateEmailInstructionResult {
1401
- mode: 'instruction';
1402
- accepted: true;
1403
- status: 202;
1404
- sessionId: string;
1405
- }
1406
- type EmailUpdateResult = UpdateEmailPatchResult | UpdateEmailInstructionResult;
1407
- interface CompileEmailParams {
1408
- vars?: Record<string, unknown>;
1409
- }
1410
- interface CompileEmailWarning {
1411
- code: string;
1412
- line: number;
1413
- message: string;
1414
- }
1415
- interface CompileEmailResult {
1416
- html: string;
1417
- ms: number;
1418
- warnings: ReadonlyArray<CompileEmailWarning>;
1419
- }
1420
- interface DeleteEmailResponse {
1421
- archived: true;
1422
- }
1423
-
1424
- /**
1425
- * Wraps `/v1/flows/*` — the design-v2 flow CRUD surface (P5).
1426
- *
1427
- * Mounted on `client.design.flows`. Internally the wire path is `/flows/...`
1428
- * (the SDK's base URL already includes the `/v1` prefix).
1429
- */
1430
- declare class FlowsResource {
1431
- private readonly client;
1432
- constructor(client: MigmaClient);
1433
- /** List non-archived flows for the authenticated user. */
1434
- list(params?: ListFlowsParams): Promise<MigmaResult<ListFlowsResponse>>;
1435
- /** Fetch a single flow by id. */
1436
- get(flowId: string): Promise<MigmaResult<Flow>>;
1437
- /** Create a new flow under a project. */
1438
- create(params: CreateFlowParams): Promise<MigmaResult<Flow>>;
1439
- /** Patch a flow (partial fields). */
1440
- update(flowId: string, patch: FlowPatch): Promise<MigmaResult<Flow>>;
1441
- /**
1442
- * Soft-delete a flow. The backend marks `status: 'archived'` so existing
1443
- * email/history references stay resolvable.
1444
- */
1445
- delete(flowId: string): Promise<MigmaResult<DeleteFlowResponse>>;
1446
- /** List the emails that belong to a flow, ordered by `index` ascending. */
1447
- listEmails(flowId: string): Promise<MigmaResult<EmailDesign[]>>;
1448
- }
1449
-
1450
- /**
1451
- * Wraps `/v1/emails/*` — the design-v2 single-email surface (P5).
1452
- *
1453
- * Mounted on `client.design.emails`. Distinct from the legacy `client.emails`
1454
- * resource (which targets `/projects/emails/*` for the generation flow);
1455
- * design v2 owns the `/emails/:id` namespace.
1456
- */
1457
- declare class EmailsResource {
1458
- private readonly client;
1459
- constructor(client: MigmaClient);
1460
- /**
1461
- * Fetch a single email plus a thin history summary (count + latest edit).
1462
- * Mirrors the backend `EmailWithHistory` shape so the common UI case
1463
- * (header chip showing last-edit metadata) avoids a second round trip.
1464
- */
1465
- get(emailId: string): Promise<MigmaResult<EmailWithHistory>>;
1466
- /**
1467
- * Update an email. Two mutually exclusive modes:
1468
- *
1469
- * - `patch`: structured field update (title / subject / preheader /
1470
- * zinnSource / status). Returns the updated email plus the recorded
1471
- * revision (when `zinnSource` changed).
1472
- *
1473
- * - `instruction`: natural-language edit routed to the design agent.
1474
- * Returns `{ mode: 'instruction', accepted: true, status: 202, sessionId }`.
1475
- *
1476
- * **`sessionId` is a P2 stub.** Until the agent runtime ships, the
1477
- * controller returns `stub_p2_<emailId>_<timestamp>`. Consumers that
1478
- * detect `sessionId.startsWith('stub_p2_')` should render a "pending"
1479
- * indicator and not open an SSE stream until P2 lands. The contract
1480
- * (mode/accepted/status/sessionId) will not change when P2 wires real
1481
- * sessions — only the id format will.
1482
- */
1483
- update(emailId: string, body: UpdateEmailParams): Promise<MigmaResult<EmailUpdateResult>>;
1484
- /**
1485
- * Soft-delete an email. The backend flips `status: 'failed'` so revert and
1486
- * history endpoints still resolve. The response is `{ archived: true }`
1487
- * for symmetry with `FlowsResource.delete`.
1488
- */
1489
- delete(emailId: string): Promise<MigmaResult<DeleteEmailResponse>>;
1490
- /** Compile an email's zinn source to HTML, optionally supplying merge vars. */
1491
- compile(emailId: string, opts?: CompileEmailParams): Promise<MigmaResult<CompileEmailResult>>;
1492
- /** List the email's full edit history (capped server-side). */
1493
- history(emailId: string): Promise<MigmaResult<EmailRevision[]>>;
1494
- /**
1495
- * Revert an email to a prior revision. Re-compiles and returns the fresh
1496
- * `CompileEmailResult`; the server also writes a new history entry tagged
1497
- * "Reverted to <blobId>".
1498
- */
1499
- revert(emailId: string, rev: string): Promise<MigmaResult<CompileEmailResult>>;
1500
- }
1501
-
1502
- /**
1503
- * Namespace wrapper exposing the design-v2 surface (P5) under `client.design`.
1504
- *
1505
- * Sub-resources are instantiated eagerly — same pattern as every other
1506
- * resource on the `Migma` client, keeps the public surface side-effect-free
1507
- * at module-load time and avoids per-call allocation.
1508
- *
1509
- * Naming: internally the wire path is `/v1/flows/*` (matches DB + REST), but
1510
- * the user-facing SDK surface is `client.design.flows` / `client.design.emails`
1511
- * so call sites read naturally for design tooling.
1512
- */
1513
- declare class DesignResource {
1514
- readonly flows: FlowsResource;
1515
- readonly emails: EmailsResource;
1516
- constructor(client: MigmaClient);
1517
1224
  }
1518
1225
 
1519
1226
  interface MigmaConfig {
@@ -1541,8 +1248,7 @@ declare class Migma {
1541
1248
  readonly knowledgeBase: KnowledgeBase;
1542
1249
  readonly images: Images;
1543
1250
  readonly campaigns: Campaigns;
1544
- readonly design: DesignResource;
1545
1251
  constructor(apiKey: string, config?: MigmaConfig);
1546
1252
  }
1547
1253
 
1548
- export { type AddImageParams, type AddKnowledgeBaseParams, type AnalyzeDeliverabilityParams, type AnalyzeLinksParams, type ApiResponse, type BatchStatus, type BulkImportAsyncResponse, type BulkImportContactItem, type BulkImportJobStatus, type BulkImportParams, type BulkImportResponse, type BulkImportSyncResponse, type Campaign, type CampaignStatus, type ChangeStatusParams, type CheckCompatibilityParams, type CheckSpellingParams, type CheckedLink, type ClientConfig, type CompatibilityResponse, type CompileEmailParams, type CompileEmailResult, type CompileEmailWarning, type Contact, type ContactStatus, type CreateCampaignParams, type CreateContactParams, type CreateDomainParams, type CreateFlowParams, type CreateManagedDomainParams, type CreatePreviewParams, type CreatePreviewResponse, type CreateSegmentParams, type CreateTagParams, type CreateTopicParams, type CreateWebhookParams, type DeleteEmailResponse, type DeleteFlowResponse, type DeleteResponse, type DeliverabilityResponse, DesignResource, type DeviceCategoriesResponse, type DnsRecord, type Domain, type DomainAvailability, type DomainDeleteResponse, type DomainVerificationResult, type EmailAsset, type EmailDesign, type EmailDesignPatch, type EmailEdit, type EmailEditKind, type EmailExport, type EmailGenerationResult, type EmailGenerationStatus, type EmailImage, type EmailRevision, type EmailRevisionRef, type EmailSend, type EmailStatus, type EmailUpdateResult, type EmailVariable, type EmailVariableSource, type EmailWithHistory, EmailsResource, type ExportFile, type ExportFormat, type ExportFormatsResponse, type ExportResult, type ExportStatusResponse, type FieldCatalogEntry, type FieldCatalogParams, type FieldCatalogResponse, type FieldCatalogValueType, type Flow, type FlowMeta, type FlowPatch, type FlowReferenceSelection, type FlowStatus, type FlowToolPolicy, FlowsResource, type GenerateEmailParams, type GenerateEmailResponse, type GetDevicePreviewResponse, type GetPreviewResponse, type GetPreviewStatusResponse, type GetSupportedDevicesResponse, type HubspotExportParams, type ImageGenMode, type ImageJob, type ImageJobStatus, type ImportProjectParams, type ImportProjectResponse, type ImportStatusResponse, type KnowledgeBaseEntry, type KnowledgeBaseListResponse, type LinkAnalysisResponse, type ListCampaignsParams, type ListCampaignsResponse, type ListContactsParams, type ListContactsResponse, type ListEmailsEmail, type ListEmailsParams, type ListEmailsResponse, type ListFlowsParams, type ListFlowsResponse, type ListProjectsParams, type ListProjectsResponse, type ListSegmentsResponse, type ListTagsParams, type ListTagsResponse, type ListTopicsParams, type ListTopicsResponse, type ListWebhooksResponse, type LogosResponse, type MessageResponse, Migma, MigmaClient, type MigmaConfig, MigmaError, MigmaErrorCode, type MigmaResult, type PollingOptions, type PreviewDevice, type PreviewDeviceCategory, type PreviewDeviceStatus, type PreviewMetadata, type PreviewStatus, type Project, type ProjectImage, type ProviderType, type RecipientType, type RetryImportResponse, type ScheduleCampaignParams, type Segment, type SegmentFilters, type SendEmailParams, type SendEmailResponse, type SendTestEmailParams, type SendTestEmailResponse, type SpellingResponse, type SupportedDevice, type Tag, type Topic, type TopicSubscriptionParams, type TopicSubscriptionResponse, type UpdateContactParams, type UpdateDomainParams, type UpdateEmailInstructionResult, type UpdateEmailParams, type UpdateEmailPatchResult, type UpdateImageParams, type UpdateKnowledgeBaseParams, type UpdateLogosParams, type UpdateSegmentParams, type UpdateTagParams, type UpdateTopicParams, type UpdateWebhookParams, type ValidateAllParams, type ValidateAllResponse, type Webhook, type WebhookDeliveriesResponse, type WebhookDelivery, type WebhookDetail, type WebhookEvent, type WebhookEventType, type WebhookEventsResponse, type WebhookTestResult, poll };
1254
+ export { type AddImageParams, type AddKnowledgeBaseParams, type AnalyzeDeliverabilityParams, type AnalyzeLinksParams, type ApiResponse, type BatchStatus, type BulkImportAsyncResponse, type BulkImportContactItem, type BulkImportJobStatus, type BulkImportParams, type BulkImportResponse, type BulkImportSyncResponse, type Campaign, type CampaignStatus, type ChangeStatusParams, type CheckCompatibilityParams, type CheckSpellingParams, type CheckedLink, type ClientConfig, type CompatibilityResponse, type CompileEmailArtifactParams, type CompileEmailArtifactResponse, type Contact, type ContactStatus, type CreateCampaignParams, type CreateContactParams, type CreateDomainParams, type CreateManagedDomainParams, type CreatePreviewParams, type CreatePreviewResponse, type CreateSegmentParams, type CreateTagParams, type CreateTopicParams, type CreateWebhookParams, type DeleteResponse, type DeliverabilityResponse, type DeviceCategoriesResponse, type DnsRecord, type Domain, type DomainAvailability, type DomainDeleteResponse, type DomainVerificationResult, type EmailArtifact, type EmailGenerationResult, type EmailGenerationStatus, type EmailImage, type ExportFile, type ExportFormat, type ExportFormatsResponse, type ExportResult, type ExportStatusResponse, type GenerateEmailParams, type GenerateEmailResponse, type GeneratedEmailArtifact, type GetDevicePreviewResponse, type GetPreviewResponse, type GetPreviewStatusResponse, type GetSupportedDevicesResponse, type HubspotExportParams, type ImportProjectParams, type ImportProjectResponse, type ImportStatusResponse, type KnowledgeBaseEntry, type KnowledgeBaseListResponse, type LinkAnalysisResponse, type ListCampaignsParams, type ListCampaignsResponse, type ListContactsParams, type ListContactsResponse, type ListEmailsEmail, type ListEmailsParams, type ListEmailsResponse, type ListProjectsParams, type ListProjectsResponse, type ListSegmentsResponse, type ListTagsParams, type ListTagsResponse, type ListTopicsParams, type ListTopicsResponse, type ListWebhooksResponse, type LogosResponse, type MessageResponse, Migma, MigmaClient, type MigmaConfig, MigmaError, MigmaErrorCode, type MigmaResult, type PollingOptions, type PreviewDevice, type PreviewDeviceCategory, type PreviewDeviceStatus, type PreviewMetadata, type PreviewStatus, type Project, type ProjectImage, type ProviderType, type RecipientType, type RetryImportResponse, type ScheduleCampaignParams, type Segment, type SegmentFilters, type SendEmailParams, type SendEmailResponse, type SendTestEmailParams, type SendTestEmailResponse, type SpellingResponse, type SupportedDevice, type Tag, type Topic, type TopicSubscriptionParams, type TopicSubscriptionResponse, type UpdateContactParams, type UpdateDomainParams, type UpdateEmailArtifactParams, type UpdateImageParams, type UpdateKnowledgeBaseParams, type UpdateLogosParams, type UpdateSegmentParams, type UpdateTagParams, type UpdateTopicParams, type UpdateWebhookParams, type ValidateAllParams, type ValidateAllResponse, type Webhook, type WebhookDeliveriesResponse, type WebhookDelivery, type WebhookDetail, type WebhookEvent, type WebhookEventType, type WebhookEventsResponse, type WebhookTestResult, poll };