@dudousxd/nestjs-durable-dashboard 0.50.0 → 0.51.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/durable-client.d.ts +2 -0
- package/dist/client/durable-client.d.ts.map +1 -1
- package/dist/client/durable-client.js +8 -0
- package/dist/client/durable-client.js.map +1 -1
- package/dist/server/index.cjs +402 -293
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +22 -5
- package/dist/server/index.d.ts +22 -5
- package/dist/server/index.js +274 -165
- package/dist/server/index.js.map +1 -1
- package/dist/spa/assets/{bench-bNSq4C-e.js → bench-UvOjwMnz.js} +1 -1
- package/dist/spa/assets/{index-DYEe8Ag-.css → index-BbR4CZ1K.css} +1 -1
- package/dist/spa/assets/{index-CwX0J7uV.js → index-DnQL-Xbv.js} +15 -15
- package/dist/spa/assets/{index-CMQJ1rjL.js → index-ov2ocqi5.js} +1 -1
- package/dist/spa/assets/{preview-CehDLs8M.js → preview-BSiqTdta.js} +1 -1
- package/dist/spa/bench.html +3 -3
- package/dist/spa/index.html +3 -3
- package/dist/spa/preview.html +3 -3
- package/package.json +2 -2
package/dist/server/index.cjs
CHANGED
|
@@ -245,11 +245,30 @@ var DashboardService = class {
|
|
|
245
245
|
}
|
|
246
246
|
/**
|
|
247
247
|
* Deliver a `ctx.webhook()` callback: turn an inbound POST (token + body) into the signal the
|
|
248
|
-
*
|
|
249
|
-
*
|
|
248
|
+
* run is (or will be) parked on. A callback that arrives BEFORE the run reaches `wait()` (the url
|
|
249
|
+
* was handed out and the run is still busy or sleeping) is buffered, and `wait()` consumes it, so
|
|
250
|
+
* the result is the run's current status. Returns `null` — mapped to 404 by the controller — for a
|
|
251
|
+
* token that is not a webhook token, whose run doesn't exist or is terminal, or whose wait already
|
|
252
|
+
* resolved (a duplicate): nothing is buffered for those, so a public endpoint can't leave junk
|
|
253
|
+
* rows behind or signal non-webhook tokens. Control-plane-only.
|
|
250
254
|
*/
|
|
251
255
|
async deliverWebhook(token, body) {
|
|
252
|
-
|
|
256
|
+
const { store, engine } = this.controlPlane();
|
|
257
|
+
const parsed = (0, import_nestjs_durable_core.parseWebhookToken)(token);
|
|
258
|
+
if (!parsed) return null;
|
|
259
|
+
const run = await store.getRun(parsed.runId);
|
|
260
|
+
if (!run || import_nestjs_durable_core.TERMINAL_RUN_STATUSES.includes(run.status)) return null;
|
|
261
|
+
const resolved = await store.getCheckpoint(parsed.runId, parsed.seq);
|
|
262
|
+
if (resolved?.status === "completed") return null;
|
|
263
|
+
const delivered = await engine.signal(token, body);
|
|
264
|
+
if (delivered) return delivered;
|
|
265
|
+
const now = await store.getCheckpoint(parsed.runId, parsed.seq);
|
|
266
|
+
if (now?.status === "completed" && await store.takeBufferedSignal(token)) return null;
|
|
267
|
+
const fresh = await store.getRun(parsed.runId);
|
|
268
|
+
return {
|
|
269
|
+
runId: run.id,
|
|
270
|
+
status: fresh?.status ?? run.status
|
|
271
|
+
};
|
|
253
272
|
}
|
|
254
273
|
/** Side-effect-free read of a value a run published via `ctx.setEvent` (a live query). Control-plane-only. */
|
|
255
274
|
async getEvent(runId, key) {
|
|
@@ -289,7 +308,7 @@ DashboardService = _ts_decorate([
|
|
|
289
308
|
|
|
290
309
|
// src/server/durable-api.controller.ts
|
|
291
310
|
var import_nestjs_filter2 = require("@dudousxd/nestjs-filter");
|
|
292
|
-
var
|
|
311
|
+
var import_common5 = require("@nestjs/common");
|
|
293
312
|
|
|
294
313
|
// src/server/durable-run.ts
|
|
295
314
|
var DurableRun = class {
|
|
@@ -364,6 +383,129 @@ function runValueAxisFor(field) {
|
|
|
364
383
|
}
|
|
365
384
|
__name(runValueAxisFor, "runValueAxisFor");
|
|
366
385
|
|
|
386
|
+
// src/server/not-modified.ts
|
|
387
|
+
var import_common2 = require("@nestjs/common");
|
|
388
|
+
|
|
389
|
+
// src/server/auth/response.ts
|
|
390
|
+
function isRecord(value) {
|
|
391
|
+
return typeof value === "object" && value !== null;
|
|
392
|
+
}
|
|
393
|
+
__name(isRecord, "isRecord");
|
|
394
|
+
function isRawCookieResponse(value) {
|
|
395
|
+
return isRecord(value) && typeof value.getHeader === "function" && typeof value.setHeader === "function";
|
|
396
|
+
}
|
|
397
|
+
__name(isRawCookieResponse, "isRawCookieResponse");
|
|
398
|
+
function resolveCookieResponse(response) {
|
|
399
|
+
if (isRawCookieResponse(response)) return response;
|
|
400
|
+
if (isRecord(response) && isRawCookieResponse(response.raw)) return response.raw;
|
|
401
|
+
return null;
|
|
402
|
+
}
|
|
403
|
+
__name(resolveCookieResponse, "resolveCookieResponse");
|
|
404
|
+
function existingSetCookies(response) {
|
|
405
|
+
const current = response.getHeader("set-cookie");
|
|
406
|
+
if (Array.isArray(current)) return current;
|
|
407
|
+
if (typeof current === "string") return [
|
|
408
|
+
current
|
|
409
|
+
];
|
|
410
|
+
return [];
|
|
411
|
+
}
|
|
412
|
+
__name(existingSetCookies, "existingSetCookies");
|
|
413
|
+
function appendSetCookie(response, cookie) {
|
|
414
|
+
const raw = resolveCookieResponse(response);
|
|
415
|
+
if (!raw) return;
|
|
416
|
+
raw.setHeader("set-cookie", [
|
|
417
|
+
...existingSetCookies(raw),
|
|
418
|
+
cookie
|
|
419
|
+
]);
|
|
420
|
+
}
|
|
421
|
+
__name(appendSetCookie, "appendSetCookie");
|
|
422
|
+
function isRawRedirectResponse(value) {
|
|
423
|
+
return isRecord(value) && typeof value.getHeader === "function" && typeof value.setHeader === "function" && typeof value.end === "function";
|
|
424
|
+
}
|
|
425
|
+
__name(isRawRedirectResponse, "isRawRedirectResponse");
|
|
426
|
+
function resolveRedirectResponse(response) {
|
|
427
|
+
if (isRawRedirectResponse(response)) return response;
|
|
428
|
+
if (isRecord(response) && isRawRedirectResponse(response.raw)) return response.raw;
|
|
429
|
+
return null;
|
|
430
|
+
}
|
|
431
|
+
__name(resolveRedirectResponse, "resolveRedirectResponse");
|
|
432
|
+
function redirectRaw(response, location, status = 302) {
|
|
433
|
+
const raw = resolveRedirectResponse(response);
|
|
434
|
+
if (!raw) return;
|
|
435
|
+
raw.statusCode = status;
|
|
436
|
+
raw.setHeader("location", location);
|
|
437
|
+
raw.end();
|
|
438
|
+
}
|
|
439
|
+
__name(redirectRaw, "redirectRaw");
|
|
440
|
+
function responseAlreadyWritten(response) {
|
|
441
|
+
const raw = resolveRedirectResponse(response);
|
|
442
|
+
return raw?.headersSent === true;
|
|
443
|
+
}
|
|
444
|
+
__name(responseAlreadyWritten, "responseAlreadyWritten");
|
|
445
|
+
function writeHtmlRaw(response, html, status = 200) {
|
|
446
|
+
const raw = resolveRedirectResponse(response);
|
|
447
|
+
if (!raw) return;
|
|
448
|
+
raw.statusCode = status;
|
|
449
|
+
raw.setHeader("content-type", "text/html; charset=utf-8");
|
|
450
|
+
raw.setHeader("cache-control", "no-store, must-revalidate");
|
|
451
|
+
raw.end(html);
|
|
452
|
+
}
|
|
453
|
+
__name(writeHtmlRaw, "writeHtmlRaw");
|
|
454
|
+
function setRawHeader(response, name, value) {
|
|
455
|
+
resolveCookieResponse(response)?.setHeader(name, value);
|
|
456
|
+
}
|
|
457
|
+
__name(setRawHeader, "setRawHeader");
|
|
458
|
+
function writeNotModifiedRaw(response, etag) {
|
|
459
|
+
const raw = resolveRedirectResponse(response);
|
|
460
|
+
if (!raw) return;
|
|
461
|
+
raw.statusCode = 304;
|
|
462
|
+
raw.setHeader("etag", etag);
|
|
463
|
+
raw.setHeader("cache-control", "private, no-cache");
|
|
464
|
+
raw.end();
|
|
465
|
+
}
|
|
466
|
+
__name(writeNotModifiedRaw, "writeNotModifiedRaw");
|
|
467
|
+
|
|
468
|
+
// src/server/not-modified.ts
|
|
469
|
+
function _ts_decorate2(decorators, target, key, desc) {
|
|
470
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
471
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
472
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
473
|
+
} else {
|
|
474
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
475
|
+
if (d = decorators[i]) {
|
|
476
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
481
|
+
}
|
|
482
|
+
__name(_ts_decorate2, "_ts_decorate");
|
|
483
|
+
var NotModifiedException = class extends import_common2.HttpException {
|
|
484
|
+
static {
|
|
485
|
+
__name(this, "NotModifiedException");
|
|
486
|
+
}
|
|
487
|
+
etag;
|
|
488
|
+
constructor(etag) {
|
|
489
|
+
super("Not Modified", 304), this.etag = etag;
|
|
490
|
+
}
|
|
491
|
+
};
|
|
492
|
+
var NotModifiedFilter = class {
|
|
493
|
+
static {
|
|
494
|
+
__name(this, "NotModifiedFilter");
|
|
495
|
+
}
|
|
496
|
+
catch(exception, host) {
|
|
497
|
+
writeNotModifiedRaw(host.switchToHttp().getResponse(), exception.etag);
|
|
498
|
+
}
|
|
499
|
+
};
|
|
500
|
+
NotModifiedFilter = _ts_decorate2([
|
|
501
|
+
(0, import_common2.Catch)(NotModifiedException)
|
|
502
|
+
], NotModifiedFilter);
|
|
503
|
+
function setEtag(response, etag) {
|
|
504
|
+
setRawHeader(response, "etag", etag);
|
|
505
|
+
setRawHeader(response, "cache-control", "private, no-cache");
|
|
506
|
+
}
|
|
507
|
+
__name(setEtag, "setEtag");
|
|
508
|
+
|
|
367
509
|
// src/server/run-list-row.ts
|
|
368
510
|
function toRunListRow(run) {
|
|
369
511
|
const { input: _input, output: _output, error: _error, ...row } = run;
|
|
@@ -373,7 +515,7 @@ __name(toRunListRow, "toRunListRow");
|
|
|
373
515
|
|
|
374
516
|
// src/server/run.filter.ts
|
|
375
517
|
var import_nestjs_filter = require("@dudousxd/nestjs-filter");
|
|
376
|
-
var
|
|
518
|
+
var import_common4 = require("@nestjs/common");
|
|
377
519
|
|
|
378
520
|
// src/server/attr-filter.ts
|
|
379
521
|
var SCALAR_OPS = /* @__PURE__ */ new Set([
|
|
@@ -424,7 +566,7 @@ __name(parseAttrFilters, "parseAttrFilters");
|
|
|
424
566
|
|
|
425
567
|
// src/server/run-query.adapter.ts
|
|
426
568
|
var import_nestjs_durable_core2 = require("@dudousxd/nestjs-durable-core");
|
|
427
|
-
var
|
|
569
|
+
var import_common3 = require("@nestjs/common");
|
|
428
570
|
|
|
429
571
|
// src/server/run-query-draft.ts
|
|
430
572
|
var RunQueryDraft2 = class {
|
|
@@ -454,7 +596,7 @@ var RunQueryDraft2 = class {
|
|
|
454
596
|
};
|
|
455
597
|
|
|
456
598
|
// src/server/run-query.adapter.ts
|
|
457
|
-
function
|
|
599
|
+
function _ts_decorate3(decorators, target, key, desc) {
|
|
458
600
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
459
601
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
460
602
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -467,7 +609,7 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
467
609
|
}
|
|
468
610
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
469
611
|
}
|
|
470
|
-
__name(
|
|
612
|
+
__name(_ts_decorate3, "_ts_decorate");
|
|
471
613
|
function _ts_metadata2(metadataKey, metadataValue) {
|
|
472
614
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
473
615
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
@@ -495,7 +637,7 @@ function operands(clause) {
|
|
|
495
637
|
}
|
|
496
638
|
__name(operands, "operands");
|
|
497
639
|
function unsupported(clause, supported) {
|
|
498
|
-
throw new
|
|
640
|
+
throw new import_common3.BadRequestException(`The durable run list cannot filter \`${clause.field}\` with \`${clause.operator}\`. Supported here: ${supported}.`);
|
|
499
641
|
}
|
|
500
642
|
__name(unsupported, "unsupported");
|
|
501
643
|
var RunQueryAdapter = class {
|
|
@@ -533,7 +675,7 @@ var RunQueryAdapter = class {
|
|
|
533
675
|
const draft = this.draft(qb);
|
|
534
676
|
for (const clause of filters) {
|
|
535
677
|
if (clause.AND || clause.OR) {
|
|
536
|
-
throw new
|
|
678
|
+
throw new import_common3.BadRequestException("The durable run list cannot filter with nested AND/OR groups: its predicates are a flat conjunction.");
|
|
537
679
|
}
|
|
538
680
|
this.applyClause(draft, clause);
|
|
539
681
|
}
|
|
@@ -624,7 +766,7 @@ var RunQueryAdapter = class {
|
|
|
624
766
|
applyAttributeClause(draft, clause) {
|
|
625
767
|
const key = clause.field.slice(ATTRIBUTE_FIELD.length + 1);
|
|
626
768
|
if (!key) {
|
|
627
|
-
throw new
|
|
769
|
+
throw new import_common3.BadRequestException("Filtering search attributes needs a key: `attr.<key>`, e.g. `attr.tier`.");
|
|
628
770
|
}
|
|
629
771
|
const scalarOps = {
|
|
630
772
|
equals: "eq",
|
|
@@ -668,7 +810,7 @@ var RunQueryAdapter = class {
|
|
|
668
810
|
applySort(_qb, sorts) {
|
|
669
811
|
for (const sort of sorts) {
|
|
670
812
|
if (sort.field !== FIXED_ORDER.field || sort.direction !== FIXED_ORDER.direction) {
|
|
671
|
-
throw new
|
|
813
|
+
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}\`.`);
|
|
672
814
|
}
|
|
673
815
|
}
|
|
674
816
|
}
|
|
@@ -709,14 +851,14 @@ var RunQueryAdapter = class {
|
|
|
709
851
|
async groupByCount(qb, field, entity, opts) {
|
|
710
852
|
this.assertDurableRun(entity);
|
|
711
853
|
if (typeof field !== "string") {
|
|
712
|
-
throw new
|
|
854
|
+
throw new import_common3.BadRequestException("The durable run list has no computed fields to group by \u2014 group by one of its own fields.");
|
|
713
855
|
}
|
|
714
856
|
if (opts?.bucket !== void 0) {
|
|
715
|
-
throw new
|
|
857
|
+
throw new import_common3.BadRequestException("The durable run list cannot bucket a group-by-count: none of its filterable fields is numeric.");
|
|
716
858
|
}
|
|
717
859
|
const axis = runValueAxisFor(field);
|
|
718
860
|
if (!axis) {
|
|
719
|
-
throw new
|
|
861
|
+
throw new import_common3.BadRequestException(`The durable run list cannot enumerate values of \`${field}\`.`);
|
|
720
862
|
}
|
|
721
863
|
const rows = await this.gateway.runValueFacets(axis, this.draft(qb).facetQuery(), {
|
|
722
864
|
limit: opts?.limit ?? import_nestjs_durable_core2.RUN_VALUE_FACET_LIMIT,
|
|
@@ -747,8 +889,8 @@ var RunQueryAdapter = class {
|
|
|
747
889
|
}
|
|
748
890
|
}
|
|
749
891
|
};
|
|
750
|
-
RunQueryAdapter =
|
|
751
|
-
(0,
|
|
892
|
+
RunQueryAdapter = _ts_decorate3([
|
|
893
|
+
(0, import_common3.Injectable)(),
|
|
752
894
|
_ts_metadata2("design:type", Function),
|
|
753
895
|
_ts_metadata2("design:paramtypes", [
|
|
754
896
|
typeof import_nestjs_durable_core2.RunGateway === "undefined" ? Object : import_nestjs_durable_core2.RunGateway
|
|
@@ -756,7 +898,7 @@ RunQueryAdapter = _ts_decorate2([
|
|
|
756
898
|
], RunQueryAdapter);
|
|
757
899
|
|
|
758
900
|
// src/server/run.filter.ts
|
|
759
|
-
function
|
|
901
|
+
function _ts_decorate4(decorators, target, key, desc) {
|
|
760
902
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
761
903
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
762
904
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -769,7 +911,7 @@ function _ts_decorate3(decorators, target, key, desc) {
|
|
|
769
911
|
}
|
|
770
912
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
771
913
|
}
|
|
772
|
-
__name(
|
|
914
|
+
__name(_ts_decorate4, "_ts_decorate");
|
|
773
915
|
function _ts_metadata3(metadataKey, metadataValue) {
|
|
774
916
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
775
917
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
@@ -895,7 +1037,7 @@ var RunFilter = class extends import_nestjs_filter.BaseFilter {
|
|
|
895
1037
|
});
|
|
896
1038
|
}
|
|
897
1039
|
};
|
|
898
|
-
|
|
1040
|
+
_ts_decorate4([
|
|
899
1041
|
(0, import_nestjs_filter.FilterFor)("status"),
|
|
900
1042
|
_ts_metadata3("design:type", Function),
|
|
901
1043
|
_ts_metadata3("design:paramtypes", [
|
|
@@ -903,7 +1045,7 @@ _ts_decorate3([
|
|
|
903
1045
|
]),
|
|
904
1046
|
_ts_metadata3("design:returntype", void 0)
|
|
905
1047
|
], RunFilter.prototype, "applyStatus", null);
|
|
906
|
-
|
|
1048
|
+
_ts_decorate4([
|
|
907
1049
|
(0, import_nestjs_filter.FilterFor)("workflow"),
|
|
908
1050
|
_ts_metadata3("design:type", Function),
|
|
909
1051
|
_ts_metadata3("design:paramtypes", [
|
|
@@ -911,7 +1053,7 @@ _ts_decorate3([
|
|
|
911
1053
|
]),
|
|
912
1054
|
_ts_metadata3("design:returntype", void 0)
|
|
913
1055
|
], RunFilter.prototype, "applyWorkflow", null);
|
|
914
|
-
|
|
1056
|
+
_ts_decorate4([
|
|
915
1057
|
(0, import_nestjs_filter.FilterFor)("namespace"),
|
|
916
1058
|
_ts_metadata3("design:type", Function),
|
|
917
1059
|
_ts_metadata3("design:paramtypes", [
|
|
@@ -919,7 +1061,7 @@ _ts_decorate3([
|
|
|
919
1061
|
]),
|
|
920
1062
|
_ts_metadata3("design:returntype", void 0)
|
|
921
1063
|
], RunFilter.prototype, "applyNamespace", null);
|
|
922
|
-
|
|
1064
|
+
_ts_decorate4([
|
|
923
1065
|
(0, import_nestjs_filter.FilterFor)("tag"),
|
|
924
1066
|
_ts_metadata3("design:type", Function),
|
|
925
1067
|
_ts_metadata3("design:paramtypes", [
|
|
@@ -927,19 +1069,19 @@ _ts_decorate3([
|
|
|
927
1069
|
]),
|
|
928
1070
|
_ts_metadata3("design:returntype", void 0)
|
|
929
1071
|
], RunFilter.prototype, "applyTag", null);
|
|
930
|
-
|
|
1072
|
+
_ts_decorate4([
|
|
931
1073
|
(0, import_nestjs_filter.FilterFor)("origin"),
|
|
932
1074
|
_ts_metadata3("design:type", Function),
|
|
933
1075
|
_ts_metadata3("design:paramtypes", []),
|
|
934
1076
|
_ts_metadata3("design:returntype", void 0)
|
|
935
1077
|
], RunFilter.prototype, "applyOrigin", null);
|
|
936
|
-
|
|
1078
|
+
_ts_decorate4([
|
|
937
1079
|
(0, import_nestjs_filter.FilterFor)("unattributed"),
|
|
938
1080
|
_ts_metadata3("design:type", Function),
|
|
939
1081
|
_ts_metadata3("design:paramtypes", []),
|
|
940
1082
|
_ts_metadata3("design:returntype", void 0)
|
|
941
1083
|
], RunFilter.prototype, "applyUnattributed", null);
|
|
942
|
-
|
|
1084
|
+
_ts_decorate4([
|
|
943
1085
|
(0, import_nestjs_filter.FilterFor)("attr"),
|
|
944
1086
|
_ts_metadata3("design:type", Function),
|
|
945
1087
|
_ts_metadata3("design:paramtypes", [
|
|
@@ -947,7 +1089,7 @@ _ts_decorate3([
|
|
|
947
1089
|
]),
|
|
948
1090
|
_ts_metadata3("design:returntype", void 0)
|
|
949
1091
|
], RunFilter.prototype, "applyAttributes", null);
|
|
950
|
-
|
|
1092
|
+
_ts_decorate4([
|
|
951
1093
|
(0, import_nestjs_filter.FilterFor)("limit"),
|
|
952
1094
|
_ts_metadata3("design:type", Function),
|
|
953
1095
|
_ts_metadata3("design:paramtypes", [
|
|
@@ -955,7 +1097,7 @@ _ts_decorate3([
|
|
|
955
1097
|
]),
|
|
956
1098
|
_ts_metadata3("design:returntype", void 0)
|
|
957
1099
|
], RunFilter.prototype, "applyLimit", null);
|
|
958
|
-
|
|
1100
|
+
_ts_decorate4([
|
|
959
1101
|
(0, import_nestjs_filter.FilterFor)("offset"),
|
|
960
1102
|
_ts_metadata3("design:type", Function),
|
|
961
1103
|
_ts_metadata3("design:paramtypes", [
|
|
@@ -963,8 +1105,8 @@ _ts_decorate3([
|
|
|
963
1105
|
]),
|
|
964
1106
|
_ts_metadata3("design:returntype", void 0)
|
|
965
1107
|
], RunFilter.prototype, "applyOffset", null);
|
|
966
|
-
RunFilter =
|
|
967
|
-
(0,
|
|
1108
|
+
RunFilter = _ts_decorate4([
|
|
1109
|
+
(0, import_common4.Injectable)(),
|
|
968
1110
|
(0, import_nestjs_filter.Filterable)({
|
|
969
1111
|
entity: DurableRun,
|
|
970
1112
|
adapter: RUN_QUERY_ADAPTER,
|
|
@@ -973,7 +1115,7 @@ RunFilter = _ts_decorate3([
|
|
|
973
1115
|
], RunFilter);
|
|
974
1116
|
|
|
975
1117
|
// src/server/durable-api.controller.ts
|
|
976
|
-
function
|
|
1118
|
+
function _ts_decorate5(decorators, target, key, desc) {
|
|
977
1119
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
978
1120
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
979
1121
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -986,7 +1128,7 @@ function _ts_decorate4(decorators, target, key, desc) {
|
|
|
986
1128
|
}
|
|
987
1129
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
988
1130
|
}
|
|
989
|
-
__name(
|
|
1131
|
+
__name(_ts_decorate5, "_ts_decorate");
|
|
990
1132
|
function _ts_metadata4(metadataKey, metadataValue) {
|
|
991
1133
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
992
1134
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
@@ -1101,23 +1243,43 @@ var DurableApiController = class {
|
|
|
1101
1243
|
/**
|
|
1102
1244
|
* A run's detail. Fans wider than {@link FAN_INLINE_MAX} come back as one `FanSummary` each, their
|
|
1103
1245
|
* members paged by `runs/:id/fans/:group`; `?full=true` returns every checkpoint instead.
|
|
1246
|
+
*
|
|
1247
|
+
* When the gateway can version the detail without reading it, the response carries an `ETag`, and
|
|
1248
|
+
* a poll whose `If-None-Match` still names it gets a 304 before the timeline is read. The browser
|
|
1249
|
+
* sends that header itself (the response is `no-cache`), so a console poll needs no code for it.
|
|
1104
1250
|
*/
|
|
1105
|
-
async run(id, full) {
|
|
1251
|
+
async run(id, full, ifNoneMatch, response) {
|
|
1106
1252
|
const detail = await this.dashboard.getRunDetail(id, full === "true" ? void 0 : {
|
|
1107
|
-
summarizeFansOver: FAN_INLINE_MAX
|
|
1253
|
+
summarizeFansOver: FAN_INLINE_MAX,
|
|
1254
|
+
...ifNoneMatch && {
|
|
1255
|
+
ifNoneMatch
|
|
1256
|
+
}
|
|
1108
1257
|
});
|
|
1109
|
-
if (!detail) throw new
|
|
1110
|
-
|
|
1258
|
+
if (!detail) throw new import_common5.NotFoundException(`run ${id} not found`);
|
|
1259
|
+
const { etag, notModified, ...body } = detail;
|
|
1260
|
+
if (etag) {
|
|
1261
|
+
if (notModified) throw new NotModifiedException(etag);
|
|
1262
|
+
setEtag(response, etag);
|
|
1263
|
+
}
|
|
1264
|
+
return body;
|
|
1111
1265
|
}
|
|
1112
|
-
/** One page of a summarized fan's members, in seq order. */
|
|
1113
|
-
async fanMembers(id, group, offset, limit, failed) {
|
|
1266
|
+
/** One page of a summarized fan's members, in seq order. Versioned like {@link run}. */
|
|
1267
|
+
async fanMembers(id, group, offset, limit, failed, ifNoneMatch, response) {
|
|
1114
1268
|
const page2 = await this.dashboard.getFanMembers(id, group, {
|
|
1115
1269
|
offset: offset === void 0 ? void 0 : Number(offset),
|
|
1116
1270
|
limit: limit === void 0 ? void 0 : Number(limit),
|
|
1117
|
-
failedOnly: failed === "true"
|
|
1271
|
+
failedOnly: failed === "true",
|
|
1272
|
+
...ifNoneMatch && {
|
|
1273
|
+
ifNoneMatch
|
|
1274
|
+
}
|
|
1118
1275
|
});
|
|
1119
|
-
if (!page2) throw new
|
|
1120
|
-
|
|
1276
|
+
if (!page2) throw new import_common5.NotFoundException(`fan ${group} of run ${id} not found`);
|
|
1277
|
+
const { etag, notModified, ...body } = page2;
|
|
1278
|
+
if (etag) {
|
|
1279
|
+
if (notModified) throw new NotModifiedException(etag);
|
|
1280
|
+
setEtag(response, etag);
|
|
1281
|
+
}
|
|
1282
|
+
return body;
|
|
1121
1283
|
}
|
|
1122
1284
|
/** Server-Sent Events stream of a run's live lifecycle events — the dashboard tails it instead
|
|
1123
1285
|
* of polling. Cross-pod when the transport has a control plane (see DashboardService.streamRun). */
|
|
@@ -1146,18 +1308,18 @@ var DurableApiController = class {
|
|
|
1146
1308
|
const result = await this.dashboard.cancel(id, {
|
|
1147
1309
|
compensate: compensate === "true"
|
|
1148
1310
|
});
|
|
1149
|
-
if (!result) throw new
|
|
1311
|
+
if (!result) throw new import_common5.NotFoundException(`run ${id} not found`);
|
|
1150
1312
|
return result;
|
|
1151
1313
|
}
|
|
1152
1314
|
async continue(id) {
|
|
1153
1315
|
const result = await this.dashboard.continue(id);
|
|
1154
|
-
if (!result) throw new
|
|
1316
|
+
if (!result) throw new import_common5.NotFoundException(`run ${id} is not paused at a breakpoint`);
|
|
1155
1317
|
return result;
|
|
1156
1318
|
}
|
|
1157
1319
|
/** Re-dispatch a run's stuck `pending` remote steps — recovery for a lost step dispatch. */
|
|
1158
1320
|
async redispatch(id) {
|
|
1159
1321
|
const result = await this.dashboard.redispatch(id);
|
|
1160
|
-
if (!result) throw new
|
|
1322
|
+
if (!result) throw new import_common5.NotFoundException(`run ${id} not found`);
|
|
1161
1323
|
return result;
|
|
1162
1324
|
}
|
|
1163
1325
|
/**
|
|
@@ -1168,7 +1330,7 @@ var DurableApiController = class {
|
|
|
1168
1330
|
*/
|
|
1169
1331
|
async webhook(token, body) {
|
|
1170
1332
|
const result = await this.dashboard.deliverWebhook(token, body);
|
|
1171
|
-
if (!result) throw new
|
|
1333
|
+
if (!result) throw new import_common5.NotFoundException(`no live run is waiting for webhook ${token}`);
|
|
1172
1334
|
return result;
|
|
1173
1335
|
}
|
|
1174
1336
|
/** Live query: the latest value a run published for `key` via `ctx.setEvent` (no side effect). */
|
|
@@ -1180,8 +1342,8 @@ var DurableApiController = class {
|
|
|
1180
1342
|
return this.dashboard.update(id, name, body);
|
|
1181
1343
|
}
|
|
1182
1344
|
};
|
|
1183
|
-
|
|
1184
|
-
(0,
|
|
1345
|
+
_ts_decorate5([
|
|
1346
|
+
(0, import_common5.Get)("runs"),
|
|
1185
1347
|
_ts_param2(0, (0, import_nestjs_filter2.ApplyFilter)(RunFilter)),
|
|
1186
1348
|
_ts_metadata4("design:type", Function),
|
|
1187
1349
|
_ts_metadata4("design:paramtypes", [
|
|
@@ -1189,8 +1351,8 @@ _ts_decorate4([
|
|
|
1189
1351
|
]),
|
|
1190
1352
|
_ts_metadata4("design:returntype", Promise)
|
|
1191
1353
|
], DurableApiController.prototype, "runs", null);
|
|
1192
|
-
|
|
1193
|
-
(0,
|
|
1354
|
+
_ts_decorate5([
|
|
1355
|
+
(0, import_common5.Get)("runs/facets"),
|
|
1194
1356
|
_ts_param2(0, (0, import_nestjs_filter2.ApplyFilter)(RunFilter)),
|
|
1195
1357
|
_ts_metadata4("design:type", Function),
|
|
1196
1358
|
_ts_metadata4("design:paramtypes", [
|
|
@@ -1198,35 +1360,35 @@ _ts_decorate4([
|
|
|
1198
1360
|
]),
|
|
1199
1361
|
_ts_metadata4("design:returntype", void 0)
|
|
1200
1362
|
], DurableApiController.prototype, "facets", null);
|
|
1201
|
-
|
|
1202
|
-
(0,
|
|
1203
|
-
_ts_param2(0, (0,
|
|
1363
|
+
_ts_decorate5([
|
|
1364
|
+
(0, import_common5.Get)("runs/values"),
|
|
1365
|
+
_ts_param2(0, (0, import_common5.Query)()),
|
|
1204
1366
|
_ts_metadata4("design:type", Function),
|
|
1205
1367
|
_ts_metadata4("design:paramtypes", [
|
|
1206
1368
|
typeof Record === "undefined" ? Object : Record
|
|
1207
1369
|
]),
|
|
1208
1370
|
_ts_metadata4("design:returntype", void 0)
|
|
1209
1371
|
], DurableApiController.prototype, "values", null);
|
|
1210
|
-
|
|
1211
|
-
(0,
|
|
1212
|
-
(0,
|
|
1372
|
+
_ts_decorate5([
|
|
1373
|
+
(0, import_common5.Get)("metrics"),
|
|
1374
|
+
(0, import_common5.Header)("Content-Type", "text/plain; version=0.0.4"),
|
|
1213
1375
|
_ts_metadata4("design:type", Function),
|
|
1214
1376
|
_ts_metadata4("design:paramtypes", []),
|
|
1215
1377
|
_ts_metadata4("design:returntype", void 0)
|
|
1216
1378
|
], DurableApiController.prototype, "metrics", null);
|
|
1217
|
-
|
|
1218
|
-
(0,
|
|
1379
|
+
_ts_decorate5([
|
|
1380
|
+
(0, import_common5.Get)("workers"),
|
|
1219
1381
|
_ts_metadata4("design:type", Function),
|
|
1220
1382
|
_ts_metadata4("design:paramtypes", []),
|
|
1221
1383
|
_ts_metadata4("design:returntype", void 0)
|
|
1222
1384
|
], DurableApiController.prototype, "workers", null);
|
|
1223
|
-
|
|
1224
|
-
(0,
|
|
1225
|
-
_ts_param2(0, (0,
|
|
1226
|
-
_ts_param2(1, (0,
|
|
1227
|
-
_ts_param2(2, (0,
|
|
1228
|
-
_ts_param2(3, (0,
|
|
1229
|
-
_ts_param2(4, (0,
|
|
1385
|
+
_ts_decorate5([
|
|
1386
|
+
(0, import_common5.Get)("schedules"),
|
|
1387
|
+
_ts_param2(0, (0, import_common5.Query)("namespace")),
|
|
1388
|
+
_ts_param2(1, (0, import_common5.Query)("workflow")),
|
|
1389
|
+
_ts_param2(2, (0, import_common5.Query)("tag")),
|
|
1390
|
+
_ts_param2(3, (0, import_common5.Query)("paused")),
|
|
1391
|
+
_ts_param2(4, (0, import_common5.Query)("limit")),
|
|
1230
1392
|
_ts_metadata4("design:type", Function),
|
|
1231
1393
|
_ts_metadata4("design:paramtypes", [
|
|
1232
1394
|
String,
|
|
@@ -1237,89 +1399,101 @@ _ts_decorate4([
|
|
|
1237
1399
|
]),
|
|
1238
1400
|
_ts_metadata4("design:returntype", void 0)
|
|
1239
1401
|
], DurableApiController.prototype, "schedules", null);
|
|
1240
|
-
|
|
1241
|
-
(0,
|
|
1242
|
-
_ts_param2(0, (0,
|
|
1402
|
+
_ts_decorate5([
|
|
1403
|
+
(0, import_common5.Post)("schedules/:id/pause"),
|
|
1404
|
+
_ts_param2(0, (0, import_common5.Param)("id")),
|
|
1243
1405
|
_ts_metadata4("design:type", Function),
|
|
1244
1406
|
_ts_metadata4("design:paramtypes", [
|
|
1245
1407
|
String
|
|
1246
1408
|
]),
|
|
1247
1409
|
_ts_metadata4("design:returntype", void 0)
|
|
1248
1410
|
], DurableApiController.prototype, "pauseSchedule", null);
|
|
1249
|
-
|
|
1250
|
-
(0,
|
|
1251
|
-
_ts_param2(0, (0,
|
|
1411
|
+
_ts_decorate5([
|
|
1412
|
+
(0, import_common5.Post)("schedules/:id/resume"),
|
|
1413
|
+
_ts_param2(0, (0, import_common5.Param)("id")),
|
|
1252
1414
|
_ts_metadata4("design:type", Function),
|
|
1253
1415
|
_ts_metadata4("design:paramtypes", [
|
|
1254
1416
|
String
|
|
1255
1417
|
]),
|
|
1256
1418
|
_ts_metadata4("design:returntype", void 0)
|
|
1257
1419
|
], DurableApiController.prototype, "resumeSchedule", null);
|
|
1258
|
-
|
|
1259
|
-
(0,
|
|
1260
|
-
_ts_param2(0, (0,
|
|
1420
|
+
_ts_decorate5([
|
|
1421
|
+
(0, import_common5.Post)("schedules/:id/trigger"),
|
|
1422
|
+
_ts_param2(0, (0, import_common5.Param)("id")),
|
|
1261
1423
|
_ts_metadata4("design:type", Function),
|
|
1262
1424
|
_ts_metadata4("design:paramtypes", [
|
|
1263
1425
|
String
|
|
1264
1426
|
]),
|
|
1265
1427
|
_ts_metadata4("design:returntype", void 0)
|
|
1266
1428
|
], DurableApiController.prototype, "triggerSchedule", null);
|
|
1267
|
-
|
|
1268
|
-
(0,
|
|
1429
|
+
_ts_decorate5([
|
|
1430
|
+
(0, import_common5.Get)("topology"),
|
|
1269
1431
|
_ts_metadata4("design:type", Function),
|
|
1270
1432
|
_ts_metadata4("design:paramtypes", []),
|
|
1271
1433
|
_ts_metadata4("design:returntype", void 0)
|
|
1272
1434
|
], DurableApiController.prototype, "topology", null);
|
|
1273
|
-
|
|
1274
|
-
(0,
|
|
1275
|
-
_ts_param2(0, (0,
|
|
1276
|
-
_ts_param2(1, (0,
|
|
1435
|
+
_ts_decorate5([
|
|
1436
|
+
(0, import_common5.Get)("runs/:id"),
|
|
1437
|
+
_ts_param2(0, (0, import_common5.Param)("id")),
|
|
1438
|
+
_ts_param2(1, (0, import_common5.Query)("full")),
|
|
1439
|
+
_ts_param2(2, (0, import_common5.Headers)("if-none-match")),
|
|
1440
|
+
_ts_param2(3, (0, import_common5.Res)({
|
|
1441
|
+
passthrough: true
|
|
1442
|
+
})),
|
|
1277
1443
|
_ts_metadata4("design:type", Function),
|
|
1278
1444
|
_ts_metadata4("design:paramtypes", [
|
|
1279
1445
|
String,
|
|
1280
|
-
String
|
|
1446
|
+
String,
|
|
1447
|
+
String,
|
|
1448
|
+
Object
|
|
1281
1449
|
]),
|
|
1282
1450
|
_ts_metadata4("design:returntype", Promise)
|
|
1283
1451
|
], DurableApiController.prototype, "run", null);
|
|
1284
|
-
|
|
1285
|
-
(0,
|
|
1286
|
-
_ts_param2(0, (0,
|
|
1287
|
-
_ts_param2(1, (0,
|
|
1288
|
-
_ts_param2(2, (0,
|
|
1289
|
-
_ts_param2(3, (0,
|
|
1290
|
-
_ts_param2(4, (0,
|
|
1452
|
+
_ts_decorate5([
|
|
1453
|
+
(0, import_common5.Get)("runs/:id/fans/:group"),
|
|
1454
|
+
_ts_param2(0, (0, import_common5.Param)("id")),
|
|
1455
|
+
_ts_param2(1, (0, import_common5.Param)("group")),
|
|
1456
|
+
_ts_param2(2, (0, import_common5.Query)("offset")),
|
|
1457
|
+
_ts_param2(3, (0, import_common5.Query)("limit")),
|
|
1458
|
+
_ts_param2(4, (0, import_common5.Query)("failed")),
|
|
1459
|
+
_ts_param2(5, (0, import_common5.Headers)("if-none-match")),
|
|
1460
|
+
_ts_param2(6, (0, import_common5.Res)({
|
|
1461
|
+
passthrough: true
|
|
1462
|
+
})),
|
|
1291
1463
|
_ts_metadata4("design:type", Function),
|
|
1292
1464
|
_ts_metadata4("design:paramtypes", [
|
|
1293
1465
|
String,
|
|
1294
1466
|
String,
|
|
1295
1467
|
String,
|
|
1296
1468
|
String,
|
|
1297
|
-
String
|
|
1469
|
+
String,
|
|
1470
|
+
String,
|
|
1471
|
+
Object
|
|
1298
1472
|
]),
|
|
1299
1473
|
_ts_metadata4("design:returntype", Promise)
|
|
1300
1474
|
], DurableApiController.prototype, "fanMembers", null);
|
|
1301
|
-
|
|
1302
|
-
(0,
|
|
1303
|
-
_ts_param2(0, (0,
|
|
1475
|
+
_ts_decorate5([
|
|
1476
|
+
(0, import_common5.Sse)("runs/:id/stream"),
|
|
1477
|
+
_ts_param2(0, (0, import_common5.Param)("id")),
|
|
1304
1478
|
_ts_metadata4("design:type", Function),
|
|
1305
1479
|
_ts_metadata4("design:paramtypes", [
|
|
1306
1480
|
String
|
|
1307
1481
|
]),
|
|
1308
1482
|
_ts_metadata4("design:returntype", void 0)
|
|
1309
1483
|
], DurableApiController.prototype, "stream", null);
|
|
1310
|
-
|
|
1311
|
-
(0,
|
|
1312
|
-
_ts_param2(0, (0,
|
|
1484
|
+
_ts_decorate5([
|
|
1485
|
+
(0, import_common5.Post)("runs/:id/retry"),
|
|
1486
|
+
_ts_param2(0, (0, import_common5.Param)("id")),
|
|
1313
1487
|
_ts_metadata4("design:type", Function),
|
|
1314
1488
|
_ts_metadata4("design:paramtypes", [
|
|
1315
1489
|
String
|
|
1316
1490
|
]),
|
|
1317
1491
|
_ts_metadata4("design:returntype", void 0)
|
|
1318
1492
|
], DurableApiController.prototype, "retry", null);
|
|
1319
|
-
|
|
1320
|
-
(0,
|
|
1321
|
-
_ts_param2(0, (0,
|
|
1322
|
-
_ts_param2(1, (0,
|
|
1493
|
+
_ts_decorate5([
|
|
1494
|
+
(0, import_common5.Post)("runs/:id/retry-with-input"),
|
|
1495
|
+
_ts_param2(0, (0, import_common5.Param)("id")),
|
|
1496
|
+
_ts_param2(1, (0, import_common5.Body)()),
|
|
1323
1497
|
_ts_metadata4("design:type", Function),
|
|
1324
1498
|
_ts_metadata4("design:paramtypes", [
|
|
1325
1499
|
String,
|
|
@@ -1327,11 +1501,11 @@ _ts_decorate4([
|
|
|
1327
1501
|
]),
|
|
1328
1502
|
_ts_metadata4("design:returntype", void 0)
|
|
1329
1503
|
], DurableApiController.prototype, "retryWithInput", null);
|
|
1330
|
-
|
|
1331
|
-
(0,
|
|
1332
|
-
_ts_param2(0, (0,
|
|
1504
|
+
_ts_decorate5([
|
|
1505
|
+
(0, import_common5.Post)("bulk/:action"),
|
|
1506
|
+
_ts_param2(0, (0, import_common5.Param)("action")),
|
|
1333
1507
|
_ts_param2(1, (0, import_nestjs_filter2.ApplyFilter)(RunFilter)),
|
|
1334
|
-
_ts_param2(2, (0,
|
|
1508
|
+
_ts_param2(2, (0, import_common5.Query)("compensate")),
|
|
1335
1509
|
_ts_metadata4("design:type", Function),
|
|
1336
1510
|
_ts_metadata4("design:paramtypes", [
|
|
1337
1511
|
String,
|
|
@@ -1340,10 +1514,10 @@ _ts_decorate4([
|
|
|
1340
1514
|
]),
|
|
1341
1515
|
_ts_metadata4("design:returntype", void 0)
|
|
1342
1516
|
], DurableApiController.prototype, "bulk", null);
|
|
1343
|
-
|
|
1344
|
-
(0,
|
|
1345
|
-
_ts_param2(0, (0,
|
|
1346
|
-
_ts_param2(1, (0,
|
|
1517
|
+
_ts_decorate5([
|
|
1518
|
+
(0, import_common5.Post)("runs/:id/cancel"),
|
|
1519
|
+
_ts_param2(0, (0, import_common5.Param)("id")),
|
|
1520
|
+
_ts_param2(1, (0, import_common5.Query)("compensate")),
|
|
1347
1521
|
_ts_metadata4("design:type", Function),
|
|
1348
1522
|
_ts_metadata4("design:paramtypes", [
|
|
1349
1523
|
String,
|
|
@@ -1351,28 +1525,28 @@ _ts_decorate4([
|
|
|
1351
1525
|
]),
|
|
1352
1526
|
_ts_metadata4("design:returntype", Promise)
|
|
1353
1527
|
], DurableApiController.prototype, "cancel", null);
|
|
1354
|
-
|
|
1355
|
-
(0,
|
|
1356
|
-
_ts_param2(0, (0,
|
|
1528
|
+
_ts_decorate5([
|
|
1529
|
+
(0, import_common5.Post)("runs/:id/continue"),
|
|
1530
|
+
_ts_param2(0, (0, import_common5.Param)("id")),
|
|
1357
1531
|
_ts_metadata4("design:type", Function),
|
|
1358
1532
|
_ts_metadata4("design:paramtypes", [
|
|
1359
1533
|
String
|
|
1360
1534
|
]),
|
|
1361
1535
|
_ts_metadata4("design:returntype", Promise)
|
|
1362
1536
|
], DurableApiController.prototype, "continue", null);
|
|
1363
|
-
|
|
1364
|
-
(0,
|
|
1365
|
-
_ts_param2(0, (0,
|
|
1537
|
+
_ts_decorate5([
|
|
1538
|
+
(0, import_common5.Post)("runs/:id/redispatch"),
|
|
1539
|
+
_ts_param2(0, (0, import_common5.Param)("id")),
|
|
1366
1540
|
_ts_metadata4("design:type", Function),
|
|
1367
1541
|
_ts_metadata4("design:paramtypes", [
|
|
1368
1542
|
String
|
|
1369
1543
|
]),
|
|
1370
1544
|
_ts_metadata4("design:returntype", Promise)
|
|
1371
1545
|
], DurableApiController.prototype, "redispatch", null);
|
|
1372
|
-
|
|
1373
|
-
(0,
|
|
1374
|
-
_ts_param2(0, (0,
|
|
1375
|
-
_ts_param2(1, (0,
|
|
1546
|
+
_ts_decorate5([
|
|
1547
|
+
(0, import_common5.Post)("webhooks/:token"),
|
|
1548
|
+
_ts_param2(0, (0, import_common5.Param)("token")),
|
|
1549
|
+
_ts_param2(1, (0, import_common5.Body)()),
|
|
1376
1550
|
_ts_metadata4("design:type", Function),
|
|
1377
1551
|
_ts_metadata4("design:paramtypes", [
|
|
1378
1552
|
String,
|
|
@@ -1380,10 +1554,10 @@ _ts_decorate4([
|
|
|
1380
1554
|
]),
|
|
1381
1555
|
_ts_metadata4("design:returntype", Promise)
|
|
1382
1556
|
], DurableApiController.prototype, "webhook", null);
|
|
1383
|
-
|
|
1384
|
-
(0,
|
|
1385
|
-
_ts_param2(0, (0,
|
|
1386
|
-
_ts_param2(1, (0,
|
|
1557
|
+
_ts_decorate5([
|
|
1558
|
+
(0, import_common5.Get)("runs/:id/events/:key"),
|
|
1559
|
+
_ts_param2(0, (0, import_common5.Param)("id")),
|
|
1560
|
+
_ts_param2(1, (0, import_common5.Param)("key")),
|
|
1387
1561
|
_ts_metadata4("design:type", Function),
|
|
1388
1562
|
_ts_metadata4("design:paramtypes", [
|
|
1389
1563
|
String,
|
|
@@ -1391,11 +1565,11 @@ _ts_decorate4([
|
|
|
1391
1565
|
]),
|
|
1392
1566
|
_ts_metadata4("design:returntype", void 0)
|
|
1393
1567
|
], DurableApiController.prototype, "event", null);
|
|
1394
|
-
|
|
1395
|
-
(0,
|
|
1396
|
-
_ts_param2(0, (0,
|
|
1397
|
-
_ts_param2(1, (0,
|
|
1398
|
-
_ts_param2(2, (0,
|
|
1568
|
+
_ts_decorate5([
|
|
1569
|
+
(0, import_common5.Post)("runs/:id/updates/:name"),
|
|
1570
|
+
_ts_param2(0, (0, import_common5.Param)("id")),
|
|
1571
|
+
_ts_param2(1, (0, import_common5.Param)("name")),
|
|
1572
|
+
_ts_param2(2, (0, import_common5.Body)()),
|
|
1399
1573
|
_ts_metadata4("design:type", Function),
|
|
1400
1574
|
_ts_metadata4("design:paramtypes", [
|
|
1401
1575
|
String,
|
|
@@ -1404,9 +1578,10 @@ _ts_decorate4([
|
|
|
1404
1578
|
]),
|
|
1405
1579
|
_ts_metadata4("design:returntype", void 0)
|
|
1406
1580
|
], DurableApiController.prototype, "update", null);
|
|
1407
|
-
DurableApiController =
|
|
1408
|
-
(0,
|
|
1409
|
-
(0,
|
|
1581
|
+
DurableApiController = _ts_decorate5([
|
|
1582
|
+
(0, import_common5.Controller)(),
|
|
1583
|
+
(0, import_common5.UseInterceptors)(import_nestjs_filter2.ApplyFilterInterceptor),
|
|
1584
|
+
(0, import_common5.UseFilters)(NotModifiedFilter),
|
|
1410
1585
|
_ts_metadata4("design:type", Function),
|
|
1411
1586
|
_ts_metadata4("design:paramtypes", [
|
|
1412
1587
|
typeof DashboardService === "undefined" ? Object : DashboardService,
|
|
@@ -1415,14 +1590,14 @@ DurableApiController = _ts_decorate4([
|
|
|
1415
1590
|
], DurableApiController);
|
|
1416
1591
|
function notFound(error) {
|
|
1417
1592
|
if (error instanceof Error && error.name === "ScheduleNotFoundError") {
|
|
1418
|
-
throw new
|
|
1593
|
+
throw new import_common5.NotFoundException(error.message);
|
|
1419
1594
|
}
|
|
1420
1595
|
throw error;
|
|
1421
1596
|
}
|
|
1422
1597
|
__name(notFound, "notFound");
|
|
1423
1598
|
|
|
1424
1599
|
// src/server/durable-auth.controller.ts
|
|
1425
|
-
var
|
|
1600
|
+
var import_common9 = require("@nestjs/common");
|
|
1426
1601
|
|
|
1427
1602
|
// src/server/auth/dashboard-auth-config.ts
|
|
1428
1603
|
var DASHBOARD_AUTH = Symbol("DASHBOARD_AUTH");
|
|
@@ -1662,14 +1837,14 @@ function renderSessionRequiredPage(basePath) {
|
|
|
1662
1837
|
__name(renderSessionRequiredPage, "renderSessionRequiredPage");
|
|
1663
1838
|
|
|
1664
1839
|
// src/server/auth/request.ts
|
|
1665
|
-
function
|
|
1840
|
+
function isRecord2(value) {
|
|
1666
1841
|
return typeof value === "object" && value !== null;
|
|
1667
1842
|
}
|
|
1668
|
-
__name(
|
|
1843
|
+
__name(isRecord2, "isRecord");
|
|
1669
1844
|
function readHeaders(request) {
|
|
1670
|
-
if (!
|
|
1845
|
+
if (!isRecord2(request)) return {};
|
|
1671
1846
|
const headers = request.headers;
|
|
1672
|
-
return
|
|
1847
|
+
return isRecord2(headers) ? headers : {};
|
|
1673
1848
|
}
|
|
1674
1849
|
__name(readHeaders, "readHeaders");
|
|
1675
1850
|
function headerToString(value) {
|
|
@@ -1685,14 +1860,14 @@ function readCookieHeader(request) {
|
|
|
1685
1860
|
}
|
|
1686
1861
|
__name(readCookieHeader, "readCookieHeader");
|
|
1687
1862
|
function isHttpsRequest(request) {
|
|
1688
|
-
if (
|
|
1863
|
+
if (isRecord2(request) && request.protocol === "https") return true;
|
|
1689
1864
|
const forwarded = headerToString(readHeaders(request)["x-forwarded-proto"]);
|
|
1690
1865
|
if (forwarded === void 0) return false;
|
|
1691
1866
|
return forwarded.split(",").map((proto) => proto.trim().toLowerCase()).includes("https");
|
|
1692
1867
|
}
|
|
1693
1868
|
__name(isHttpsRequest, "isHttpsRequest");
|
|
1694
1869
|
function originalRequestUrl(request) {
|
|
1695
|
-
if (!
|
|
1870
|
+
if (!isRecord2(request)) return "/";
|
|
1696
1871
|
if (typeof request.originalUrl === "string" && request.originalUrl !== "") {
|
|
1697
1872
|
return request.originalUrl;
|
|
1698
1873
|
}
|
|
@@ -1709,72 +1884,6 @@ function sanitizeReturnTo(candidate, fallback) {
|
|
|
1709
1884
|
}
|
|
1710
1885
|
__name(sanitizeReturnTo, "sanitizeReturnTo");
|
|
1711
1886
|
|
|
1712
|
-
// src/server/auth/response.ts
|
|
1713
|
-
function isRecord2(value) {
|
|
1714
|
-
return typeof value === "object" && value !== null;
|
|
1715
|
-
}
|
|
1716
|
-
__name(isRecord2, "isRecord");
|
|
1717
|
-
function isRawCookieResponse(value) {
|
|
1718
|
-
return isRecord2(value) && typeof value.getHeader === "function" && typeof value.setHeader === "function";
|
|
1719
|
-
}
|
|
1720
|
-
__name(isRawCookieResponse, "isRawCookieResponse");
|
|
1721
|
-
function resolveCookieResponse(response) {
|
|
1722
|
-
if (isRawCookieResponse(response)) return response;
|
|
1723
|
-
if (isRecord2(response) && isRawCookieResponse(response.raw)) return response.raw;
|
|
1724
|
-
return null;
|
|
1725
|
-
}
|
|
1726
|
-
__name(resolveCookieResponse, "resolveCookieResponse");
|
|
1727
|
-
function existingSetCookies(response) {
|
|
1728
|
-
const current = response.getHeader("set-cookie");
|
|
1729
|
-
if (Array.isArray(current)) return current;
|
|
1730
|
-
if (typeof current === "string") return [
|
|
1731
|
-
current
|
|
1732
|
-
];
|
|
1733
|
-
return [];
|
|
1734
|
-
}
|
|
1735
|
-
__name(existingSetCookies, "existingSetCookies");
|
|
1736
|
-
function appendSetCookie(response, cookie) {
|
|
1737
|
-
const raw = resolveCookieResponse(response);
|
|
1738
|
-
if (!raw) return;
|
|
1739
|
-
raw.setHeader("set-cookie", [
|
|
1740
|
-
...existingSetCookies(raw),
|
|
1741
|
-
cookie
|
|
1742
|
-
]);
|
|
1743
|
-
}
|
|
1744
|
-
__name(appendSetCookie, "appendSetCookie");
|
|
1745
|
-
function isRawRedirectResponse(value) {
|
|
1746
|
-
return isRecord2(value) && typeof value.getHeader === "function" && typeof value.setHeader === "function" && typeof value.end === "function";
|
|
1747
|
-
}
|
|
1748
|
-
__name(isRawRedirectResponse, "isRawRedirectResponse");
|
|
1749
|
-
function resolveRedirectResponse(response) {
|
|
1750
|
-
if (isRawRedirectResponse(response)) return response;
|
|
1751
|
-
if (isRecord2(response) && isRawRedirectResponse(response.raw)) return response.raw;
|
|
1752
|
-
return null;
|
|
1753
|
-
}
|
|
1754
|
-
__name(resolveRedirectResponse, "resolveRedirectResponse");
|
|
1755
|
-
function redirectRaw(response, location, status = 302) {
|
|
1756
|
-
const raw = resolveRedirectResponse(response);
|
|
1757
|
-
if (!raw) return;
|
|
1758
|
-
raw.statusCode = status;
|
|
1759
|
-
raw.setHeader("location", location);
|
|
1760
|
-
raw.end();
|
|
1761
|
-
}
|
|
1762
|
-
__name(redirectRaw, "redirectRaw");
|
|
1763
|
-
function responseAlreadyWritten(response) {
|
|
1764
|
-
const raw = resolveRedirectResponse(response);
|
|
1765
|
-
return raw?.headersSent === true;
|
|
1766
|
-
}
|
|
1767
|
-
__name(responseAlreadyWritten, "responseAlreadyWritten");
|
|
1768
|
-
function writeHtmlRaw(response, html, status = 200) {
|
|
1769
|
-
const raw = resolveRedirectResponse(response);
|
|
1770
|
-
if (!raw) return;
|
|
1771
|
-
raw.statusCode = status;
|
|
1772
|
-
raw.setHeader("content-type", "text/html; charset=utf-8");
|
|
1773
|
-
raw.setHeader("cache-control", "no-store, must-revalidate");
|
|
1774
|
-
raw.end(html);
|
|
1775
|
-
}
|
|
1776
|
-
__name(writeHtmlRaw, "writeHtmlRaw");
|
|
1777
|
-
|
|
1778
1887
|
// src/server/auth/cookie-header.ts
|
|
1779
1888
|
function parseCookieHeader(header) {
|
|
1780
1889
|
const cookies = {};
|
|
@@ -1974,11 +2083,11 @@ __name(maybeRenewSession, "maybeRenewSession");
|
|
|
1974
2083
|
var import_node_fs = require("fs");
|
|
1975
2084
|
var import_node_path = require("path");
|
|
1976
2085
|
var import_node_url = require("url");
|
|
1977
|
-
var
|
|
2086
|
+
var import_common8 = require("@nestjs/common");
|
|
1978
2087
|
|
|
1979
2088
|
// src/server/auth/login-redirect.exception.ts
|
|
1980
|
-
var
|
|
1981
|
-
function
|
|
2089
|
+
var import_common6 = require("@nestjs/common");
|
|
2090
|
+
function _ts_decorate6(decorators, target, key, desc) {
|
|
1982
2091
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1983
2092
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
1984
2093
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1991,8 +2100,8 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
1991
2100
|
}
|
|
1992
2101
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1993
2102
|
}
|
|
1994
|
-
__name(
|
|
1995
|
-
var DashboardLoginRedirectException = class extends
|
|
2103
|
+
__name(_ts_decorate6, "_ts_decorate");
|
|
2104
|
+
var DashboardLoginRedirectException = class extends import_common6.HttpException {
|
|
1996
2105
|
static {
|
|
1997
2106
|
__name(this, "DashboardLoginRedirectException");
|
|
1998
2107
|
}
|
|
@@ -2000,7 +2109,7 @@ var DashboardLoginRedirectException = class extends import_common5.HttpException
|
|
|
2000
2109
|
constructor(location) {
|
|
2001
2110
|
super({
|
|
2002
2111
|
location
|
|
2003
|
-
},
|
|
2112
|
+
}, import_common6.HttpStatus.FOUND), this.location = location;
|
|
2004
2113
|
}
|
|
2005
2114
|
};
|
|
2006
2115
|
var DashboardLoginRedirectFilter = class {
|
|
@@ -2012,13 +2121,13 @@ var DashboardLoginRedirectFilter = class {
|
|
|
2012
2121
|
redirectRaw(response, exception.location);
|
|
2013
2122
|
}
|
|
2014
2123
|
};
|
|
2015
|
-
DashboardLoginRedirectFilter =
|
|
2016
|
-
(0,
|
|
2124
|
+
DashboardLoginRedirectFilter = _ts_decorate6([
|
|
2125
|
+
(0, import_common6.Catch)(DashboardLoginRedirectException)
|
|
2017
2126
|
], DashboardLoginRedirectFilter);
|
|
2018
2127
|
|
|
2019
2128
|
// src/server/auth/session-required.exception.ts
|
|
2020
|
-
var
|
|
2021
|
-
function
|
|
2129
|
+
var import_common7 = require("@nestjs/common");
|
|
2130
|
+
function _ts_decorate7(decorators, target, key, desc) {
|
|
2022
2131
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2023
2132
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
2024
2133
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2031,7 +2140,7 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
2031
2140
|
}
|
|
2032
2141
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2033
2142
|
}
|
|
2034
|
-
__name(
|
|
2143
|
+
__name(_ts_decorate7, "_ts_decorate");
|
|
2035
2144
|
function _ts_metadata5(metadataKey, metadataValue) {
|
|
2036
2145
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
2037
2146
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
@@ -2044,7 +2153,7 @@ function _ts_param3(paramIndex, decorator) {
|
|
|
2044
2153
|
};
|
|
2045
2154
|
}
|
|
2046
2155
|
__name(_ts_param3, "_ts_param");
|
|
2047
|
-
var DashboardSessionRequiredException = class extends
|
|
2156
|
+
var DashboardSessionRequiredException = class extends import_common7.HttpException {
|
|
2048
2157
|
static {
|
|
2049
2158
|
__name(this, "DashboardSessionRequiredException");
|
|
2050
2159
|
}
|
|
@@ -2052,7 +2161,7 @@ var DashboardSessionRequiredException = class extends import_common6.HttpExcepti
|
|
|
2052
2161
|
constructor(basePath) {
|
|
2053
2162
|
super({
|
|
2054
2163
|
basePath
|
|
2055
|
-
},
|
|
2164
|
+
}, import_common7.HttpStatus.UNAUTHORIZED), this.basePath = basePath;
|
|
2056
2165
|
}
|
|
2057
2166
|
};
|
|
2058
2167
|
var DashboardSessionRequiredFilter = class _DashboardSessionRequiredFilter {
|
|
@@ -2060,7 +2169,7 @@ var DashboardSessionRequiredFilter = class _DashboardSessionRequiredFilter {
|
|
|
2060
2169
|
__name(this, "DashboardSessionRequiredFilter");
|
|
2061
2170
|
}
|
|
2062
2171
|
auth;
|
|
2063
|
-
logger = new
|
|
2172
|
+
logger = new import_common7.Logger(_DashboardSessionRequiredFilter.name);
|
|
2064
2173
|
warned = false;
|
|
2065
2174
|
constructor(auth = null) {
|
|
2066
2175
|
this.auth = auth;
|
|
@@ -2083,7 +2192,7 @@ var DashboardSessionRequiredFilter = class _DashboardSessionRequiredFilter {
|
|
|
2083
2192
|
if (responseAlreadyWritten(response)) return;
|
|
2084
2193
|
}
|
|
2085
2194
|
}
|
|
2086
|
-
writeHtmlRaw(response, renderSessionRequiredPage(exception.basePath),
|
|
2195
|
+
writeHtmlRaw(response, renderSessionRequiredPage(exception.basePath), import_common7.HttpStatus.UNAUTHORIZED);
|
|
2087
2196
|
}
|
|
2088
2197
|
/** Once per process, not once per request: a broken hook fires on every denied navigation. */
|
|
2089
2198
|
warnOnce(message) {
|
|
@@ -2092,10 +2201,10 @@ var DashboardSessionRequiredFilter = class _DashboardSessionRequiredFilter {
|
|
|
2092
2201
|
this.logger.warn(message);
|
|
2093
2202
|
}
|
|
2094
2203
|
};
|
|
2095
|
-
DashboardSessionRequiredFilter =
|
|
2096
|
-
(0,
|
|
2097
|
-
_ts_param3(0, (0,
|
|
2098
|
-
_ts_param3(0, (0,
|
|
2204
|
+
DashboardSessionRequiredFilter = _ts_decorate7([
|
|
2205
|
+
(0, import_common7.Catch)(DashboardSessionRequiredException),
|
|
2206
|
+
_ts_param3(0, (0, import_common7.Optional)()),
|
|
2207
|
+
_ts_param3(0, (0, import_common7.Inject)(DASHBOARD_AUTH)),
|
|
2099
2208
|
_ts_metadata5("design:type", Function),
|
|
2100
2209
|
_ts_metadata5("design:paramtypes", [
|
|
2101
2210
|
Object
|
|
@@ -2103,7 +2212,7 @@ DashboardSessionRequiredFilter = _ts_decorate6([
|
|
|
2103
2212
|
], DashboardSessionRequiredFilter);
|
|
2104
2213
|
|
|
2105
2214
|
// src/server/durable-ui.controller.ts
|
|
2106
|
-
function
|
|
2215
|
+
function _ts_decorate8(decorators, target, key, desc) {
|
|
2107
2216
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2108
2217
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
2109
2218
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2116,7 +2225,7 @@ function _ts_decorate7(decorators, target, key, desc) {
|
|
|
2116
2225
|
}
|
|
2117
2226
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2118
2227
|
}
|
|
2119
|
-
__name(
|
|
2228
|
+
__name(_ts_decorate8, "_ts_decorate");
|
|
2120
2229
|
function _ts_metadata6(metadataKey, metadataValue) {
|
|
2121
2230
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
2122
2231
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
@@ -2161,7 +2270,7 @@ var DurableUiController = class {
|
|
|
2161
2270
|
index() {
|
|
2162
2271
|
const indexPath = (0, import_node_path.join)(this.dir, "index.html");
|
|
2163
2272
|
if (!(0, import_node_fs.existsSync)(indexPath)) {
|
|
2164
|
-
throw new
|
|
2273
|
+
throw new import_common8.NotFoundException("Dashboard is not built. Run the package build.");
|
|
2165
2274
|
}
|
|
2166
2275
|
const html = (0, import_node_fs.readFileSync)(indexPath, "utf8").replaceAll(`="${BUILD_BASE}/`, `="${this.basePath}/`);
|
|
2167
2276
|
const inject = `<script>window.__DURABLE_BASE__='${this.basePath}';window.__DURABLE_API__='${this.apiBasePath}';</script>`;
|
|
@@ -2169,41 +2278,41 @@ var DurableUiController = class {
|
|
|
2169
2278
|
}
|
|
2170
2279
|
asset(file) {
|
|
2171
2280
|
const safe = (0, import_node_path.basename)(file);
|
|
2172
|
-
if (safe !== file) throw new
|
|
2281
|
+
if (safe !== file) throw new import_common8.NotFoundException();
|
|
2173
2282
|
const root = (0, import_node_path.resolve)(this.dir, "assets");
|
|
2174
2283
|
const assetPath = (0, import_node_path.resolve)(root, safe);
|
|
2175
2284
|
if (!assetPath.startsWith(root + import_node_path.sep) || !(0, import_node_fs.existsSync)(assetPath)) {
|
|
2176
|
-
throw new
|
|
2285
|
+
throw new import_common8.NotFoundException();
|
|
2177
2286
|
}
|
|
2178
2287
|
const type = CONTENT_TYPES[(0, import_node_path.extname)(safe)] ?? "application/octet-stream";
|
|
2179
|
-
return new
|
|
2288
|
+
return new import_common8.StreamableFile((0, import_node_fs.readFileSync)(assetPath), {
|
|
2180
2289
|
type
|
|
2181
2290
|
});
|
|
2182
2291
|
}
|
|
2183
2292
|
};
|
|
2184
|
-
|
|
2185
|
-
(0,
|
|
2186
|
-
(0,
|
|
2187
|
-
(0,
|
|
2293
|
+
_ts_decorate8([
|
|
2294
|
+
(0, import_common8.Get)(),
|
|
2295
|
+
(0, import_common8.Header)("Content-Type", "text/html; charset=utf-8"),
|
|
2296
|
+
(0, import_common8.Header)("Cache-Control", "no-store, must-revalidate"),
|
|
2188
2297
|
_ts_metadata6("design:type", Function),
|
|
2189
2298
|
_ts_metadata6("design:paramtypes", []),
|
|
2190
2299
|
_ts_metadata6("design:returntype", String)
|
|
2191
2300
|
], DurableUiController.prototype, "index", null);
|
|
2192
|
-
|
|
2193
|
-
(0,
|
|
2194
|
-
(0,
|
|
2195
|
-
_ts_param4(0, (0,
|
|
2301
|
+
_ts_decorate8([
|
|
2302
|
+
(0, import_common8.Get)("assets/:file"),
|
|
2303
|
+
(0, import_common8.Header)("Cache-Control", "public, max-age=31536000, immutable"),
|
|
2304
|
+
_ts_param4(0, (0, import_common8.Param)("file")),
|
|
2196
2305
|
_ts_metadata6("design:type", Function),
|
|
2197
2306
|
_ts_metadata6("design:paramtypes", [
|
|
2198
2307
|
String
|
|
2199
2308
|
]),
|
|
2200
|
-
_ts_metadata6("design:returntype", typeof
|
|
2309
|
+
_ts_metadata6("design:returntype", typeof import_common8.StreamableFile === "undefined" ? Object : import_common8.StreamableFile)
|
|
2201
2310
|
], DurableUiController.prototype, "asset", null);
|
|
2202
|
-
DurableUiController =
|
|
2203
|
-
(0,
|
|
2204
|
-
(0,
|
|
2205
|
-
_ts_param4(0, (0,
|
|
2206
|
-
_ts_param4(1, (0,
|
|
2311
|
+
DurableUiController = _ts_decorate8([
|
|
2312
|
+
(0, import_common8.UseFilters)(DashboardLoginRedirectFilter, DashboardSessionRequiredFilter),
|
|
2313
|
+
(0, import_common8.Controller)(),
|
|
2314
|
+
_ts_param4(0, (0, import_common8.Inject)(DASHBOARD_BASE_PATH)),
|
|
2315
|
+
_ts_param4(1, (0, import_common8.Inject)(DASHBOARD_API_PATH)),
|
|
2207
2316
|
_ts_metadata6("design:type", Function),
|
|
2208
2317
|
_ts_metadata6("design:paramtypes", [
|
|
2209
2318
|
String,
|
|
@@ -2212,7 +2321,7 @@ DurableUiController = _ts_decorate7([
|
|
|
2212
2321
|
], DurableUiController);
|
|
2213
2322
|
|
|
2214
2323
|
// src/server/durable-auth.controller.ts
|
|
2215
|
-
function
|
|
2324
|
+
function _ts_decorate9(decorators, target, key, desc) {
|
|
2216
2325
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2217
2326
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
2218
2327
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2225,7 +2334,7 @@ function _ts_decorate8(decorators, target, key, desc) {
|
|
|
2225
2334
|
}
|
|
2226
2335
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2227
2336
|
}
|
|
2228
|
-
__name(
|
|
2337
|
+
__name(_ts_decorate9, "_ts_decorate");
|
|
2229
2338
|
function _ts_metadata7(metadataKey, metadataValue) {
|
|
2230
2339
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
2231
2340
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
@@ -2248,7 +2357,7 @@ var DurableAuthController = class _DurableAuthController {
|
|
|
2248
2357
|
}
|
|
2249
2358
|
auth;
|
|
2250
2359
|
basePath;
|
|
2251
|
-
logger = new
|
|
2360
|
+
logger = new import_common9.Logger(_DurableAuthController.name);
|
|
2252
2361
|
/** Warn once per hook kind so a throwing hook doesn't spam logs on every failed attempt. */
|
|
2253
2362
|
warnedHooks = /* @__PURE__ */ new Set();
|
|
2254
2363
|
constructor(auth, basePath) {
|
|
@@ -2260,7 +2369,7 @@ var DurableAuthController = class _DurableAuthController {
|
|
|
2260
2369
|
// the developer-controlled `basePath`.
|
|
2261
2370
|
loginPage() {
|
|
2262
2371
|
const auth = this.requireAuth();
|
|
2263
|
-
if (!auth.modes.includes("login")) throw new
|
|
2372
|
+
if (!auth.modes.includes("login")) throw new import_common9.NotFoundException();
|
|
2264
2373
|
return renderLoginPage(this.basePath);
|
|
2265
2374
|
}
|
|
2266
2375
|
// Called by the login page's own fetch (JSON, not a classic form POST — see `login-page.ts` for
|
|
@@ -2269,13 +2378,13 @@ var DurableAuthController = class _DurableAuthController {
|
|
|
2269
2378
|
// (unknown user, wrong password, throwing hook) — no user-enumeration.
|
|
2270
2379
|
async login(body, request, response) {
|
|
2271
2380
|
const auth = this.requireAuth();
|
|
2272
|
-
if (!auth.modes.includes("login")) throw new
|
|
2381
|
+
if (!auth.modes.includes("login")) throw new import_common9.NotFoundException();
|
|
2273
2382
|
if (!isString(body?.username) || !isString(body?.password)) {
|
|
2274
|
-
throw new
|
|
2383
|
+
throw new import_common9.BadRequestException("Body must include string `username` and `password`.");
|
|
2275
2384
|
}
|
|
2276
2385
|
const { username, password } = body;
|
|
2277
2386
|
const user = await this.runHook("login", () => auth.login?.(username, password) ?? null);
|
|
2278
|
-
if (!user) throw new
|
|
2387
|
+
if (!user) throw new import_common9.UnauthorizedException({
|
|
2279
2388
|
message: "Invalid username or password."
|
|
2280
2389
|
});
|
|
2281
2390
|
issueSessionCookie(user, {
|
|
@@ -2292,9 +2401,9 @@ var DurableAuthController = class _DurableAuthController {
|
|
|
2292
2401
|
// guard decides, and no credential ever reaches this library.
|
|
2293
2402
|
async session(request, response) {
|
|
2294
2403
|
const auth = this.requireAuth();
|
|
2295
|
-
if (!auth.modes.includes("session")) throw new
|
|
2404
|
+
if (!auth.modes.includes("session")) throw new import_common9.NotFoundException();
|
|
2296
2405
|
const user = await this.runHook("session", () => auth.session?.(request) ?? null);
|
|
2297
|
-
if (!user) throw new
|
|
2406
|
+
if (!user) throw new import_common9.UnauthorizedException();
|
|
2298
2407
|
issueSessionCookie(user, {
|
|
2299
2408
|
auth,
|
|
2300
2409
|
request,
|
|
@@ -2313,7 +2422,7 @@ var DurableAuthController = class _DurableAuthController {
|
|
|
2313
2422
|
redirectRaw(response, this.auth?.modes.includes("login") ? `${this.basePath}/login` : this.basePath);
|
|
2314
2423
|
}
|
|
2315
2424
|
requireAuth() {
|
|
2316
|
-
if (!this.auth) throw new
|
|
2425
|
+
if (!this.auth) throw new import_common9.NotFoundException();
|
|
2317
2426
|
return this.auth;
|
|
2318
2427
|
}
|
|
2319
2428
|
/**
|
|
@@ -2333,20 +2442,20 @@ var DurableAuthController = class _DurableAuthController {
|
|
|
2333
2442
|
}
|
|
2334
2443
|
}
|
|
2335
2444
|
};
|
|
2336
|
-
|
|
2337
|
-
(0,
|
|
2338
|
-
(0,
|
|
2339
|
-
(0,
|
|
2445
|
+
_ts_decorate9([
|
|
2446
|
+
(0, import_common9.Get)("login"),
|
|
2447
|
+
(0, import_common9.Header)("Content-Type", "text/html; charset=utf-8"),
|
|
2448
|
+
(0, import_common9.Header)("Cache-Control", "no-store, must-revalidate"),
|
|
2340
2449
|
_ts_metadata7("design:type", Function),
|
|
2341
2450
|
_ts_metadata7("design:paramtypes", []),
|
|
2342
2451
|
_ts_metadata7("design:returntype", String)
|
|
2343
2452
|
], DurableAuthController.prototype, "loginPage", null);
|
|
2344
|
-
|
|
2345
|
-
(0,
|
|
2346
|
-
(0,
|
|
2347
|
-
_ts_param5(0, (0,
|
|
2348
|
-
_ts_param5(1, (0,
|
|
2349
|
-
_ts_param5(2, (0,
|
|
2453
|
+
_ts_decorate9([
|
|
2454
|
+
(0, import_common9.Post)("login"),
|
|
2455
|
+
(0, import_common9.HttpCode)(200),
|
|
2456
|
+
_ts_param5(0, (0, import_common9.Body)()),
|
|
2457
|
+
_ts_param5(1, (0, import_common9.Req)()),
|
|
2458
|
+
_ts_param5(2, (0, import_common9.Res)({
|
|
2350
2459
|
passthrough: true
|
|
2351
2460
|
})),
|
|
2352
2461
|
_ts_metadata7("design:type", Function),
|
|
@@ -2357,11 +2466,11 @@ _ts_decorate8([
|
|
|
2357
2466
|
]),
|
|
2358
2467
|
_ts_metadata7("design:returntype", Promise)
|
|
2359
2468
|
], DurableAuthController.prototype, "login", null);
|
|
2360
|
-
|
|
2361
|
-
(0,
|
|
2362
|
-
(0,
|
|
2363
|
-
_ts_param5(0, (0,
|
|
2364
|
-
_ts_param5(1, (0,
|
|
2469
|
+
_ts_decorate9([
|
|
2470
|
+
(0, import_common9.Post)("session"),
|
|
2471
|
+
(0, import_common9.HttpCode)(204),
|
|
2472
|
+
_ts_param5(0, (0, import_common9.Req)()),
|
|
2473
|
+
_ts_param5(1, (0, import_common9.Res)({
|
|
2365
2474
|
passthrough: true
|
|
2366
2475
|
})),
|
|
2367
2476
|
_ts_metadata7("design:type", Function),
|
|
@@ -2371,10 +2480,10 @@ _ts_decorate8([
|
|
|
2371
2480
|
]),
|
|
2372
2481
|
_ts_metadata7("design:returntype", Promise)
|
|
2373
2482
|
], DurableAuthController.prototype, "session", null);
|
|
2374
|
-
|
|
2375
|
-
(0,
|
|
2376
|
-
_ts_param5(0, (0,
|
|
2377
|
-
_ts_param5(1, (0,
|
|
2483
|
+
_ts_decorate9([
|
|
2484
|
+
(0, import_common9.Get)("logout"),
|
|
2485
|
+
_ts_param5(0, (0, import_common9.Req)()),
|
|
2486
|
+
_ts_param5(1, (0, import_common9.Res)()),
|
|
2378
2487
|
_ts_metadata7("design:type", Function),
|
|
2379
2488
|
_ts_metadata7("design:paramtypes", [
|
|
2380
2489
|
Object,
|
|
@@ -2382,11 +2491,11 @@ _ts_decorate8([
|
|
|
2382
2491
|
]),
|
|
2383
2492
|
_ts_metadata7("design:returntype", void 0)
|
|
2384
2493
|
], DurableAuthController.prototype, "logout", null);
|
|
2385
|
-
DurableAuthController =
|
|
2386
|
-
(0,
|
|
2387
|
-
_ts_param5(0, (0,
|
|
2388
|
-
_ts_param5(0, (0,
|
|
2389
|
-
_ts_param5(1, (0,
|
|
2494
|
+
DurableAuthController = _ts_decorate9([
|
|
2495
|
+
(0, import_common9.Controller)(),
|
|
2496
|
+
_ts_param5(0, (0, import_common9.Optional)()),
|
|
2497
|
+
_ts_param5(0, (0, import_common9.Inject)(DASHBOARD_AUTH)),
|
|
2498
|
+
_ts_param5(1, (0, import_common9.Inject)(DASHBOARD_BASE_PATH)),
|
|
2390
2499
|
_ts_metadata7("design:type", Function),
|
|
2391
2500
|
_ts_metadata7("design:paramtypes", [
|
|
2392
2501
|
Object,
|
|
@@ -2397,12 +2506,12 @@ DurableAuthController = _ts_decorate8([
|
|
|
2397
2506
|
// src/server/durable-dashboard.module.ts
|
|
2398
2507
|
var import_reflect_metadata = require("reflect-metadata");
|
|
2399
2508
|
var import_nestjs_filter3 = require("@dudousxd/nestjs-filter");
|
|
2400
|
-
var
|
|
2509
|
+
var import_common11 = require("@nestjs/common");
|
|
2401
2510
|
var import_core = require("@nestjs/core");
|
|
2402
2511
|
|
|
2403
2512
|
// src/server/durable-session.guard.ts
|
|
2404
|
-
var
|
|
2405
|
-
function
|
|
2513
|
+
var import_common10 = require("@nestjs/common");
|
|
2514
|
+
function _ts_decorate10(decorators, target, key, desc) {
|
|
2406
2515
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2407
2516
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
2408
2517
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2415,7 +2524,7 @@ function _ts_decorate9(decorators, target, key, desc) {
|
|
|
2415
2524
|
}
|
|
2416
2525
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2417
2526
|
}
|
|
2418
|
-
__name(
|
|
2527
|
+
__name(_ts_decorate10, "_ts_decorate");
|
|
2419
2528
|
function _ts_metadata8(metadataKey, metadataValue) {
|
|
2420
2529
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
2421
2530
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
@@ -2468,10 +2577,10 @@ var DurableUiSessionGuard = class {
|
|
|
2468
2577
|
throw new DashboardLoginRedirectException(`${this.basePath}/login?returnTo=${returnTo}`);
|
|
2469
2578
|
}
|
|
2470
2579
|
};
|
|
2471
|
-
DurableUiSessionGuard =
|
|
2472
|
-
(0,
|
|
2473
|
-
_ts_param6(0, (0,
|
|
2474
|
-
_ts_param6(1, (0,
|
|
2580
|
+
DurableUiSessionGuard = _ts_decorate10([
|
|
2581
|
+
(0, import_common10.Injectable)(),
|
|
2582
|
+
_ts_param6(0, (0, import_common10.Inject)(DASHBOARD_AUTH)),
|
|
2583
|
+
_ts_param6(1, (0, import_common10.Inject)(DASHBOARD_BASE_PATH)),
|
|
2475
2584
|
_ts_metadata8("design:type", Function),
|
|
2476
2585
|
_ts_metadata8("design:paramtypes", [
|
|
2477
2586
|
Object,
|
|
@@ -2505,16 +2614,16 @@ var DurableApiSessionGuard = class {
|
|
|
2505
2614
|
* 401; `DurableUiSessionGuard`'s redirect/session-required exceptions above don't reach it.
|
|
2506
2615
|
*/
|
|
2507
2616
|
unauthorized(auth) {
|
|
2508
|
-
return new
|
|
2617
|
+
return new import_common10.UnauthorizedException({
|
|
2509
2618
|
auth: {
|
|
2510
2619
|
modes: auth.modes
|
|
2511
2620
|
}
|
|
2512
2621
|
});
|
|
2513
2622
|
}
|
|
2514
2623
|
};
|
|
2515
|
-
DurableApiSessionGuard =
|
|
2516
|
-
(0,
|
|
2517
|
-
_ts_param6(0, (0,
|
|
2624
|
+
DurableApiSessionGuard = _ts_decorate10([
|
|
2625
|
+
(0, import_common10.Injectable)(),
|
|
2626
|
+
_ts_param6(0, (0, import_common10.Inject)(DASHBOARD_AUTH)),
|
|
2518
2627
|
_ts_metadata8("design:type", Function),
|
|
2519
2628
|
_ts_metadata8("design:paramtypes", [
|
|
2520
2629
|
Object
|
|
@@ -2522,7 +2631,7 @@ DurableApiSessionGuard = _ts_decorate9([
|
|
|
2522
2631
|
], DurableApiSessionGuard);
|
|
2523
2632
|
|
|
2524
2633
|
// src/server/durable-dashboard.module.ts
|
|
2525
|
-
function
|
|
2634
|
+
function _ts_decorate11(decorators, target, key, desc) {
|
|
2526
2635
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2527
2636
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
2528
2637
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2535,7 +2644,7 @@ function _ts_decorate10(decorators, target, key, desc) {
|
|
|
2535
2644
|
}
|
|
2536
2645
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2537
2646
|
}
|
|
2538
|
-
__name(
|
|
2647
|
+
__name(_ts_decorate11, "_ts_decorate");
|
|
2539
2648
|
var GUARDS_METADATA = "__guards__";
|
|
2540
2649
|
function normalize(path) {
|
|
2541
2650
|
return `/${path.replace(/^\/+|\/+$/g, "")}`;
|
|
@@ -2608,8 +2717,8 @@ var DurableApiModule = class _DurableApiModule {
|
|
|
2608
2717
|
};
|
|
2609
2718
|
}
|
|
2610
2719
|
};
|
|
2611
|
-
DurableApiModule =
|
|
2612
|
-
(0,
|
|
2720
|
+
DurableApiModule = _ts_decorate11([
|
|
2721
|
+
(0, import_common11.Module)({})
|
|
2613
2722
|
], DurableApiModule);
|
|
2614
2723
|
var DurableDashboardModule = class _DurableDashboardModule {
|
|
2615
2724
|
static {
|
|
@@ -2694,8 +2803,8 @@ var DurableDashboardModule = class _DurableDashboardModule {
|
|
|
2694
2803
|
};
|
|
2695
2804
|
}
|
|
2696
2805
|
};
|
|
2697
|
-
DurableDashboardModule =
|
|
2698
|
-
(0,
|
|
2806
|
+
DurableDashboardModule = _ts_decorate11([
|
|
2807
|
+
(0, import_common11.Module)({})
|
|
2699
2808
|
], DurableDashboardModule);
|
|
2700
2809
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2701
2810
|
0 && (module.exports = {
|