Comparing version 0.3.0 to 0.3.1
@@ -46,3 +46,3 @@ var ze = Object.defineProperty; | ||
} | ||
function d(t) { | ||
function p(t) { | ||
return _e(t) ? t[se] : t === null ? "NONE" : JSON.stringify(t); | ||
@@ -54,5 +54,5 @@ } | ||
function Ke(t) { | ||
const e = new URL("rpc", t.connection.endpoint.replace("http", "ws")), n = setInterval(() => u("ping"), 3e4), r = new Ye(e), i = /* @__PURE__ */ new Map(); | ||
let l = !1; | ||
const u = (a, h = []) => { | ||
const e = new URL("rpc", t.connection.endpoint.replace("http", "ws")), n = setInterval(() => a("ping"), 3e4), r = new Ye(e), i = /* @__PURE__ */ new Map(); | ||
let u = !1; | ||
const a = (l, h = []) => { | ||
const g = Ze(); | ||
@@ -62,3 +62,3 @@ return new Promise((E, S) => { | ||
id: g, | ||
method: a, | ||
method: l, | ||
params: h | ||
@@ -69,13 +69,13 @@ })), setTimeout(() => { | ||
}); | ||
}, y = (a, h) => { | ||
}, d = (l, h) => { | ||
var g; | ||
clearInterval(n), (g = t.onDisconnect) == null || g.call(t, a, h); | ||
clearInterval(n), (g = t.onDisconnect) == null || g.call(t, l, h); | ||
}, c = () => { | ||
l = !0, r.close(), y(-1, "connection terminated"); | ||
}, w = async (a, h) => u("query", h ? [a, h] : [a]); | ||
u = !0, r.close(), d(-1, "connection terminated"); | ||
}, w = async (l, h) => a("query", h ? [l, h] : [l]); | ||
return r.addEventListener("open", async () => { | ||
var g; | ||
const { namespace: a, database: h } = t.connection; | ||
const { namespace: l, database: h } = t.connection; | ||
try { | ||
"token" in t.credentials ? await u("authenticate", [t.credentials.token]) : await u("signin", [t.credentials]); | ||
"token" in t.credentials ? await a("authenticate", [t.credentials.token]) : await a("signin", [t.credentials]); | ||
} catch { | ||
@@ -85,10 +85,10 @@ c(); | ||
} | ||
a && h && u("use", [a, h]), (g = t.onConnect) == null || g.call(t); | ||
}), r.addEventListener("close", (a) => { | ||
l || y(a.code, a.reason); | ||
}), r.addEventListener("message", (a) => { | ||
const { id: h, result: g, method: E, error: S } = JSON.parse(a.data); | ||
l && h && a("use", [l, h]), (g = t.onConnect) == null || g.call(t); | ||
}), r.addEventListener("close", (l) => { | ||
u || d(l.code, l.reason); | ||
}), r.addEventListener("message", (l) => { | ||
const { id: h, result: g, method: E, error: S } = JSON.parse(l.data); | ||
if (E !== "notify") | ||
if (!i.has(h)) | ||
console.warn("No callback for message", a.data); | ||
console.warn("No callback for message", l.data); | ||
else { | ||
@@ -98,5 +98,5 @@ const [v, W] = i.get(h); | ||
} | ||
}), r.addEventListener("error", (a) => { | ||
}), r.addEventListener("error", (l) => { | ||
var h; | ||
(h = t.onError) == null || h.call(t, a.error); | ||
(h = t.onError) == null || h.call(t, l.error); | ||
}), { | ||
@@ -165,3 +165,3 @@ close: c, | ||
J = new WeakMap(), ee = new WeakSet(), Ne = async function(n) { | ||
var y; | ||
var d; | ||
if (!o(this, J).onRequest()) | ||
@@ -171,16 +171,16 @@ throw new R("There is no active connection to the database", "no_connection"); | ||
return []; | ||
const r = s(this, we, Qe).call(this, n), i = s(this, ye, ke).call(this, n), l = []; | ||
const r = s(this, we, Qe).call(this, n), i = s(this, ye, ke).call(this, n), u = []; | ||
o(this, J).onLog(i, r); | ||
const u = await o(this, J).onQuery(i, r); | ||
if (!Array.isArray(u) || u.length !== n.queries.length) | ||
const a = await o(this, J).onQuery(i, r); | ||
if (!Array.isArray(a) || a.length !== n.queries.length) | ||
throw new R("The response from the database was invalid", "invalid_response"); | ||
for (let c = 0; c < u.length; c++) { | ||
const { query: w, schema: a } = n.queries[c], { status: h, result: g, detail: E } = u[c], S = w._quantity; | ||
for (let c = 0; c < a.length; c++) { | ||
const { query: w, schema: l } = n.queries[c], { status: h, result: g, detail: E } = a[c], S = w._quantity; | ||
if (h !== "OK") | ||
throw new R(`Query ${c + 1} returned a non-successful status code: ${h}: ${E}`, "invalid_response"); | ||
if (S == "zero") { | ||
l.push(void 0); | ||
u.push(void 0); | ||
continue; | ||
} | ||
const v = ((y = w._transform) == null ? void 0 : y.call(w, g)) ?? g, A = (et(w) ? w._schema : a).array().safeParse(v); | ||
const v = ((d = w._transform) == null ? void 0 : d.call(w, g)) ?? g, A = (et(w) ? w._schema : l).array().safeParse(v); | ||
if (!A.success) | ||
@@ -193,7 +193,7 @@ throw new We(`Query ${c + 1} failed to parse`, A.error); | ||
throw new R(`Query ${c + 1} expected at most one result but got ${A.data.length}`, "invalid_response"); | ||
l.push(A.data[0] || null); | ||
u.push(A.data[0] || null); | ||
} else | ||
l.push(A.data); | ||
u.push(A.data); | ||
} | ||
return l; | ||
return u; | ||
}, ye = new WeakSet(), ke = function(n) { | ||
@@ -206,6 +206,6 @@ let r = n.queries.map((i) => i.query.toQuery()); | ||
for (const i of n.queries) | ||
for (const [l, u] of Object.entries(i.params || {})) { | ||
if (l in r) | ||
throw new R(`The parameter "${l}" was defined multiple times`, "invalid_query"); | ||
r[l] = u; | ||
for (const [u, a] of Object.entries(i.params || {})) { | ||
if (u in r) | ||
throw new R(`The parameter "${u}" was defined multiple times`, "invalid_query"); | ||
r[u] = a; | ||
} | ||
@@ -263,4 +263,4 @@ return r; | ||
m(this, P, !1), m(this, x, !1), this.dispatchEvent(new He(n, r)); | ||
const { retryCount: i, retryDelay: l } = this.options; | ||
(i < 0 || i > 0 && o(this, z) < i) && (xe(this, z)._++, m(this, G, setTimeout(() => this.connect(), l))); | ||
const { retryCount: i, retryDelay: u } = this.options; | ||
(i < 0 || i > 0 && o(this, z) < i) && (xe(this, z)._++, m(this, G, setTimeout(() => this.connect(), u))); | ||
}, | ||
@@ -313,11 +313,11 @@ onError: (n) => { | ||
throw new R("Stateless queries do not support parameters yet. ", "invalid_request"); | ||
const { endpoint: i, namespace: l, database: u } = this.options.connection, { user: y, pass: c, DB: w, NS: a, SC: h, token: g } = this.options.credentials, E = new URL("sql", i); | ||
if (!y && !c && !g) | ||
const { endpoint: i, namespace: u, database: a } = this.options.connection, { user: d, pass: c, DB: w, NS: l, SC: h, token: g } = this.options.credentials, E = new URL("sql", i); | ||
if (!d && !c && !g) | ||
throw new R("Missing username & password or token", "invalid_request"); | ||
const v = { | ||
"User-Agent": "Cirql", | ||
Authorization: g ? `Bearer ${g}` : `Basic ${btoa(`${y}:${c}`)}`, | ||
Authorization: g ? `Bearer ${g}` : `Basic ${btoa(`${d}:${c}`)}`, | ||
Accept: "application/json" | ||
}; | ||
return (a || l) && (v.NS = a || l), (w || u) && (v.DB = w || u), h && (v.SC = h), await fetch(E, { | ||
return (l || u) && (v.NS = l || u), (w || a) && (v.DB = w || a), h && (v.SC = h), await fetch(E, { | ||
method: "POST", | ||
@@ -331,9 +331,9 @@ headers: v, | ||
function n(r, i) { | ||
Object.entries(r).forEach(([l, u]) => { | ||
if (u !== void 0) | ||
if (typeof u == "object" && !Array.isArray(u)) { | ||
const y = u[se]; | ||
y ? e.push(`${i}${l} ${y}`) : n(u, `${i}${l}.`); | ||
Object.entries(r).forEach(([u, a]) => { | ||
if (a !== void 0) | ||
if (typeof a == "object" && !Array.isArray(a)) { | ||
const d = a[se]; | ||
d ? e.push(`${i}${u} ${d}`) : n(a, `${i}${u}.`); | ||
} else | ||
e.push(`${i}${l} = ${u === null ? "NONE" : JSON.stringify(u)}`); | ||
e.push(`${i}${u} = ${a === null ? "NONE" : JSON.stringify(a)}`); | ||
}); | ||
@@ -347,8 +347,8 @@ } | ||
if (r === "OR" || r === "AND") { | ||
const i = t[r], l = []; | ||
const i = t[r], u = []; | ||
if (i === void 0) | ||
throw new R("Received expected undefined property in where clause", "invalid_request"); | ||
for (const u of i) | ||
l.push(`(${ue(u)})`); | ||
n.push(`(${l.join(` ${r} `)})`); | ||
for (const a of i) | ||
u.push(`(${ue(a)})`); | ||
n.push(`(${u.join(` ${r} `)})`); | ||
} else { | ||
@@ -360,3 +360,3 @@ const i = t[r]; | ||
} | ||
var O, rt, M, I, te, qe, Y, ae; | ||
var C, rt, M, I, te, qe, Y, ae; | ||
const Ae = class { | ||
@@ -367,8 +367,8 @@ constructor(e) { | ||
f(this, Y); | ||
f(this, O, void 0); | ||
f(this, C, void 0); | ||
$(this, rt, !0); | ||
m(this, O, e); | ||
m(this, C, e); | ||
} | ||
get _quantity() { | ||
return o(this, O).quantity; | ||
return o(this, C).quantity; | ||
} | ||
@@ -387,3 +387,3 @@ /** | ||
setFields: { | ||
...o(this, O).setFields, | ||
...o(this, C).setFields, | ||
[e]: n | ||
@@ -406,3 +406,3 @@ } | ||
setFields: { | ||
...o(this, O).setFields, | ||
...o(this, C).setFields, | ||
...e | ||
@@ -470,6 +470,6 @@ } | ||
returnMode: i, | ||
returnFields: l, | ||
timeout: u, | ||
parallel: y | ||
} = o(this, O); | ||
returnFields: u, | ||
timeout: a, | ||
parallel: d | ||
} = o(this, C); | ||
if (!e) | ||
@@ -483,12 +483,12 @@ throw new Error("No targets specified"); | ||
s(this, Y, ae).call(this) && (c += ` CONTENT ${JSON.stringify(n)}`); | ||
return i === "fields" ? c += ` RETURN ${l.join(", ")}` : i && (c += ` RETURN ${i.toUpperCase()}`), u && (c += ` TIMEOUT ${u}s`), y && (c += " PARALLEL"), c; | ||
return i === "fields" ? c += ` RETURN ${u.join(", ")}` : i && (c += ` RETURN ${i.toUpperCase()}`), a && (c += ` TIMEOUT ${a}s`), d && (c += " PARALLEL"), c; | ||
} | ||
}; | ||
let fe = Ae; | ||
rt = oe, O = new WeakMap(), M = new WeakSet(), I = function(e) { | ||
return new Ae({ ...o(this, O), ...e }); | ||
rt = oe, C = new WeakMap(), M = new WeakSet(), I = function(e) { | ||
return new Ae({ ...o(this, C), ...e }); | ||
}, te = new WeakSet(), qe = function() { | ||
return Object.keys(o(this, O).setFields).length > 0; | ||
return Object.keys(o(this, C).setFields).length > 0; | ||
}, Y = new WeakSet(), ae = function() { | ||
return Object.keys(o(this, O).content).length > 0; | ||
return Object.keys(o(this, C).content).length > 0; | ||
}; | ||
@@ -637,9 +637,9 @@ function yt(...t) { | ||
returnFields: i, | ||
timeout: l, | ||
parallel: u | ||
timeout: u, | ||
parallel: a | ||
} = o(this, k); | ||
if (!e) | ||
throw new Error("No targets specified"); | ||
let y = `DELETE ${e}`; | ||
return n && (y += ` WHERE ${n}`), r === "fields" ? y += ` RETURN ${i.join(", ")}` : r && (y += ` RETURN ${r.toUpperCase()}`), l && (y += ` TIMEOUT ${l}s`), u && (y += " PARALLEL"), y; | ||
let d = `DELETE ${e}`; | ||
return n && (d += ` WHERE ${n}`), r === "fields" ? d += ` RETURN ${i.join(", ")}` : r && (d += ` RETURN ${r.toUpperCase()}`), u && (d += ` TIMEOUT ${u}s`), a && (d += " PARALLEL"), d; | ||
} | ||
@@ -785,5 +785,5 @@ }; | ||
content: i, | ||
setFields: l, | ||
returnMode: u, | ||
returnFields: y, | ||
setFields: u, | ||
returnMode: a, | ||
returnFields: d, | ||
timeout: c, | ||
@@ -794,9 +794,9 @@ parallel: w | ||
throw new Error("From, edge, and to must be defined"); | ||
let a = `RELATE ${e}->${n}->${r}`; | ||
let l = `RELATE ${e}->${n}->${r}`; | ||
if (s(this, ne, be).call(this)) { | ||
const h = ve(l); | ||
h && (a += ` SET ${h}`); | ||
const h = ve(u); | ||
h && (l += ` SET ${h}`); | ||
} else | ||
s(this, V, le).call(this) && (a += ` CONTENT ${JSON.stringify(i)}`); | ||
return u === "fields" ? a += ` RETURN ${y.join(", ")}` : u && (a += ` RETURN ${u.toUpperCase()}`), c && (a += ` TIMEOUT ${c}s`), w && (a += " PARALLEL"), a; | ||
s(this, V, le).call(this) && (l += ` CONTENT ${JSON.stringify(i)}`); | ||
return a === "fields" ? l += ` RETURN ${d.join(", ")}` : a && (l += ` RETURN ${a.toUpperCase()}`), c && (l += ` TIMEOUT ${c}s`), w && (l += " PARALLEL"), l; | ||
} | ||
@@ -829,4 +829,10 @@ }; | ||
function Et(t, e, n, r, i) { | ||
const l = `type::thing(${JSON.stringify(t)}, ${JSON.stringify(e)})`, u = `type::thing(${JSON.stringify(r)}, ${JSON.stringify(i)})`; | ||
return tt(l, n, u); | ||
const u = typeof t == "object" ? t : { | ||
fromTable: t, | ||
fromId: e, | ||
edge: n, | ||
toTable: r, | ||
toId: i | ||
}, a = `type::thing(${JSON.stringify(u.fromTable)}, ${JSON.stringify(u.fromId)})`, d = `type::thing(${JSON.stringify(u.toTable)}, ${JSON.stringify(u.toId)})`; | ||
return tt(a, u.edge, d); | ||
} | ||
@@ -991,8 +997,8 @@ var Q, ut, q, T; | ||
split: i, | ||
group: l, | ||
order: u, | ||
limit: y, | ||
group: u, | ||
order: a, | ||
limit: d, | ||
start: c, | ||
fetch: w, | ||
timeout: a, | ||
timeout: l, | ||
parallel: h | ||
@@ -1005,12 +1011,12 @@ } = o(this, Q); | ||
throw new Error("No projections specified"); | ||
const g = Object.entries(u); | ||
const g = Object.entries(a); | ||
let E = `SELECT ${e} FROM ${n}`; | ||
if (r && (E += ` WHERE ${r}`), i.length > 0 && (E += ` SPLIT ${i.join(", ")}`), l === "all" ? E += " GROUP BY ALL" : l.length > 0 && (E += ` GROUP BY ${l.join(", ")}`), g.length > 0) { | ||
if (r && (E += ` WHERE ${r}`), i.length > 0 && (E += ` SPLIT ${i.join(", ")}`), u === "all" ? E += " GROUP BY ALL" : u.length > 0 && (E += ` GROUP BY ${u.join(", ")}`), g.length > 0) { | ||
const S = g.map(([v, W]) => `${v} ${W.toUpperCase()}`); | ||
E += ` ORDER BY ${S.join(", ")}`; | ||
} | ||
return y && (E += ` LIMIT BY ${y}`), c && (E += ` START AT ${c}`), w.length > 0 && (E += ` FETCH ${w.join(", ")}`), a && (E += ` TIMEOUT ${a}s`), h && (E += " PARALLEL"), E; | ||
return d && (E += ` LIMIT BY ${d}`), c && (E += ` START AT ${c}`), w.length > 0 && (E += ` FETCH ${w.join(", ")}`), l && (E += ` TIMEOUT ${l}s`), h && (E += " PARALLEL"), E; | ||
} | ||
}; | ||
let Oe = je; | ||
let Ce = je; | ||
ut = oe, Q = new WeakMap(), q = new WeakSet(), T = function(e) { | ||
@@ -1025,3 +1031,3 @@ return new je({ | ||
throw new N("Multiple projections must be specified seperately"); | ||
return new Oe({ | ||
return new Ce({ | ||
quantity: "many", | ||
@@ -1041,3 +1047,3 @@ projections: t.join(", ") || "*", | ||
} | ||
var C, at, b, F, Z, ce, K, he; | ||
var O, at, b, F, Z, ce, K, he; | ||
const Ie = class { | ||
@@ -1048,8 +1054,8 @@ constructor(e) { | ||
f(this, K); | ||
f(this, C, void 0); | ||
f(this, O, void 0); | ||
$(this, at, !0); | ||
m(this, C, e); | ||
m(this, O, e); | ||
} | ||
get _quantity() { | ||
return o(this, C).quantity; | ||
return o(this, O).quantity; | ||
} | ||
@@ -1068,3 +1074,3 @@ /** | ||
setFields: { | ||
...o(this, C).setFields, | ||
...o(this, O).setFields, | ||
[e]: n | ||
@@ -1087,3 +1093,3 @@ } | ||
setFields: { | ||
...o(this, C).setFields, | ||
...o(this, O).setFields, | ||
...e | ||
@@ -1182,29 +1188,29 @@ } | ||
setFields: i, | ||
where: l, | ||
returnMode: u, | ||
returnFields: y, | ||
where: u, | ||
returnMode: a, | ||
returnFields: d, | ||
timeout: c, | ||
parallel: w | ||
} = o(this, C); | ||
} = o(this, O); | ||
if (!e) | ||
throw new Error("No targets specified"); | ||
let a = `UPDATE ${e}`; | ||
let l = `UPDATE ${e}`; | ||
if (s(this, Z, ce).call(this)) { | ||
const h = ve(i); | ||
h && (a += ` SET ${h}`); | ||
h && (l += ` SET ${h}`); | ||
} else | ||
s(this, K, he).call(this) && (a += ` ${r === "merge" ? "MERGE" : "CONTENT"} ${JSON.stringify(n)}`); | ||
return l && (a += ` WHERE ${l}`), u === "fields" ? a += ` RETURN ${y.join(", ")}` : u && (a += ` RETURN ${u.toUpperCase()}`), c && (a += ` TIMEOUT ${c}s`), w && (a += " PARALLEL"), a; | ||
s(this, K, he).call(this) && (l += ` ${r === "merge" ? "MERGE" : "CONTENT"} ${JSON.stringify(n)}`); | ||
return u && (l += ` WHERE ${u}`), a === "fields" ? l += ` RETURN ${d.join(", ")}` : a && (l += ` RETURN ${a.toUpperCase()}`), c && (l += ` TIMEOUT ${c}s`), w && (l += " PARALLEL"), l; | ||
} | ||
}; | ||
let pe = Ie; | ||
at = oe, C = new WeakMap(), b = new WeakSet(), F = function(e) { | ||
at = oe, O = new WeakMap(), b = new WeakSet(), F = function(e) { | ||
return new Ie({ | ||
...o(this, C), | ||
...o(this, O), | ||
...e | ||
}); | ||
}, Z = new WeakSet(), ce = function() { | ||
return Object.keys(o(this, C).setFields).length > 0; | ||
return Object.keys(o(this, O).setFields).length > 0; | ||
}, K = new WeakSet(), he = function() { | ||
return Object.keys(o(this, C).content).length > 0; | ||
return Object.keys(o(this, O).content).length > 0; | ||
}; | ||
@@ -1266,6 +1272,6 @@ function qt(...t) { | ||
}; | ||
let Ce = Ue; | ||
let Oe = Ue; | ||
lt = oe, X = new WeakMap(), re = new WeakMap(); | ||
function St(t) { | ||
return new Ce(t, "many"); | ||
return new Oe(t, "many"); | ||
} | ||
@@ -1277,3 +1283,3 @@ const nt = /^[a-zA-Z0-9_]*$/; | ||
let n; | ||
return typeof e == "object" && "toQuery" in e ? n = `(${e.toQuery()})` : n = d(e), { | ||
return typeof e == "object" && "toQuery" in e ? n = `(${e.toQuery()})` : n = p(e), { | ||
[me]: !0, | ||
@@ -1287,3 +1293,3 @@ _quantity: "zero", | ||
} | ||
function p(t) { | ||
function y(t) { | ||
return { | ||
@@ -1293,85 +1299,85 @@ [se]: t | ||
} | ||
function Ct(t) { | ||
return y(`= ${p(t)}`); | ||
} | ||
function Ot(t) { | ||
return p(`= ${d(t)}`); | ||
return y(`!= ${p(t)}`); | ||
} | ||
function Ct(t) { | ||
return p(`!= ${d(t)}`); | ||
} | ||
function Rt(t) { | ||
return p(`== ${d(t)}`); | ||
return y(`== ${p(t)}`); | ||
} | ||
function vt(t) { | ||
return p(`?= ${d(t)}`); | ||
return y(`?= ${p(t)}`); | ||
} | ||
function At(t) { | ||
return p(`*= ${d(t)}`); | ||
return y(`*= ${p(t)}`); | ||
} | ||
function Ft(t) { | ||
return p(`~ ${d(t)}`); | ||
return y(`~ ${p(t)}`); | ||
} | ||
function Mt(t) { | ||
return p(`!~ ${d(t)}`); | ||
return y(`!~ ${p(t)}`); | ||
} | ||
function Lt(t) { | ||
return p(`?~ ${d(t)}`); | ||
return y(`?~ ${p(t)}`); | ||
} | ||
function jt(t) { | ||
return p(`*~ ${d(t)}`); | ||
return y(`*~ ${p(t)}`); | ||
} | ||
function It(t) { | ||
return p(`< ${d(t)}`); | ||
return y(`< ${p(t)}`); | ||
} | ||
function Ut(t) { | ||
return p(`<= ${d(t)}`); | ||
return y(`<= ${p(t)}`); | ||
} | ||
function xt(t) { | ||
return p(`> ${d(t)}`); | ||
return y(`> ${p(t)}`); | ||
} | ||
function Pt(t) { | ||
return p(`>= ${d(t)}`); | ||
return y(`>= ${p(t)}`); | ||
} | ||
function _t(t) { | ||
return p(`CONTAINS ${d(t)}`); | ||
return y(`CONTAINS ${p(t)}`); | ||
} | ||
function Jt(t) { | ||
return p(`CONTAINSNOT ${d(t)}`); | ||
return y(`CONTAINSNOT ${p(t)}`); | ||
} | ||
function kt(t) { | ||
return p(`CONTAINSALL ${d(t)}`); | ||
return y(`CONTAINSALL ${p(t)}`); | ||
} | ||
function Qt(t) { | ||
return p(`CONTAINSANY ${d(t)}`); | ||
return y(`CONTAINSANY ${p(t)}`); | ||
} | ||
function Dt(t) { | ||
return p(`CONTAINSNONE ${d(t)}`); | ||
return y(`CONTAINSNONE ${p(t)}`); | ||
} | ||
function Bt(t) { | ||
return p(`INSIDE ${d(t)}`); | ||
return y(`INSIDE ${p(t)}`); | ||
} | ||
function zt(t) { | ||
return p(`NOTINSIDE ${d(t)}`); | ||
return y(`NOTINSIDE ${p(t)}`); | ||
} | ||
function Gt(t) { | ||
return p(`ALLINSIDE ${d(t)}`); | ||
return y(`ALLINSIDE ${p(t)}`); | ||
} | ||
function Yt(t) { | ||
return p(`ANYINSIDE ${d(t)}`); | ||
return y(`ANYINSIDE ${p(t)}`); | ||
} | ||
function Ht(t) { | ||
return p(`NONEINSIDE ${d(t)}`); | ||
return y(`NONEINSIDE ${p(t)}`); | ||
} | ||
function Vt(t) { | ||
return p(`OUTSIDE ${d(t)}`); | ||
return y(`OUTSIDE ${p(t)}`); | ||
} | ||
function Zt(t) { | ||
return p(`INTERSECTS ${d(t)}`); | ||
return y(`INTERSECTS ${p(t)}`); | ||
} | ||
function Kt(t) { | ||
return p(`+= ${d(t)}`); | ||
return y(`+= ${p(t)}`); | ||
} | ||
function Xt(t) { | ||
return p(`-= ${d(t)}`); | ||
return y(`-= ${p(t)}`); | ||
} | ||
function Wt() { | ||
return p("time::now()"); | ||
return y("time::now()"); | ||
} | ||
@@ -1388,3 +1394,3 @@ export { | ||
Se as RelateQueryWriter, | ||
Oe as SelectQueryWriter, | ||
Ce as SelectQueryWriter, | ||
pe as UpdateQueryWriter, | ||
@@ -1407,3 +1413,3 @@ Kt as add, | ||
Rt as eeq, | ||
Ot as eq, | ||
Ct as eq, | ||
jt as fall, | ||
@@ -1419,3 +1425,3 @@ Lt as fany, | ||
Ut as lte, | ||
Ct as neq, | ||
Ot as neq, | ||
Mt as nfeq, | ||
@@ -1426,3 +1432,3 @@ Ht as noneInside, | ||
St as query, | ||
p as raw, | ||
y as raw, | ||
tt as relate, | ||
@@ -1429,0 +1435,0 @@ Et as relateRecords, |
@@ -403,2 +403,9 @@ import { ZodTypeAny, ZodNumber, z, ZodUndefined, TypeOf, ZodError } from 'zod'; | ||
} | ||
interface RecordRelation { | ||
fromTable: string; | ||
fromId: string; | ||
edge: string; | ||
toTable: string; | ||
toId: string; | ||
} | ||
/** | ||
@@ -418,2 +425,11 @@ * Start a new RELATE query with the given targets. | ||
* | ||
* @relation The relation information | ||
* @returns The query writer | ||
*/ | ||
declare function relateRecords(relation: RecordRelation): RelateQueryWriter; | ||
/** | ||
* Start a new RELATE query with the given records. This function | ||
* is especially useful in situations where the table name within a | ||
* record pointer may be spoofed, and a specific table name is required. | ||
* | ||
* @param fromTable The first record table | ||
@@ -1063,2 +1079,2 @@ * @param fromId The first record id, either the full id or just the unique id | ||
export { Cirql, CirqlBaseOptions, CirqlError, CirqlOptions, CirqlParseError, CirqlStateless, CirqlStatelessOptions, CirqlWriterError, ConnectionDetails, CountQueryWriter, CreateQueryWriter, CredentialDetails, DatabaseAuth, DeleteQueryWriter, ErrorCodes, GenericQueryRequest, GenericQueryWriter, MultiTypeOf, NamespaceAuth, Order, Ordering, Params, QuantitativeTypeOf, Quantity, QueryRequest, QueryWriter, RelateQueryWriter, ReturnMode, RootAuth, SchemafulQueryRequest, SchemafulQueryWriter, ScopeAuth, SelectQueryWriter, TokenAuth, UpdateQueryWriter, Where, add, all, allInside, any, anyInside, contains, containsAll, containsAny, containsNone, containsNot, count, create, createRecord, del, delRecord, eeq, eq, fall, fany, feq, gt, gte, inside, intersects, letValue, lt, lte, neq, nfeq, noneInside, notInside, outside, query, raw, relate, relateRecords, remove, select, timeNow, update, updateRecord }; | ||
export { Cirql, CirqlBaseOptions, CirqlError, CirqlOptions, CirqlParseError, CirqlStateless, CirqlStatelessOptions, CirqlWriterError, ConnectionDetails, CountQueryWriter, CreateQueryWriter, CredentialDetails, DatabaseAuth, DeleteQueryWriter, ErrorCodes, GenericQueryRequest, GenericQueryWriter, MultiTypeOf, NamespaceAuth, Order, Ordering, Params, QuantitativeTypeOf, Quantity, QueryRequest, QueryWriter, RecordRelation, RelateQueryWriter, ReturnMode, RootAuth, SchemafulQueryRequest, SchemafulQueryWriter, ScopeAuth, SelectQueryWriter, TokenAuth, UpdateQueryWriter, Where, add, all, allInside, any, anyInside, contains, containsAll, containsAny, containsNone, containsNot, count, create, createRecord, del, delRecord, eeq, eq, fall, fany, feq, gt, gte, inside, intersects, letValue, lt, lte, neq, nfeq, noneInside, notInside, outside, query, raw, relate, relateRecords, remove, select, timeNow, update, updateRecord }; |
{ | ||
"name": "cirql", | ||
"version": "0.3.0", | ||
"version": "0.3.1", | ||
"type": "module", | ||
@@ -5,0 +5,0 @@ "files": [ |
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
96124
2541