@dudousxd/nestjs-durable-dashboard 0.50.0 → 0.51.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.
- 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 +380 -290
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +16 -3
- package/dist/server/index.d.ts +16 -3
- package/dist/server/index.js +250 -160
- 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
|
@@ -289,7 +289,7 @@ DashboardService = _ts_decorate([
|
|
|
289
289
|
|
|
290
290
|
// src/server/durable-api.controller.ts
|
|
291
291
|
var import_nestjs_filter2 = require("@dudousxd/nestjs-filter");
|
|
292
|
-
var
|
|
292
|
+
var import_common5 = require("@nestjs/common");
|
|
293
293
|
|
|
294
294
|
// src/server/durable-run.ts
|
|
295
295
|
var DurableRun = class {
|
|
@@ -364,6 +364,129 @@ function runValueAxisFor(field) {
|
|
|
364
364
|
}
|
|
365
365
|
__name(runValueAxisFor, "runValueAxisFor");
|
|
366
366
|
|
|
367
|
+
// src/server/not-modified.ts
|
|
368
|
+
var import_common2 = require("@nestjs/common");
|
|
369
|
+
|
|
370
|
+
// src/server/auth/response.ts
|
|
371
|
+
function isRecord(value) {
|
|
372
|
+
return typeof value === "object" && value !== null;
|
|
373
|
+
}
|
|
374
|
+
__name(isRecord, "isRecord");
|
|
375
|
+
function isRawCookieResponse(value) {
|
|
376
|
+
return isRecord(value) && typeof value.getHeader === "function" && typeof value.setHeader === "function";
|
|
377
|
+
}
|
|
378
|
+
__name(isRawCookieResponse, "isRawCookieResponse");
|
|
379
|
+
function resolveCookieResponse(response) {
|
|
380
|
+
if (isRawCookieResponse(response)) return response;
|
|
381
|
+
if (isRecord(response) && isRawCookieResponse(response.raw)) return response.raw;
|
|
382
|
+
return null;
|
|
383
|
+
}
|
|
384
|
+
__name(resolveCookieResponse, "resolveCookieResponse");
|
|
385
|
+
function existingSetCookies(response) {
|
|
386
|
+
const current = response.getHeader("set-cookie");
|
|
387
|
+
if (Array.isArray(current)) return current;
|
|
388
|
+
if (typeof current === "string") return [
|
|
389
|
+
current
|
|
390
|
+
];
|
|
391
|
+
return [];
|
|
392
|
+
}
|
|
393
|
+
__name(existingSetCookies, "existingSetCookies");
|
|
394
|
+
function appendSetCookie(response, cookie) {
|
|
395
|
+
const raw = resolveCookieResponse(response);
|
|
396
|
+
if (!raw) return;
|
|
397
|
+
raw.setHeader("set-cookie", [
|
|
398
|
+
...existingSetCookies(raw),
|
|
399
|
+
cookie
|
|
400
|
+
]);
|
|
401
|
+
}
|
|
402
|
+
__name(appendSetCookie, "appendSetCookie");
|
|
403
|
+
function isRawRedirectResponse(value) {
|
|
404
|
+
return isRecord(value) && typeof value.getHeader === "function" && typeof value.setHeader === "function" && typeof value.end === "function";
|
|
405
|
+
}
|
|
406
|
+
__name(isRawRedirectResponse, "isRawRedirectResponse");
|
|
407
|
+
function resolveRedirectResponse(response) {
|
|
408
|
+
if (isRawRedirectResponse(response)) return response;
|
|
409
|
+
if (isRecord(response) && isRawRedirectResponse(response.raw)) return response.raw;
|
|
410
|
+
return null;
|
|
411
|
+
}
|
|
412
|
+
__name(resolveRedirectResponse, "resolveRedirectResponse");
|
|
413
|
+
function redirectRaw(response, location, status = 302) {
|
|
414
|
+
const raw = resolveRedirectResponse(response);
|
|
415
|
+
if (!raw) return;
|
|
416
|
+
raw.statusCode = status;
|
|
417
|
+
raw.setHeader("location", location);
|
|
418
|
+
raw.end();
|
|
419
|
+
}
|
|
420
|
+
__name(redirectRaw, "redirectRaw");
|
|
421
|
+
function responseAlreadyWritten(response) {
|
|
422
|
+
const raw = resolveRedirectResponse(response);
|
|
423
|
+
return raw?.headersSent === true;
|
|
424
|
+
}
|
|
425
|
+
__name(responseAlreadyWritten, "responseAlreadyWritten");
|
|
426
|
+
function writeHtmlRaw(response, html, status = 200) {
|
|
427
|
+
const raw = resolveRedirectResponse(response);
|
|
428
|
+
if (!raw) return;
|
|
429
|
+
raw.statusCode = status;
|
|
430
|
+
raw.setHeader("content-type", "text/html; charset=utf-8");
|
|
431
|
+
raw.setHeader("cache-control", "no-store, must-revalidate");
|
|
432
|
+
raw.end(html);
|
|
433
|
+
}
|
|
434
|
+
__name(writeHtmlRaw, "writeHtmlRaw");
|
|
435
|
+
function setRawHeader(response, name, value) {
|
|
436
|
+
resolveCookieResponse(response)?.setHeader(name, value);
|
|
437
|
+
}
|
|
438
|
+
__name(setRawHeader, "setRawHeader");
|
|
439
|
+
function writeNotModifiedRaw(response, etag) {
|
|
440
|
+
const raw = resolveRedirectResponse(response);
|
|
441
|
+
if (!raw) return;
|
|
442
|
+
raw.statusCode = 304;
|
|
443
|
+
raw.setHeader("etag", etag);
|
|
444
|
+
raw.setHeader("cache-control", "private, no-cache");
|
|
445
|
+
raw.end();
|
|
446
|
+
}
|
|
447
|
+
__name(writeNotModifiedRaw, "writeNotModifiedRaw");
|
|
448
|
+
|
|
449
|
+
// src/server/not-modified.ts
|
|
450
|
+
function _ts_decorate2(decorators, target, key, desc) {
|
|
451
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
452
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
453
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
454
|
+
} else {
|
|
455
|
+
for (var i = decorators.length - 1; i >= 0; i--) {
|
|
456
|
+
if (d = decorators[i]) {
|
|
457
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
462
|
+
}
|
|
463
|
+
__name(_ts_decorate2, "_ts_decorate");
|
|
464
|
+
var NotModifiedException = class extends import_common2.HttpException {
|
|
465
|
+
static {
|
|
466
|
+
__name(this, "NotModifiedException");
|
|
467
|
+
}
|
|
468
|
+
etag;
|
|
469
|
+
constructor(etag) {
|
|
470
|
+
super("Not Modified", 304), this.etag = etag;
|
|
471
|
+
}
|
|
472
|
+
};
|
|
473
|
+
var NotModifiedFilter = class {
|
|
474
|
+
static {
|
|
475
|
+
__name(this, "NotModifiedFilter");
|
|
476
|
+
}
|
|
477
|
+
catch(exception, host) {
|
|
478
|
+
writeNotModifiedRaw(host.switchToHttp().getResponse(), exception.etag);
|
|
479
|
+
}
|
|
480
|
+
};
|
|
481
|
+
NotModifiedFilter = _ts_decorate2([
|
|
482
|
+
(0, import_common2.Catch)(NotModifiedException)
|
|
483
|
+
], NotModifiedFilter);
|
|
484
|
+
function setEtag(response, etag) {
|
|
485
|
+
setRawHeader(response, "etag", etag);
|
|
486
|
+
setRawHeader(response, "cache-control", "private, no-cache");
|
|
487
|
+
}
|
|
488
|
+
__name(setEtag, "setEtag");
|
|
489
|
+
|
|
367
490
|
// src/server/run-list-row.ts
|
|
368
491
|
function toRunListRow(run) {
|
|
369
492
|
const { input: _input, output: _output, error: _error, ...row } = run;
|
|
@@ -373,7 +496,7 @@ __name(toRunListRow, "toRunListRow");
|
|
|
373
496
|
|
|
374
497
|
// src/server/run.filter.ts
|
|
375
498
|
var import_nestjs_filter = require("@dudousxd/nestjs-filter");
|
|
376
|
-
var
|
|
499
|
+
var import_common4 = require("@nestjs/common");
|
|
377
500
|
|
|
378
501
|
// src/server/attr-filter.ts
|
|
379
502
|
var SCALAR_OPS = /* @__PURE__ */ new Set([
|
|
@@ -424,7 +547,7 @@ __name(parseAttrFilters, "parseAttrFilters");
|
|
|
424
547
|
|
|
425
548
|
// src/server/run-query.adapter.ts
|
|
426
549
|
var import_nestjs_durable_core2 = require("@dudousxd/nestjs-durable-core");
|
|
427
|
-
var
|
|
550
|
+
var import_common3 = require("@nestjs/common");
|
|
428
551
|
|
|
429
552
|
// src/server/run-query-draft.ts
|
|
430
553
|
var RunQueryDraft2 = class {
|
|
@@ -454,7 +577,7 @@ var RunQueryDraft2 = class {
|
|
|
454
577
|
};
|
|
455
578
|
|
|
456
579
|
// src/server/run-query.adapter.ts
|
|
457
|
-
function
|
|
580
|
+
function _ts_decorate3(decorators, target, key, desc) {
|
|
458
581
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
459
582
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
460
583
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -467,7 +590,7 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
467
590
|
}
|
|
468
591
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
469
592
|
}
|
|
470
|
-
__name(
|
|
593
|
+
__name(_ts_decorate3, "_ts_decorate");
|
|
471
594
|
function _ts_metadata2(metadataKey, metadataValue) {
|
|
472
595
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
473
596
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
@@ -495,7 +618,7 @@ function operands(clause) {
|
|
|
495
618
|
}
|
|
496
619
|
__name(operands, "operands");
|
|
497
620
|
function unsupported(clause, supported) {
|
|
498
|
-
throw new
|
|
621
|
+
throw new import_common3.BadRequestException(`The durable run list cannot filter \`${clause.field}\` with \`${clause.operator}\`. Supported here: ${supported}.`);
|
|
499
622
|
}
|
|
500
623
|
__name(unsupported, "unsupported");
|
|
501
624
|
var RunQueryAdapter = class {
|
|
@@ -533,7 +656,7 @@ var RunQueryAdapter = class {
|
|
|
533
656
|
const draft = this.draft(qb);
|
|
534
657
|
for (const clause of filters) {
|
|
535
658
|
if (clause.AND || clause.OR) {
|
|
536
|
-
throw new
|
|
659
|
+
throw new import_common3.BadRequestException("The durable run list cannot filter with nested AND/OR groups: its predicates are a flat conjunction.");
|
|
537
660
|
}
|
|
538
661
|
this.applyClause(draft, clause);
|
|
539
662
|
}
|
|
@@ -624,7 +747,7 @@ var RunQueryAdapter = class {
|
|
|
624
747
|
applyAttributeClause(draft, clause) {
|
|
625
748
|
const key = clause.field.slice(ATTRIBUTE_FIELD.length + 1);
|
|
626
749
|
if (!key) {
|
|
627
|
-
throw new
|
|
750
|
+
throw new import_common3.BadRequestException("Filtering search attributes needs a key: `attr.<key>`, e.g. `attr.tier`.");
|
|
628
751
|
}
|
|
629
752
|
const scalarOps = {
|
|
630
753
|
equals: "eq",
|
|
@@ -668,7 +791,7 @@ var RunQueryAdapter = class {
|
|
|
668
791
|
applySort(_qb, sorts) {
|
|
669
792
|
for (const sort of sorts) {
|
|
670
793
|
if (sort.field !== FIXED_ORDER.field || sort.direction !== FIXED_ORDER.direction) {
|
|
671
|
-
throw new
|
|
794
|
+
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
795
|
}
|
|
673
796
|
}
|
|
674
797
|
}
|
|
@@ -709,14 +832,14 @@ var RunQueryAdapter = class {
|
|
|
709
832
|
async groupByCount(qb, field, entity, opts) {
|
|
710
833
|
this.assertDurableRun(entity);
|
|
711
834
|
if (typeof field !== "string") {
|
|
712
|
-
throw new
|
|
835
|
+
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
836
|
}
|
|
714
837
|
if (opts?.bucket !== void 0) {
|
|
715
|
-
throw new
|
|
838
|
+
throw new import_common3.BadRequestException("The durable run list cannot bucket a group-by-count: none of its filterable fields is numeric.");
|
|
716
839
|
}
|
|
717
840
|
const axis = runValueAxisFor(field);
|
|
718
841
|
if (!axis) {
|
|
719
|
-
throw new
|
|
842
|
+
throw new import_common3.BadRequestException(`The durable run list cannot enumerate values of \`${field}\`.`);
|
|
720
843
|
}
|
|
721
844
|
const rows = await this.gateway.runValueFacets(axis, this.draft(qb).facetQuery(), {
|
|
722
845
|
limit: opts?.limit ?? import_nestjs_durable_core2.RUN_VALUE_FACET_LIMIT,
|
|
@@ -747,8 +870,8 @@ var RunQueryAdapter = class {
|
|
|
747
870
|
}
|
|
748
871
|
}
|
|
749
872
|
};
|
|
750
|
-
RunQueryAdapter =
|
|
751
|
-
(0,
|
|
873
|
+
RunQueryAdapter = _ts_decorate3([
|
|
874
|
+
(0, import_common3.Injectable)(),
|
|
752
875
|
_ts_metadata2("design:type", Function),
|
|
753
876
|
_ts_metadata2("design:paramtypes", [
|
|
754
877
|
typeof import_nestjs_durable_core2.RunGateway === "undefined" ? Object : import_nestjs_durable_core2.RunGateway
|
|
@@ -756,7 +879,7 @@ RunQueryAdapter = _ts_decorate2([
|
|
|
756
879
|
], RunQueryAdapter);
|
|
757
880
|
|
|
758
881
|
// src/server/run.filter.ts
|
|
759
|
-
function
|
|
882
|
+
function _ts_decorate4(decorators, target, key, desc) {
|
|
760
883
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
761
884
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
762
885
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -769,7 +892,7 @@ function _ts_decorate3(decorators, target, key, desc) {
|
|
|
769
892
|
}
|
|
770
893
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
771
894
|
}
|
|
772
|
-
__name(
|
|
895
|
+
__name(_ts_decorate4, "_ts_decorate");
|
|
773
896
|
function _ts_metadata3(metadataKey, metadataValue) {
|
|
774
897
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
775
898
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
@@ -895,7 +1018,7 @@ var RunFilter = class extends import_nestjs_filter.BaseFilter {
|
|
|
895
1018
|
});
|
|
896
1019
|
}
|
|
897
1020
|
};
|
|
898
|
-
|
|
1021
|
+
_ts_decorate4([
|
|
899
1022
|
(0, import_nestjs_filter.FilterFor)("status"),
|
|
900
1023
|
_ts_metadata3("design:type", Function),
|
|
901
1024
|
_ts_metadata3("design:paramtypes", [
|
|
@@ -903,7 +1026,7 @@ _ts_decorate3([
|
|
|
903
1026
|
]),
|
|
904
1027
|
_ts_metadata3("design:returntype", void 0)
|
|
905
1028
|
], RunFilter.prototype, "applyStatus", null);
|
|
906
|
-
|
|
1029
|
+
_ts_decorate4([
|
|
907
1030
|
(0, import_nestjs_filter.FilterFor)("workflow"),
|
|
908
1031
|
_ts_metadata3("design:type", Function),
|
|
909
1032
|
_ts_metadata3("design:paramtypes", [
|
|
@@ -911,7 +1034,7 @@ _ts_decorate3([
|
|
|
911
1034
|
]),
|
|
912
1035
|
_ts_metadata3("design:returntype", void 0)
|
|
913
1036
|
], RunFilter.prototype, "applyWorkflow", null);
|
|
914
|
-
|
|
1037
|
+
_ts_decorate4([
|
|
915
1038
|
(0, import_nestjs_filter.FilterFor)("namespace"),
|
|
916
1039
|
_ts_metadata3("design:type", Function),
|
|
917
1040
|
_ts_metadata3("design:paramtypes", [
|
|
@@ -919,7 +1042,7 @@ _ts_decorate3([
|
|
|
919
1042
|
]),
|
|
920
1043
|
_ts_metadata3("design:returntype", void 0)
|
|
921
1044
|
], RunFilter.prototype, "applyNamespace", null);
|
|
922
|
-
|
|
1045
|
+
_ts_decorate4([
|
|
923
1046
|
(0, import_nestjs_filter.FilterFor)("tag"),
|
|
924
1047
|
_ts_metadata3("design:type", Function),
|
|
925
1048
|
_ts_metadata3("design:paramtypes", [
|
|
@@ -927,19 +1050,19 @@ _ts_decorate3([
|
|
|
927
1050
|
]),
|
|
928
1051
|
_ts_metadata3("design:returntype", void 0)
|
|
929
1052
|
], RunFilter.prototype, "applyTag", null);
|
|
930
|
-
|
|
1053
|
+
_ts_decorate4([
|
|
931
1054
|
(0, import_nestjs_filter.FilterFor)("origin"),
|
|
932
1055
|
_ts_metadata3("design:type", Function),
|
|
933
1056
|
_ts_metadata3("design:paramtypes", []),
|
|
934
1057
|
_ts_metadata3("design:returntype", void 0)
|
|
935
1058
|
], RunFilter.prototype, "applyOrigin", null);
|
|
936
|
-
|
|
1059
|
+
_ts_decorate4([
|
|
937
1060
|
(0, import_nestjs_filter.FilterFor)("unattributed"),
|
|
938
1061
|
_ts_metadata3("design:type", Function),
|
|
939
1062
|
_ts_metadata3("design:paramtypes", []),
|
|
940
1063
|
_ts_metadata3("design:returntype", void 0)
|
|
941
1064
|
], RunFilter.prototype, "applyUnattributed", null);
|
|
942
|
-
|
|
1065
|
+
_ts_decorate4([
|
|
943
1066
|
(0, import_nestjs_filter.FilterFor)("attr"),
|
|
944
1067
|
_ts_metadata3("design:type", Function),
|
|
945
1068
|
_ts_metadata3("design:paramtypes", [
|
|
@@ -947,7 +1070,7 @@ _ts_decorate3([
|
|
|
947
1070
|
]),
|
|
948
1071
|
_ts_metadata3("design:returntype", void 0)
|
|
949
1072
|
], RunFilter.prototype, "applyAttributes", null);
|
|
950
|
-
|
|
1073
|
+
_ts_decorate4([
|
|
951
1074
|
(0, import_nestjs_filter.FilterFor)("limit"),
|
|
952
1075
|
_ts_metadata3("design:type", Function),
|
|
953
1076
|
_ts_metadata3("design:paramtypes", [
|
|
@@ -955,7 +1078,7 @@ _ts_decorate3([
|
|
|
955
1078
|
]),
|
|
956
1079
|
_ts_metadata3("design:returntype", void 0)
|
|
957
1080
|
], RunFilter.prototype, "applyLimit", null);
|
|
958
|
-
|
|
1081
|
+
_ts_decorate4([
|
|
959
1082
|
(0, import_nestjs_filter.FilterFor)("offset"),
|
|
960
1083
|
_ts_metadata3("design:type", Function),
|
|
961
1084
|
_ts_metadata3("design:paramtypes", [
|
|
@@ -963,8 +1086,8 @@ _ts_decorate3([
|
|
|
963
1086
|
]),
|
|
964
1087
|
_ts_metadata3("design:returntype", void 0)
|
|
965
1088
|
], RunFilter.prototype, "applyOffset", null);
|
|
966
|
-
RunFilter =
|
|
967
|
-
(0,
|
|
1089
|
+
RunFilter = _ts_decorate4([
|
|
1090
|
+
(0, import_common4.Injectable)(),
|
|
968
1091
|
(0, import_nestjs_filter.Filterable)({
|
|
969
1092
|
entity: DurableRun,
|
|
970
1093
|
adapter: RUN_QUERY_ADAPTER,
|
|
@@ -973,7 +1096,7 @@ RunFilter = _ts_decorate3([
|
|
|
973
1096
|
], RunFilter);
|
|
974
1097
|
|
|
975
1098
|
// src/server/durable-api.controller.ts
|
|
976
|
-
function
|
|
1099
|
+
function _ts_decorate5(decorators, target, key, desc) {
|
|
977
1100
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
978
1101
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
979
1102
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -986,7 +1109,7 @@ function _ts_decorate4(decorators, target, key, desc) {
|
|
|
986
1109
|
}
|
|
987
1110
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
988
1111
|
}
|
|
989
|
-
__name(
|
|
1112
|
+
__name(_ts_decorate5, "_ts_decorate");
|
|
990
1113
|
function _ts_metadata4(metadataKey, metadataValue) {
|
|
991
1114
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
992
1115
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
@@ -1101,23 +1224,43 @@ var DurableApiController = class {
|
|
|
1101
1224
|
/**
|
|
1102
1225
|
* A run's detail. Fans wider than {@link FAN_INLINE_MAX} come back as one `FanSummary` each, their
|
|
1103
1226
|
* members paged by `runs/:id/fans/:group`; `?full=true` returns every checkpoint instead.
|
|
1227
|
+
*
|
|
1228
|
+
* When the gateway can version the detail without reading it, the response carries an `ETag`, and
|
|
1229
|
+
* a poll whose `If-None-Match` still names it gets a 304 before the timeline is read. The browser
|
|
1230
|
+
* sends that header itself (the response is `no-cache`), so a console poll needs no code for it.
|
|
1104
1231
|
*/
|
|
1105
|
-
async run(id, full) {
|
|
1232
|
+
async run(id, full, ifNoneMatch, response) {
|
|
1106
1233
|
const detail = await this.dashboard.getRunDetail(id, full === "true" ? void 0 : {
|
|
1107
|
-
summarizeFansOver: FAN_INLINE_MAX
|
|
1234
|
+
summarizeFansOver: FAN_INLINE_MAX,
|
|
1235
|
+
...ifNoneMatch && {
|
|
1236
|
+
ifNoneMatch
|
|
1237
|
+
}
|
|
1108
1238
|
});
|
|
1109
|
-
if (!detail) throw new
|
|
1110
|
-
|
|
1239
|
+
if (!detail) throw new import_common5.NotFoundException(`run ${id} not found`);
|
|
1240
|
+
const { etag, notModified, ...body } = detail;
|
|
1241
|
+
if (etag) {
|
|
1242
|
+
if (notModified) throw new NotModifiedException(etag);
|
|
1243
|
+
setEtag(response, etag);
|
|
1244
|
+
}
|
|
1245
|
+
return body;
|
|
1111
1246
|
}
|
|
1112
|
-
/** One page of a summarized fan's members, in seq order. */
|
|
1113
|
-
async fanMembers(id, group, offset, limit, failed) {
|
|
1247
|
+
/** One page of a summarized fan's members, in seq order. Versioned like {@link run}. */
|
|
1248
|
+
async fanMembers(id, group, offset, limit, failed, ifNoneMatch, response) {
|
|
1114
1249
|
const page2 = await this.dashboard.getFanMembers(id, group, {
|
|
1115
1250
|
offset: offset === void 0 ? void 0 : Number(offset),
|
|
1116
1251
|
limit: limit === void 0 ? void 0 : Number(limit),
|
|
1117
|
-
failedOnly: failed === "true"
|
|
1252
|
+
failedOnly: failed === "true",
|
|
1253
|
+
...ifNoneMatch && {
|
|
1254
|
+
ifNoneMatch
|
|
1255
|
+
}
|
|
1118
1256
|
});
|
|
1119
|
-
if (!page2) throw new
|
|
1120
|
-
|
|
1257
|
+
if (!page2) throw new import_common5.NotFoundException(`fan ${group} of run ${id} not found`);
|
|
1258
|
+
const { etag, notModified, ...body } = page2;
|
|
1259
|
+
if (etag) {
|
|
1260
|
+
if (notModified) throw new NotModifiedException(etag);
|
|
1261
|
+
setEtag(response, etag);
|
|
1262
|
+
}
|
|
1263
|
+
return body;
|
|
1121
1264
|
}
|
|
1122
1265
|
/** Server-Sent Events stream of a run's live lifecycle events — the dashboard tails it instead
|
|
1123
1266
|
* of polling. Cross-pod when the transport has a control plane (see DashboardService.streamRun). */
|
|
@@ -1146,18 +1289,18 @@ var DurableApiController = class {
|
|
|
1146
1289
|
const result = await this.dashboard.cancel(id, {
|
|
1147
1290
|
compensate: compensate === "true"
|
|
1148
1291
|
});
|
|
1149
|
-
if (!result) throw new
|
|
1292
|
+
if (!result) throw new import_common5.NotFoundException(`run ${id} not found`);
|
|
1150
1293
|
return result;
|
|
1151
1294
|
}
|
|
1152
1295
|
async continue(id) {
|
|
1153
1296
|
const result = await this.dashboard.continue(id);
|
|
1154
|
-
if (!result) throw new
|
|
1297
|
+
if (!result) throw new import_common5.NotFoundException(`run ${id} is not paused at a breakpoint`);
|
|
1155
1298
|
return result;
|
|
1156
1299
|
}
|
|
1157
1300
|
/** Re-dispatch a run's stuck `pending` remote steps — recovery for a lost step dispatch. */
|
|
1158
1301
|
async redispatch(id) {
|
|
1159
1302
|
const result = await this.dashboard.redispatch(id);
|
|
1160
|
-
if (!result) throw new
|
|
1303
|
+
if (!result) throw new import_common5.NotFoundException(`run ${id} not found`);
|
|
1161
1304
|
return result;
|
|
1162
1305
|
}
|
|
1163
1306
|
/**
|
|
@@ -1168,7 +1311,7 @@ var DurableApiController = class {
|
|
|
1168
1311
|
*/
|
|
1169
1312
|
async webhook(token, body) {
|
|
1170
1313
|
const result = await this.dashboard.deliverWebhook(token, body);
|
|
1171
|
-
if (!result) throw new
|
|
1314
|
+
if (!result) throw new import_common5.NotFoundException(`no run is waiting on webhook ${token}`);
|
|
1172
1315
|
return result;
|
|
1173
1316
|
}
|
|
1174
1317
|
/** Live query: the latest value a run published for `key` via `ctx.setEvent` (no side effect). */
|
|
@@ -1180,8 +1323,8 @@ var DurableApiController = class {
|
|
|
1180
1323
|
return this.dashboard.update(id, name, body);
|
|
1181
1324
|
}
|
|
1182
1325
|
};
|
|
1183
|
-
|
|
1184
|
-
(0,
|
|
1326
|
+
_ts_decorate5([
|
|
1327
|
+
(0, import_common5.Get)("runs"),
|
|
1185
1328
|
_ts_param2(0, (0, import_nestjs_filter2.ApplyFilter)(RunFilter)),
|
|
1186
1329
|
_ts_metadata4("design:type", Function),
|
|
1187
1330
|
_ts_metadata4("design:paramtypes", [
|
|
@@ -1189,8 +1332,8 @@ _ts_decorate4([
|
|
|
1189
1332
|
]),
|
|
1190
1333
|
_ts_metadata4("design:returntype", Promise)
|
|
1191
1334
|
], DurableApiController.prototype, "runs", null);
|
|
1192
|
-
|
|
1193
|
-
(0,
|
|
1335
|
+
_ts_decorate5([
|
|
1336
|
+
(0, import_common5.Get)("runs/facets"),
|
|
1194
1337
|
_ts_param2(0, (0, import_nestjs_filter2.ApplyFilter)(RunFilter)),
|
|
1195
1338
|
_ts_metadata4("design:type", Function),
|
|
1196
1339
|
_ts_metadata4("design:paramtypes", [
|
|
@@ -1198,35 +1341,35 @@ _ts_decorate4([
|
|
|
1198
1341
|
]),
|
|
1199
1342
|
_ts_metadata4("design:returntype", void 0)
|
|
1200
1343
|
], DurableApiController.prototype, "facets", null);
|
|
1201
|
-
|
|
1202
|
-
(0,
|
|
1203
|
-
_ts_param2(0, (0,
|
|
1344
|
+
_ts_decorate5([
|
|
1345
|
+
(0, import_common5.Get)("runs/values"),
|
|
1346
|
+
_ts_param2(0, (0, import_common5.Query)()),
|
|
1204
1347
|
_ts_metadata4("design:type", Function),
|
|
1205
1348
|
_ts_metadata4("design:paramtypes", [
|
|
1206
1349
|
typeof Record === "undefined" ? Object : Record
|
|
1207
1350
|
]),
|
|
1208
1351
|
_ts_metadata4("design:returntype", void 0)
|
|
1209
1352
|
], DurableApiController.prototype, "values", null);
|
|
1210
|
-
|
|
1211
|
-
(0,
|
|
1212
|
-
(0,
|
|
1353
|
+
_ts_decorate5([
|
|
1354
|
+
(0, import_common5.Get)("metrics"),
|
|
1355
|
+
(0, import_common5.Header)("Content-Type", "text/plain; version=0.0.4"),
|
|
1213
1356
|
_ts_metadata4("design:type", Function),
|
|
1214
1357
|
_ts_metadata4("design:paramtypes", []),
|
|
1215
1358
|
_ts_metadata4("design:returntype", void 0)
|
|
1216
1359
|
], DurableApiController.prototype, "metrics", null);
|
|
1217
|
-
|
|
1218
|
-
(0,
|
|
1360
|
+
_ts_decorate5([
|
|
1361
|
+
(0, import_common5.Get)("workers"),
|
|
1219
1362
|
_ts_metadata4("design:type", Function),
|
|
1220
1363
|
_ts_metadata4("design:paramtypes", []),
|
|
1221
1364
|
_ts_metadata4("design:returntype", void 0)
|
|
1222
1365
|
], 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,
|
|
1366
|
+
_ts_decorate5([
|
|
1367
|
+
(0, import_common5.Get)("schedules"),
|
|
1368
|
+
_ts_param2(0, (0, import_common5.Query)("namespace")),
|
|
1369
|
+
_ts_param2(1, (0, import_common5.Query)("workflow")),
|
|
1370
|
+
_ts_param2(2, (0, import_common5.Query)("tag")),
|
|
1371
|
+
_ts_param2(3, (0, import_common5.Query)("paused")),
|
|
1372
|
+
_ts_param2(4, (0, import_common5.Query)("limit")),
|
|
1230
1373
|
_ts_metadata4("design:type", Function),
|
|
1231
1374
|
_ts_metadata4("design:paramtypes", [
|
|
1232
1375
|
String,
|
|
@@ -1237,89 +1380,101 @@ _ts_decorate4([
|
|
|
1237
1380
|
]),
|
|
1238
1381
|
_ts_metadata4("design:returntype", void 0)
|
|
1239
1382
|
], DurableApiController.prototype, "schedules", null);
|
|
1240
|
-
|
|
1241
|
-
(0,
|
|
1242
|
-
_ts_param2(0, (0,
|
|
1383
|
+
_ts_decorate5([
|
|
1384
|
+
(0, import_common5.Post)("schedules/:id/pause"),
|
|
1385
|
+
_ts_param2(0, (0, import_common5.Param)("id")),
|
|
1243
1386
|
_ts_metadata4("design:type", Function),
|
|
1244
1387
|
_ts_metadata4("design:paramtypes", [
|
|
1245
1388
|
String
|
|
1246
1389
|
]),
|
|
1247
1390
|
_ts_metadata4("design:returntype", void 0)
|
|
1248
1391
|
], DurableApiController.prototype, "pauseSchedule", null);
|
|
1249
|
-
|
|
1250
|
-
(0,
|
|
1251
|
-
_ts_param2(0, (0,
|
|
1392
|
+
_ts_decorate5([
|
|
1393
|
+
(0, import_common5.Post)("schedules/:id/resume"),
|
|
1394
|
+
_ts_param2(0, (0, import_common5.Param)("id")),
|
|
1252
1395
|
_ts_metadata4("design:type", Function),
|
|
1253
1396
|
_ts_metadata4("design:paramtypes", [
|
|
1254
1397
|
String
|
|
1255
1398
|
]),
|
|
1256
1399
|
_ts_metadata4("design:returntype", void 0)
|
|
1257
1400
|
], DurableApiController.prototype, "resumeSchedule", null);
|
|
1258
|
-
|
|
1259
|
-
(0,
|
|
1260
|
-
_ts_param2(0, (0,
|
|
1401
|
+
_ts_decorate5([
|
|
1402
|
+
(0, import_common5.Post)("schedules/:id/trigger"),
|
|
1403
|
+
_ts_param2(0, (0, import_common5.Param)("id")),
|
|
1261
1404
|
_ts_metadata4("design:type", Function),
|
|
1262
1405
|
_ts_metadata4("design:paramtypes", [
|
|
1263
1406
|
String
|
|
1264
1407
|
]),
|
|
1265
1408
|
_ts_metadata4("design:returntype", void 0)
|
|
1266
1409
|
], DurableApiController.prototype, "triggerSchedule", null);
|
|
1267
|
-
|
|
1268
|
-
(0,
|
|
1410
|
+
_ts_decorate5([
|
|
1411
|
+
(0, import_common5.Get)("topology"),
|
|
1269
1412
|
_ts_metadata4("design:type", Function),
|
|
1270
1413
|
_ts_metadata4("design:paramtypes", []),
|
|
1271
1414
|
_ts_metadata4("design:returntype", void 0)
|
|
1272
1415
|
], DurableApiController.prototype, "topology", null);
|
|
1273
|
-
|
|
1274
|
-
(0,
|
|
1275
|
-
_ts_param2(0, (0,
|
|
1276
|
-
_ts_param2(1, (0,
|
|
1416
|
+
_ts_decorate5([
|
|
1417
|
+
(0, import_common5.Get)("runs/:id"),
|
|
1418
|
+
_ts_param2(0, (0, import_common5.Param)("id")),
|
|
1419
|
+
_ts_param2(1, (0, import_common5.Query)("full")),
|
|
1420
|
+
_ts_param2(2, (0, import_common5.Headers)("if-none-match")),
|
|
1421
|
+
_ts_param2(3, (0, import_common5.Res)({
|
|
1422
|
+
passthrough: true
|
|
1423
|
+
})),
|
|
1277
1424
|
_ts_metadata4("design:type", Function),
|
|
1278
1425
|
_ts_metadata4("design:paramtypes", [
|
|
1279
1426
|
String,
|
|
1280
|
-
String
|
|
1427
|
+
String,
|
|
1428
|
+
String,
|
|
1429
|
+
Object
|
|
1281
1430
|
]),
|
|
1282
1431
|
_ts_metadata4("design:returntype", Promise)
|
|
1283
1432
|
], 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,
|
|
1433
|
+
_ts_decorate5([
|
|
1434
|
+
(0, import_common5.Get)("runs/:id/fans/:group"),
|
|
1435
|
+
_ts_param2(0, (0, import_common5.Param)("id")),
|
|
1436
|
+
_ts_param2(1, (0, import_common5.Param)("group")),
|
|
1437
|
+
_ts_param2(2, (0, import_common5.Query)("offset")),
|
|
1438
|
+
_ts_param2(3, (0, import_common5.Query)("limit")),
|
|
1439
|
+
_ts_param2(4, (0, import_common5.Query)("failed")),
|
|
1440
|
+
_ts_param2(5, (0, import_common5.Headers)("if-none-match")),
|
|
1441
|
+
_ts_param2(6, (0, import_common5.Res)({
|
|
1442
|
+
passthrough: true
|
|
1443
|
+
})),
|
|
1291
1444
|
_ts_metadata4("design:type", Function),
|
|
1292
1445
|
_ts_metadata4("design:paramtypes", [
|
|
1293
1446
|
String,
|
|
1294
1447
|
String,
|
|
1295
1448
|
String,
|
|
1296
1449
|
String,
|
|
1297
|
-
String
|
|
1450
|
+
String,
|
|
1451
|
+
String,
|
|
1452
|
+
Object
|
|
1298
1453
|
]),
|
|
1299
1454
|
_ts_metadata4("design:returntype", Promise)
|
|
1300
1455
|
], DurableApiController.prototype, "fanMembers", null);
|
|
1301
|
-
|
|
1302
|
-
(0,
|
|
1303
|
-
_ts_param2(0, (0,
|
|
1456
|
+
_ts_decorate5([
|
|
1457
|
+
(0, import_common5.Sse)("runs/:id/stream"),
|
|
1458
|
+
_ts_param2(0, (0, import_common5.Param)("id")),
|
|
1304
1459
|
_ts_metadata4("design:type", Function),
|
|
1305
1460
|
_ts_metadata4("design:paramtypes", [
|
|
1306
1461
|
String
|
|
1307
1462
|
]),
|
|
1308
1463
|
_ts_metadata4("design:returntype", void 0)
|
|
1309
1464
|
], DurableApiController.prototype, "stream", null);
|
|
1310
|
-
|
|
1311
|
-
(0,
|
|
1312
|
-
_ts_param2(0, (0,
|
|
1465
|
+
_ts_decorate5([
|
|
1466
|
+
(0, import_common5.Post)("runs/:id/retry"),
|
|
1467
|
+
_ts_param2(0, (0, import_common5.Param)("id")),
|
|
1313
1468
|
_ts_metadata4("design:type", Function),
|
|
1314
1469
|
_ts_metadata4("design:paramtypes", [
|
|
1315
1470
|
String
|
|
1316
1471
|
]),
|
|
1317
1472
|
_ts_metadata4("design:returntype", void 0)
|
|
1318
1473
|
], DurableApiController.prototype, "retry", null);
|
|
1319
|
-
|
|
1320
|
-
(0,
|
|
1321
|
-
_ts_param2(0, (0,
|
|
1322
|
-
_ts_param2(1, (0,
|
|
1474
|
+
_ts_decorate5([
|
|
1475
|
+
(0, import_common5.Post)("runs/:id/retry-with-input"),
|
|
1476
|
+
_ts_param2(0, (0, import_common5.Param)("id")),
|
|
1477
|
+
_ts_param2(1, (0, import_common5.Body)()),
|
|
1323
1478
|
_ts_metadata4("design:type", Function),
|
|
1324
1479
|
_ts_metadata4("design:paramtypes", [
|
|
1325
1480
|
String,
|
|
@@ -1327,11 +1482,11 @@ _ts_decorate4([
|
|
|
1327
1482
|
]),
|
|
1328
1483
|
_ts_metadata4("design:returntype", void 0)
|
|
1329
1484
|
], DurableApiController.prototype, "retryWithInput", null);
|
|
1330
|
-
|
|
1331
|
-
(0,
|
|
1332
|
-
_ts_param2(0, (0,
|
|
1485
|
+
_ts_decorate5([
|
|
1486
|
+
(0, import_common5.Post)("bulk/:action"),
|
|
1487
|
+
_ts_param2(0, (0, import_common5.Param)("action")),
|
|
1333
1488
|
_ts_param2(1, (0, import_nestjs_filter2.ApplyFilter)(RunFilter)),
|
|
1334
|
-
_ts_param2(2, (0,
|
|
1489
|
+
_ts_param2(2, (0, import_common5.Query)("compensate")),
|
|
1335
1490
|
_ts_metadata4("design:type", Function),
|
|
1336
1491
|
_ts_metadata4("design:paramtypes", [
|
|
1337
1492
|
String,
|
|
@@ -1340,10 +1495,10 @@ _ts_decorate4([
|
|
|
1340
1495
|
]),
|
|
1341
1496
|
_ts_metadata4("design:returntype", void 0)
|
|
1342
1497
|
], DurableApiController.prototype, "bulk", null);
|
|
1343
|
-
|
|
1344
|
-
(0,
|
|
1345
|
-
_ts_param2(0, (0,
|
|
1346
|
-
_ts_param2(1, (0,
|
|
1498
|
+
_ts_decorate5([
|
|
1499
|
+
(0, import_common5.Post)("runs/:id/cancel"),
|
|
1500
|
+
_ts_param2(0, (0, import_common5.Param)("id")),
|
|
1501
|
+
_ts_param2(1, (0, import_common5.Query)("compensate")),
|
|
1347
1502
|
_ts_metadata4("design:type", Function),
|
|
1348
1503
|
_ts_metadata4("design:paramtypes", [
|
|
1349
1504
|
String,
|
|
@@ -1351,28 +1506,28 @@ _ts_decorate4([
|
|
|
1351
1506
|
]),
|
|
1352
1507
|
_ts_metadata4("design:returntype", Promise)
|
|
1353
1508
|
], DurableApiController.prototype, "cancel", null);
|
|
1354
|
-
|
|
1355
|
-
(0,
|
|
1356
|
-
_ts_param2(0, (0,
|
|
1509
|
+
_ts_decorate5([
|
|
1510
|
+
(0, import_common5.Post)("runs/:id/continue"),
|
|
1511
|
+
_ts_param2(0, (0, import_common5.Param)("id")),
|
|
1357
1512
|
_ts_metadata4("design:type", Function),
|
|
1358
1513
|
_ts_metadata4("design:paramtypes", [
|
|
1359
1514
|
String
|
|
1360
1515
|
]),
|
|
1361
1516
|
_ts_metadata4("design:returntype", Promise)
|
|
1362
1517
|
], DurableApiController.prototype, "continue", null);
|
|
1363
|
-
|
|
1364
|
-
(0,
|
|
1365
|
-
_ts_param2(0, (0,
|
|
1518
|
+
_ts_decorate5([
|
|
1519
|
+
(0, import_common5.Post)("runs/:id/redispatch"),
|
|
1520
|
+
_ts_param2(0, (0, import_common5.Param)("id")),
|
|
1366
1521
|
_ts_metadata4("design:type", Function),
|
|
1367
1522
|
_ts_metadata4("design:paramtypes", [
|
|
1368
1523
|
String
|
|
1369
1524
|
]),
|
|
1370
1525
|
_ts_metadata4("design:returntype", Promise)
|
|
1371
1526
|
], DurableApiController.prototype, "redispatch", null);
|
|
1372
|
-
|
|
1373
|
-
(0,
|
|
1374
|
-
_ts_param2(0, (0,
|
|
1375
|
-
_ts_param2(1, (0,
|
|
1527
|
+
_ts_decorate5([
|
|
1528
|
+
(0, import_common5.Post)("webhooks/:token"),
|
|
1529
|
+
_ts_param2(0, (0, import_common5.Param)("token")),
|
|
1530
|
+
_ts_param2(1, (0, import_common5.Body)()),
|
|
1376
1531
|
_ts_metadata4("design:type", Function),
|
|
1377
1532
|
_ts_metadata4("design:paramtypes", [
|
|
1378
1533
|
String,
|
|
@@ -1380,10 +1535,10 @@ _ts_decorate4([
|
|
|
1380
1535
|
]),
|
|
1381
1536
|
_ts_metadata4("design:returntype", Promise)
|
|
1382
1537
|
], DurableApiController.prototype, "webhook", null);
|
|
1383
|
-
|
|
1384
|
-
(0,
|
|
1385
|
-
_ts_param2(0, (0,
|
|
1386
|
-
_ts_param2(1, (0,
|
|
1538
|
+
_ts_decorate5([
|
|
1539
|
+
(0, import_common5.Get)("runs/:id/events/:key"),
|
|
1540
|
+
_ts_param2(0, (0, import_common5.Param)("id")),
|
|
1541
|
+
_ts_param2(1, (0, import_common5.Param)("key")),
|
|
1387
1542
|
_ts_metadata4("design:type", Function),
|
|
1388
1543
|
_ts_metadata4("design:paramtypes", [
|
|
1389
1544
|
String,
|
|
@@ -1391,11 +1546,11 @@ _ts_decorate4([
|
|
|
1391
1546
|
]),
|
|
1392
1547
|
_ts_metadata4("design:returntype", void 0)
|
|
1393
1548
|
], DurableApiController.prototype, "event", null);
|
|
1394
|
-
|
|
1395
|
-
(0,
|
|
1396
|
-
_ts_param2(0, (0,
|
|
1397
|
-
_ts_param2(1, (0,
|
|
1398
|
-
_ts_param2(2, (0,
|
|
1549
|
+
_ts_decorate5([
|
|
1550
|
+
(0, import_common5.Post)("runs/:id/updates/:name"),
|
|
1551
|
+
_ts_param2(0, (0, import_common5.Param)("id")),
|
|
1552
|
+
_ts_param2(1, (0, import_common5.Param)("name")),
|
|
1553
|
+
_ts_param2(2, (0, import_common5.Body)()),
|
|
1399
1554
|
_ts_metadata4("design:type", Function),
|
|
1400
1555
|
_ts_metadata4("design:paramtypes", [
|
|
1401
1556
|
String,
|
|
@@ -1404,9 +1559,10 @@ _ts_decorate4([
|
|
|
1404
1559
|
]),
|
|
1405
1560
|
_ts_metadata4("design:returntype", void 0)
|
|
1406
1561
|
], DurableApiController.prototype, "update", null);
|
|
1407
|
-
DurableApiController =
|
|
1408
|
-
(0,
|
|
1409
|
-
(0,
|
|
1562
|
+
DurableApiController = _ts_decorate5([
|
|
1563
|
+
(0, import_common5.Controller)(),
|
|
1564
|
+
(0, import_common5.UseInterceptors)(import_nestjs_filter2.ApplyFilterInterceptor),
|
|
1565
|
+
(0, import_common5.UseFilters)(NotModifiedFilter),
|
|
1410
1566
|
_ts_metadata4("design:type", Function),
|
|
1411
1567
|
_ts_metadata4("design:paramtypes", [
|
|
1412
1568
|
typeof DashboardService === "undefined" ? Object : DashboardService,
|
|
@@ -1415,14 +1571,14 @@ DurableApiController = _ts_decorate4([
|
|
|
1415
1571
|
], DurableApiController);
|
|
1416
1572
|
function notFound(error) {
|
|
1417
1573
|
if (error instanceof Error && error.name === "ScheduleNotFoundError") {
|
|
1418
|
-
throw new
|
|
1574
|
+
throw new import_common5.NotFoundException(error.message);
|
|
1419
1575
|
}
|
|
1420
1576
|
throw error;
|
|
1421
1577
|
}
|
|
1422
1578
|
__name(notFound, "notFound");
|
|
1423
1579
|
|
|
1424
1580
|
// src/server/durable-auth.controller.ts
|
|
1425
|
-
var
|
|
1581
|
+
var import_common9 = require("@nestjs/common");
|
|
1426
1582
|
|
|
1427
1583
|
// src/server/auth/dashboard-auth-config.ts
|
|
1428
1584
|
var DASHBOARD_AUTH = Symbol("DASHBOARD_AUTH");
|
|
@@ -1662,14 +1818,14 @@ function renderSessionRequiredPage(basePath) {
|
|
|
1662
1818
|
__name(renderSessionRequiredPage, "renderSessionRequiredPage");
|
|
1663
1819
|
|
|
1664
1820
|
// src/server/auth/request.ts
|
|
1665
|
-
function
|
|
1821
|
+
function isRecord2(value) {
|
|
1666
1822
|
return typeof value === "object" && value !== null;
|
|
1667
1823
|
}
|
|
1668
|
-
__name(
|
|
1824
|
+
__name(isRecord2, "isRecord");
|
|
1669
1825
|
function readHeaders(request) {
|
|
1670
|
-
if (!
|
|
1826
|
+
if (!isRecord2(request)) return {};
|
|
1671
1827
|
const headers = request.headers;
|
|
1672
|
-
return
|
|
1828
|
+
return isRecord2(headers) ? headers : {};
|
|
1673
1829
|
}
|
|
1674
1830
|
__name(readHeaders, "readHeaders");
|
|
1675
1831
|
function headerToString(value) {
|
|
@@ -1685,14 +1841,14 @@ function readCookieHeader(request) {
|
|
|
1685
1841
|
}
|
|
1686
1842
|
__name(readCookieHeader, "readCookieHeader");
|
|
1687
1843
|
function isHttpsRequest(request) {
|
|
1688
|
-
if (
|
|
1844
|
+
if (isRecord2(request) && request.protocol === "https") return true;
|
|
1689
1845
|
const forwarded = headerToString(readHeaders(request)["x-forwarded-proto"]);
|
|
1690
1846
|
if (forwarded === void 0) return false;
|
|
1691
1847
|
return forwarded.split(",").map((proto) => proto.trim().toLowerCase()).includes("https");
|
|
1692
1848
|
}
|
|
1693
1849
|
__name(isHttpsRequest, "isHttpsRequest");
|
|
1694
1850
|
function originalRequestUrl(request) {
|
|
1695
|
-
if (!
|
|
1851
|
+
if (!isRecord2(request)) return "/";
|
|
1696
1852
|
if (typeof request.originalUrl === "string" && request.originalUrl !== "") {
|
|
1697
1853
|
return request.originalUrl;
|
|
1698
1854
|
}
|
|
@@ -1709,72 +1865,6 @@ function sanitizeReturnTo(candidate, fallback) {
|
|
|
1709
1865
|
}
|
|
1710
1866
|
__name(sanitizeReturnTo, "sanitizeReturnTo");
|
|
1711
1867
|
|
|
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
1868
|
// src/server/auth/cookie-header.ts
|
|
1779
1869
|
function parseCookieHeader(header) {
|
|
1780
1870
|
const cookies = {};
|
|
@@ -1974,11 +2064,11 @@ __name(maybeRenewSession, "maybeRenewSession");
|
|
|
1974
2064
|
var import_node_fs = require("fs");
|
|
1975
2065
|
var import_node_path = require("path");
|
|
1976
2066
|
var import_node_url = require("url");
|
|
1977
|
-
var
|
|
2067
|
+
var import_common8 = require("@nestjs/common");
|
|
1978
2068
|
|
|
1979
2069
|
// src/server/auth/login-redirect.exception.ts
|
|
1980
|
-
var
|
|
1981
|
-
function
|
|
2070
|
+
var import_common6 = require("@nestjs/common");
|
|
2071
|
+
function _ts_decorate6(decorators, target, key, desc) {
|
|
1982
2072
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1983
2073
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
1984
2074
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1991,8 +2081,8 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
1991
2081
|
}
|
|
1992
2082
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1993
2083
|
}
|
|
1994
|
-
__name(
|
|
1995
|
-
var DashboardLoginRedirectException = class extends
|
|
2084
|
+
__name(_ts_decorate6, "_ts_decorate");
|
|
2085
|
+
var DashboardLoginRedirectException = class extends import_common6.HttpException {
|
|
1996
2086
|
static {
|
|
1997
2087
|
__name(this, "DashboardLoginRedirectException");
|
|
1998
2088
|
}
|
|
@@ -2000,7 +2090,7 @@ var DashboardLoginRedirectException = class extends import_common5.HttpException
|
|
|
2000
2090
|
constructor(location) {
|
|
2001
2091
|
super({
|
|
2002
2092
|
location
|
|
2003
|
-
},
|
|
2093
|
+
}, import_common6.HttpStatus.FOUND), this.location = location;
|
|
2004
2094
|
}
|
|
2005
2095
|
};
|
|
2006
2096
|
var DashboardLoginRedirectFilter = class {
|
|
@@ -2012,13 +2102,13 @@ var DashboardLoginRedirectFilter = class {
|
|
|
2012
2102
|
redirectRaw(response, exception.location);
|
|
2013
2103
|
}
|
|
2014
2104
|
};
|
|
2015
|
-
DashboardLoginRedirectFilter =
|
|
2016
|
-
(0,
|
|
2105
|
+
DashboardLoginRedirectFilter = _ts_decorate6([
|
|
2106
|
+
(0, import_common6.Catch)(DashboardLoginRedirectException)
|
|
2017
2107
|
], DashboardLoginRedirectFilter);
|
|
2018
2108
|
|
|
2019
2109
|
// src/server/auth/session-required.exception.ts
|
|
2020
|
-
var
|
|
2021
|
-
function
|
|
2110
|
+
var import_common7 = require("@nestjs/common");
|
|
2111
|
+
function _ts_decorate7(decorators, target, key, desc) {
|
|
2022
2112
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2023
2113
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
2024
2114
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2031,7 +2121,7 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
2031
2121
|
}
|
|
2032
2122
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2033
2123
|
}
|
|
2034
|
-
__name(
|
|
2124
|
+
__name(_ts_decorate7, "_ts_decorate");
|
|
2035
2125
|
function _ts_metadata5(metadataKey, metadataValue) {
|
|
2036
2126
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
2037
2127
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
@@ -2044,7 +2134,7 @@ function _ts_param3(paramIndex, decorator) {
|
|
|
2044
2134
|
};
|
|
2045
2135
|
}
|
|
2046
2136
|
__name(_ts_param3, "_ts_param");
|
|
2047
|
-
var DashboardSessionRequiredException = class extends
|
|
2137
|
+
var DashboardSessionRequiredException = class extends import_common7.HttpException {
|
|
2048
2138
|
static {
|
|
2049
2139
|
__name(this, "DashboardSessionRequiredException");
|
|
2050
2140
|
}
|
|
@@ -2052,7 +2142,7 @@ var DashboardSessionRequiredException = class extends import_common6.HttpExcepti
|
|
|
2052
2142
|
constructor(basePath) {
|
|
2053
2143
|
super({
|
|
2054
2144
|
basePath
|
|
2055
|
-
},
|
|
2145
|
+
}, import_common7.HttpStatus.UNAUTHORIZED), this.basePath = basePath;
|
|
2056
2146
|
}
|
|
2057
2147
|
};
|
|
2058
2148
|
var DashboardSessionRequiredFilter = class _DashboardSessionRequiredFilter {
|
|
@@ -2060,7 +2150,7 @@ var DashboardSessionRequiredFilter = class _DashboardSessionRequiredFilter {
|
|
|
2060
2150
|
__name(this, "DashboardSessionRequiredFilter");
|
|
2061
2151
|
}
|
|
2062
2152
|
auth;
|
|
2063
|
-
logger = new
|
|
2153
|
+
logger = new import_common7.Logger(_DashboardSessionRequiredFilter.name);
|
|
2064
2154
|
warned = false;
|
|
2065
2155
|
constructor(auth = null) {
|
|
2066
2156
|
this.auth = auth;
|
|
@@ -2083,7 +2173,7 @@ var DashboardSessionRequiredFilter = class _DashboardSessionRequiredFilter {
|
|
|
2083
2173
|
if (responseAlreadyWritten(response)) return;
|
|
2084
2174
|
}
|
|
2085
2175
|
}
|
|
2086
|
-
writeHtmlRaw(response, renderSessionRequiredPage(exception.basePath),
|
|
2176
|
+
writeHtmlRaw(response, renderSessionRequiredPage(exception.basePath), import_common7.HttpStatus.UNAUTHORIZED);
|
|
2087
2177
|
}
|
|
2088
2178
|
/** Once per process, not once per request: a broken hook fires on every denied navigation. */
|
|
2089
2179
|
warnOnce(message) {
|
|
@@ -2092,10 +2182,10 @@ var DashboardSessionRequiredFilter = class _DashboardSessionRequiredFilter {
|
|
|
2092
2182
|
this.logger.warn(message);
|
|
2093
2183
|
}
|
|
2094
2184
|
};
|
|
2095
|
-
DashboardSessionRequiredFilter =
|
|
2096
|
-
(0,
|
|
2097
|
-
_ts_param3(0, (0,
|
|
2098
|
-
_ts_param3(0, (0,
|
|
2185
|
+
DashboardSessionRequiredFilter = _ts_decorate7([
|
|
2186
|
+
(0, import_common7.Catch)(DashboardSessionRequiredException),
|
|
2187
|
+
_ts_param3(0, (0, import_common7.Optional)()),
|
|
2188
|
+
_ts_param3(0, (0, import_common7.Inject)(DASHBOARD_AUTH)),
|
|
2099
2189
|
_ts_metadata5("design:type", Function),
|
|
2100
2190
|
_ts_metadata5("design:paramtypes", [
|
|
2101
2191
|
Object
|
|
@@ -2103,7 +2193,7 @@ DashboardSessionRequiredFilter = _ts_decorate6([
|
|
|
2103
2193
|
], DashboardSessionRequiredFilter);
|
|
2104
2194
|
|
|
2105
2195
|
// src/server/durable-ui.controller.ts
|
|
2106
|
-
function
|
|
2196
|
+
function _ts_decorate8(decorators, target, key, desc) {
|
|
2107
2197
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2108
2198
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
2109
2199
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2116,7 +2206,7 @@ function _ts_decorate7(decorators, target, key, desc) {
|
|
|
2116
2206
|
}
|
|
2117
2207
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2118
2208
|
}
|
|
2119
|
-
__name(
|
|
2209
|
+
__name(_ts_decorate8, "_ts_decorate");
|
|
2120
2210
|
function _ts_metadata6(metadataKey, metadataValue) {
|
|
2121
2211
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
2122
2212
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
@@ -2161,7 +2251,7 @@ var DurableUiController = class {
|
|
|
2161
2251
|
index() {
|
|
2162
2252
|
const indexPath = (0, import_node_path.join)(this.dir, "index.html");
|
|
2163
2253
|
if (!(0, import_node_fs.existsSync)(indexPath)) {
|
|
2164
|
-
throw new
|
|
2254
|
+
throw new import_common8.NotFoundException("Dashboard is not built. Run the package build.");
|
|
2165
2255
|
}
|
|
2166
2256
|
const html = (0, import_node_fs.readFileSync)(indexPath, "utf8").replaceAll(`="${BUILD_BASE}/`, `="${this.basePath}/`);
|
|
2167
2257
|
const inject = `<script>window.__DURABLE_BASE__='${this.basePath}';window.__DURABLE_API__='${this.apiBasePath}';</script>`;
|
|
@@ -2169,41 +2259,41 @@ var DurableUiController = class {
|
|
|
2169
2259
|
}
|
|
2170
2260
|
asset(file) {
|
|
2171
2261
|
const safe = (0, import_node_path.basename)(file);
|
|
2172
|
-
if (safe !== file) throw new
|
|
2262
|
+
if (safe !== file) throw new import_common8.NotFoundException();
|
|
2173
2263
|
const root = (0, import_node_path.resolve)(this.dir, "assets");
|
|
2174
2264
|
const assetPath = (0, import_node_path.resolve)(root, safe);
|
|
2175
2265
|
if (!assetPath.startsWith(root + import_node_path.sep) || !(0, import_node_fs.existsSync)(assetPath)) {
|
|
2176
|
-
throw new
|
|
2266
|
+
throw new import_common8.NotFoundException();
|
|
2177
2267
|
}
|
|
2178
2268
|
const type = CONTENT_TYPES[(0, import_node_path.extname)(safe)] ?? "application/octet-stream";
|
|
2179
|
-
return new
|
|
2269
|
+
return new import_common8.StreamableFile((0, import_node_fs.readFileSync)(assetPath), {
|
|
2180
2270
|
type
|
|
2181
2271
|
});
|
|
2182
2272
|
}
|
|
2183
2273
|
};
|
|
2184
|
-
|
|
2185
|
-
(0,
|
|
2186
|
-
(0,
|
|
2187
|
-
(0,
|
|
2274
|
+
_ts_decorate8([
|
|
2275
|
+
(0, import_common8.Get)(),
|
|
2276
|
+
(0, import_common8.Header)("Content-Type", "text/html; charset=utf-8"),
|
|
2277
|
+
(0, import_common8.Header)("Cache-Control", "no-store, must-revalidate"),
|
|
2188
2278
|
_ts_metadata6("design:type", Function),
|
|
2189
2279
|
_ts_metadata6("design:paramtypes", []),
|
|
2190
2280
|
_ts_metadata6("design:returntype", String)
|
|
2191
2281
|
], DurableUiController.prototype, "index", null);
|
|
2192
|
-
|
|
2193
|
-
(0,
|
|
2194
|
-
(0,
|
|
2195
|
-
_ts_param4(0, (0,
|
|
2282
|
+
_ts_decorate8([
|
|
2283
|
+
(0, import_common8.Get)("assets/:file"),
|
|
2284
|
+
(0, import_common8.Header)("Cache-Control", "public, max-age=31536000, immutable"),
|
|
2285
|
+
_ts_param4(0, (0, import_common8.Param)("file")),
|
|
2196
2286
|
_ts_metadata6("design:type", Function),
|
|
2197
2287
|
_ts_metadata6("design:paramtypes", [
|
|
2198
2288
|
String
|
|
2199
2289
|
]),
|
|
2200
|
-
_ts_metadata6("design:returntype", typeof
|
|
2290
|
+
_ts_metadata6("design:returntype", typeof import_common8.StreamableFile === "undefined" ? Object : import_common8.StreamableFile)
|
|
2201
2291
|
], DurableUiController.prototype, "asset", null);
|
|
2202
|
-
DurableUiController =
|
|
2203
|
-
(0,
|
|
2204
|
-
(0,
|
|
2205
|
-
_ts_param4(0, (0,
|
|
2206
|
-
_ts_param4(1, (0,
|
|
2292
|
+
DurableUiController = _ts_decorate8([
|
|
2293
|
+
(0, import_common8.UseFilters)(DashboardLoginRedirectFilter, DashboardSessionRequiredFilter),
|
|
2294
|
+
(0, import_common8.Controller)(),
|
|
2295
|
+
_ts_param4(0, (0, import_common8.Inject)(DASHBOARD_BASE_PATH)),
|
|
2296
|
+
_ts_param4(1, (0, import_common8.Inject)(DASHBOARD_API_PATH)),
|
|
2207
2297
|
_ts_metadata6("design:type", Function),
|
|
2208
2298
|
_ts_metadata6("design:paramtypes", [
|
|
2209
2299
|
String,
|
|
@@ -2212,7 +2302,7 @@ DurableUiController = _ts_decorate7([
|
|
|
2212
2302
|
], DurableUiController);
|
|
2213
2303
|
|
|
2214
2304
|
// src/server/durable-auth.controller.ts
|
|
2215
|
-
function
|
|
2305
|
+
function _ts_decorate9(decorators, target, key, desc) {
|
|
2216
2306
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2217
2307
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
2218
2308
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2225,7 +2315,7 @@ function _ts_decorate8(decorators, target, key, desc) {
|
|
|
2225
2315
|
}
|
|
2226
2316
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2227
2317
|
}
|
|
2228
|
-
__name(
|
|
2318
|
+
__name(_ts_decorate9, "_ts_decorate");
|
|
2229
2319
|
function _ts_metadata7(metadataKey, metadataValue) {
|
|
2230
2320
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
2231
2321
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
@@ -2248,7 +2338,7 @@ var DurableAuthController = class _DurableAuthController {
|
|
|
2248
2338
|
}
|
|
2249
2339
|
auth;
|
|
2250
2340
|
basePath;
|
|
2251
|
-
logger = new
|
|
2341
|
+
logger = new import_common9.Logger(_DurableAuthController.name);
|
|
2252
2342
|
/** Warn once per hook kind so a throwing hook doesn't spam logs on every failed attempt. */
|
|
2253
2343
|
warnedHooks = /* @__PURE__ */ new Set();
|
|
2254
2344
|
constructor(auth, basePath) {
|
|
@@ -2260,7 +2350,7 @@ var DurableAuthController = class _DurableAuthController {
|
|
|
2260
2350
|
// the developer-controlled `basePath`.
|
|
2261
2351
|
loginPage() {
|
|
2262
2352
|
const auth = this.requireAuth();
|
|
2263
|
-
if (!auth.modes.includes("login")) throw new
|
|
2353
|
+
if (!auth.modes.includes("login")) throw new import_common9.NotFoundException();
|
|
2264
2354
|
return renderLoginPage(this.basePath);
|
|
2265
2355
|
}
|
|
2266
2356
|
// Called by the login page's own fetch (JSON, not a classic form POST — see `login-page.ts` for
|
|
@@ -2269,13 +2359,13 @@ var DurableAuthController = class _DurableAuthController {
|
|
|
2269
2359
|
// (unknown user, wrong password, throwing hook) — no user-enumeration.
|
|
2270
2360
|
async login(body, request, response) {
|
|
2271
2361
|
const auth = this.requireAuth();
|
|
2272
|
-
if (!auth.modes.includes("login")) throw new
|
|
2362
|
+
if (!auth.modes.includes("login")) throw new import_common9.NotFoundException();
|
|
2273
2363
|
if (!isString(body?.username) || !isString(body?.password)) {
|
|
2274
|
-
throw new
|
|
2364
|
+
throw new import_common9.BadRequestException("Body must include string `username` and `password`.");
|
|
2275
2365
|
}
|
|
2276
2366
|
const { username, password } = body;
|
|
2277
2367
|
const user = await this.runHook("login", () => auth.login?.(username, password) ?? null);
|
|
2278
|
-
if (!user) throw new
|
|
2368
|
+
if (!user) throw new import_common9.UnauthorizedException({
|
|
2279
2369
|
message: "Invalid username or password."
|
|
2280
2370
|
});
|
|
2281
2371
|
issueSessionCookie(user, {
|
|
@@ -2292,9 +2382,9 @@ var DurableAuthController = class _DurableAuthController {
|
|
|
2292
2382
|
// guard decides, and no credential ever reaches this library.
|
|
2293
2383
|
async session(request, response) {
|
|
2294
2384
|
const auth = this.requireAuth();
|
|
2295
|
-
if (!auth.modes.includes("session")) throw new
|
|
2385
|
+
if (!auth.modes.includes("session")) throw new import_common9.NotFoundException();
|
|
2296
2386
|
const user = await this.runHook("session", () => auth.session?.(request) ?? null);
|
|
2297
|
-
if (!user) throw new
|
|
2387
|
+
if (!user) throw new import_common9.UnauthorizedException();
|
|
2298
2388
|
issueSessionCookie(user, {
|
|
2299
2389
|
auth,
|
|
2300
2390
|
request,
|
|
@@ -2313,7 +2403,7 @@ var DurableAuthController = class _DurableAuthController {
|
|
|
2313
2403
|
redirectRaw(response, this.auth?.modes.includes("login") ? `${this.basePath}/login` : this.basePath);
|
|
2314
2404
|
}
|
|
2315
2405
|
requireAuth() {
|
|
2316
|
-
if (!this.auth) throw new
|
|
2406
|
+
if (!this.auth) throw new import_common9.NotFoundException();
|
|
2317
2407
|
return this.auth;
|
|
2318
2408
|
}
|
|
2319
2409
|
/**
|
|
@@ -2333,20 +2423,20 @@ var DurableAuthController = class _DurableAuthController {
|
|
|
2333
2423
|
}
|
|
2334
2424
|
}
|
|
2335
2425
|
};
|
|
2336
|
-
|
|
2337
|
-
(0,
|
|
2338
|
-
(0,
|
|
2339
|
-
(0,
|
|
2426
|
+
_ts_decorate9([
|
|
2427
|
+
(0, import_common9.Get)("login"),
|
|
2428
|
+
(0, import_common9.Header)("Content-Type", "text/html; charset=utf-8"),
|
|
2429
|
+
(0, import_common9.Header)("Cache-Control", "no-store, must-revalidate"),
|
|
2340
2430
|
_ts_metadata7("design:type", Function),
|
|
2341
2431
|
_ts_metadata7("design:paramtypes", []),
|
|
2342
2432
|
_ts_metadata7("design:returntype", String)
|
|
2343
2433
|
], DurableAuthController.prototype, "loginPage", null);
|
|
2344
|
-
|
|
2345
|
-
(0,
|
|
2346
|
-
(0,
|
|
2347
|
-
_ts_param5(0, (0,
|
|
2348
|
-
_ts_param5(1, (0,
|
|
2349
|
-
_ts_param5(2, (0,
|
|
2434
|
+
_ts_decorate9([
|
|
2435
|
+
(0, import_common9.Post)("login"),
|
|
2436
|
+
(0, import_common9.HttpCode)(200),
|
|
2437
|
+
_ts_param5(0, (0, import_common9.Body)()),
|
|
2438
|
+
_ts_param5(1, (0, import_common9.Req)()),
|
|
2439
|
+
_ts_param5(2, (0, import_common9.Res)({
|
|
2350
2440
|
passthrough: true
|
|
2351
2441
|
})),
|
|
2352
2442
|
_ts_metadata7("design:type", Function),
|
|
@@ -2357,11 +2447,11 @@ _ts_decorate8([
|
|
|
2357
2447
|
]),
|
|
2358
2448
|
_ts_metadata7("design:returntype", Promise)
|
|
2359
2449
|
], DurableAuthController.prototype, "login", null);
|
|
2360
|
-
|
|
2361
|
-
(0,
|
|
2362
|
-
(0,
|
|
2363
|
-
_ts_param5(0, (0,
|
|
2364
|
-
_ts_param5(1, (0,
|
|
2450
|
+
_ts_decorate9([
|
|
2451
|
+
(0, import_common9.Post)("session"),
|
|
2452
|
+
(0, import_common9.HttpCode)(204),
|
|
2453
|
+
_ts_param5(0, (0, import_common9.Req)()),
|
|
2454
|
+
_ts_param5(1, (0, import_common9.Res)({
|
|
2365
2455
|
passthrough: true
|
|
2366
2456
|
})),
|
|
2367
2457
|
_ts_metadata7("design:type", Function),
|
|
@@ -2371,10 +2461,10 @@ _ts_decorate8([
|
|
|
2371
2461
|
]),
|
|
2372
2462
|
_ts_metadata7("design:returntype", Promise)
|
|
2373
2463
|
], DurableAuthController.prototype, "session", null);
|
|
2374
|
-
|
|
2375
|
-
(0,
|
|
2376
|
-
_ts_param5(0, (0,
|
|
2377
|
-
_ts_param5(1, (0,
|
|
2464
|
+
_ts_decorate9([
|
|
2465
|
+
(0, import_common9.Get)("logout"),
|
|
2466
|
+
_ts_param5(0, (0, import_common9.Req)()),
|
|
2467
|
+
_ts_param5(1, (0, import_common9.Res)()),
|
|
2378
2468
|
_ts_metadata7("design:type", Function),
|
|
2379
2469
|
_ts_metadata7("design:paramtypes", [
|
|
2380
2470
|
Object,
|
|
@@ -2382,11 +2472,11 @@ _ts_decorate8([
|
|
|
2382
2472
|
]),
|
|
2383
2473
|
_ts_metadata7("design:returntype", void 0)
|
|
2384
2474
|
], DurableAuthController.prototype, "logout", null);
|
|
2385
|
-
DurableAuthController =
|
|
2386
|
-
(0,
|
|
2387
|
-
_ts_param5(0, (0,
|
|
2388
|
-
_ts_param5(0, (0,
|
|
2389
|
-
_ts_param5(1, (0,
|
|
2475
|
+
DurableAuthController = _ts_decorate9([
|
|
2476
|
+
(0, import_common9.Controller)(),
|
|
2477
|
+
_ts_param5(0, (0, import_common9.Optional)()),
|
|
2478
|
+
_ts_param5(0, (0, import_common9.Inject)(DASHBOARD_AUTH)),
|
|
2479
|
+
_ts_param5(1, (0, import_common9.Inject)(DASHBOARD_BASE_PATH)),
|
|
2390
2480
|
_ts_metadata7("design:type", Function),
|
|
2391
2481
|
_ts_metadata7("design:paramtypes", [
|
|
2392
2482
|
Object,
|
|
@@ -2397,12 +2487,12 @@ DurableAuthController = _ts_decorate8([
|
|
|
2397
2487
|
// src/server/durable-dashboard.module.ts
|
|
2398
2488
|
var import_reflect_metadata = require("reflect-metadata");
|
|
2399
2489
|
var import_nestjs_filter3 = require("@dudousxd/nestjs-filter");
|
|
2400
|
-
var
|
|
2490
|
+
var import_common11 = require("@nestjs/common");
|
|
2401
2491
|
var import_core = require("@nestjs/core");
|
|
2402
2492
|
|
|
2403
2493
|
// src/server/durable-session.guard.ts
|
|
2404
|
-
var
|
|
2405
|
-
function
|
|
2494
|
+
var import_common10 = require("@nestjs/common");
|
|
2495
|
+
function _ts_decorate10(decorators, target, key, desc) {
|
|
2406
2496
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2407
2497
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
2408
2498
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2415,7 +2505,7 @@ function _ts_decorate9(decorators, target, key, desc) {
|
|
|
2415
2505
|
}
|
|
2416
2506
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2417
2507
|
}
|
|
2418
|
-
__name(
|
|
2508
|
+
__name(_ts_decorate10, "_ts_decorate");
|
|
2419
2509
|
function _ts_metadata8(metadataKey, metadataValue) {
|
|
2420
2510
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
2421
2511
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
@@ -2468,10 +2558,10 @@ var DurableUiSessionGuard = class {
|
|
|
2468
2558
|
throw new DashboardLoginRedirectException(`${this.basePath}/login?returnTo=${returnTo}`);
|
|
2469
2559
|
}
|
|
2470
2560
|
};
|
|
2471
|
-
DurableUiSessionGuard =
|
|
2472
|
-
(0,
|
|
2473
|
-
_ts_param6(0, (0,
|
|
2474
|
-
_ts_param6(1, (0,
|
|
2561
|
+
DurableUiSessionGuard = _ts_decorate10([
|
|
2562
|
+
(0, import_common10.Injectable)(),
|
|
2563
|
+
_ts_param6(0, (0, import_common10.Inject)(DASHBOARD_AUTH)),
|
|
2564
|
+
_ts_param6(1, (0, import_common10.Inject)(DASHBOARD_BASE_PATH)),
|
|
2475
2565
|
_ts_metadata8("design:type", Function),
|
|
2476
2566
|
_ts_metadata8("design:paramtypes", [
|
|
2477
2567
|
Object,
|
|
@@ -2505,16 +2595,16 @@ var DurableApiSessionGuard = class {
|
|
|
2505
2595
|
* 401; `DurableUiSessionGuard`'s redirect/session-required exceptions above don't reach it.
|
|
2506
2596
|
*/
|
|
2507
2597
|
unauthorized(auth) {
|
|
2508
|
-
return new
|
|
2598
|
+
return new import_common10.UnauthorizedException({
|
|
2509
2599
|
auth: {
|
|
2510
2600
|
modes: auth.modes
|
|
2511
2601
|
}
|
|
2512
2602
|
});
|
|
2513
2603
|
}
|
|
2514
2604
|
};
|
|
2515
|
-
DurableApiSessionGuard =
|
|
2516
|
-
(0,
|
|
2517
|
-
_ts_param6(0, (0,
|
|
2605
|
+
DurableApiSessionGuard = _ts_decorate10([
|
|
2606
|
+
(0, import_common10.Injectable)(),
|
|
2607
|
+
_ts_param6(0, (0, import_common10.Inject)(DASHBOARD_AUTH)),
|
|
2518
2608
|
_ts_metadata8("design:type", Function),
|
|
2519
2609
|
_ts_metadata8("design:paramtypes", [
|
|
2520
2610
|
Object
|
|
@@ -2522,7 +2612,7 @@ DurableApiSessionGuard = _ts_decorate9([
|
|
|
2522
2612
|
], DurableApiSessionGuard);
|
|
2523
2613
|
|
|
2524
2614
|
// src/server/durable-dashboard.module.ts
|
|
2525
|
-
function
|
|
2615
|
+
function _ts_decorate11(decorators, target, key, desc) {
|
|
2526
2616
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2527
2617
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
2528
2618
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2535,7 +2625,7 @@ function _ts_decorate10(decorators, target, key, desc) {
|
|
|
2535
2625
|
}
|
|
2536
2626
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2537
2627
|
}
|
|
2538
|
-
__name(
|
|
2628
|
+
__name(_ts_decorate11, "_ts_decorate");
|
|
2539
2629
|
var GUARDS_METADATA = "__guards__";
|
|
2540
2630
|
function normalize(path) {
|
|
2541
2631
|
return `/${path.replace(/^\/+|\/+$/g, "")}`;
|
|
@@ -2608,8 +2698,8 @@ var DurableApiModule = class _DurableApiModule {
|
|
|
2608
2698
|
};
|
|
2609
2699
|
}
|
|
2610
2700
|
};
|
|
2611
|
-
DurableApiModule =
|
|
2612
|
-
(0,
|
|
2701
|
+
DurableApiModule = _ts_decorate11([
|
|
2702
|
+
(0, import_common11.Module)({})
|
|
2613
2703
|
], DurableApiModule);
|
|
2614
2704
|
var DurableDashboardModule = class _DurableDashboardModule {
|
|
2615
2705
|
static {
|
|
@@ -2694,8 +2784,8 @@ var DurableDashboardModule = class _DurableDashboardModule {
|
|
|
2694
2784
|
};
|
|
2695
2785
|
}
|
|
2696
2786
|
};
|
|
2697
|
-
DurableDashboardModule =
|
|
2698
|
-
(0,
|
|
2787
|
+
DurableDashboardModule = _ts_decorate11([
|
|
2788
|
+
(0, import_common11.Module)({})
|
|
2699
2789
|
], DurableDashboardModule);
|
|
2700
2790
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2701
2791
|
0 && (module.exports = {
|