support the workflow status for cli and mcp and node sdk users#22
Conversation
Add status field to WorkflowAttributes type to track workflow state as either 'live' or 'draft'. Update all workflow test fixtures to include the new status field and add assertions to verify status values are correctly returned from the API.
feat: add status field to workflow attributes
…module Add ESM package type and keep tooling configs in CJS
Confidence Score: 2/5
Prompt To Fix All With AIThis is a comment left during a code review.
Path: package.json
Line: 7-9
Comment:
**ESM-only package breaks CJS consumers**
Adding `"type": "module"` without a CJS build output or an `exports` field with a `require` condition means any consumer using `require('@bentonow/bento-node-sdk')` will get a runtime error: `ERR_REQUIRE_ESM`. The PR description mentions improving vanilla JS compatibility, but this change has the opposite effect for CJS environments.
To support both, add an `exports` field with dual entry points:
```json
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
}
```
And update the build script to emit both ESM and CJS outputs.
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: src/sdk/workflows/types.ts
Line: 17
Comment:
**`status` as required field is a breaking change**
Making `status` required means any existing cached/persisted API response that doesn't include this field will fail TypeScript type checks. If there's any chance the API returns workflows without `status` (e.g., older records), this should be optional:
```suggestion
status?: 'live' | 'draft';
```
How can I resolve this? If you propose a fix, please make it concise.Last reviewed commit: d5484a0 |
| "type": "module", | ||
| "main": "dist/index.js", | ||
| "module": "dist/index.js", |
There was a problem hiding this comment.
ESM-only package breaks CJS consumers
Adding "type": "module" without a CJS build output or an exports field with a require condition means any consumer using require('@bentonow/bento-node-sdk') will get a runtime error: ERR_REQUIRE_ESM. The PR description mentions improving vanilla JS compatibility, but this change has the opposite effect for CJS environments.
To support both, add an exports field with dual entry points:
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
}And update the build script to emit both ESM and CJS outputs.
Prompt To Fix With AI
This is a comment left during a code review.
Path: package.json
Line: 7-9
Comment:
**ESM-only package breaks CJS consumers**
Adding `"type": "module"` without a CJS build output or an `exports` field with a `require` condition means any consumer using `require('@bentonow/bento-node-sdk')` will get a runtime error: `ERR_REQUIRE_ESM`. The PR description mentions improving vanilla JS compatibility, but this change has the opposite effect for CJS environments.
To support both, add an `exports` field with dual entry points:
```json
"exports": {
".": {
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
}
```
And update the build script to emit both ESM and CJS outputs.
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
SDK is ESM only anyway, this allows others to use it as a module with proper imports, we don't have any CJS in here so its a non issue.
| */ | ||
| export type WorkflowAttributes = { | ||
| name: string; | ||
| status: 'live' | 'draft'; |
There was a problem hiding this comment.
status as required field is a breaking change
Making status required means any existing cached/persisted API response that doesn't include this field will fail TypeScript type checks. If there's any chance the API returns workflows without status (e.g., older records), this should be optional:
| status: 'live' | 'draft'; | |
| status?: 'live' | 'draft'; |
Prompt To Fix With AI
This is a comment left during a code review.
Path: src/sdk/workflows/types.ts
Line: 17
Comment:
**`status` as required field is a breaking change**
Making `status` required means any existing cached/persisted API response that doesn't include this field will fail TypeScript type checks. If there's any chance the API returns workflows without `status` (e.g., older records), this should be optional:
```suggestion
status?: 'live' | 'draft';
```
How can I resolve this? If you propose a fix, please make it concise.
Add status field to WorkflowAttributes type to track
workflow state as either 'live' or 'draft'. Update all
workflow test fixtures to include the new status field
and add assertions to verify status values are correctly
returned from the API.
there is also work to flag the project as a ESM package type and keep CJS configs this should allow ingestion into vanilla js ecosystem projects.