Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a23763c
WIP on faye-removal
Stwissel Mar 28, 2026
29428bc
feat: add custom CometD client with long-polling and WebSocket support
Stwissel Mar 28, 2026
ef3402d
refactor: rewrite fdcstream.js to use custom CometD client instead of…
Stwissel Mar 28, 2026
f3c48c8
test: add fdcstream integration tests and replay extension test
Stwissel Mar 28, 2026
05d7b2d
chore: remove faye dependency
Stwissel Mar 28, 2026
ac3ca7b
docs: rewrite README.md with current API, examples, and features
Stwissel Mar 28, 2026
a7b6806
docs: restore original badges in README.md
Stwissel Mar 28, 2026
2e8aa0f
documentation updates
Stwissel Mar 28, 2026
7e27770
Refactoring
Stwissel Mar 29, 2026
df97ddf
docs(refactoring): Update code smell detector data
Stwissel Mar 30, 2026
0777815
docs(refactoring): Refresh detailed code smell detection report
Stwissel Mar 30, 2026
8245b46
docs(refactoring): Update code smell detection summary
Stwissel Mar 30, 2026
a30fe25
docs(refactoring): Update refactoring expert system data
Stwissel Mar 30, 2026
35d211b
docs(refactoring): Regenerate detailed code refactoring report
Stwissel Mar 30, 2026
45c0ff2
docs(refactoring): Update code refactoring summary
Stwissel Mar 30, 2026
2c86a72
fix: upsert() now uses applyBody for multipart support (R03)
Stwissel Mar 30, 2026
278edd6
fix: replace error-swallowing test patterns with promise returns (R02)
Stwissel Mar 30, 2026
25a283f
style: fix spacing, quotes, and let->const via ESLint (R04, R07, R14)
Stwissel Mar 30, 2026
5e8e0ef
refactor: extract _resubscribeAll() to deduplicate reconnect logic (R05)
Stwissel Mar 30, 2026
4459a35
refactor: remove redundant Promise.resolve() in authenticate (R06)
Stwissel Mar 30, 2026
83aa03e
refactor: inline temp variable in createSObject (R11)
Stwissel Mar 30, 2026
4e6f8a1
refactor: hoist inline require to top-level import (R08)
Stwissel Mar 30, 2026
62227ef
refactor: extract ID_FIELD_VARIANTS constant and rename headerContain…
Stwissel Mar 30, 2026
a6b5b3e
refactor: rename getFullUri to buildUrl (R15)
Stwissel Mar 30, 2026
54291de
refactor: simplify getAuthUri conditional blocks (R10)
Stwissel Mar 30, 2026
4484a16
refactor: propagate error details to transport:down event (R16)
Stwissel Mar 30, 2026
57f9675
refactor: remove dead code in integration.js (R17)
Stwissel Mar 30, 2026
39a4300
feat: onRefresh now accepts async/promise-returning functions (R09)
Stwissel Mar 30, 2026
14e550e
refactor: convert mock server to class-based instance (R18)
Stwissel Mar 30, 2026
f75febc
fix: lint error in onRefresh test (unused param)
Stwissel Mar 30, 2026
7e0c503
Refactor
Stwissel Mar 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co

## Project Overview

nforce8 is a Node.js REST API wrapper for Salesforce, a modernized fork of the original `nforce` library. It is promise-based only (no callback support). Used with NodeRED and other Node.js applications. Requires Node.js >22.0.
nforce8 is a Node.js REST API wrapper for Salesforce, a modernized fork of the original `nforce` library. It is promise-based only (no callback support). Used with NodeRED and other Node.js applications. Requires Node.js >=22.4.0 (stable built-in `WebSocket`; experimental in 22.0–22.3).

## Commands

Expand All @@ -24,7 +24,7 @@ There is no build step — this is a plain Node.js module with no transpilation.

### Supporting Modules

- **`lib/fdcstream.js`** — Faye-based Streaming API client (EventEmitter). `Subscription` and `Client` classes with replay and auto-reconnection support.
- **`lib/fdcstream.js`** — CometD-based Streaming API client (EventEmitter). `Subscription` and `Client` classes with replay and auto-reconnection support.
- **`lib/optionhelper.js`** — Builds API request options (URIs, headers, multipart, gzip).
- **`lib/multipart.js`** — Multipart form-data builder for file uploads (ContentVersion, Attachment).
- **`lib/util.js`** — Type checking, response validation, OAuth validation, ID extraction.
Expand Down
79 changes: 79 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
# Code of Conduct

The **nforce8** project adheres to the [Contributor Covenant](https://www.contributor-covenant.org/) Code of Conduct. Everyone who participates—whether reporting issues, submitting patches, reviewing code, or discussing the project—is expected to follow it.

## Our pledge

We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone, regardless of age, body size, visible or invisible disability, ethnicity, sex characteristics, gender identity and expression, level of experience, education, socio-economic status, nationality, personal appearance, race, caste, color, religion, or sexual identity and orientation.

We pledge to act and interact in ways that contribute to an open, welcoming, diverse, inclusive, and healthy community.

## Our standards

Examples of behavior that contributes to a positive environment for our community include:

- Demonstrating empathy and kindness toward other people
- Being respectful of differing opinions, viewpoints, and experiences
- Giving and gracefully accepting constructive feedback
- Accepting responsibility and apologizing to those affected by our mistakes, and learning from the experience
- Focusing on what is best not just for us as individuals, but for the overall community

Examples of unacceptable behavior include:

- The use of sexualized language or imagery, and sexual attention or advances of any kind
- Trolling, insulting or derogatory comments, and personal or political attacks
- Public or private harassment
- Publishing others' private information, such as a physical or email address, without their explicit permission
- Other conduct which could reasonably be considered inappropriate in a professional setting

## Enforcement responsibilities

Community leaders are responsible for clarifying and enforcing our standards of acceptable behavior and will take appropriate and fair corrective action in response to any behavior that they deem inappropriate, threatening, offensive, or harmful.

Community leaders have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, and will communicate reasons for moderation decisions when appropriate.

## Scope

This Code of Conduct applies within all community spaces (including GitHub issues, pull requests, discussions, and related channels), and also applies when an individual is officially representing the community in public spaces. Examples of representing our community include using an official e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event.

## Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported to the community leaders responsible for enforcement at **[stephan@wissel.net](mailto:stephan@wissel.net)**. All complaints will be reviewed and investigated promptly and fairly.

All community leaders are obligated to respect the privacy and security of the reporter of any incident.

## Enforcement guidelines

Community leaders will follow these Community Impact Guidelines in determining the consequences for any action they deem in violation of this Code of Conduct:

### 1. Correction

**Community impact:** Use of inappropriate language or other behavior deemed unprofessional or unwelcome in the community.

**Consequence:** A private, written warning from community leaders, providing clarity around the nature of the violation and an explanation of why the behavior was inappropriate. A public apology may be requested.

### 2. Warning

**Community impact:** A violation through a single incident or series of actions.

**Consequence:** A warning with consequences for continued behavior. No interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, for a specified period of time. This includes avoiding interactions in community spaces as well as external channels like social media. Violating these terms may lead to a temporary or permanent ban.

### 3. Temporary ban

**Community impact:** A serious violation of community standards, including sustained inappropriate behavior.

**Consequence:** A temporary ban from any sort of interaction or public communication with the community for a specified period of time. No public or private interaction with the people involved, including unsolicited interaction with those enforcing the Code of Conduct, is allowed during this period. Violating these terms may lead to a permanent ban.

### 4. Permanent ban

**Community impact:** Demonstrating a pattern of violation of community standards, including sustained inappropriate behavior, harassment of an individual, or aggression toward or disparagement of classes of individuals.

**Consequence:** A permanent ban from any sort of public interaction within the community.

## Attribution

This Code of Conduct is adapted from the [Contributor Covenant](https://www.contributor-covenant.org/), version 2.1, available at [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html](https://www.contributor-covenant.org/version/2/1/code_of_conduct.html).

Community Impact Guidelines were inspired by [Mozilla's code of conduct enforcement ladder](https://github.com/mozilla/diversity).

For answers to common questions about this code of conduct, see the [FAQ](https://www.contributor-covenant.org/faq). [Translations](https://www.contributor-covenant.org/translations) are available on the Contributor Covenant site.
116 changes: 116 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@

# Contributing to nforce8

Thank you for your interest in contributing to nforce8! All contributions are welcome, whether they are bug reports, feature suggestions, documentation improvements, or code changes.

## Code of Conduct

This project follows a [Code of Conduct](CODE_OF_CONDUCT.md). By participating, you are expected to uphold it. Please report unacceptable behavior to [stephan@wissel.net](mailto:stephan@wissel.net).

## Reporting Bugs

Before opening a new issue, please check [existing issues](https://github.com/Stwissel/nforce8/issues) to avoid duplicates.

When filing a bug report, include:

- **Node.js version** (`node --version`)
- **nforce8 version** (`npm ls nforce8`)
- **Steps to reproduce** the issue
- **Expected behavior** vs **actual behavior**
- A **minimal reproduction case** if possible
- Any relevant error messages or stack traces

## Suggesting Features

Open a [GitHub Issue](https://github.com/Stwissel/nforce8/issues) describing:

- The **use case** and why it matters
- How it would work from the caller's perspective
- Any alternatives you have considered

For larger changes, please discuss the approach in an issue before submitting a pull request.

## Development Setup

### Prerequisites

- **Node.js >= 22.0** (uses built-in `fetch` and `WebSocket`)

### Getting Started

```bash
# Fork the repository on GitHub, then:
git clone https://github.com/<your-username>/nforce8.git
cd nforce8
npm install
```

### Running Tests

Tests run against a local mock Salesforce API server -- no live org credentials are needed.

```bash
# Full test suite with coverage
npm test

# Single test file
npx mocha test/<filename>.js
```

### Linting

```bash
npm run lint
```

## Submitting Pull Requests

1. **Fork** the repository and create a feature branch from `main`
2. **Keep PRs focused** -- one concern per pull request
3. **Include tests** for new functionality and bug fixes
4. **Ensure all tests pass** (`npm test`)
5. **Ensure lint passes** (`npm run lint`)
6. **Update documentation** if your change affects the public API
7. **Reference related issues** in the PR description (e.g., "Fixes #42")

### Commit Messages

This project follows [Conventional Commits](https://www.conventionalcommits.org/):

```
<type>(<scope>): <description>

[optional body]
```

Common types: `feat`, `fix`, `docs`, `refactor`, `test`, `chore`

Examples:

```
feat(streaming): add platform event batch subscribe
fix(auth): handle expired refresh token in single-user mode
docs: update streaming API guide
test(crud): add upsert external ID coverage
refactor(api): extract blob retrieval factory
```

## Coding Standards

- **ESLint** enforces the project style -- run `npm run lint` before committing
- **Single quotes** for strings
- **CommonJS** modules (`require` / `module.exports`)
- **Promise-based** patterns only -- no callbacks
- **No build step** -- plain Node.js, no transpilation
- **API version format** must be fully-qualified strings (e.g., `'v62.0'`)

## Testing Guidelines

- All new features and bug fixes need tests
- Tests use **Mocha** + **should.js** assertions
- Tests run against mock servers in `test/mock/` -- do not require a live Salesforce org
- Aim for meaningful coverage of both success and error paths

## License

By contributing to nforce8, you agree that your contributions will be licensed under the [MIT License](LICENSE).
Loading
Loading