Skip to content

TypeScript SDK: Consider options-bag pattern for feedback parameters #32

@coreyt

Description

@coreyt

Context

The TypeScript SDK's progress callback support adds progressCallback and feedbackConfig as trailing positional parameters to 34 methods (Engine: 4, Query: 5, AdminClient: 25). This matches the Python SDK's API exactly.

Problem

Positional parameters create ambiguity at call sites, especially for methods with existing optional trailing parameters:

// Is the 2nd arg a record key or a callback?
admin.traceOperationalCollection("events", recordKey?, progressCallback?, feedbackConfig?)

Adding a third feedback-related option later would require touching every signature again.

Proposed Change

Bundle into an options bag:

type CallOptions = {
  progressCallback?: ProgressCallback;
  feedbackConfig?: FeedbackConfig;
};

// Before:
checkIntegrity(progressCallback?, feedbackConfig?): IntegrityReport
// After:
checkIntegrity(options?: CallOptions): IntegrityReport

This is a breaking API change and would diverge from Python's positional-parameter convention. Should be evaluated for the next major version.

Files

  • typescript/packages/fathomdb/src/engine.ts
  • typescript/packages/fathomdb/src/query.ts
  • typescript/packages/fathomdb/src/admin.ts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions