@teable/app 6.1.4 → 6.1.5
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/{TDLQQFGT.js → 7LMF3F7Z.js} +1 -1
- package/dist/chunks/{O6KEZ2KL.js → JX4PSLSS.js} +2 -2
- package/dist/chunks/{H3YCXVRL.js → QFBJVTKN.js} +12 -2
- package/dist/chunks/{RJHLCJUX.js → X7RU6GWG.js} +17 -1
- package/dist/chunks/{TN5GZDH5.js → YKGJK354.js} +1 -1
- package/dist/client.js +2 -2
- package/dist/dev/host.js +10 -1
- package/dist/index.js +3 -3
- package/dist/protocol.d.ts +12 -0
- package/dist/protocol.js +11 -3
- 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
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
describeTables
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./YKGJK354.js";
|
|
4
4
|
import {
|
|
5
5
|
CAPABILITIES,
|
|
6
6
|
PROTOCOL_VERSION,
|
|
7
7
|
admit,
|
|
8
8
|
isPageAccess
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./X7RU6GWG.js";
|
|
10
10
|
|
|
11
11
|
// src/server/errors.ts
|
|
12
12
|
import { z } from "zod";
|
|
@@ -5,8 +5,9 @@ import {
|
|
|
5
5
|
DEV_PATHS,
|
|
6
6
|
PAGES_APP_META,
|
|
7
7
|
SESSION_PATH,
|
|
8
|
-
checkAccess
|
|
9
|
-
|
|
8
|
+
checkAccess,
|
|
9
|
+
spaceRoleOf
|
|
10
|
+
} from "./X7RU6GWG.js";
|
|
10
11
|
|
|
11
12
|
// src/build/index.ts
|
|
12
13
|
import { existsSync, readFileSync } from "node:fs";
|
|
@@ -303,6 +304,15 @@ function remoteMiddleware(remote, appId) {
|
|
|
303
304
|
const url = new URL(req.url ?? "/", "http://localhost");
|
|
304
305
|
switch (`${req.method} ${url.pathname}`) {
|
|
305
306
|
case `GET ${SESSION_PATH}/sign-in`: {
|
|
307
|
+
const as = url.searchParams.get("as");
|
|
308
|
+
if (as === "anonymous" || spaceRoleOf(as) !== null) {
|
|
309
|
+
const who = as === "anonymous" ? "anonymous" : "token";
|
|
310
|
+
res.writeHead(302, {
|
|
311
|
+
Location: onHost(url.searchParams.get("return")),
|
|
312
|
+
"Set-Cookie": cookie(who)
|
|
313
|
+
});
|
|
314
|
+
return res.end();
|
|
315
|
+
}
|
|
306
316
|
if (!signedOut(req) && !url.searchParams.has("choose")) {
|
|
307
317
|
res.writeHead(302, { Location: onHost(url.searchParams.get("return")) });
|
|
308
318
|
return res.end();
|
|
@@ -115,6 +115,18 @@ function isExposed(method) {
|
|
|
115
115
|
function callableMethods(manifest, caller) {
|
|
116
116
|
return manifest.methods.filter((m) => isExposed(m) && checkAccess(caller, m.access) === null);
|
|
117
117
|
}
|
|
118
|
+
function spaceRoleOf(name) {
|
|
119
|
+
return SPACE_ROLES.find((role) => role === name) ?? null;
|
|
120
|
+
}
|
|
121
|
+
function roleAsAsked(role, asked) {
|
|
122
|
+
return asked !== null && SPACE_ROLES.indexOf(asked) > SPACE_ROLES.indexOf(role) ? asked : role;
|
|
123
|
+
}
|
|
124
|
+
function signedInAsAsked(role, asked) {
|
|
125
|
+
return asked === null || role === asked;
|
|
126
|
+
}
|
|
127
|
+
function rolesBelow(role) {
|
|
128
|
+
return SPACE_ROLES.slice(SPACE_ROLES.indexOf(role) + 1);
|
|
129
|
+
}
|
|
118
130
|
|
|
119
131
|
export {
|
|
120
132
|
PROTOCOL_VERSION,
|
|
@@ -142,5 +154,9 @@ export {
|
|
|
142
154
|
admit,
|
|
143
155
|
isMember,
|
|
144
156
|
isExposed,
|
|
145
|
-
callableMethods
|
|
157
|
+
callableMethods,
|
|
158
|
+
spaceRoleOf,
|
|
159
|
+
roleAsAsked,
|
|
160
|
+
signedInAsAsked,
|
|
161
|
+
rolesBelow
|
|
146
162
|
};
|
package/dist/client.js
CHANGED
package/dist/dev/host.js
CHANGED
|
@@ -10,7 +10,7 @@ import {
|
|
|
10
10
|
callableMethods,
|
|
11
11
|
checkAccess,
|
|
12
12
|
isMember
|
|
13
|
-
} from "../chunks/
|
|
13
|
+
} from "../chunks/X7RU6GWG.js";
|
|
14
14
|
|
|
15
15
|
// src/dev/host.ts
|
|
16
16
|
import { DurableObject, WorkerEntrypoint } from "cloudflare:workers";
|
|
@@ -239,6 +239,15 @@ async function session(request, url) {
|
|
|
239
239
|
switch (route) {
|
|
240
240
|
case "GET /sign-in": {
|
|
241
241
|
const returnTo = pathOnHost(url.searchParams.get("return"));
|
|
242
|
+
const as = PICKS.find(
|
|
243
|
+
(pick) => pick.who !== "outsider" && pick.who === url.searchParams.get("as")
|
|
244
|
+
);
|
|
245
|
+
if (as) {
|
|
246
|
+
return new Response(null, {
|
|
247
|
+
status: 302,
|
|
248
|
+
headers: { Location: returnTo, "Set-Cookie": cookie(as.who) }
|
|
249
|
+
});
|
|
250
|
+
}
|
|
242
251
|
const caller = callerOf(request);
|
|
243
252
|
if (caller.kind === "user" && !url.searchParams.has("choose")) {
|
|
244
253
|
return new Response(null, { status: 302, headers: { Location: returnTo } });
|
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/JX4PSLSS.js";
|
|
5
|
+
import "./chunks/YKGJK354.js";
|
|
6
|
+
import "./chunks/X7RU6GWG.js";
|
|
7
7
|
|
|
8
8
|
// src/index.ts
|
|
9
9
|
import { z } from "zod";
|
package/dist/protocol.d.ts
CHANGED
|
@@ -612,3 +612,15 @@ export declare function isMember(caller: Caller): boolean;
|
|
|
612
612
|
export declare function isExposed(method: MethodInfo): boolean;
|
|
613
613
|
/** The exposed methods this caller may call. */
|
|
614
614
|
export declare function callableMethods(manifest: AppManifest, caller: Caller): MethodInfo[];
|
|
615
|
+
/** A space role by its name; null for anything else. */
|
|
616
|
+
export declare function spaceRoleOf(name: unknown): SpaceRole | null;
|
|
617
|
+
/**
|
|
618
|
+
* The role a sign-in to an app's pages gives a person who asked to be at
|
|
619
|
+
* most `asked` (the builder's Preview, as another role): theirs, or the
|
|
620
|
+
* lower one asked for, never a higher one. Null asks for theirs.
|
|
621
|
+
*/
|
|
622
|
+
export declare function roleAsAsked(role: SpaceRole, asked: SpaceRole | null): SpaceRole;
|
|
623
|
+
/** Whether a session with `role` is what a sign-in asking for `asked` gives: none is needed. */
|
|
624
|
+
export declare function signedInAsAsked(role: SpaceRole, asked: SpaceRole | null): boolean;
|
|
625
|
+
/** The roles below `role`, highest first: those its holder may preview an app's pages as. */
|
|
626
|
+
export declare function rolesBelow(role: SpaceRole): SpaceRole[];
|
package/dist/protocol.js
CHANGED
|
@@ -24,8 +24,12 @@ import {
|
|
|
24
24
|
isExposed,
|
|
25
25
|
isMember,
|
|
26
26
|
isPageAccess,
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
roleAsAsked,
|
|
28
|
+
rolesBelow,
|
|
29
|
+
secretPlaceholder,
|
|
30
|
+
signedInAsAsked,
|
|
31
|
+
spaceRoleOf
|
|
32
|
+
} from "./chunks/X7RU6GWG.js";
|
|
29
33
|
export {
|
|
30
34
|
APPS_PATH,
|
|
31
35
|
APP_COMPATIBILITY_DATE,
|
|
@@ -52,5 +56,9 @@ export {
|
|
|
52
56
|
isExposed,
|
|
53
57
|
isMember,
|
|
54
58
|
isPageAccess,
|
|
55
|
-
|
|
59
|
+
roleAsAsked,
|
|
60
|
+
rolesBelow,
|
|
61
|
+
secretPlaceholder,
|
|
62
|
+
signedInAsAsked,
|
|
63
|
+
spaceRoleOf
|
|
56
64
|
};
|
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/JX4PSLSS.js";
|
|
4
|
+
import "./chunks/YKGJK354.js";
|
|
5
5
|
import {
|
|
6
6
|
MethodError
|
|
7
|
-
} from "./chunks/
|
|
7
|
+
} from "./chunks/7LMF3F7Z.js";
|
|
8
8
|
import {
|
|
9
9
|
ERROR_STATUS
|
|
10
|
-
} from "./chunks/
|
|
10
|
+
} from "./chunks/X7RU6GWG.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