@defer.run/client
Advanced tools
Comparing version 0.0.9 to 0.0.10
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.defer = exports.init = void 0; | ||
const fetch_1 = require("@whatwg-node/fetch"); | ||
@@ -11,2 +12,3 @@ const constants_js_1 = require("./constants.js"); | ||
}; | ||
exports.init = init; | ||
function defer(fn) { | ||
@@ -32,3 +34,3 @@ const ret = (...args) => { | ||
"Content-type": "application/json", | ||
Authorization: `Bearer ${token}`, | ||
Authorization: `Basic ${Buffer.from(":" + token).toString("base64")}`, | ||
}, | ||
@@ -47,2 +49,2 @@ }).then(resolve, (error) => { | ||
} | ||
exports.default = { defer, init }; | ||
exports.defer = defer; |
@@ -5,7 +5,7 @@ import { fetch } from "@whatwg-node/fetch"; | ||
let apiEndpoint = `${DOMAIN}${PATH}`; | ||
const init = ({ apiToken, apiUrl }) => { | ||
export const init = ({ apiToken, apiUrl }) => { | ||
token = apiToken || process.env[TOKEN_ENV_NAME]; | ||
apiEndpoint = apiUrl || `${DOMAIN}${PATH}`; | ||
}; | ||
function defer(fn) { | ||
export function defer(fn) { | ||
const ret = (...args) => { | ||
@@ -30,3 +30,3 @@ if (token) { | ||
"Content-type": "application/json", | ||
Authorization: `Bearer ${token}`, | ||
Authorization: `Basic ${Buffer.from(":" + token).toString("base64")}`, | ||
}, | ||
@@ -45,2 +45,1 @@ }).then(resolve, (error) => { | ||
} | ||
export default { defer, init }; |
@@ -5,7 +5,4 @@ interface Options { | ||
} | ||
declare function defer<F extends (...args: any | undefined) => Promise<any>>(fn: F): F; | ||
declare const _default: { | ||
defer: typeof defer; | ||
init: ({ apiToken, apiUrl }: Options) => void; | ||
}; | ||
export default _default; | ||
export declare const init: ({ apiToken, apiUrl }: Options) => void; | ||
export declare function defer<F extends (...args: any | undefined) => Promise<any>>(fn: F): F; | ||
export {}; |
{ | ||
"name": "@defer.run/client", | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"description": "cua JavaScript client", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js", |
@@ -12,3 +12,3 @@ import { fetch } from "@whatwg-node/fetch"; | ||
const init = ({ apiToken, apiUrl }: Options) => { | ||
export const init = ({ apiToken, apiUrl }: Options) => { | ||
token = apiToken || process.env[TOKEN_ENV_NAME]; | ||
@@ -18,4 +18,6 @@ apiEndpoint = apiUrl || `${DOMAIN}${PATH}`; | ||
function defer<F extends (...args: any | undefined) => Promise<any>>(fn: F): F; | ||
function defer(fn: any): any { | ||
export function defer<F extends (...args: any | undefined) => Promise<any>>( | ||
fn: F | ||
): F; | ||
export function defer(fn: any): any { | ||
const ret = (...args: any[]) => { | ||
@@ -41,3 +43,5 @@ if (token) { | ||
"Content-type": "application/json", | ||
Authorization: `Bearer ${token}`, | ||
Authorization: `Basic ${Buffer.from(":" + token).toString( | ||
"base64" | ||
)}`, | ||
}, | ||
@@ -55,3 +59,1 @@ }).then(resolve, (error) => { | ||
} | ||
export default { defer, init }; |
Sorry, the diff of this file is not supported yet
14587
208