Skip to content

v0.5.0

Choose a tag to compare

@github-actions github-actions released this 16 Nov 13:32
· 39 commits to main since this release

Added

  • A tutorial in the docs: build a small leads API with FastAPI in about 25 minutes, from the first call to tests with the fake. (#34)
  • A new esf.ApexActionFailed error (a RecordError) is raised for APEX_FAILED, the code Salesforce returns when an Apex invocable action throws an uncaught exception. Its hint points to the Apex debug log. Code that catches esf.RecordError keeps working.
  • Add sf.graphql(query, variables) for the Salesforce GraphQL API. It returns the data member and raises esf.GraphQLError (with .data for partial data) when the response has an errors array, even with 200 OK. sf.graphql_iter(query, variables, path=...) yields every node of a connection by following pageInfo.endCursor, and FakeSalesforce.on_graphql() scripts answers in tests.
  • Add sf.metadata.quick_deploy(validated_id), which deploys a succeeded validation without running its tests again (POST metadata/deployRequest/{id} with validatedDeployRequestId), and sf.metadata.cancel_deploy(id) (PATCH with deployResult.status=Canceling). Neither is resent once it may have reached Salesforce. Canceling a deployment that is already finalizing (API 65.0 and later) raises the new esf.DeployNotCancelable. FakeSalesforce.metadata supports both.
  • Add sf.metadata for the Metadata API. deploy() takes zip bytes, a zip file or a folder (zipped on the fly, symlinks must stay inside it) and sends metadata/deployRequest. deploy_status(id, wait=True) polls until the deployment is done, and DeployResult.raise_for_errors() raises esf.DeployFailed. retrieve(), list_metadata() and describe_metadata() use the SOAP Metadata API with the OAuth token; retrieve(extract_to=...) refuses zip entries that would escape the folder. Deploy and retrieve are never resent once they may have reached Salesforce, and waits end with esf.MetadataTimeout. FakeSalesforce.metadata, fake.on_deploy() and fake.add_metadata() support tests.
  • Add sf.reports.recent(): the reports the user viewed most recently (GET analytics/reports, at most 200). To find any report, query the Report object with SOQL. FakeSalesforce lists the scripted reports.
  • Add sf.reports for the Reports and Dashboards REST API: run reports with or without filters, run slow reports asynchronously and wait with instance(), and read or refresh dashboards. ReportResult.rows() and summary_rows() turn fact maps into dicts, and FakeSalesforce scripts reports with fake.on_report() and dashboards with fake.on_dashboard(). New errors: ReportRunFailed and ReportTimeout.
  • Added default_namespace= to AsyncSalesforce and Salesforce. It sends defaultNamespace=<ns> in Sforce-Call-Options (with client= when client_name is set), so code can name a managed package's fields without the prefix. Salesforce also leaves the prefix out of the field names it returns, so dict keys change.
  • Added esf.SalesforceWarning. When Salesforce sends a Warning response header (for example for a deprecated API version), the client warns once per distinct text per client family, and the sf.request event has a new sf_warning field.
  • Added update_mru= to AsyncSalesforce and Salesforce. update_mru=False sends Sforce-Mru: updateMru=false on sf.sobject(...) create, get, get-by-external-id, update and upsert, so an integration doesn't fill the user's Recently Viewed list. It needs api_version 60.0 or newer.
  • Collections sf.request events carry records_failed, and the capture() roll-up has sf_records_failed, so partial failures are visible in logs even when raise_for_errors() is never called.
  • Core layer for 0.1: typed exception hierarchy, client configuration objects, result models, and pure (no-I/O) helpers for SOQL quoting, query cursors, limit-header parsing, error classification and retry decisions.
  • Documentation for 0.1: a rewritten README and a documentation site covering getting started, Salesforce setup (External Client Apps), each login flow, token stores (with the durable-store contract and SQLite, SQLAlchemy and Redis example stores), records, query and search, Collections, raw requests, errors, usage and budgets, logging, performance, testing, the esf CLI, migrating from simple-salesforce, an API reference and ADRs 0002–0011. Every Python example in docs/ and README.md runs in CI (tests/docs), and the docs build is strict about broken links. Public members that had no docstring now have one.
  • Every error has docs_url, a link to its entry on the new Troubleshooting section of the Errors page, and some have a hint with the likely fix: the closest field names for an InvalidField (from the cached describe only, never an extra API call), and hints for INVALID_SESSION_ID after a refresh, API_DISABLED_FOR_ORG, REQUEST_LIMIT_EXCEEDED and a query with an unescaped quote. Both are added to str(error), survive pickling, and esf prints them on their own lines.
  • Login flows accept an Experience Cloud site URL with a path prefix as domain=, such as https://acme.my.site.com/partners; the client calls the authorize, token, revoke and introspect endpoints under that URL, and JwtBearer uses the site URL as the aud claim. ClientCredentials still needs the My Domain URL.
  • New Bulk API 2.0 job handles for long-running work. sf.bulk.start_query() creates a query job and returns an esf.AsyncQueryJob (esf.QueryJob) at once, with id, info, refresh(), wait(), abort(), rows(parallel_downloads=) and pages(locator=, max_records=). pages() yields an esf.AsyncResultPage (esf.ResultPage) with locator, next_locator and size, so a download can resume from a saved locator. sf.bulk.query_job(job_id) and sf.bulk.ingest_job(job_ids) open a job again by its ids, for example in a worker. New esf.BulkJobNotComplete for results asked for before a query job is JobComplete. FakeSalesforce supports all of it.
  • New esf commands: esf describe <sObject> prints each field's type, length, whether it is required and its picklist values; esf request <METHOD> <path> [--json BODY] [--param KEY=VALUE] calls any REST resource through sf.request; and esf generate models <sObject>... [--out FILE] [--pydantic] writes one TypedDict (or pydantic model) per sObject from its describe, for use with model=.
  • New private_key_passphrase= on esf.JwtBearer for encrypted PEM keys. The client decrypts the key locally when you create the object and never sends, logs or shows the passphrase.
  • New sf.bulk for Bulk API 2.0. ingest() loads rows given as dicts, a CSV path or CSV bytes, streamed and split into jobs of at most 100 MB; None sets null and a missing key leaves a field unchanged. The returned job has wait(poll=esf.Backoff(...), timeout=...), info, abort(), successful_results(), failed_results() (with esf.ErrorDetail) and unprocessed_records(). query() streams the rows of a query job, with include_deleted= and parallel_downloads=, and expand_compound_fields() swaps compound fields for their components. New esf.BulkJobState, esf.BulkJobInfo, esf.BulkFailure, esf.Backoff and esf.BulkJobTimeout; esf.BulkJobFailed is now raised. FakeSalesforce and AsyncFakeSalesforce support bulk.
  • New sf.composite for many REST calls in one round trip: builder() (Composite, up to 25 subrequests with ref("id") references and all_or_none), graph() (Composite Graph, each graph atomic), tree() (sObject Tree) and batch() (up to 25 independent subrequests). Every limit raises ValueError before anything is sent, and results are esf.CompositeResult, esf.SubrequestResult and esf.GraphResult, whose raise_for_errors() raises the usual typed error of the subrequest that caused the failure. FakeSalesforce and AsyncFakeSalesforce support composite.
  • New sf.files for Salesforce Files: upload() streams a path, bytes, a file object or an iterator as a multipart ContentVersion (up to 2 GB, never held in memory), with optional link_to, share_type and visibility. download() is a streaming context manager; also download_bytes(), download_attachment(), link() and list_for() (returns esf.FileLink). FakeSalesforce and AsyncFakeSalesforce support files, plus add_file() and file_content().
  • New sf.tooling.describe_global(cached=True) lists every Tooling API object (GET tooling/sobjects), cached like sf.describe_global(). FakeSalesforce and AsyncFakeSalesforce support it.
  • New sf.tooling for the Tooling API: query(), query_iter() and sobject(name) (the sf.sobject methods on tooling/ paths; sf.query_more() accepts Tooling cursors), run_tests_async(class_ids) and completions(type). execute_anonymous(code, capture_log=False) runs anonymous Apex and returns esf.AnonymousResult; it is never resent after it may have reached Salesforce. With capture_log=True the client creates a short-lived TraceFlag, returns the run's debug log in result.log and always deletes the flag. FakeSalesforce and AsyncFakeSalesforce support tooling, plus on_execute_anonymous() and set_completions().
  • New sf.ui reads the Salesforce User Interface API: record(), object_info(), picklist_values(), create_defaults(), clone_defaults(), list_views() and list_records(). Object info and picklist values are served from the describe cache, and FakeSalesforce has a matching fake.ui with set_list_view().
  • Org automation: sf.actions.standard(), flow() and apex() run invocable actions with one input or a list, and list() and describe() read them. sf.apex.get/post/put/patch/delete() call Apex REST classes and raise ApexError with the decoded body. esf generate actions writes typed stubs (dataclasses, or Pydantic models with --pydantic) that you run with sf.run(). FakeSalesforce gains on_action(), set_action_describe() and on_apex().
  • SOQL methods take values directly: sf.query("SELECT Id FROM Lead WHERE Email = {}", email) on query, query_iter, count, query_one, query_first and explain, quoted by the same code as esf.soql. New sf.query_one() (exactly one row: NotFound / MultipleMatches), sf.query_first() (first row or None), sf.explain() (query plans as QueryPlan, Salesforce Beta) and esf.flatten(row) (dotted lookup keys, flattened child rows) for CSV/DataFrame export; the CLI CSV output uses it.
  • TokenStoreContract and AsyncTokenStoreContract check that lock() excludes a second holder. They also check that a compare-and-swap save against a missing key conflicts.
  • UNSUPPORTED_API_VERSION maps to UnsupportedApiVersion. A caller's own Sforce-Call-Options header is merged with client_name instead of replacing it. with_auth(..., instance_url=); the parent's override is no longer inherited. sf.auth.revoke()/introspect() take auth= for tokens issued by another flow, and a StaticToken revoke really revokes.
  • client_name= client option: sends Sforce-Call-Options: client=<name> on every API call so admins can attribute API usage to the integration. sf.request() refuses a body on GET/HEAD.
  • esf migrate codemod ([migrate] extra, libcst): rewrites simple-salesforce code (sync and simple_salesforce.aio) to even-simpler-salesforce, marks what it can't with # esf-migrate: TODO|REVIEW[rule] comments, writes a JSON report (--report), and has a CI mode (--check). See the esf migrate docs page.
  • esf migrate has a new client-methods rule. It rewrites describe() to describe_global() and puts a TODO on quick_search(), is_sandbox(), search(...)["searchRecords"] and limits()["X"]["Remaining"].
  • esf.DuplicateRules(allow_save=False, include_record_details=False, run_as_current_user=False)
    controls the org's duplicate rules (Sforce-Duplicate-Rule-Header). Pass it as
    duplicate_rules= to create(), update() and upsert() on sf.sobject(...) and
    sf.collections, and on FakeSalesforce. With include_record_details=True,
    DuplicateDetected.duplicates carries fields of the matched records on single-record writes.
  • esf.sosl_term(value) quotes user input as a SOSL FIND {...} search term, escaping every SOSL reserved character so input can't close the braces or add wildcards.
  • even_simpler_salesforce.contrib.fastapi.SalesforceIntegration ([fastapi] extra): creates and closes one AsyncSalesforce in the app lifespan, gives routes the app-wide client (admin) or a per-user child (user, through auth_for=) as dependencies, reports the esf.capture() roll-up of each request to on_summary=, and with error_handlers=True maps typed errors to JSON responses (401, 422, 404, 400 for an invalid cursor, 503 with Retry-After, 502).
  • even_simpler_salesforce.contrib.flask.Salesforce ([flask] extra): a Flask extension with init_app() that keeps one sync Salesforce client per app and process (ext.client), reports the esf.capture() roll-up of each request to on_summary=, and with error_handlers=True maps typed errors to the same JSON responses as the FastAPI integration.
  • sf.auth.refresh() refreshes the token now, even if it looks valid, and returns the new token, for tokens sent in a request body such as a SOAP SessionHeader. Concurrent calls share one refresh; a StaticToken client raises SessionExpired.
  • sf.collections.create(), update() and upsert() take assignment_rule_id= and allow_save=
    (Sforce-Auto-Assign and Sforce-Duplicate-Rule-Header, sent on every chunk). A sandbox check
    confirmed that Salesforce applies both headers to sObject Collections.
  • sf.instance_url: read-only base URL of the org (the instance_url= override, else the current token's instance; None before the first call). Replaces simple-salesforce's sf_instance / base_url for building links.
  • sf.leads.convert(), sf.leads.convert_many() and sf.merge() convert leads and merge duplicate leads, contacts or accounts. REST has no resource for these tasks, so the client uses the SOAP API with your OAuth token. SOAP faults map to the usual error classes, and unknown codes raise SoapFault. FakeSalesforce supports all three calls.
  • sf.platform_events.publish() and publish_many() publish platform events and return a PublishResult with the event's EventUuid. Publish failures raise the new EventPublishFailed and EventPublishUnavailable errors, both RecordError subclasses. FakeSalesforce keeps published events for fake.published(name).
  • sf.pubsub.subscribe() receives platform events and Change Data Capture events over the
    Pub/Sub API ([pubsub] extra). It decodes Avro payloads and the ChangeEventHeader,
    including changed, nulled and diff field bitmaps with compound Parent.Child names, as
    PubSubEvent and ChangeHeader (ChangeType, is_gap, is_overflow). Flow control
    follows the consumer (batch_size, at most 100). AsyncReplayStore / ReplayStore, with
    AsyncInMemoryReplayStore / InMemoryReplayStore, give at-least-once delivery across
    restarts. The client reconnects from the last processed event, refreshes the token once on an
    authentication error, and raises the new PubSubError, PubSubLimitExceeded and
    ReplayUnavailable errors. Streams emit sf.pubsub.* events. esf.testing adds
    fake.pubsub (emit, emit_change, fail_next) and ReplayStoreContract. The client
    takes pubsub_endpoint= for the EU endpoint.

Changed

  • Documentation site restyled: a shadcn-inspired theme and a landing home page with a step-by-step quickstart example. (#13)
  • Docs: the sidebar is grouped into labelled sections, the planned API areas are on one Roadmap page, and every page is rewritten to a shorter, code-first style. ADRs are linked from the API reference instead of the header. (#23)
  • Retry safety (breaking): only reads are resent after a request may have reached Salesforce. update, delete, upsert (single and Collections) and code-running GETs (Apex REST, executeAnonymous) are no longer resent after a timeout, reset or 5xx, so triggers and flows never run twice and you never get a false Conflict/NotFound. Pass idempotent=True to sf.request() to opt in. Connect errors, row locks and Retry-After responses are still retried. See ADR 0001.
  • Docs for sf.actions and ActionResult now state what a real org does: Salesforce runs at most 2,000 inputs per action request and fails the rest with UNKNOWN_EXCEPTION; an uncaught Apex exception fails every input of the request; a failed Flow interview still returns Flow__InterviewGuid and Flow__InterviewStatus in outputs. The platform events guide notes that INVALID_FIELD and STRING_TOO_LONG keep their usual classes.
  • Docs landing page: FastAPI (async) and Flask (sync) examples side by side in an always-dark hero with readable code colours; the project status moved to Getting started. README: links to the docs, PyPI and changelog, badges, and a new tagline.
  • Docs: dark mode by default with a working light-mode toggle (the landing hero now follows it), JetBrains Mono for code, the theme's own header, and more readable body text.
  • Docs: the landing page shows one short Async/Sync example instead of two long framework apps, and six cards with code for what the library adds over simple-salesforce.
  • Documented UI API and Reports API behaviour seen in a real org: an unknown object on sf.ui.object_info() raises Forbidden (403), not InvalidType; sf.reports.dashboards.refresh() returns only statusUrl and is refused with Conflict (409) while a refresh runs and Forbidden (403) within a minute of the last one; an unknown dashboard raises InvalidReference; a dashboard component has reportResult: None until the first refresh.
  • Lists of more than 2,000 inputs for an Apex or Flow action now raise ValueError before anything is sent. Salesforce ran the first 2,000 and failed the rest.
  • Long-running jobs now all wait the same way as Bulk jobs: sf.metadata.deploy_status(wait=True), sf.metadata.retrieve() and sf.reports.instance() take poll=esf.Backoff(...) (default 2 s doubling up to 30 s) and timeout= with a default of 3600 s instead of 600 s. sf.reports.instance() takes poll instead of poll_interval.
  • Replay now matches the query string by default, comparing SOQL with literals masked; match_query=False restores the old behaviour.
  • The README and the roadmap page list every API area as available, now that Pub/Sub completes the release plan up to 0.5.
  • The [testing] extra no longer caps pytest below 9.2; it only skips 9.2.0 on Python 3.10, where that release crashes at startup.
  • The describe cache now revalidates with If-None-Match when Salesforce sent an ETag, so stale sf.ui.object_info() and sf.ui.picklist_values() entries get a 304 instead of a full download.
  • The package is now marked Development Status :: 4 - Beta. The project status notes in the README and docs list the orgs and login flow the test suite runs against.
  • The recorder now masks record ids and SOQL/SOSL literals by default, and names and postal addresses in sObject records (JSON objects with attributes); a plain create or update body keeps its values. mask_ids=False and mask_personal=False turn this off, extra_keys= adds fields, and you should read every fixture before you share it.
  • The sdist now has an explicit file list: the source, the tests, the docs and docs config those tests read, README.md, CHANGELOG.md, pyproject.toml and the licence files.
  • Decimal values are encoded as exact JSON numbers instead of strings, with both JSON backends.
  • OpenTelemetry metrics no longer carry the caller and sobject labels, which can take many distinct values; spans still carry them. Pass metric_attributes= to choose the metric labels.
  • esf.flatten() given a list, a tuple, a QueryResult or another iterable of rows raises a TypeError that says to use [esf.flatten(r) for r in page].
  • sf.bulk.query() now raises ValueError before it creates a job if the SOQL selects FIELDS(ALL) or FIELDS(CUSTOM), which Bulk API 2.0 query jobs don't support. The sf.bulk.job event is now also emitted when a wait() poll sees records_failed change (it already did for records_processed), and its records_failed is None for query jobs instead of 0.
  • sf.pubsub now decodes Date fields (Avro doc …:DateOnly…) to datetime.date instead of leaving the epoch-millisecond int. FakeSalesforce.pubsub gives change events a random event_id, as Salesforce does.
  • sf.request() returns bytes for binary bodies (any content type that is not text, XML, JSON or declared with a charset=), so file contents such as ContentVersion/{id}/VersionData arrive intact instead of being decoded with replacement characters. Text bodies are decoded with their declared charset.
  • sf.tooling.sobject(...) no longer uses the .json/.xml/.html external id workaround, which is verified only for the REST API. The value is sent in the path.
  • sf.ui.record() now raises ValueError when you pass both fields and layout_types. Salesforce refuses the combination with HTTP 400 INVALID_INPUT_COMBINATION, so the call could never succeed.

Deprecated

  • BatchResult.ok is deprecated in favour of BatchResult.succeeded, because if batch.ok: reads like "all succeeded" but is true when any record succeeded. .ok emits EsfDeprecationWarning and will be removed in 0.7; use not batch.failed to check that every record succeeded.
  • allow_save= on create(), update() and upsert() (sf.sobject(...), sf.collections and
    FakeSalesforce) is deprecated in favour of duplicate_rules=esf.DuplicateRules(allow_save=...).
    It still sends the same header, but it emits EsfDeprecationWarning, and passing both raises
    TypeError. It will be removed in 0.7.

Removed

  • sobject.delete() no longer takes if_unmodified_since=. Salesforce doesn't support conditional headers on DELETE: it rejects such a request (500 UNKNOWN_EXCEPTION, or 400 BAD_HEADER for a future date) instead of checking the precondition.

Fixed

  • A REST response (such as an Apex REST class's own 500) that carries INVALID_SESSION_ID without HTTP 401 no longer refreshes the token and resends the request; only SOAP faults do. A class that returns its own 401 or 429 body now raises ApexError with .body, and an Apex REST path with # is rejected.
  • A SOAP fault (always HTTP 500), such as INVALID_TYPE from sf.metadata.list_metadata() or INVALID_LOCATOR from a retrieve, is no longer resent as if the server had failed. SERVER_UNAVAILABLE and 500 responses without a fault are still retried.
  • A 401 without INVALID_SESSION_ID or invalid_token, such as one an Apex REST class returns itself, no longer refreshes and resends a write. Reads still get one refresh and resend.
  • A call that waits before a retry no longer holds its max_concurrency place, so it doesn't block other calls for the whole backoff.
  • A refresh failure that running calls may need to share stays in memory until they finish, so a waiter can't retry with an already-rotated refresh token. Idle per-token-key locks are dropped, so a client per user no longer keeps a lock per user forever.
  • An HTML or plain-text HTTP 414 or 431 page (a URL or header block too long, for example a long sf.tooling.execute_anonymous() body) now raises RequestTooLarge instead of UnexpectedResponse.
  • An {"error": ...} body outside /services/oauth2/, for example from an Apex REST class, is classified by its HTTP status instead of always as OAuthError, so a 404 raises NotFound. ApexError.body holds the response body.
  • Bulk API 2.0: failed_results() now splits the space-separated field list that Salesforce writes in sf__Error (...:LastName Company --), and parallel_downloads works at API 59.0–62.0, where resultPages answers with resultChunks/resultLink. A query that uses FIELDS(STANDARD) on an object with compound fields gets a hint saying so.
  • Collections chunks that fail with an HTML 5xx (proxy/maintenance page) are marked outcome="unknown" (the request may have reached Salesforce). ESF_DEBUG=2 attempt events log the path template instead of the URL, so external id values stay out of logs. parameterized_search events carry soql_hash.
  • Collections: when one chunk's request fails, every other chunk still finishes and the call raises PartialFailure with the full ordered BatchResult (failed-chunk rows carry extended["outcome"] = "unknown" or "rejected"). Previously the async client raised immediately and left the other chunks writing in the background, and the results of committed chunks were lost. all_or_none=True errors now report the real HTTP method.
  • Concurrent callers whose requests were in flight when a token refresh failed now reliably share that failure (the refresh generation is captured before each request is sent).
  • Describe results are private copies, so changing one no longer changes the cache. Concurrent cache misses make one request, and idle describe locks are dropped.
  • Docs synced with the implementation: the changelog page explains how pre-releases (0.1.0rcN) are recorded, install instructions use pip install --pre until 0.1.0 final, the migrate and all extras are listed, and parameter names, event fields, error mapping, esf migrate options and exit codes and the API reference now match the code.
  • Docs: the performance page no longer lists the Bulk CSV benchmark, which the suite skips until Bulk ships in 0.3. It also says that the client waits for Retry-After only on 429 and REQUEST_LIMIT_EXCEEDED, and that 5xx retries use backoff.
  • Files: a memoryview upload of wider items now sends the right Content-Length, a gzip download reports content_length=None instead of the compressed size, a downloaded JSON file is no longer parsed as an API response, and a file the upload opened is closed as soon as a send fails.
  • If sf.request() gets a 2xx application/json body that is not valid JSON, the sf.request event now reports outcome="error". Previously the event said ok and the error was raised afterwards.
  • JSON request bodies containing NaN or ±Infinity (as float or Decimal, at any depth) now raise ValueError before anything is sent, with both the stdlib and orjson backends. Previously orjson turned them into null and would have blanked the field in Salesforce.
  • New recipes: select all fields with SOQL FIELDS() or a field list built from describe() (query guide), and clear the describe cache after a deploy with your own esf.MemoryCache (records guide).
  • Query events, NotFound and MultipleMatches name the outer object for queries with subqueries.
  • Review fixes: cursors/ids/identifiers with a trailing newline are rejected (fullmatch); calls after close raise TransportError; InMemoryTokenStore.lock() is a real per-key lock; the limits poller lives on the client family and stops with the root client; NOT_FOUND on an sObject type raises InvalidType; SOSL FIND {...} terms are redacted from logs; sf.auth.refreshed is emitted after the refresh lock is released; client-credentials/JWT invalid_grant is an OAuthError, not ReauthorizationRequired; capture() counts only real retries; SOQL floats never use exponent notation; JwtBearer checks for the [jwt] extra at construction.
  • The JWT bearer page now shows how to upload the certificate to the app and lists the invalid_grant descriptions Salesforce documents for this flow.
  • The api_version validation errors now quote DEFAULT_API_VERSION and the minimum supported version from their constants instead of hard-coded numbers that would go stale on the next version bump.
  • The docs for UnsupportedApiVersion and sobject(...).delete() now match what Salesforce does: an
    api_version newer than the org's gives NotFound (NOT_FOUND), and an If-Unmodified-Since
    header on DELETE is rejected (the record is kept), not ignored.
  • The in-memory token stores no longer reuse a version after delete(), so a stale compare-and-swap can't overwrite a newer token, and they drop idle per-key locks. TokenStoreContract checks the version rule too.
  • The query guide now says to send only signed cursors to a browser, and that a signed cursor is not bound to a user.
  • The records guide now shows how to write a Pydantic model back with only the fields you changed, and no longer says that Pydantic Decimal fields give exact numbers on read: the client parses JSON numbers as float first.
  • The sync client's docstring no longer calls it async.
  • Usage values from Sforce-Limit-Info are kept per org. A with_auth() child in another org no longer overwrites the parent's api_used and api_max, and the budget guard checks the org that the call goes to.
  • When many concurrent calls hit an expired session and the token refresh fails (for example invalid_client, invalid_grant or a 401 from the token endpoint), the callers that were already waiting for that refresh now all get the same typed error instead of each posting to the token endpoint again. Bad credentials no longer cause a burst of token requests that can trip Salesforce login rate limits. A call made after the failure still makes a fresh attempt.
  • With refresh-token rotation, a call whose freshly refreshed token was revoked by another process's refresh now uses the newer stored token and resends (at most 2 times, never a second refresh request; the last resend holds the token store's lock), instead of raising SessionExpired. If it still fails, the error says the token was superseded by another refresh rather than pointing at OAuth scopes or IP policies. retry_reasons gains the value token_superseded.
  • ChangeType.SNAPSHOT is added, so a change event with it no longer ends a Pub/Sub subscription.
  • DeployResult.failed and raise_for_errors() now count failed Apex tests. Salesforce reports a deployment whose tests failed as Succeeded when rollback_on_error is off (the default outside production).
  • ErrorDetail and RecordResult are hashable. ErrorDetail.extended still counts for == but not for hash().
  • FakeSalesforce matches the real client in more places: a subquery or string literal no longer changes the reported sObject, MultipleMatches.matches holds record URLs, a closed fake raises TransportError, and request() refuses a body on GET and HEAD. sf.request events carry records_failed for Collections and include error_message only with ESF_DEBUG.
  • FakeSalesforce now matches the real client: positional query values, query_one, query_first, explain, instance_url, with_auth(instance_url=) and sf.auth. A signature-parity test checks this, and the fake caps open query locators.
  • GraphQLError.errors now reads the field path that Salesforce sends as paths into extended["path"], and HTML-unescapes the messages (Field 'Nmae' instead of Field &#39;Nmae&#39;). graphql_errors still holds the entries as sent.
  • JwtBearer(domain="https://test.salesforce.com") now uses the https://test.salesforce.com audience, like domain="test".
  • LeadConvert rejects text with control characters and values of the wrong type before building the SOAP envelope. sf.actions checks the action name also for an empty batch, and FakeSalesforce records no call for one.
  • RetryPolicy(respect_retry_after=False) now retries rate-limited calls with normal backoff instead of failing immediately. The ESF_DEBUG line prints whole thousands as 100k.
  • Sforce-Call-Options options are joined with ; , as in the Salesforce example, and a caller's own header is split on both ; and , before the client merges client= into it.
  • calls_by_caller counts at most 1,000 distinct caller tags, so tags with many values can't grow memory without bound. Calls with a new tag after that count under "other".
  • datetime.time values encode as isoformat() strings with both JSON backends. Previously the stdlib backend raised TypeError and orjson rejected a time with a timezone.
  • esf generate actions writes a module that loads when a description contains quotes or control characters, or a name matches a Python keyword or a name the module uses; an unwritable --out is a usage error (exit 2) and the file starts with the same header as esf generate models.
  • esf migrate --exclude now matches directory names such as build and tests, skips those directories while it walks, and accepts relative globs when you pass an absolute path.
  • esf migrate --rules runs sobject-attr and its sub-rules as one group. Before, --rules sobject-attr rewrote upsert() and get_by_custom_id() calls to sobject() without fixing their arguments or marking them.
  • esf migrate --write keeps a UTF-8 byte order mark and reads and writes a file in the encoding of its PEP 263 coding comment, instead of dropping the BOM or reporting a read error. from simple_salesforce import * now gets a TODO.
  • esf migrate --write keeps each file's line endings and writes atomically through a uniquely named temporary file. A file it can't write is reported as an error in the results instead of aborting the run.
  • esf migrate confirms a client from a bare Salesforce or AsyncSalesforce only when that name comes from simple-salesforce, so code that already uses this library stays unchanged. query(q, flag) now becomes include_deleted=flag or gets a TODO, and calls with *args or **kwargs get a TODO instead of a wrong rewrite.
  • esf migrate marks simple-salesforce exceptions constructed with arguments and the content, resource_name and url attributes of caught exceptions with a TODO. It now removes a rewritten exception import that is no longer used, and puts markers for except* handlers above the handler.
  • esf migrate no longer rejects a file that uses syntax newer than the running Python, such as except* on Python 3.10. The compile check now runs only when the original file compiles.
  • esf migrate puts a TODO on a query() call whose result it can't follow, for example a result that is returned, passed on or assigned twice. QueryResult is not a dict, so these uses broke without a marker.
  • esf migrate renames a stored get_by_custom_id method reference to get_by_external_id and marks create and upsert references for review. A describe_layout reference gets an unsupported TODO.
  • esf migrate review fixes: f-string-safe quoting (valid on Python 3.10/3.11) plus a compile() safety net; imports pruned only when unused (ignore[...] can no longer cause a NameError); markers for decorators, default args, class headers and match; ignore[rule] honoured for every sub-rule; write-mode report lines mapped with a line diff; leftover simple-salesforce imports marked; unconfirmed sObject-looking calls reported as not-a-client TODOs (upper-case fallback only in modules that use simple-salesforce); SalesforceExpiredSession is a TODO (not 1:1); describe_layout, headers=/raw_response= and keyword upsert(record_id=) are TODOs; method references rewritten; un-awaited async query_all is a TODO; esf name conflicts handled; stronger report redaction (multi-line strings, more secret names); faster file walk.
  • esf.testing.record() now masks Salesforce ids used as JSON object keys (such as the UI API recordTypeInfos) the same way as ids in values, and keeps well-known all-zero ids such as the master record type 012000000000000AAA.
  • esf.testing.record now masks user names in JSON and XML (createdByName, userFullName and similar), such as in Metadata API deploy and SOAP results.
  • esf.testing fakes now answer like a real org (recorded on API 68.0): fake.ui.object_info() and fake.ui.list_views() raise Forbidden (403 INSUFFICIENT_ACCESS) for an unknown object instead of InvalidType, a field of another object in fake.ui.record(fields=...) raises RequestError INVALID_INPUT, list_views() lists __Recent first, UI API records and pages carry the same keys as real ones, fake.reports.recent() entries include fieldsUrl, and fake.reports.dashboards.refresh() returns only statusUrl.
  • httpx.DecodingError and TooManyRedirects raise TransportError.
  • request() decides between text and bytes from the parsed media type, not substrings.
  • sf.auth events for another token_key carry that key's hash.
  • sf.metadata.deploy_status() no longer fails with UnexpectedResponse when Salesforce reports the
    status Finalizing (seen on a REST quick deploy); it is treated as still in progress.
  • sf.platform_events.publish_many() now raises EventPublishFailed or EventPublishUnavailable when every request fails, as publish() does, and the contrib helpers answer EventPublishUnavailable with 503 instead of 422. A SOAP session fault after a refresh now gives the connected-app hint.
  • sf.request events report outcome="error" when a 2xx body that should be JSON is not; previously the event said ok and the error was raised afterwards.
  • sobject(...).get_by_external_id() and upsert() now work for external id values that end in
    .json, .xml or .html. Salesforce reads those endings of the path as a response format and
    answered 404 NOT_FOUND; for such values the client now finds the record with SOQL (then reads it
    by id) or upserts it through sObject Collections, with the same results and errors.
  • sobject.get() is typed as returning ... | None when you pass if_modified_since=, because it returns None on 304 Not Modified.

Security

  • JwtBearer infers the sandbox audience from the parsed hostname (*.sandbox.my.salesforce.com), not a substring match, so a look-alike domain can't select the sandbox audience.
  • Salesforce error messages (which can quote record values) are no longer added to sf.request events unless ESF_DEBUG is set; the raised exception keeps the full message.
  • The FastAPI and Flask examples and integration docs escape the request path before logging it, so a crafted path can't forge log lines.
  • The client now checks the instance_url of every token from the token endpoint or a token store. A non-https URL raises an error before the bearer token is sent; plain http is allowed only for loopback hosts.
  • The client now raises the new esf.TokenIdentityChanged (an AuthError) when a refreshed token, or a token it re-reads from the token store, belongs to another org or user than the token it replaces. Before, it used the new token and acted as the other user.
  • The default HTTP client connects directly to plain-http:// loopback hosts, so an HTTP_PROXY never sees a bearer token in cleartext.
  • The recorder writes each fixture through a uniquely named temporary file, so a symlink planted at <fixture>.tmp can no longer redirect the write to another file.
  • StaticToken(instance_url=...) and the client's instance_url= override require https:// (plain http:// only for localhost, 127.0.0.1 and ::1), so a bearer token is never sent unencrypted. In-memory tokens are capped at 10,000 per client family (least recently used dropped and reloaded from the store), and sf.auth.revoke() also drops the key's refresh state.
  • WebServerFlow now requires token_key= (one key per Salesforce identity). Without it every user of a multi-user app shared one token record.
  • esf query --csv prefixes string cells that start with =, +, -, @, a tab, a carriage return, a line feed or a full-width form of those signs, so spreadsheets read them as text. Table output escapes control characters, so record data can't drive the terminal.
  • esf.testing.record() now redacts the text of every XML sessionId element (the SessionHeader of a SOAP call), whatever its format. Before, only values shaped like 00D…!… were redacted.
  • esf error lines and ESF_DEBUG error messages escape control characters, so a Salesforce error message can't send escape sequences to the terminal.
  • repr() of an AuthStart no longer shows the PKCE code_verifier or state.

Performance

  • Bulk API 2.0 uploads over 64 KiB are gzipped on the wire.
  • The NaN and ±Infinity check on JSON request bodies no longer builds a path for every value. It finds the path only after it finds a bad value, so a 200-record chunk spends several times less time in the check.
  • The describe cache stores the JSON text and each cache hit decodes its own copy after the cache lock is released, instead of deep-copying the cached dict inside the lock. A hit on a large describe is several times faster, and concurrent hits no longer queue behind each other.
  • The recorder serialises each interaction once instead of on every write, which reduces the cost of long recordings.
  • esf migrate skips the full analysis of files that no rule can match. It checks the text, or the parsed module, for simple-salesforce, the client names and sObject-like attributes first.
  • esf query --all --json prints rows page by page instead of after the last page, and --all keeps one copy of each row instead of two.
  • sf.collections.create(..., sobject=) validates the sObject name once per call instead of once per row.

Install: pip install even-simpler-salesforce==0.5.0