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

conjure-lite

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

conjure-lite - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

6

lib/ConjureContext.d.ts
export interface ConjureContext {
fetchFn: typeof fetch;
basePath: string;
fetchFn?: typeof fetch;
tokenProvider?: () => Promise<string>;
baseUrl: string;
servicePath: string;
}
import type { ConjureContext } from "./ConjureContext.js";
export declare function conjureFetch<T>({ fetchFn, basePath }: ConjureContext, url: string, method: string, body?: ArrayBuffer | Blob | FormData | URLSearchParams | null | string | {}, contentType?: "application/json" | "application/octet-stream", accept?: "application/json" | "application/octet-stream"): Promise<T>;
export declare function conjureFetch<T>({ fetchFn, baseUrl, servicePath, tokenProvider }: ConjureContext, url: string, method: string, body?: ArrayBuffer | Blob | FormData | URLSearchParams | null | string | {}, contentType?: "application/json" | "application/octet-stream", accept?: "application/json" | "application/octet-stream"): Promise<T>;
type ConjureErrorType = "NETWORK" | "OTHER" | "PARSE" | "STATUS";

@@ -4,0 +4,0 @@ export declare class ConjureError<E> {

// This is the ONLY file that gets put into someones build.
export async function conjureFetch({ fetchFn, basePath }, url, method, body, contentType, accept) {
export async function conjureFetch({ fetchFn, baseUrl, servicePath, tokenProvider }, url, method, body, contentType, accept) {
if (body) {

@@ -12,3 +12,3 @@ if (body instanceof URLSearchParams || body instanceof Blob || body instanceof FormData

}
const response = await fetchFn(`${basePath}/${url}`, {
const response = await (fetchFn ?? fetch)(`${baseUrl}${servicePath}${url}`, {
method,

@@ -20,2 +20,3 @@ credentials: "same-origin",

accept: accept ?? "application/json",
...(tokenProvider ? { "Authorization": `Bearer ${await tokenProvider()}` } : {}),
},

@@ -22,0 +23,0 @@ ...(body ? { body } : {}),

{
"name": "conjure-lite",
"version": "0.0.4",
"version": "0.0.5",
"exports": {

@@ -5,0 +5,0 @@ ".": {

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