Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rassets

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rassets - npm Package Compare versions

Comparing version 1.0.4 to 1.1.0

lib/enum/AssetType.d.ts

3

lib/index.d.ts
import { IAssetUploadFile, IAssetUploadRequest } from "./interfaces/IAssetUploadRequest";
import { IAudioRequest } from "./interfaces/IAudioRequest";
import { IAudioResponse } from "./interfaces/IAudioResponse";
import { IAudioVerifyRequest } from "./interfaces/IAudioVerifyRequest";
import { IAudioVerifyResponse } from "./interfaces/IAudioVerifyResponse";
declare namespace RAssets {

@@ -9,4 +11,5 @@ function getCSRF(cookie: string): Promise<string | undefined>;

function upload(cookie: string, file: IAssetUploadFile, data: IAssetUploadRequest): Promise<string>;
function verifyAudio(cookie: string, data: IAudioVerifyRequest): Promise<IAudioVerifyResponse>;
}
export = RAssets;
//# sourceMappingURL=index.d.ts.map

@@ -146,4 +146,42 @@ "use strict";

RAssets.upload = upload;
// Verify if an audio can be uploaded
function verifyAudio(cookie, data) {
return __awaiter(this, void 0, void 0, function* () {
// Config
const config = {
file: data.file,
paymentSource: data.paymentSource,
};
if (data.duration)
config.duration = data.duration;
if (data.fileSize)
config.fileSize = data.fileSize;
if (data.groupId)
config.groupId = data.groupId;
if (data.name)
config.name = data.name;
// Send request
const response = yield HttpClient.post("audio/verify", {
throwHttpErrors: false,
headers: {
"Content-Type": "application-json"
},
body: JSON.stringify(config)
});
// Parse Body
const responseBody = JSON.parse(response.body);
// Check for any errors
if (responseBody["errors"]) {
const error = responseBody["errors"][0];
const errorMessage = error["message"];
if (errorMessage) {
throw (new Error(errorMessage));
}
}
return responseBody;
});
}
RAssets.verifyAudio = verifyAudio;
})(RAssets || (RAssets = {}));
module.exports = RAssets;
//# sourceMappingURL=index.js.map

3

lib/interfaces/IAssetUploadRequest.d.ts
/// <reference types="node" />
import { AssetType } from "../enum/AssetType";
export interface IAssetUploadRequest {
assetTypeId: string;
assetTypeId: AssetType;
isOggUploadEnabled?: "True" | "False";

@@ -5,0 +6,0 @@ groupId?: string;

{
"name": "rassets",
"version": "1.0.4",
"version": "1.1.0",
"description": "A simple Typescript wrapper to upload assets.",

@@ -5,0 +5,0 @@ "main": "./lib/index.js",

@@ -7,2 +7,4 @@ // Dependencies

import { IAudioResponse } from "./interfaces/IAudioResponse";
import { IAudioVerifyRequest } from "./interfaces/IAudioVerifyRequest";
import { IAudioVerifyResponse } from "./interfaces/IAudioVerifyResponse";

@@ -144,2 +146,39 @@ // RAssets namespace

}
// Verify if an audio can be uploaded
export async function verifyAudio(cookie: string, data: IAudioVerifyRequest){
// Config
const config = <IAudioVerifyRequest>{
file: data.file,
paymentSource: data.paymentSource,
}
if (data.duration) config.duration = data.duration
if (data.fileSize) config.fileSize = data.fileSize
if (data.groupId) config.groupId = data.groupId
if (data.name) config.name = data.name
// Send request
const response = await HttpClient.post("audio/verify", {
throwHttpErrors: false,
headers: {
"Content-Type": "application-json"
},
body: JSON.stringify(config)
})
// Parse Body
const responseBody = JSON.parse(response.body)
// Check for any errors
if (responseBody["errors"]){
const error = responseBody["errors"][0]
const errorMessage = error["message"]
if (errorMessage){
throw(new Error(errorMessage))
}
}
return <IAudioVerifyResponse>responseBody
}
}

@@ -146,0 +185,0 @@

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

import { AssetType } from "../enum/AssetType";
export interface IAssetUploadRequest {
assetTypeId: string
assetTypeId: AssetType
isOggUploadEnabled?: "True" | "False"

@@ -4,0 +6,0 @@ groupId?: string

// Dependencies
import * as fs from "fs"
import { AssetType } from "../src/enum/AssetType"
import RAssets from "../src/index"

@@ -22,3 +23,3 @@

// Upload Asset
const uploadAsset = await RAssets.upload(cookie, {content: testImage, name: "test", type: "png"}, {mime: "image/png", assetTypeId: "11"})
const uploadAsset = await RAssets.upload(cookie, {content: testImage, name: "test", type: "png"}, {mime: "image/png", assetTypeId: AssetType.Image})

@@ -25,0 +26,0 @@ // Results

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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