@teable/app 7.0.6 → 7.0.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 CHANGED
@@ -2,8 +2,8 @@
2
2
  import {
3
3
  buildServer,
4
4
  buildWorker
5
- } from "../chunks/AZZIO5NR.js";
6
- import "../chunks/ZKTI2IGQ.js";
5
+ } from "../chunks/QMKFUKJ4.js";
6
+ import "../chunks/4HDG5ILC.js";
7
7
 
8
8
  // src/build/cli.ts
9
9
  import { mkdirSync, rmSync, writeFileSync } from "node:fs";
@@ -3,8 +3,8 @@ import {
3
3
  buildWorker,
4
4
  sqlAsText,
5
5
  teable
6
- } from "../chunks/AZZIO5NR.js";
7
- import "../chunks/ZKTI2IGQ.js";
6
+ } from "../chunks/QMKFUKJ4.js";
7
+ import "../chunks/4HDG5ILC.js";
8
8
  export {
9
9
  buildServer,
10
10
  buildWorker,
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  describeTables
3
- } from "./YVAP26TZ.js";
3
+ } from "./TKDXT3ZT.js";
4
4
  import {
5
5
  CAPABILITIES,
6
6
  PROTOCOL_VERSION,
7
7
  admit,
8
8
  isPageAccess
9
- } from "./ZKTI2IGQ.js";
9
+ } from "./4HDG5ILC.js";
10
10
 
11
11
  // src/server/errors.ts
12
12
  import { z } from "zod";
@@ -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 MAX_FILE_BYTES = 100 * 1024 * 1024;
266
267
  var PREVIEW_QUERY = "preview";
267
268
  function fileKeyPath(key) {
268
269
  const slash = key.indexOf("/");
@@ -276,6 +277,8 @@ function isSecretFile(path) {
276
277
  const name = path.slice(path.lastIndexOf("/") + 1);
277
278
  return SECRET_FILE_PREFIXES.some((prefix) => name.startsWith(prefix));
278
279
  }
280
+ var GITHUB_CONFLICT_BRANCH = "teable-sync";
281
+ var GITHUB_CHANNEL = "teable-github";
279
282
  var DOMAIN_NAME = /^(?:[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?\.)+[a-z]{2,63}$/;
280
283
  function normalizeDomain(input) {
281
284
  return input.trim().toLowerCase().replace(/^https?:\/\//, "").replace(/\/+$/, "").replace(/\.$/, "");
@@ -363,6 +366,7 @@ export {
363
366
  pagesBridge,
364
367
  APPS_PATH,
365
368
  FILE_NAME_HEADER,
369
+ MAX_FILE_BYTES,
366
370
  PREVIEW_QUERY,
367
371
  fileKeyPath,
368
372
  DEPLOY_HEADERS,
@@ -370,6 +374,8 @@ export {
370
374
  PAGES_APP_META,
371
375
  SECRET_FILE_PREFIXES,
372
376
  isSecretFile,
377
+ GITHUB_CONFLICT_BRANCH,
378
+ GITHUB_CHANNEL,
373
379
  normalizeDomain,
374
380
  isDomainName,
375
381
  BADGE_RULES,
@@ -10,7 +10,7 @@ import {
10
10
  isMember,
11
11
  pagesBridge,
12
12
  spaceRoleOf
13
- } from "./ZKTI2IGQ.js";
13
+ } from "./4HDG5ILC.js";
14
14
 
15
15
  // src/build/index.ts
16
16
  import { existsSync, readFileSync } from "node:fs";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  DEFAULT_CURRENCY,
3
3
  currencyDigits
4
- } from "./ZKTI2IGQ.js";
4
+ } from "./4HDG5ILC.js";
5
5
 
6
6
  // src/schema.ts
7
7
  import { getTableColumns, getTableName, is } from "drizzle-orm";
@@ -5,7 +5,7 @@ import {
5
5
  PREVIEW_QUERY,
6
6
  SESSION_PATH,
7
7
  fileKeyPath
8
- } from "./ZKTI2IGQ.js";
8
+ } from "./4HDG5ILC.js";
9
9
 
10
10
  // src/client.ts
11
11
  var MethodError = class extends Error {
package/dist/client.js CHANGED
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  MethodError,
3
3
  createClient
4
- } from "./chunks/KWMJ6RAV.js";
5
- import "./chunks/ZKTI2IGQ.js";
4
+ } from "./chunks/ZQI6BF6U.js";
5
+ import "./chunks/4HDG5ILC.js";
6
6
  export {
7
7
  MethodError,
8
8
  createClient
package/dist/dev/host.js CHANGED
@@ -10,7 +10,7 @@ import {
10
10
  callableMethods,
11
11
  checkAccess,
12
12
  isMember
13
- } from "../chunks/ZKTI2IGQ.js";
13
+ } from "../chunks/4HDG5ILC.js";
14
14
 
15
15
  // src/dev/host.ts
16
16
  import { DurableObject, WorkerEntrypoint } from "cloudflare:workers";
package/dist/index.js CHANGED
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  createApp,
3
3
  fail
4
- } from "./chunks/OTMVSMPE.js";
5
- import "./chunks/YVAP26TZ.js";
6
- import "./chunks/ZKTI2IGQ.js";
4
+ } from "./chunks/2W5UWORA.js";
5
+ import "./chunks/TKDXT3ZT.js";
6
+ import "./chunks/4HDG5ILC.js";
7
7
 
8
8
  // src/index.ts
9
9
  import { z } from "zod";
@@ -589,6 +589,26 @@ export type RealtimeMessage = {
589
589
  export declare const APPS_PATH = "/api/v4/apps";
590
590
  /** The header that names an uploaded file (URI-encoded); the body is its bytes. */
591
591
  export declare const FILE_NAME_HEADER = "X-File-Name";
592
+ /** At most this many bytes a file of an app (100 MiB), however it is stored: uploaded, or by a task. */
593
+ export declare const MAX_FILE_BYTES: number;
594
+ /**
595
+ * An app's files, for those who may publish it (ADR 0010): `GET
596
+ * {APPS_PATH}/:appId/files` lists a page of them, a thousand at most
597
+ * (`?limit=` asks for fewer), and the next page after `?cursor=`, the one
598
+ * the last page gave. `DELETE {APPS_PATH}/:appId/files/:id/:name` deletes
599
+ * one: nothing opens it after, the app's rows and its public links
600
+ * included. The preview and the live version share them (ADR 0022).
601
+ */
602
+ export interface AppFiles {
603
+ /** In the order they are stored in, by key, which is no order people know: sort them to show them. */
604
+ files: AppFile[];
605
+ /** Where the next page starts; null after the last. */
606
+ cursor: string | null;
607
+ }
608
+ /** A file of an app: what its rows keep of it, and when it was uploaded (epoch milliseconds). */
609
+ export interface AppFile extends Attachment {
610
+ uploadedAt: number;
611
+ }
592
612
  /**
593
613
  * The query parameter, set to `1`, by which a request on the platform's
594
614
  * hosts names the app's preview (ADR 0022): the builder's views call it so,
@@ -745,6 +765,97 @@ export interface AppCodeFile {
745
765
  export declare const SECRET_FILE_PREFIXES: readonly [".env", ".dev.vars"];
746
766
  /** Whether the file at `path` (separated by `/`) is where secrets are kept. */
747
767
  export declare function isSecretFile(path: string): boolean;
768
+ /**
769
+ * How an app's GitHub sync stands (ADR 0031): `syncing` while a sync waits
770
+ * or runs; `active` while the repository's branch and the app's `main` hold
771
+ * the same commit; `conflict` while both moved, the app's `main` waiting on
772
+ * the repository's `teable-sync` branch for someone to merge it; `paused`
773
+ * while the GitHub App cannot reach the repository; `error` after a sync
774
+ * failed.
775
+ */
776
+ export type GithubSyncStatus = "syncing" | "active" | "paused" | "conflict" | "error";
777
+ /**
778
+ * The branch of a linked repository where the app's `main` waits while it
779
+ * and the repository's branch both moved (`conflict`), for someone to merge
780
+ * it on GitHub. GitHub sync forces no other branch.
781
+ */
782
+ export declare const GITHUB_CONFLICT_BRANCH = "teable-sync";
783
+ /** The GitHub repository an app's code is synced with (ADR 0031). */
784
+ export interface GithubLink {
785
+ /** `owner/name`. */
786
+ repository: string;
787
+ /** Its page on GitHub. */
788
+ url: string;
789
+ /** Its branch that moves with the app's `main`. */
790
+ branch: string;
791
+ status: GithubSyncStatus;
792
+ /** Why it is paused, in conflict or failed, in GitHub's words where they are its; null otherwise. */
793
+ message: string | null;
794
+ /** When both last held the same commit (epoch milliseconds); null before. */
795
+ syncedAt: number | null;
796
+ }
797
+ /**
798
+ * The app's GitHub sync (ADR 0031), as `GET {APPS_PATH}/:appId/github`
799
+ * answers those who may publish the app.
800
+ */
801
+ export interface AppGithub {
802
+ /** Whether this platform has a GitHub App: without one, nothing links. */
803
+ configured: boolean;
804
+ /** Whether the space's plan includes GitHub sync (Business and above). */
805
+ allowed: boolean;
806
+ link: GithubLink | null;
807
+ /**
808
+ * The GitHub user the person signed in as, through the GitHub App, to
809
+ * link a repository; null before, and once that sign-in ran out (8 hours).
810
+ */
811
+ user: {
812
+ login: string;
813
+ } | null;
814
+ }
815
+ /**
816
+ * A GitHub account the person may link a repository of: one the GitHub App
817
+ * is installed on that GitHub lets them reach, as `GET
818
+ * {APPS_PATH}/:appId/github/accounts` lists them.
819
+ */
820
+ export interface GithubAccount {
821
+ installationId: number;
822
+ login: string;
823
+ type: "User" | "Organization";
824
+ avatarUrl: string;
825
+ }
826
+ /**
827
+ * A repository of an account that the person may link (they can push to
828
+ * it), as `GET {APPS_PATH}/:appId/github/accounts/:installationId/repositories`
829
+ * lists them.
830
+ */
831
+ export interface GithubRepository {
832
+ id: number;
833
+ /** `owner/name`. */
834
+ fullName: string;
835
+ private: boolean;
836
+ }
837
+ /**
838
+ * What `POST {APPS_PATH}/:appId/github/link` links: a new private
839
+ * repository named `name` on the account, or its repository `repositoryId`.
840
+ */
841
+ export type GithubLinkInput = {
842
+ installationId: number;
843
+ name: string;
844
+ } | {
845
+ installationId: number;
846
+ repositoryId: number;
847
+ };
848
+ /**
849
+ * Where the person signs in to GitHub, or installs the GitHub App on another
850
+ * account (`install`), as `POST {APPS_PATH}/:appId/github/connect` answers:
851
+ * a page to open in a popup, which ends on a page of this origin that posts
852
+ * `{ ok, error }` on the `BroadcastChannel` named `GITHUB_CHANNEL`.
853
+ */
854
+ export interface GithubConnect {
855
+ url: string;
856
+ }
857
+ /** The `BroadcastChannel` the GitHub sign-in's last page posts its outcome on. */
858
+ export declare const GITHUB_CHANNEL = "teable-github";
748
859
  /**
749
860
  * A failure of the app's own, as `GET {APPS_PATH}/:appId/failures` lists
750
861
  * them for its creators: what broke in it lately, each failure once, with
package/dist/protocol.js CHANGED
@@ -12,6 +12,9 @@ import {
12
12
  ERROR_CODES,
13
13
  ERROR_STATUS,
14
14
  FILE_NAME_HEADER,
15
+ GITHUB_CHANNEL,
16
+ GITHUB_CONFLICT_BRANCH,
17
+ MAX_FILE_BYTES,
15
18
  PAGES_APP_META,
16
19
  PREVIEW_QUERY,
17
20
  PROTOCOL_VERSION,
@@ -40,7 +43,7 @@ import {
40
43
  secretPlaceholder,
41
44
  signedInAsAsked,
42
45
  spaceRoleOf
43
- } from "./chunks/ZKTI2IGQ.js";
46
+ } from "./chunks/4HDG5ILC.js";
44
47
  export {
45
48
  APPS_PATH,
46
49
  APP_COMPATIBILITY_DATE,
@@ -55,6 +58,9 @@ export {
55
58
  ERROR_CODES,
56
59
  ERROR_STATUS,
57
60
  FILE_NAME_HEADER,
61
+ GITHUB_CHANNEL,
62
+ GITHUB_CONFLICT_BRANCH,
63
+ MAX_FILE_BYTES,
58
64
  PAGES_APP_META,
59
65
  PREVIEW_QUERY,
60
66
  PROTOCOL_VERSION,
package/dist/schema.js CHANGED
@@ -3,8 +3,8 @@ import {
3
3
  col,
4
4
  describeTables,
5
5
  schemaOf
6
- } from "./chunks/YVAP26TZ.js";
7
- import "./chunks/ZKTI2IGQ.js";
6
+ } from "./chunks/TKDXT3ZT.js";
7
+ import "./chunks/4HDG5ILC.js";
8
8
  export {
9
9
  attachment,
10
10
  col,
package/dist/testing.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  methodName
3
- } from "./chunks/OTMVSMPE.js";
4
- import "./chunks/YVAP26TZ.js";
3
+ } from "./chunks/2W5UWORA.js";
4
+ import "./chunks/TKDXT3ZT.js";
5
5
  import {
6
6
  MethodError
7
- } from "./chunks/KWMJ6RAV.js";
7
+ } from "./chunks/ZQI6BF6U.js";
8
8
  import {
9
9
  ERROR_STATUS
10
- } from "./chunks/ZKTI2IGQ.js";
10
+ } from "./chunks/4HDG5ILC.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
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  MethodError
3
- } from "./chunks/KWMJ6RAV.js";
3
+ } from "./chunks/ZQI6BF6U.js";
4
4
  import {
5
5
  ERROR_STATUS
6
- } from "./chunks/ZKTI2IGQ.js";
6
+ } from "./chunks/4HDG5ILC.js";
7
7
 
8
8
  // src/worker.ts
9
9
  function thrower(caller) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teable/app",
3
- "version": "7.0.6",
3
+ "version": "7.0.8",
4
4
  "description": "Write a Teable app as a Drizzle schema plus methods",
5
5
  "license": "MIT",
6
6
  "repository": {