@cua.run/client
Advanced tools
Comparing version 0.0.4-next.0 to 0.0.4
# @cua.run/client | ||
## 0.0.4 | ||
### Patch Changes | ||
- fetch | ||
## 0.0.4-next.0 | ||
@@ -4,0 +10,0 @@ |
"use strict"; | ||
const DOMAIN = ""; | ||
const DOMAIN = "https://cua.run"; | ||
const PATH = "/push"; |
"use strict"; | ||
// import { fetch } from "@whatwg-node/fetch"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
// let token: string; | ||
const fetch_1 = require("@whatwg-node/fetch"); | ||
let token; | ||
exports.default = { | ||
init: ({}) => { | ||
// token = apiToken; | ||
init: ({ apiToken }) => { | ||
token = apiToken; | ||
}, | ||
push: (fn, args, _options) => { | ||
console.log(`cua.push(${fn}, ${args})`); | ||
// return fetch(`${DOMAIN}/${PATH}`, { | ||
// method: "POST", | ||
// body: JSON.stringify({ | ||
// fn, | ||
// args, | ||
// }), | ||
// headers: { | ||
// "Content-type": "application/json", | ||
// Authorization: `Bearer ${token}`, | ||
// }, | ||
// }); | ||
push: (fn, args, options) => { | ||
const { apiToken = token } = options || {}; | ||
return (0, fetch_1.fetch)(`${DOMAIN}/${PATH}`, { | ||
method: "POST", | ||
body: JSON.stringify({ | ||
fn, | ||
args, | ||
}), | ||
headers: { | ||
"Content-type": "application/json", | ||
Authorization: `Bearer ${apiToken}`, | ||
}, | ||
}); | ||
}, | ||
}; |
"use strict"; | ||
const DOMAIN = ""; | ||
const DOMAIN = "https://cua.run"; | ||
const PATH = "/push"; |
@@ -1,21 +0,21 @@ | ||
// import { fetch } from "@whatwg-node/fetch"; | ||
// let token: string; | ||
import { fetch } from "@whatwg-node/fetch"; | ||
let token; | ||
export default { | ||
init: ({}) => { | ||
// token = apiToken; | ||
init: ({ apiToken }) => { | ||
token = apiToken; | ||
}, | ||
push: (fn, args, _options) => { | ||
console.log(`cua.push(${fn}, ${args})`); | ||
// return fetch(`${DOMAIN}/${PATH}`, { | ||
// method: "POST", | ||
// body: JSON.stringify({ | ||
// fn, | ||
// args, | ||
// }), | ||
// headers: { | ||
// "Content-type": "application/json", | ||
// Authorization: `Bearer ${token}`, | ||
// }, | ||
// }); | ||
push: (fn, args, options) => { | ||
const { apiToken = token } = options || {}; | ||
return fetch(`${DOMAIN}/${PATH}`, { | ||
method: "POST", | ||
body: JSON.stringify({ | ||
fn, | ||
args, | ||
}), | ||
headers: { | ||
"Content-type": "application/json", | ||
Authorization: `Bearer ${apiToken}`, | ||
}, | ||
}); | ||
}, | ||
}; |
{ | ||
"name": "@cua.run/client", | ||
"version": "0.0.2", | ||
"version": "0.0.4-next.0", | ||
"description": "cua JavaScript client", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
@@ -1,2 +0,2 @@ | ||
declare const DOMAIN = ""; | ||
declare const DOMAIN = "https://cua.run"; | ||
declare const PATH = "/push"; |
@@ -5,5 +5,5 @@ interface Options { | ||
declare const _default: { | ||
init: ({}: Options) => void; | ||
push: (fn: string, args: Record<string, any>, _options: Options) => void; | ||
init: ({ apiToken }: Options) => void; | ||
push: (fn: string, args?: any[], options?: Options) => Promise<Response>; | ||
}; | ||
export default _default; |
{ | ||
"name": "@cua.run/client", | ||
"version": "0.0.4-next.0", | ||
"version": "0.0.4", | ||
"description": "cua JavaScript client", | ||
@@ -5,0 +5,0 @@ "main": "dist/cjs/index.js", |
@@ -1,2 +0,2 @@ | ||
const DOMAIN = ""; | ||
const DOMAIN = "https://cua.run"; | ||
const PATH = "/push"; |
@@ -1,2 +0,2 @@ | ||
// import { fetch } from "@whatwg-node/fetch"; | ||
import { fetch } from "@whatwg-node/fetch"; | ||
@@ -7,22 +7,21 @@ interface Options { | ||
// let token: string; | ||
let token: string; | ||
export default { | ||
init: ({}: Options) => { | ||
// token = apiToken; | ||
init: ({ apiToken }: Options) => { | ||
token = apiToken; | ||
}, | ||
push: (fn: string, args: Record<string, any>, _options: Options) => { | ||
console.log(`cua.push(${fn}, ${args})`); | ||
// return fetch(`${DOMAIN}/${PATH}`, { | ||
// method: "POST", | ||
// body: JSON.stringify({ | ||
// fn, | ||
// args, | ||
// }), | ||
// headers: { | ||
// "Content-type": "application/json", | ||
// Authorization: `Bearer ${token}`, | ||
// }, | ||
// }); | ||
push: (fn: string, args?: any[], options?: Options) => { | ||
const { apiToken = token } = options || {}; | ||
return fetch(`${DOMAIN}/${PATH}`, { | ||
method: "POST", | ||
body: JSON.stringify({ | ||
fn, | ||
args, | ||
}), | ||
headers: { | ||
"Content-type": "application/json", | ||
Authorization: `Bearer ${apiToken}`, | ||
}, | ||
}); | ||
}, | ||
}; |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10557
1