@speechall/sdk 0.0.1 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (151) hide show
  1. package/.beads/README.md +81 -0
  2. package/.beads/config.yaml +62 -0
  3. package/.beads/issues.jsonl +46 -0
  4. package/.beads/metadata.json +4 -0
  5. package/.env.example +5 -0
  6. package/.fernignore +45 -0
  7. package/.gitattributes +3 -0
  8. package/.github/copilot-instructions.md +78 -0
  9. package/.github/workflows/auto-release-simple.yml.deprecated +106 -0
  10. package/.github/workflows/auto-release.yml +67 -0
  11. package/.github/workflows/ci.yml +41 -0
  12. package/.github/workflows/release.yml +57 -0
  13. package/AGENTS.md +94 -0
  14. package/CHANGELOG.md +58 -0
  15. package/CLAUDE.md +75 -0
  16. package/README.md +294 -155
  17. package/examples/CLAUDE.md +136 -0
  18. package/examples/advanced-options.ts +213 -0
  19. package/examples/basic-transcription.ts +66 -0
  20. package/examples/error-handling.ts +251 -0
  21. package/examples/list-models.ts +112 -0
  22. package/examples/remote-transcription.ts +60 -0
  23. package/fern/fern.config.json +4 -0
  24. package/fern/generators.yml +43 -0
  25. package/jest.config.js +11 -0
  26. package/package.json +26 -44
  27. package/regenerate.sh +45 -0
  28. package/scripts/fix-generated-code.sh +25 -0
  29. package/src/BaseClient.ts +82 -0
  30. package/src/Client.ts +30 -0
  31. package/src/api/errors/BadRequestError.ts +22 -0
  32. package/src/api/errors/GatewayTimeoutError.ts +22 -0
  33. package/src/api/errors/InternalServerError.ts +22 -0
  34. package/src/api/errors/NotFoundError.ts +22 -0
  35. package/src/api/errors/PaymentRequiredError.ts +22 -0
  36. package/src/api/errors/ServiceUnavailableError.ts +22 -0
  37. package/src/api/errors/TooManyRequestsError.ts +22 -0
  38. package/src/api/errors/UnauthorizedError.ts +22 -0
  39. package/src/api/errors/index.ts +8 -0
  40. package/src/api/index.ts +3 -0
  41. package/src/api/resources/index.ts +5 -0
  42. package/src/api/resources/replacementRules/client/Client.ts +148 -0
  43. package/src/api/resources/replacementRules/client/index.ts +1 -0
  44. package/src/api/resources/replacementRules/client/requests/CreateReplacementRulesetRequest.ts +25 -0
  45. package/src/api/resources/replacementRules/client/requests/index.ts +1 -0
  46. package/src/api/resources/replacementRules/index.ts +2 -0
  47. package/src/api/resources/replacementRules/types/CreateReplacementRulesetResponse.ts +6 -0
  48. package/src/api/resources/replacementRules/types/index.ts +1 -0
  49. package/src/api/resources/speechToText/client/Client.ts +275 -0
  50. package/src/api/resources/speechToText/client/index.ts +1 -0
  51. package/src/api/resources/speechToText/client/requests/RemoteTranscriptionConfiguration.ts +20 -0
  52. package/src/api/resources/speechToText/client/requests/TranscribeRequest.ts +26 -0
  53. package/src/api/resources/speechToText/client/requests/index.ts +2 -0
  54. package/src/api/resources/speechToText/index.ts +1 -0
  55. package/src/api/types/BaseTranscriptionConfiguration.ts +29 -0
  56. package/src/api/types/ErrorResponse.ts +11 -0
  57. package/src/api/types/ExactRule.ts +13 -0
  58. package/src/api/types/RegexGroupRule.ts +28 -0
  59. package/src/api/types/RegexRule.ts +28 -0
  60. package/src/api/types/ReplacementRule.ts +25 -0
  61. package/src/api/types/SpeechToTextModel.ts +90 -0
  62. package/src/api/types/TranscriptLanguageCode.ts +114 -0
  63. package/src/api/types/TranscriptOutputFormat.ts +18 -0
  64. package/src/api/types/TranscriptionDetailed.ts +19 -0
  65. package/src/api/types/TranscriptionModelIdentifier.ts +80 -0
  66. package/src/api/types/TranscriptionOnlyText.ts +11 -0
  67. package/src/api/types/TranscriptionProvider.ts +23 -0
  68. package/src/api/types/TranscriptionResponse.ts +8 -0
  69. package/src/api/types/TranscriptionSegment.ts +17 -0
  70. package/src/api/types/TranscriptionWord.ts +17 -0
  71. package/src/api/types/index.ts +16 -0
  72. package/src/auth/BearerAuthProvider.ts +37 -0
  73. package/src/auth/index.ts +1 -0
  74. package/src/core/auth/AuthProvider.ts +6 -0
  75. package/src/core/auth/AuthRequest.ts +9 -0
  76. package/src/core/auth/BasicAuth.ts +32 -0
  77. package/src/core/auth/BearerToken.ts +20 -0
  78. package/src/core/auth/NoOpAuthProvider.ts +8 -0
  79. package/src/core/auth/index.ts +5 -0
  80. package/src/core/base64.ts +27 -0
  81. package/src/core/exports.ts +2 -0
  82. package/src/core/fetcher/APIResponse.ts +23 -0
  83. package/src/core/fetcher/BinaryResponse.ts +34 -0
  84. package/src/core/fetcher/EndpointMetadata.ts +13 -0
  85. package/src/core/fetcher/EndpointSupplier.ts +14 -0
  86. package/src/core/fetcher/Fetcher.ts +391 -0
  87. package/src/core/fetcher/Headers.ts +93 -0
  88. package/src/core/fetcher/HttpResponsePromise.ts +116 -0
  89. package/src/core/fetcher/RawResponse.ts +61 -0
  90. package/src/core/fetcher/Supplier.ts +11 -0
  91. package/src/core/fetcher/createRequestUrl.ts +6 -0
  92. package/src/core/fetcher/getErrorResponseBody.ts +33 -0
  93. package/src/core/fetcher/getFetchFn.ts +3 -0
  94. package/src/core/fetcher/getHeader.ts +8 -0
  95. package/src/core/fetcher/getRequestBody.ts +20 -0
  96. package/src/core/fetcher/getResponseBody.ts +58 -0
  97. package/src/core/fetcher/index.ts +11 -0
  98. package/src/core/fetcher/makeRequest.ts +42 -0
  99. package/src/core/fetcher/requestWithRetries.ts +64 -0
  100. package/src/core/fetcher/signals.ts +26 -0
  101. package/src/core/file/exports.ts +1 -0
  102. package/src/core/file/file.ts +217 -0
  103. package/src/core/file/index.ts +2 -0
  104. package/src/core/file/types.ts +81 -0
  105. package/src/core/headers.ts +35 -0
  106. package/src/core/index.ts +7 -0
  107. package/src/core/json.ts +27 -0
  108. package/src/core/logging/exports.ts +19 -0
  109. package/src/core/logging/index.ts +1 -0
  110. package/src/core/logging/logger.ts +203 -0
  111. package/src/core/runtime/index.ts +1 -0
  112. package/src/core/runtime/runtime.ts +134 -0
  113. package/src/core/url/encodePathParam.ts +18 -0
  114. package/src/core/url/index.ts +3 -0
  115. package/src/core/url/join.ts +79 -0
  116. package/src/core/url/qs.ts +74 -0
  117. package/src/environments.ts +7 -0
  118. package/src/errors/SpeechallError.ts +58 -0
  119. package/src/errors/SpeechallTimeoutError.ts +13 -0
  120. package/src/errors/handleNonStatusCodeError.ts +37 -0
  121. package/src/errors/index.ts +2 -0
  122. package/src/exports.ts +1 -0
  123. package/src/index.ts +6 -0
  124. package/test-import.ts +17 -0
  125. package/tests/integration/api.test.ts +93 -0
  126. package/tests/unit/client.test.ts +91 -0
  127. package/tsconfig.json +20 -0
  128. package/dist/api.d.ts +0 -467
  129. package/dist/api.d.ts.map +0 -1
  130. package/dist/api.js +0 -592
  131. package/dist/base.d.ts +0 -32
  132. package/dist/base.d.ts.map +0 -1
  133. package/dist/base.js +0 -35
  134. package/dist/common.d.ts +0 -14
  135. package/dist/common.d.ts.map +0 -1
  136. package/dist/common.js +0 -91
  137. package/dist/configuration.d.ts +0 -23
  138. package/dist/configuration.d.ts.map +0 -1
  139. package/dist/configuration.js +0 -25
  140. package/dist/esm/api.js +0 -574
  141. package/dist/esm/base.js +0 -27
  142. package/dist/esm/common.js +0 -79
  143. package/dist/esm/configuration.js +0 -21
  144. package/dist/esm/example.js +0 -131
  145. package/dist/esm/index.js +0 -2
  146. package/dist/example.d.ts +0 -3
  147. package/dist/example.d.ts.map +0 -1
  148. package/dist/example.js +0 -133
  149. package/dist/index.d.ts +0 -3
  150. package/dist/index.d.ts.map +0 -1
  151. package/dist/index.js +0 -18
@@ -0,0 +1,106 @@
1
+ name: Auto Release (Simple)
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+
7
+ jobs:
8
+ test:
9
+ runs-on: ubuntu-latest
10
+ strategy:
11
+ matrix:
12
+ node-version: [16.x, 18.x, 20.x]
13
+
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+
17
+ - name: Use Node.js ${{ matrix.node-version }}
18
+ uses: actions/setup-node@v4
19
+ with:
20
+ node-version: ${{ matrix.node-version }}
21
+ cache: 'npm'
22
+
23
+ - name: Install dependencies
24
+ run: npm ci
25
+
26
+ - name: Run lint
27
+ run: npm run lint
28
+
29
+ - name: Build package
30
+ run: npm run build
31
+
32
+ - name: Test package can be imported
33
+ run: node -e "require('./dist/index.js')"
34
+
35
+ check-version:
36
+ runs-on: ubuntu-latest
37
+ outputs:
38
+ version-changed: ${{ steps.version-check.outputs.changed }}
39
+ new-version: ${{ steps.version-check.outputs.version }}
40
+ steps:
41
+ - uses: actions/checkout@v4
42
+ with:
43
+ fetch-depth: 2
44
+
45
+ - name: Check if version changed
46
+ id: version-check
47
+ run: |
48
+ # Get current version
49
+ CURRENT_VERSION=$(node -p "require('./package.json').version")
50
+
51
+ # Get previous version (from previous commit)
52
+ git checkout HEAD~1
53
+ PREVIOUS_VERSION=$(node -p "require('./package.json').version")
54
+ git checkout -
55
+
56
+ echo "Previous version: $PREVIOUS_VERSION"
57
+ echo "Current version: $CURRENT_VERSION"
58
+
59
+ if [ "$CURRENT_VERSION" != "$PREVIOUS_VERSION" ]; then
60
+ echo "changed=true" >> $GITHUB_OUTPUT
61
+ echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT
62
+ else
63
+ echo "changed=false" >> $GITHUB_OUTPUT
64
+ fi
65
+
66
+ release-and-publish:
67
+ needs: [test, check-version]
68
+ runs-on: ubuntu-latest
69
+ if: needs.check-version.outputs.version-changed == 'true'
70
+
71
+ steps:
72
+ - uses: actions/checkout@v4
73
+
74
+ - name: Use Node.js 18
75
+ uses: actions/setup-node@v4
76
+ with:
77
+ node-version: 18
78
+ cache: 'npm'
79
+ registry-url: 'https://registry.npmjs.org'
80
+
81
+ - name: Install dependencies
82
+ run: npm ci
83
+
84
+ - name: Build package
85
+ run: npm run build
86
+
87
+ - name: Create Release
88
+ id: create_release
89
+ uses: actions/create-release@v1
90
+ env:
91
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
92
+ with:
93
+ tag_name: v${{ needs.check-version.outputs.new-version }}
94
+ release_name: Release v${{ needs.check-version.outputs.new-version }}
95
+ draft: false
96
+ prerelease: false
97
+ body: |
98
+ Changes in this release:
99
+ - Version bump to ${{ needs.check-version.outputs.new-version }}
100
+
101
+ For detailed changes, see the commit history.
102
+
103
+ - name: Publish to NPM
104
+ run: npm publish
105
+ env:
106
+ NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -0,0 +1,67 @@
1
+ name: Auto Release
2
+
3
+ on:
4
+ push:
5
+ branches:
6
+ - main
7
+ paths:
8
+ - 'package.json'
9
+
10
+ jobs:
11
+ create-release:
12
+ runs-on: ubuntu-latest
13
+ permissions:
14
+ contents: write
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+ with:
19
+ fetch-depth: 0
20
+
21
+ - name: Get version from package.json
22
+ id: version
23
+ run: |
24
+ VERSION=$(node -p "require('./package.json').version")
25
+ echo "version=$VERSION" >> $GITHUB_OUTPUT
26
+ echo "tag=v$VERSION" >> $GITHUB_OUTPUT
27
+
28
+ - name: Check if tag exists
29
+ id: check_tag
30
+ run: |
31
+ if git rev-parse "v${{ steps.version.outputs.version }}" >/dev/null 2>&1; then
32
+ echo "exists=true" >> $GITHUB_OUTPUT
33
+ else
34
+ echo "exists=false" >> $GITHUB_OUTPUT
35
+ fi
36
+
37
+ - name: Extract changelog for version
38
+ if: steps.check_tag.outputs.exists == 'false'
39
+ id: changelog
40
+ run: |
41
+ VERSION="${{ steps.version.outputs.version }}"
42
+ # Extract changelog section for this version
43
+ CHANGELOG=$(awk "/^## \[$VERSION\]/{flag=1; next} /^## \[/{flag=0} flag" CHANGELOG.md | head -50)
44
+ if [ -z "$CHANGELOG" ]; then
45
+ CHANGELOG="Release v$VERSION"
46
+ fi
47
+ # Write to file for multiline handling
48
+ echo "$CHANGELOG" > release_notes.txt
49
+
50
+ - name: Create GitHub Release
51
+ if: steps.check_tag.outputs.exists == 'false'
52
+ uses: softprops/action-gh-release@v2
53
+ with:
54
+ tag_name: ${{ steps.version.outputs.tag }}
55
+ name: ${{ steps.version.outputs.tag }}
56
+ body_path: release_notes.txt
57
+ draft: false
58
+ prerelease: false
59
+ env:
60
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
61
+
62
+ - name: Trigger npm publish workflow
63
+ if: steps.check_tag.outputs.exists == 'false'
64
+ uses: peter-evans/repository-dispatch@v3
65
+ with:
66
+ event-type: npm-publish
67
+ client-payload: '{"tag": "${{ steps.version.outputs.tag }}", "version": "${{ steps.version.outputs.version }}"}'
@@ -0,0 +1,41 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+
9
+ jobs:
10
+ test:
11
+ runs-on: ubuntu-latest
12
+ strategy:
13
+ matrix:
14
+ node-version: [18.x, 20.x]
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Setup Node.js ${{ matrix.node-version }}
20
+ uses: actions/setup-node@v4
21
+ with:
22
+ node-version: ${{ matrix.node-version }}
23
+ cache: 'npm'
24
+
25
+ - name: Install dependencies
26
+ run: npm ci
27
+
28
+ - name: Build SDK
29
+ run: npm run build
30
+
31
+ - name: Verify TypeScript compilation
32
+ run: npx tsc --noEmit
33
+
34
+ - name: Run unit tests
35
+ run: npm run test:unit
36
+
37
+ - name: Run integration tests
38
+ run: npm run test:integration
39
+
40
+ - name: Test package can be imported
41
+ run: node -e "require('./dist/index.js')"
@@ -0,0 +1,57 @@
1
+ name: Release
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ repository_dispatch:
7
+ types: [npm-publish]
8
+
9
+ jobs:
10
+ publish:
11
+ runs-on: ubuntu-latest
12
+ permissions:
13
+ contents: read
14
+ id-token: write # for npm provenance
15
+
16
+ steps:
17
+ - uses: actions/checkout@v4
18
+
19
+ - name: Setup Node.js
20
+ uses: actions/setup-node@v4
21
+ with:
22
+ node-version: '22'
23
+ registry-url: 'https://registry.npmjs.org'
24
+ cache: 'npm'
25
+
26
+ - name: Ensure npm version supports Trusted Publishing
27
+ run: |
28
+ npm --version
29
+ npm install -g npm@latest
30
+ npm --version
31
+
32
+ - name: Verify version matches release tag
33
+ run: |
34
+ PACKAGE_VERSION=$(node -p "require('./package.json').version")
35
+ # Handle both release event and repository_dispatch event
36
+ if [ "${{ github.event_name }}" = "repository_dispatch" ]; then
37
+ RELEASE_VERSION="${{ github.event.client_payload.version }}"
38
+ else
39
+ RELEASE_VERSION=${GITHUB_REF#refs/tags/v}
40
+ fi
41
+ if [ "$PACKAGE_VERSION" != "$RELEASE_VERSION" ]; then
42
+ echo "Error: package.json version ($PACKAGE_VERSION) does not match release version ($RELEASE_VERSION)"
43
+ exit 1
44
+ fi
45
+ echo "Version verified: $PACKAGE_VERSION"
46
+
47
+ - name: Install dependencies
48
+ run: npm ci
49
+
50
+ - name: Build SDK
51
+ run: npm run build
52
+
53
+ - name: Run tests before publishing
54
+ run: npm test
55
+
56
+ - name: Publish to npm
57
+ run: npm publish --access public
package/AGENTS.md ADDED
@@ -0,0 +1,94 @@
1
+ ## Issue Tracking with bd (beads)
2
+
3
+ **IMPORTANT**: This project uses **bd (beads)** for ALL issue tracking. Do NOT use markdown TODOs, task lists, or other tracking methods.
4
+
5
+ ### Quick Start
6
+
7
+ **Check for ready work:**
8
+ ```bash
9
+ bd ready --json
10
+ ```
11
+
12
+ **Create new issues:**
13
+ ```bash
14
+ bd create "Issue title" -t bug|feature|task -p 0-4 --json
15
+ bd create "Issue title" -p 1 --deps discovered-from:bd-123 --json
16
+ bd create "Subtask" --parent <epic-id> --json # Hierarchical subtask (gets ID like epic-id.1)
17
+ ```
18
+
19
+ **Claim and update:**
20
+ ```bash
21
+ bd update bd-42 --status in_progress --json
22
+ bd update bd-42 --priority 1 --json
23
+ ```
24
+
25
+ **Complete work:**
26
+ ```bash
27
+ bd close bd-42 --reason "Completed" --json
28
+ ```
29
+
30
+ ### Issue Types
31
+
32
+ - `bug` - Something broken
33
+ - `feature` - New functionality
34
+ - `task` - Work item (tests, docs, refactoring)
35
+ - `epic` - Large feature with subtasks
36
+ - `chore` - Maintenance (dependencies, tooling)
37
+
38
+ ### Priorities
39
+
40
+ - `0` - Critical (security, data loss, broken builds)
41
+ - `1` - High (major features, important bugs)
42
+ - `2` - Medium (default, nice-to-have)
43
+ - `3` - Low (polish, optimization)
44
+ - `4` - Backlog (future ideas)
45
+
46
+ ### Workflow
47
+
48
+ 1. **Check ready work**: `bd ready` shows unblocked issues
49
+ 2. **Claim your task**: `bd update <id> --status in_progress`
50
+ 3. **Work on it**: Implement, test, document
51
+ 4. **Discover new work?** Create linked issue:
52
+ - `bd create "Found bug" -p 1 --deps discovered-from:<parent-id>`
53
+ 5. **Complete**: `bd close <id> --reason "Done"`
54
+ 6. **Commit together**: Always commit the `.beads/issues.jsonl` file together with the code changes so issue state stays in sync with code state
55
+
56
+ ### Auto-Sync
57
+
58
+ bd automatically syncs with git:
59
+ - Exports to `.beads/issues.jsonl` after changes (5s debounce)
60
+ - Imports from JSONL when newer (e.g., after `git pull`)
61
+ - No manual export/import needed!
62
+
63
+ ### Planning Documents
64
+
65
+ If you want to create planning and design documents during development:
66
+ - PLAN.md, IMPLEMENTATION.md, ARCHITECTURE.md
67
+ - DESIGN.md, CODEBASE_SUMMARY.md, INTEGRATION_PLAN.md
68
+ - TESTING_GUIDE.md, TECHNICAL_DESIGN.md, and similar files
69
+
70
+ **Best Practice: Use a dedicated directory for these ephemeral files**
71
+
72
+ **Recommended approach:**
73
+ - Create a `history/` directory in the project root
74
+ - Store ALL planning/design docs in `history/`
75
+ - Keep the repository root clean and focused on permanent project files
76
+ - Only access `history/` when explicitly asked to review past planning
77
+
78
+ ### CLI Help
79
+
80
+ Run `bd <command> --help` to see all available flags for any command.
81
+ For example: `bd create --help` shows `--parent`, `--deps`, `--assignee`, etc.
82
+
83
+ ### Important Rules
84
+
85
+ - ✅ Use bd for ALL task tracking
86
+ - ✅ Always use `--json` flag for programmatic use
87
+ - ✅ Link discovered work with `discovered-from` dependencies
88
+ - ✅ Check `bd ready` before asking "what should I work on?"
89
+ - ✅ Store AI planning docs in `history/` directory
90
+ - ✅ Run `bd <cmd> --help` to discover available flags
91
+ - ❌ Do NOT create markdown TODO lists
92
+ - ❌ Do NOT use external issue trackers
93
+ - ❌ Do NOT duplicate tracking systems
94
+ - ❌ Do NOT clutter repo root with planning documents
package/CHANGELOG.md ADDED
@@ -0,0 +1,58 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [2.0.4] - 2025-12-18
9
+
10
+ ### Fixed
11
+
12
+ - Updated to npm 11.5.1+ for Trusted Publishing OIDC support
13
+
14
+ ## [2.0.3] - 2025-12-18
15
+
16
+ ### Fixed
17
+
18
+ - Fixed npm Trusted Publishing workflow configuration
19
+
20
+ ## [2.0.2] - 2025-12-18
21
+
22
+ ### Fixed
23
+
24
+ - Switched to npm Trusted Publishing (OIDC) for more secure token-less authentication
25
+
26
+ ## [2.0.1] - 2025-12-17
27
+
28
+ ### Fixed
29
+
30
+ - Fixed auto-release workflow not triggering npm publish due to GITHUB_TOKEN limitation
31
+ - Added repository_dispatch event to chain workflows correctly
32
+
33
+ ## [2.0.0] - 2025-12-17
34
+
35
+ ### Changed
36
+
37
+ - **BREAKING**: Migrated SDK code generator from openapi-generator to [Fern](https://buildwithfern.com)
38
+ - Removed OpenAI-compatible endpoints (use the native OpenAI SDK instead)
39
+ - Regenerated SDK with improved TypeScript types and error handling
40
+
41
+ ### Migration Guide
42
+
43
+ The package name remains `@speechall/sdk`. Update your code to remove any OpenAI-compatible endpoint usage:
44
+
45
+ ```typescript
46
+ // v1.x OpenAI-compatible (REMOVED)
47
+ // client.openaiCompatible.createTranscription(...)
48
+
49
+ // v2.x - Use native Speechall API
50
+ const result = await client.speechToText.transcribe(audioFile, {
51
+ model: 'openai.whisper-1',
52
+ language: 'en',
53
+ });
54
+ ```
55
+
56
+ ## [1.0.0] - 2025-06-09
57
+
58
+ Initial release of the TypeScript SDK generated with openapi-generator.
package/CLAUDE.md ADDED
@@ -0,0 +1,75 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Project Overview
6
+
7
+ This is the official TypeScript SDK for [speechall.com](https://speechall.com), a speech-to-text API supporting multiple providers (OpenAI Whisper, Deepgram, AssemblyAI, RevAI, Amazon Transcribe, etc.).
8
+
9
+ **The SDK is auto-generated using [Fern](https://buildwithfern.com) from an OpenAPI specification. Do not manually edit files in `src/`.**
10
+
11
+ ## Common Commands
12
+
13
+ ```bash
14
+ # Build
15
+ npm run build # Compile TypeScript to dist/
16
+
17
+ # Test
18
+ npm test # Run all tests
19
+ npm run test:unit # Unit tests only
20
+ npm run test:integration # Integration tests (requires SPEECHALL_API_TOKEN env var)
21
+ npm run test:coverage # Tests with coverage report
22
+
23
+ # SDK Regeneration (after OpenAPI spec changes)
24
+ ./regenerate.sh # Recommended: validates, generates, type-checks, and tests
25
+ fern generate --local --force # Manual generation
26
+ fern check # Validate OpenAPI spec
27
+
28
+ # Run examples (requires npm run build first)
29
+ npx tsx examples/basic-transcription.ts # Use tsx, not ts-node
30
+ ```
31
+
32
+ ## Architecture
33
+
34
+ ### Code Generation Flow
35
+ ```
36
+ OpenAPI spec → Fern generator → src/ (TypeScript) → npm run build → dist/ (JavaScript)
37
+ ```
38
+
39
+ Configuration: `fern/generators.yml` controls SDK generation options.
40
+
41
+ ### Client Structure
42
+ ```typescript
43
+ SpeechallClient
44
+ ├── speechToText // Main transcription API
45
+ │ ├── transcribe() // Local audio file
46
+ │ ├── transcribeRemote() // Remote URL
47
+ │ └── listSpeechToTextModels()
48
+ └── replacementRules // Text replacement rulesets
49
+ └── create()
50
+ ```
51
+
52
+ ### Key Directories
53
+ - `src/` - Generated TypeScript source (do not edit)
54
+ - `dist/` - Compiled JavaScript output
55
+ - `fern/` - Fern configuration (`generators.yml`, `fern.config.json`)
56
+ - `tests/` - Jest tests (unit and integration)
57
+ - `examples/` - Usage examples
58
+
59
+ ### Protected Files (not overwritten by Fern)
60
+ See `.fernignore`: tests/, examples/, tsconfig.json, jest.config.js, README.md
61
+
62
+ ### Regenerated Files
63
+ - `src/` - Fully regenerated by Fern
64
+ - `package.json` - Metadata from `fern/generators.yml` packageJson config
65
+
66
+ ## Error Types
67
+
68
+ SDK provides typed errors for HTTP status codes:
69
+ - `BadRequestError` (400), `UnauthorizedError` (401), `PaymentRequiredError` (402)
70
+ - `NotFoundError` (404), `TooManyRequestsError` (429)
71
+ - `InternalServerError` (500), `ServiceUnavailableError` (503), `GatewayTimeoutError` (504)
72
+ - `SpeechallTimeoutError` - Request timeout
73
+ - `SpeechallError` - Base error class
74
+
75
+ @AGENTS.md