@teable/app 7.0.1 → 7.0.2
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.js +2 -2
- package/dist/chunks/{MV7KRBHD.js → 2VHESBP6.js} +1 -1
- package/dist/chunks/{SY3BAXHH.js → 55AX7R35.js} +2 -0
- package/dist/chunks/{CFKHMHDT.js → HOJZKDRT.js} +8 -6
- package/dist/chunks/{DPGYFUG5.js → N57JCM5C.js} +1 -1
- package/dist/chunks/{O4WQUPBV.js → TSMB4OBX.js} +2 -2
- package/dist/client.d.ts +8 -0
- package/dist/client.js +2 -2
- package/dist/dev/host.js +1 -1
- package/dist/index.js +3 -3
- package/dist/protocol.d.ts +7 -0
- package/dist/protocol.js +3 -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.js
CHANGED
|
@@ -263,6 +263,7 @@ var BRIDGE = String.raw`function (window, origins) {
|
|
|
263
263
|
}`;
|
|
264
264
|
var APPS_PATH = "/api/v4/apps";
|
|
265
265
|
var FILE_NAME_HEADER = "X-File-Name";
|
|
266
|
+
var PREVIEW_QUERY = "preview";
|
|
266
267
|
function fileKeyPath(key) {
|
|
267
268
|
const slash = key.indexOf("/");
|
|
268
269
|
return `${key.slice(0, slash)}/${encodeURIComponent(key.slice(slash + 1))}`;
|
|
@@ -340,6 +341,7 @@ export {
|
|
|
340
341
|
pagesBridge,
|
|
341
342
|
APPS_PATH,
|
|
342
343
|
FILE_NAME_HEADER,
|
|
344
|
+
PREVIEW_QUERY,
|
|
343
345
|
fileKeyPath,
|
|
344
346
|
DEPLOY_HEADERS,
|
|
345
347
|
DEPLOY_PARTS,
|
|
@@ -2,9 +2,10 @@ import {
|
|
|
2
2
|
APPS_PATH,
|
|
3
3
|
ERROR_STATUS,
|
|
4
4
|
FILE_NAME_HEADER,
|
|
5
|
+
PREVIEW_QUERY,
|
|
5
6
|
SESSION_PATH,
|
|
6
7
|
fileKeyPath
|
|
7
|
-
} from "./
|
|
8
|
+
} from "./55AX7R35.js";
|
|
8
9
|
|
|
9
10
|
// src/client.ts
|
|
10
11
|
var MethodError = class extends Error {
|
|
@@ -30,7 +31,8 @@ function createClient(options) {
|
|
|
30
31
|
const page = globalThis.location;
|
|
31
32
|
const base = () => options.baseUrl ?? page?.origin ?? "";
|
|
32
33
|
const doFetch = options.fetch ?? globalThis.fetch.bind(globalThis);
|
|
33
|
-
const dataKey = ["teable-app", options.appId];
|
|
34
|
+
const dataKey = [options.preview ? "teable-preview" : "teable-app", options.appId];
|
|
35
|
+
const scope = options.preview ? `?${PREVIEW_QUERY}=1` : "";
|
|
34
36
|
async function request(path, init = {
|
|
35
37
|
method: "GET"
|
|
36
38
|
}, prefix = `${APPS_PATH}/${options.appId}`) {
|
|
@@ -64,7 +66,7 @@ function createClient(options) {
|
|
|
64
66
|
let attempt = 0;
|
|
65
67
|
let timer;
|
|
66
68
|
const connect = (retry) => {
|
|
67
|
-
const url = new URL(`${base()}${APPS_PATH}/${options.appId}/realtime`);
|
|
69
|
+
const url = new URL(`${base()}${APPS_PATH}/${options.appId}/realtime${scope}`);
|
|
68
70
|
url.protocol = url.protocol === "https:" ? "wss:" : "ws:";
|
|
69
71
|
socket = new WebSocket(url.toString());
|
|
70
72
|
socket.onopen = () => {
|
|
@@ -92,9 +94,9 @@ function createClient(options) {
|
|
|
92
94
|
return {
|
|
93
95
|
appId: options.appId,
|
|
94
96
|
dataKey,
|
|
95
|
-
manifestKey: ["teable-manifest", options.appId],
|
|
96
|
-
call: ((method, input) => request(`/methods/${method}`, json(input))),
|
|
97
|
-
manifest: async () => await request(
|
|
97
|
+
manifestKey: [options.preview ? "teable-preview-manifest" : "teable-manifest", options.appId],
|
|
98
|
+
call: ((method, input) => request(`/methods/${method}${scope}`, json(input))),
|
|
99
|
+
manifest: async () => await request(`/manifest${scope}`),
|
|
98
100
|
members: async () => (await request("/members")).members,
|
|
99
101
|
accounts: async () => (await request("/accounts")).accounts,
|
|
100
102
|
queryKey: (method, input) => [...dataKey, method, input ?? {}],
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
describeTables
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./2VHESBP6.js";
|
|
4
4
|
import {
|
|
5
5
|
CAPABILITIES,
|
|
6
6
|
PROTOCOL_VERSION,
|
|
7
7
|
admit,
|
|
8
8
|
isPageAccess
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./55AX7R35.js";
|
|
10
10
|
|
|
11
11
|
// src/server/errors.ts
|
|
12
12
|
import { z } from "zod";
|
package/dist/client.d.ts
CHANGED
|
@@ -89,6 +89,14 @@ export interface ClientOptions {
|
|
|
89
89
|
/** A bearer identity token. Pages on the platform's domain use the identity cookie instead. */
|
|
90
90
|
token?: () => string | null | undefined;
|
|
91
91
|
fetch?: typeof fetch;
|
|
92
|
+
/**
|
|
93
|
+
* The app's preview instead of its live version (ADR 0022), from the
|
|
94
|
+
* platform's hosts, for those who may publish the app: its manifest, its
|
|
95
|
+
* methods on its copy of the data, and its realtime, under keys of its
|
|
96
|
+
* own. Files are the app's either way. On the preview's own host, pages
|
|
97
|
+
* call it without this.
|
|
98
|
+
*/
|
|
99
|
+
preview?: boolean;
|
|
92
100
|
}
|
|
93
101
|
export interface AppClient<S> {
|
|
94
102
|
readonly appId: string;
|
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/TSMB4OBX.js";
|
|
5
|
+
import "./chunks/2VHESBP6.js";
|
|
6
|
+
import "./chunks/55AX7R35.js";
|
|
7
7
|
|
|
8
8
|
// src/index.ts
|
|
9
9
|
import { z } from "zod";
|
package/dist/protocol.d.ts
CHANGED
|
@@ -588,6 +588,13 @@ export type RealtimeMessage = {
|
|
|
588
588
|
export declare const APPS_PATH = "/api/v4/apps";
|
|
589
589
|
/** The header that names an uploaded file (URI-encoded); the body is its bytes. */
|
|
590
590
|
export declare const FILE_NAME_HEADER = "X-File-Name";
|
|
591
|
+
/**
|
|
592
|
+
* The query parameter, set to `1`, by which a request on the platform's
|
|
593
|
+
* hosts names the app's preview (ADR 0022): the builder's views call it so,
|
|
594
|
+
* and signing in to it starts so. On the preview's own host every call is
|
|
595
|
+
* the preview's.
|
|
596
|
+
*/
|
|
597
|
+
export declare const PREVIEW_QUERY = "preview";
|
|
591
598
|
/** A file's key (`<uuid>/<name>`) as it goes in a URL path: the name encoded. */
|
|
592
599
|
export declare function fileKeyPath(key: string): string;
|
|
593
600
|
/**
|
package/dist/protocol.js
CHANGED
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
ERROR_STATUS,
|
|
13
13
|
FILE_NAME_HEADER,
|
|
14
14
|
PAGES_APP_META,
|
|
15
|
+
PREVIEW_QUERY,
|
|
15
16
|
PROTOCOL_VERSION,
|
|
16
17
|
SECRET_NAME,
|
|
17
18
|
SECRET_PLACEHOLDER,
|
|
@@ -32,7 +33,7 @@ import {
|
|
|
32
33
|
secretPlaceholder,
|
|
33
34
|
signedInAsAsked,
|
|
34
35
|
spaceRoleOf
|
|
35
|
-
} from "./chunks/
|
|
36
|
+
} from "./chunks/55AX7R35.js";
|
|
36
37
|
export {
|
|
37
38
|
APPS_PATH,
|
|
38
39
|
APP_COMPATIBILITY_DATE,
|
|
@@ -47,6 +48,7 @@ export {
|
|
|
47
48
|
ERROR_STATUS,
|
|
48
49
|
FILE_NAME_HEADER,
|
|
49
50
|
PAGES_APP_META,
|
|
51
|
+
PREVIEW_QUERY,
|
|
50
52
|
PROTOCOL_VERSION,
|
|
51
53
|
SECRET_NAME,
|
|
52
54
|
SECRET_PLACEHOLDER,
|
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/TSMB4OBX.js";
|
|
4
|
+
import "./chunks/2VHESBP6.js";
|
|
5
5
|
import {
|
|
6
6
|
MethodError
|
|
7
|
-
} from "./chunks/
|
|
7
|
+
} from "./chunks/HOJZKDRT.js";
|
|
8
8
|
import {
|
|
9
9
|
ERROR_STATUS
|
|
10
|
-
} from "./chunks/
|
|
10
|
+
} from "./chunks/55AX7R35.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