@dudousxd/nestjs-durable-dashboard 0.56.0 → 0.57.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.
@@ -36,10 +36,12 @@ __export(index_exports, {
36
36
  CONSOLE_AUTHORIZE_MISSING_WARNING: () => CONSOLE_AUTHORIZE_MISSING_WARNING,
37
37
  CONSOLE_GATE: () => CONSOLE_GATE,
38
38
  CONSOLE_PAGE_METADATA: () => CONSOLE_PAGE_METADATA,
39
+ CONSOLE_PUBLIC_METADATA: () => CONSOLE_PUBLIC_METADATA,
39
40
  ConsoleAccessDenied: () => ConsoleAccessDenied,
40
41
  ConsoleAuthorizeFilter: () => ConsoleAuthorizeFilter,
41
42
  ConsoleAuthorizeGuard: () => ConsoleAuthorizeGuard,
42
43
  ConsolePage: () => ConsolePage,
44
+ ConsolePublic: () => ConsolePublic,
43
45
  DASHBOARD_API_PATH: () => DASHBOARD_API_PATH,
44
46
  DASHBOARD_BASE_PATH: () => DASHBOARD_BASE_PATH,
45
47
  DashboardService: () => DashboardService,
@@ -294,6 +296,10 @@ var ConsoleAccessDenied = class extends import_common.HttpException {
294
296
  }, unauthenticated2 ? 401 : 403), this.decision = decision, this.page = page;
295
297
  }
296
298
  };
299
+ var CONSOLE_PUBLIC_METADATA = `${PACKAGE}:console-public`;
300
+ var ConsolePublic = /* @__PURE__ */ __name(() => (_target, _key, descriptor) => {
301
+ Reflect.defineMetadata(CONSOLE_PUBLIC_METADATA, true, descriptor.value);
302
+ }, "ConsolePublic");
297
303
  var ConsoleAuthorizeGuard = class {
298
304
  static {
299
305
  __name(this, "ConsoleAuthorizeGuard");
@@ -303,6 +309,7 @@ var ConsoleAuthorizeGuard = class {
303
309
  this.decide = decide;
304
310
  }
305
311
  async canActivate(context) {
312
+ if (Reflect.getMetadata(CONSOLE_PUBLIC_METADATA, context.getHandler()) === true) return true;
306
313
  const decision = await this.decide(context);
307
314
  if (decision.allowed) return true;
308
315
  throw new ConsoleAccessDenied(decision, isPageNavigation(context));
@@ -415,7 +422,7 @@ var DashboardService = class {
415
422
  */
416
423
  controlPlane() {
417
424
  if (!this.store || !this.engine) {
418
- throw new Error("This durable dashboard operation requires the control plane (not available on a tenant deployment).");
425
+ throw new import_common2.NotImplementedException("This durable dashboard operation requires the control plane (not available on a tenant deployment).");
419
426
  }
420
427
  return {
421
428
  store: this.store,
@@ -1670,9 +1677,9 @@ var DurableApiControllerBase = class {
1670
1677
  }
1671
1678
  /**
1672
1679
  * Public callback endpoint for `ctx.webhook()`: a third party POSTs here (the url handed to it),
1673
- * and the body resumes the waiting run. NOTE: this is reachable by external systems — protect it
1674
- * by treating the token as a secret (it embeds runId:seq) and/or fronting it with signature
1675
- * verification in your own middleware.
1680
+ * and the body resumes the waiting run. Not a console route: the console's `authorize` does not
1681
+ * apply, the token is the secret. The app's `decorators` still do. Treat the token as a secret
1682
+ * and/or front it with signature verification in your own middleware.
1676
1683
  */
1677
1684
  async webhook(token, body) {
1678
1685
  const result = await this.dashboard.deliverWebhook(token, body);
@@ -1910,6 +1917,7 @@ _ts_decorate6([
1910
1917
  _ts_metadata5("design:returntype", Promise)
1911
1918
  ], DurableApiControllerBase.prototype, "redispatch", null);
1912
1919
  _ts_decorate6([
1920
+ ConsolePublic(),
1913
1921
  (0, import_common6.Post)("webhooks/:token"),
1914
1922
  _ts_param3(0, (0, import_common6.Param)("token")),
1915
1923
  _ts_param3(1, (0, import_common6.Body)()),
@@ -2339,10 +2347,12 @@ DurableDashboardModule = _ts_decorate8([
2339
2347
  CONSOLE_AUTHORIZE_MISSING_WARNING,
2340
2348
  CONSOLE_GATE,
2341
2349
  CONSOLE_PAGE_METADATA,
2350
+ CONSOLE_PUBLIC_METADATA,
2342
2351
  ConsoleAccessDenied,
2343
2352
  ConsoleAuthorizeFilter,
2344
2353
  ConsoleAuthorizeGuard,
2345
2354
  ConsolePage,
2355
+ ConsolePublic,
2346
2356
  DASHBOARD_API_PATH,
2347
2357
  DASHBOARD_BASE_PATH,
2348
2358
  DashboardService,