@realiizlabs/admin 0.15.6 → 0.15.7

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.
@@ -35,6 +35,12 @@ interface StudioEnv {
35
35
  identity: IdentityConfig;
36
36
  /** Optional: without it the Team tab explains that invites aren't set up. */
37
37
  service: ServiceConfig | null;
38
+ /**
39
+ * Optional: the host's deploy hook (a Vercel Deploy Hook URL for the production
40
+ * branch). When a Studio update's rebuild never starts, the tracker offers
41
+ * "Nudge the build", which POSTs here. Without it the tracker says to tell {supportName}.
42
+ */
43
+ deployHookUrl?: string | null;
38
44
  }
39
45
  interface StudioConfig {
40
46
  /** The site's registry, keyed by type id. */
@@ -217,6 +223,14 @@ declare function updateVersionOf(pr: {
217
223
  title: string;
218
224
  branch: string;
219
225
  }): string | null;
226
+ type NudgeOutcome = {
227
+ state: "sent";
228
+ } | {
229
+ state: "unavailable";
230
+ } | {
231
+ state: "error";
232
+ message: string;
233
+ };
220
234
  declare function compareVersions(a: string, b: string): number;
221
235
 
222
236
  declare function createStudio(config: StudioConfig): {
@@ -305,6 +319,7 @@ declare function createStudio(config: StudioConfig): {
305
319
  slug: string;
306
320
  }) => Promise<PublishResult | never>;
307
321
  updateStudio: (number: number) => Promise<MergeOutcome>;
322
+ nudgeBuild: () => Promise<NudgeOutcome>;
308
323
  };
309
324
  authHandlers: {
310
325
  callback: (request: Request) => Promise<Response>;
@@ -315,4 +330,4 @@ type Studio = ReturnType<typeof createStudio>;
315
330
  type StudioActions = Studio["actions"];
316
331
  type StudioReaders = Studio["readers"];
317
332
 
318
- export { type ActionResult, type DiscardOutcome, type IdentityConfig, ImagePayload, type ListItem, type Located, type MergeOutcome, NotHere, type PendingChange, type PendingState, type PrSummary, type PublishInput, type PublishResult, type RepoConfig, type ServiceConfig, type Session, type Studio, type StudioActions, type StudioConfig, type StudioEnv, type StudioReaders, type StudioUpdate, type TeamState, compareVersions, createStudio, pendingLabel, pendingText, updateVersionOf };
333
+ export { type ActionResult, type DiscardOutcome, type IdentityConfig, ImagePayload, type ListItem, type Located, type MergeOutcome, NotHere, type NudgeOutcome, type PendingChange, type PendingState, type PrSummary, type PublishInput, type PublishResult, type RepoConfig, type ServiceConfig, type Session, type Studio, type StudioActions, type StudioConfig, type StudioEnv, type StudioReaders, type StudioUpdate, type TeamState, compareVersions, createStudio, pendingLabel, pendingText, updateVersionOf };
@@ -35,6 +35,12 @@ interface StudioEnv {
35
35
  identity: IdentityConfig;
36
36
  /** Optional: without it the Team tab explains that invites aren't set up. */
37
37
  service: ServiceConfig | null;
38
+ /**
39
+ * Optional: the host's deploy hook (a Vercel Deploy Hook URL for the production
40
+ * branch). When a Studio update's rebuild never starts, the tracker offers
41
+ * "Nudge the build", which POSTs here. Without it the tracker says to tell {supportName}.
42
+ */
43
+ deployHookUrl?: string | null;
38
44
  }
39
45
  interface StudioConfig {
40
46
  /** The site's registry, keyed by type id. */
@@ -217,6 +223,14 @@ declare function updateVersionOf(pr: {
217
223
  title: string;
218
224
  branch: string;
219
225
  }): string | null;
226
+ type NudgeOutcome = {
227
+ state: "sent";
228
+ } | {
229
+ state: "unavailable";
230
+ } | {
231
+ state: "error";
232
+ message: string;
233
+ };
220
234
  declare function compareVersions(a: string, b: string): number;
221
235
 
222
236
  declare function createStudio(config: StudioConfig): {
@@ -305,6 +319,7 @@ declare function createStudio(config: StudioConfig): {
305
319
  slug: string;
306
320
  }) => Promise<PublishResult | never>;
307
321
  updateStudio: (number: number) => Promise<MergeOutcome>;
322
+ nudgeBuild: () => Promise<NudgeOutcome>;
308
323
  };
309
324
  authHandlers: {
310
325
  callback: (request: Request) => Promise<Response>;
@@ -315,4 +330,4 @@ type Studio = ReturnType<typeof createStudio>;
315
330
  type StudioActions = Studio["actions"];
316
331
  type StudioReaders = Studio["readers"];
317
332
 
318
- export { type ActionResult, type DiscardOutcome, type IdentityConfig, ImagePayload, type ListItem, type Located, type MergeOutcome, NotHere, type PendingChange, type PendingState, type PrSummary, type PublishInput, type PublishResult, type RepoConfig, type ServiceConfig, type Session, type Studio, type StudioActions, type StudioConfig, type StudioEnv, type StudioReaders, type StudioUpdate, type TeamState, compareVersions, createStudio, pendingLabel, pendingText, updateVersionOf };
333
+ export { type ActionResult, type DiscardOutcome, type IdentityConfig, ImagePayload, type ListItem, type Located, type MergeOutcome, NotHere, type NudgeOutcome, type PendingChange, type PendingState, type PrSummary, type PublishInput, type PublishResult, type RepoConfig, type ServiceConfig, type Session, type Studio, type StudioActions, type StudioConfig, type StudioEnv, type StudioReaders, type StudioUpdate, type TeamState, compareVersions, createStudio, pendingLabel, pendingText, updateVersionOf };
@@ -1104,7 +1104,7 @@ function makeHandlers(ctx) {
1104
1104
  }
1105
1105
 
1106
1106
  // src/version.ts
1107
- var ADMIN_VERSION = "0.15.6" ;
1107
+ var ADMIN_VERSION = "0.15.7" ;
1108
1108
 
1109
1109
  // src/studio/update.ts
1110
1110
  var PACKAGE_NAME = "@realiizlabs/admin";
@@ -1163,7 +1163,18 @@ function makeUpdate(config, ctx, deps = {}) {
1163
1163
  return { state: "error", message: err instanceof Error ? err.message : String(err) };
1164
1164
  }
1165
1165
  };
1166
- return { studioUpdate, updateStudio };
1166
+ const nudgeBuild = async () => {
1167
+ await ctx.requireAdmin({ minimumRole: "owner" });
1168
+ const url = config.env().deployHookUrl;
1169
+ if (!url) return { state: "unavailable" };
1170
+ try {
1171
+ const res = await (deps.fetch ?? fetch)(url, { method: "POST" });
1172
+ return res.ok ? { state: "sent" } : { state: "error", message: `The hosting service answered ${res.status}.` };
1173
+ } catch (err) {
1174
+ return { state: "error", message: err instanceof Error ? err.message : String(err) };
1175
+ }
1176
+ };
1177
+ return { studioUpdate, updateStudio, nudgeBuild };
1167
1178
  }
1168
1179
  function compareVersions(a, b) {
1169
1180
  const pa = a.split(".").map(Number), pb = b.split(".").map(Number);
@@ -1182,6 +1193,7 @@ function createStudio(config) {
1182
1193
  const update = makeUpdate(config, ctx);
1183
1194
  const actions = {
1184
1195
  updateStudio: update.updateStudio,
1196
+ nudgeBuild: update.nudgeBuild,
1185
1197
  ...makePublish(config, registry, ctx, readers),
1186
1198
  ...makeMerge(config, ctx, readers),
1187
1199
  ...makePreview(ctx),