@helixml/apps-client
Advanced tools
Comparing version 0.1.2 to 0.1.3
export interface ClientOptions { | ||
token: string; | ||
url?: string; | ||
runScriptPath?: string; | ||
} | ||
@@ -5,0 +6,0 @@ export interface RunScriptRequest { |
@@ -9,3 +9,3 @@ function me(e, t) { | ||
return e[n] || (e[n] = n.slice(8, -1).toLowerCase()); | ||
})(/* @__PURE__ */ Object.create(null)), A = (e) => (e = e.toLowerCase(), (t) => H(t) === e), q = (e) => (t) => typeof t === e, { isArray: C } = Array, _ = q("undefined"); | ||
})(/* @__PURE__ */ Object.create(null)), A = (e) => (e = e.toLowerCase(), (t) => H(t) === e), I = (e) => (t) => typeof t === e, { isArray: C } = Array, _ = I("undefined"); | ||
function He(e) { | ||
@@ -15,7 +15,7 @@ return e !== null && !_(e) && e.constructor !== null && !_(e.constructor) && R(e.constructor.isBuffer) && e.constructor.isBuffer(e); | ||
const ye = A("ArrayBuffer"); | ||
function qe(e) { | ||
function Ie(e) { | ||
let t; | ||
return typeof ArrayBuffer < "u" && ArrayBuffer.isView ? t = ArrayBuffer.isView(e) : t = e && e.buffer && ye(e.buffer), t; | ||
} | ||
const Ie = q("string"), R = q("function"), Ee = q("number"), I = (e) => e !== null && typeof e == "object", Me = (e) => e === !0 || e === !1, L = (e) => { | ||
const qe = I("string"), R = I("function"), Ee = I("number"), q = (e) => e !== null && typeof e == "object", Me = (e) => e === !0 || e === !1, U = (e) => { | ||
if (H(e) !== "object") | ||
@@ -25,3 +25,3 @@ return !1; | ||
return (t === null || t === Object.prototype || Object.getPrototypeOf(t) === null) && !(Symbol.toStringTag in e) && !(Symbol.iterator in e); | ||
}, ze = A("Date"), Je = A("File"), $e = A("Blob"), Ve = A("FileList"), We = (e) => I(e) && R(e.pipe), Ke = (e) => { | ||
}, ze = A("Date"), Je = A("File"), $e = A("Blob"), Ve = A("FileList"), We = (e) => q(e) && R(e.pipe), Ke = (e) => { | ||
let t; | ||
@@ -31,3 +31,3 @@ return e && (typeof FormData == "function" && e instanceof FormData || R(e.append) && ((t = H(e)) === "formdata" || // detect form-data instance | ||
}, Ge = A("URLSearchParams"), Xe = (e) => e.trim ? e.trim() : e.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, ""); | ||
function B(e, t, { allOwnKeys: n = !1 } = {}) { | ||
function D(e, t, { allOwnKeys: n = !1 } = {}) { | ||
if (e === null || typeof e > "u") | ||
@@ -59,9 +59,9 @@ return; | ||
const o = e && we(t, s) || s; | ||
L(t[o]) && L(r) ? t[o] = K(t[o], r) : L(r) ? t[o] = K({}, r) : C(r) ? t[o] = r.slice() : t[o] = r; | ||
U(t[o]) && U(r) ? t[o] = K(t[o], r) : U(r) ? t[o] = K({}, r) : C(r) ? t[o] = r.slice() : t[o] = r; | ||
}; | ||
for (let r = 0, s = arguments.length; r < s; r++) | ||
arguments[r] && B(arguments[r], n); | ||
arguments[r] && D(arguments[r], n); | ||
return t; | ||
} | ||
const ve = (e, t, n, { allOwnKeys: r } = {}) => (B(t, (s, o) => { | ||
const ve = (e, t, n, { allOwnKeys: r } = {}) => (D(t, (s, o) => { | ||
n && R(s) ? e[o] = me(s, n) : e[o] = s; | ||
@@ -119,3 +119,3 @@ }, { allOwnKeys: r }), e), Qe = (e) => (e.charCodeAt(0) === 65279 && (e = e.slice(1)), e), Ze = (e, t, n, r) => { | ||
const n = Object.getOwnPropertyDescriptors(e), r = {}; | ||
B(n, (s, o) => { | ||
D(n, (s, o) => { | ||
let i; | ||
@@ -163,3 +163,3 @@ (i = t(s, o, e)) !== !1 && (r[o] = i || s); | ||
const t = new Array(10), n = (r, s) => { | ||
if (I(r)) { | ||
if (q(r)) { | ||
if (t.indexOf(r) >= 0) | ||
@@ -170,3 +170,3 @@ return; | ||
const o = C(r) ? [] : {}; | ||
return B(r, (i, c) => { | ||
return D(r, (i, c) => { | ||
const p = n(i, s + 1); | ||
@@ -180,3 +180,3 @@ !_(p) && (o[c] = p); | ||
return n(e, 0); | ||
}, mt = A("AsyncFunction"), yt = (e) => e && (I(e) || R(e)) && R(e.then) && R(e.catch), a = { | ||
}, mt = A("AsyncFunction"), yt = (e) => e && (q(e) || R(e)) && R(e.then) && R(e.catch), a = { | ||
isArray: C, | ||
@@ -186,8 +186,8 @@ isArrayBuffer: ye, | ||
isFormData: Ke, | ||
isArrayBufferView: qe, | ||
isString: Ie, | ||
isArrayBufferView: Ie, | ||
isString: qe, | ||
isNumber: Ee, | ||
isBoolean: Me, | ||
isObject: I, | ||
isPlainObject: L, | ||
isObject: q, | ||
isPlainObject: U, | ||
isUndefined: _, | ||
@@ -203,3 +203,3 @@ isDate: ze, | ||
isFileList: Ve, | ||
forEach: B, | ||
forEach: D, | ||
merge: K, | ||
@@ -598,3 +598,3 @@ extend: ve, | ||
}); | ||
const te = ee, Bt = a.toObjectSet([ | ||
const te = ee, Dt = a.toObjectSet([ | ||
"age", | ||
@@ -617,3 +617,3 @@ "authorization", | ||
"user-agent" | ||
]), Dt = (e) => { | ||
]), Lt = (e) => { | ||
const t = {}; | ||
@@ -623,3 +623,3 @@ let n, r, s; | ||
`).forEach(function(i) { | ||
s = i.indexOf(":"), n = i.substring(0, s).trim().toLowerCase(), r = i.substring(s + 1).trim(), !(!n || t[n] && Bt[n]) && (n === "set-cookie" ? t[n] ? t[n].push(r) : t[n] = [r] : t[n] = t[n] ? t[n] + ", " + r : r); | ||
s = i.indexOf(":"), n = i.substring(0, s).trim().toLowerCase(), r = i.substring(s + 1).trim(), !(!n || t[n] && Dt[n]) && (n === "set-cookie" ? t[n] ? t[n].push(r) : t[n] = [r] : t[n] = t[n] ? t[n] + ", " + r : r); | ||
}), t; | ||
@@ -630,6 +630,6 @@ }, ue = Symbol("internals"); | ||
} | ||
function U(e) { | ||
return e === !1 || e == null ? e : a.isArray(e) ? e.map(U) : String(e); | ||
function B(e) { | ||
return e === !1 || e == null ? e : a.isArray(e) ? e.map(B) : String(e); | ||
} | ||
function Lt(e) { | ||
function Ut(e) { | ||
const t = /* @__PURE__ */ Object.create(null), n = /([^\s,;=]+)\s*(?:=\s*([^,;]+))?/g; | ||
@@ -641,3 +641,3 @@ let r; | ||
} | ||
const Ut = (e) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()); | ||
const Bt = (e) => /^[-_a-zA-Z0-9^`|~,!#$%&'*+.]+$/.test(e.trim()); | ||
function $(e, t, n, r, s) { | ||
@@ -678,6 +678,6 @@ if (a.isFunction(r)) | ||
const u = a.findKey(s, l); | ||
(!u || s[u] === void 0 || h === !0 || h === void 0 && s[u] !== !1) && (s[u || p] = U(c)); | ||
(!u || s[u] === void 0 || h === !0 || h === void 0 && s[u] !== !1) && (s[u || p] = B(c)); | ||
} | ||
const i = (c, p) => a.forEach(c, (h, l) => o(h, l, p)); | ||
return a.isPlainObject(t) || t instanceof this.constructor ? i(t, n) : a.isString(t) && (t = t.trim()) && !Ut(t) ? i(Dt(t), n) : t != null && o(n, t, r), this; | ||
return a.isPlainObject(t) || t instanceof this.constructor ? i(t, n) : a.isString(t) && (t = t.trim()) && !Bt(t) ? i(Lt(t), n) : t != null && o(n, t, r), this; | ||
} | ||
@@ -692,3 +692,3 @@ get(t, n) { | ||
if (n === !0) | ||
return Lt(s); | ||
return Ut(s); | ||
if (a.isFunction(n)) | ||
@@ -734,7 +734,7 @@ return n.call(this, s, r); | ||
if (i) { | ||
n[i] = U(s), delete n[o]; | ||
n[i] = B(s), delete n[o]; | ||
return; | ||
} | ||
const c = t ? kt(o) : String(o).trim(); | ||
c !== o && delete n[o], n[c] = U(s), r[c] = !0; | ||
c !== o && delete n[o], n[c] = B(s), r[c] = !0; | ||
}), this; | ||
@@ -801,6 +801,6 @@ } | ||
} | ||
function D(e, t, n) { | ||
function L(e, t, n) { | ||
m.call(this, e ?? "canceled", m.ERR_CANCELED, t, n), this.name = "CanceledError"; | ||
} | ||
a.inherits(D, m, { | ||
a.inherits(L, m, { | ||
__CANCEL__: !0 | ||
@@ -818,3 +818,3 @@ }); | ||
} | ||
const qt = O.hasStandardBrowserEnv ? ( | ||
const It = O.hasStandardBrowserEnv ? ( | ||
// Standard browser envs support document.cookie | ||
@@ -846,3 +846,3 @@ { | ||
); | ||
function It(e) { | ||
function qt(e) { | ||
return /^([a-z][a-z\d+\-.]*:)?\/\//i.test(e); | ||
@@ -853,4 +853,4 @@ } | ||
} | ||
function Be(e, t) { | ||
return e && !It(t) ? Mt(e, t) : t; | ||
function De(e, t) { | ||
return e && !qt(t) ? Mt(e, t) : t; | ||
} | ||
@@ -949,3 +949,3 @@ const zt = O.hasStandardBrowserEnv ? ( | ||
} | ||
const E = Be(e.baseURL, e.url); | ||
const E = De(e.baseURL, e.url); | ||
u.open(e.method.toUpperCase(), Ne(E, e.params, e.paramsSerializer), !0), u.timeout = e.timeout; | ||
@@ -987,3 +987,3 @@ function S() { | ||
}, O.hasStandardBrowserEnv && (c && a.isFunction(c) && (c = c(e)), c || c !== !1 && zt(E))) { | ||
const d = e.xsrfHeaderName && e.xsrfCookieName && qt.read(e.xsrfCookieName); | ||
const d = e.xsrfHeaderName && e.xsrfCookieName && It.read(e.xsrfCookieName); | ||
d && o.set(e.xsrfHeaderName, d); | ||
@@ -994,3 +994,3 @@ } | ||
}), a.isUndefined(e.withCredentials) || (u.withCredentials = !!e.withCredentials), i && i !== "json" && (u.responseType = e.responseType), typeof e.onDownloadProgress == "function" && u.addEventListener("progress", le(e.onDownloadProgress, !0)), typeof e.onUploadProgress == "function" && u.upload && u.upload.addEventListener("progress", le(e.onUploadProgress)), (e.cancelToken || e.signal) && (p = (d) => { | ||
u && (r(!d || d.type ? new D(null, e, u) : d), u.abort(), u = null); | ||
u && (r(!d || d.type ? new L(null, e, u) : d), u.abort(), u = null); | ||
}, e.cancelToken && e.cancelToken.subscribe(p), e.signal && (e.signal.aborted ? p() : e.signal.addEventListener("abort", p))); | ||
@@ -1017,3 +1017,3 @@ const f = Jt(E); | ||
}); | ||
const fe = (e) => `- ${e}`, Kt = (e) => a.isFunction(e) || e === null || e === !1, De = { | ||
const fe = (e) => `- ${e}`, Kt = (e) => a.isFunction(e) || e === null || e === !1, Le = { | ||
getAdapter: (e) => { | ||
@@ -1051,3 +1051,3 @@ e = a.isArray(e) ? e : [e]; | ||
if (e.cancelToken && e.cancelToken.throwIfRequested(), e.signal && e.signal.aborted) | ||
throw new D(null, e); | ||
throw new L(null, e); | ||
} | ||
@@ -1058,3 +1058,3 @@ function de(e) { | ||
e.transformRequest | ||
), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), De.getAdapter(e.adapter || te.adapter)(e).then(function(r) { | ||
), ["post", "put", "patch"].indexOf(e.method) !== -1 && e.headers.setContentType("application/x-www-form-urlencoded", !1), Le.getAdapter(e.adapter || te.adapter)(e).then(function(r) { | ||
return W(e), r.data = V.call( | ||
@@ -1140,3 +1140,3 @@ e, | ||
} | ||
const Le = "1.6.8", ne = {}; | ||
const Ue = "1.6.8", ne = {}; | ||
["object", "boolean", "number", "function", "string", "symbol"].forEach((e, t) => { | ||
@@ -1150,3 +1150,3 @@ ne[e] = function(r) { | ||
function s(o, i) { | ||
return "[Axios v" + Le + "] Transitional option '" + o + "'" + i + (r ? ". " + r : ""); | ||
return "[Axios v" + Ue + "] Transitional option '" + o + "'" + i + (r ? ". " + r : ""); | ||
} | ||
@@ -1278,3 +1278,3 @@ return (o, i, c) => { | ||
t = P(this.defaults, t); | ||
const n = Be(t.baseURL, t.url); | ||
const n = De(t.baseURL, t.url); | ||
return Ne(n, t.params, t.paramsSerializer); | ||
@@ -1333,3 +1333,3 @@ } | ||
}, t(function(o, i, c) { | ||
r.reason || (r.reason = new D(o, i, c), n(r.reason)); | ||
r.reason || (r.reason = new L(o, i, c), n(r.reason)); | ||
}); | ||
@@ -1455,14 +1455,14 @@ } | ||
const Zt = Q; | ||
function Ue(e) { | ||
function Be(e) { | ||
const t = new k(e), n = me(k.prototype.request, t); | ||
return a.extend(n, k.prototype, t, { allOwnKeys: !0 }), a.extend(n, t, null, { allOwnKeys: !0 }), n.create = function(s) { | ||
return Ue(P(e, s)); | ||
return Be(P(e, s)); | ||
}, n; | ||
} | ||
const y = Ue(te); | ||
const y = Be(te); | ||
y.Axios = k; | ||
y.CanceledError = D; | ||
y.CanceledError = L; | ||
y.CancelToken = Xt; | ||
y.isCancel = _e; | ||
y.VERSION = Le; | ||
y.VERSION = Ue; | ||
y.toFormData = M; | ||
@@ -1479,17 +1479,18 @@ y.AxiosError = m; | ||
y.formToJSON = (e) => Fe(a.isHTMLForm(e) ? new FormData(e) : e); | ||
y.getAdapter = De.getAdapter; | ||
y.getAdapter = Le.getAdapter; | ||
y.HttpStatusCode = Zt; | ||
y.default = y; | ||
const Yt = (e) => { | ||
const t = window.location.hostname === "localhost"; | ||
if (e.url, !t && !e.token) | ||
const Yt = "https://app.tryhelix.ai", en = "http://localhost:8005", tn = (e) => { | ||
const t = window.location.hostname === "localhost", n = e.runScriptPath || (t ? "/api/v1/run/development" : "/api/v1/apps/script"); | ||
let r = e.url; | ||
if (r || (t ? r = en : r = Yt), !t && !e.token) | ||
throw new Error("Token is required"); | ||
return { | ||
runScript: async (r) => { | ||
const s = {}; | ||
return e.token && (s.Authorization = `Bearer ${e.token}`), (await y({ | ||
method: "POST", | ||
url: `${e.url}/api/v1/apps/script`, | ||
headers: s, | ||
data: r | ||
runScript: async (o) => { | ||
const i = {}; | ||
return e.token && (i.Authorization = `Bearer ${e.token}`), (await y({ | ||
method: "post", | ||
url: `${r}${n}`, | ||
headers: i, | ||
data: o | ||
})).data; | ||
@@ -1500,3 +1501,3 @@ } | ||
export { | ||
Yt as default | ||
tn as default | ||
}; |
{ | ||
"name": "@helixml/apps-client", | ||
"version": "0.1.2", | ||
"version": "0.1.3", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "types": "dist/index.d.ts", |
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
46595
1485