@vibedropio/publisher 0.21.2 → 0.22.0

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.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "git-publisher",
3
3
  "displayName": "Git Publisher",
4
- "version": "0.21.2",
4
+ "version": "0.22.0",
5
5
  "description": "Publish an app folder to the platform and keep it updated (\"publish my app\", \"update my app\", \"fetch the engineered version\").",
6
6
  "author": { "name": "VibeDrop" },
7
7
  "keywords": ["git", "publish", "deploy", "serverless"]
@@ -21723,7 +21723,8 @@ var postApiTerminalApplications = {
21723
21723
  name: external_exports.string().min(1).max(80),
21724
21724
  creationId: external_exports.string().regex(new RegExp("^[0-9a-hjkmnp-tv-z]{26}$")),
21725
21725
  kind: external_exports.enum(["managed", "stack"]).optional(),
21726
- defaultBranch: external_exports.string().regex(new RegExp("^(?!.*\\.\\.)(?!\\/)(?!.*\\/$)[A-Za-z0-9._/-]{1,200}$")).nullable().optional()
21726
+ defaultBranch: external_exports.string().regex(new RegExp("^(?!.*\\.\\.)(?!\\/)(?!.*\\/$)[A-Za-z0-9._/-]{1,200}$")).nullable().optional(),
21727
+ cell: external_exports.string().regex(new RegExp("^(platform|[0-9a-f]{8})$")).nullable().optional()
21727
21728
  }),
21728
21729
  answers: {
21729
21730
  200: external_exports.object({
@@ -21731,14 +21732,38 @@ var postApiTerminalApplications = {
21731
21732
  appId: external_exports.string(),
21732
21733
  name: external_exports.string()
21733
21734
  }),
21734
- repository: external_exports.record(external_exports.string(), external_exports.unknown())
21735
+ repository: external_exports.record(external_exports.string(), external_exports.unknown()),
21736
+ placement: external_exports.union([
21737
+ external_exports.object({
21738
+ cell: external_exports.string()
21739
+ }),
21740
+ external_exports.object({
21741
+ refused: external_exports.enum(["no-cell", "unavailable"])
21742
+ }),
21743
+ external_exports.object({
21744
+ refused: external_exports.literal("must-pick"),
21745
+ offered: external_exports.array(external_exports.string())
21746
+ })
21747
+ ]).optional()
21735
21748
  }),
21736
21749
  201: external_exports.object({
21737
21750
  application: external_exports.object({
21738
21751
  appId: external_exports.string(),
21739
21752
  name: external_exports.string()
21740
21753
  }),
21741
- repository: external_exports.record(external_exports.string(), external_exports.unknown())
21754
+ repository: external_exports.record(external_exports.string(), external_exports.unknown()),
21755
+ placement: external_exports.union([
21756
+ external_exports.object({
21757
+ cell: external_exports.string()
21758
+ }),
21759
+ external_exports.object({
21760
+ refused: external_exports.enum(["no-cell", "unavailable"])
21761
+ }),
21762
+ external_exports.object({
21763
+ refused: external_exports.literal("must-pick"),
21764
+ offered: external_exports.array(external_exports.string())
21765
+ })
21766
+ ]).optional()
21742
21767
  })
21743
21768
  }
21744
21769
  };
@@ -21857,7 +21882,12 @@ var REFUSALS = {
21857
21882
  };
21858
21883
  async function createApplication(input2, opts) {
21859
21884
  const url2 = terminalUrl(input2.portal, postApiTerminalApplications.path());
21860
- const body = { creationId: input2.creationId ?? newCreationId(), name: input2.name, defaultBranch: input2.defaultBranch ?? "main" };
21885
+ const body = {
21886
+ creationId: input2.creationId ?? newCreationId(),
21887
+ name: input2.name,
21888
+ defaultBranch: input2.defaultBranch ?? "main",
21889
+ ...input2.cell === void 0 ? {} : { cell: input2.cell }
21890
+ };
21861
21891
  const session = new TerminalSession(opts);
21862
21892
  let lastOutage = "";
21863
21893
  for (let attempt = 0; attempt < ATTEMPTS; ) {
@@ -21897,7 +21927,7 @@ function read(body, created) {
21897
21927
  if (!answer2.success || !repository.success) {
21898
21928
  throw new PublisherError("UNAVAILABLE", "the portal answered with an application this version cannot read");
21899
21929
  }
21900
- return { appId: answer2.data.application.appId, created, repository: repository.data };
21930
+ return { appId: answer2.data.application.appId, created, repository: repository.data, placement: answer2.data.placement ?? null };
21901
21931
  }
21902
21932
 
21903
21933
  // ../client/src/clients/git-publisher/errors.ts
@@ -23667,6 +23697,7 @@ var OPTIONS = {
23667
23697
  token: { type: "string" },
23668
23698
  portal: { type: "string" },
23669
23699
  name: { type: "string" },
23700
+ cell: { type: "string" },
23670
23701
  app: { type: "string" },
23671
23702
  repo: { type: "string" },
23672
23703
  message: { type: "string" },
@@ -24518,7 +24549,7 @@ var skills = {
24518
24549
  async function repositoryForInit(p, endpoint, name, opts = {}) {
24519
24550
  const confirmed2 = await confirmedPortal(endpoint, opts);
24520
24551
  if (confirmed2.kind === "none") {
24521
- return { repoId: (await p.createRepository({ name, grants: [] })).repoId, appId: null };
24552
+ return { repoId: (await p.createRepository({ name, grants: [] })).repoId, appId: null, placement: null };
24522
24553
  }
24523
24554
  const { portal } = confirmed2;
24524
24555
  if (confirmed2.kind === "unconfirmed") {
@@ -24527,8 +24558,24 @@ async function repositoryForInit(p, endpoint, name, opts = {}) {
24527
24558
  if (!confirmed2.terminal.includes(APPLICATION_CREATION)) {
24528
24559
  throw new PublisherError("UNAVAILABLE", `${portal} cannot make an application from a terminal yet, and a repository needs one; ask whoever runs it to update the portal`);
24529
24560
  }
24530
- const made = await p.createApplication({ portal, name });
24531
- return { repoId: made.repository.repoId, appId: made.appId };
24561
+ const made = await p.createApplication({ portal, name, ...opts.cell === void 0 ? {} : { cell: opts.cell } });
24562
+ return { repoId: made.repository.repoId, appId: made.appId, placement: made.placement };
24563
+ }
24564
+ function placementWords(placement) {
24565
+ if (placement === null) {
24566
+ return null;
24567
+ }
24568
+ if ("cell" in placement) {
24569
+ return `this app runs in the ${placement.cell} cell`;
24570
+ }
24571
+ switch (placement.refused) {
24572
+ case "must-pick":
24573
+ return `this app has no cell yet, so its first publication stops. You can pick: ${placement.offered.join(", ")}. Open the app in the portal and pick one on its Cell tab`;
24574
+ case "no-cell":
24575
+ return "this app has no cell yet, because you cannot use that cell or any cell. An owner or admin can give you one";
24576
+ case "unavailable":
24577
+ return "where this app runs could not be asked now. Its first publication asks again";
24578
+ }
24532
24579
  }
24533
24580
 
24534
24581
  // src/commands/link.ts
@@ -24551,10 +24598,15 @@ async function linkFolder(inv, p, endpoint, dir, attach) {
24551
24598
  }
24552
24599
  let repoId = attach.repoId ?? null;
24553
24600
  let appId = null;
24601
+ let placement = null;
24554
24602
  if (repoId === null) {
24555
- const made = await repositoryForInit(p, endpoint, inv.str("name") ?? dir.split("/").pop() ?? "");
24556
- repoId = made.repoId;
24557
- appId = made.appId;
24603
+ const cell = inv.str("cell");
24604
+ const made = await repositoryForInit(p, endpoint, inv.str("name") ?? dir.split("/").pop() ?? "", cell === void 0 ? {} : { cell });
24605
+ ({ repoId, appId, placement } = made);
24606
+ const words = placementWords(placement);
24607
+ if (words !== null) {
24608
+ inv.log(words);
24609
+ }
24558
24610
  } else {
24559
24611
  await p.getRepository(repoId);
24560
24612
  }
@@ -24564,6 +24616,7 @@ async function linkFolder(inv, p, endpoint, dir, attach) {
24564
24616
  repoId,
24565
24617
  appId,
24566
24618
  created: attach.repoId === void 0,
24619
+ placement,
24567
24620
  onboarding: onboarding ? { commit: onboarding.commit, committed: onboarding.committed.length, excluded: onboarding.excluded } : null,
24568
24621
  workspace: workspace === null ? null : { branch: workspace.branch, baseOid: workspace.baseOid, baseGeneration: workspace.baseGeneration }
24569
24622
  };
@@ -25335,7 +25388,9 @@ Usage:
25335
25388
  publisher login --continue [--timeout <seconds>] collect the credential once the code is approved
25336
25389
  publisher logout (--endpoint <url> | --profile <name>)
25337
25390
  publisher profile list | profile use <name> | profile remove <name>
25338
- publisher init [dir] [--name <name>] [--repo <id>] create (or attach to) a repository, associate this folder
25391
+ publisher init [dir] [--name <name>] [--repo <id>] [--cell <cell>]
25392
+ create (or attach to) a repository, associate this folder; --cell names
25393
+ where a new app runs
25339
25394
  and record it as a workspace (so sync works here)
25340
25395
  publisher publish [dir] [--ref <ref>]... [--force] [--no-wait] publish commits as they are; to save and publish
25341
25396
  a change, use sync
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibedropio/publisher",
3
- "version": "0.21.2",
3
+ "version": "0.22.0",
4
4
  "description": "publisher: publish an app's Git history to the serverless Git backend",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",