assemblyai 4.5.0-beta.0 → 4.5.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.
Files changed (46) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +53 -9
  3. package/dist/assemblyai.streaming.umd.js +288 -0
  4. package/dist/assemblyai.streaming.umd.min.js +1 -0
  5. package/dist/assemblyai.umd.js +131 -12
  6. package/dist/assemblyai.umd.min.js +1 -1
  7. package/dist/browser.mjs +125 -11
  8. package/dist/bun.mjs +125 -11
  9. package/dist/deno.mjs +125 -11
  10. package/dist/exports/index.d.ts +2 -0
  11. package/dist/exports/streaming.d.ts +4 -0
  12. package/dist/index.cjs +131 -12
  13. package/dist/index.mjs +131 -12
  14. package/dist/node.cjs +125 -11
  15. package/dist/node.mjs +125 -11
  16. package/dist/polyfills/fetch/default.d.ts +1 -0
  17. package/dist/polyfills/fetch/workerd.d.ts +1 -0
  18. package/dist/services/base.d.ts +1 -0
  19. package/dist/services/lemur/index.d.ts +8 -1
  20. package/dist/services/transcripts/index.d.ts +16 -3
  21. package/dist/streaming.browser.mjs +239 -0
  22. package/dist/streaming.cjs +277 -0
  23. package/dist/streaming.mjs +274 -0
  24. package/dist/types/index.d.ts +7 -0
  25. package/dist/types/openapi.generated.d.ts +60 -23
  26. package/dist/types/services/index.d.ts +7 -0
  27. package/dist/types/transcripts/index.d.ts +9 -0
  28. package/dist/utils/userAgent.d.ts +2 -0
  29. package/dist/workerd.mjs +722 -0
  30. package/docs/reference-types-from-js.md +27 -0
  31. package/package.json +39 -19
  32. package/src/exports/index.ts +2 -0
  33. package/src/exports/streaming.ts +4 -0
  34. package/src/polyfills/fetch/default.ts +3 -0
  35. package/src/polyfills/fetch/workerd.ts +1 -0
  36. package/src/services/base.ts +27 -7
  37. package/src/services/files/index.ts +19 -2
  38. package/src/services/index.ts +2 -1
  39. package/src/services/lemur/index.ts +12 -0
  40. package/src/services/transcripts/index.ts +41 -4
  41. package/src/types/index.ts +9 -0
  42. package/src/types/openapi.generated.ts +198 -41
  43. package/src/types/services/index.ts +8 -0
  44. package/src/types/transcripts/index.ts +10 -0
  45. package/src/utils/path.ts +1 -0
  46. package/src/utils/userAgent.ts +51 -0
@@ -497,35 +497,50 @@ export type Entity = {
497
497
  * The type of entity for the detected entity
498
498
  */
499
499
  export type EntityType =
500
+ | "account_number"
500
501
  | "banking_information"
501
502
  | "blood_type"
502
503
  | "credit_card_cvv"
503
504
  | "credit_card_expiration"
504
505
  | "credit_card_number"
505
506
  | "date"
507
+ | "date_interval"
506
508
  | "date_of_birth"
507
509
  | "drivers_license"
508
510
  | "drug"
511
+ | "duration"
509
512
  | "email_address"
510
513
  | "event"
514
+ | "filename"
515
+ | "gender_sexuality"
516
+ | "healthcare_number"
511
517
  | "injury"
518
+ | "ip_address"
512
519
  | "language"
513
520
  | "location"
521
+ | "marital_status"
514
522
  | "medical_condition"
515
523
  | "medical_process"
516
524
  | "money_amount"
517
525
  | "nationality"
526
+ | "number_sequence"
518
527
  | "occupation"
519
528
  | "organization"
529
+ | "passport_number"
520
530
  | "password"
521
531
  | "person_age"
522
532
  | "person_name"
523
533
  | "phone_number"
534
+ | "physical_attribute"
524
535
  | "political_affiliation"
525
536
  | "religion"
537
+ | "statistics"
526
538
  | "time"
527
539
  | "url"
528
- | "us_social_security_number";
540
+ | "us_social_security_number"
541
+ | "username"
542
+ | "vehicle_id"
543
+ | "zodiac_sign";
529
544
 
530
545
  /**
531
546
  * @example
@@ -573,7 +588,11 @@ export type LemurActionItemsParams = LemurBaseParams & {
573
588
  * ```js
574
589
  * {
575
590
  * "request_id": "5"e1b27c2-691f-4414-8bc5-f14678442f9e",
576
- * "response": "Here are some potential action items based on the transcript:\n\n- Monitor air quality levels in affected areas and issue warnings as needed.\n\n- Advise vulnerable populations like children, the elderly, and those with respiratory conditions to limit time outdoors.\n\n- Have schools cancel outdoor activities when air quality is poor.\n\n- Educate the public on health impacts of smoke inhalation and precautions to take.\n\n- Track progression of smoke plumes using weather and air quality monitoring systems.\n\n- Coordinate cross-regionally to manage smoke exposure as air masses shift.\n\n- Plan for likely increase in such events due to climate change. Expand monitoring and forecasting capabilities.\n\n- Conduct research to better understand health impacts of wildfire smoke and mitigation strategies.\n\n- Develop strategies to prevent and manage wildfires to limit air quality impacts.\n"
591
+ * "response": "Here are some potential action items based on the transcript:\n\n- Monitor air quality levels in affected areas and issue warnings as needed.\n\n- Advise vulnerable populations like children, the elderly, and those with respiratory conditions to limit time outdoors.\n\n- Have schools cancel outdoor activities when air quality is poor.\n\n- Educate the public on health impacts of smoke inhalation and precautions to take.\n\n- Track progression of smoke plumes using weather and air quality monitoring systems.\n\n- Coordinate cross-regionally to manage smoke exposure as air masses shift.\n\n- Plan for likely increase in such events due to climate change. Expand monitoring and forecasting capabilities.\n\n- Conduct research to better understand health impacts of wildfire smoke and mitigation strategies.\n\n- Develop strategies to prevent and manage wildfires to limit air quality impacts.\n",
592
+ * "usage": {
593
+ * "input_tokens": 27,
594
+ * "output_tokens": 3
595
+ * }
577
596
  * }
578
597
  * ```
579
598
  */
@@ -644,7 +663,11 @@ export type LemurBaseParams = {
644
663
  * @example
645
664
  * ```js
646
665
  * {
647
- * "request_id": "5e1b27c2-691f-4414-8bc5-f14678442f9e"
666
+ * "request_id": "5e1b27c2-691f-4414-8bc5-f14678442f9e",
667
+ * "usage": {
668
+ * "input_tokens": 27,
669
+ * "output_tokens": 3
670
+ * }
648
671
  * }
649
672
  * ```
650
673
  */
@@ -653,6 +676,10 @@ export type LemurBaseResponse = {
653
676
  * The ID of the LeMUR request
654
677
  */
655
678
  request_id: string;
679
+ /**
680
+ * The usage numbers for the LeMUR request
681
+ */
682
+ usage: LemurUsage;
656
683
  };
657
684
 
658
685
  /**
@@ -773,7 +800,11 @@ export type LemurQuestionAnswerParams = LemurBaseParams & {
773
800
  * "answer": "yes",
774
801
  * "question": "Is global warming affecting wildfires?"
775
802
  * }
776
- * ]
803
+ * ],
804
+ * "usage": {
805
+ * "input_tokens": 27,
806
+ * "output_tokens": 3
807
+ * }
777
808
  * }
778
809
  * ```
779
810
  */
@@ -784,12 +815,18 @@ export type LemurQuestionAnswerResponse = LemurBaseResponse & {
784
815
  response: LemurQuestionAnswer[];
785
816
  };
786
817
 
818
+ export type LemurResponse =
819
+ | LemurTaskResponse
820
+ | LemurSummaryResponse
821
+ | LemurQuestionAnswerResponse
822
+ | LemurActionItemsResponse;
823
+
787
824
  /**
788
825
  * @example
789
826
  * ```js
790
827
  * {
791
828
  * "transcript_ids": [
792
- * "64nygnr62k-405c-4ae8-8a6b-d90b40ff3cce"
829
+ * "47b95ba5-8889-44d8-bc80-5de38306e582"
793
830
  * ],
794
831
  * "context": "This is an interview about wildfires.",
795
832
  * "final_model": "default",
@@ -810,7 +847,11 @@ export type LemurSummaryParams = LemurBaseParams & {
810
847
  * ```js
811
848
  * {
812
849
  * "request_id": "5e1b27c2-691f-4414-8bc5-f14678442f9e",
813
- * "response": "- Wildfires in Canada are sending smoke and air pollution across parts of the US, triggering air quality alerts from Maine to Minnesota. Concentrations of particulate matter have exceeded safety levels.\n\n- Weather systems are channeling the smoke through Pennsylvania into the Mid-Atlantic and Northeast regions. New York City has canceled outdoor activities to keep children and vulnerable groups indoors.\n\n- Very small particulate matter can enter the lungs and impact respiratory, cardiovascular and neurological health. Young children, the elderly and those with preexisting conditions are most at risk.\n\n- The conditions causing the poor air quality could get worse or shift to different areas in coming days depending on weather patterns. More wildfires may also contribute to higher concentrations.\n\n- Climate change is leading to longer and more severe fire seasons. Events of smoke traveling long distances and affecting air quality over wide areas will likely become more common in the future.\"\n"
850
+ * "response": "- Wildfires in Canada are sending smoke and air pollution across parts of the US, triggering air quality alerts from Maine to Minnesota. Concentrations of particulate matter have exceeded safety levels.\n\n- Weather systems are channeling the smoke through Pennsylvania into the Mid-Atlantic and Northeast regions. New York City has canceled outdoor activities to keep children and vulnerable groups indoors.\n\n- Very small particulate matter can enter the lungs and impact respiratory, cardiovascular and neurological health. Young children, the elderly and those with preexisting conditions are most at risk.\n\n- The conditions causing the poor air quality could get worse or shift to different areas in coming days depending on weather patterns. More wildfires may also contribute to higher concentrations.\n\n- Climate change is leading to longer and more severe fire seasons. Events of smoke traveling long distances and affecting air quality over wide areas will likely become more common in the future.\"\n",
851
+ * "usage": {
852
+ * "input_tokens": 27,
853
+ * "output_tokens": 3
854
+ * }
814
855
  * }
815
856
  * ```
816
857
  */
@@ -848,7 +889,11 @@ export type LemurTaskParams = {
848
889
  * ```js
849
890
  * {
850
891
  * "request_id": "5e1b27c2-691f-4414-8bc5-f14678442f9e",
851
- * "response": "Based on the transcript, the following locations were mentioned as being affected by wildfire smoke from Canada:\n\n- Maine\n- Maryland\n- Minnesota\n- Mid Atlantic region\n- Northeast region\n- New York City\n- Baltimore\n"
892
+ * "response": "Based on the transcript, the following locations were mentioned as being affected by wildfire smoke from Canada:\n\n- Maine\n- Maryland\n- Minnesota\n- Mid Atlantic region\n- Northeast region\n- New York City\n- Baltimore\n",
893
+ * "usage": {
894
+ * "input_tokens": 27,
895
+ * "output_tokens": 3
896
+ * }
852
897
  * }
853
898
  * ```
854
899
  */
@@ -859,6 +904,20 @@ export type LemurTaskResponse = {
859
904
  response: string;
860
905
  } & LemurBaseResponse;
861
906
 
907
+ /**
908
+ * The usage numbers for the LeMUR request
909
+ */
910
+ export type LemurUsage = {
911
+ /**
912
+ * The number of input tokens used by the model
913
+ */
914
+ input_tokens: number;
915
+ /**
916
+ * The number of output tokens generated by the model
917
+ */
918
+ output_tokens: number;
919
+ };
920
+
862
921
  /**
863
922
  * @example
864
923
  * ```js
@@ -901,7 +960,6 @@ export type ListTranscriptParams = {
901
960
  };
902
961
 
903
962
  /**
904
- * Details of the transcript page.
905
963
  * Details of the transcript page. Transcripts are sorted from newest to oldest. The previous URL always points to a page with older transcripts.
906
964
  * @example
907
965
  * ```js
@@ -924,12 +982,10 @@ export type PageDetails = {
924
982
  */
925
983
  limit: number;
926
984
  /**
927
- * The URL to the next page of transcripts
928
985
  * The URL to the next page of transcripts. The next URL always points to a page with newer transcripts.
929
986
  */
930
987
  next_url: string | null;
931
988
  /**
932
- * The URL to the previous page of transcripts
933
989
  * The URL to the next page of transcripts. The previous URL always points to a page with older transcripts.
934
990
  */
935
991
  prev_url: string | null;
@@ -1023,34 +1079,54 @@ export type ParagraphsResponse = {
1023
1079
  paragraphs: TranscriptParagraph[];
1024
1080
  };
1025
1081
 
1082
+ /**
1083
+ * The type of PII to redact
1084
+ */
1026
1085
  export type PiiPolicy =
1027
- | "medical_process"
1028
- | "medical_condition"
1086
+ | "account_number"
1087
+ | "banking_information"
1029
1088
  | "blood_type"
1030
- | "drug"
1031
- | "injury"
1032
- | "number_sequence"
1033
- | "email_address"
1034
- | "date_of_birth"
1035
- | "phone_number"
1036
- | "us_social_security_number"
1037
- | "credit_card_number"
1038
- | "credit_card_expiration"
1039
1089
  | "credit_card_cvv"
1090
+ | "credit_card_expiration"
1091
+ | "credit_card_number"
1040
1092
  | "date"
1041
- | "nationality"
1093
+ | "date_interval"
1094
+ | "date_of_birth"
1095
+ | "drivers_license"
1096
+ | "drug"
1097
+ | "duration"
1098
+ | "email_address"
1042
1099
  | "event"
1100
+ | "filename"
1101
+ | "gender_sexuality"
1102
+ | "healthcare_number"
1103
+ | "injury"
1104
+ | "ip_address"
1043
1105
  | "language"
1044
1106
  | "location"
1107
+ | "marital_status"
1108
+ | "medical_condition"
1109
+ | "medical_process"
1045
1110
  | "money_amount"
1046
- | "person_name"
1047
- | "person_age"
1111
+ | "nationality"
1112
+ | "number_sequence"
1113
+ | "occupation"
1048
1114
  | "organization"
1115
+ | "passport_number"
1116
+ | "password"
1117
+ | "person_age"
1118
+ | "person_name"
1119
+ | "phone_number"
1120
+ | "physical_attribute"
1049
1121
  | "political_affiliation"
1050
- | "occupation"
1051
1122
  | "religion"
1052
- | "drivers_license"
1053
- | "banking_information";
1123
+ | "statistics"
1124
+ | "time"
1125
+ | "url"
1126
+ | "us_social_security_number"
1127
+ | "username"
1128
+ | "vehicle_id"
1129
+ | "zodiac_sign";
1054
1130
 
1055
1131
  /**
1056
1132
  * @example
@@ -1234,7 +1310,7 @@ export type SentencesResponse = {
1234
1310
  export type Sentiment = "POSITIVE" | "NEUTRAL" | "NEGATIVE";
1235
1311
 
1236
1312
  /**
1237
- * The result of the sentiment analysis model
1313
+ * The result of the Sentiment Analysis model
1238
1314
  * @example
1239
1315
  * ```js
1240
1316
  * {
@@ -2239,7 +2315,7 @@ export type Transcript = {
2239
2315
  auto_highlights: boolean;
2240
2316
  /**
2241
2317
  * An array of results for the Key Phrases model, if it is enabled.
2242
- * See {@link https://www.assemblyai.com/docs/models/key-phrases | Key phrases } for more information.
2318
+ * See {@link https://www.assemblyai.com/docs/models/key-phrases | Key Phrases } for more information.
2243
2319
  */
2244
2320
  auto_highlights_result?: AutoHighlightsResult | null;
2245
2321
  /**
@@ -2361,7 +2437,7 @@ export type Transcript = {
2361
2437
  sentiment_analysis?: boolean | null;
2362
2438
  /**
2363
2439
  * An array of results for the Sentiment Analysis model, if it is enabled.
2364
- * See {@link https://www.assemblyai.com/docs/models/sentiment-analysis | Sentiment analysis } for more information.
2440
+ * See {@link https://www.assemblyai.com/docs/models/sentiment-analysis | Sentiment Analysis } for more information.
2365
2441
  */
2366
2442
  sentiment_analysis_results?: SentimentAnalysisResult[] | null;
2367
2443
  /**
@@ -2438,7 +2514,7 @@ export type Transcript = {
2438
2514
  */
2439
2515
  webhook_status_code?: number | null;
2440
2516
  /**
2441
- * The URL to which we send webhooks upon trancription completion
2517
+ * The URL to which we send webhooks upon transcription completion
2442
2518
  */
2443
2519
  webhook_url?: string | null;
2444
2520
  /**
@@ -2497,19 +2573,100 @@ export type TranscriptLanguageCode =
2497
2573
  | "it"
2498
2574
  | "pt"
2499
2575
  | "nl"
2500
- | "hi"
2501
- | "ja"
2576
+ | "af"
2577
+ | "sq"
2578
+ | "am"
2579
+ | "ar"
2580
+ | "hy"
2581
+ | "as"
2582
+ | "az"
2583
+ | "ba"
2584
+ | "eu"
2585
+ | "be"
2586
+ | "bn"
2587
+ | "bs"
2588
+ | "br"
2589
+ | "bg"
2590
+ | "my"
2591
+ | "ca"
2502
2592
  | "zh"
2593
+ | "hr"
2594
+ | "cs"
2595
+ | "da"
2596
+ | "et"
2597
+ | "fo"
2503
2598
  | "fi"
2599
+ | "gl"
2600
+ | "ka"
2601
+ | "el"
2602
+ | "gu"
2603
+ | "ht"
2604
+ | "ha"
2605
+ | "haw"
2606
+ | "he"
2607
+ | "hi"
2608
+ | "hu"
2609
+ | "is"
2610
+ | "id"
2611
+ | "ja"
2612
+ | "jw"
2613
+ | "kn"
2614
+ | "kk"
2615
+ | "km"
2504
2616
  | "ko"
2617
+ | "lo"
2618
+ | "la"
2619
+ | "lv"
2620
+ | "ln"
2621
+ | "lt"
2622
+ | "lb"
2623
+ | "mk"
2624
+ | "mg"
2625
+ | "ms"
2626
+ | "ml"
2627
+ | "mt"
2628
+ | "mi"
2629
+ | "mr"
2630
+ | "mn"
2631
+ | "ne"
2632
+ | "no"
2633
+ | "nn"
2634
+ | "oc"
2635
+ | "pa"
2636
+ | "ps"
2637
+ | "fa"
2505
2638
  | "pl"
2639
+ | "ro"
2506
2640
  | "ru"
2641
+ | "sa"
2642
+ | "sr"
2643
+ | "sn"
2644
+ | "sd"
2645
+ | "si"
2646
+ | "sk"
2647
+ | "sl"
2648
+ | "so"
2649
+ | "su"
2650
+ | "sw"
2651
+ | "sv"
2652
+ | "tl"
2653
+ | "tg"
2654
+ | "ta"
2655
+ | "tt"
2656
+ | "te"
2657
+ | "th"
2658
+ | "bo"
2507
2659
  | "tr"
2660
+ | "tk"
2508
2661
  | "uk"
2509
- | "vi";
2662
+ | "ur"
2663
+ | "uz"
2664
+ | "vi"
2665
+ | "cy"
2666
+ | "yi"
2667
+ | "yo";
2510
2668
 
2511
2669
  /**
2512
- * A list of transcripts
2513
2670
  * A list of transcripts. Transcripts are sorted from newest to oldest. The previous URL always points to a page with older transcripts.
2514
2671
  * @example
2515
2672
  * ```js
@@ -2649,7 +2806,7 @@ export type TranscriptOptionalParams = {
2649
2806
  */
2650
2807
  auto_chapters?: boolean;
2651
2808
  /**
2652
- * Whether Key Phrases is enabled, either true or false
2809
+ * Enable Key Phrases, either true or false
2653
2810
  */
2654
2811
  auto_highlights?: boolean;
2655
2812
  /**
@@ -2661,7 +2818,7 @@ export type TranscriptOptionalParams = {
2661
2818
  */
2662
2819
  content_safety?: boolean;
2663
2820
  /**
2664
- * The confidence threshold for content moderation. Values must be between 25 and 100.
2821
+ * The confidence threshold for the Content Moderation model. Values must be between 25 and 100.
2665
2822
  */
2666
2823
  content_safety_confidence?: number;
2667
2824
  /**
@@ -2669,7 +2826,7 @@ export type TranscriptOptionalParams = {
2669
2826
  */
2670
2827
  custom_spelling?: TranscriptCustomSpelling[];
2671
2828
  /**
2672
- * Whether custom topics is enabled, either true or false
2829
+ * Enable custom topics, either true or false
2673
2830
  */
2674
2831
  custom_topics?: boolean;
2675
2832
  /**
@@ -2702,7 +2859,7 @@ export type TranscriptOptionalParams = {
2702
2859
  */
2703
2860
  language_code?: LiteralUnion<TranscriptLanguageCode, string> | null;
2704
2861
  /**
2705
- * Whether {@link https://www.assemblyai.com/docs/models/speech-recognition#automatic-language-detection | Automatic language detection } was enabled in the transcription request, either true or false.
2862
+ * Enable {@link https://www.assemblyai.com/docs/models/speech-recognition#automatic-language-detection | Automatic language detection }, either true or false.
2706
2863
  */
2707
2864
  language_detection?: boolean;
2708
2865
  /**
@@ -2770,7 +2927,7 @@ export type TranscriptOptionalParams = {
2770
2927
  */
2771
2928
  summary_type?: SummaryType;
2772
2929
  /**
2773
- * The list of custom topics provided, if custom topics is enabled
2930
+ * The list of custom topics
2774
2931
  */
2775
2932
  topics?: string[];
2776
2933
  /**
@@ -2784,7 +2941,7 @@ export type TranscriptOptionalParams = {
2784
2941
  */
2785
2942
  webhook_auth_header_value?: string | null;
2786
2943
  /**
2787
- * The URL to which AssemblyAI send webhooks upon trancription completion
2944
+ * The URL to which AssemblyAI send webhooks upon transcription completion
2788
2945
  */
2789
2946
  webhook_url?: string;
2790
2947
  /**
@@ -1,6 +1,14 @@
1
+ import { UserAgent } from "..";
2
+
1
3
  type BaseServiceParams = {
2
4
  apiKey: string;
3
5
  baseUrl?: string;
6
+ /**
7
+ * The AssemblyAI user agent to use for requests.
8
+ * The provided components will be merged into the default AssemblyAI user agent.
9
+ * If `false`, the AssemblyAI user agent will be removed.
10
+ */
11
+ userAgent?: UserAgent | false;
4
12
  };
5
13
 
6
14
  export type { BaseServiceParams };
@@ -54,3 +54,13 @@ export type SubmitParams = TranscribeParams;
54
54
  * The options to transcribe an audio file, including polling options.
55
55
  */
56
56
  export type TranscribeOptions = PollingOptions;
57
+
58
+ /**
59
+ * The PII redacted audio file, transmitted over the network.
60
+ */
61
+ export type RedactedAudioFile = {
62
+ arrayBuffer: () => Promise<ArrayBuffer>;
63
+ blob: () => Promise<Blob>;
64
+ body: ReadableStream<Uint8Array> | null;
65
+ bodyUsed: boolean;
66
+ };
package/src/utils/path.ts CHANGED
@@ -1,6 +1,7 @@
1
1
  export function getPath(path: string) {
2
2
  if (path.startsWith("http")) return null;
3
3
  if (path.startsWith("https")) return null;
4
+ if (path.startsWith("data:")) return null;
4
5
  if (path.startsWith("file://")) return path.substring(7);
5
6
  if (path.startsWith("file:")) return path.substring(5);
6
7
  return path;
@@ -0,0 +1,51 @@
1
+ import { UserAgent } from "../types";
2
+
3
+ export const buildUserAgent = (userAgent: UserAgent | false) =>
4
+ defaultUserAgentString +
5
+ (userAgent === false
6
+ ? ""
7
+ : " AssemblyAI/1.0 (" +
8
+ Object.entries({ ...defaultUserAgent, ...userAgent })
9
+ .map(([key, item]) =>
10
+ item ? `${key}=${item.name}/${item.version}` : "",
11
+ )
12
+ .join(" ") +
13
+ ")");
14
+
15
+ let defaultUserAgentString = "";
16
+ if (typeof navigator !== "undefined" && navigator.userAgent) {
17
+ defaultUserAgentString += navigator.userAgent;
18
+ }
19
+
20
+ const defaultUserAgent: UserAgent = {
21
+ sdk: { name: "JavaScript", version: "__SDK_VERSION__" },
22
+ };
23
+
24
+ if (typeof process !== "undefined") {
25
+ if (process.versions.node && defaultUserAgentString.indexOf("Node") === -1) {
26
+ defaultUserAgent.runtime_env = {
27
+ name: "Node",
28
+ version: process.versions.node,
29
+ };
30
+ }
31
+ if (process.versions.bun && defaultUserAgentString.indexOf("Bun") === -1) {
32
+ defaultUserAgent.runtime_env = {
33
+ name: "Bun",
34
+ version: process.versions.bun,
35
+ };
36
+ }
37
+ }
38
+
39
+ declare const Deno:
40
+ | {
41
+ version: {
42
+ deno: string;
43
+ };
44
+ }
45
+ | undefined;
46
+
47
+ if (typeof Deno !== "undefined") {
48
+ if (process.versions.bun && defaultUserAgentString.indexOf("Deno") === -1) {
49
+ defaultUserAgent.runtime_env = { name: "Deno", version: Deno.version.deno };
50
+ }
51
+ }