Skip to content

Commit

Permalink
Merge pull request #42 from AssemblyAI/18E400FF9A7719F04C627C4BA0CBFC3E
Browse files Browse the repository at this point in the history
Sync from internal repo (2024/04/27)
  • Loading branch information
Swimburger authored Mar 19, 2024
2 parents bacca29 + d5f4c2a commit b7429db
Show file tree
Hide file tree
Showing 20 changed files with 375 additions and 375 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/api-reference.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
name: Publish API reference

on: workflow_dispatch
on:
release:
types: [published]

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
Expand All @@ -19,7 +21,7 @@ jobs:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
name: Build and publish API reference to GH Pages
name: Build and publish to npmjs.com
runs-on: ubuntu-latest
steps:
- name: Setup Node.js 20
Expand Down
9 changes: 4 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ It is written primarily for Node.js in TypeScript with all types exported, but a

## Documentation

Visit the [AssemblyAI documentation](https://www.assemblyai.com/docs) for step-by-step instructions and a lot more details about our AI models and API.
Explore the [SDK API reference](https://assemblyai.github.io/assemblyai-node-sdk/) for more details on the SDK types, functions, and classes.
Visit the [AssemblyAI documentation](https://www.assemblyai.com/docs) for step-by-step instructions and a lot more details about our AI models and API.

## Quickstart

Expand Down Expand Up @@ -241,9 +240,9 @@ You can configure the following events.
```typescript
rt.on("open", ({ sessionId, expiresAt }) => console.log('Session ID:', sessionId, 'Expires at:', expiresAt));
rt.on("close", (code: number, reason: string) => console.log('Closed', code, reason));
rt.on("transcript", (transcript: RealtimeTranscript) => console.log('Transcript:', transcript));
rt.on("transcript.partial", (transcript: PartialTranscript) => console.log('Partial transcript:', transcript));
rt.on("transcript.final", (transcript: FinalTranscript) => console.log('Final transcript:', transcript));
rt.on("transcript", (transcript: TranscriptMessage) => console.log('Transcript:', transcript));
rt.on("transcript.partial", (transcript: PartialTranscriptMessage) => console.log('Partial transcript:', transcript));
rt.on("transcript.final", (transcript: FinalTranscriptMessage) => console.log('Final transcript:', transcript));
rt.on("error", (error: Error) => console.error('Error', error));
```

Expand Down
51 changes: 24 additions & 27 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -67,12 +67,11 @@
},
"scripts": {
"build": "pnpm clean && pnpm rollup -c",
"clean": "rimraf dist/*",
"lint": "eslint -c .eslintrc.json '{src,tests}/**/*.{js,ts}' && publint",
"clean": "rimraf dist/* && rimraf temp/* && rimraf temp-docs/*",
"lint": "eslint -c .eslintrc.json '{src,tests}/**/*.{js,ts}' && publint && tsc --noEmit -p tsconfig.json",
"test": "jest --config jest.config.js",
"format": "prettier '**/*' --write",
"generate-types": "tsx ./scripts/generate-types.ts && pnpm format",
"generate-reference": "typedoc",
"copybara:dry-run": "./copybara.sh dry_run --init-history",
"copybara:pr": "./copybara.sh sync_out --init-history"
},
Expand All @@ -99,38 +98,36 @@
"docs"
],
"devDependencies": {
"@babel/preset-env": "^7.23.5",
"@babel/preset-env": "^7.24.0",
"@babel/preset-typescript": "^7.23.3",
"@rollup/plugin-node-resolve": "^15.2.3",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^11.1.5",
"@types/jest": "^29.5.5",
"@types/node": "^20.5.7",
"@types/websocket": "^1.0.8",
"@types/ws": "^8.5.5",
"@typescript-eslint/eslint-plugin": "^6.7.5",
"dotenv": "^16.3.1",
"eslint": "^8.48.0",
"@rollup/plugin-typescript": "^11.1.6",
"@types/jest": "^29.5.12",
"@types/node": "^18.11.9",
"@types/websocket": "^1.0.10",
"@types/ws": "^8.5.10",
"@typescript-eslint/eslint-plugin": "^7.2.0",
"dotenv": "^16.4.5",
"eslint": "^8.57.0",
"eslint-plugin-tsdoc": "^0.2.17",
"jest": "^29.5.0",
"jest-cli": "^29.5.0",
"jest": "^29.7.0",
"jest-cli": "^29.7.0",
"jest-fetch-mock": "^3.0.3",
"jest-junit": "^16.0.0",
"jest-websocket-mock": "^2.4.1",
"mock-socket": "^9.2.1",
"npm": "^9.7.1",
"openapi-typescript": "^6.6.1",
"prettier": "^2.8.8",
"publint": "^0.2.5",
"rimraf": "^5.0.1",
"rollup": "^3.25.1",
"ts-jest": "^29.1.0",
"jest-websocket-mock": "^2.5.0",
"mock-socket": "^9.3.1",
"openapi-typescript": "^6.7.5",
"prettier": "^3.2.5",
"publint": "^0.2.7",
"rimraf": "^5.0.5",
"rollup": "^4.13.0",
"ts-jest": "^29.1.2",
"tslib": "^2.5.3",
"typedoc": "^0.25.12",
"typedoc-plugin-extras": "^3.0.0",
"typescript": "^5.2.2"
"typescript": "^5.4.2",
"typedoc": "^0.25.12"
},
"dependencies": {
"ws": "^8.13.0"
"ws": "^8.16.0"
}
}
6 changes: 3 additions & 3 deletions scripts/generate-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async function generateTypes(apiSpecPath: string, outputPath: string) {
// Remove everything before and after the schemas, as we're only interested in schemas.
.substring(
schemasPosition,
output.indexOf("\n };\n responses", schemasPosition)
output.indexOf("\n };\n responses", schemasPosition),
)
// Turn components["schemas"]["{TYPE_NAME}"] into TYPE_NAME
.replace(/components\["schemas"]\["(\w*)"\]/gm, "$1")
Expand Down Expand Up @@ -50,7 +50,7 @@ async function generateTypes(apiSpecPath: string, outputPath: string) {
// replace prefix js examples with js code blocks
.replaceAll(
/@example (?:({(?:\n|.)*? \* })|(\[(?:\n|.)*? \* \]))/gm,
"@example\n * ```js\n * $1$2\n * ```"
"@example\n * ```js\n * $1$2\n * ```",
)
// put string examples in quotes
.replaceAll(/@example ([^0-9]+\d*)/g, '@example "$1"')
Expand All @@ -61,7 +61,7 @@ async function generateTypes(apiSpecPath: string, outputPath: string) {
// move description to the beginning of multi-line comments
.replaceAll(
/( *\/\*\* *\n)((?:\s|\S)*)\n(\s*\* @description (?:.*))( *\*\/\n)/gm,
"$1$3$2$4"
"$1$3$2$4",
)
.replaceAll(
/(?:\[(.*)\])(?:\(((?:http)(?:s)?(?::\/\/).*)\))/gm,
Expand Down
Loading

0 comments on commit b7429db

Please sign in to comment.