@vibedropio/publisher 0.21.1 → 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.1",
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"]
@@ -21722,7 +21722,9 @@ var postApiTerminalApplications = {
21722
21722
  body: external_exports.object({
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
- defaultBranch: external_exports.string().regex(new RegExp("^(?!.*\\.\\.)(?!\\/)(?!.*\\/$)[A-Za-z0-9._/-]{1,200}$")).nullable().optional()
21725
+ kind: external_exports.enum(["managed", "stack"]).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()
21726
21728
  }),
21727
21729
  answers: {
21728
21730
  200: external_exports.object({
@@ -21730,14 +21732,38 @@ var postApiTerminalApplications = {
21730
21732
  appId: external_exports.string(),
21731
21733
  name: external_exports.string()
21732
21734
  }),
21733
- 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()
21734
21748
  }),
21735
21749
  201: external_exports.object({
21736
21750
  application: external_exports.object({
21737
21751
  appId: external_exports.string(),
21738
21752
  name: external_exports.string()
21739
21753
  }),
21740
- 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()
21741
21767
  })
21742
21768
  }
21743
21769
  };
@@ -21856,7 +21882,12 @@ var REFUSALS = {
21856
21882
  };
21857
21883
  async function createApplication(input2, opts) {
21858
21884
  const url2 = terminalUrl(input2.portal, postApiTerminalApplications.path());
21859
- 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
+ };
21860
21891
  const session = new TerminalSession(opts);
21861
21892
  let lastOutage = "";
21862
21893
  for (let attempt = 0; attempt < ATTEMPTS; ) {
@@ -21896,7 +21927,7 @@ function read(body, created) {
21896
21927
  if (!answer2.success || !repository.success) {
21897
21928
  throw new PublisherError("UNAVAILABLE", "the portal answered with an application this version cannot read");
21898
21929
  }
21899
- 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 };
21900
21931
  }
21901
21932
 
21902
21933
  // ../client/src/clients/git-publisher/errors.ts
@@ -23666,6 +23697,7 @@ var OPTIONS = {
23666
23697
  token: { type: "string" },
23667
23698
  portal: { type: "string" },
23668
23699
  name: { type: "string" },
23700
+ cell: { type: "string" },
23669
23701
  app: { type: "string" },
23670
23702
  repo: { type: "string" },
23671
23703
  message: { type: "string" },
@@ -24517,7 +24549,7 @@ var skills = {
24517
24549
  async function repositoryForInit(p, endpoint, name, opts = {}) {
24518
24550
  const confirmed2 = await confirmedPortal(endpoint, opts);
24519
24551
  if (confirmed2.kind === "none") {
24520
- return { repoId: (await p.createRepository({ name, grants: [] })).repoId, appId: null };
24552
+ return { repoId: (await p.createRepository({ name, grants: [] })).repoId, appId: null, placement: null };
24521
24553
  }
24522
24554
  const { portal } = confirmed2;
24523
24555
  if (confirmed2.kind === "unconfirmed") {
@@ -24526,8 +24558,24 @@ async function repositoryForInit(p, endpoint, name, opts = {}) {
24526
24558
  if (!confirmed2.terminal.includes(APPLICATION_CREATION)) {
24527
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`);
24528
24560
  }
24529
- const made = await p.createApplication({ portal, name });
24530
- 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
+ }
24531
24579
  }
24532
24580
 
24533
24581
  // src/commands/link.ts
@@ -24550,10 +24598,15 @@ async function linkFolder(inv, p, endpoint, dir, attach) {
24550
24598
  }
24551
24599
  let repoId = attach.repoId ?? null;
24552
24600
  let appId = null;
24601
+ let placement = null;
24553
24602
  if (repoId === null) {
24554
- const made = await repositoryForInit(p, endpoint, inv.str("name") ?? dir.split("/").pop() ?? "");
24555
- repoId = made.repoId;
24556
- 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
+ }
24557
24610
  } else {
24558
24611
  await p.getRepository(repoId);
24559
24612
  }
@@ -24563,6 +24616,7 @@ async function linkFolder(inv, p, endpoint, dir, attach) {
24563
24616
  repoId,
24564
24617
  appId,
24565
24618
  created: attach.repoId === void 0,
24619
+ placement,
24566
24620
  onboarding: onboarding ? { commit: onboarding.commit, committed: onboarding.committed.length, excluded: onboarding.excluded } : null,
24567
24621
  workspace: workspace === null ? null : { branch: workspace.branch, baseOid: workspace.baseOid, baseGeneration: workspace.baseGeneration }
24568
24622
  };
@@ -25334,7 +25388,9 @@ Usage:
25334
25388
  publisher login --continue [--timeout <seconds>] collect the credential once the code is approved
25335
25389
  publisher logout (--endpoint <url> | --profile <name>)
25336
25390
  publisher profile list | profile use <name> | profile remove <name>
25337
- 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
25338
25394
  and record it as a workspace (so sync works here)
25339
25395
  publisher publish [dir] [--ref <ref>]... [--force] [--no-wait] publish commits as they are; to save and publish
25340
25396
  a change, use sync
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibedropio/publisher",
3
- "version": "0.21.1",
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",