@teable/next-cli 1.0.0 → 1.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/README.md CHANGED
@@ -22,17 +22,25 @@ runs the app's own `bun run check` and `bun run build`, so it needs
22
22
  | `clone <projectId> [dir]` | Checks out the project's app |
23
23
  | `pull` | Fast-forwards the checkout to the app's repository |
24
24
  | `push [-m "<what changed>"]` | Commits (with `-m`) and pushes; deploys nothing |
25
- | `publish` | Runs the app's check and build, then deploys the pushed commit as its next version |
25
+ | `publish` | Runs the app's check and build, then deploys the pushed commit, its pages too, as its next version |
26
26
  | `versions` | The published versions, newest first: when, by whom, from which commit |
27
27
  | `rollback --version <n>` | Deploys version `n`'s code again, as the next version |
28
+ | `rename "<name>"` | Names the project, as its space lists it |
28
29
  | `whoami` | Who the token belongs to |
29
30
  | `login --token <token>` | Saves the token for later commands |
30
31
 
31
32
  Inside a checkout (a directory holding `teable.json`, or below one) commands
32
- take the project from `teable.json`; outside one, `versions` and `rollback`
33
- take `--project <projectId>`. Every command prints one JSON result on stdout
34
- and exits with 1 when it fails; what the programs it runs print goes to
35
- stderr. Nothing is ever asked for. `teable-next <command> --help` says more.
33
+ take the project from `teable.json`; outside one, `versions`, `rollback` and
34
+ `rename` take `--project <projectId>`. Every command prints one JSON result
35
+ on stdout and exits with 1 when it fails, with `success: false` and why in
36
+ `error`; a `clone` that finds no code in the project's repository also says
37
+ `"code": "NO_CODE"`: start that app with `init`. What the programs a command
38
+ runs print goes to stderr. Nothing is ever asked for. `teable-next <command>
39
+ --help` says more.
40
+
41
+ A new project has no name until someone names it: `init`, `clone` and
42
+ `publish` print its name as `projectName`, null until then. Once you know
43
+ what the app is, `teable-next rename "<name>"` names the project after it.
36
44
 
37
45
  ## Signing in
38
46
 
@@ -45,4 +53,5 @@ give it your projects with base read and update. Teable is
45
53
  says otherwise; `TEABLE_NEXT_ENDPOINT` says where teable-next itself is
46
54
  served (its runtime's API and the builder), when that is another address.
47
55
 
48
- Publishing takes the creator or owner role in the project's space.
56
+ Publishing and renaming take the creator or owner role in the project's
57
+ space.
package/dist/cli.js CHANGED
@@ -329,6 +329,9 @@ function field(answer, name, what) {
329
329
  return value;
330
330
  }
331
331
  var projectPath = (projectId) => `/base/${encodeURIComponent(projectId)}`;
332
+ function nameOf(project) {
333
+ return typeof project.name === "string" && project.name.trim() !== "" ? project.name : null;
334
+ }
332
335
  async function currentUser(teable) {
333
336
  const user = await request(teable, "GET", "/auth/user");
334
337
  return {
@@ -339,14 +342,18 @@ async function currentUser(teable) {
339
342
  }
340
343
  async function teableNextProject(teable, projectId) {
341
344
  const project = await request(teable, "GET", projectPath(projectId));
342
- const name = typeof project.name === "string" ? project.name : "";
345
+ const name = nameOf(project);
343
346
  if (project.runtime !== "next") {
344
347
  throw new CommandError(
345
- `Project ${projectId}${name ? ` ("${name}")` : ""} does not run in teable-next, so it has no app of its own: it is a classic Teable project, and its apps are App Builder apps, which the \`teable\` CLI works on (\`teable app --help\`).`
348
+ `Project ${projectId}${name === null ? "" : ` ("${name}")`} does not run in teable-next, so it has no app of its own: it is a classic Teable project, and its apps are App Builder apps, which the \`teable\` CLI works on (\`teable app --help\`).`
346
349
  );
347
350
  }
348
351
  return { id: projectId, name };
349
352
  }
353
+ async function renameProject(teable, projectId, name) {
354
+ const project = await request(teable, "PATCH", projectPath(projectId), { name });
355
+ return { id: projectId, name: nameOf(project) };
356
+ }
350
357
  async function identityToken(teable, projectId) {
351
358
  const answer = await request(teable, "POST", `${projectPath(projectId)}/teable-next/identity`, {
352
359
  delivery: "token"
@@ -526,14 +533,16 @@ function saveLogin(login) {
526
533
  }
527
534
 
528
535
  // src/publish.ts
529
- import { existsSync as existsSync3, readFileSync as readFileSync3 } from "node:fs";
530
- import { join as join3 } from "node:path";
536
+ import { createHash } from "node:crypto";
537
+ import { existsSync as existsSync3, readdirSync as readdirSync2, readFileSync as readFileSync3, statSync as statSync2 } from "node:fs";
538
+ import { join as join3, relative, sep } from "node:path";
531
539
 
532
540
  // ../app/src/protocol.ts
533
541
  var EVERY_CAPABILITY = { files: true, http: true };
534
542
  var CAPABILITIES = Object.keys(EVERY_CAPABILITY);
535
543
  var APPS_PATH = "/api/v4/apps";
536
544
  var DEPLOY_HEADERS = { commit: "X-Teable-Commit", message: "X-Teable-Message" };
545
+ var DEPLOY_PARTS = { server: "server", worker: "worker", pages: "pages" };
537
546
 
538
547
  // src/runtime.ts
539
548
  var DEPLOY_TIMEOUT_MS = 10 * 6e4;
@@ -549,8 +558,18 @@ function appUrls(teable, appId) {
549
558
  mcp: `${api}/mcp`
550
559
  };
551
560
  }
561
+ var identities = /* @__PURE__ */ new Map();
562
+ function identityFor(teable, appId) {
563
+ let identity = identities.get(appId);
564
+ if (identity === void 0) {
565
+ identity = identityToken(teable, appId);
566
+ identities.set(appId, identity);
567
+ identity.catch(() => identities.delete(appId));
568
+ }
569
+ return identity;
570
+ }
552
571
  async function callRuntime(teable, appId, path, init2) {
553
- const identity = await identityToken(teable, appId);
572
+ const identity = await identityFor(teable, appId);
554
573
  const url = `${appUrls(teable, appId).api}${path}`;
555
574
  let response;
556
575
  try {
@@ -603,18 +622,57 @@ function summary(manifest) {
603
622
  ...manifest.capabilities?.length ? { capabilities: manifest.capabilities } : {}
604
623
  };
605
624
  }
606
- async function deploy(teable, appId, bundle, built) {
625
+ async function missingPages(teable, appId, files) {
626
+ const answer = await callRuntime(teable, appId, "/pages", {
627
+ method: "POST",
628
+ headers: { "Content-Type": "application/json" },
629
+ body: JSON.stringify({ files })
630
+ });
631
+ if (!Array.isArray(answer.missing)) {
632
+ throw new CommandError(
633
+ `The runtime did not say which pages it lacks: ${JSON.stringify(answer).slice(0, 300)}`
634
+ );
635
+ }
636
+ return answer.missing;
637
+ }
638
+ async function uploadPages(teable, appId, files) {
639
+ const form = new FormData();
640
+ for (const { sha256, bytes } of files) form.append(sha256, new Blob([bytes]), sha256);
641
+ await callRuntime(teable, appId, "/pages/files", {
642
+ method: "POST",
643
+ body: form,
644
+ timeoutMs: DEPLOY_TIMEOUT_MS
645
+ });
646
+ }
647
+ async function deploy(teable, appId, bundle, built, pages) {
648
+ const commit = {
649
+ [DEPLOY_HEADERS.commit]: built.commit,
650
+ [DEPLOY_HEADERS.message]: encodeURIComponent(built.message)
651
+ };
652
+ let body = bundle;
653
+ if (pages) {
654
+ body = new FormData();
655
+ body.append(DEPLOY_PARTS.server, new Blob([bundle], { type: "text/javascript" }), "server.js");
656
+ if (pages.worker !== null) {
657
+ body.append(
658
+ DEPLOY_PARTS.worker,
659
+ new Blob([pages.worker], { type: "text/javascript" }),
660
+ "worker.js"
661
+ );
662
+ }
663
+ body.append(DEPLOY_PARTS.pages, JSON.stringify({ files: pages.files }));
664
+ }
607
665
  const answer = await callRuntime(teable, appId, "/versions", {
608
666
  method: "POST",
609
- headers: {
610
- "Content-Type": "application/javascript",
611
- [DEPLOY_HEADERS.commit]: built.commit,
612
- [DEPLOY_HEADERS.message]: encodeURIComponent(built.message)
613
- },
614
- body: bundle,
667
+ headers: pages ? commit : { "Content-Type": "application/javascript", ...commit },
668
+ body,
615
669
  timeoutMs: DEPLOY_TIMEOUT_MS
616
670
  });
617
- return { version: versionIn(answer, "version"), manifest: summary(answer.manifest) };
671
+ return {
672
+ version: versionIn(answer, "version"),
673
+ manifest: summary(answer.manifest),
674
+ pagesUrl: typeof answer.pagesUrl === "string" ? answer.pagesUrl : null
675
+ };
618
676
  }
619
677
  async function listVersions(teable, appId) {
620
678
  const answer = await callRuntime(teable, appId, "/versions", { method: "GET" });
@@ -641,6 +699,46 @@ async function rollback(teable, appId, to) {
641
699
 
642
700
  // src/publish.ts
643
701
  var SERVER_BUNDLE = "dist/server.js";
702
+ var WORKER_BUNDLE = "dist/worker.js";
703
+ var PAGES_DIR = "dist/pages";
704
+ var UPLOAD_BATCH_BYTES = 10 * 1024 * 1024;
705
+ var UPLOAD_BATCH_FILES = 100;
706
+ function readPages(root) {
707
+ const dir = join3(root, PAGES_DIR);
708
+ if (!existsSync3(dir)) return null;
709
+ const pages = /* @__PURE__ */ new Map();
710
+ const walk = (at) => {
711
+ for (const entry of readdirSync2(at).sort()) {
712
+ const path = join3(at, entry);
713
+ if (statSync2(path).isDirectory()) walk(path);
714
+ else if (entry !== ".DS_Store") {
715
+ const bytes = new Uint8Array(readFileSync3(path));
716
+ const sha256 = createHash("sha256").update(bytes).digest("hex");
717
+ pages.set(`/${relative(dir, path).split(sep).join("/")}`, { sha256, bytes });
718
+ }
719
+ }
720
+ };
721
+ walk(dir);
722
+ return pages;
723
+ }
724
+ async function uploadMissing(teable, appId, pages, files) {
725
+ const missing = new Set(await missingPages(teable, appId, files));
726
+ const unique = new Map([...pages.values()].map((file) => [file.sha256, file]));
727
+ const queue = [...missing].flatMap((sha256) => unique.get(sha256) ?? []);
728
+ for (let start = 0; start < queue.length; ) {
729
+ const batch = [];
730
+ let bytes = 0;
731
+ for (const file of queue.slice(start)) {
732
+ if (batch.length > 0 && (bytes + file.bytes.byteLength > UPLOAD_BATCH_BYTES || batch.length >= UPLOAD_BATCH_FILES))
733
+ break;
734
+ batch.push(file);
735
+ bytes += file.bytes.byteLength;
736
+ }
737
+ await uploadPages(teable, appId, batch);
738
+ start += batch.length;
739
+ }
740
+ return queue.length;
741
+ }
644
742
  var MESSAGE_MAX_CHARS = 500;
645
743
  async function unpushedReason(root, local, remote) {
646
744
  if (remote === null) return "Nothing is pushed yet: run `teable-next push`, then publish.";
@@ -697,15 +795,33 @@ async function publish(teable, cwd) {
697
795
  stop({ step: "git" })
698
796
  );
699
797
  }
798
+ const project = await teableNextProject(teable, appId);
700
799
  const remote = await fetchMain(root, await checkoutCredentials(root, appId, teable, "fetch"));
701
800
  if (remote !== commit) {
702
801
  throw new CommandError(await unpushedReason(root, commit, remote), stop({ step: "git" }));
703
802
  }
704
803
  const bundle = await checkAndBuild(root, stop);
705
804
  const subject = (await subjectOf(root, commit)).slice(0, MESSAGE_MAX_CHARS);
805
+ const pages = readPages(root);
806
+ const worker = existsSync3(join3(root, WORKER_BUNDLE)) ? readFileSync3(join3(root, WORKER_BUNDLE), "utf8") : null;
706
807
  let deployed;
808
+ let uploaded = 0;
707
809
  try {
708
- deployed = await deploy(teable, appId, bundle, { commit, message: subject });
810
+ if (pages === null) {
811
+ deployed = await deploy(teable, appId, bundle, { commit, message: subject });
812
+ } else {
813
+ const files = Object.fromEntries(
814
+ [...pages].map(([path, { sha256, bytes }]) => [path, { sha256, size: bytes.byteLength }])
815
+ );
816
+ uploaded = await uploadMissing(teable, appId, pages, files);
817
+ deployed = await deploy(
818
+ teable,
819
+ appId,
820
+ bundle,
821
+ { commit, message: subject },
822
+ { worker, files }
823
+ );
824
+ }
709
825
  } catch (error) {
710
826
  if (error instanceof CommandError) {
711
827
  throw new CommandError(
@@ -715,16 +831,20 @@ async function publish(teable, cwd) {
715
831
  }
716
832
  throw error;
717
833
  }
834
+ const where = deployed.pagesUrl ? ` Its pages are at ${deployed.pagesUrl}.` : "";
835
+ const unnamed = project.name === null ? ` The project has no name yet: name it after the app, in the user's language, with \`teable-next rename "<name>"\`.` : "";
718
836
  return {
719
837
  success: true,
720
838
  appId,
839
+ projectName: project.name,
721
840
  dir: root,
722
841
  version: deployed.version,
723
842
  commitSha: commit,
724
843
  commitMessage: subject,
725
- urls: appUrls(teable, appId),
844
+ urls: { ...appUrls(teable, appId), pages: deployed.pagesUrl },
845
+ ...pages && { pages: { files: pages.size, uploaded, worker: worker !== null } },
726
846
  ...deployed.manifest && { deployed: deployed.manifest },
727
- message: `Version ${deployed.version} of ${appId} is live, built from ${commit.slice(0, 8)} ("${subject}").`
847
+ message: `Version ${deployed.version} of ${appId} is live, built from ${commit.slice(0, 8)} ("${subject}").${where}${unnamed}`
728
848
  };
729
849
  }
730
850
  async function versions(teable, appId, limit) {
@@ -753,11 +873,11 @@ async function rollBack(teable, appId, to) {
753
873
  }
754
874
 
755
875
  // src/repository.ts
756
- import { existsSync as existsSync4, mkdirSync as mkdirSync3, statSync as statSync2 } from "node:fs";
757
- import { dirname as dirname4, join as join4, relative, resolve as resolve2 } from "node:path";
876
+ import { existsSync as existsSync4, mkdirSync as mkdirSync3, statSync as statSync3 } from "node:fs";
877
+ import { dirname as dirname4, join as join4, relative as relative2, resolve as resolve2 } from "node:path";
758
878
  var DEFAULT_CREATE_APP_VERSION = "latest";
759
879
  function shellPath(path) {
760
- const where = relative(process.cwd(), path) || ".";
880
+ const where = relative2(process.cwd(), path) || ".";
761
881
  return /^[\w@%+=:,./-]+$/.test(where) ? where : `'${where.replaceAll("'", "'\\''")}'`;
762
882
  }
763
883
  function workflow(root, pull2) {
@@ -772,7 +892,7 @@ function workflow(root, pull2) {
772
892
  ];
773
893
  }
774
894
  function directoryFor(name, projectId) {
775
- const slug = name.trim().replace(/[\\/:*?"<>|\s]+/g, "-").replace(/^[-.]+|-+$/g, "").toLowerCase();
895
+ const slug = (name ?? "").trim().replace(/[\\/:*?"<>|\s]+/g, "-").replace(/^[-.]+|-+$/g, "").toLowerCase();
776
896
  return slug || projectId;
777
897
  }
778
898
  var NO_GIT_IDENTITY = /Please tell me who you are|empty ident|unable to auto-detect email|no email was given/i;
@@ -822,7 +942,7 @@ async function init(teable, input) {
822
942
  const appId = project.id;
823
943
  const root = resolve2(input.dir);
824
944
  const version2 = input.createAppVersion;
825
- if (existsSync4(root) && !statSync2(root).isDirectory()) {
945
+ if (existsSync4(root) && !statSync3(root).isDirectory()) {
826
946
  throw new CommandError(`${root} is a file: name an empty or new directory.`);
827
947
  }
828
948
  const earlier = appIdIn(root);
@@ -856,7 +976,7 @@ async function init(teable, input) {
856
976
  return {
857
977
  success: true,
858
978
  appId,
859
- appName: project.name,
979
+ projectName: project.name,
860
980
  dir: root,
861
981
  commitSha,
862
982
  createApp: `@teable/create-app@${version2}`,
@@ -881,7 +1001,8 @@ async function clone(teable, input) {
881
1001
  } catch (error) {
882
1002
  if (/Remote branch \S+ not found|empty repository/i.test(messageOf(error))) {
883
1003
  throw new CommandError(
884
- `The project has no code yet. Start it with \`teable-next init <dir> --project ${appId}\`.`
1004
+ `The project has no code yet. Start it with \`teable-next init <dir> --project ${appId}\`.`,
1005
+ { code: "NO_CODE" }
885
1006
  );
886
1007
  }
887
1008
  throw error;
@@ -896,7 +1017,7 @@ async function clone(teable, input) {
896
1017
  return {
897
1018
  success: true,
898
1019
  appId,
899
- appName: project.name,
1020
+ projectName: project.name,
900
1021
  dir: root,
901
1022
  commitSha,
902
1023
  nextSteps: workflow(root, true),
@@ -1035,7 +1156,8 @@ it goes on from the scaffold. A project whose repository has code is cloned inst
1035
1156
  usage: "clone <projectId> [dir]",
1036
1157
  summary: "Check out the project's app",
1037
1158
  details: `Clones the project's repository into [dir] (default: a new directory named after the project),
1038
- its remote named \`teable\`. The repository is the whole app.`,
1159
+ its remote named \`teable\`. The repository is the whole app. A project with no code yet fails with
1160
+ code NO_CODE: start its app with \`teable-next init\`.`,
1039
1161
  options: {},
1040
1162
  optionHelp: [],
1041
1163
  takes: [1, 2],
@@ -1068,11 +1190,14 @@ pushed since your last pull. Nothing is deployed: \`teable-next publish\` deploy
1068
1190
  details: `In a checkout: deploys the pushed commit as the app's next version, as you.
1069
1191
  1. The checkout must be clean, its HEAD pushed to the app repository's main (\`teable-next push\`).
1070
1192
  2. Runs \`bun run check\`, then \`bun run build\`; their output goes to stderr.
1071
- 3. Uploads dist/server.js to the runtime with the commit's id and subject. The runtime runs the
1072
- version's migrations on a copy of the live data, then on the live data, and makes it live only
1073
- if both work.
1074
- Prints the version and the app's URLs (builder, API, OpenAPI, MCP). Publish each change once it is
1075
- checked: no approval is needed. Publishing takes the creator or owner role in the project's space.
1193
+ 3. Uploads the pages' files the runtime lacks (dist/pages), then deploys dist/server.js with the
1194
+ pages and the app's own Worker (dist/worker.js, if any), with the commit's id and subject. The
1195
+ runtime runs the version's migrations on a copy of the live data, then on the live data, and
1196
+ makes it live, with its pages, only if both work.
1197
+ Prints the version, the project's name (null until someone names it) and the app's URLs (its pages
1198
+ at its own host, builder, API, OpenAPI, MCP).
1199
+ Publish each change once it is checked: no approval is needed. Publishing takes the creator or
1200
+ owner role in the project's space.
1076
1201
  TEABLE_NEXT_ENDPOINT points it at another runtime (a local one); by default the runtime is under
1077
1202
  Teable's own address.`,
1078
1203
  options: {},
@@ -1112,6 +1237,25 @@ app repository is unchanged: fix or revert the code there before the next publis
1112
1237
  return rollBack(teable, await appOf(teable, values), to);
1113
1238
  }
1114
1239
  },
1240
+ rename: {
1241
+ usage: 'rename "<name>" [--project <projectId>]',
1242
+ summary: "Name the project, as its space lists it",
1243
+ details: `Names the project (the app) on Teable: the name its space lists and the builder shows. A project
1244
+ nobody named has none: init, clone and publish print its projectName as null. Once you know what
1245
+ the app is, name it after the app, in the user's language; rename a project that has a name only
1246
+ when asked to. The name is trimmed, and cannot be empty. Prints the name Teable kept. Renaming
1247
+ takes the creator or owner role in the project's space.`,
1248
+ options: { project: { type: "string" } },
1249
+ optionHelp: [PROJECT_OPTION],
1250
+ takes: [1, 1],
1251
+ run: async (values, [given = ""]) => {
1252
+ const name = given.trim();
1253
+ if (name === "") throw new CommandError('rename needs a name: teable-next rename "<name>".');
1254
+ const teable = teableOf(values);
1255
+ const project = await renameProject(teable, await appOf(teable, values), name);
1256
+ return { success: true, project };
1257
+ }
1258
+ },
1115
1259
  whoami: {
1116
1260
  usage: "whoami",
1117
1261
  summary: "Who your token belongs to",
@@ -5,6 +5,8 @@
5
5
  *
6
6
  * - `GET /api/auth/user`: who the token belongs to.
7
7
  * - `GET /api/base/:projectId`: the project; `runtime: "next"` when it runs in teable-next.
8
+ * - `PATCH /api/base/:projectId` with `{"name"}`: names the project, for its space's
9
+ * owners and creators (`base|update`); answers the name it keeps.
8
10
  * - `POST /api/base/:projectId/teable-next/identity` with `{"delivery":"token"}`:
9
11
  * a 15-minute identity token for the runtime, good for every app of the project's space.
10
12
  * - `POST /api/base/:projectId/teable-next/git/credentials` with `{"ops":"fetch"|"push"}`:
@@ -25,7 +27,15 @@ export declare function currentUser(teable: Teable): Promise<{
25
27
  */
26
28
  export declare function teableNextProject(teable: Teable, projectId: string): Promise<{
27
29
  id: string;
28
- name: string;
30
+ name: string | null;
31
+ }>;
32
+ /**
33
+ * Name the project: the name its space lists and the builder shows. Its
34
+ * space's owners and creators may; the platform refuses anyone else.
35
+ */
36
+ export declare function renameProject(teable: Teable, projectId: string, name: string): Promise<{
37
+ id: string;
38
+ name: string | null;
29
39
  }>;
30
40
  /** A 15-minute identity token for the runtime, for the space of the project. */
31
41
  export declare function identityToken(teable: Teable, projectId: string): Promise<string>;
package/dist/publish.d.ts CHANGED
@@ -9,6 +9,7 @@ import type { Teable } from "./config.js";
9
9
  export declare function publish(teable: Teable, cwd: string): Promise<{
10
10
  success: boolean;
11
11
  appId: string;
12
+ projectName: string | null;
12
13
  dir: string;
13
14
  version: number;
14
15
  commitSha: string;
@@ -18,7 +19,13 @@ export declare function publish(teable: Teable, cwd: string): Promise<{
18
19
  api: string;
19
20
  openapi: string;
20
21
  mcp: string;
22
+ pages: string | null;
21
23
  };
24
+ pages?: {
25
+ files: number;
26
+ uploaded: number;
27
+ worker: boolean;
28
+ } | undefined;
22
29
  deployed?: {
23
30
  protocol: number;
24
31
  methods: {
@@ -15,7 +15,7 @@ export declare function init(teable: Teable, input: {
15
15
  }): Promise<{
16
16
  success: boolean;
17
17
  appId: string;
18
- appName: string;
18
+ projectName: string | null;
19
19
  dir: string;
20
20
  commitSha: string;
21
21
  createApp: string;
@@ -29,7 +29,7 @@ export declare function clone(teable: Teable, input: {
29
29
  }): Promise<{
30
30
  success: boolean;
31
31
  appId: string;
32
- appName: string;
32
+ projectName: string | null;
33
33
  dir: string;
34
34
  commitSha: string;
35
35
  nextSteps: string[];
package/dist/runtime.d.ts CHANGED
@@ -3,7 +3,7 @@
3
3
  * token, which the old platform issues: the creators and owners of the
4
4
  * project's space deploy its app, list its versions and roll it back.
5
5
  */
6
- import { type VersionInfo } from "@teable/app/protocol";
6
+ import { type PageFiles, type VersionInfo } from "@teable/app/protocol";
7
7
  import type { Teable } from "./config.js";
8
8
  /** Where an app is found: its builder, and its API, OpenAPI and MCP on the runtime. */
9
9
  export declare function appUrls(teable: Teable, appId: string): {
@@ -12,13 +12,24 @@ export declare function appUrls(teable: Teable, appId: string): {
12
12
  openapi: string;
13
13
  mcp: string;
14
14
  };
15
+ /** The pages' files the runtime lacks, by SHA-256 (ADR 0014). */
16
+ export declare function missingPages(teable: Teable, appId: string, files: PageFiles): Promise<string[]>;
17
+ /** Upload some of the pages' files, each named by its SHA-256. */
18
+ export declare function uploadPages(teable: Teable, appId: string, files: {
19
+ sha256: string;
20
+ bytes: Uint8Array<ArrayBuffer>;
21
+ }[]): Promise<void>;
15
22
  /**
16
23
  * Deploy a server bundle as the app's next version, naming the commit it was
17
- * built from. The runtime answers once the version is live.
24
+ * built from, with its pages (the app's Worker, if it has one, and the files
25
+ * already uploaded) or without. The runtime answers once the version is live.
18
26
  */
19
27
  export declare function deploy(teable: Teable, appId: string, bundle: string, built: {
20
28
  commit: string;
21
29
  message: string;
30
+ }, pages?: {
31
+ worker: string | null;
32
+ files: PageFiles;
22
33
  }): Promise<{
23
34
  version: number;
24
35
  manifest: {
@@ -31,6 +42,7 @@ export declare function deploy(teable: Teable, appId: string, bundle: string, bu
31
42
  tables: string[];
32
43
  capabilities?: (keyof import("@teable/app/protocol").Capabilities)[] | undefined;
33
44
  } | undefined;
45
+ pagesUrl: string | null;
34
46
  }>;
35
47
  /** Every version of the app, newest first. */
36
48
  export declare function listVersions(teable: Teable, appId: string): Promise<VersionInfo[]>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@teable/next-cli",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "teable-next: start, check out, push and publish Teable apps (teable-next) from their repositories",
5
5
  "license": "MIT",
6
6
  "repository": {