@teable/app 7.0.5 → 7.0.7
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/{OXDV76VZ.js → 55YHKIYV.js} +1 -1
- package/dist/chunks/{QHPLAVFD.js → G4M5LS7T.js} +2 -2
- package/dist/chunks/{UDRXJPLD.js → H6R7E3GY.js} +1 -1
- package/dist/chunks/{QNWCYG6K.js → QMWZJWS3.js} +1 -1
- package/dist/chunks/{N6PYNICH.js → ZYCZJSHS.js} +11 -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 +135 -0
- package/dist/protocol.js +9 -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
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
describeTables
|
|
3
|
-
} from "./
|
|
3
|
+
} from "./QMWZJWS3.js";
|
|
4
4
|
import {
|
|
5
5
|
CAPABILITIES,
|
|
6
6
|
PROTOCOL_VERSION,
|
|
7
7
|
admit,
|
|
8
8
|
isPageAccess
|
|
9
|
-
} from "./
|
|
9
|
+
} from "./ZYCZJSHS.js";
|
|
10
10
|
|
|
11
11
|
// src/server/errors.ts
|
|
12
12
|
import { z } from "zod";
|
|
@@ -271,6 +271,13 @@ function fileKeyPath(key) {
|
|
|
271
271
|
var DEPLOY_HEADERS = { commit: "X-Teable-Commit", message: "X-Teable-Message" };
|
|
272
272
|
var DEPLOY_PARTS = { server: "server", worker: "worker", pages: "pages" };
|
|
273
273
|
var PAGES_APP_META = "teable-app";
|
|
274
|
+
var SECRET_FILE_PREFIXES = [".env", ".dev.vars"];
|
|
275
|
+
function isSecretFile(path) {
|
|
276
|
+
const name = path.slice(path.lastIndexOf("/") + 1);
|
|
277
|
+
return SECRET_FILE_PREFIXES.some((prefix) => name.startsWith(prefix));
|
|
278
|
+
}
|
|
279
|
+
var GITHUB_CONFLICT_BRANCH = "teable-sync";
|
|
280
|
+
var GITHUB_CHANNEL = "teable-github";
|
|
274
281
|
var DOMAIN_NAME = /^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/;
|
|
275
282
|
function normalizeDomain(input) {
|
|
276
283
|
return input.trim().toLowerCase().replace(/^https?:\/\//, "").replace(/\/+$/, "").replace(/\.$/, "");
|
|
@@ -363,6 +370,10 @@ export {
|
|
|
363
370
|
DEPLOY_HEADERS,
|
|
364
371
|
DEPLOY_PARTS,
|
|
365
372
|
PAGES_APP_META,
|
|
373
|
+
SECRET_FILE_PREFIXES,
|
|
374
|
+
isSecretFile,
|
|
375
|
+
GITHUB_CONFLICT_BRANCH,
|
|
376
|
+
GITHUB_CHANNEL,
|
|
366
377
|
normalizeDomain,
|
|
367
378
|
isDomainName,
|
|
368
379
|
BADGE_RULES,
|
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/G4M5LS7T.js";
|
|
5
|
+
import "./chunks/QMWZJWS3.js";
|
|
6
|
+
import "./chunks/ZYCZJSHS.js";
|
|
7
7
|
|
|
8
8
|
// src/index.ts
|
|
9
9
|
import { z } from "zod";
|
package/dist/protocol.d.ts
CHANGED
|
@@ -701,6 +701,141 @@ export interface VersionInfo {
|
|
|
701
701
|
/** Whether it is the version that serves the app now. */
|
|
702
702
|
live: boolean;
|
|
703
703
|
}
|
|
704
|
+
/**
|
|
705
|
+
* An app's code is a git repository (ADR 0029): one in Cloudflare
|
|
706
|
+
* Artifacts, named after the app, which the runtime keeps. Those who may
|
|
707
|
+
* publish the app ask for credentials to it with `POST
|
|
708
|
+
* {APPS_PATH}/:appId/git/credentials` and `{ "ops": GitOps }`; git sends the
|
|
709
|
+
* token as `Authorization: Bearer <token>`.
|
|
710
|
+
*/
|
|
711
|
+
export type GitOps = "fetch" | "push";
|
|
712
|
+
export interface GitCredentials {
|
|
713
|
+
/** The repository's HTTPS address. */
|
|
714
|
+
gitUrl: string;
|
|
715
|
+
/** Secret: for git's header only, never stored or shown. */
|
|
716
|
+
token: string;
|
|
717
|
+
/** When the token stops working (ISO 8601). */
|
|
718
|
+
expiresAt: string;
|
|
719
|
+
/** What it allows: fetching, or fetching and pushing. */
|
|
720
|
+
ops: GitOps[];
|
|
721
|
+
}
|
|
722
|
+
/**
|
|
723
|
+
* What the app's repository holds on `main`, as `GET
|
|
724
|
+
* {APPS_PATH}/:appId/code` answers those who may publish the app.
|
|
725
|
+
*/
|
|
726
|
+
export interface AppCode {
|
|
727
|
+
/** `main`'s commit; null while nothing has been pushed. */
|
|
728
|
+
commit: string | null;
|
|
729
|
+
/** Every file but secret files (`isSecretFile`), by path. */
|
|
730
|
+
files: AppCodeFile[];
|
|
731
|
+
}
|
|
732
|
+
export interface AppCodeFile {
|
|
733
|
+
/** From the repository's root, separated by `/`. */
|
|
734
|
+
path: string;
|
|
735
|
+
/** In bytes. */
|
|
736
|
+
size: number;
|
|
737
|
+
/** The file as text; null for a binary file, or one too large to show. */
|
|
738
|
+
content: string | null;
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* Where secrets are kept, by how a file's name starts, anywhere in the tree:
|
|
742
|
+
* env files and wrangler's `.dev.vars`. Their values stay out of an app's
|
|
743
|
+
* repository: the CLI refuses to push one, and its code is never shown with one.
|
|
744
|
+
*/
|
|
745
|
+
export declare const SECRET_FILE_PREFIXES: readonly [".env", ".dev.vars"];
|
|
746
|
+
/** Whether the file at `path` (separated by `/`) is where secrets are kept. */
|
|
747
|
+
export declare function isSecretFile(path: string): boolean;
|
|
748
|
+
/**
|
|
749
|
+
* How an app's GitHub sync stands (ADR 0031): `syncing` while a sync waits
|
|
750
|
+
* or runs; `active` while the repository's branch and the app's `main` hold
|
|
751
|
+
* the same commit; `conflict` while both moved, the app's `main` waiting on
|
|
752
|
+
* the repository's `teable-sync` branch for someone to merge it; `paused`
|
|
753
|
+
* while the GitHub App cannot reach the repository; `error` after a sync
|
|
754
|
+
* failed.
|
|
755
|
+
*/
|
|
756
|
+
export type GithubSyncStatus = "syncing" | "active" | "paused" | "conflict" | "error";
|
|
757
|
+
/**
|
|
758
|
+
* The branch of a linked repository where the app's `main` waits while it
|
|
759
|
+
* and the repository's branch both moved (`conflict`), for someone to merge
|
|
760
|
+
* it on GitHub. GitHub sync forces no other branch.
|
|
761
|
+
*/
|
|
762
|
+
export declare const GITHUB_CONFLICT_BRANCH = "teable-sync";
|
|
763
|
+
/** The GitHub repository an app's code is synced with (ADR 0031). */
|
|
764
|
+
export interface GithubLink {
|
|
765
|
+
/** `owner/name`. */
|
|
766
|
+
repository: string;
|
|
767
|
+
/** Its page on GitHub. */
|
|
768
|
+
url: string;
|
|
769
|
+
/** Its branch that moves with the app's `main`. */
|
|
770
|
+
branch: string;
|
|
771
|
+
status: GithubSyncStatus;
|
|
772
|
+
/** Why it is paused, in conflict or failed, in GitHub's words where they are its; null otherwise. */
|
|
773
|
+
message: string | null;
|
|
774
|
+
/** When both last held the same commit (epoch milliseconds); null before. */
|
|
775
|
+
syncedAt: number | null;
|
|
776
|
+
}
|
|
777
|
+
/**
|
|
778
|
+
* The app's GitHub sync (ADR 0031), as `GET {APPS_PATH}/:appId/github`
|
|
779
|
+
* answers those who may publish the app.
|
|
780
|
+
*/
|
|
781
|
+
export interface AppGithub {
|
|
782
|
+
/** Whether this platform has a GitHub App: without one, nothing links. */
|
|
783
|
+
configured: boolean;
|
|
784
|
+
/** Whether the space's plan includes GitHub sync (Business and above). */
|
|
785
|
+
allowed: boolean;
|
|
786
|
+
link: GithubLink | null;
|
|
787
|
+
/**
|
|
788
|
+
* The GitHub user the person signed in as, through the GitHub App, to
|
|
789
|
+
* link a repository; null before, and once that sign-in ran out (8 hours).
|
|
790
|
+
*/
|
|
791
|
+
user: {
|
|
792
|
+
login: string;
|
|
793
|
+
} | null;
|
|
794
|
+
}
|
|
795
|
+
/**
|
|
796
|
+
* A GitHub account the person may link a repository of: one the GitHub App
|
|
797
|
+
* is installed on that GitHub lets them reach, as `GET
|
|
798
|
+
* {APPS_PATH}/:appId/github/accounts` lists them.
|
|
799
|
+
*/
|
|
800
|
+
export interface GithubAccount {
|
|
801
|
+
installationId: number;
|
|
802
|
+
login: string;
|
|
803
|
+
type: "User" | "Organization";
|
|
804
|
+
avatarUrl: string;
|
|
805
|
+
}
|
|
806
|
+
/**
|
|
807
|
+
* A repository of an account that the person may link (they can push to
|
|
808
|
+
* it), as `GET {APPS_PATH}/:appId/github/accounts/:installationId/repositories`
|
|
809
|
+
* lists them.
|
|
810
|
+
*/
|
|
811
|
+
export interface GithubRepository {
|
|
812
|
+
id: number;
|
|
813
|
+
/** `owner/name`. */
|
|
814
|
+
fullName: string;
|
|
815
|
+
private: boolean;
|
|
816
|
+
}
|
|
817
|
+
/**
|
|
818
|
+
* What `POST {APPS_PATH}/:appId/github/link` links: a new private
|
|
819
|
+
* repository named `name` on the account, or its repository `repositoryId`.
|
|
820
|
+
*/
|
|
821
|
+
export type GithubLinkInput = {
|
|
822
|
+
installationId: number;
|
|
823
|
+
name: string;
|
|
824
|
+
} | {
|
|
825
|
+
installationId: number;
|
|
826
|
+
repositoryId: number;
|
|
827
|
+
};
|
|
828
|
+
/**
|
|
829
|
+
* Where the person signs in to GitHub, or installs the GitHub App on another
|
|
830
|
+
* account (`install`), as `POST {APPS_PATH}/:appId/github/connect` answers:
|
|
831
|
+
* a page to open in a popup, which ends on a page of this origin that posts
|
|
832
|
+
* `{ ok, error }` on the `BroadcastChannel` named `GITHUB_CHANNEL`.
|
|
833
|
+
*/
|
|
834
|
+
export interface GithubConnect {
|
|
835
|
+
url: string;
|
|
836
|
+
}
|
|
837
|
+
/** The `BroadcastChannel` the GitHub sign-in's last page posts its outcome on. */
|
|
838
|
+
export declare const GITHUB_CHANNEL = "teable-github";
|
|
704
839
|
/**
|
|
705
840
|
* A failure of the app's own, as `GET {APPS_PATH}/:appId/failures` lists
|
|
706
841
|
* them for its creators: what broke in it lately, each failure once, with
|
package/dist/protocol.js
CHANGED
|
@@ -12,9 +12,12 @@ import {
|
|
|
12
12
|
ERROR_CODES,
|
|
13
13
|
ERROR_STATUS,
|
|
14
14
|
FILE_NAME_HEADER,
|
|
15
|
+
GITHUB_CHANNEL,
|
|
16
|
+
GITHUB_CONFLICT_BRANCH,
|
|
15
17
|
PAGES_APP_META,
|
|
16
18
|
PREVIEW_QUERY,
|
|
17
19
|
PROTOCOL_VERSION,
|
|
20
|
+
SECRET_FILE_PREFIXES,
|
|
18
21
|
SECRET_NAME,
|
|
19
22
|
SECRET_PLACEHOLDER,
|
|
20
23
|
SESSION_PATH,
|
|
@@ -31,6 +34,7 @@ import {
|
|
|
31
34
|
isExposed,
|
|
32
35
|
isMember,
|
|
33
36
|
isPageAccess,
|
|
37
|
+
isSecretFile,
|
|
34
38
|
normalizeDomain,
|
|
35
39
|
pagesBridge,
|
|
36
40
|
roleAsAsked,
|
|
@@ -38,7 +42,7 @@ import {
|
|
|
38
42
|
secretPlaceholder,
|
|
39
43
|
signedInAsAsked,
|
|
40
44
|
spaceRoleOf
|
|
41
|
-
} from "./chunks/
|
|
45
|
+
} from "./chunks/ZYCZJSHS.js";
|
|
42
46
|
export {
|
|
43
47
|
APPS_PATH,
|
|
44
48
|
APP_COMPATIBILITY_DATE,
|
|
@@ -53,9 +57,12 @@ export {
|
|
|
53
57
|
ERROR_CODES,
|
|
54
58
|
ERROR_STATUS,
|
|
55
59
|
FILE_NAME_HEADER,
|
|
60
|
+
GITHUB_CHANNEL,
|
|
61
|
+
GITHUB_CONFLICT_BRANCH,
|
|
56
62
|
PAGES_APP_META,
|
|
57
63
|
PREVIEW_QUERY,
|
|
58
64
|
PROTOCOL_VERSION,
|
|
65
|
+
SECRET_FILE_PREFIXES,
|
|
59
66
|
SECRET_NAME,
|
|
60
67
|
SECRET_PLACEHOLDER,
|
|
61
68
|
SESSION_PATH,
|
|
@@ -72,6 +79,7 @@ export {
|
|
|
72
79
|
isExposed,
|
|
73
80
|
isMember,
|
|
74
81
|
isPageAccess,
|
|
82
|
+
isSecretFile,
|
|
75
83
|
normalizeDomain,
|
|
76
84
|
pagesBridge,
|
|
77
85
|
roleAsAsked,
|
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/G4M5LS7T.js";
|
|
4
|
+
import "./chunks/QMWZJWS3.js";
|
|
5
5
|
import {
|
|
6
6
|
MethodError
|
|
7
|
-
} from "./chunks/
|
|
7
|
+
} from "./chunks/55YHKIYV.js";
|
|
8
8
|
import {
|
|
9
9
|
ERROR_STATUS
|
|
10
|
-
} from "./chunks/
|
|
10
|
+
} from "./chunks/ZYCZJSHS.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