assemblyai 4.4.5 → 4.4.7-beta.0

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assemblyai",
3
- "version": "4.4.5",
3
+ "version": "4.4.7-beta.0",
4
4
  "description": "The AssemblyAI JavaScript SDK provides an easy-to-use interface for interacting with the AssemblyAI API, which supports async and real-time transcription, as well as the latest LeMUR models.",
5
5
  "engines": {
6
6
  "node": ">=18"
@@ -16,7 +16,7 @@
16
16
  "types": "./dist/exports/index.d.ts",
17
17
  "default": "./dist/deno.mjs"
18
18
  },
19
- "workerd": "./dist/index.mjs",
19
+ "workerd": "./dist/workerd.mjs",
20
20
  "browser": "./dist/browser.mjs",
21
21
  "react-native": "./dist/browser.mjs",
22
22
  "node": {
@@ -38,6 +38,10 @@
38
38
  "./package.json": "./package.json"
39
39
  },
40
40
  "imports": {
41
+ "#fetch":{
42
+ "workerd": "./src/polyfills/fetch/workerd.ts",
43
+ "default": "./src/polyfills/fetch/default.ts"
44
+ },
41
45
  "#fs": {
42
46
  "node": "./src/polyfills/fs/node.ts",
43
47
  "bun": "./src/polyfills/fs/bun.ts",
@@ -67,7 +71,7 @@
67
71
  "url": "git+https://github.com/AssemblyAI/assemblyai-node-sdk.git"
68
72
  },
69
73
  "publishConfig": {
70
- "tag": "latest",
74
+ "tag": "beta",
71
75
  "access": "public",
72
76
  "registry": "https://registry.npmjs.org/"
73
77
  },
@@ -0,0 +1,3 @@
1
+ export const DEFAULT_FETCH_INIT: Record<string, unknown> = {
2
+ cache: "no-store"
3
+ };
@@ -0,0 +1,2 @@
1
+ export const DEFAULT_FETCH_INIT: Record<string, unknown> = {
2
+ };
@@ -1,5 +1,5 @@
1
- import { BaseServiceParams } from "..";
2
- import { Error as JsonError } from "..";
1
+ import { DEFAULT_FETCH_INIT } from "#fetch";
2
+ import { BaseServiceParams, Error as JsonError } from "..";
3
3
  import { buildUserAgent } from "../utils/userAgent";
4
4
 
5
5
  /**
@@ -22,13 +22,13 @@ export abstract class BaseService {
22
22
  input: string,
23
23
  init?: RequestInit | undefined,
24
24
  ): Promise<Response> {
25
- init = init ?? {};
26
- let headers = init.headers ?? {};
27
- headers = {
25
+ init = { ...DEFAULT_FETCH_INIT, ...init };
26
+ let headers = {
28
27
  Authorization: this.params.apiKey,
29
28
  "Content-Type": "application/json",
30
- ...init.headers,
31
29
  };
30
+ if (DEFAULT_FETCH_INIT?.headers) headers = { ...headers, ...DEFAULT_FETCH_INIT.headers };
31
+ if (init?.headers) headers = { ...headers, ...init.headers };
32
32
 
33
33
  if (this.userAgent) {
34
34
  (headers as Record<string, string>)["User-Agent"] = this.userAgent;
@@ -40,7 +40,6 @@ export abstract class BaseService {
40
40
  }
41
41
  init.headers = headers;
42
42
 
43
- init.cache = "no-store";
44
43
  if (!input.startsWith("http")) input = this.params.baseUrl + input;
45
44
 
46
45
  const response = await fetch(input, init);