@dudousxd/nestjs-durable-dashboard 0.55.1 → 0.56.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,29 @@ 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
+ ConsoleAccessDenied: () => ConsoleAccessDenied,
40
+ ConsoleAuthorizeFilter: () => ConsoleAuthorizeFilter,
41
+ ConsoleAuthorizeGuard: () => ConsoleAuthorizeGuard,
42
+ ConsolePage: () => ConsolePage,
25
43
  DASHBOARD_API_PATH: () => DASHBOARD_API_PATH,
26
44
  DASHBOARD_BASE_PATH: () => DASHBOARD_BASE_PATH,
27
- DASHBOARD_PROTECTION_CHECK: () => DASHBOARD_PROTECTION_CHECK,
28
45
  DashboardService: () => DashboardService,
29
46
  DurableApiController: () => DurableApiController,
30
47
  DurableApiControllerBase: () => DurableApiControllerBase,
@@ -32,14 +49,18 @@ __export(index_exports, {
32
49
  DurableDashboardModule: () => DurableDashboardModule,
33
50
  DurableUiController: () => DurableUiController,
34
51
  DurableUiControllerBase: () => DurableUiControllerBase,
35
- UNPROTECTED_CONSOLE_IN_PRODUCTION: () => UNPROTECTED_CONSOLE_IN_PRODUCTION
52
+ UseConsoleAuthorize: () => UseConsoleAuthorize,
53
+ authorizeByToken: () => authorizeByToken,
54
+ normalizeConsoleResult: () => normalizeConsoleResult,
55
+ resolveConsoleAuthorize: () => resolveConsoleAuthorize
36
56
  });
37
57
  module.exports = __toCommonJS(index_exports);
38
58
 
39
- // src/server/dashboard.service.ts
40
- var import_nestjs_durable_core = require("@dudousxd/nestjs-durable-core");
59
+ // src/server/console-authorize.ts
60
+ var import_reflect_metadata = require("reflect-metadata");
61
+ var import_node_crypto = require("crypto");
41
62
  var import_common = require("@nestjs/common");
42
- var import_rxjs = require("rxjs");
63
+ var import_core = require("@nestjs/core");
43
64
  function _ts_decorate(decorators, target, key, desc) {
44
65
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
45
66
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
@@ -66,6 +87,310 @@ function _ts_param(paramIndex, decorator) {
66
87
  };
67
88
  }
68
89
  __name(_ts_param, "_ts_param");
90
+ var CONSOLE_GATE = Symbol.for("@dudousxd/aviary:console-gate");
91
+ var PACKAGE = "@dudousxd/nestjs-durable-dashboard";
92
+ var MODULE = "DurableDashboardModule";
93
+ 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().`;
94
+ var allow = /* @__PURE__ */ __name(() => ({
95
+ allowed: true
96
+ }), "allow");
97
+ var forbidden = /* @__PURE__ */ __name(() => ({
98
+ allowed: false,
99
+ reason: "forbidden"
100
+ }), "forbidden");
101
+ var unauthenticated = /* @__PURE__ */ __name(() => ({
102
+ allowed: false,
103
+ reason: "unauthenticated"
104
+ }), "unauthenticated");
105
+ function isProduction() {
106
+ return (process.env.NODE_ENV ?? "").trim().toLowerCase() === "production";
107
+ }
108
+ __name(isProduction, "isProduction");
109
+ function isAuthorizerClass(value) {
110
+ if (typeof value !== "function") return false;
111
+ if (typeof value.prototype?.authorize === "function") {
112
+ return true;
113
+ }
114
+ return /^class[\s{]/.test(Function.prototype.toString.call(value));
115
+ }
116
+ __name(isAuthorizerClass, "isAuthorizerClass");
117
+ function isPolicyCheck(value) {
118
+ return typeof value === "object" && value !== null && typeof value.policy === "function" && typeof value.ability === "string";
119
+ }
120
+ __name(isPolicyCheck, "isPolicyCheck");
121
+ function isLazyModule(value) {
122
+ return typeof value === "object" && value !== null && isAuthorizerClass(value.default);
123
+ }
124
+ __name(isLazyModule, "isLazyModule");
125
+ function normalizeConsoleResult(result) {
126
+ if (result === true) return allow();
127
+ if (typeof result !== "object" || result === null) return forbidden();
128
+ const shape = result;
129
+ if (typeof shape.redirectTo === "string" && shape.allowed !== true) {
130
+ return {
131
+ allowed: false,
132
+ reason: "unauthenticated",
133
+ redirectTo: shape.redirectTo
134
+ };
135
+ }
136
+ if (shape.allowed === true) return allow();
137
+ return shape.reason === "unauthenticated" ? unauthenticated() : forbidden();
138
+ }
139
+ __name(normalizeConsoleResult, "normalizeConsoleResult");
140
+ function hasUser(user) {
141
+ return user !== null && user !== void 0 && user !== false;
142
+ }
143
+ __name(hasUser, "hasUser");
144
+ async function policyDecider(check, moduleRef) {
145
+ let pkg;
146
+ try {
147
+ pkg = await import("@nestjs/authorization");
148
+ } catch {
149
+ 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.`);
150
+ }
151
+ const { AuthorizationService, AUTHORIZATION_MODULE_OPTIONS, defaultGetUser } = pkg;
152
+ try {
153
+ moduleRef.get(AuthorizationService, {
154
+ strict: false
155
+ });
156
+ } catch {
157
+ throw new Error(`${MODULE}: \`authorize: { policy, ability }\` needs AuthorizationModule.forRoot() from @nestjs/authorization imported in the app.`);
158
+ }
159
+ let getUser = defaultGetUser;
160
+ try {
161
+ const options = moduleRef.get(AUTHORIZATION_MODULE_OPTIONS, {
162
+ strict: false
163
+ });
164
+ if (typeof options?.getUser === "function") getUser = options.getUser;
165
+ } catch {
166
+ }
167
+ return async (context) => {
168
+ const authorization = moduleRef.get(AuthorizationService, {
169
+ strict: false
170
+ });
171
+ const user = await getUser(context);
172
+ const can = authorization.can;
173
+ if (await can.call(authorization, check.policy, check.ability, hasUser(user) ? user : null)) {
174
+ return allow();
175
+ }
176
+ return hasUser(user) ? forbidden() : unauthenticated();
177
+ };
178
+ }
179
+ __name(policyDecider, "policyDecider");
180
+ function gateDecider(name, moduleRef) {
181
+ try {
182
+ moduleRef.get(CONSOLE_GATE, {
183
+ strict: false
184
+ });
185
+ } catch {
186
+ throw new Error(`\`authorize: '${name}'\` needs @dudousxd/nestjs-authz's AuthzModule (it resolves gate names); or pass a function, a class, or { policy, ability }`);
187
+ }
188
+ return async (context) => {
189
+ const gate = moduleRef.get(CONSOLE_GATE, {
190
+ strict: false
191
+ });
192
+ return normalizeConsoleResult(await gate.allows(name, context));
193
+ };
194
+ }
195
+ __name(gateDecider, "gateDecider");
196
+ function classDecider(moduleRef) {
197
+ const instances = /* @__PURE__ */ new Map();
198
+ const instanceOf = /* @__PURE__ */ __name((Class) => {
199
+ const cached = instances.get(Class);
200
+ if (cached) return cached;
201
+ const pending = (async () => {
202
+ try {
203
+ const registered = moduleRef.get(Class, {
204
+ strict: false
205
+ });
206
+ if (registered) return registered;
207
+ } catch {
208
+ }
209
+ return moduleRef.create(Class);
210
+ })();
211
+ pending.catch(() => instances.delete(Class));
212
+ instances.set(Class, pending);
213
+ return pending;
214
+ }, "instanceOf");
215
+ return (Class) => async (context) => normalizeConsoleResult(await (await instanceOf(Class)).authorize(context));
216
+ }
217
+ __name(classDecider, "classDecider");
218
+ async function resolveConsoleAuthorize(authorize, moduleRef, options = {}) {
219
+ const logger = options.logger ?? new import_common.Logger(MODULE);
220
+ if (authorize === void 0) {
221
+ if (options.warnIfMissing !== false) logger.warn(CONSOLE_AUTHORIZE_MISSING_WARNING);
222
+ const production = isProduction();
223
+ return async () => production ? forbidden() : allow();
224
+ }
225
+ let decide;
226
+ if (typeof authorize === "string") {
227
+ decide = gateDecider(authorize, moduleRef);
228
+ } else if (isPolicyCheck(authorize)) {
229
+ decide = await policyDecider(authorize, moduleRef);
230
+ } else if (isAuthorizerClass(authorize)) {
231
+ decide = classDecider(moduleRef)(authorize);
232
+ } else if (typeof authorize === "function") {
233
+ const fromClass = classDecider(moduleRef);
234
+ let lazy;
235
+ const fn = authorize;
236
+ decide = /* @__PURE__ */ __name(async (context) => {
237
+ if (lazy) return lazy(context);
238
+ const result = await fn(context);
239
+ if (!isLazyModule(result)) return normalizeConsoleResult(result);
240
+ lazy = fromClass(result.default);
241
+ return lazy(context);
242
+ }, "decide");
243
+ } else {
244
+ throw new Error(`${MODULE}: \`authorize\` must be a function, a class with authorize(), a lazy import, { policy, ability } or a gate name.`);
245
+ }
246
+ return async (context) => {
247
+ try {
248
+ return await decide(context);
249
+ } catch (error) {
250
+ logger.warn(`console \`authorize\` threw, denying the request: ${error instanceof Error ? error.message : String(error)}`);
251
+ return forbidden();
252
+ }
253
+ };
254
+ }
255
+ __name(resolveConsoleAuthorize, "resolveConsoleAuthorize");
256
+ var sha256 = /* @__PURE__ */ __name((value) => (0, import_node_crypto.createHash)("sha256").update(value).digest(), "sha256");
257
+ function authorizeByToken(options) {
258
+ const token = options.token;
259
+ if (typeof token !== "string" || token.length === 0) {
260
+ throw new Error("authorizeByToken: `token` is empty; set it (e.g. from an env var).");
261
+ }
262
+ const expected = sha256(token);
263
+ return (context) => {
264
+ const header = context.switchToHttp().getRequest()?.headers?.authorization;
265
+ const match = typeof header === "string" ? /^Bearer\s+(.+)$/i.exec(header.trim()) : null;
266
+ if (match?.[1] && (0, import_node_crypto.timingSafeEqual)(sha256(match[1]), expected)) return true;
267
+ return {
268
+ allowed: false,
269
+ reason: "unauthenticated"
270
+ };
271
+ };
272
+ }
273
+ __name(authorizeByToken, "authorizeByToken");
274
+ var CONSOLE_AUTHORIZE_DECIDE = Symbol(`${PACKAGE}:console-authorize`);
275
+ var CONSOLE_PAGE_METADATA = `${PACKAGE}:console-page`;
276
+ var ConsolePage = /* @__PURE__ */ __name(() => (target) => {
277
+ Reflect.defineMetadata(CONSOLE_PAGE_METADATA, true, target);
278
+ }, "ConsolePage");
279
+ var ConsoleAccessDenied = class extends import_common.HttpException {
280
+ static {
281
+ __name(this, "ConsoleAccessDenied");
282
+ }
283
+ decision;
284
+ page;
285
+ constructor(decision, page) {
286
+ const unauthenticated2 = decision.reason === "unauthenticated";
287
+ super(unauthenticated2 ? {
288
+ error: "unauthenticated",
289
+ ...decision.redirectTo ? {
290
+ redirectTo: decision.redirectTo
291
+ } : {}
292
+ } : {
293
+ error: "forbidden"
294
+ }, unauthenticated2 ? 401 : 403), this.decision = decision, this.page = page;
295
+ }
296
+ };
297
+ var ConsoleAuthorizeGuard = class {
298
+ static {
299
+ __name(this, "ConsoleAuthorizeGuard");
300
+ }
301
+ decide;
302
+ constructor(decide) {
303
+ this.decide = decide;
304
+ }
305
+ async canActivate(context) {
306
+ const decision = await this.decide(context);
307
+ if (decision.allowed) return true;
308
+ throw new ConsoleAccessDenied(decision, isPageNavigation(context));
309
+ }
310
+ };
311
+ ConsoleAuthorizeGuard = _ts_decorate([
312
+ (0, import_common.Injectable)(),
313
+ _ts_param(0, (0, import_common.Inject)(CONSOLE_AUTHORIZE_DECIDE)),
314
+ _ts_metadata("design:type", Function),
315
+ _ts_metadata("design:paramtypes", [
316
+ typeof ConsoleDecide === "undefined" ? Object : ConsoleDecide
317
+ ])
318
+ ], ConsoleAuthorizeGuard);
319
+ function isPageNavigation(context) {
320
+ if (context.getType() !== "http") return false;
321
+ if (Reflect.getMetadata(CONSOLE_PAGE_METADATA, context.getClass()) !== true) return false;
322
+ const request = context.switchToHttp().getRequest();
323
+ const accept = request?.headers?.accept;
324
+ return request?.method === "GET" && typeof accept === "string" && accept.includes("text/html");
325
+ }
326
+ __name(isPageNavigation, "isPageNavigation");
327
+ 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");
328
+ var DENIED_PAGE = consolePage("Access denied", "You do not have access to this console.");
329
+ var SIGN_IN_PAGE = consolePage("Sign in required", "Sign in to open this console.");
330
+ var ConsoleAuthorizeFilter = class {
331
+ static {
332
+ __name(this, "ConsoleAuthorizeFilter");
333
+ }
334
+ adapterHost;
335
+ constructor(adapterHost) {
336
+ this.adapterHost = adapterHost;
337
+ }
338
+ catch(exception, host) {
339
+ const adapter = this.adapterHost.httpAdapter;
340
+ const response = host.switchToHttp().getResponse();
341
+ const { decision, page } = exception;
342
+ if (page && decision.redirectTo) {
343
+ adapter.redirect(response, 302, decision.redirectTo);
344
+ return;
345
+ }
346
+ if (page) {
347
+ const forbiddenPage = decision.reason === "forbidden";
348
+ adapter.setHeader(response, "Content-Type", "text/html; charset=utf-8");
349
+ adapter.reply(response, forbiddenPage ? DENIED_PAGE : SIGN_IN_PAGE, forbiddenPage ? 403 : 401);
350
+ return;
351
+ }
352
+ adapter.reply(response, exception.getResponse(), exception.getStatus());
353
+ }
354
+ };
355
+ ConsoleAuthorizeFilter = _ts_decorate([
356
+ (0, import_common.Catch)(ConsoleAccessDenied),
357
+ _ts_metadata("design:type", Function),
358
+ _ts_metadata("design:paramtypes", [
359
+ typeof import_core.HttpAdapterHost === "undefined" ? Object : import_core.HttpAdapterHost
360
+ ])
361
+ ], ConsoleAuthorizeFilter);
362
+ var UseConsoleAuthorize = /* @__PURE__ */ __name(() => (0, import_common.applyDecorators)((0, import_common.UseGuards)(ConsoleAuthorizeGuard), (0, import_common.UseFilters)(ConsoleAuthorizeFilter)), "UseConsoleAuthorize");
363
+
364
+ // src/server/dashboard.service.ts
365
+ var import_nestjs_durable_core = require("@dudousxd/nestjs-durable-core");
366
+ var import_common2 = require("@nestjs/common");
367
+ var import_rxjs = require("rxjs");
368
+ function _ts_decorate2(decorators, target, key, desc) {
369
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
370
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
371
+ r = Reflect.decorate(decorators, target, key, desc);
372
+ } else {
373
+ for (var i = decorators.length - 1; i >= 0; i--) {
374
+ if (d = decorators[i]) {
375
+ r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
376
+ }
377
+ }
378
+ }
379
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
380
+ }
381
+ __name(_ts_decorate2, "_ts_decorate");
382
+ function _ts_metadata2(metadataKey, metadataValue) {
383
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
384
+ return Reflect.metadata(metadataKey, metadataValue);
385
+ }
386
+ }
387
+ __name(_ts_metadata2, "_ts_metadata");
388
+ function _ts_param2(paramIndex, decorator) {
389
+ return function(target, key) {
390
+ decorator(target, key, paramIndex);
391
+ };
392
+ }
393
+ __name(_ts_param2, "_ts_param");
69
394
  var DashboardService = class {
70
395
  static {
71
396
  __name(this, "DashboardService");
@@ -339,13 +664,13 @@ var DashboardService = class {
339
664
  });
340
665
  }
341
666
  };
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", [
667
+ DashboardService = _ts_decorate2([
668
+ (0, import_common2.Injectable)(),
669
+ _ts_param2(1, (0, import_common2.Optional)()),
670
+ _ts_param2(1, (0, import_common2.Inject)(import_nestjs_durable_core.STATE_STORE_CANONICAL)),
671
+ _ts_param2(2, (0, import_common2.Optional)()),
672
+ _ts_metadata2("design:type", Function),
673
+ _ts_metadata2("design:paramtypes", [
349
674
  typeof import_nestjs_durable_core.RunGateway === "undefined" ? Object : import_nestjs_durable_core.RunGateway,
350
675
  typeof StateStore === "undefined" ? Object : StateStore,
351
676
  typeof import_nestjs_durable_core.WorkflowEngine === "undefined" ? Object : import_nestjs_durable_core.WorkflowEngine
@@ -354,7 +679,7 @@ DashboardService = _ts_decorate([
354
679
 
355
680
  // src/server/durable-api.controller.ts
356
681
  var import_nestjs_filter2 = require("@dudousxd/nestjs-filter");
357
- var import_common5 = require("@nestjs/common");
682
+ var import_common6 = require("@nestjs/common");
358
683
 
359
684
  // src/server/durable-run.ts
360
685
  var DurableRun = class {
@@ -430,8 +755,8 @@ function runValueAxisFor(field) {
430
755
  __name(runValueAxisFor, "runValueAxisFor");
431
756
 
432
757
  // src/server/not-modified.ts
433
- var import_common2 = require("@nestjs/common");
434
- function _ts_decorate2(decorators, target, key, desc) {
758
+ var import_common3 = require("@nestjs/common");
759
+ function _ts_decorate3(decorators, target, key, desc) {
435
760
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
436
761
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
437
762
  r = Reflect.decorate(decorators, target, key, desc);
@@ -444,7 +769,7 @@ function _ts_decorate2(decorators, target, key, desc) {
444
769
  }
445
770
  return c > 3 && r && Object.defineProperty(target, key, r), r;
446
771
  }
447
- __name(_ts_decorate2, "_ts_decorate");
772
+ __name(_ts_decorate3, "_ts_decorate");
448
773
  function isRawResponse(value) {
449
774
  if (typeof value !== "object" || value === null) return false;
450
775
  const candidate = value;
@@ -470,7 +795,7 @@ function writeNotModifiedRaw(response, etag) {
470
795
  raw.end();
471
796
  }
472
797
  __name(writeNotModifiedRaw, "writeNotModifiedRaw");
473
- var NotModifiedException = class extends import_common2.HttpException {
798
+ var NotModifiedException = class extends import_common3.HttpException {
474
799
  static {
475
800
  __name(this, "NotModifiedException");
476
801
  }
@@ -487,8 +812,8 @@ var NotModifiedFilter = class {
487
812
  writeNotModifiedRaw(host.switchToHttp().getResponse(), exception.etag);
488
813
  }
489
814
  };
490
- NotModifiedFilter = _ts_decorate2([
491
- (0, import_common2.Catch)(NotModifiedException)
815
+ NotModifiedFilter = _ts_decorate3([
816
+ (0, import_common3.Catch)(NotModifiedException)
492
817
  ], NotModifiedFilter);
493
818
  function setEtag(response, etag) {
494
819
  setRawHeader(response, "etag", etag);
@@ -505,7 +830,7 @@ __name(toRunListRow, "toRunListRow");
505
830
 
506
831
  // src/server/run.filter.ts
507
832
  var import_nestjs_filter = require("@dudousxd/nestjs-filter");
508
- var import_common4 = require("@nestjs/common");
833
+ var import_common5 = require("@nestjs/common");
509
834
 
510
835
  // src/server/attr-filter.ts
511
836
  var SCALAR_OPS = /* @__PURE__ */ new Set([
@@ -556,7 +881,7 @@ __name(parseAttrFilters, "parseAttrFilters");
556
881
 
557
882
  // src/server/run-query.adapter.ts
558
883
  var import_nestjs_durable_core2 = require("@dudousxd/nestjs-durable-core");
559
- var import_common3 = require("@nestjs/common");
884
+ var import_common4 = require("@nestjs/common");
560
885
 
561
886
  // src/server/run-query-draft.ts
562
887
  var RunQueryDraft2 = class {
@@ -586,7 +911,7 @@ var RunQueryDraft2 = class {
586
911
  };
587
912
 
588
913
  // src/server/run-query.adapter.ts
589
- function _ts_decorate3(decorators, target, key, desc) {
914
+ function _ts_decorate4(decorators, target, key, desc) {
590
915
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
591
916
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
592
917
  r = Reflect.decorate(decorators, target, key, desc);
@@ -599,13 +924,13 @@ function _ts_decorate3(decorators, target, key, desc) {
599
924
  }
600
925
  return c > 3 && r && Object.defineProperty(target, key, r), r;
601
926
  }
602
- __name(_ts_decorate3, "_ts_decorate");
603
- function _ts_metadata2(metadataKey, metadataValue) {
927
+ __name(_ts_decorate4, "_ts_decorate");
928
+ function _ts_metadata3(metadataKey, metadataValue) {
604
929
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
605
930
  return Reflect.metadata(metadataKey, metadataValue);
606
931
  }
607
932
  }
608
- __name(_ts_metadata2, "_ts_metadata");
933
+ __name(_ts_metadata3, "_ts_metadata");
609
934
  var RUN_QUERY_ADAPTER = Symbol("DURABLE_RUN_QUERY_ADAPTER");
610
935
  var FIXED_ORDER = {
611
936
  field: "createdAt",
@@ -627,7 +952,7 @@ function operands(clause) {
627
952
  }
628
953
  __name(operands, "operands");
629
954
  function unsupported(clause, supported) {
630
- throw new import_common3.BadRequestException(`The durable run list cannot filter \`${clause.field}\` with \`${clause.operator}\`. Supported here: ${supported}.`);
955
+ throw new import_common4.BadRequestException(`The durable run list cannot filter \`${clause.field}\` with \`${clause.operator}\`. Supported here: ${supported}.`);
631
956
  }
632
957
  __name(unsupported, "unsupported");
633
958
  var RunQueryAdapter = class {
@@ -665,7 +990,7 @@ var RunQueryAdapter = class {
665
990
  const draft = this.draft(qb);
666
991
  for (const clause of filters) {
667
992
  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.");
993
+ throw new import_common4.BadRequestException("The durable run list cannot filter with nested AND/OR groups: its predicates are a flat conjunction.");
669
994
  }
670
995
  this.applyClause(draft, clause);
671
996
  }
@@ -756,7 +1081,7 @@ var RunQueryAdapter = class {
756
1081
  applyAttributeClause(draft, clause) {
757
1082
  const key = clause.field.slice(ATTRIBUTE_FIELD.length + 1);
758
1083
  if (!key) {
759
- throw new import_common3.BadRequestException("Filtering search attributes needs a key: `attr.<key>`, e.g. `attr.tier`.");
1084
+ throw new import_common4.BadRequestException("Filtering search attributes needs a key: `attr.<key>`, e.g. `attr.tier`.");
760
1085
  }
761
1086
  const scalarOps = {
762
1087
  equals: "eq",
@@ -800,7 +1125,7 @@ var RunQueryAdapter = class {
800
1125
  applySort(_qb, sorts) {
801
1126
  for (const sort of sorts) {
802
1127
  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}\`.`);
1128
+ 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
1129
  }
805
1130
  }
806
1131
  }
@@ -841,14 +1166,14 @@ var RunQueryAdapter = class {
841
1166
  async groupByCount(qb, field, entity, opts) {
842
1167
  this.assertDurableRun(entity);
843
1168
  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.");
1169
+ 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
1170
  }
846
1171
  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.");
1172
+ throw new import_common4.BadRequestException("The durable run list cannot bucket a group-by-count: none of its filterable fields is numeric.");
848
1173
  }
849
1174
  const axis = runValueAxisFor(field);
850
1175
  if (!axis) {
851
- throw new import_common3.BadRequestException(`The durable run list cannot enumerate values of \`${field}\`.`);
1176
+ throw new import_common4.BadRequestException(`The durable run list cannot enumerate values of \`${field}\`.`);
852
1177
  }
853
1178
  const rows = await this.gateway.runValueFacets(axis, this.draft(qb).facetQuery(), {
854
1179
  limit: opts?.limit ?? import_nestjs_durable_core2.RUN_VALUE_FACET_LIMIT,
@@ -879,16 +1204,16 @@ var RunQueryAdapter = class {
879
1204
  }
880
1205
  }
881
1206
  };
882
- RunQueryAdapter = _ts_decorate3([
883
- (0, import_common3.Injectable)(),
884
- _ts_metadata2("design:type", Function),
885
- _ts_metadata2("design:paramtypes", [
1207
+ RunQueryAdapter = _ts_decorate4([
1208
+ (0, import_common4.Injectable)(),
1209
+ _ts_metadata3("design:type", Function),
1210
+ _ts_metadata3("design:paramtypes", [
886
1211
  typeof import_nestjs_durable_core2.RunGateway === "undefined" ? Object : import_nestjs_durable_core2.RunGateway
887
1212
  ])
888
1213
  ], RunQueryAdapter);
889
1214
 
890
1215
  // src/server/run.filter.ts
891
- function _ts_decorate4(decorators, target, key, desc) {
1216
+ function _ts_decorate5(decorators, target, key, desc) {
892
1217
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
893
1218
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
894
1219
  r = Reflect.decorate(decorators, target, key, desc);
@@ -901,13 +1226,13 @@ function _ts_decorate4(decorators, target, key, desc) {
901
1226
  }
902
1227
  return c > 3 && r && Object.defineProperty(target, key, r), r;
903
1228
  }
904
- __name(_ts_decorate4, "_ts_decorate");
905
- function _ts_metadata3(metadataKey, metadataValue) {
1229
+ __name(_ts_decorate5, "_ts_decorate");
1230
+ function _ts_metadata4(metadataKey, metadataValue) {
906
1231
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
907
1232
  return Reflect.metadata(metadataKey, metadataValue);
908
1233
  }
909
1234
  }
910
- __name(_ts_metadata3, "_ts_metadata");
1235
+ __name(_ts_metadata4, "_ts_metadata");
911
1236
  function list(value) {
912
1237
  return (Array.isArray(value) ? value : [
913
1238
  value
@@ -1027,76 +1352,76 @@ var RunFilter = class extends import_nestjs_filter.BaseFilter {
1027
1352
  });
1028
1353
  }
1029
1354
  };
1030
- _ts_decorate4([
1355
+ _ts_decorate5([
1031
1356
  (0, import_nestjs_filter.FilterFor)("status"),
1032
- _ts_metadata3("design:type", Function),
1033
- _ts_metadata3("design:paramtypes", [
1357
+ _ts_metadata4("design:type", Function),
1358
+ _ts_metadata4("design:paramtypes", [
1034
1359
  Object
1035
1360
  ]),
1036
- _ts_metadata3("design:returntype", void 0)
1361
+ _ts_metadata4("design:returntype", void 0)
1037
1362
  ], RunFilter.prototype, "applyStatus", null);
1038
- _ts_decorate4([
1363
+ _ts_decorate5([
1039
1364
  (0, import_nestjs_filter.FilterFor)("workflow"),
1040
- _ts_metadata3("design:type", Function),
1041
- _ts_metadata3("design:paramtypes", [
1365
+ _ts_metadata4("design:type", Function),
1366
+ _ts_metadata4("design:paramtypes", [
1042
1367
  Object
1043
1368
  ]),
1044
- _ts_metadata3("design:returntype", void 0)
1369
+ _ts_metadata4("design:returntype", void 0)
1045
1370
  ], RunFilter.prototype, "applyWorkflow", null);
1046
- _ts_decorate4([
1371
+ _ts_decorate5([
1047
1372
  (0, import_nestjs_filter.FilterFor)("namespace"),
1048
- _ts_metadata3("design:type", Function),
1049
- _ts_metadata3("design:paramtypes", [
1373
+ _ts_metadata4("design:type", Function),
1374
+ _ts_metadata4("design:paramtypes", [
1050
1375
  Object
1051
1376
  ]),
1052
- _ts_metadata3("design:returntype", void 0)
1377
+ _ts_metadata4("design:returntype", void 0)
1053
1378
  ], RunFilter.prototype, "applyNamespace", null);
1054
- _ts_decorate4([
1379
+ _ts_decorate5([
1055
1380
  (0, import_nestjs_filter.FilterFor)("tag"),
1056
- _ts_metadata3("design:type", Function),
1057
- _ts_metadata3("design:paramtypes", [
1381
+ _ts_metadata4("design:type", Function),
1382
+ _ts_metadata4("design:paramtypes", [
1058
1383
  Object
1059
1384
  ]),
1060
- _ts_metadata3("design:returntype", void 0)
1385
+ _ts_metadata4("design:returntype", void 0)
1061
1386
  ], RunFilter.prototype, "applyTag", null);
1062
- _ts_decorate4([
1387
+ _ts_decorate5([
1063
1388
  (0, import_nestjs_filter.FilterFor)("origin"),
1064
- _ts_metadata3("design:type", Function),
1065
- _ts_metadata3("design:paramtypes", []),
1066
- _ts_metadata3("design:returntype", void 0)
1389
+ _ts_metadata4("design:type", Function),
1390
+ _ts_metadata4("design:paramtypes", []),
1391
+ _ts_metadata4("design:returntype", void 0)
1067
1392
  ], RunFilter.prototype, "applyOrigin", null);
1068
- _ts_decorate4([
1393
+ _ts_decorate5([
1069
1394
  (0, import_nestjs_filter.FilterFor)("unattributed"),
1070
- _ts_metadata3("design:type", Function),
1071
- _ts_metadata3("design:paramtypes", []),
1072
- _ts_metadata3("design:returntype", void 0)
1395
+ _ts_metadata4("design:type", Function),
1396
+ _ts_metadata4("design:paramtypes", []),
1397
+ _ts_metadata4("design:returntype", void 0)
1073
1398
  ], RunFilter.prototype, "applyUnattributed", null);
1074
- _ts_decorate4([
1399
+ _ts_decorate5([
1075
1400
  (0, import_nestjs_filter.FilterFor)("attr"),
1076
- _ts_metadata3("design:type", Function),
1077
- _ts_metadata3("design:paramtypes", [
1401
+ _ts_metadata4("design:type", Function),
1402
+ _ts_metadata4("design:paramtypes", [
1078
1403
  Object
1079
1404
  ]),
1080
- _ts_metadata3("design:returntype", void 0)
1405
+ _ts_metadata4("design:returntype", void 0)
1081
1406
  ], RunFilter.prototype, "applyAttributes", null);
1082
- _ts_decorate4([
1407
+ _ts_decorate5([
1083
1408
  (0, import_nestjs_filter.FilterFor)("limit"),
1084
- _ts_metadata3("design:type", Function),
1085
- _ts_metadata3("design:paramtypes", [
1409
+ _ts_metadata4("design:type", Function),
1410
+ _ts_metadata4("design:paramtypes", [
1086
1411
  Object
1087
1412
  ]),
1088
- _ts_metadata3("design:returntype", void 0)
1413
+ _ts_metadata4("design:returntype", void 0)
1089
1414
  ], RunFilter.prototype, "applyLimit", null);
1090
- _ts_decorate4([
1415
+ _ts_decorate5([
1091
1416
  (0, import_nestjs_filter.FilterFor)("offset"),
1092
- _ts_metadata3("design:type", Function),
1093
- _ts_metadata3("design:paramtypes", [
1417
+ _ts_metadata4("design:type", Function),
1418
+ _ts_metadata4("design:paramtypes", [
1094
1419
  Object
1095
1420
  ]),
1096
- _ts_metadata3("design:returntype", void 0)
1421
+ _ts_metadata4("design:returntype", void 0)
1097
1422
  ], RunFilter.prototype, "applyOffset", null);
1098
- RunFilter = _ts_decorate4([
1099
- (0, import_common4.Injectable)(),
1423
+ RunFilter = _ts_decorate5([
1424
+ (0, import_common5.Injectable)(),
1100
1425
  (0, import_nestjs_filter.Filterable)({
1101
1426
  entity: DurableRun,
1102
1427
  adapter: RUN_QUERY_ADAPTER,
@@ -1105,7 +1430,7 @@ RunFilter = _ts_decorate4([
1105
1430
  ], RunFilter);
1106
1431
 
1107
1432
  // src/server/durable-api.controller.ts
1108
- function _ts_decorate5(decorators, target, key, desc) {
1433
+ function _ts_decorate6(decorators, target, key, desc) {
1109
1434
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1110
1435
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
1111
1436
  r = Reflect.decorate(decorators, target, key, desc);
@@ -1118,19 +1443,19 @@ function _ts_decorate5(decorators, target, key, desc) {
1118
1443
  }
1119
1444
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1120
1445
  }
1121
- __name(_ts_decorate5, "_ts_decorate");
1122
- function _ts_metadata4(metadataKey, metadataValue) {
1446
+ __name(_ts_decorate6, "_ts_decorate");
1447
+ function _ts_metadata5(metadataKey, metadataValue) {
1123
1448
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
1124
1449
  return Reflect.metadata(metadataKey, metadataValue);
1125
1450
  }
1126
1451
  }
1127
- __name(_ts_metadata4, "_ts_metadata");
1128
- function _ts_param2(paramIndex, decorator) {
1452
+ __name(_ts_metadata5, "_ts_metadata");
1453
+ function _ts_param3(paramIndex, decorator) {
1129
1454
  return function(target, key) {
1130
1455
  decorator(target, key, paramIndex);
1131
1456
  };
1132
1457
  }
1133
- __name(_ts_param2, "_ts_param");
1458
+ __name(_ts_param3, "_ts_param");
1134
1459
  var FAN_INLINE_MAX = 50;
1135
1460
  var DurableApiControllerBase = class {
1136
1461
  static {
@@ -1232,7 +1557,7 @@ var DurableApiControllerBase = class {
1232
1557
  */
1233
1558
  async workflowLifecycle(name) {
1234
1559
  const links = await this.dashboard.workflowLifecycle(name).catch(notSupportedByServer);
1235
- if (!links) throw new import_common5.NotImplementedException("workflow lifecycle links need the control plane");
1560
+ if (!links) throw new import_common6.NotImplementedException("workflow lifecycle links need the control plane");
1236
1561
  return links;
1237
1562
  }
1238
1563
  /** This deployment's durable role (control plane vs tenant) + tenant name — for the header badge. */
@@ -1254,7 +1579,7 @@ var DurableApiControllerBase = class {
1254
1579
  ifNoneMatch
1255
1580
  }
1256
1581
  });
1257
- if (!detail) throw new import_common5.NotFoundException(`run ${id} not found`);
1582
+ if (!detail) throw new import_common6.NotFoundException(`run ${id} not found`);
1258
1583
  const { etag, notModified, ...body } = detail;
1259
1584
  if (etag) {
1260
1585
  if (notModified) throw new NotModifiedException(etag);
@@ -1272,7 +1597,7 @@ var DurableApiControllerBase = class {
1272
1597
  ifNoneMatch
1273
1598
  }
1274
1599
  });
1275
- if (!page) throw new import_common5.NotFoundException(`fan ${group} of run ${id} not found`);
1600
+ if (!page) throw new import_common6.NotFoundException(`fan ${group} of run ${id} not found`);
1276
1601
  const { etag, notModified, ...body } = page;
1277
1602
  if (etag) {
1278
1603
  if (notModified) throw new NotModifiedException(etag);
@@ -1307,7 +1632,7 @@ var DurableApiControllerBase = class {
1307
1632
  const result = await this.dashboard.cancel(id, {
1308
1633
  compensate: compensate === "true"
1309
1634
  });
1310
- if (!result) throw new import_common5.NotFoundException(`run ${id} not found`);
1635
+ if (!result) throw new import_common6.NotFoundException(`run ${id} not found`);
1311
1636
  return result;
1312
1637
  }
1313
1638
  /**
@@ -1320,27 +1645,27 @@ var DurableApiControllerBase = class {
1320
1645
  result = await this.dashboard.republishLifecycle(id, body?.subscriber || void 0);
1321
1646
  } catch (error) {
1322
1647
  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);
1648
+ if (/^run .* not found$/.test(message)) throw new import_common6.NotFoundException(message);
1649
+ if (/^run .* has not settled/.test(message)) throw new import_common6.BadRequestException(message);
1325
1650
  if (error?.code === "bad-request") {
1326
- throw new import_common5.BadRequestException(message);
1651
+ throw new import_common6.BadRequestException(message);
1327
1652
  }
1328
1653
  return notSupportedByServer(error);
1329
1654
  }
1330
1655
  if (!result) {
1331
- throw new import_common5.NotImplementedException("republishing lifecycle events needs the control plane");
1656
+ throw new import_common6.NotImplementedException("republishing lifecycle events needs the control plane");
1332
1657
  }
1333
1658
  return result;
1334
1659
  }
1335
1660
  async continue(id) {
1336
1661
  const result = await this.dashboard.continue(id);
1337
- if (!result) throw new import_common5.NotFoundException(`run ${id} is not paused at a breakpoint`);
1662
+ if (!result) throw new import_common6.NotFoundException(`run ${id} is not paused at a breakpoint`);
1338
1663
  return result;
1339
1664
  }
1340
1665
  /** Re-dispatch a run's stuck `pending` remote steps — recovery for a lost step dispatch. */
1341
1666
  async redispatch(id) {
1342
1667
  const result = await this.dashboard.redispatch(id);
1343
- if (!result) throw new import_common5.NotFoundException(`run ${id} not found`);
1668
+ if (!result) throw new import_common6.NotFoundException(`run ${id} not found`);
1344
1669
  return result;
1345
1670
  }
1346
1671
  /**
@@ -1351,7 +1676,7 @@ var DurableApiControllerBase = class {
1351
1676
  */
1352
1677
  async webhook(token, body) {
1353
1678
  const result = await this.dashboard.deliverWebhook(token, body);
1354
- if (!result) throw new import_common5.NotFoundException(`no live run is waiting for webhook ${token}`);
1679
+ if (!result) throw new import_common6.NotFoundException(`no live run is waiting for webhook ${token}`);
1355
1680
  return result;
1356
1681
  }
1357
1682
  /** Live query: the latest value a run published for `key` via `ctx.setEvent` (no side effect). */
@@ -1363,135 +1688,135 @@ var DurableApiControllerBase = class {
1363
1688
  return this.dashboard.update(id, name, body);
1364
1689
  }
1365
1690
  };
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", [
1691
+ _ts_decorate6([
1692
+ (0, import_common6.Get)("runs"),
1693
+ _ts_param3(0, (0, import_nestjs_filter2.ApplyFilter)(RunFilter)),
1694
+ _ts_metadata5("design:type", Function),
1695
+ _ts_metadata5("design:paramtypes", [
1371
1696
  typeof RunQueryDraft === "undefined" ? Object : RunQueryDraft
1372
1697
  ]),
1373
- _ts_metadata4("design:returntype", Promise)
1698
+ _ts_metadata5("design:returntype", Promise)
1374
1699
  ], 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", [
1700
+ _ts_decorate6([
1701
+ (0, import_common6.Get)("runs/facets"),
1702
+ _ts_param3(0, (0, import_nestjs_filter2.ApplyFilter)(RunFilter)),
1703
+ _ts_metadata5("design:type", Function),
1704
+ _ts_metadata5("design:paramtypes", [
1380
1705
  typeof RunQueryDraft === "undefined" ? Object : RunQueryDraft
1381
1706
  ]),
1382
- _ts_metadata4("design:returntype", void 0)
1707
+ _ts_metadata5("design:returntype", void 0)
1383
1708
  ], 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", [
1709
+ _ts_decorate6([
1710
+ (0, import_common6.Get)("runs/values"),
1711
+ _ts_param3(0, (0, import_common6.Query)()),
1712
+ _ts_metadata5("design:type", Function),
1713
+ _ts_metadata5("design:paramtypes", [
1389
1714
  typeof Record === "undefined" ? Object : Record
1390
1715
  ]),
1391
- _ts_metadata4("design:returntype", void 0)
1716
+ _ts_metadata5("design:returntype", void 0)
1392
1717
  ], 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)
1718
+ _ts_decorate6([
1719
+ (0, import_common6.Get)("metrics"),
1720
+ (0, import_common6.Header)("Content-Type", "text/plain; version=0.0.4"),
1721
+ _ts_metadata5("design:type", Function),
1722
+ _ts_metadata5("design:paramtypes", []),
1723
+ _ts_metadata5("design:returntype", void 0)
1399
1724
  ], 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)
1725
+ _ts_decorate6([
1726
+ (0, import_common6.Get)("workers"),
1727
+ _ts_metadata5("design:type", Function),
1728
+ _ts_metadata5("design:paramtypes", []),
1729
+ _ts_metadata5("design:returntype", void 0)
1405
1730
  ], 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", [
1731
+ _ts_decorate6([
1732
+ (0, import_common6.Get)("schedules"),
1733
+ _ts_param3(0, (0, import_common6.Query)("namespace")),
1734
+ _ts_param3(1, (0, import_common6.Query)("workflow")),
1735
+ _ts_param3(2, (0, import_common6.Query)("tag")),
1736
+ _ts_param3(3, (0, import_common6.Query)("paused")),
1737
+ _ts_param3(4, (0, import_common6.Query)("limit")),
1738
+ _ts_metadata5("design:type", Function),
1739
+ _ts_metadata5("design:paramtypes", [
1415
1740
  String,
1416
1741
  String,
1417
1742
  String,
1418
1743
  String,
1419
1744
  String
1420
1745
  ]),
1421
- _ts_metadata4("design:returntype", void 0)
1746
+ _ts_metadata5("design:returntype", void 0)
1422
1747
  ], 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", [
1748
+ _ts_decorate6([
1749
+ (0, import_common6.Post)("schedules/:id/pause"),
1750
+ _ts_param3(0, (0, import_common6.Param)("id")),
1751
+ _ts_metadata5("design:type", Function),
1752
+ _ts_metadata5("design:paramtypes", [
1428
1753
  String
1429
1754
  ]),
1430
- _ts_metadata4("design:returntype", void 0)
1755
+ _ts_metadata5("design:returntype", void 0)
1431
1756
  ], 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", [
1757
+ _ts_decorate6([
1758
+ (0, import_common6.Post)("schedules/:id/resume"),
1759
+ _ts_param3(0, (0, import_common6.Param)("id")),
1760
+ _ts_metadata5("design:type", Function),
1761
+ _ts_metadata5("design:paramtypes", [
1437
1762
  String
1438
1763
  ]),
1439
- _ts_metadata4("design:returntype", void 0)
1764
+ _ts_metadata5("design:returntype", void 0)
1440
1765
  ], 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", [
1766
+ _ts_decorate6([
1767
+ (0, import_common6.Post)("schedules/:id/trigger"),
1768
+ _ts_param3(0, (0, import_common6.Param)("id")),
1769
+ _ts_metadata5("design:type", Function),
1770
+ _ts_metadata5("design:paramtypes", [
1446
1771
  String
1447
1772
  ]),
1448
- _ts_metadata4("design:returntype", void 0)
1773
+ _ts_metadata5("design:returntype", void 0)
1449
1774
  ], 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", [
1775
+ _ts_decorate6([
1776
+ (0, import_common6.Get)("workflows/:name/lifecycle"),
1777
+ _ts_param3(0, (0, import_common6.Param)("name")),
1778
+ _ts_metadata5("design:type", Function),
1779
+ _ts_metadata5("design:paramtypes", [
1455
1780
  String
1456
1781
  ]),
1457
- _ts_metadata4("design:returntype", Promise)
1782
+ _ts_metadata5("design:returntype", Promise)
1458
1783
  ], 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)
1784
+ _ts_decorate6([
1785
+ (0, import_common6.Get)("topology"),
1786
+ _ts_metadata5("design:type", Function),
1787
+ _ts_metadata5("design:paramtypes", []),
1788
+ _ts_metadata5("design:returntype", void 0)
1464
1789
  ], 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)({
1790
+ _ts_decorate6([
1791
+ (0, import_common6.Get)("runs/:id"),
1792
+ _ts_param3(0, (0, import_common6.Param)("id")),
1793
+ _ts_param3(1, (0, import_common6.Query)("full")),
1794
+ _ts_param3(2, (0, import_common6.Headers)("if-none-match")),
1795
+ _ts_param3(3, (0, import_common6.Res)({
1471
1796
  passthrough: true
1472
1797
  })),
1473
- _ts_metadata4("design:type", Function),
1474
- _ts_metadata4("design:paramtypes", [
1798
+ _ts_metadata5("design:type", Function),
1799
+ _ts_metadata5("design:paramtypes", [
1475
1800
  String,
1476
1801
  String,
1477
1802
  String,
1478
1803
  Object
1479
1804
  ]),
1480
- _ts_metadata4("design:returntype", Promise)
1805
+ _ts_metadata5("design:returntype", Promise)
1481
1806
  ], 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)({
1807
+ _ts_decorate6([
1808
+ (0, import_common6.Get)("runs/:id/fans/:group"),
1809
+ _ts_param3(0, (0, import_common6.Param)("id")),
1810
+ _ts_param3(1, (0, import_common6.Param)("group")),
1811
+ _ts_param3(2, (0, import_common6.Query)("offset")),
1812
+ _ts_param3(3, (0, import_common6.Query)("limit")),
1813
+ _ts_param3(4, (0, import_common6.Query)("failed")),
1814
+ _ts_param3(5, (0, import_common6.Headers)("if-none-match")),
1815
+ _ts_param3(6, (0, import_common6.Res)({
1491
1816
  passthrough: true
1492
1817
  })),
1493
- _ts_metadata4("design:type", Function),
1494
- _ts_metadata4("design:paramtypes", [
1818
+ _ts_metadata5("design:type", Function),
1819
+ _ts_metadata5("design:paramtypes", [
1495
1820
  String,
1496
1821
  String,
1497
1822
  String,
@@ -1500,145 +1825,145 @@ _ts_decorate5([
1500
1825
  String,
1501
1826
  Object
1502
1827
  ]),
1503
- _ts_metadata4("design:returntype", Promise)
1828
+ _ts_metadata5("design:returntype", Promise)
1504
1829
  ], 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", [
1830
+ _ts_decorate6([
1831
+ (0, import_common6.Sse)("runs/:id/stream"),
1832
+ _ts_param3(0, (0, import_common6.Param)("id")),
1833
+ _ts_metadata5("design:type", Function),
1834
+ _ts_metadata5("design:paramtypes", [
1510
1835
  String
1511
1836
  ]),
1512
- _ts_metadata4("design:returntype", void 0)
1837
+ _ts_metadata5("design:returntype", void 0)
1513
1838
  ], 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", [
1839
+ _ts_decorate6([
1840
+ (0, import_common6.Post)("runs/:id/retry"),
1841
+ _ts_param3(0, (0, import_common6.Param)("id")),
1842
+ _ts_metadata5("design:type", Function),
1843
+ _ts_metadata5("design:paramtypes", [
1519
1844
  String
1520
1845
  ]),
1521
- _ts_metadata4("design:returntype", void 0)
1846
+ _ts_metadata5("design:returntype", void 0)
1522
1847
  ], 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", [
1848
+ _ts_decorate6([
1849
+ (0, import_common6.Post)("runs/:id/retry-with-input"),
1850
+ _ts_param3(0, (0, import_common6.Param)("id")),
1851
+ _ts_param3(1, (0, import_common6.Body)()),
1852
+ _ts_metadata5("design:type", Function),
1853
+ _ts_metadata5("design:paramtypes", [
1529
1854
  String,
1530
1855
  Object
1531
1856
  ]),
1532
- _ts_metadata4("design:returntype", void 0)
1857
+ _ts_metadata5("design:returntype", void 0)
1533
1858
  ], 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", [
1859
+ _ts_decorate6([
1860
+ (0, import_common6.Post)("bulk/:action"),
1861
+ _ts_param3(0, (0, import_common6.Param)("action")),
1862
+ _ts_param3(1, (0, import_nestjs_filter2.ApplyFilter)(RunFilter)),
1863
+ _ts_param3(2, (0, import_common6.Query)("compensate")),
1864
+ _ts_metadata5("design:type", Function),
1865
+ _ts_metadata5("design:paramtypes", [
1541
1866
  String,
1542
1867
  typeof RunQueryDraft === "undefined" ? Object : RunQueryDraft,
1543
1868
  String
1544
1869
  ]),
1545
- _ts_metadata4("design:returntype", void 0)
1870
+ _ts_metadata5("design:returntype", void 0)
1546
1871
  ], 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", [
1872
+ _ts_decorate6([
1873
+ (0, import_common6.Post)("runs/:id/cancel"),
1874
+ _ts_param3(0, (0, import_common6.Param)("id")),
1875
+ _ts_param3(1, (0, import_common6.Query)("compensate")),
1876
+ _ts_metadata5("design:type", Function),
1877
+ _ts_metadata5("design:paramtypes", [
1553
1878
  String,
1554
1879
  String
1555
1880
  ]),
1556
- _ts_metadata4("design:returntype", Promise)
1881
+ _ts_metadata5("design:returntype", Promise)
1557
1882
  ], 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", [
1883
+ _ts_decorate6([
1884
+ (0, import_common6.Post)("runs/:id/republish-lifecycle"),
1885
+ _ts_param3(0, (0, import_common6.Param)("id")),
1886
+ _ts_param3(1, (0, import_common6.Body)()),
1887
+ _ts_metadata5("design:type", Function),
1888
+ _ts_metadata5("design:paramtypes", [
1564
1889
  String,
1565
1890
  Object
1566
1891
  ]),
1567
- _ts_metadata4("design:returntype", Promise)
1892
+ _ts_metadata5("design:returntype", Promise)
1568
1893
  ], 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", [
1894
+ _ts_decorate6([
1895
+ (0, import_common6.Post)("runs/:id/continue"),
1896
+ _ts_param3(0, (0, import_common6.Param)("id")),
1897
+ _ts_metadata5("design:type", Function),
1898
+ _ts_metadata5("design:paramtypes", [
1574
1899
  String
1575
1900
  ]),
1576
- _ts_metadata4("design:returntype", Promise)
1901
+ _ts_metadata5("design:returntype", Promise)
1577
1902
  ], 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", [
1903
+ _ts_decorate6([
1904
+ (0, import_common6.Post)("runs/:id/redispatch"),
1905
+ _ts_param3(0, (0, import_common6.Param)("id")),
1906
+ _ts_metadata5("design:type", Function),
1907
+ _ts_metadata5("design:paramtypes", [
1583
1908
  String
1584
1909
  ]),
1585
- _ts_metadata4("design:returntype", Promise)
1910
+ _ts_metadata5("design:returntype", Promise)
1586
1911
  ], 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", [
1912
+ _ts_decorate6([
1913
+ (0, import_common6.Post)("webhooks/:token"),
1914
+ _ts_param3(0, (0, import_common6.Param)("token")),
1915
+ _ts_param3(1, (0, import_common6.Body)()),
1916
+ _ts_metadata5("design:type", Function),
1917
+ _ts_metadata5("design:paramtypes", [
1593
1918
  String,
1594
1919
  Object
1595
1920
  ]),
1596
- _ts_metadata4("design:returntype", Promise)
1921
+ _ts_metadata5("design:returntype", Promise)
1597
1922
  ], 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", [
1923
+ _ts_decorate6([
1924
+ (0, import_common6.Get)("runs/:id/events/:key"),
1925
+ _ts_param3(0, (0, import_common6.Param)("id")),
1926
+ _ts_param3(1, (0, import_common6.Param)("key")),
1927
+ _ts_metadata5("design:type", Function),
1928
+ _ts_metadata5("design:paramtypes", [
1604
1929
  String,
1605
1930
  String
1606
1931
  ]),
1607
- _ts_metadata4("design:returntype", void 0)
1932
+ _ts_metadata5("design:returntype", void 0)
1608
1933
  ], 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", [
1934
+ _ts_decorate6([
1935
+ (0, import_common6.Post)("runs/:id/updates/:name"),
1936
+ _ts_param3(0, (0, import_common6.Param)("id")),
1937
+ _ts_param3(1, (0, import_common6.Param)("name")),
1938
+ _ts_param3(2, (0, import_common6.Body)()),
1939
+ _ts_metadata5("design:type", Function),
1940
+ _ts_metadata5("design:paramtypes", [
1616
1941
  String,
1617
1942
  String,
1618
1943
  Object
1619
1944
  ]),
1620
- _ts_metadata4("design:returntype", void 0)
1945
+ _ts_metadata5("design:returntype", void 0)
1621
1946
  ], 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", [
1947
+ DurableApiControllerBase = _ts_decorate6([
1948
+ (0, import_common6.Controller)(),
1949
+ (0, import_common6.UseInterceptors)(import_nestjs_filter2.ApplyFilterInterceptor),
1950
+ (0, import_common6.UseFilters)(NotModifiedFilter),
1951
+ _ts_metadata5("design:type", Function),
1952
+ _ts_metadata5("design:paramtypes", [
1628
1953
  typeof DashboardService === "undefined" ? Object : DashboardService,
1629
1954
  typeof import_nestjs_filter2.FilterRunner === "undefined" ? Object : import_nestjs_filter2.FilterRunner
1630
1955
  ])
1631
1956
  ], DurableApiControllerBase);
1632
1957
  function notFound(error) {
1633
1958
  if (error instanceof Error && error.name === "ScheduleNotFoundError") {
1634
- throw new import_common5.NotFoundException(error.message);
1959
+ throw new import_common6.NotFoundException(error.message);
1635
1960
  }
1636
1961
  throw error;
1637
1962
  }
1638
1963
  __name(notFound, "notFound");
1639
1964
  function notSupportedByServer(error) {
1640
1965
  if (error?.code === "unsupported-request") {
1641
- throw new import_common5.NotImplementedException(error instanceof Error ? error.message : String(error));
1966
+ throw new import_common6.NotImplementedException(error instanceof Error ? error.message : String(error));
1642
1967
  }
1643
1968
  throw error;
1644
1969
  }
@@ -1648,18 +1973,18 @@ var DurableApiController = class extends DurableApiControllerBase {
1648
1973
  __name(this, "DurableApiController");
1649
1974
  }
1650
1975
  };
1651
- DurableApiController = _ts_decorate5([
1652
- (0, import_common5.Controller)()
1976
+ DurableApiController = _ts_decorate6([
1977
+ (0, import_common6.Controller)()
1653
1978
  ], DurableApiController);
1654
1979
 
1655
1980
  // src/server/durable-dashboard.module.ts
1656
- var import_reflect_metadata2 = require("reflect-metadata");
1981
+ var import_reflect_metadata3 = require("reflect-metadata");
1657
1982
  var import_nestjs_filter3 = require("@dudousxd/nestjs-filter");
1658
- var import_common7 = require("@nestjs/common");
1659
- var import_core = require("@nestjs/core");
1983
+ var import_common8 = require("@nestjs/common");
1984
+ var import_core2 = require("@nestjs/core");
1660
1985
 
1661
1986
  // src/server/controller-decorators.ts
1662
- var import_reflect_metadata = require("reflect-metadata");
1987
+ var import_reflect_metadata2 = require("reflect-metadata");
1663
1988
  var CAN_ANYONE_METADATA = "authorization:can-anyone";
1664
1989
  function markOpenToAuthorization(controller) {
1665
1990
  Reflect.defineMetadata(CAN_ANYONE_METADATA, true, controller);
@@ -1688,8 +2013,8 @@ __name(controllerFor, "controllerFor");
1688
2013
  var import_node_fs = require("fs");
1689
2014
  var import_node_path = require("path");
1690
2015
  var import_node_url = require("url");
1691
- var import_common6 = require("@nestjs/common");
1692
- function _ts_decorate6(decorators, target, key, desc) {
2016
+ var import_common7 = require("@nestjs/common");
2017
+ function _ts_decorate7(decorators, target, key, desc) {
1693
2018
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1694
2019
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
1695
2020
  r = Reflect.decorate(decorators, target, key, desc);
@@ -1702,19 +2027,19 @@ function _ts_decorate6(decorators, target, key, desc) {
1702
2027
  }
1703
2028
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1704
2029
  }
1705
- __name(_ts_decorate6, "_ts_decorate");
1706
- function _ts_metadata5(metadataKey, metadataValue) {
2030
+ __name(_ts_decorate7, "_ts_decorate");
2031
+ function _ts_metadata6(metadataKey, metadataValue) {
1707
2032
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
1708
2033
  return Reflect.metadata(metadataKey, metadataValue);
1709
2034
  }
1710
2035
  }
1711
- __name(_ts_metadata5, "_ts_metadata");
1712
- function _ts_param3(paramIndex, decorator) {
2036
+ __name(_ts_metadata6, "_ts_metadata");
2037
+ function _ts_param4(paramIndex, decorator) {
1713
2038
  return function(target, key) {
1714
2039
  decorator(target, key, paramIndex);
1715
2040
  };
1716
2041
  }
1717
- __name(_ts_param3, "_ts_param");
2042
+ __name(_ts_param4, "_ts_param");
1718
2043
  var DASHBOARD_BASE_PATH = Symbol("DASHBOARD_BASE_PATH");
1719
2044
  var DASHBOARD_API_PATH = Symbol("DASHBOARD_API_PATH");
1720
2045
  var BUILD_BASE = "/durable";
@@ -1747,7 +2072,7 @@ var DurableUiControllerBase = class {
1747
2072
  index() {
1748
2073
  const indexPath = (0, import_node_path.join)(this.dir, "index.html");
1749
2074
  if (!(0, import_node_fs.existsSync)(indexPath)) {
1750
- throw new import_common6.NotFoundException("Dashboard is not built. Run the package build.");
2075
+ throw new import_common7.NotFoundException("Dashboard is not built. Run the package build.");
1751
2076
  }
1752
2077
  const html = (0, import_node_fs.readFileSync)(indexPath, "utf8").replaceAll(`="${BUILD_BASE}/`, `="${this.basePath}/`);
1753
2078
  const inject = `<script>window.__DURABLE_BASE__='${this.basePath}';window.__DURABLE_API__='${this.apiBasePath}';</script>`;
@@ -1755,42 +2080,43 @@ var DurableUiControllerBase = class {
1755
2080
  }
1756
2081
  asset(file) {
1757
2082
  const safe = (0, import_node_path.basename)(file);
1758
- if (safe !== file) throw new import_common6.NotFoundException();
2083
+ if (safe !== file) throw new import_common7.NotFoundException();
1759
2084
  const root = (0, import_node_path.resolve)(this.dir, "assets");
1760
2085
  const assetPath = (0, import_node_path.resolve)(root, safe);
1761
2086
  if (!assetPath.startsWith(root + import_node_path.sep) || !(0, import_node_fs.existsSync)(assetPath)) {
1762
- throw new import_common6.NotFoundException();
2087
+ throw new import_common7.NotFoundException();
1763
2088
  }
1764
2089
  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), {
2090
+ return new import_common7.StreamableFile((0, import_node_fs.readFileSync)(assetPath), {
1766
2091
  type
1767
2092
  });
1768
2093
  }
1769
2094
  };
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)
2095
+ _ts_decorate7([
2096
+ (0, import_common7.Get)(),
2097
+ (0, import_common7.Header)("Content-Type", "text/html; charset=utf-8"),
2098
+ (0, import_common7.Header)("Cache-Control", "no-store, must-revalidate"),
2099
+ _ts_metadata6("design:type", Function),
2100
+ _ts_metadata6("design:paramtypes", []),
2101
+ _ts_metadata6("design:returntype", String)
1777
2102
  ], 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", [
2103
+ _ts_decorate7([
2104
+ (0, import_common7.Get)("assets/:file"),
2105
+ (0, import_common7.Header)("Cache-Control", "public, max-age=31536000, immutable"),
2106
+ _ts_param4(0, (0, import_common7.Param)("file")),
2107
+ _ts_metadata6("design:type", Function),
2108
+ _ts_metadata6("design:paramtypes", [
1784
2109
  String
1785
2110
  ]),
1786
- _ts_metadata5("design:returntype", typeof import_common6.StreamableFile === "undefined" ? Object : import_common6.StreamableFile)
2111
+ _ts_metadata6("design:returntype", typeof import_common7.StreamableFile === "undefined" ? Object : import_common7.StreamableFile)
1787
2112
  ], 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", [
2113
+ DurableUiControllerBase = _ts_decorate7([
2114
+ (0, import_common7.Controller)(),
2115
+ ConsolePage(),
2116
+ _ts_param4(0, (0, import_common7.Inject)(DASHBOARD_BASE_PATH)),
2117
+ _ts_param4(1, (0, import_common7.Inject)(DASHBOARD_API_PATH)),
2118
+ _ts_metadata6("design:type", Function),
2119
+ _ts_metadata6("design:paramtypes", [
1794
2120
  String,
1795
2121
  String
1796
2122
  ])
@@ -1800,12 +2126,12 @@ var DurableUiController = class extends DurableUiControllerBase {
1800
2126
  __name(this, "DurableUiController");
1801
2127
  }
1802
2128
  };
1803
- DurableUiController = _ts_decorate6([
1804
- (0, import_common6.Controller)()
2129
+ DurableUiController = _ts_decorate7([
2130
+ (0, import_common7.Controller)()
1805
2131
  ], DurableUiController);
1806
2132
 
1807
2133
  // src/server/durable-dashboard.module.ts
1808
- function _ts_decorate7(decorators, target, key, desc) {
2134
+ function _ts_decorate8(decorators, target, key, desc) {
1809
2135
  var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
1810
2136
  if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
1811
2137
  r = Reflect.decorate(decorators, target, key, desc);
@@ -1818,31 +2144,9 @@ function _ts_decorate7(decorators, target, key, desc) {
1818
2144
  }
1819
2145
  return c > 3 && r && Object.defineProperty(target, key, r), r;
1820
2146
  }
1821
- __name(_ts_decorate7, "_ts_decorate");
2147
+ __name(_ts_decorate8, "_ts_decorate");
1822
2148
  markOpenToAuthorization(DurableApiController);
1823
2149
  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
2150
  function assertNothingToDecorate(options) {
1847
2151
  if (options.decorators === void 0) return;
1848
2152
  throw new Error([
@@ -1853,6 +2157,13 @@ function assertNothingToDecorate(options) {
1853
2157
  ].join(" "));
1854
2158
  }
1855
2159
  __name(assertNothingToDecorate, "assertNothingToDecorate");
2160
+ function consoleController(base, decorators) {
2161
+ return controllerFor(base, [
2162
+ ...decorators ?? [],
2163
+ UseConsoleAuthorize()
2164
+ ]);
2165
+ }
2166
+ __name(consoleController, "consoleController");
1856
2167
  function normalize(path) {
1857
2168
  return `/${path.replace(/^\/+|\/+$/g, "")}`;
1858
2169
  }
@@ -1869,10 +2180,20 @@ var DurableApiModule = class _DurableApiModule {
1869
2180
  ...options.imports ?? []
1870
2181
  ],
1871
2182
  controllers: routes ? [
1872
- controllerFor(DurableApiController, options.decorators)
2183
+ consoleController(DurableApiController, options.decorators)
1873
2184
  ] : [],
1874
2185
  providers: [
1875
2186
  DashboardService,
2187
+ // Resolved at boot: a gate name without nestjs-authz, or a policy without
2188
+ // @nestjs/authorization, fails here rather than on the first request.
2189
+ {
2190
+ provide: CONSOLE_AUTHORIZE_DECIDE,
2191
+ // Also with `routes: false`: `@UseConsoleAuthorize()` still applies the production 403.
2192
+ useFactory: /* @__PURE__ */ __name((moduleRef) => resolveConsoleAuthorize(options.authorize, moduleRef), "useFactory"),
2193
+ inject: [
2194
+ import_core2.ModuleRef
2195
+ ]
2196
+ },
1876
2197
  // `@dudousxd/nestjs-filter` is wired PRIVATELY here rather than through
1877
2198
  // `FilterModule.forRoot()`, which is a global registration. A library calling that would
1878
2199
  // fight the host app over one set of module options and register a second app-wide
@@ -1894,7 +2215,7 @@ var DurableApiModule = class _DurableApiModule {
1894
2215
  validation: "off"
1895
2216
  }, null), "useFactory"),
1896
2217
  inject: [
1897
- import_core.ModuleRef
2218
+ import_core2.ModuleRef
1898
2219
  ]
1899
2220
  },
1900
2221
  import_nestjs_filter3.ApplyFilterInterceptor,
@@ -1910,16 +2231,18 @@ var DurableApiModule = class _DurableApiModule {
1910
2231
  // is only exported then: exporting it from a mounted console would shadow a host's own
1911
2232
  // `FilterModule` runner in whatever module imports the dashboard.
1912
2233
  exports: routes ? [
1913
- DashboardService
2234
+ DashboardService,
2235
+ CONSOLE_AUTHORIZE_DECIDE
1914
2236
  ] : [
1915
2237
  DashboardService,
1916
- import_nestjs_filter3.FilterRunner
2238
+ import_nestjs_filter3.FilterRunner,
2239
+ CONSOLE_AUTHORIZE_DECIDE
1917
2240
  ]
1918
2241
  };
1919
2242
  }
1920
2243
  };
1921
- DurableApiModule = _ts_decorate7([
1922
- (0, import_common7.Module)({})
2244
+ DurableApiModule = _ts_decorate8([
2245
+ (0, import_common8.Module)({})
1923
2246
  ], DurableApiModule);
1924
2247
  var DurableDashboardModule = class _DurableDashboardModule {
1925
2248
  static {
@@ -1944,6 +2267,9 @@ var DurableDashboardModule = class _DurableDashboardModule {
1944
2267
  ...options.imports ? {
1945
2268
  imports: options.imports
1946
2269
  } : {},
2270
+ ...options.authorize !== void 0 ? {
2271
+ authorize: options.authorize
2272
+ } : {},
1947
2273
  routes: false
1948
2274
  });
1949
2275
  return {
@@ -1955,7 +2281,8 @@ var DurableDashboardModule = class _DurableDashboardModule {
1955
2281
  controllers: [],
1956
2282
  providers: pathProviders,
1957
2283
  // 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.
2284
+ // the SPA's paths, the read/action service, the filter runner and the resolved `authorize`
2285
+ // (for `@UseConsoleAuthorize()`) via the API module.
1959
2286
  exports: [
1960
2287
  DurableApiModule,
1961
2288
  DASHBOARD_BASE_PATH,
@@ -1963,7 +2290,6 @@ var DurableDashboardModule = class _DurableDashboardModule {
1963
2290
  ]
1964
2291
  };
1965
2292
  }
1966
- const decorated = (options.decorators?.length ?? 0) > 0;
1967
2293
  return {
1968
2294
  module: _DurableDashboardModule,
1969
2295
  imports: [
@@ -1977,9 +2303,12 @@ var DurableDashboardModule = class _DurableDashboardModule {
1977
2303
  } : {},
1978
2304
  ...options.decorators ? {
1979
2305
  decorators: options.decorators
2306
+ } : {},
2307
+ ...options.authorize !== void 0 ? {
2308
+ authorize: options.authorize
1980
2309
  } : {}
1981
2310
  }),
1982
- import_core.RouterModule.register([
2311
+ import_core2.RouterModule.register([
1983
2312
  {
1984
2313
  path: basePath,
1985
2314
  module: _DurableDashboardModule
@@ -1991,14 +2320,9 @@ var DurableDashboardModule = class _DurableDashboardModule {
1991
2320
  ])
1992
2321
  ],
1993
2322
  controllers: [
1994
- controllerFor(DurableUiController, options.decorators)
1995
- ],
1996
- providers: [
1997
- ...pathProviders,
1998
- ...decorated ? [] : [
1999
- protectionCheckProvider()
2000
- ]
2323
+ consoleController(DurableUiController, options.decorators)
2001
2324
  ],
2325
+ providers: pathProviders,
2002
2326
  // Re-export the API module so its DashboardService reaches importers (e.g. flip's own controllers).
2003
2327
  exports: [
2004
2328
  DurableApiModule
@@ -2006,14 +2330,21 @@ var DurableDashboardModule = class _DurableDashboardModule {
2006
2330
  };
2007
2331
  }
2008
2332
  };
2009
- DurableDashboardModule = _ts_decorate7([
2010
- (0, import_common7.Module)({})
2333
+ DurableDashboardModule = _ts_decorate8([
2334
+ (0, import_common8.Module)({})
2011
2335
  ], DurableDashboardModule);
2012
2336
  // Annotate the CommonJS export names for ESM import in node:
2013
2337
  0 && (module.exports = {
2338
+ CONSOLE_AUTHORIZE_DECIDE,
2339
+ CONSOLE_AUTHORIZE_MISSING_WARNING,
2340
+ CONSOLE_GATE,
2341
+ CONSOLE_PAGE_METADATA,
2342
+ ConsoleAccessDenied,
2343
+ ConsoleAuthorizeFilter,
2344
+ ConsoleAuthorizeGuard,
2345
+ ConsolePage,
2014
2346
  DASHBOARD_API_PATH,
2015
2347
  DASHBOARD_BASE_PATH,
2016
- DASHBOARD_PROTECTION_CHECK,
2017
2348
  DashboardService,
2018
2349
  DurableApiController,
2019
2350
  DurableApiControllerBase,
@@ -2021,6 +2352,9 @@ DurableDashboardModule = _ts_decorate7([
2021
2352
  DurableDashboardModule,
2022
2353
  DurableUiController,
2023
2354
  DurableUiControllerBase,
2024
- UNPROTECTED_CONSOLE_IN_PRODUCTION
2355
+ UseConsoleAuthorize,
2356
+ authorizeByToken,
2357
+ normalizeConsoleResult,
2358
+ resolveConsoleAuthorize
2025
2359
  });
2026
2360
  //# sourceMappingURL=index.cjs.map