@teable/app 6.1.7 → 6.1.8
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/build/cli.js +2 -2
- package/dist/build/index.d.ts +20 -3
- package/dist/build/index.js +2 -2
- package/dist/chunks/{V6KXHW3L.js → ERQJZOEM.js} +30 -0
- package/dist/chunks/{GCWICK3X.js → GMRE3ZBW.js} +1 -1
- package/dist/chunks/{2RGK2EON.js → K5LVABM3.js} +2 -2
- package/dist/chunks/{QI7K66CG.js → KOPAQ575.js} +32 -3
- package/dist/chunks/{2UHILLRW.js → QPDT7M6Y.js} +1 -1
- package/dist/client.js +2 -2
- package/dist/dev/host.js +1 -1
- package/dist/index.js +3 -3
- package/dist/protocol.d.ts +27 -5
- package/dist/protocol.js +1 -1
- package/dist/schema.js +2 -2
- package/dist/testing.js +4 -4
- package/dist/worker.js +2 -2
- package/package.json +1 -1
package/dist/build/cli.js
CHANGED
package/dist/build/index.d.ts
CHANGED
|
@@ -68,6 +68,13 @@ export interface TeableOptions {
|
|
|
68
68
|
url: string;
|
|
69
69
|
token?: string;
|
|
70
70
|
};
|
|
71
|
+
/**
|
|
72
|
+
* A builder that shows these pages in its Preview in development: its
|
|
73
|
+
* address. The pages get the Preview's bridge for it, as the runtime adds
|
|
74
|
+
* it on the app's host (ADR 0017), so the Preview follows them, picks from
|
|
75
|
+
* them and hears their errors.
|
|
76
|
+
*/
|
|
77
|
+
builder?: string;
|
|
71
78
|
}
|
|
72
79
|
type Next = (error?: unknown) => void;
|
|
73
80
|
type Middleware = (req: IncomingMessage, res: ServerResponse, next: Next) => void;
|
|
@@ -131,15 +138,25 @@ export declare function teable(options?: TeableOptions): {
|
|
|
131
138
|
};
|
|
132
139
|
};
|
|
133
140
|
}>;
|
|
134
|
-
/**
|
|
135
|
-
|
|
141
|
+
/**
|
|
142
|
+
* The pages name the app they are built for: a deploy to another app
|
|
143
|
+
* refuses them. Served for a builder, they start with its bridge.
|
|
144
|
+
*/
|
|
145
|
+
transformIndexHtml(): ({
|
|
136
146
|
tag: string;
|
|
137
147
|
attrs: {
|
|
138
148
|
name: string;
|
|
139
149
|
content: string;
|
|
140
150
|
};
|
|
141
151
|
injectTo: string;
|
|
142
|
-
}
|
|
152
|
+
} | {
|
|
153
|
+
tag: string;
|
|
154
|
+
attrs: {
|
|
155
|
+
src: string;
|
|
156
|
+
defer: boolean;
|
|
157
|
+
};
|
|
158
|
+
injectTo: string;
|
|
159
|
+
})[];
|
|
143
160
|
configureServer(server: DevServer): (() => void) | undefined;
|
|
144
161
|
};
|
|
145
162
|
export {};
|
package/dist/build/index.js
CHANGED
|
@@ -228,6 +228,36 @@ var BRIDGE = String.raw`function (window, origins) {
|
|
|
228
228
|
});
|
|
229
229
|
window.addEventListener("popstate", announce);
|
|
230
230
|
window.addEventListener("hashchange", announce);
|
|
231
|
+
var failures = 0;
|
|
232
|
+
function said(value) {
|
|
233
|
+
if (typeof value === "string") return value;
|
|
234
|
+
try {
|
|
235
|
+
var json = JSON.stringify(value);
|
|
236
|
+
if (json !== undefined && json !== "{}") return json;
|
|
237
|
+
} catch (error) {}
|
|
238
|
+
return String(value);
|
|
239
|
+
}
|
|
240
|
+
function fail(kind, error, otherwise, at) {
|
|
241
|
+
if (failures >= 20) return;
|
|
242
|
+
failures++;
|
|
243
|
+
var known = error !== null && typeof error === "object" && typeof error.message === "string";
|
|
244
|
+
var message = known ? (error.name ? error.name + ": " : "") + error.message : said(otherwise);
|
|
245
|
+
var stack = known && typeof error.stack === "string" && error.stack ? error.stack : at;
|
|
246
|
+
var report = {
|
|
247
|
+
path: where(),
|
|
248
|
+
kind: kind,
|
|
249
|
+
message: message.slice(0, 1000),
|
|
250
|
+
stack: stack ? stack.slice(0, 4000) : null,
|
|
251
|
+
};
|
|
252
|
+
for (var i = 0; i < origins.length; i++) post({ type: "error", error: report }, origins[i]);
|
|
253
|
+
}
|
|
254
|
+
window.addEventListener("error", function (event) {
|
|
255
|
+
var at = event.filename ? event.filename + ":" + event.lineno + ":" + event.colno : null;
|
|
256
|
+
fail("error", event.error, event.message, at);
|
|
257
|
+
});
|
|
258
|
+
window.addEventListener("unhandledrejection", function (event) {
|
|
259
|
+
fail("rejection", event.reason, event.reason, null);
|
|
260
|
+
});
|
|
231
261
|
announce();
|
|
232
262
|
}`;
|
|
233
263
|
var APPS_PATH = "/api/v4/apps";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
describeTables
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./QPDT7M6Y.js";
|
|
4
4
|
import {
|
|
5
5
|
CAPABILITIES,
|
|
6
6
|
PROTOCOL_VERSION,
|
|
7
7
|
admit,
|
|
8
8
|
isPageAccess
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./ERQJZOEM.js";
|
|
10
10
|
|
|
11
11
|
// src/server/errors.ts
|
|
12
12
|
import { z } from "zod";
|
|
@@ -2,12 +2,14 @@ import {
|
|
|
2
2
|
APPS_PATH,
|
|
3
3
|
APP_COMPATIBILITY_DATE,
|
|
4
4
|
ASSETS_HEADER,
|
|
5
|
+
BRIDGE_PATH,
|
|
5
6
|
DEV_PATHS,
|
|
6
7
|
PAGES_APP_META,
|
|
7
8
|
SESSION_PATH,
|
|
8
9
|
checkAccess,
|
|
10
|
+
pagesBridge,
|
|
9
11
|
spaceRoleOf
|
|
10
|
-
} from "./
|
|
12
|
+
} from "./ERQJZOEM.js";
|
|
11
13
|
|
|
12
14
|
// src/build/index.ts
|
|
13
15
|
import { existsSync, readFileSync } from "node:fs";
|
|
@@ -150,12 +152,14 @@ function teable(options = {}) {
|
|
|
150
152
|
let appId = options.appId ?? "app";
|
|
151
153
|
let workerd = "";
|
|
152
154
|
const serving = (command) => command === "serve" && !process.env.VITEST;
|
|
155
|
+
let builder = null;
|
|
153
156
|
return {
|
|
154
157
|
name: "teable",
|
|
155
158
|
async config(config, env) {
|
|
156
159
|
appId = options.appId ?? appIdOf(config.root ?? process.cwd());
|
|
157
160
|
const define = { "import.meta.env.VITE_TEABLE_APP_ID": JSON.stringify(appId) };
|
|
158
161
|
if (!serving(env.command)) return { define };
|
|
162
|
+
builder = options.builder ? new URL(options.builder).origin : null;
|
|
159
163
|
const { remote } = options;
|
|
160
164
|
let target;
|
|
161
165
|
let configure;
|
|
@@ -180,11 +184,36 @@ function teable(options = {}) {
|
|
|
180
184
|
server: { proxy: { [APPS_PATH]: proxy, ...remote ? {} : { [SESSION_PATH]: proxy } } }
|
|
181
185
|
};
|
|
182
186
|
},
|
|
183
|
-
/**
|
|
187
|
+
/**
|
|
188
|
+
* The pages name the app they are built for: a deploy to another app
|
|
189
|
+
* refuses them. Served for a builder, they start with its bridge.
|
|
190
|
+
*/
|
|
184
191
|
transformIndexHtml() {
|
|
185
|
-
|
|
192
|
+
const meta = {
|
|
193
|
+
tag: "meta",
|
|
194
|
+
attrs: { name: PAGES_APP_META, content: appId },
|
|
195
|
+
injectTo: "head"
|
|
196
|
+
};
|
|
197
|
+
if (builder === null) return [meta];
|
|
198
|
+
const bridge = {
|
|
199
|
+
tag: "script",
|
|
200
|
+
attrs: { src: BRIDGE_PATH, defer: true },
|
|
201
|
+
injectTo: "head-prepend"
|
|
202
|
+
};
|
|
203
|
+
return [bridge, meta];
|
|
186
204
|
},
|
|
187
205
|
configureServer(server) {
|
|
206
|
+
if (builder !== null) {
|
|
207
|
+
const script = pagesBridge([builder]);
|
|
208
|
+
server.middlewares.use((req, res, next) => {
|
|
209
|
+
if (req.url?.split("?")[0] !== BRIDGE_PATH) return next();
|
|
210
|
+
res.writeHead(200, {
|
|
211
|
+
"Content-Type": "text/javascript; charset=utf-8",
|
|
212
|
+
"Cache-Control": "no-cache"
|
|
213
|
+
});
|
|
214
|
+
res.end(script);
|
|
215
|
+
});
|
|
216
|
+
}
|
|
188
217
|
if (!workerd && !options.remote) return;
|
|
189
218
|
if (options.remote) {
|
|
190
219
|
server.middlewares.use(remoteMiddleware(options.remote, appId));
|
package/dist/client.js
CHANGED
package/dist/dev/host.js
CHANGED
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createApp,
|
|
3
3
|
fail
|
|
4
|
-
} from "./chunks/
|
|
5
|
-
import "./chunks/
|
|
6
|
-
import "./chunks/
|
|
4
|
+
} from "./chunks/K5LVABM3.js";
|
|
5
|
+
import "./chunks/QPDT7M6Y.js";
|
|
6
|
+
import "./chunks/ERQJZOEM.js";
|
|
7
7
|
|
|
8
8
|
// src/index.ts
|
|
9
9
|
import { z } from "zod";
|
package/dist/protocol.d.ts
CHANGED
|
@@ -412,9 +412,10 @@ export interface SessionResponse {
|
|
|
412
412
|
/**
|
|
413
413
|
* The bridge between the builder's Preview and an app's pages, in its frame:
|
|
414
414
|
* a script the runtime serves on the app's host (`BRIDGE_PATH`) and adds to
|
|
415
|
-
* the pages it frames there. It tells the builder where the page is,
|
|
416
|
-
*
|
|
417
|
-
* clicked. It answers only the builder's
|
|
415
|
+
* the pages it frames there. It tells the builder where the page is, the
|
|
416
|
+
* errors the page does not catch, and, while the person picks an element to
|
|
417
|
+
* point the agent at, which they clicked. It answers only the builder's
|
|
418
|
+
* hosts, and tells only them.
|
|
418
419
|
*/
|
|
419
420
|
export declare const BRIDGE_PATH = "/.teable/bridge.js";
|
|
420
421
|
/** What the builder tells the bridge: start or stop picking an element. */
|
|
@@ -438,9 +439,24 @@ export interface PickedElement {
|
|
|
438
439
|
/** A CSS selector for it, from its nearest ancestor with an id, at most six steps. */
|
|
439
440
|
selector: string;
|
|
440
441
|
}
|
|
442
|
+
/**
|
|
443
|
+
* What went wrong in a page that nothing in it caught: an error its scripts
|
|
444
|
+
* threw, or a promise they left rejected, as the bridge reports it.
|
|
445
|
+
*/
|
|
446
|
+
export interface PageError {
|
|
447
|
+
/** The page it happened on: its path, query and fragment. */
|
|
448
|
+
path: string;
|
|
449
|
+
/** Thrown (`error`), or a promise rejected with nothing to handle it (`rejection`). */
|
|
450
|
+
kind: "error" | "rejection";
|
|
451
|
+
/** The error's name and message, or what was thrown, at most 1,000 characters. */
|
|
452
|
+
message: string;
|
|
453
|
+
/** Its stack as the browser gives it, else where it was thrown if known; at most 4,000 characters. */
|
|
454
|
+
stack: string | null;
|
|
455
|
+
}
|
|
441
456
|
/**
|
|
442
457
|
* What the bridge tells the builder: where the page is (as it loads and as
|
|
443
|
-
* it moves), the element picked,
|
|
458
|
+
* it moves), the element picked, that picking stopped (Escape), or an error
|
|
459
|
+
* the page did not catch (the first twenty of each page it loads).
|
|
444
460
|
*/
|
|
445
461
|
export type PagesMessage = {
|
|
446
462
|
source: "teable-pages";
|
|
@@ -453,11 +469,17 @@ export type PagesMessage = {
|
|
|
453
469
|
} | {
|
|
454
470
|
source: "teable-pages";
|
|
455
471
|
type: "stopped";
|
|
472
|
+
} | {
|
|
473
|
+
source: "teable-pages";
|
|
474
|
+
type: "error";
|
|
475
|
+
error: PageError;
|
|
456
476
|
};
|
|
457
477
|
/**
|
|
458
478
|
* The bridge's script, for a page framed by one of `origins` (the builder's
|
|
459
479
|
* hosts), which alone may ask it anything. Plain script, so that it runs
|
|
460
|
-
* in any app's pages, built with any SDK; `window` is the page's.
|
|
480
|
+
* in any app's pages, built with any SDK; `window` is the page's. It hears
|
|
481
|
+
* the page's errors from where it runs, so it runs before the page's own
|
|
482
|
+
* scripts: first in the page's head.
|
|
461
483
|
*/
|
|
462
484
|
export declare function pagesBridge(origins: readonly string[]): string;
|
|
463
485
|
/**
|
package/dist/protocol.js
CHANGED
package/dist/schema.js
CHANGED
package/dist/testing.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
methodName
|
|
3
|
-
} from "./chunks/
|
|
4
|
-
import "./chunks/
|
|
3
|
+
} from "./chunks/K5LVABM3.js";
|
|
4
|
+
import "./chunks/QPDT7M6Y.js";
|
|
5
5
|
import {
|
|
6
6
|
MethodError
|
|
7
|
-
} from "./chunks/
|
|
7
|
+
} from "./chunks/GMRE3ZBW.js";
|
|
8
8
|
import {
|
|
9
9
|
ERROR_STATUS
|
|
10
|
-
} from "./chunks/
|
|
10
|
+
} from "./chunks/ERQJZOEM.js";
|
|
11
11
|
|
|
12
12
|
// src/testing.ts
|
|
13
13
|
var OWNER = { kind: "user", userId: "test-owner", role: "owner", via: "api" };
|
package/dist/worker.js
CHANGED