convex 0.9.0 → 0.9.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser.bundle.js +41 -24
- package/dist/browser.bundle.js.map +2 -2
- package/dist/cjs/browser/http_client.js +41 -24
- package/dist/cjs/browser/http_client.js.map +2 -2
- package/dist/cjs/index.js +1 -1
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/server/impl/actions_impl.js +2 -2
- package/dist/cjs/server/impl/actions_impl.js.map +2 -2
- package/dist/cli.bundle.cjs +1 -1
- package/dist/cli.bundle.cjs.map +1 -1
- package/dist/esm/browser/http_client.js +42 -25
- package/dist/esm/browser/http_client.js.map +2 -2
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/server/impl/actions_impl.js +3 -3
- package/dist/esm/server/impl/actions_impl.js.map +2 -2
- package/dist/react.bundle.js +1 -1
- package/dist/react.bundle.js.map +1 -1
- package/dist/types/browser/http_client.d.ts.map +1 -1
- package/dist/types/index.d.ts +1 -1
- package/package.json +1 -1
- package/src/browser/http_client.ts +50 -29
- package/src/index.ts +1 -1
- package/src/server/impl/actions_impl.ts +3 -3
- package/tmp.txt +20 -0
- package/tsconfig-cjsemit.json +27 -0
package/dist/browser.bundle.js
CHANGED
|
@@ -212,7 +212,7 @@ var convex = (() => {
|
|
|
212
212
|
var v4_default = v4;
|
|
213
213
|
|
|
214
214
|
// src/index.ts
|
|
215
|
-
var version = "0.9.
|
|
215
|
+
var version = "0.9.1";
|
|
216
216
|
|
|
217
217
|
// src/values/values.ts
|
|
218
218
|
var Base64 = __toESM(require_base64_js());
|
|
@@ -1711,26 +1711,39 @@ var convex = (() => {
|
|
|
1711
1711
|
}
|
|
1712
1712
|
query(name) {
|
|
1713
1713
|
return async (...args) => {
|
|
1714
|
-
const
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1714
|
+
const body = JSON.stringify({
|
|
1715
|
+
path: name,
|
|
1716
|
+
args: convexToJson(args),
|
|
1717
|
+
debug: this.debug
|
|
1718
|
+
});
|
|
1719
|
+
const headers = {
|
|
1720
|
+
"Content-Type": "application/json",
|
|
1721
|
+
"Convex-Client": `npm-${version}`
|
|
1722
|
+
};
|
|
1723
|
+
if (this.auth) {
|
|
1724
|
+
headers["Authorization"] = `Bearer ${this.auth}`;
|
|
1725
|
+
}
|
|
1726
|
+
const response = await fetch(`${this.address}/query`, {
|
|
1727
|
+
body,
|
|
1728
|
+
method: "POST",
|
|
1729
|
+
headers,
|
|
1730
|
+
credentials: "include"
|
|
1721
1731
|
});
|
|
1722
1732
|
if (!response.ok && response.status !== STATUS_CODE_UDF_FAILED) {
|
|
1723
1733
|
throw new Error(await response.text());
|
|
1724
1734
|
}
|
|
1725
1735
|
const respJSON = await response.json();
|
|
1726
|
-
const
|
|
1727
|
-
for (const line of respJSON.logs) {
|
|
1736
|
+
for (const line of respJSON.logLines ?? []) {
|
|
1728
1737
|
logToConsole("info", "query", name, line);
|
|
1729
1738
|
}
|
|
1730
|
-
|
|
1731
|
-
|
|
1739
|
+
switch (respJSON.status) {
|
|
1740
|
+
case "success":
|
|
1741
|
+
return jsonToConvex(respJSON.value);
|
|
1742
|
+
case "error":
|
|
1743
|
+
throw new Error(respJSON.errorMessage);
|
|
1744
|
+
default:
|
|
1745
|
+
throw new Error(`Invalid response: ${JSON.stringify(respJSON)}`);
|
|
1732
1746
|
}
|
|
1733
|
-
return value;
|
|
1734
1747
|
};
|
|
1735
1748
|
}
|
|
1736
1749
|
mutation(name) {
|
|
@@ -1738,15 +1751,16 @@ var convex = (() => {
|
|
|
1738
1751
|
const body = JSON.stringify({
|
|
1739
1752
|
path: name,
|
|
1740
1753
|
args: convexToJson(args),
|
|
1741
|
-
|
|
1754
|
+
debug: this.debug
|
|
1742
1755
|
});
|
|
1743
1756
|
const headers = {
|
|
1744
|
-
"Content-Type": "application/json"
|
|
1757
|
+
"Content-Type": "application/json",
|
|
1758
|
+
"Convex-Client": `npm-${version}`
|
|
1745
1759
|
};
|
|
1746
1760
|
if (this.auth) {
|
|
1747
1761
|
headers["Authorization"] = `Bearer ${this.auth}`;
|
|
1748
1762
|
}
|
|
1749
|
-
const response = await fetch(`${this.address}
|
|
1763
|
+
const response = await fetch(`${this.address}/mutation`, {
|
|
1750
1764
|
body,
|
|
1751
1765
|
method: "POST",
|
|
1752
1766
|
headers,
|
|
@@ -1756,14 +1770,17 @@ var convex = (() => {
|
|
|
1756
1770
|
throw new Error(await response.text());
|
|
1757
1771
|
}
|
|
1758
1772
|
const respJSON = await response.json();
|
|
1759
|
-
const
|
|
1760
|
-
for (const line of respJSON.logs) {
|
|
1773
|
+
for (const line of respJSON.logLines ?? []) {
|
|
1761
1774
|
logToConsole("info", "mutation", name, line);
|
|
1762
1775
|
}
|
|
1763
|
-
|
|
1764
|
-
|
|
1776
|
+
switch (respJSON.status) {
|
|
1777
|
+
case "success":
|
|
1778
|
+
return jsonToConvex(respJSON.value);
|
|
1779
|
+
case "error":
|
|
1780
|
+
throw new Error(respJSON.errorMessage);
|
|
1781
|
+
default:
|
|
1782
|
+
throw new Error(`Invalid response: ${JSON.stringify(respJSON)}`);
|
|
1765
1783
|
}
|
|
1766
|
-
return value;
|
|
1767
1784
|
};
|
|
1768
1785
|
}
|
|
1769
1786
|
action(name) {
|
|
@@ -1774,7 +1791,8 @@ var convex = (() => {
|
|
|
1774
1791
|
debug: this.debug
|
|
1775
1792
|
});
|
|
1776
1793
|
const headers = {
|
|
1777
|
-
"Content-Type": "application/json"
|
|
1794
|
+
"Content-Type": "application/json",
|
|
1795
|
+
"Convex-Client": `npm-${version}`
|
|
1778
1796
|
};
|
|
1779
1797
|
if (this.auth) {
|
|
1780
1798
|
headers["Authorization"] = `Bearer ${this.auth}`;
|
|
@@ -1794,8 +1812,7 @@ var convex = (() => {
|
|
|
1794
1812
|
}
|
|
1795
1813
|
switch (respJSON.status) {
|
|
1796
1814
|
case "success":
|
|
1797
|
-
jsonToConvex(respJSON.value);
|
|
1798
|
-
return respJSON.value;
|
|
1815
|
+
return jsonToConvex(respJSON.value);
|
|
1799
1816
|
case "error":
|
|
1800
1817
|
throw new Error(respJSON.errorMessage);
|
|
1801
1818
|
default:
|