Skip to content

feat: remove workflows namespace from SDK#898

Open
vcapretz wants to merge 1 commit intopreview-workflowsfrom
cursor/workflows-namespace-removal-6dd9
Open

feat: remove workflows namespace from SDK#898
vcapretz wants to merge 1 commit intopreview-workflowsfrom
cursor/workflows-namespace-removal-6dd9

Conversation

@vcapretz
Copy link
Copy Markdown
Contributor

@vcapretz vcapretz commented Mar 28, 2026

Summary

Removes the duplicate workflows namespace from the SDK. The preview-workflows branch had both workflows and automations namespaces pointing to the same /automations API endpoints. This PR removes the workflows-named duplicate, keeping only automations as the canonical SDK interface.

Changes

Deleted directories

  • src/workflows/Workflows class, all interfaces (CreateWorkflowOptions, GetWorkflow, ListWorkflows, RemoveWorkflow, UpdateWorkflow, WorkflowStep, Workflow), and spec file
  • src/workflow-runs/WorkflowRuns class, all interfaces (GetWorkflowRun, ListWorkflowRuns, WorkflowRun), and spec file
  • src/workflow-run-steps/WorkflowRunSteps class, all interfaces (GetWorkflowRunStep, ListWorkflowRunSteps, WorkflowRunStep), and spec file

Modified files

  • src/resend.ts — Removed Workflows import and readonly workflows property from Resend client
  • src/index.ts — Removed re-exports for workflow-run-steps, workflow-runs, and workflows interfaces
  • src/common/utils/parse-automation-to-api-options.spec.ts — Fixed stale parseWorkflowEventToApiOptions describe name → parseEventToApiOptions, and updated test data name from 'Minimal Workflow' to 'Minimal Automation'

What's preserved

  • automations namespace (src/automations/, src/automation-runs/, src/automation-run-steps/) — unchanged
  • events namespace (src/events/) — unchanged (note: the workflow_event string in SendEventResponseSuccess.object is an API response type literal, not SDK namespace code)

Verification

  • All 31 test files pass (337 tests)
  • Lint passes (biome check)
  • Build succeeds (tsdown)
  • No workflow references remain in built output except the workflow_event API response type

Slack Thread

Open in Web Open in Cursor 

Summary by cubic

Removed the duplicate workflows namespace and made automations the single SDK interface. Also added a new events API with send and CRUD support.

  • New Features

    • Exposed resend.automations with create/list/get/update/remove, plus resend.automations.runs and resend.automations.runs.steps (get/list).
    • Added resend.events with send/create/get/list/update/remove.
    • Re-exports now include automations, automation-runs, automation-run-steps, and events.
  • Migration

    • Replace resend.workflows with resend.automations.
    • Runs and steps: resend.workflows.runs[.steps]resend.automations.runs[.steps].
    • Update types: Workflow*Automation*, WorkflowRun*AutomationRun*, WorkflowRunStep*AutomationRunStep*. Note: workflow_event remains an API response literal.

Written for commit b3be0eb. Summary will update on new commits.

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new bot commented Mar 28, 2026

Open in StackBlitz

npm i https://pkg.pr.new/resend@898

commit: 7b880ad

Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 issues found across 44 files

Confidence score: 3/5

  • Test files src/events/events.spec.ts and src/automations/automations.spec.ts include API-key-shaped secrets; even if placeholders, this is a security/process risk and should be replaced with clearly fake values.
  • There’s some maintainability risk from duplicated e2e logic in integrations/integrations.spec.ts, which could drift over time.
  • Given the high-severity secret-pattern findings, this is a moderate-risk merge until those placeholders are cleaned up.
  • Pay close attention to src/events/events.spec.ts, src/automations/automations.spec.ts, integrations/integrations.spec.ts, integrations/nextjs/app/route.js - secret-like tokens, duplicated tests, and dead code.
Prompt for AI agents (unresolved issues)

Check if these issues are valid — if so, understand the root cause of each and fix them. If appropriate, use sub-agents to investigate and fix each issue separately.


<file name="integrations/nextjs/app/route.js">

<violation number="1" location="integrations/nextjs/app/route.js:4">
P3: This creates a `Resend` client but never uses it, so the line is dead code in the request path.</violation>
</file>

<file name="src/events/events.spec.ts">

<violation number="1" location="src/events/events.spec.ts:15">
P1: Do not commit API key-shaped secrets in test files; replace this with a clearly non-secret placeholder.

(Based on your team's feedback about redacting secrets in committed artifacts.) [FEEDBACK_USED]</violation>
</file>

<file name="src/automations/automations.spec.ts">

<violation number="1" location="src/automations/automations.spec.ts:17">
P2: Avoid committing API-key-like tokens in test code; replace with a clearly fake placeholder sourced from a test constant/env.

(Based on your team's feedback about redacting secrets from test artifacts.) [FEEDBACK_USED]</violation>
</file>

<file name="integrations/integrations.spec.ts">

<violation number="1" location="integrations/integrations.spec.ts:6">
P2: This file duplicates the existing e2e integration test logic almost verbatim; extract shared test logic or keep a single canonical test file to avoid divergence.</violation>
</file>

Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.

const fetchMocker = createFetchMock(vi);
fetchMocker.enableMocks();

const resend = new Resend('re_zKa4RCko_Lhm9ost2YjNCctnPjbLw8Nop');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: Do not commit API key-shaped secrets in test files; replace this with a clearly non-secret placeholder.

(Based on your team's feedback about redacting secrets in committed artifacts.)

View Feedback

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/events/events.spec.ts, line 15:

<comment>Do not commit API key-shaped secrets in test files; replace this with a clearly non-secret placeholder.

(Based on your team's feedback about redacting secrets in committed artifacts.) </comment>

<file context>
@@ -0,0 +1,421 @@
+const fetchMocker = createFetchMock(vi);
+fetchMocker.enableMocks();
+
+const resend = new Resend('re_zKa4RCko_Lhm9ost2YjNCctnPjbLw8Nop');
+
+describe('Events', () => {
</file context>

const fetchMocker = createFetchMock(vi);
fetchMocker.enableMocks();

const resend = new Resend('re_zKa4RCko_Lhm9ost2YjNCctnPjbLw8Nop');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Avoid committing API-key-like tokens in test code; replace with a clearly fake placeholder sourced from a test constant/env.

(Based on your team's feedback about redacting secrets from test artifacts.)

View Feedback

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At src/automations/automations.spec.ts, line 17:

<comment>Avoid committing API-key-like tokens in test code; replace with a clearly fake placeholder sourced from a test constant/env.

(Based on your team's feedback about redacting secrets from test artifacts.) </comment>

<file context>
@@ -0,0 +1,403 @@
+const fetchMocker = createFetchMock(vi);
+fetchMocker.enableMocks();
+
+const resend = new Resend('re_zKa4RCko_Lhm9ost2YjNCctnPjbLw8Nop');
+
+afterEach(() => fetchMock.resetMocks());
</file context>

import os from 'node:os';
import path from 'node:path';

describe('integrations', () => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: This file duplicates the existing e2e integration test logic almost verbatim; extract shared test logic or keep a single canonical test file to avoid divergence.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At integrations/integrations.spec.ts, line 6:

<comment>This file duplicates the existing e2e integration test logic almost verbatim; extract shared test logic or keep a single canonical test file to avoid divergence.</comment>

<file context>
@@ -0,0 +1,89 @@
+import os from 'node:os';
+import path from 'node:path';
+
+describe('integrations', () => {
+  const sdkPath = path.resolve(__dirname, '..');
+
</file context>

import { Resend } from 'resend';

export function GET() {
new Resend('');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P3: This creates a Resend client but never uses it, so the line is dead code in the request path.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At integrations/nextjs/app/route.js, line 4:

<comment>This creates a `Resend` client but never uses it, so the line is dead code in the request path.</comment>

<file context>
@@ -0,0 +1,7 @@
+import { Resend } from 'resend';
+
+export function GET() {
+  new Resend('');
+
+  return new Response('Hello from this API route!', { status: 200 });
</file context>

Remove the duplicate 'workflows' namespace from the SDK. The preview-workflows
branch had both 'workflows' and 'automations' namespaces pointing to the same
/automations API endpoints. This commit removes:

- src/workflows/ (Workflows class, interfaces, specs)
- src/workflow-runs/ (WorkflowRuns class, interfaces, specs)
- src/workflow-run-steps/ (WorkflowRunSteps class, interfaces, specs)
- workflows property from Resend client
- workflow-related exports from index.ts

The 'automations' namespace (automations, automation-runs, automation-run-steps)
is preserved as the canonical SDK interface for these endpoints.

Also fixes a stale test describe name and test data in
parse-automation-to-api-options.spec.ts.

Co-authored-by: Vitor Capretz <capretzvitor@gmail.com>
@cursor cursor bot force-pushed the cursor/workflows-namespace-removal-6dd9 branch from 7b880ad to b3be0eb Compare March 28, 2026 01:36
@cursor cursor bot changed the base branch from canary to preview-workflows March 28, 2026 01:36
@vcapretz vcapretz marked this pull request as ready for review March 28, 2026 01:39
@vcapretz vcapretz requested a review from a team as a code owner March 28, 2026 01:39
@vcapretz vcapretz requested review from felipevolpone and removed request for a team March 28, 2026 01:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants