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

@soundify/shared

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@soundify/shared - npm Package Compare versions

Comparing version 0.0.29 to 0.0.30

7

esm/mod.js

@@ -5,5 +5,5 @@ /**

* You can use `new URLSearchParams(obj)`, when your object
* `extends Record<string, string>`. Otherwise use this function.
* extends `Record<string, string>`. Otherwise use this function.
*/
export const searchParamsFromObj = (obj) => {
export const objectToSearchParams = (obj) => {
const params = new URLSearchParams();

@@ -14,5 +14,2 @@ Object.keys(obj).forEach((key) => {

return;
if (Array.isArray(value)) {
params.set(key, value.join(","));
}
params.set(key, value.toString());

@@ -19,0 +16,0 @@ });

@@ -5,5 +5,8 @@ {

"name": "@soundify/shared",
"version": "0.0.29",
"version": "0.0.30",
"description": "Shared types and functions for soundify packages",
"license": "MIT",
"devDependencies": {},
"devDependencies": {
"@types/node": "^18.11.9"
},
"packageManager": "pnpm@7.29.1",

@@ -19,2 +22,14 @@ "repository": {

"homepage": "https://github.com/MellKam/soundify/readme",
"keywords": [
"spotify",
"api",
"wrapper",
"music",
"client",
"soundify",
"web",
"js",
"ts",
"deno"
],
"exports": {

@@ -21,0 +36,0 @@ ".": {

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

export type QueryParam = string | number | boolean | undefined | string[];
export type QueryParams = Record<string, QueryParam>;
export type SearchParam = string | number | boolean | undefined | string[];
export type SearchParams = Record<string, SearchParam>;
/**

@@ -7,7 +7,7 @@ * Creates URLSearchParams from object

* You can use `new URLSearchParams(obj)`, when your object
* `extends Record<string, string>`. Otherwise use this function.
* extends `Record<string, string>`. Otherwise use this function.
*/
export declare const searchParamsFromObj: <T extends Record<string, QueryParam>>(obj: T) => URLSearchParams;
export declare const objectToSearchParams: <T extends SearchParams>(obj: T) => URLSearchParams;
export type JSONValue = undefined | null | string | number | boolean | JSONObject | JSONArray;
export type JSONArray = Array<JSONValue>;
export type JSONArray = JSONValue[];
export interface JSONObject {

@@ -20,15 +20,32 @@ [x: string]: JSONValue;

body?: JSONValue;
query?: QueryParams;
query?: SearchParams;
}
export type ExpectedResponse = "json" | "void";
/**
* Interface that provides a fetch method to make HTTP requests.
*/
export interface HTTPClient {
fetch(baseURL: string, returnType: "void", opts?: FetchOpts): Promise<void>;
fetch<R extends unknown>(baseURL: string, returnType: "json", opts?: FetchOpts): Promise<R>;
/**
* Sends an HTTP request.
*
* @param baseURL
* The base URL for the API request. Must begin with "/"
* @param returnType
* The expected return type of the API response.
* @param opts
* Optional request options, such as the request body or query parameters.
*/
fetch(baseURL: string, responseType: "void", opts?: FetchOpts): Promise<void>;
fetch<R extends JSONValue = JSONValue>(baseURL: string, responseType: "json", opts?: FetchOpts): Promise<R>;
}
export interface IAuthProvider {
/**
* The interface used to provide access token with the ability to refresh it
*/
export interface Accessor {
/**
* Function that gives you Spotify access token.
* Function that gives you access token.
*/
getAccessToken: (
/**
* Should the service refresh the token
* Does the service have to refresh the token, or give you a cached token
* @default false

@@ -38,1 +55,4 @@ */

}
export type NonNullableJSON<T extends JSONObject> = {
[K in keyof T]: NonNullable<T[K]>;
};
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