tandem-editor 0.6.3 → 0.7.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/CHANGELOG.md +389 -32
- package/dist/channel/index.js +41 -7
- package/dist/channel/index.js.map +1 -1
- package/dist/cli/index.js +382 -40
- package/dist/cli/index.js.map +1 -1
- package/dist/client/assets/index-DLTxaDBk.js +351 -0
- package/dist/client/index.html +1 -1
- package/dist/monitor/index.js +23 -2
- package/dist/monitor/index.js.map +1 -1
- package/dist/server/index.js +835 -395
- package/dist/server/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/client/assets/index-B1Cd5UGT.js +0 -349
package/dist/client/index.html
CHANGED
package/dist/monitor/index.js
CHANGED
|
@@ -84,6 +84,27 @@ var TANDEM_MODE_DEFAULT = "tandem";
|
|
|
84
84
|
var CHANNEL_MAX_RETRIES = 5;
|
|
85
85
|
var CHANNEL_RETRY_DELAY_MS = 2e3;
|
|
86
86
|
|
|
87
|
+
// src/shared/cli-runtime.ts
|
|
88
|
+
var VALID_TOKEN_RE = /^[A-Za-z0-9_\-]{32,}$/;
|
|
89
|
+
var _warnedInvalidToken = false;
|
|
90
|
+
async function authFetch(url, init) {
|
|
91
|
+
const token = process.env.TANDEM_AUTH_TOKEN;
|
|
92
|
+
if (token !== void 0 && token.trim() !== "") {
|
|
93
|
+
if (VALID_TOKEN_RE.test(token.trim())) {
|
|
94
|
+
const headers = new Headers(init?.headers);
|
|
95
|
+
headers.set("Authorization", `Bearer ${token.trim()}`);
|
|
96
|
+
return fetch(url, { ...init, headers });
|
|
97
|
+
}
|
|
98
|
+
if (!_warnedInvalidToken) {
|
|
99
|
+
_warnedInvalidToken = true;
|
|
100
|
+
console.error(
|
|
101
|
+
"[tandem] authFetch: TANDEM_AUTH_TOKEN is set but invalid (must be 32+ alphanumeric chars [A-Za-z0-9_-]); sending without Authorization header"
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return fetch(url, init);
|
|
106
|
+
}
|
|
107
|
+
|
|
87
108
|
// node_modules/zod/v3/external.js
|
|
88
109
|
var external_exports = {};
|
|
89
110
|
__export(external_exports, {
|
|
@@ -4168,7 +4189,7 @@ var STABLE_CONNECTION_MS = 6e4;
|
|
|
4168
4189
|
var CHANNEL_RETRY_MAX_DELAY_MS = 3e4;
|
|
4169
4190
|
async function fetchWithTimeout(url, init, timeoutMs) {
|
|
4170
4191
|
const signal = AbortSignal.timeout(timeoutMs);
|
|
4171
|
-
return
|
|
4192
|
+
return authFetch(url, { ...init, signal });
|
|
4172
4193
|
}
|
|
4173
4194
|
function describeFetchError(err, endpoint, timeoutMs) {
|
|
4174
4195
|
if (err instanceof Error && (err.name === "TimeoutError" || err.name === "AbortError")) {
|
|
@@ -4253,7 +4274,7 @@ async function connectAndStream(lastEventId, onEventId, onStable = () => {
|
|
|
4253
4274
|
);
|
|
4254
4275
|
let res;
|
|
4255
4276
|
try {
|
|
4256
|
-
res = await
|
|
4277
|
+
res = await authFetch(`${TANDEM_URL}/api/events`, { headers, signal: connectCtrl.signal });
|
|
4257
4278
|
} finally {
|
|
4258
4279
|
clearTimeout(connectTimer);
|
|
4259
4280
|
}
|