@dudousxd/nestjs-durable-dashboard 0.55.1 → 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.
@@ -1,8 +1,10 @@
1
1
  const __importMetaUrl = require('url').pathToFileURL(__filename).href;
2
2
  "use strict";
3
+ var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
6
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
9
  var __name = (target, value) => __defProp(target, "name", { value, configurable: true });
8
10
  var __export = (target, all) => {
@@ -17,14 +19,31 @@ var __copyProps = (to, from, except, desc) => {
17
19
  }
18
20
  return to;
19
21
  };
22
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
23
+ // If the importer is in node compatibility mode or this is not an ESM
24
+ // file that has been converted to a CommonJS file using a Babel-
25
+ // compatible transform (i.e. "__esModule" has not been set), then set
26
+ // "default" to the CommonJS "module.exports" for node compatibility.
27
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
28
+ mod
29
+ ));
20
30
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
21
31
 
22
32
  // src/server/index.ts
23
33
  var index_exports = {};
24
34
  __export(index_exports, {
35
+ CONSOLE_AUTHORIZE_DECIDE: () => CONSOLE_AUTHORIZE_DECIDE,
36
+ CONSOLE_AUTHORIZE_MISSING_WARNING: () => CONSOLE_AUTHORIZE_MISSING_WARNING,
37
+ CONSOLE_GATE: () => CONSOLE_GATE,
38
+ CONSOLE_PAGE_METADATA: () => CONSOLE_PAGE_METADATA,
39
+ CONSOLE_PUBLIC_METADATA: () => CONSOLE_PUBLIC_METADATA,
40
+ ConsoleAccessDenied: () => ConsoleAccessDenied,
41
+ ConsoleAuthorizeFilter: () => ConsoleAuthorizeFilter,
42
+ ConsoleAuthorizeGuard: () => ConsoleAuthorizeGuard,
43
+ ConsolePage: () => ConsolePage,
44
+ ConsolePublic: () => ConsolePublic,
25
45
  DASHBOARD_API_PATH: () => DASHBOARD_API_PATH,
26
46
  DASHBOARD_BASE_PATH: () => DASHBOARD_BASE_PATH,
27
- DASHBOARD_PROTECTION_CHECK: () => DASHBOARD_PROTECTION_CHECK,
28
47
  DashboardService: () => DashboardService,
29
48
  DurableApiController: () => DurableApiController,
30
49
  DurableApiControllerBase: () => DurableApiControllerBase,
@@ -32,14 +51,18 @@ __export(index_exports, {
32
51
  DurableDashboardModule: () => DurableDashboardModule,
33
52
  DurableUiController: () => DurableUiController,
34
53
  DurableUiControllerBase: () => DurableUiControllerBase,
35
- UNPROTECTED_CONSOLE_IN_PRODUCTION: () => UNPROTECTED_CONSOLE_IN_PRODUCTION
54
+ UseConsoleAuthorize: () => UseConsoleAuthorize,
55
+ authorizeByToken: () => authorizeByToken,
56
+ normalizeConsoleResult: () => normalizeConsoleResult,
57
+ resolveConsoleAuthorize: () => resolveConsoleAuthorize
36
58
  });
37
59
  module.exports = __toCommonJS(index_exports);
38
60
 
39
- // src/server/dashboard.service.ts
40
- var import_nestjs_durable_core = require("@dudousxd/nestjs-durable-core");
61
+ // src/server/console-authorize.ts
62
+ var import_reflect_metadata = require("reflect-metadata");
63
+ var import_node_crypto = require("crypto");
41
64
  var import_common = require("@nestjs/common");
42
- var import_rxjs = require("rxjs");
65
+ var import_core = require("@nestjs/core");
43
66
  function _ts_decorate(decorators, target, key, desc) {
44
67
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
45
68
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
@@ -66,6 +89,315 @@ function _ts_param(paramIndex, decorator) {
66
89
  };
67
90
  }
68
91
  __name(_ts_param, "_ts_param");
92
+ var CONSOLE_GATE = Symbol.for("@dudousxd/aviary:console-gate");
93
+ var PACKAGE = "@dudousxd/nestjs-durable-dashboard";
94
+ var MODULE = "DurableDashboardModule";
95
+ var CONSOLE_AUTHORIZE_MISSING_WARNING = `[${PACKAGE}] console has no \`authorize\` configured: it is open outside production and denies every request in production. Set \`authorize\` in ${MODULE}.forRoot().`;
96
+ var allow = /* @__PURE__ */ __name(() => ({
97
+ allowed: true
98
+ }), "allow");
99
+ var forbidden = /* @__PURE__ */ __name(() => ({
100
+ allowed: false,
101
+ reason: "forbidden"
102
+ }), "forbidden");
103
+ var unauthenticated = /* @__PURE__ */ __name(() => ({
104
+ allowed: false,
105
+ reason: "unauthenticated"
106
+ }), "unauthenticated");
107
+ function isProduction() {
108
+ return (process.env.NODE_ENV ?? "").trim().toLowerCase() === "production";
109
+ }
110
+ __name(isProduction, "isProduction");
111
+ function isAuthorizerClass(value) {
112
+ if (typeof value !== "function") return false;
113
+ if (typeof value.prototype?.authorize === "function") {
114
+ return true;
115
+ }
116
+ return /^class[\s{]/.test(Function.prototype.toString.call(value));
117
+ }
118
+ __name(isAuthorizerClass, "isAuthorizerClass");
119
+ function isPolicyCheck(value) {
120
+ return typeof value === "object" && value !== null && typeof value.policy === "function" && typeof value.ability === "string";
121
+ }
122
+ __name(isPolicyCheck, "isPolicyCheck");
123
+ function isLazyModule(value) {
124
+ return typeof value === "object" && value !== null && isAuthorizerClass(value.default);
125
+ }
126
+ __name(isLazyModule, "isLazyModule");
127
+ function normalizeConsoleResult(result) {
128
+ if (result === true) return allow();
129
+ if (typeof result !== "object" || result === null) return forbidden();
130
+ const shape = result;
131
+ if (typeof shape.redirectTo === "string" && shape.allowed !== true) {
132
+ return {
133
+ allowed: false,
134
+ reason: "unauthenticated",
135
+ redirectTo: shape.redirectTo
136
+ };
137
+ }
138
+ if (shape.allowed === true) return allow();
139
+ return shape.reason === "unauthenticated" ? unauthenticated() : forbidden();
140
+ }
141
+ __name(normalizeConsoleResult, "normalizeConsoleResult");
142
+ function hasUser(user) {
143
+ return user !== null && user !== void 0 && user !== false;
144
+ }
145
+ __name(hasUser, "hasUser");
146
+ async function policyDecider(check, moduleRef) {
147
+ let pkg;
148
+ try {
149
+ pkg = await import("@nestjs/authorization");
150
+ } catch {
151
+ throw new Error(`${MODULE}: \`authorize: { policy, ability }\` needs @nestjs/authorization installed, with AuthorizationModule.forRoot() imported in the app; or pass a function, a class, or a gate name.`);
152
+ }
153
+ const { AuthorizationService, AUTHORIZATION_MODULE_OPTIONS, defaultGetUser } = pkg;
154
+ try {
155
+ moduleRef.get(AuthorizationService, {
156
+ strict: false
157
+ });
158
+ } catch {
159
+ throw new Error(`${MODULE}: \`authorize: { policy, ability }\` needs AuthorizationModule.forRoot() from @nestjs/authorization imported in the app.`);
160
+ }
161
+ let getUser = defaultGetUser;
162
+ try {
163
+ const options = moduleRef.get(AUTHORIZATION_MODULE_OPTIONS, {
164
+ strict: false
165
+ });
166
+ if (typeof options?.getUser === "function") getUser = options.getUser;
167
+ } catch {
168
+ }
169
+ return async (context) => {
170
+ const authorization = moduleRef.get(AuthorizationService, {
171
+ strict: false
172
+ });
173
+ const user = await getUser(context);
174
+ const can = authorization.can;
175
+ if (await can.call(authorization, check.policy, check.ability, hasUser(user) ? user : null)) {
176
+ return allow();
177
+ }
178
+ return hasUser(user) ? forbidden() : unauthenticated();
179
+ };
180
+ }
181
+ __name(policyDecider, "policyDecider");
182
+ function gateDecider(name, moduleRef) {
183
+ try {
184
+ moduleRef.get(CONSOLE_GATE, {
185
+ strict: false
186
+ });
187
+ } catch {
188
+ throw new Error(`\`authorize: '${name}'\` needs @dudousxd/nestjs-authz's AuthzModule (it resolves gate names); or pass a function, a class, or { policy, ability }`);
189
+ }
190
+ return async (context) => {
191
+ const gate = moduleRef.get(CONSOLE_GATE, {
192
+ strict: false
193
+ });
194
+ return normalizeConsoleResult(await gate.allows(name, context));
195
+ };
196
+ }
197
+ __name(gateDecider, "gateDecider");
198
+ function classDecider(moduleRef) {
199
+ const instances = /* @__PURE__ */ new Map();
200
+ const instanceOf = /* @__PURE__ */ __name((Class) => {
201
+ const cached = instances.get(Class);
202
+ if (cached) return cached;
203
+ const pending = (async () => {
204
+ try {
205
+ const registered = moduleRef.get(Class, {
206
+ strict: false
207
+ });
208
+ if (registered) return registered;
209
+ } catch {
210
+ }
211
+ return moduleRef.create(Class);
212
+ })();
213
+ pending.catch(() => instances.delete(Class));
214
+ instances.set(Class, pending);
215
+ return pending;
216
+ }, "instanceOf");
217
+ return (Class) => async (context) => normalizeConsoleResult(await (await instanceOf(Class)).authorize(context));
218
+ }
219
+ __name(classDecider, "classDecider");
220
+ async function resolveConsoleAuthorize(authorize, moduleRef, options = {}) {
221
+ const logger = options.logger ?? new import_common.Logger(MODULE);
222
+ if (authorize === void 0) {
223
+ if (options.warnIfMissing !== false) logger.warn(CONSOLE_AUTHORIZE_MISSING_WARNING);
224
+ const production = isProduction();
225
+ return async () => production ? forbidden() : allow();
226
+ }
227
+ let decide;
228
+ if (typeof authorize === "string") {
229
+ decide = gateDecider(authorize, moduleRef);
230
+ } else if (isPolicyCheck(authorize)) {
231
+ decide = await policyDecider(authorize, moduleRef);
232
+ } else if (isAuthorizerClass(authorize)) {
233
+ decide = classDecider(moduleRef)(authorize);
234
+ } else if (typeof authorize === "function") {
235
+ const fromClass = classDecider(moduleRef);
236
+ let lazy;
237
+ const fn = authorize;
238
+ decide = /* @__PURE__ */ __name(async (context) => {
239
+ if (lazy) return lazy(context);
240
+ const result = await fn(context);
241
+ if (!isLazyModule(result)) return normalizeConsoleResult(result);
242
+ lazy = fromClass(result.default);
243
+ return lazy(context);
244
+ }, "decide");
245
+ } else {
246
+ throw new Error(`${MODULE}: \`authorize\` must be a function, a class with authorize(), a lazy import, { policy, ability } or a gate name.`);
247
+ }
248
+ return async (context) => {
249
+ try {
250
+ return await decide(context);
251
+ } catch (error) {
252
+ logger.warn(`console \`authorize\` threw, denying the request: ${error instanceof Error ? error.message : String(error)}`);
253
+ return forbidden();
254
+ }
255
+ };
256
+ }
257
+ __name(resolveConsoleAuthorize, "resolveConsoleAuthorize");
258
+ var sha256 = /* @__PURE__ */ __name((value) => (0, import_node_crypto.createHash)("sha256").update(value).digest(), "sha256");
259
+ function authorizeByToken(options) {
260
+ const token = options.token;
261
+ if (typeof token !== "string" || token.length === 0) {
262
+ throw new Error("authorizeByToken: `token` is empty; set it (e.g. from an env var).");
263
+ }
264
+ const expected = sha256(token);
265
+ return (context) => {
266
+ const header = context.switchToHttp().getRequest()?.headers?.authorization;
267
+ const match = typeof header === "string" ? /^Bearer\s+(.+)$/i.exec(header.trim()) : null;
268
+ if (match?.[1] && (0, import_node_crypto.timingSafeEqual)(sha256(match[1]), expected)) return true;
269
+ return {
270
+ allowed: false,
271
+ reason: "unauthenticated"
272
+ };
273
+ };
274
+ }
275
+ __name(authorizeByToken, "authorizeByToken");
276
+ var CONSOLE_AUTHORIZE_DECIDE = Symbol(`${PACKAGE}:console-authorize`);
277
+ var CONSOLE_PAGE_METADATA = `${PACKAGE}:console-page`;
278
+ var ConsolePage = /* @__PURE__ */ __name(() => (target) => {
279
+ Reflect.defineMetadata(CONSOLE_PAGE_METADATA, true, target);
280
+ }, "ConsolePage");
281
+ var ConsoleAccessDenied = class extends import_common.HttpException {
282
+ static {
283
+ __name(this, "ConsoleAccessDenied");
284
+ }
285
+ decision;
286
+ page;
287
+ constructor(decision, page) {
288
+ const unauthenticated2 = decision.reason === "unauthenticated";
289
+ super(unauthenticated2 ? {
290
+ error: "unauthenticated",
291
+ ...decision.redirectTo ? {
292
+ redirectTo: decision.redirectTo
293
+ } : {}
294
+ } : {
295
+ error: "forbidden"
296
+ }, unauthenticated2 ? 401 : 403), this.decision = decision, this.page = page;
297
+ }
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");
303
+ var ConsoleAuthorizeGuard = class {
304
+ static {
305
+ __name(this, "ConsoleAuthorizeGuard");
306
+ }
307
+ decide;
308
+ constructor(decide) {
309
+ this.decide = decide;
310
+ }
311
+ async canActivate(context) {
312
+ if (Reflect.getMetadata(CONSOLE_PUBLIC_METADATA, context.getHandler()) === true) return true;
313
+ const decision = await this.decide(context);
314
+ if (decision.allowed) return true;
315
+ throw new ConsoleAccessDenied(decision, isPageNavigation(context));
316
+ }
317
+ };
318
+ ConsoleAuthorizeGuard = _ts_decorate([
319
+ (0, import_common.Injectable)(),
320
+ _ts_param(0, (0, import_common.Inject)(CONSOLE_AUTHORIZE_DECIDE)),
321
+ _ts_metadata("design:type", Function),
322
+ _ts_metadata("design:paramtypes", [
323
+ typeof ConsoleDecide === "undefined" ? Object : ConsoleDecide
324
+ ])
325
+ ], ConsoleAuthorizeGuard);
326
+ function isPageNavigation(context) {
327
+ if (context.getType() !== "http") return false;
328
+ if (Reflect.getMetadata(CONSOLE_PAGE_METADATA, context.getClass()) !== true) return false;
329
+ const request = context.switchToHttp().getRequest();
330
+ const accept = request?.headers?.accept;
331
+ return request?.method === "GET" && typeof accept === "string" && accept.includes("text/html");
332
+ }
333
+ __name(isPageNavigation, "isPageNavigation");
334
+ var consolePage = /* @__PURE__ */ __name((title, message) => `<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width,initial-scale=1"><title>${title}</title></head><body style="font-family:system-ui,sans-serif;display:grid;place-items:center;min-height:100vh;margin:0"><main style="text-align:center"><h1>${title}</h1><p>${message}</p></main></body></html>`, "consolePage");
335
+ var DENIED_PAGE = consolePage("Access denied", "You do not have access to this console.");
336
+ var SIGN_IN_PAGE = consolePage("Sign in required", "Sign in to open this console.");
337
+ var ConsoleAuthorizeFilter = class {
338
+ static {
339
+ __name(this, "ConsoleAuthorizeFilter");
340
+ }
341
+ adapterHost;
342
+ constructor(adapterHost) {
343
+ this.adapterHost = adapterHost;
344
+ }
345
+ catch(exception, host) {
346
+ const adapter = this.adapterHost.httpAdapter;
347
+ const response = host.switchToHttp().getResponse();
348
+ const { decision, page } = exception;
349
+ if (page && decision.redirectTo) {
350
+ adapter.redirect(response, 302, decision.redirectTo);
351
+ return;
352
+ }
353
+ if (page) {
354
+ const forbiddenPage = decision.reason === "forbidden";
355
+ adapter.setHeader(response, "Content-Type", "text/html; charset=utf-8");
356
+ adapter.reply(response, forbiddenPage ? DENIED_PAGE : SIGN_IN_PAGE, forbiddenPage ? 403 : 401);
357
+ return;
358
+ }
359
+ adapter.reply(response, exception.getResponse(), exception.getStatus());
360
+ }
361
+ };
362
+ ConsoleAuthorizeFilter = _ts_decorate([
363
+ (0, import_common.Catch)(ConsoleAccessDenied),
364
+ _ts_metadata("design:type", Function),
365
+ _ts_metadata("design:paramtypes", [
366
+ typeof import_core.HttpAdapterHost === "undefined" ? Object : import_core.HttpAdapterHost
367
+ ])
368
+ ], ConsoleAuthorizeFilter);
369
+ var UseConsoleAuthorize = /* @__PURE__ */ __name(() => (0, import_common.applyDecorators)((0, import_common.UseGuards)(ConsoleAuthorizeGuard), (0, import_common.UseFilters)(ConsoleAuthorizeFilter)), "UseConsoleAuthorize");
370
+
371
+ // src/server/dashboard.service.ts
372
+ var import_nestjs_durable_core = require("@dudousxd/nestjs-durable-core");
373
+ var import_common2 = require("@nestjs/common");
374
+ var import_rxjs = require("rxjs");
375
+ function _ts_decorate2(decorators, target, key, desc) {
376
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
377
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
378
+ r = Reflect.decorate(decorators, target, key, desc);
379
+ } else {
380
+ for (var i = decorators.length - 1; i >= 0; i--) {
381
+ if (d = decorators[i]) {
382
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
383
+ }
384
+ }
385
+ }
386
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
387
+ }
388
+ __name(_ts_decorate2, "_ts_decorate");
389
+ function _ts_metadata2(metadataKey, metadataValue) {
390
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
391
+ return Reflect.metadata(metadataKey, metadataValue);
392
+ }
393
+ }
394
+ __name(_ts_metadata2, "_ts_metadata");
395
+ function _ts_param2(paramIndex, decorator) {
396
+ return function(target, key) {
397
+ decorator(target, key, paramIndex);
398
+ };
399
+ }
400
+ __name(_ts_param2, "_ts_param");
69
401
  var DashboardService = class {
70
402
  static {
71
403
  __name(this, "DashboardService");
@@ -90,7 +422,7 @@ var DashboardService = class {
90
422
  */
91
423
  controlPlane() {
92
424
  if (!this.store || !this.engine) {
93
- 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).");
94
426
  }
95
427
  return {
96
428
  store: this.store,
@@ -339,13 +671,13 @@ var DashboardService = class {
339
671
  });
340
672
  }
341
673
  };
342
- DashboardService = _ts_decorate([
343
- (0, import_common.Injectable)(),
344
- _ts_param(1, (0, import_common.Optional)()),
345
- _ts_param(1, (0, import_common.Inject)(import_nestjs_durable_core.STATE_STORE_CANONICAL)),
346
- _ts_param(2, (0, import_common.Optional)()),
347
- _ts_metadata("design:type", Function),
348
- _ts_metadata("design:paramtypes", [
674
+ DashboardService = _ts_decorate2([
675
+ (0, import_common2.Injectable)(),
676
+ _ts_param2(1, (0, import_common2.Optional)()),
677
+ _ts_param2(1, (0, import_common2.Inject)(import_nestjs_durable_core.STATE_STORE_CANONICAL)),
678
+ _ts_param2(2, (0, import_common2.Optional)()),
679
+ _ts_metadata2("design:type", Function),
680
+ _ts_metadata2("design:paramtypes", [
349
681
  typeof import_nestjs_durable_core.RunGateway === "undefined" ? Object : import_nestjs_durable_core.RunGateway,
350
682
  typeof StateStore === "undefined" ? Object : StateStore,
351
683
  typeof import_nestjs_durable_core.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core.WorkflowEngine
@@ -354,7 +686,7 @@ DashboardService = _ts_decorate([
354
686
 
355
687
  // src/server/durable-api.controller.ts
356
688
  var import_nestjs_filter2 = require("@dudousxd/nestjs-filter");
357
- var import_common5 = require("@nestjs/common");
689
+ var import_common6 = require("@nestjs/common");
358
690
 
359
691
  // src/server/durable-run.ts
360
692
  var DurableRun = class {
@@ -430,8 +762,8 @@ function runValueAxisFor(field) {
430
762
  __name(runValueAxisFor, "runValueAxisFor");
431
763
 
432
764
  // src/server/not-modified.ts
433
- var import_common2 = require("@nestjs/common");
434
- function _ts_decorate2(decorators, target, key, desc) {
765
+ var import_common3 = require("@nestjs/common");
766
+ function _ts_decorate3(decorators, target, key, desc) {
435
767
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
436
768
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
437
769
  r = Reflect.decorate(decorators, target, key, desc);
@@ -444,7 +776,7 @@ function _ts_decorate2(decorators, target, key, desc) {
444
776
  }
445
777
  return c > 3 && r && Object.defineProperty(target, key, r), r;
446
778
  }
447
- __name(_ts_decorate2, "_ts_decorate");
779
+ __name(_ts_decorate3, "_ts_decorate");
448
780
  function isRawResponse(value) {
449
781
  if (typeof value !== "object" || value === null) return false;
450
782
  const candidate = value;
@@ -470,7 +802,7 @@ function writeNotModifiedRaw(response, etag) {
470
802
  raw.end();
471
803
  }
472
804
  __name(writeNotModifiedRaw, "writeNotModifiedRaw");
473
- var NotModifiedException = class extends import_common2.HttpException {
805
+ var NotModifiedException = class extends import_common3.HttpException {
474
806
  static {
475
807
  __name(this, "NotModifiedException");
476
808
  }
@@ -487,8 +819,8 @@ var NotModifiedFilter = class {
487
819
  writeNotModifiedRaw(host.switchToHttp().getResponse(), exception.etag);
488
820
  }
489
821
  };
490
- NotModifiedFilter = _ts_decorate2([
491
- (0, import_common2.Catch)(NotModifiedException)
822
+ NotModifiedFilter = _ts_decorate3([
823
+ (0, import_common3.Catch)(NotModifiedException)
492
824
  ], NotModifiedFilter);
493
825
  function setEtag(response, etag) {
494
826
  setRawHeader(response, "etag", etag);
@@ -505,7 +837,7 @@ __name(toRunListRow, "toRunListRow");
505
837
 
506
838
  // src/server/run.filter.ts
507
839
  var import_nestjs_filter = require("@dudousxd/nestjs-filter");
508
- var import_common4 = require("@nestjs/common");
840
+ var import_common5 = require("@nestjs/common");
509
841
 
510
842
  // src/server/attr-filter.ts
511
843
  var SCALAR_OPS = /* @__PURE__ */ new Set([
@@ -556,7 +888,7 @@ __name(parseAttrFilters, "parseAttrFilters");
556
888
 
557
889
  // src/server/run-query.adapter.ts
558
890
  var import_nestjs_durable_core2 = require("@dudousxd/nestjs-durable-core");
559
- var import_common3 = require("@nestjs/common");
891
+ var import_common4 = require("@nestjs/common");
560
892
 
561
893
  // src/server/run-query-draft.ts
562
894
  var RunQueryDraft2 = class {
@@ -586,7 +918,7 @@ var RunQueryDraft2 = class {
586
918
  };
587
919
 
588
920
  // src/server/run-query.adapter.ts
589
- function _ts_decorate3(decorators, target, key, desc) {
921
+ function _ts_decorate4(decorators, target, key, desc) {
590
922
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
591
923
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
592
924
  r = Reflect.decorate(decorators, target, key, desc);
@@ -599,13 +931,13 @@ function _ts_decorate3(decorators, target, key, desc) {
599
931
  }
600
932
  return c > 3 && r && Object.defineProperty(target, key, r), r;
601
933
  }
602
- __name(_ts_decorate3, "_ts_decorate");
603
- function _ts_metadata2(metadataKey, metadataValue) {
934
+ __name(_ts_decorate4, "_ts_decorate");
935
+ function _ts_metadata3(metadataKey, metadataValue) {
604
936
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
605
937
  return Reflect.metadata(metadataKey, metadataValue);
606
938
  }
607
939
  }
608
- __name(_ts_metadata2, "_ts_metadata");
940
+ __name(_ts_metadata3, "_ts_metadata");
609
941
  var RUN_QUERY_ADAPTER = Symbol("DURABLE_RUN_QUERY_ADAPTER");
610
942
  var FIXED_ORDER = {
611
943
  field: "createdAt",
@@ -627,7 +959,7 @@ function operands(clause) {
627
959
  }
628
960
  __name(operands, "operands");
629
961
  function unsupported(clause, supported) {
630
- throw new import_common3.BadRequestException(`The durable run list cannot filter \`${clause.field}\` with \`${clause.operator}\`. Supported here: ${supported}.`);
962
+ throw new import_common4.BadRequestException(`The durable run list cannot filter \`${clause.field}\` with \`${clause.operator}\`. Supported here: ${supported}.`);
631
963
  }
632
964
  __name(unsupported, "unsupported");
633
965
  var RunQueryAdapter = class {
@@ -665,7 +997,7 @@ var RunQueryAdapter = class {
665
997
  const draft = this.draft(qb);
666
998
  for (const clause of filters) {
667
999
  if (clause.AND || clause.OR) {
668
- throw new import_common3.BadRequestException("The durable run list cannot filter with nested AND/OR groups: its predicates are a flat conjunction.");
1000
+ throw new import_common4.BadRequestException("The durable run list cannot filter with nested AND/OR groups: its predicates are a flat conjunction.");
669
1001
  }
670
1002
  this.applyClause(draft, clause);
671
1003
  }
@@ -756,7 +1088,7 @@ var RunQueryAdapter = class {
756
1088
  applyAttributeClause(draft, clause) {
757
1089
  const key = clause.field.slice(ATTRIBUTE_FIELD.length + 1);
758
1090
  if (!key) {
759
- throw new import_common3.BadRequestException("Filtering search attributes needs a key: `attr.<key>`, e.g. `attr.tier`.");
1091
+ throw new import_common4.BadRequestException("Filtering search attributes needs a key: `attr.<key>`, e.g. `attr.tier`.");
760
1092
  }
761
1093
  const scalarOps = {
762
1094
  equals: "eq",
@@ -800,7 +1132,7 @@ var RunQueryAdapter = class {
800
1132
  applySort(_qb, sorts) {
801
1133
  for (const sort of sorts) {
802
1134
  if (sort.field !== FIXED_ORDER.field || sort.direction !== FIXED_ORDER.direction) {
803
- throw new import_common3.BadRequestException(`The durable run list is always ordered \`${FIXED_ORDER.field} ${FIXED_ORDER.direction}\` and cannot be sorted by \`${sort.field} ${sort.direction}\`.`);
1135
+ throw new import_common4.BadRequestException(`The durable run list is always ordered \`${FIXED_ORDER.field} ${FIXED_ORDER.direction}\` and cannot be sorted by \`${sort.field} ${sort.direction}\`.`);
804
1136
  }
805
1137
  }
806
1138
  }
@@ -841,14 +1173,14 @@ var RunQueryAdapter = class {
841
1173
  async groupByCount(qb, field, entity, opts) {
842
1174
  this.assertDurableRun(entity);
843
1175
  if (typeof field !== "string") {
844
- throw new import_common3.BadRequestException("The durable run list has no computed fields to group by \u2014 group by one of its own fields.");
1176
+ throw new import_common4.BadRequestException("The durable run list has no computed fields to group by \u2014 group by one of its own fields.");
845
1177
  }
846
1178
  if (opts?.bucket !== void 0) {
847
- throw new import_common3.BadRequestException("The durable run list cannot bucket a group-by-count: none of its filterable fields is numeric.");
1179
+ throw new import_common4.BadRequestException("The durable run list cannot bucket a group-by-count: none of its filterable fields is numeric.");
848
1180
  }
849
1181
  const axis = runValueAxisFor(field);
850
1182
  if (!axis) {
851
- throw new import_common3.BadRequestException(`The durable run list cannot enumerate values of \`${field}\`.`);
1183
+ throw new import_common4.BadRequestException(`The durable run list cannot enumerate values of \`${field}\`.`);
852
1184
  }
853
1185
  const rows = await this.gateway.runValueFacets(axis, this.draft(qb).facetQuery(), {
854
1186
  limit: opts?.limit ?? import_nestjs_durable_core2.RUN_VALUE_FACET_LIMIT,
@@ -879,16 +1211,16 @@ var RunQueryAdapter = class {
879
1211
  }
880
1212
  }
881
1213
  };
882
- RunQueryAdapter = _ts_decorate3([
883
- (0, import_common3.Injectable)(),
884
- _ts_metadata2("design:type", Function),
885
- _ts_metadata2("design:paramtypes", [
1214
+ RunQueryAdapter = _ts_decorate4([
1215
+ (0, import_common4.Injectable)(),
1216
+ _ts_metadata3("design:type", Function),
1217
+ _ts_metadata3("design:paramtypes", [
886
1218
  typeof import_nestjs_durable_core2.RunGateway === "undefined" ? Object : import_nestjs_durable_core2.RunGateway
887
1219
  ])
888
1220
  ], RunQueryAdapter);
889
1221
 
890
1222
  // src/server/run.filter.ts
891
- function _ts_decorate4(decorators, target, key, desc) {
1223
+ function _ts_decorate5(decorators, target, key, desc) {
892
1224
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
893
1225
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
894
1226
  r = Reflect.decorate(decorators, target, key, desc);
@@ -901,13 +1233,13 @@ function _ts_decorate4(decorators, target, key, desc) {
901
1233
  }
902
1234
  return c > 3 && r && Object.defineProperty(target, key, r), r;
903
1235
  }
904
- __name(_ts_decorate4, "_ts_decorate");
905
- function _ts_metadata3(metadataKey, metadataValue) {
1236
+ __name(_ts_decorate5, "_ts_decorate");
1237
+ function _ts_metadata4(metadataKey, metadataValue) {
906
1238
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
907
1239
  return Reflect.metadata(metadataKey, metadataValue);
908
1240
  }
909
1241
  }
910
- __name(_ts_metadata3, "_ts_metadata");
1242
+ __name(_ts_metadata4, "_ts_metadata");
911
1243
  function list(value) {
912
1244
  return (Array.isArray(value) ? value : [
913
1245
  value
@@ -1027,76 +1359,76 @@ var RunFilter = class extends import_nestjs_filter.BaseFilter {
1027
1359
  });
1028
1360
  }
1029
1361
  };
1030
- _ts_decorate4([
1362
+ _ts_decorate5([
1031
1363
  (0, import_nestjs_filter.FilterFor)("status"),
1032
- _ts_metadata3("design:type", Function),
1033
- _ts_metadata3("design:paramtypes", [
1364
+ _ts_metadata4("design:type", Function),
1365
+ _ts_metadata4("design:paramtypes", [
1034
1366
  Object
1035
1367
  ]),
1036
- _ts_metadata3("design:returntype", void 0)
1368
+ _ts_metadata4("design:returntype", void 0)
1037
1369
  ], RunFilter.prototype, "applyStatus", null);
1038
- _ts_decorate4([
1370
+ _ts_decorate5([
1039
1371
  (0, import_nestjs_filter.FilterFor)("workflow"),
1040
- _ts_metadata3("design:type", Function),
1041
- _ts_metadata3("design:paramtypes", [
1372
+ _ts_metadata4("design:type", Function),
1373
+ _ts_metadata4("design:paramtypes", [
1042
1374
  Object
1043
1375
  ]),
1044
- _ts_metadata3("design:returntype", void 0)
1376
+ _ts_metadata4("design:returntype", void 0)
1045
1377
  ], RunFilter.prototype, "applyWorkflow", null);
1046
- _ts_decorate4([
1378
+ _ts_decorate5([
1047
1379
  (0, import_nestjs_filter.FilterFor)("namespace"),
1048
- _ts_metadata3("design:type", Function),
1049
- _ts_metadata3("design:paramtypes", [
1380
+ _ts_metadata4("design:type", Function),
1381
+ _ts_metadata4("design:paramtypes", [
1050
1382
  Object
1051
1383
  ]),
1052
- _ts_metadata3("design:returntype", void 0)
1384
+ _ts_metadata4("design:returntype", void 0)
1053
1385
  ], RunFilter.prototype, "applyNamespace", null);
1054
- _ts_decorate4([
1386
+ _ts_decorate5([
1055
1387
  (0, import_nestjs_filter.FilterFor)("tag"),
1056
- _ts_metadata3("design:type", Function),
1057
- _ts_metadata3("design:paramtypes", [
1388
+ _ts_metadata4("design:type", Function),
1389
+ _ts_metadata4("design:paramtypes", [
1058
1390
  Object
1059
1391
  ]),
1060
- _ts_metadata3("design:returntype", void 0)
1392
+ _ts_metadata4("design:returntype", void 0)
1061
1393
  ], RunFilter.prototype, "applyTag", null);
1062
- _ts_decorate4([
1394
+ _ts_decorate5([
1063
1395
  (0, import_nestjs_filter.FilterFor)("origin"),
1064
- _ts_metadata3("design:type", Function),
1065
- _ts_metadata3("design:paramtypes", []),
1066
- _ts_metadata3("design:returntype", void 0)
1396
+ _ts_metadata4("design:type", Function),
1397
+ _ts_metadata4("design:paramtypes", []),
1398
+ _ts_metadata4("design:returntype", void 0)
1067
1399
  ], RunFilter.prototype, "applyOrigin", null);
1068
- _ts_decorate4([
1400
+ _ts_decorate5([
1069
1401
  (0, import_nestjs_filter.FilterFor)("unattributed"),
1070
- _ts_metadata3("design:type", Function),
1071
- _ts_metadata3("design:paramtypes", []),
1072
- _ts_metadata3("design:returntype", void 0)
1402
+ _ts_metadata4("design:type", Function),
1403
+ _ts_metadata4("design:paramtypes", []),
1404
+ _ts_metadata4("design:returntype", void 0)
1073
1405
  ], RunFilter.prototype, "applyUnattributed", null);
1074
- _ts_decorate4([
1406
+ _ts_decorate5([
1075
1407
  (0, import_nestjs_filter.FilterFor)("attr"),
1076
- _ts_metadata3("design:type", Function),
1077
- _ts_metadata3("design:paramtypes", [
1408
+ _ts_metadata4("design:type", Function),
1409
+ _ts_metadata4("design:paramtypes", [
1078
1410
  Object
1079
1411
  ]),
1080
- _ts_metadata3("design:returntype", void 0)
1412
+ _ts_metadata4("design:returntype", void 0)
1081
1413
  ], RunFilter.prototype, "applyAttributes", null);
1082
- _ts_decorate4([
1414
+ _ts_decorate5([
1083
1415
  (0, import_nestjs_filter.FilterFor)("limit"),
1084
- _ts_metadata3("design:type", Function),
1085
- _ts_metadata3("design:paramtypes", [
1416
+ _ts_metadata4("design:type", Function),
1417
+ _ts_metadata4("design:paramtypes", [
1086
1418
  Object
1087
1419
  ]),
1088
- _ts_metadata3("design:returntype", void 0)
1420
+ _ts_metadata4("design:returntype", void 0)
1089
1421
  ], RunFilter.prototype, "applyLimit", null);
1090
- _ts_decorate4([
1422
+ _ts_decorate5([
1091
1423
  (0, import_nestjs_filter.FilterFor)("offset"),
1092
- _ts_metadata3("design:type", Function),
1093
- _ts_metadata3("design:paramtypes", [
1424
+ _ts_metadata4("design:type", Function),
1425
+ _ts_metadata4("design:paramtypes", [
1094
1426
  Object
1095
1427
  ]),
1096
- _ts_metadata3("design:returntype", void 0)
1428
+ _ts_metadata4("design:returntype", void 0)
1097
1429
  ], RunFilter.prototype, "applyOffset", null);
1098
- RunFilter = _ts_decorate4([
1099
- (0, import_common4.Injectable)(),
1430
+ RunFilter = _ts_decorate5([
1431
+ (0, import_common5.Injectable)(),
1100
1432
  (0, import_nestjs_filter.Filterable)({
1101
1433
  entity: DurableRun,
1102
1434
  adapter: RUN_QUERY_ADAPTER,
@@ -1105,7 +1437,7 @@ RunFilter = _ts_decorate4([
1105
1437
  ], RunFilter);
1106
1438
 
1107
1439
  // src/server/durable-api.controller.ts
1108
- function _ts_decorate5(decorators, target, key, desc) {
1440
+ function _ts_decorate6(decorators, target, key, desc) {
1109
1441
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1110
1442
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
1111
1443
  r = Reflect.decorate(decorators, target, key, desc);
@@ -1118,19 +1450,19 @@ function _ts_decorate5(decorators, target, key, desc) {
1118
1450
  }
1119
1451
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1120
1452
  }
1121
- __name(_ts_decorate5, "_ts_decorate");
1122
- function _ts_metadata4(metadataKey, metadataValue) {
1453
+ __name(_ts_decorate6, "_ts_decorate");
1454
+ function _ts_metadata5(metadataKey, metadataValue) {
1123
1455
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
1124
1456
  return Reflect.metadata(metadataKey, metadataValue);
1125
1457
  }
1126
1458
  }
1127
- __name(_ts_metadata4, "_ts_metadata");
1128
- function _ts_param2(paramIndex, decorator) {
1459
+ __name(_ts_metadata5, "_ts_metadata");
1460
+ function _ts_param3(paramIndex, decorator) {
1129
1461
  return function(target, key) {
1130
1462
  decorator(target, key, paramIndex);
1131
1463
  };
1132
1464
  }
1133
- __name(_ts_param2, "_ts_param");
1465
+ __name(_ts_param3, "_ts_param");
1134
1466
  var FAN_INLINE_MAX = 50;
1135
1467
  var DurableApiControllerBase = class {
1136
1468
  static {
@@ -1232,7 +1564,7 @@ var DurableApiControllerBase = class {
1232
1564
  */
1233
1565
  async workflowLifecycle(name) {
1234
1566
  const links = await this.dashboard.workflowLifecycle(name).catch(notSupportedByServer);
1235
- if (!links) throw new import_common5.NotImplementedException("workflow lifecycle links need the control plane");
1567
+ if (!links) throw new import_common6.NotImplementedException("workflow lifecycle links need the control plane");
1236
1568
  return links;
1237
1569
  }
1238
1570
  /** This deployment's durable role (control plane vs tenant) + tenant name — for the header badge. */
@@ -1254,7 +1586,7 @@ var DurableApiControllerBase = class {
1254
1586
  ifNoneMatch
1255
1587
  }
1256
1588
  });
1257
- if (!detail) throw new import_common5.NotFoundException(`run ${id} not found`);
1589
+ if (!detail) throw new import_common6.NotFoundException(`run ${id} not found`);
1258
1590
  const { etag, notModified, ...body } = detail;
1259
1591
  if (etag) {
1260
1592
  if (notModified) throw new NotModifiedException(etag);
@@ -1272,7 +1604,7 @@ var DurableApiControllerBase = class {
1272
1604
  ifNoneMatch
1273
1605
  }
1274
1606
  });
1275
- if (!page) throw new import_common5.NotFoundException(`fan ${group} of run ${id} not found`);
1607
+ if (!page) throw new import_common6.NotFoundException(`fan ${group} of run ${id} not found`);
1276
1608
  const { etag, notModified, ...body } = page;
1277
1609
  if (etag) {
1278
1610
  if (notModified) throw new NotModifiedException(etag);
@@ -1307,7 +1639,7 @@ var DurableApiControllerBase = class {
1307
1639
  const result = await this.dashboard.cancel(id, {
1308
1640
  compensate: compensate === "true"
1309
1641
  });
1310
- if (!result) throw new import_common5.NotFoundException(`run ${id} not found`);
1642
+ if (!result) throw new import_common6.NotFoundException(`run ${id} not found`);
1311
1643
  return result;
1312
1644
  }
1313
1645
  /**
@@ -1320,38 +1652,38 @@ var DurableApiControllerBase = class {
1320
1652
  result = await this.dashboard.republishLifecycle(id, body?.subscriber || void 0);
1321
1653
  } catch (error) {
1322
1654
  const message = error instanceof Error ? error.message : String(error);
1323
- if (/^run .* not found$/.test(message)) throw new import_common5.NotFoundException(message);
1324
- if (/^run .* has not settled/.test(message)) throw new import_common5.BadRequestException(message);
1655
+ if (/^run .* not found$/.test(message)) throw new import_common6.NotFoundException(message);
1656
+ if (/^run .* has not settled/.test(message)) throw new import_common6.BadRequestException(message);
1325
1657
  if (error?.code === "bad-request") {
1326
- throw new import_common5.BadRequestException(message);
1658
+ throw new import_common6.BadRequestException(message);
1327
1659
  }
1328
1660
  return notSupportedByServer(error);
1329
1661
  }
1330
1662
  if (!result) {
1331
- throw new import_common5.NotImplementedException("republishing lifecycle events needs the control plane");
1663
+ throw new import_common6.NotImplementedException("republishing lifecycle events needs the control plane");
1332
1664
  }
1333
1665
  return result;
1334
1666
  }
1335
1667
  async continue(id) {
1336
1668
  const result = await this.dashboard.continue(id);
1337
- if (!result) throw new import_common5.NotFoundException(`run ${id} is not paused at a breakpoint`);
1669
+ if (!result) throw new import_common6.NotFoundException(`run ${id} is not paused at a breakpoint`);
1338
1670
  return result;
1339
1671
  }
1340
1672
  /** Re-dispatch a run's stuck `pending` remote steps — recovery for a lost step dispatch. */
1341
1673
  async redispatch(id) {
1342
1674
  const result = await this.dashboard.redispatch(id);
1343
- if (!result) throw new import_common5.NotFoundException(`run ${id} not found`);
1675
+ if (!result) throw new import_common6.NotFoundException(`run ${id} not found`);
1344
1676
  return result;
1345
1677
  }
1346
1678
  /**
1347
1679
  * Public callback endpoint for `ctx.webhook()`: a third party POSTs here (the url handed to it),
1348
- * and the body resumes the waiting run. NOTE: this is reachable by external systems — protect it
1349
- * by treating the token as a secret (it embeds runId:seq) and/or fronting it with signature
1350
- * 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.
1351
1683
  */
1352
1684
  async webhook(token, body) {
1353
1685
  const result = await this.dashboard.deliverWebhook(token, body);
1354
- if (!result) throw new import_common5.NotFoundException(`no live run is waiting for webhook ${token}`);
1686
+ if (!result) throw new import_common6.NotFoundException(`no live run is waiting for webhook ${token}`);
1355
1687
  return result;
1356
1688
  }
1357
1689
  /** Live query: the latest value a run published for `key` via `ctx.setEvent` (no side effect). */
@@ -1363,135 +1695,135 @@ var DurableApiControllerBase = class {
1363
1695
  return this.dashboard.update(id, name, body);
1364
1696
  }
1365
1697
  };
1366
- _ts_decorate5([
1367
- (0, import_common5.Get)("runs"),
1368
- _ts_param2(0, (0, import_nestjs_filter2.ApplyFilter)(RunFilter)),
1369
- _ts_metadata4("design:type", Function),
1370
- _ts_metadata4("design:paramtypes", [
1698
+ _ts_decorate6([
1699
+ (0, import_common6.Get)("runs"),
1700
+ _ts_param3(0, (0, import_nestjs_filter2.ApplyFilter)(RunFilter)),
1701
+ _ts_metadata5("design:type", Function),
1702
+ _ts_metadata5("design:paramtypes", [
1371
1703
  typeof RunQueryDraft === "undefined" ? Object : RunQueryDraft
1372
1704
  ]),
1373
- _ts_metadata4("design:returntype", Promise)
1705
+ _ts_metadata5("design:returntype", Promise)
1374
1706
  ], DurableApiControllerBase.prototype, "runs", null);
1375
- _ts_decorate5([
1376
- (0, import_common5.Get)("runs/facets"),
1377
- _ts_param2(0, (0, import_nestjs_filter2.ApplyFilter)(RunFilter)),
1378
- _ts_metadata4("design:type", Function),
1379
- _ts_metadata4("design:paramtypes", [
1707
+ _ts_decorate6([
1708
+ (0, import_common6.Get)("runs/facets"),
1709
+ _ts_param3(0, (0, import_nestjs_filter2.ApplyFilter)(RunFilter)),
1710
+ _ts_metadata5("design:type", Function),
1711
+ _ts_metadata5("design:paramtypes", [
1380
1712
  typeof RunQueryDraft === "undefined" ? Object : RunQueryDraft
1381
1713
  ]),
1382
- _ts_metadata4("design:returntype", void 0)
1714
+ _ts_metadata5("design:returntype", void 0)
1383
1715
  ], DurableApiControllerBase.prototype, "facets", null);
1384
- _ts_decorate5([
1385
- (0, import_common5.Get)("runs/values"),
1386
- _ts_param2(0, (0, import_common5.Query)()),
1387
- _ts_metadata4("design:type", Function),
1388
- _ts_metadata4("design:paramtypes", [
1716
+ _ts_decorate6([
1717
+ (0, import_common6.Get)("runs/values"),
1718
+ _ts_param3(0, (0, import_common6.Query)()),
1719
+ _ts_metadata5("design:type", Function),
1720
+ _ts_metadata5("design:paramtypes", [
1389
1721
  typeof Record === "undefined" ? Object : Record
1390
1722
  ]),
1391
- _ts_metadata4("design:returntype", void 0)
1723
+ _ts_metadata5("design:returntype", void 0)
1392
1724
  ], DurableApiControllerBase.prototype, "values", null);
1393
- _ts_decorate5([
1394
- (0, import_common5.Get)("metrics"),
1395
- (0, import_common5.Header)("Content-Type", "text/plain; version=0.0.4"),
1396
- _ts_metadata4("design:type", Function),
1397
- _ts_metadata4("design:paramtypes", []),
1398
- _ts_metadata4("design:returntype", void 0)
1725
+ _ts_decorate6([
1726
+ (0, import_common6.Get)("metrics"),
1727
+ (0, import_common6.Header)("Content-Type", "text/plain; version=0.0.4"),
1728
+ _ts_metadata5("design:type", Function),
1729
+ _ts_metadata5("design:paramtypes", []),
1730
+ _ts_metadata5("design:returntype", void 0)
1399
1731
  ], DurableApiControllerBase.prototype, "metrics", null);
1400
- _ts_decorate5([
1401
- (0, import_common5.Get)("workers"),
1402
- _ts_metadata4("design:type", Function),
1403
- _ts_metadata4("design:paramtypes", []),
1404
- _ts_metadata4("design:returntype", void 0)
1732
+ _ts_decorate6([
1733
+ (0, import_common6.Get)("workers"),
1734
+ _ts_metadata5("design:type", Function),
1735
+ _ts_metadata5("design:paramtypes", []),
1736
+ _ts_metadata5("design:returntype", void 0)
1405
1737
  ], DurableApiControllerBase.prototype, "workers", null);
1406
- _ts_decorate5([
1407
- (0, import_common5.Get)("schedules"),
1408
- _ts_param2(0, (0, import_common5.Query)("namespace")),
1409
- _ts_param2(1, (0, import_common5.Query)("workflow")),
1410
- _ts_param2(2, (0, import_common5.Query)("tag")),
1411
- _ts_param2(3, (0, import_common5.Query)("paused")),
1412
- _ts_param2(4, (0, import_common5.Query)("limit")),
1413
- _ts_metadata4("design:type", Function),
1414
- _ts_metadata4("design:paramtypes", [
1738
+ _ts_decorate6([
1739
+ (0, import_common6.Get)("schedules"),
1740
+ _ts_param3(0, (0, import_common6.Query)("namespace")),
1741
+ _ts_param3(1, (0, import_common6.Query)("workflow")),
1742
+ _ts_param3(2, (0, import_common6.Query)("tag")),
1743
+ _ts_param3(3, (0, import_common6.Query)("paused")),
1744
+ _ts_param3(4, (0, import_common6.Query)("limit")),
1745
+ _ts_metadata5("design:type", Function),
1746
+ _ts_metadata5("design:paramtypes", [
1415
1747
  String,
1416
1748
  String,
1417
1749
  String,
1418
1750
  String,
1419
1751
  String
1420
1752
  ]),
1421
- _ts_metadata4("design:returntype", void 0)
1753
+ _ts_metadata5("design:returntype", void 0)
1422
1754
  ], DurableApiControllerBase.prototype, "schedules", null);
1423
- _ts_decorate5([
1424
- (0, import_common5.Post)("schedules/:id/pause"),
1425
- _ts_param2(0, (0, import_common5.Param)("id")),
1426
- _ts_metadata4("design:type", Function),
1427
- _ts_metadata4("design:paramtypes", [
1755
+ _ts_decorate6([
1756
+ (0, import_common6.Post)("schedules/:id/pause"),
1757
+ _ts_param3(0, (0, import_common6.Param)("id")),
1758
+ _ts_metadata5("design:type", Function),
1759
+ _ts_metadata5("design:paramtypes", [
1428
1760
  String
1429
1761
  ]),
1430
- _ts_metadata4("design:returntype", void 0)
1762
+ _ts_metadata5("design:returntype", void 0)
1431
1763
  ], DurableApiControllerBase.prototype, "pauseSchedule", null);
1432
- _ts_decorate5([
1433
- (0, import_common5.Post)("schedules/:id/resume"),
1434
- _ts_param2(0, (0, import_common5.Param)("id")),
1435
- _ts_metadata4("design:type", Function),
1436
- _ts_metadata4("design:paramtypes", [
1764
+ _ts_decorate6([
1765
+ (0, import_common6.Post)("schedules/:id/resume"),
1766
+ _ts_param3(0, (0, import_common6.Param)("id")),
1767
+ _ts_metadata5("design:type", Function),
1768
+ _ts_metadata5("design:paramtypes", [
1437
1769
  String
1438
1770
  ]),
1439
- _ts_metadata4("design:returntype", void 0)
1771
+ _ts_metadata5("design:returntype", void 0)
1440
1772
  ], DurableApiControllerBase.prototype, "resumeSchedule", null);
1441
- _ts_decorate5([
1442
- (0, import_common5.Post)("schedules/:id/trigger"),
1443
- _ts_param2(0, (0, import_common5.Param)("id")),
1444
- _ts_metadata4("design:type", Function),
1445
- _ts_metadata4("design:paramtypes", [
1773
+ _ts_decorate6([
1774
+ (0, import_common6.Post)("schedules/:id/trigger"),
1775
+ _ts_param3(0, (0, import_common6.Param)("id")),
1776
+ _ts_metadata5("design:type", Function),
1777
+ _ts_metadata5("design:paramtypes", [
1446
1778
  String
1447
1779
  ]),
1448
- _ts_metadata4("design:returntype", void 0)
1780
+ _ts_metadata5("design:returntype", void 0)
1449
1781
  ], DurableApiControllerBase.prototype, "triggerSchedule", null);
1450
- _ts_decorate5([
1451
- (0, import_common5.Get)("workflows/:name/lifecycle"),
1452
- _ts_param2(0, (0, import_common5.Param)("name")),
1453
- _ts_metadata4("design:type", Function),
1454
- _ts_metadata4("design:paramtypes", [
1782
+ _ts_decorate6([
1783
+ (0, import_common6.Get)("workflows/:name/lifecycle"),
1784
+ _ts_param3(0, (0, import_common6.Param)("name")),
1785
+ _ts_metadata5("design:type", Function),
1786
+ _ts_metadata5("design:paramtypes", [
1455
1787
  String
1456
1788
  ]),
1457
- _ts_metadata4("design:returntype", Promise)
1789
+ _ts_metadata5("design:returntype", Promise)
1458
1790
  ], DurableApiControllerBase.prototype, "workflowLifecycle", null);
1459
- _ts_decorate5([
1460
- (0, import_common5.Get)("topology"),
1461
- _ts_metadata4("design:type", Function),
1462
- _ts_metadata4("design:paramtypes", []),
1463
- _ts_metadata4("design:returntype", void 0)
1791
+ _ts_decorate6([
1792
+ (0, import_common6.Get)("topology"),
1793
+ _ts_metadata5("design:type", Function),
1794
+ _ts_metadata5("design:paramtypes", []),
1795
+ _ts_metadata5("design:returntype", void 0)
1464
1796
  ], DurableApiControllerBase.prototype, "topology", null);
1465
- _ts_decorate5([
1466
- (0, import_common5.Get)("runs/:id"),
1467
- _ts_param2(0, (0, import_common5.Param)("id")),
1468
- _ts_param2(1, (0, import_common5.Query)("full")),
1469
- _ts_param2(2, (0, import_common5.Headers)("if-none-match")),
1470
- _ts_param2(3, (0, import_common5.Res)({
1797
+ _ts_decorate6([
1798
+ (0, import_common6.Get)("runs/:id"),
1799
+ _ts_param3(0, (0, import_common6.Param)("id")),
1800
+ _ts_param3(1, (0, import_common6.Query)("full")),
1801
+ _ts_param3(2, (0, import_common6.Headers)("if-none-match")),
1802
+ _ts_param3(3, (0, import_common6.Res)({
1471
1803
  passthrough: true
1472
1804
  })),
1473
- _ts_metadata4("design:type", Function),
1474
- _ts_metadata4("design:paramtypes", [
1805
+ _ts_metadata5("design:type", Function),
1806
+ _ts_metadata5("design:paramtypes", [
1475
1807
  String,
1476
1808
  String,
1477
1809
  String,
1478
1810
  Object
1479
1811
  ]),
1480
- _ts_metadata4("design:returntype", Promise)
1812
+ _ts_metadata5("design:returntype", Promise)
1481
1813
  ], DurableApiControllerBase.prototype, "run", null);
1482
- _ts_decorate5([
1483
- (0, import_common5.Get)("runs/:id/fans/:group"),
1484
- _ts_param2(0, (0, import_common5.Param)("id")),
1485
- _ts_param2(1, (0, import_common5.Param)("group")),
1486
- _ts_param2(2, (0, import_common5.Query)("offset")),
1487
- _ts_param2(3, (0, import_common5.Query)("limit")),
1488
- _ts_param2(4, (0, import_common5.Query)("failed")),
1489
- _ts_param2(5, (0, import_common5.Headers)("if-none-match")),
1490
- _ts_param2(6, (0, import_common5.Res)({
1814
+ _ts_decorate6([
1815
+ (0, import_common6.Get)("runs/:id/fans/:group"),
1816
+ _ts_param3(0, (0, import_common6.Param)("id")),
1817
+ _ts_param3(1, (0, import_common6.Param)("group")),
1818
+ _ts_param3(2, (0, import_common6.Query)("offset")),
1819
+ _ts_param3(3, (0, import_common6.Query)("limit")),
1820
+ _ts_param3(4, (0, import_common6.Query)("failed")),
1821
+ _ts_param3(5, (0, import_common6.Headers)("if-none-match")),
1822
+ _ts_param3(6, (0, import_common6.Res)({
1491
1823
  passthrough: true
1492
1824
  })),
1493
- _ts_metadata4("design:type", Function),
1494
- _ts_metadata4("design:paramtypes", [
1825
+ _ts_metadata5("design:type", Function),
1826
+ _ts_metadata5("design:paramtypes", [
1495
1827
  String,
1496
1828
  String,
1497
1829
  String,
@@ -1500,145 +1832,146 @@ _ts_decorate5([
1500
1832
  String,
1501
1833
  Object
1502
1834
  ]),
1503
- _ts_metadata4("design:returntype", Promise)
1835
+ _ts_metadata5("design:returntype", Promise)
1504
1836
  ], DurableApiControllerBase.prototype, "fanMembers", null);
1505
- _ts_decorate5([
1506
- (0, import_common5.Sse)("runs/:id/stream"),
1507
- _ts_param2(0, (0, import_common5.Param)("id")),
1508
- _ts_metadata4("design:type", Function),
1509
- _ts_metadata4("design:paramtypes", [
1837
+ _ts_decorate6([
1838
+ (0, import_common6.Sse)("runs/:id/stream"),
1839
+ _ts_param3(0, (0, import_common6.Param)("id")),
1840
+ _ts_metadata5("design:type", Function),
1841
+ _ts_metadata5("design:paramtypes", [
1510
1842
  String
1511
1843
  ]),
1512
- _ts_metadata4("design:returntype", void 0)
1844
+ _ts_metadata5("design:returntype", void 0)
1513
1845
  ], DurableApiControllerBase.prototype, "stream", null);
1514
- _ts_decorate5([
1515
- (0, import_common5.Post)("runs/:id/retry"),
1516
- _ts_param2(0, (0, import_common5.Param)("id")),
1517
- _ts_metadata4("design:type", Function),
1518
- _ts_metadata4("design:paramtypes", [
1846
+ _ts_decorate6([
1847
+ (0, import_common6.Post)("runs/:id/retry"),
1848
+ _ts_param3(0, (0, import_common6.Param)("id")),
1849
+ _ts_metadata5("design:type", Function),
1850
+ _ts_metadata5("design:paramtypes", [
1519
1851
  String
1520
1852
  ]),
1521
- _ts_metadata4("design:returntype", void 0)
1853
+ _ts_metadata5("design:returntype", void 0)
1522
1854
  ], DurableApiControllerBase.prototype, "retry", null);
1523
- _ts_decorate5([
1524
- (0, import_common5.Post)("runs/:id/retry-with-input"),
1525
- _ts_param2(0, (0, import_common5.Param)("id")),
1526
- _ts_param2(1, (0, import_common5.Body)()),
1527
- _ts_metadata4("design:type", Function),
1528
- _ts_metadata4("design:paramtypes", [
1855
+ _ts_decorate6([
1856
+ (0, import_common6.Post)("runs/:id/retry-with-input"),
1857
+ _ts_param3(0, (0, import_common6.Param)("id")),
1858
+ _ts_param3(1, (0, import_common6.Body)()),
1859
+ _ts_metadata5("design:type", Function),
1860
+ _ts_metadata5("design:paramtypes", [
1529
1861
  String,
1530
1862
  Object
1531
1863
  ]),
1532
- _ts_metadata4("design:returntype", void 0)
1864
+ _ts_metadata5("design:returntype", void 0)
1533
1865
  ], DurableApiControllerBase.prototype, "retryWithInput", null);
1534
- _ts_decorate5([
1535
- (0, import_common5.Post)("bulk/:action"),
1536
- _ts_param2(0, (0, import_common5.Param)("action")),
1537
- _ts_param2(1, (0, import_nestjs_filter2.ApplyFilter)(RunFilter)),
1538
- _ts_param2(2, (0, import_common5.Query)("compensate")),
1539
- _ts_metadata4("design:type", Function),
1540
- _ts_metadata4("design:paramtypes", [
1866
+ _ts_decorate6([
1867
+ (0, import_common6.Post)("bulk/:action"),
1868
+ _ts_param3(0, (0, import_common6.Param)("action")),
1869
+ _ts_param3(1, (0, import_nestjs_filter2.ApplyFilter)(RunFilter)),
1870
+ _ts_param3(2, (0, import_common6.Query)("compensate")),
1871
+ _ts_metadata5("design:type", Function),
1872
+ _ts_metadata5("design:paramtypes", [
1541
1873
  String,
1542
1874
  typeof RunQueryDraft === "undefined" ? Object : RunQueryDraft,
1543
1875
  String
1544
1876
  ]),
1545
- _ts_metadata4("design:returntype", void 0)
1877
+ _ts_metadata5("design:returntype", void 0)
1546
1878
  ], DurableApiControllerBase.prototype, "bulk", null);
1547
- _ts_decorate5([
1548
- (0, import_common5.Post)("runs/:id/cancel"),
1549
- _ts_param2(0, (0, import_common5.Param)("id")),
1550
- _ts_param2(1, (0, import_common5.Query)("compensate")),
1551
- _ts_metadata4("design:type", Function),
1552
- _ts_metadata4("design:paramtypes", [
1879
+ _ts_decorate6([
1880
+ (0, import_common6.Post)("runs/:id/cancel"),
1881
+ _ts_param3(0, (0, import_common6.Param)("id")),
1882
+ _ts_param3(1, (0, import_common6.Query)("compensate")),
1883
+ _ts_metadata5("design:type", Function),
1884
+ _ts_metadata5("design:paramtypes", [
1553
1885
  String,
1554
1886
  String
1555
1887
  ]),
1556
- _ts_metadata4("design:returntype", Promise)
1888
+ _ts_metadata5("design:returntype", Promise)
1557
1889
  ], DurableApiControllerBase.prototype, "cancel", null);
1558
- _ts_decorate5([
1559
- (0, import_common5.Post)("runs/:id/republish-lifecycle"),
1560
- _ts_param2(0, (0, import_common5.Param)("id")),
1561
- _ts_param2(1, (0, import_common5.Body)()),
1562
- _ts_metadata4("design:type", Function),
1563
- _ts_metadata4("design:paramtypes", [
1890
+ _ts_decorate6([
1891
+ (0, import_common6.Post)("runs/:id/republish-lifecycle"),
1892
+ _ts_param3(0, (0, import_common6.Param)("id")),
1893
+ _ts_param3(1, (0, import_common6.Body)()),
1894
+ _ts_metadata5("design:type", Function),
1895
+ _ts_metadata5("design:paramtypes", [
1564
1896
  String,
1565
1897
  Object
1566
1898
  ]),
1567
- _ts_metadata4("design:returntype", Promise)
1899
+ _ts_metadata5("design:returntype", Promise)
1568
1900
  ], DurableApiControllerBase.prototype, "republishLifecycle", null);
1569
- _ts_decorate5([
1570
- (0, import_common5.Post)("runs/:id/continue"),
1571
- _ts_param2(0, (0, import_common5.Param)("id")),
1572
- _ts_metadata4("design:type", Function),
1573
- _ts_metadata4("design:paramtypes", [
1901
+ _ts_decorate6([
1902
+ (0, import_common6.Post)("runs/:id/continue"),
1903
+ _ts_param3(0, (0, import_common6.Param)("id")),
1904
+ _ts_metadata5("design:type", Function),
1905
+ _ts_metadata5("design:paramtypes", [
1574
1906
  String
1575
1907
  ]),
1576
- _ts_metadata4("design:returntype", Promise)
1908
+ _ts_metadata5("design:returntype", Promise)
1577
1909
  ], DurableApiControllerBase.prototype, "continue", null);
1578
- _ts_decorate5([
1579
- (0, import_common5.Post)("runs/:id/redispatch"),
1580
- _ts_param2(0, (0, import_common5.Param)("id")),
1581
- _ts_metadata4("design:type", Function),
1582
- _ts_metadata4("design:paramtypes", [
1910
+ _ts_decorate6([
1911
+ (0, import_common6.Post)("runs/:id/redispatch"),
1912
+ _ts_param3(0, (0, import_common6.Param)("id")),
1913
+ _ts_metadata5("design:type", Function),
1914
+ _ts_metadata5("design:paramtypes", [
1583
1915
  String
1584
1916
  ]),
1585
- _ts_metadata4("design:returntype", Promise)
1917
+ _ts_metadata5("design:returntype", Promise)
1586
1918
  ], DurableApiControllerBase.prototype, "redispatch", null);
1587
- _ts_decorate5([
1588
- (0, import_common5.Post)("webhooks/:token"),
1589
- _ts_param2(0, (0, import_common5.Param)("token")),
1590
- _ts_param2(1, (0, import_common5.Body)()),
1591
- _ts_metadata4("design:type", Function),
1592
- _ts_metadata4("design:paramtypes", [
1919
+ _ts_decorate6([
1920
+ ConsolePublic(),
1921
+ (0, import_common6.Post)("webhooks/:token"),
1922
+ _ts_param3(0, (0, import_common6.Param)("token")),
1923
+ _ts_param3(1, (0, import_common6.Body)()),
1924
+ _ts_metadata5("design:type", Function),
1925
+ _ts_metadata5("design:paramtypes", [
1593
1926
  String,
1594
1927
  Object
1595
1928
  ]),
1596
- _ts_metadata4("design:returntype", Promise)
1929
+ _ts_metadata5("design:returntype", Promise)
1597
1930
  ], DurableApiControllerBase.prototype, "webhook", null);
1598
- _ts_decorate5([
1599
- (0, import_common5.Get)("runs/:id/events/:key"),
1600
- _ts_param2(0, (0, import_common5.Param)("id")),
1601
- _ts_param2(1, (0, import_common5.Param)("key")),
1602
- _ts_metadata4("design:type", Function),
1603
- _ts_metadata4("design:paramtypes", [
1931
+ _ts_decorate6([
1932
+ (0, import_common6.Get)("runs/:id/events/:key"),
1933
+ _ts_param3(0, (0, import_common6.Param)("id")),
1934
+ _ts_param3(1, (0, import_common6.Param)("key")),
1935
+ _ts_metadata5("design:type", Function),
1936
+ _ts_metadata5("design:paramtypes", [
1604
1937
  String,
1605
1938
  String
1606
1939
  ]),
1607
- _ts_metadata4("design:returntype", void 0)
1940
+ _ts_metadata5("design:returntype", void 0)
1608
1941
  ], DurableApiControllerBase.prototype, "event", null);
1609
- _ts_decorate5([
1610
- (0, import_common5.Post)("runs/:id/updates/:name"),
1611
- _ts_param2(0, (0, import_common5.Param)("id")),
1612
- _ts_param2(1, (0, import_common5.Param)("name")),
1613
- _ts_param2(2, (0, import_common5.Body)()),
1614
- _ts_metadata4("design:type", Function),
1615
- _ts_metadata4("design:paramtypes", [
1942
+ _ts_decorate6([
1943
+ (0, import_common6.Post)("runs/:id/updates/:name"),
1944
+ _ts_param3(0, (0, import_common6.Param)("id")),
1945
+ _ts_param3(1, (0, import_common6.Param)("name")),
1946
+ _ts_param3(2, (0, import_common6.Body)()),
1947
+ _ts_metadata5("design:type", Function),
1948
+ _ts_metadata5("design:paramtypes", [
1616
1949
  String,
1617
1950
  String,
1618
1951
  Object
1619
1952
  ]),
1620
- _ts_metadata4("design:returntype", void 0)
1953
+ _ts_metadata5("design:returntype", void 0)
1621
1954
  ], DurableApiControllerBase.prototype, "update", null);
1622
- DurableApiControllerBase = _ts_decorate5([
1623
- (0, import_common5.Controller)(),
1624
- (0, import_common5.UseInterceptors)(import_nestjs_filter2.ApplyFilterInterceptor),
1625
- (0, import_common5.UseFilters)(NotModifiedFilter),
1626
- _ts_metadata4("design:type", Function),
1627
- _ts_metadata4("design:paramtypes", [
1955
+ DurableApiControllerBase = _ts_decorate6([
1956
+ (0, import_common6.Controller)(),
1957
+ (0, import_common6.UseInterceptors)(import_nestjs_filter2.ApplyFilterInterceptor),
1958
+ (0, import_common6.UseFilters)(NotModifiedFilter),
1959
+ _ts_metadata5("design:type", Function),
1960
+ _ts_metadata5("design:paramtypes", [
1628
1961
  typeof DashboardService === "undefined" ? Object : DashboardService,
1629
1962
  typeof import_nestjs_filter2.FilterRunner === "undefined" ? Object : import_nestjs_filter2.FilterRunner
1630
1963
  ])
1631
1964
  ], DurableApiControllerBase);
1632
1965
  function notFound(error) {
1633
1966
  if (error instanceof Error && error.name === "ScheduleNotFoundError") {
1634
- throw new import_common5.NotFoundException(error.message);
1967
+ throw new import_common6.NotFoundException(error.message);
1635
1968
  }
1636
1969
  throw error;
1637
1970
  }
1638
1971
  __name(notFound, "notFound");
1639
1972
  function notSupportedByServer(error) {
1640
1973
  if (error?.code === "unsupported-request") {
1641
- throw new import_common5.NotImplementedException(error instanceof Error ? error.message : String(error));
1974
+ throw new import_common6.NotImplementedException(error instanceof Error ? error.message : String(error));
1642
1975
  }
1643
1976
  throw error;
1644
1977
  }
@@ -1648,18 +1981,18 @@ var DurableApiController = class extends DurableApiControllerBase {
1648
1981
  __name(this, "DurableApiController");
1649
1982
  }
1650
1983
  };
1651
- DurableApiController = _ts_decorate5([
1652
- (0, import_common5.Controller)()
1984
+ DurableApiController = _ts_decorate6([
1985
+ (0, import_common6.Controller)()
1653
1986
  ], DurableApiController);
1654
1987
 
1655
1988
  // src/server/durable-dashboard.module.ts
1656
- var import_reflect_metadata2 = require("reflect-metadata");
1989
+ var import_reflect_metadata3 = require("reflect-metadata");
1657
1990
  var import_nestjs_filter3 = require("@dudousxd/nestjs-filter");
1658
- var import_common7 = require("@nestjs/common");
1659
- var import_core = require("@nestjs/core");
1991
+ var import_common8 = require("@nestjs/common");
1992
+ var import_core2 = require("@nestjs/core");
1660
1993
 
1661
1994
  // src/server/controller-decorators.ts
1662
- var import_reflect_metadata = require("reflect-metadata");
1995
+ var import_reflect_metadata2 = require("reflect-metadata");
1663
1996
  var CAN_ANYONE_METADATA = "authorization:can-anyone";
1664
1997
  function markOpenToAuthorization(controller) {
1665
1998
  Reflect.defineMetadata(CAN_ANYONE_METADATA, true, controller);
@@ -1688,8 +2021,8 @@ __name(controllerFor, "controllerFor");
1688
2021
  var import_node_fs = require("fs");
1689
2022
  var import_node_path = require("path");
1690
2023
  var import_node_url = require("url");
1691
- var import_common6 = require("@nestjs/common");
1692
- function _ts_decorate6(decorators, target, key, desc) {
2024
+ var import_common7 = require("@nestjs/common");
2025
+ function _ts_decorate7(decorators, target, key, desc) {
1693
2026
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1694
2027
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
1695
2028
  r = Reflect.decorate(decorators, target, key, desc);
@@ -1702,19 +2035,19 @@ function _ts_decorate6(decorators, target, key, desc) {
1702
2035
  }
1703
2036
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1704
2037
  }
1705
- __name(_ts_decorate6, "_ts_decorate");
1706
- function _ts_metadata5(metadataKey, metadataValue) {
2038
+ __name(_ts_decorate7, "_ts_decorate");
2039
+ function _ts_metadata6(metadataKey, metadataValue) {
1707
2040
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
1708
2041
  return Reflect.metadata(metadataKey, metadataValue);
1709
2042
  }
1710
2043
  }
1711
- __name(_ts_metadata5, "_ts_metadata");
1712
- function _ts_param3(paramIndex, decorator) {
2044
+ __name(_ts_metadata6, "_ts_metadata");
2045
+ function _ts_param4(paramIndex, decorator) {
1713
2046
  return function(target, key) {
1714
2047
  decorator(target, key, paramIndex);
1715
2048
  };
1716
2049
  }
1717
- __name(_ts_param3, "_ts_param");
2050
+ __name(_ts_param4, "_ts_param");
1718
2051
  var DASHBOARD_BASE_PATH = Symbol("DASHBOARD_BASE_PATH");
1719
2052
  var DASHBOARD_API_PATH = Symbol("DASHBOARD_API_PATH");
1720
2053
  var BUILD_BASE = "/durable";
@@ -1747,7 +2080,7 @@ var DurableUiControllerBase = class {
1747
2080
  index() {
1748
2081
  const indexPath = (0, import_node_path.join)(this.dir, "index.html");
1749
2082
  if (!(0, import_node_fs.existsSync)(indexPath)) {
1750
- throw new import_common6.NotFoundException("Dashboard is not built. Run the package build.");
2083
+ throw new import_common7.NotFoundException("Dashboard is not built. Run the package build.");
1751
2084
  }
1752
2085
  const html = (0, import_node_fs.readFileSync)(indexPath, "utf8").replaceAll(`="${BUILD_BASE}/`, `="${this.basePath}/`);
1753
2086
  const inject = `<script>window.__DURABLE_BASE__='${this.basePath}';window.__DURABLE_API__='${this.apiBasePath}';</script>`;
@@ -1755,42 +2088,43 @@ var DurableUiControllerBase = class {
1755
2088
  }
1756
2089
  asset(file) {
1757
2090
  const safe = (0, import_node_path.basename)(file);
1758
- if (safe !== file) throw new import_common6.NotFoundException();
2091
+ if (safe !== file) throw new import_common7.NotFoundException();
1759
2092
  const root = (0, import_node_path.resolve)(this.dir, "assets");
1760
2093
  const assetPath = (0, import_node_path.resolve)(root, safe);
1761
2094
  if (!assetPath.startsWith(root + import_node_path.sep) || !(0, import_node_fs.existsSync)(assetPath)) {
1762
- throw new import_common6.NotFoundException();
2095
+ throw new import_common7.NotFoundException();
1763
2096
  }
1764
2097
  const type = CONTENT_TYPES[(0, import_node_path.extname)(safe)] ?? "application/octet-stream";
1765
- return new import_common6.StreamableFile((0, import_node_fs.readFileSync)(assetPath), {
2098
+ return new import_common7.StreamableFile((0, import_node_fs.readFileSync)(assetPath), {
1766
2099
  type
1767
2100
  });
1768
2101
  }
1769
2102
  };
1770
- _ts_decorate6([
1771
- (0, import_common6.Get)(),
1772
- (0, import_common6.Header)("Content-Type", "text/html; charset=utf-8"),
1773
- (0, import_common6.Header)("Cache-Control", "no-store, must-revalidate"),
1774
- _ts_metadata5("design:type", Function),
1775
- _ts_metadata5("design:paramtypes", []),
1776
- _ts_metadata5("design:returntype", String)
2103
+ _ts_decorate7([
2104
+ (0, import_common7.Get)(),
2105
+ (0, import_common7.Header)("Content-Type", "text/html; charset=utf-8"),
2106
+ (0, import_common7.Header)("Cache-Control", "no-store, must-revalidate"),
2107
+ _ts_metadata6("design:type", Function),
2108
+ _ts_metadata6("design:paramtypes", []),
2109
+ _ts_metadata6("design:returntype", String)
1777
2110
  ], DurableUiControllerBase.prototype, "index", null);
1778
- _ts_decorate6([
1779
- (0, import_common6.Get)("assets/:file"),
1780
- (0, import_common6.Header)("Cache-Control", "public, max-age=31536000, immutable"),
1781
- _ts_param3(0, (0, import_common6.Param)("file")),
1782
- _ts_metadata5("design:type", Function),
1783
- _ts_metadata5("design:paramtypes", [
2111
+ _ts_decorate7([
2112
+ (0, import_common7.Get)("assets/:file"),
2113
+ (0, import_common7.Header)("Cache-Control", "public, max-age=31536000, immutable"),
2114
+ _ts_param4(0, (0, import_common7.Param)("file")),
2115
+ _ts_metadata6("design:type", Function),
2116
+ _ts_metadata6("design:paramtypes", [
1784
2117
  String
1785
2118
  ]),
1786
- _ts_metadata5("design:returntype", typeof import_common6.StreamableFile === "undefined" ? Object : import_common6.StreamableFile)
2119
+ _ts_metadata6("design:returntype", typeof import_common7.StreamableFile === "undefined" ? Object : import_common7.StreamableFile)
1787
2120
  ], DurableUiControllerBase.prototype, "asset", null);
1788
- DurableUiControllerBase = _ts_decorate6([
1789
- (0, import_common6.Controller)(),
1790
- _ts_param3(0, (0, import_common6.Inject)(DASHBOARD_BASE_PATH)),
1791
- _ts_param3(1, (0, import_common6.Inject)(DASHBOARD_API_PATH)),
1792
- _ts_metadata5("design:type", Function),
1793
- _ts_metadata5("design:paramtypes", [
2121
+ DurableUiControllerBase = _ts_decorate7([
2122
+ (0, import_common7.Controller)(),
2123
+ ConsolePage(),
2124
+ _ts_param4(0, (0, import_common7.Inject)(DASHBOARD_BASE_PATH)),
2125
+ _ts_param4(1, (0, import_common7.Inject)(DASHBOARD_API_PATH)),
2126
+ _ts_metadata6("design:type", Function),
2127
+ _ts_metadata6("design:paramtypes", [
1794
2128
  String,
1795
2129
  String
1796
2130
  ])
@@ -1800,12 +2134,12 @@ var DurableUiController = class extends DurableUiControllerBase {
1800
2134
  __name(this, "DurableUiController");
1801
2135
  }
1802
2136
  };
1803
- DurableUiController = _ts_decorate6([
1804
- (0, import_common6.Controller)()
2137
+ DurableUiController = _ts_decorate7([
2138
+ (0, import_common7.Controller)()
1805
2139
  ], DurableUiController);
1806
2140
 
1807
2141
  // src/server/durable-dashboard.module.ts
1808
- function _ts_decorate7(decorators, target, key, desc) {
2142
+ function _ts_decorate8(decorators, target, key, desc) {
1809
2143
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1810
2144
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
1811
2145
  r = Reflect.decorate(decorators, target, key, desc);
@@ -1818,31 +2152,9 @@ function _ts_decorate7(decorators, target, key, desc) {
1818
2152
  }
1819
2153
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1820
2154
  }
1821
- __name(_ts_decorate7, "_ts_decorate");
2155
+ __name(_ts_decorate8, "_ts_decorate");
1822
2156
  markOpenToAuthorization(DurableApiController);
1823
2157
  markOpenToAuthorization(DurableUiController);
1824
- var DASHBOARD_PROTECTION_CHECK = Symbol("DASHBOARD_PROTECTION_CHECK");
1825
- var UNPROTECTED_CONSOLE_IN_PRODUCTION = [
1826
- "DurableDashboardModule: NODE_ENV=production and the durable console is mounted with no",
1827
- "protection, so the app refuses to boot. Protect it one of two ways:",
1828
- "(1) decorators on the mounted console: DurableDashboardModule.forRoot({ decorators: [UseGuards(AuthenticationGuard), Can(ConsolePolicy, 'view')] });",
1829
- "(2) mount it yourself: DurableDashboardModule.forRoot({ routes: false }) plus @Controller('durable') @UseGuards(AuthenticationGuard) @Can(ConsolePolicy, 'view') class ConsoleUi extends DurableUiControllerBase {} (and the same over DurableApiControllerBase at 'durable/api')."
1830
- ].join(" ");
1831
- function isProduction() {
1832
- return (process.env.NODE_ENV ?? "").trim().toLowerCase() === "production";
1833
- }
1834
- __name(isProduction, "isProduction");
1835
- function protectionCheckProvider() {
1836
- return {
1837
- provide: DASHBOARD_PROTECTION_CHECK,
1838
- useFactory: /* @__PURE__ */ __name(() => {
1839
- if (isProduction()) throw new Error(UNPROTECTED_CONSOLE_IN_PRODUCTION);
1840
- new import_common7.Logger("DurableDashboard").warn("The durable console is mounted with no `decorators`, so it is served OPEN (retry/cancel included). That is refused when NODE_ENV=production: pass `decorators` (e.g. [UseGuards(AuthenticationGuard), Can(ConsolePolicy, 'view')]) or mount it yourself with `routes: false`.");
1841
- return true;
1842
- }, "useFactory")
1843
- };
1844
- }
1845
- __name(protectionCheckProvider, "protectionCheckProvider");
1846
2158
  function assertNothingToDecorate(options) {
1847
2159
  if (options.decorators === void 0) return;
1848
2160
  throw new Error([
@@ -1853,6 +2165,13 @@ function assertNothingToDecorate(options) {
1853
2165
  ].join(" "));
1854
2166
  }
1855
2167
  __name(assertNothingToDecorate, "assertNothingToDecorate");
2168
+ function consoleController(base, decorators) {
2169
+ return controllerFor(base, [
2170
+ ...decorators ?? [],
2171
+ UseConsoleAuthorize()
2172
+ ]);
2173
+ }
2174
+ __name(consoleController, "consoleController");
1856
2175
  function normalize(path) {
1857
2176
  return `/${path.replace(/^\/+|\/+$/g, "")}`;
1858
2177
  }
@@ -1869,10 +2188,20 @@ var DurableApiModule = class _DurableApiModule {
1869
2188
  ...options.imports ?? []
1870
2189
  ],
1871
2190
  controllers: routes ? [
1872
- controllerFor(DurableApiController, options.decorators)
2191
+ consoleController(DurableApiController, options.decorators)
1873
2192
  ] : [],
1874
2193
  providers: [
1875
2194
  DashboardService,
2195
+ // Resolved at boot: a gate name without nestjs-authz, or a policy without
2196
+ // @nestjs/authorization, fails here rather than on the first request.
2197
+ {
2198
+ provide: CONSOLE_AUTHORIZE_DECIDE,
2199
+ // Also with `routes: false`: `@UseConsoleAuthorize()` still applies the production 403.
2200
+ useFactory: /* @__PURE__ */ __name((moduleRef) => resolveConsoleAuthorize(options.authorize, moduleRef), "useFactory"),
2201
+ inject: [
2202
+ import_core2.ModuleRef
2203
+ ]
2204
+ },
1876
2205
  // `@dudousxd/nestjs-filter` is wired PRIVATELY here rather than through
1877
2206
  // `FilterModule.forRoot()`, which is a global registration. A library calling that would
1878
2207
  // fight the host app over one set of module options and register a second app-wide
@@ -1894,7 +2223,7 @@ var DurableApiModule = class _DurableApiModule {
1894
2223
  validation: "off"
1895
2224
  }, null), "useFactory"),
1896
2225
  inject: [
1897
- import_core.ModuleRef
2226
+ import_core2.ModuleRef
1898
2227
  ]
1899
2228
  },
1900
2229
  import_nestjs_filter3.ApplyFilterInterceptor,
@@ -1910,16 +2239,18 @@ var DurableApiModule = class _DurableApiModule {
1910
2239
  // is only exported then: exporting it from a mounted console would shadow a host's own
1911
2240
  // `FilterModule` runner in whatever module imports the dashboard.
1912
2241
  exports: routes ? [
1913
- DashboardService
2242
+ DashboardService,
2243
+ CONSOLE_AUTHORIZE_DECIDE
1914
2244
  ] : [
1915
2245
  DashboardService,
1916
- import_nestjs_filter3.FilterRunner
2246
+ import_nestjs_filter3.FilterRunner,
2247
+ CONSOLE_AUTHORIZE_DECIDE
1917
2248
  ]
1918
2249
  };
1919
2250
  }
1920
2251
  };
1921
- DurableApiModule = _ts_decorate7([
1922
- (0, import_common7.Module)({})
2252
+ DurableApiModule = _ts_decorate8([
2253
+ (0, import_common8.Module)({})
1923
2254
  ], DurableApiModule);
1924
2255
  var DurableDashboardModule = class _DurableDashboardModule {
1925
2256
  static {
@@ -1944,6 +2275,9 @@ var DurableDashboardModule = class _DurableDashboardModule {
1944
2275
  ...options.imports ? {
1945
2276
  imports: options.imports
1946
2277
  } : {},
2278
+ ...options.authorize !== void 0 ? {
2279
+ authorize: options.authorize
2280
+ } : {},
1947
2281
  routes: false
1948
2282
  });
1949
2283
  return {
@@ -1955,7 +2289,8 @@ var DurableDashboardModule = class _DurableDashboardModule {
1955
2289
  controllers: [],
1956
2290
  providers: pathProviders,
1957
2291
  // What a host's subclasses of `DurableUiControllerBase` / `DurableApiControllerBase` inject:
1958
- // the SPA's paths, and the read/action service and the filter runner via the API module.
2292
+ // the SPA's paths, the read/action service, the filter runner and the resolved `authorize`
2293
+ // (for `@UseConsoleAuthorize()`) via the API module.
1959
2294
  exports: [
1960
2295
  DurableApiModule,
1961
2296
  DASHBOARD_BASE_PATH,
@@ -1963,7 +2298,6 @@ var DurableDashboardModule = class _DurableDashboardModule {
1963
2298
  ]
1964
2299
  };
1965
2300
  }
1966
- const decorated = (options.decorators?.length ?? 0) > 0;
1967
2301
  return {
1968
2302
  module: _DurableDashboardModule,
1969
2303
  imports: [
@@ -1977,9 +2311,12 @@ var DurableDashboardModule = class _DurableDashboardModule {
1977
2311
  } : {},
1978
2312
  ...options.decorators ? {
1979
2313
  decorators: options.decorators
2314
+ } : {},
2315
+ ...options.authorize !== void 0 ? {
2316
+ authorize: options.authorize
1980
2317
  } : {}
1981
2318
  }),
1982
- import_core.RouterModule.register([
2319
+ import_core2.RouterModule.register([
1983
2320
  {
1984
2321
  path: basePath,
1985
2322
  module: _DurableDashboardModule
@@ -1991,14 +2328,9 @@ var DurableDashboardModule = class _DurableDashboardModule {
1991
2328
  ])
1992
2329
  ],
1993
2330
  controllers: [
1994
- controllerFor(DurableUiController, options.decorators)
1995
- ],
1996
- providers: [
1997
- ...pathProviders,
1998
- ...decorated ? [] : [
1999
- protectionCheckProvider()
2000
- ]
2331
+ consoleController(DurableUiController, options.decorators)
2001
2332
  ],
2333
+ providers: pathProviders,
2002
2334
  // Re-export the API module so its DashboardService reaches importers (e.g. flip's own controllers).
2003
2335
  exports: [
2004
2336
  DurableApiModule
@@ -2006,14 +2338,23 @@ var DurableDashboardModule = class _DurableDashboardModule {
2006
2338
  };
2007
2339
  }
2008
2340
  };
2009
- DurableDashboardModule = _ts_decorate7([
2010
- (0, import_common7.Module)({})
2341
+ DurableDashboardModule = _ts_decorate8([
2342
+ (0, import_common8.Module)({})
2011
2343
  ], DurableDashboardModule);
2012
2344
  // Annotate the CommonJS export names for ESM import in node:
2013
2345
  0 && (module.exports = {
2346
+ CONSOLE_AUTHORIZE_DECIDE,
2347
+ CONSOLE_AUTHORIZE_MISSING_WARNING,
2348
+ CONSOLE_GATE,
2349
+ CONSOLE_PAGE_METADATA,
2350
+ CONSOLE_PUBLIC_METADATA,
2351
+ ConsoleAccessDenied,
2352
+ ConsoleAuthorizeFilter,
2353
+ ConsoleAuthorizeGuard,
2354
+ ConsolePage,
2355
+ ConsolePublic,
2014
2356
  DASHBOARD_API_PATH,
2015
2357
  DASHBOARD_BASE_PATH,
2016
- DASHBOARD_PROTECTION_CHECK,
2017
2358
  DashboardService,
2018
2359
  DurableApiController,
2019
2360
  DurableApiControllerBase,
@@ -2021,6 +2362,9 @@ DurableDashboardModule = _ts_decorate7([
2021
2362
  DurableDashboardModule,
2022
2363
  DurableUiController,
2023
2364
  DurableUiControllerBase,
2024
- UNPROTECTED_CONSOLE_IN_PRODUCTION
2365
+ UseConsoleAuthorize,
2366
+ authorizeByToken,
2367
+ normalizeConsoleResult,
2368
+ resolveConsoleAuthorize
2025
2369
  });
2026
2370
  //# sourceMappingURL=index.cjs.map