@cua.run/client
Advanced tools
Comparing version 0.0.6 to 0.0.7
# @cua.run/client | ||
## 0.0.7 | ||
### Patch Changes | ||
- support multiple arguments + error handling | ||
## 0.0.6 | ||
@@ -4,0 +10,0 @@ |
@@ -10,16 +10,28 @@ "use strict"; | ||
}, | ||
push: (fn, args, options) => { | ||
const { apiToken = token } = options || {}; | ||
return (0, fetch_1.fetch)(`${constants_js_1.DOMAIN}${constants_js_1.PATH}`, { | ||
method: "POST", | ||
body: JSON.stringify({ | ||
fn, | ||
args, | ||
}), | ||
headers: { | ||
"Content-type": "application/json", | ||
Authorization: `Bearer ${apiToken}`, | ||
}, | ||
push: (fn, ...args) => { | ||
return new Promise((resolve, reject) => { | ||
let body = ""; | ||
try { | ||
body = JSON.stringify({ | ||
fn, | ||
args, | ||
}); | ||
} | ||
catch (error) { | ||
console.log(`[cua.function][${fn}] Failed to serialize arguments: ${error}`); | ||
reject(); | ||
} | ||
(0, fetch_1.fetch)(`${constants_js_1.DOMAIN}${constants_js_1.PATH}`, { | ||
method: "POST", | ||
body, | ||
headers: { | ||
"Content-type": "application/json", | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
}).then(resolve, (error) => { | ||
console.log(`[cua.function][${fn}] Failed to execute: ${error}`); | ||
reject(); | ||
}); | ||
}); | ||
}, | ||
}; |
@@ -8,16 +8,28 @@ import { fetch } from "@whatwg-node/fetch"; | ||
}, | ||
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}`, | ||
}, | ||
push: (fn, ...args) => { | ||
return new Promise((resolve, reject) => { | ||
let body = ""; | ||
try { | ||
body = JSON.stringify({ | ||
fn, | ||
args, | ||
}); | ||
} | ||
catch (error) { | ||
console.log(`[cua.function][${fn}] Failed to serialize arguments: ${error}`); | ||
reject(); | ||
} | ||
fetch(`${DOMAIN}${PATH}`, { | ||
method: "POST", | ||
body, | ||
headers: { | ||
"Content-type": "application/json", | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
}).then(resolve, (error) => { | ||
console.log(`[cua.function][${fn}] Failed to execute: ${error}`); | ||
reject(); | ||
}); | ||
}); | ||
}, | ||
}; |
{ | ||
"name": "@cua.run/client", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"description": "cua JavaScript client", | ||
@@ -5,0 +5,0 @@ "dependencies": { |
@@ -6,4 +6,4 @@ interface Options { | ||
init: ({ apiToken }: Options) => void; | ||
push: (fn: string, args?: any[], options?: Options) => Promise<Response>; | ||
push: (fn: string, ...args: any[]) => Promise<unknown>; | ||
}; | ||
export default _default; |
{ | ||
"name": "@cua.run/client", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"description": "cua JavaScript client", | ||
@@ -14,4 +14,3 @@ "main": "dist/cjs/index.js", | ||
"scripts": { | ||
"build": "bob build", | ||
"publish": "changeset version && changeset publish" | ||
"build": "bob build" | ||
}, | ||
@@ -18,0 +17,0 @@ "devDependencies": { |
@@ -13,16 +13,29 @@ import { fetch } from "@whatwg-node/fetch"; | ||
}, | ||
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}`, | ||
}, | ||
push: (fn: string, ...args: any[]) => { | ||
return new Promise((resolve, reject) => { | ||
let body = ""; | ||
try { | ||
body = JSON.stringify({ | ||
fn, | ||
args, | ||
}); | ||
} catch (error) { | ||
console.log( | ||
`[cua.function][${fn}] Failed to serialize arguments: ${error}` | ||
); | ||
reject(); | ||
} | ||
fetch(`${DOMAIN}${PATH}`, { | ||
method: "POST", | ||
body, | ||
headers: { | ||
"Content-type": "application/json", | ||
Authorization: `Bearer ${token}`, | ||
}, | ||
}).then(resolve, (error) => { | ||
console.log(`[cua.function][${fn}] Failed to execute: ${error}`); | ||
reject(); | ||
}); | ||
}); | ||
}, | ||
}; |
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
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
12135
173