New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

assemblyai

Package Overview
Dependencies
Maintainers
1
Versions
53
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

assemblyai - npm Package Compare versions

Comparing version 2.0.2 to 3.0.0

dist/types/files/index.d.ts

4

dist/index.d.ts

@@ -1,4 +0,2 @@

import { AssemblyAI } from "./services";
export type * from "./types";
export * from "./services";
export type * from "./types";
export default AssemblyAI;
import axios, { isAxiosError } from 'axios';
import WebSocket from 'ws';
import { Writable } from 'stream';
import { readFile } from 'fs/promises';
import fs from 'fs';

@@ -372,11 +372,19 @@ function createAxiosClient(params) {

}
// TODO: add options overload to support list querystring parameters
/**
* Retrieves a paged list of transcript listings.
* @param nextUrl The URL to retrieve the transcript list from. If not provided, the first page will be retrieved.
* @returns
* Retrieves a page of transcript listings.
* @param parameters The parameters to filter the transcript list by, or the URL to retrieve the transcript list from.
*/
list(nextUrl) {
list(parameters) {
return __awaiter(this, void 0, void 0, function* () {
const { data } = yield this.client.get(nextUrl !== null && nextUrl !== void 0 ? nextUrl : "/v2/transcript");
let url = "/v2/transcript";
let query;
if (typeof parameters === "string") {
url = parameters;
}
else if (parameters) {
query = parameters;
}
const { data } = yield this.client.get(url, {
params: query,
});
for (const transcriptListItem of data.transcripts) {

@@ -482,9 +490,13 @@ transcriptListItem.created = new Date(transcriptListItem.created);

* Upload a local file to AssemblyAI.
* @param path The local file to upload.
* @param input The local file path to upload, or a stream or buffer of the file to upload.
* @return A promise that resolves to the uploaded file URL.
*/
upload(path) {
upload(input) {
return __awaiter(this, void 0, void 0, function* () {
const file = yield readFile(path);
const { data } = yield this.client.post("/v2/upload", file, {
let fileData;
if (typeof input === "string")
fileData = fs.createReadStream(input);
else
fileData = input;
const { data } = yield this.client.post("/v2/upload", fileData, {
headers: {

@@ -514,16 +526,2 @@ "Content-Type": "application/octet-stream",

var services = /*#__PURE__*/Object.freeze({
__proto__: null,
AssemblyAI: AssemblyAI,
FileService: FileService,
LemurService: LemurService,
RealtimeService: RealtimeService,
RealtimeServiceFactory: RealtimeServiceFactory,
TranscriptService: TranscriptService
});
class AssemblyAIExports extends AssemblyAI {
}
module.exports = Object.assign(AssemblyAIExports, services);
export { AssemblyAI, FileService, LemurService, RealtimeService, RealtimeServiceFactory, TranscriptService, AssemblyAI as default };
export { AssemblyAI, FileService, LemurService, RealtimeService, RealtimeServiceFactory, TranscriptService };
'use strict';
Object.defineProperty(exports, '__esModule', { value: true });
var axios = require('axios');
var WebSocket = require('ws');
var stream = require('stream');
var promises = require('fs/promises');
var fs = require('fs');

@@ -376,11 +374,19 @@ function createAxiosClient(params) {

}
// TODO: add options overload to support list querystring parameters
/**
* Retrieves a paged list of transcript listings.
* @param nextUrl The URL to retrieve the transcript list from. If not provided, the first page will be retrieved.
* @returns
* Retrieves a page of transcript listings.
* @param parameters The parameters to filter the transcript list by, or the URL to retrieve the transcript list from.
*/
list(nextUrl) {
list(parameters) {
return __awaiter(this, void 0, void 0, function* () {
const { data } = yield this.client.get(nextUrl !== null && nextUrl !== void 0 ? nextUrl : "/v2/transcript");
let url = "/v2/transcript";
let query;
if (typeof parameters === "string") {
url = parameters;
}
else if (parameters) {
query = parameters;
}
const { data } = yield this.client.get(url, {
params: query,
});
for (const transcriptListItem of data.transcripts) {

@@ -486,9 +492,13 @@ transcriptListItem.created = new Date(transcriptListItem.created);

* Upload a local file to AssemblyAI.
* @param path The local file to upload.
* @param input The local file path to upload, or a stream or buffer of the file to upload.
* @return A promise that resolves to the uploaded file URL.
*/
upload(path) {
upload(input) {
return __awaiter(this, void 0, void 0, function* () {
const file = yield promises.readFile(path);
const { data } = yield this.client.post("/v2/upload", file, {
let fileData;
if (typeof input === "string")
fileData = fs.createReadStream(input);
else
fileData = input;
const { data } = yield this.client.post("/v2/upload", fileData, {
headers: {

@@ -518,16 +528,2 @@ "Content-Type": "application/octet-stream",

var services = /*#__PURE__*/Object.freeze({
__proto__: null,
AssemblyAI: AssemblyAI,
FileService: FileService,
LemurService: LemurService,
RealtimeService: RealtimeService,
RealtimeServiceFactory: RealtimeServiceFactory,
TranscriptService: TranscriptService
});
class AssemblyAIExports extends AssemblyAI {
}
module.exports = Object.assign(AssemblyAIExports, services);
exports.AssemblyAI = AssemblyAI;

@@ -539,2 +535,1 @@ exports.FileService = FileService;

exports.TranscriptService = TranscriptService;
exports.default = AssemblyAI;
import { BaseService } from "@/services/base";
import { FileUploadParameters } from "@/types";
export declare class FileService extends BaseService {
/**
* Upload a local file to AssemblyAI.
* @param path The local file to upload.
* @param input The local file path to upload, or a stream or buffer of the file to upload.
* @return A promise that resolves to the uploaded file URL.
*/
upload(path: string): Promise<string>;
upload(input: FileUploadParameters): Promise<string>;
}
import { BaseService } from "@/services/base";
import { ParagraphsResponse, SentencesResponse, Transcript, TranscriptList, CreateTranscriptParameters, CreateTranscriptOptions, Createable, Deletable, Listable, Retrieveable, SubtitleFormat, RedactedAudioResponse, WordSearchResponse } from "@/types";
import { ParagraphsResponse, SentencesResponse, Transcript, TranscriptList, CreateTranscriptParameters, CreateTranscriptOptions, Createable, Deletable, Listable, Retrieveable, SubtitleFormat, RedactedAudioResponse, TranscriptListParameters, WordSearchResponse } from "@/types";
import { AxiosInstance } from "axios";

@@ -23,7 +23,6 @@ import { FileService } from "../files";

/**
* Retrieves a paged list of transcript listings.
* @param nextUrl The URL to retrieve the transcript list from. If not provided, the first page will be retrieved.
* @returns
* Retrieves a page of transcript listings.
* @param parameters The parameters to filter the transcript list by, or the URL to retrieve the transcript list from.
*/
list(nextUrl?: string | null): Promise<TranscriptList>;
list(parameters?: TranscriptListParameters | string): Promise<TranscriptList>;
/**

@@ -30,0 +29,0 @@ * Delete a transcript

@@ -0,1 +1,2 @@

export type * from "./files";
export type * from "./transcripts";

@@ -2,0 +3,0 @@ export type * from "./realtime";

@@ -623,2 +623,23 @@ /** OneOf type helpers */

};
export type TranscriptListParameters = {
/** @description Get transcripts that were created after this transcript ID */
after_id?: string;
/** @description Get transcripts that were created before this transcript ID */
before_id?: string;
/**
* Format: date
* @description Only get transcripts created on this date
*/
created_on?: string;
/**
* Format: int64
* @description Maximum amount of transcripts to retrieve
* @default 10
*/
limit?: number;
/** @description Filter by transcript status */
status?: TranscriptStatus;
/** @description Only get throttled transcripts, overrides the status filter */
throttled_only?: boolean;
};
export type TranscriptParagraph = {

@@ -625,0 +646,0 @@ /** Format: double */

@@ -1,3 +0,3 @@

import { BaseServiceParams } from "../.";
import { BaseServiceParams } from "@/types";
export declare function createAxiosClient(params: BaseServiceParams): import("axios").AxiosInstance;
export declare function throwApiError(error: unknown): Promise<never>;
{
"name": "assemblyai",
"version": "2.0.2",
"version": "3.0.0",
"description": "The AssemblyAI Node.js 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,0 +5,0 @@ "main": "dist/index.js",

@@ -43,3 +43,3 @@ <img src="https://github.com/AssemblyAI/assemblyai-node-sdk/blob/main/assemblyai.png?raw=true" width="500"/>

```javascript
import AssemblyAI from "assemblyai";
import { AssemblyAI } from "assemblyai";

@@ -98,3 +98,3 @@ const client = new AssemblyAI({

This will return a paged list of transcripts that you have transcript.
This will return a page of transcripts that you have transcript.

@@ -101,0 +101,0 @@ ```javascript

@@ -1,7 +0,2 @@

import * as services from "./services";
import { AssemblyAI } from "./services";
export type * from "./types";
export * from "./services";
export type * from "./types";
export default AssemblyAI;
class AssemblyAIExports extends AssemblyAI {}
module.exports = Object.assign(AssemblyAIExports, services);

@@ -1,4 +0,6 @@

import { readFile } from "fs/promises";
// import the fs module instead if specific named exports
// to keep the assemblyai module more compatible. Some fs polyfills don't include `createReadStream`.
import fs from "fs";
import { BaseService } from "@/services/base";
import { UploadedFile } from "@/types";
import { UploadedFile, FileUploadParameters, FileUploadData } from "@/types";

@@ -8,13 +10,19 @@ export class FileService extends BaseService {

* Upload a local file to AssemblyAI.
* @param path The local file to upload.
* @param input The local file path to upload, or a stream or buffer of the file to upload.
* @return A promise that resolves to the uploaded file URL.
*/
async upload(path: string): Promise<string> {
const file = await readFile(path);
async upload(input: FileUploadParameters): Promise<string> {
let fileData: FileUploadData;
if (typeof input === "string") fileData = fs.createReadStream(input);
else fileData = input;
const { data } = await this.client.post<UploadedFile>("/v2/upload", file, {
headers: {
"Content-Type": "application/octet-stream",
},
});
const { data } = await this.client.post<UploadedFile>(
"/v2/upload",
fileData,
{
headers: {
"Content-Type": "application/octet-stream",
},
}
);

@@ -21,0 +29,0 @@ return data.upload_url;

@@ -15,2 +15,3 @@ import { BaseService } from "@/services/base";

RedactedAudioResponse,
TranscriptListParameters,
WordSearchResponse,

@@ -91,12 +92,19 @@ } from "@/types";

// TODO: add options overload to support list querystring parameters
/**
* Retrieves a paged list of transcript listings.
* @param nextUrl The URL to retrieve the transcript list from. If not provided, the first page will be retrieved.
* @returns
* Retrieves a page of transcript listings.
* @param parameters The parameters to filter the transcript list by, or the URL to retrieve the transcript list from.
*/
async list(nextUrl?: string | null): Promise<TranscriptList> {
const { data } = await this.client.get<TranscriptList>(
nextUrl ?? "/v2/transcript"
);
async list(
parameters?: TranscriptListParameters | string
): Promise<TranscriptList> {
let url = "/v2/transcript";
let query: TranscriptListParameters | undefined;
if (typeof parameters === "string") {
url = parameters;
} else if (parameters) {
query = parameters;
}
const { data } = await this.client.get<TranscriptList>(url, {
params: query,
});
for (const transcriptListItem of data.transcripts) {

@@ -103,0 +111,0 @@ transcriptListItem.created = new Date(transcriptListItem.created);

@@ -0,1 +1,2 @@

export type * from "./files";
export type * from "./transcripts";

@@ -2,0 +3,0 @@ export type * from "./realtime";

@@ -765,2 +765,24 @@ // this file is generated by typescript/scripts/generate-types.ts

export type TranscriptListParameters = {
/** @description Get transcripts that were created after this transcript ID */
after_id?: string;
/** @description Get transcripts that were created before this transcript ID */
before_id?: string;
/**
* Format: date
* @description Only get transcripts created on this date
*/
created_on?: string;
/**
* Format: int64
* @description Maximum amount of transcripts to retrieve
* @default 10
*/
limit?: number;
/** @description Filter by transcript status */
status?: TranscriptStatus;
/** @description Only get throttled transcripts, overrides the status filter */
throttled_only?: boolean;
};
export type TranscriptParagraph = {

@@ -767,0 +789,0 @@ /** Format: double */

import axios, { isAxiosError } from "axios";
import { BaseServiceParams } from "../.";
import { BaseServiceParams } from "@/types";

@@ -4,0 +4,0 @@ export function createAxiosClient(params: BaseServiceParams) {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc