@lukoweb/apitogo 0.2.37 → 0.2.38

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/cli/cli.js CHANGED
@@ -10073,7 +10073,7 @@ import {
10073
10073
  // package.json
10074
10074
  var package_default = {
10075
10075
  name: "@lukoweb/apitogo",
10076
- version: "0.2.37",
10076
+ version: "0.2.38",
10077
10077
  type: "module",
10078
10078
  sideEffects: [
10079
10079
  "**/*.css",
@@ -27294,7 +27294,7 @@ async function portalUrlOf(resolved, projectId, client) {
27294
27294
  throw new IdentityDeployError(
27295
27295
  "IDENTITY_PORTAL_ADDRESS_UNKNOWN",
27296
27296
  "The portal has no public address yet, and the identity needs it for the sign-in redirect.",
27297
- "Run `apitogo deploy --only portal` once so the platform gives the portal an address, then deploy identity."
27297
+ "The address comes with the project's hosting. Run `apitogo status`: while hosting is still being prepared, wait a few minutes and run `apitogo deploy` again. Once hosting is ready, `apitogo deploy --only portal` gives the portal its address, then deploy identity."
27298
27298
  );
27299
27299
  return url2;
27300
27300
  }
@@ -27712,11 +27712,15 @@ async function deployPlans(resolved, projectId, deps, options = {}) {
27712
27712
  let created = 0;
27713
27713
  let updated = 0;
27714
27714
  let archived = 0;
27715
+ const backendSync = /* @__PURE__ */ new Set();
27716
+ const noteSync = (plan2) => {
27717
+ if (plan2.plansBackendSync) backendSync.add(plan2.plansBackendSync);
27718
+ };
27715
27719
  for (const body of bodies) {
27716
27720
  const found = existing.get(body.sku);
27717
27721
  try {
27718
27722
  if (found) {
27719
- await client.updateGatewayPlan(projectId, found.id, {
27723
+ const result = await client.updateGatewayPlan(projectId, found.id, {
27720
27724
  displayName: body.displayName,
27721
27725
  isActive: true,
27722
27726
  limitsJson: body.limitsJson ?? null,
@@ -27728,9 +27732,10 @@ async function deployPlans(resolved, projectId, deps, options = {}) {
27728
27732
  billingPeriod: body.billingPeriod,
27729
27733
  sortOrder: body.sortOrder
27730
27734
  });
27735
+ noteSync(result);
27731
27736
  updated++;
27732
27737
  } else {
27733
- await client.createGatewayPlan(projectId, body);
27738
+ noteSync(await client.createGatewayPlan(projectId, body));
27734
27739
  created++;
27735
27740
  }
27736
27741
  } catch (error) {
@@ -27741,7 +27746,7 @@ async function deployPlans(resolved, projectId, deps, options = {}) {
27741
27746
  for (const plan2 of existing.values()) {
27742
27747
  if (!plan2.isActive || kept.has(plan2.sku.toLowerCase())) continue;
27743
27748
  try {
27744
- await client.updateGatewayPlan(projectId, plan2.id, {
27749
+ const result = await client.updateGatewayPlan(projectId, plan2.id, {
27745
27750
  displayName: plan2.displayName,
27746
27751
  isActive: false,
27747
27752
  limitsJson: plan2.limitsJson ?? null,
@@ -27754,6 +27759,7 @@ async function deployPlans(resolved, projectId, deps, options = {}) {
27754
27759
  billingPeriod: plan2.billingPeriod,
27755
27760
  sortOrder: plan2.sortOrder
27756
27761
  });
27762
+ noteSync(result);
27757
27763
  archived++;
27758
27764
  } catch (error) {
27759
27765
  refused(error);
@@ -27762,7 +27768,8 @@ async function deployPlans(resolved, projectId, deps, options = {}) {
27762
27768
  return {
27763
27769
  created: String(created),
27764
27770
  updated: String(updated),
27765
- archived: String(archived)
27771
+ archived: String(archived),
27772
+ ...backendSync.size > 0 ? { backendSync: [...backendSync].sort().join(",") } : {}
27766
27773
  };
27767
27774
  },
27768
27775
  // A plan someone deleted on the platform is not a result worth keeping, and neither is one that should be
@@ -28719,6 +28726,12 @@ function parseDeployOnly(value) {
28719
28726
  }
28720
28727
  return DEPLOY_ORDER.filter((name) => names.includes(name));
28721
28728
  }
28729
+ function isHostingNotReady(error) {
28730
+ if (!(error instanceof PlatformApiError)) return false;
28731
+ return /not provisioned yet|Could not retrieve deployment token/i.test(
28732
+ `${error.message} ${error.problem?.detail ?? ""}`
28733
+ );
28734
+ }
28722
28735
  function publishStep(deps, options) {
28723
28736
  return {
28724
28737
  name: "publish",
@@ -28738,6 +28751,14 @@ function publishStep(deps, options) {
28738
28751
  byteSize: String(upload.byteSize),
28739
28752
  deployServerStatus: String(upload.deployServerStatus)
28740
28753
  };
28754
+ } catch (error) {
28755
+ if (isHostingNotReady(error))
28756
+ throw new DeployError(
28757
+ "HOSTING_NOT_READY",
28758
+ "The portal's hosting is not ready yet: the platform is still preparing it, so there is nothing to publish to.",
28759
+ "Nothing is wrong with your files. Run `apitogo status` to see the hosting, wait a few minutes (a project made while the pool was full waits longest), then run `apitogo deploy` again."
28760
+ );
28761
+ throw error;
28741
28762
  } finally {
28742
28763
  await rm11(archive.archivePath, { force: true });
28743
28764
  }
@@ -29647,7 +29668,7 @@ async function createProjectV2(options, deps) {
29647
29668
  throw new ProjectCreateError(
29648
29669
  "CREATE_FAILED",
29649
29670
  "The project was created but hosting is still being prepared.",
29650
- `The folder is linked (project.id ${outcome.projectId}). Wait a few minutes, then run \`apitogo deploy\`.`
29671
+ `The folder is linked (project.id ${outcome.projectId}). Wait a few minutes (hosting takes 20 to 30 minutes, longer while the pool is full), then run \`apitogo project create\` again: it finishes the same project and does not make a second one. \`apitogo status\` shows how far it is.`
29651
29672
  );
29652
29673
  }
29653
29674
  await setProjectId(options.dir, outcome.projectId);
@@ -29664,7 +29685,7 @@ function assertCreated(outcome) {
29664
29685
  throw new ProjectCreateError(
29665
29686
  "CREATE_FAILED",
29666
29687
  `The platform could not create the project: ${outcome.message ?? outcome.status ?? "no answer"}.`,
29667
- "Nothing was written to this folder. Try again, or check `apitogo status`."
29688
+ /capacity/i.test(outcome.message ?? "") ? "There is no free hosting right now. Run `apitogo project create` again in a few minutes: it picks up where it stopped, and a project that was already made is not made twice. `apitogo status` shows whether this folder is linked." : "Try again, or check `apitogo status`."
29668
29689
  );
29669
29690
  }
29670
29691
  }
@@ -108,6 +108,7 @@ export interface GatewayPlanDto {
108
108
  priceAmount?: number;
109
109
  pricingModel?: "fixed" | "custom";
110
110
  priceLabel?: string | null;
111
+ plansBackendSync?: string | null;
111
112
  priceCurrency?: string;
112
113
  billingPeriod?: string;
113
114
  limitsJson?: string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lukoweb/apitogo",
3
- "version": "0.2.37",
3
+ "version": "0.2.38",
4
4
  "type": "module",
5
5
  "sideEffects": [
6
6
  "**/*.css",