@dudousxd/nestjs-durable-dashboard 0.49.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 +23 -1
- package/dist/client/durable-client.d.ts.map +1 -1
- package/dist/client/durable-client.js +21 -0
- package/dist/client/durable-client.js.map +1 -1
- package/dist/client/fan-pages.d.ts +8 -0
- package/dist/client/fan-pages.d.ts.map +1 -0
- package/dist/client/fan-pages.js +16 -0
- package/dist/client/fan-pages.js.map +1 -0
- package/dist/client/group-parallel-spans.d.ts +39 -4
- package/dist/client/group-parallel-spans.d.ts.map +1 -1
- package/dist/client/group-parallel-spans.js +65 -1
- package/dist/client/group-parallel-spans.js.map +1 -1
- package/dist/client/merge-live-events.d.ts +6 -1
- package/dist/client/merge-live-events.d.ts.map +1 -1
- package/dist/client/merge-live-events.js +15 -0
- package/dist/client/merge-live-events.js.map +1 -1
- package/dist/client/throttle.d.ts +11 -0
- package/dist/client/throttle.d.ts.map +1 -0
- package/dist/client/throttle.js +30 -0
- package/dist/client/throttle.js.map +1 -0
- package/dist/server/index.cjs +408 -278
- package/dist/server/index.cjs.map +1 -1
- package/dist/server/index.d.cts +24 -3
- package/dist/server/index.d.ts +24 -3
- package/dist/server/index.js +286 -156
- package/dist/server/index.js.map +1 -1
- package/dist/spa/assets/{bench-DH4bTOwJ.js → bench-UvOjwMnz.js} +1 -1
- package/dist/spa/assets/index-BbR4CZ1K.css +1 -0
- package/dist/spa/assets/index-DnQL-Xbv.js +66 -0
- package/dist/spa/assets/{index-DCWWFODc.js → index-ov2ocqi5.js} +1 -1
- package/dist/spa/assets/{preview-DeC52LPJ.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/spa/assets/index-LBQc7d3p.css +0 -1
- package/dist/spa/assets/index-xUQjm-z_.js +0 -66
package/dist/server/index.cjs
CHANGED
|
@@ -189,8 +189,12 @@ var DashboardService = class {
|
|
|
189
189
|
async workerHealth() {
|
|
190
190
|
return this.gateway.workerHealth();
|
|
191
191
|
}
|
|
192
|
-
getRunDetail(runId) {
|
|
193
|
-
return this.gateway.getRunDetail(runId);
|
|
192
|
+
getRunDetail(runId, options) {
|
|
193
|
+
return this.gateway.getRunDetail(runId, options);
|
|
194
|
+
}
|
|
195
|
+
/** A page of one fan's members, or null when the run is unknown or the gateway can't page fans. */
|
|
196
|
+
async getFanMembers(runId, group, query) {
|
|
197
|
+
return await this.gateway.getFanMembers?.(runId, group, query) ?? null;
|
|
194
198
|
}
|
|
195
199
|
/** Fix-and-replay a dead/failed run with a corrected input — a fresh linked run. Returns its id. */
|
|
196
200
|
retryWithInput(runId, input) {
|
|
@@ -285,7 +289,7 @@ DashboardService = _ts_decorate([
|
|
|
285
289
|
|
|
286
290
|
// src/server/durable-api.controller.ts
|
|
287
291
|
var import_nestjs_filter2 = require("@dudousxd/nestjs-filter");
|
|
288
|
-
var
|
|
292
|
+
var import_common5 = require("@nestjs/common");
|
|
289
293
|
|
|
290
294
|
// src/server/durable-run.ts
|
|
291
295
|
var DurableRun = class {
|
|
@@ -360,6 +364,129 @@ function runValueAxisFor(field) {
|
|
|
360
364
|
}
|
|
361
365
|
__name(runValueAxisFor, "runValueAxisFor");
|
|
362
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
|
+
|
|
363
490
|
// src/server/run-list-row.ts
|
|
364
491
|
function toRunListRow(run) {
|
|
365
492
|
const { input: _input, output: _output, error: _error, ...row } = run;
|
|
@@ -369,7 +496,7 @@ __name(toRunListRow, "toRunListRow");
|
|
|
369
496
|
|
|
370
497
|
// src/server/run.filter.ts
|
|
371
498
|
var import_nestjs_filter = require("@dudousxd/nestjs-filter");
|
|
372
|
-
var
|
|
499
|
+
var import_common4 = require("@nestjs/common");
|
|
373
500
|
|
|
374
501
|
// src/server/attr-filter.ts
|
|
375
502
|
var SCALAR_OPS = /* @__PURE__ */ new Set([
|
|
@@ -420,7 +547,7 @@ __name(parseAttrFilters, "parseAttrFilters");
|
|
|
420
547
|
|
|
421
548
|
// src/server/run-query.adapter.ts
|
|
422
549
|
var import_nestjs_durable_core2 = require("@dudousxd/nestjs-durable-core");
|
|
423
|
-
var
|
|
550
|
+
var import_common3 = require("@nestjs/common");
|
|
424
551
|
|
|
425
552
|
// src/server/run-query-draft.ts
|
|
426
553
|
var RunQueryDraft2 = class {
|
|
@@ -450,7 +577,7 @@ var RunQueryDraft2 = class {
|
|
|
450
577
|
};
|
|
451
578
|
|
|
452
579
|
// src/server/run-query.adapter.ts
|
|
453
|
-
function
|
|
580
|
+
function _ts_decorate3(decorators, target, key, desc) {
|
|
454
581
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
455
582
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
456
583
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -463,7 +590,7 @@ function _ts_decorate2(decorators, target, key, desc) {
|
|
|
463
590
|
}
|
|
464
591
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
465
592
|
}
|
|
466
|
-
__name(
|
|
593
|
+
__name(_ts_decorate3, "_ts_decorate");
|
|
467
594
|
function _ts_metadata2(metadataKey, metadataValue) {
|
|
468
595
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
469
596
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
@@ -491,7 +618,7 @@ function operands(clause) {
|
|
|
491
618
|
}
|
|
492
619
|
__name(operands, "operands");
|
|
493
620
|
function unsupported(clause, supported) {
|
|
494
|
-
throw new
|
|
621
|
+
throw new import_common3.BadRequestException(`The durable run list cannot filter \`${clause.field}\` with \`${clause.operator}\`. Supported here: ${supported}.`);
|
|
495
622
|
}
|
|
496
623
|
__name(unsupported, "unsupported");
|
|
497
624
|
var RunQueryAdapter = class {
|
|
@@ -529,7 +656,7 @@ var RunQueryAdapter = class {
|
|
|
529
656
|
const draft = this.draft(qb);
|
|
530
657
|
for (const clause of filters) {
|
|
531
658
|
if (clause.AND || clause.OR) {
|
|
532
|
-
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.");
|
|
533
660
|
}
|
|
534
661
|
this.applyClause(draft, clause);
|
|
535
662
|
}
|
|
@@ -620,7 +747,7 @@ var RunQueryAdapter = class {
|
|
|
620
747
|
applyAttributeClause(draft, clause) {
|
|
621
748
|
const key = clause.field.slice(ATTRIBUTE_FIELD.length + 1);
|
|
622
749
|
if (!key) {
|
|
623
|
-
throw new
|
|
750
|
+
throw new import_common3.BadRequestException("Filtering search attributes needs a key: `attr.<key>`, e.g. `attr.tier`.");
|
|
624
751
|
}
|
|
625
752
|
const scalarOps = {
|
|
626
753
|
equals: "eq",
|
|
@@ -664,7 +791,7 @@ var RunQueryAdapter = class {
|
|
|
664
791
|
applySort(_qb, sorts) {
|
|
665
792
|
for (const sort of sorts) {
|
|
666
793
|
if (sort.field !== FIXED_ORDER.field || sort.direction !== FIXED_ORDER.direction) {
|
|
667
|
-
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}\`.`);
|
|
668
795
|
}
|
|
669
796
|
}
|
|
670
797
|
}
|
|
@@ -705,14 +832,14 @@ var RunQueryAdapter = class {
|
|
|
705
832
|
async groupByCount(qb, field, entity, opts) {
|
|
706
833
|
this.assertDurableRun(entity);
|
|
707
834
|
if (typeof field !== "string") {
|
|
708
|
-
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.");
|
|
709
836
|
}
|
|
710
837
|
if (opts?.bucket !== void 0) {
|
|
711
|
-
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.");
|
|
712
839
|
}
|
|
713
840
|
const axis = runValueAxisFor(field);
|
|
714
841
|
if (!axis) {
|
|
715
|
-
throw new
|
|
842
|
+
throw new import_common3.BadRequestException(`The durable run list cannot enumerate values of \`${field}\`.`);
|
|
716
843
|
}
|
|
717
844
|
const rows = await this.gateway.runValueFacets(axis, this.draft(qb).facetQuery(), {
|
|
718
845
|
limit: opts?.limit ?? import_nestjs_durable_core2.RUN_VALUE_FACET_LIMIT,
|
|
@@ -743,8 +870,8 @@ var RunQueryAdapter = class {
|
|
|
743
870
|
}
|
|
744
871
|
}
|
|
745
872
|
};
|
|
746
|
-
RunQueryAdapter =
|
|
747
|
-
(0,
|
|
873
|
+
RunQueryAdapter = _ts_decorate3([
|
|
874
|
+
(0, import_common3.Injectable)(),
|
|
748
875
|
_ts_metadata2("design:type", Function),
|
|
749
876
|
_ts_metadata2("design:paramtypes", [
|
|
750
877
|
typeof import_nestjs_durable_core2.RunGateway === "undefined" ? Object : import_nestjs_durable_core2.RunGateway
|
|
@@ -752,7 +879,7 @@ RunQueryAdapter = _ts_decorate2([
|
|
|
752
879
|
], RunQueryAdapter);
|
|
753
880
|
|
|
754
881
|
// src/server/run.filter.ts
|
|
755
|
-
function
|
|
882
|
+
function _ts_decorate4(decorators, target, key, desc) {
|
|
756
883
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
757
884
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
758
885
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -765,7 +892,7 @@ function _ts_decorate3(decorators, target, key, desc) {
|
|
|
765
892
|
}
|
|
766
893
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
767
894
|
}
|
|
768
|
-
__name(
|
|
895
|
+
__name(_ts_decorate4, "_ts_decorate");
|
|
769
896
|
function _ts_metadata3(metadataKey, metadataValue) {
|
|
770
897
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
771
898
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
@@ -891,7 +1018,7 @@ var RunFilter = class extends import_nestjs_filter.BaseFilter {
|
|
|
891
1018
|
});
|
|
892
1019
|
}
|
|
893
1020
|
};
|
|
894
|
-
|
|
1021
|
+
_ts_decorate4([
|
|
895
1022
|
(0, import_nestjs_filter.FilterFor)("status"),
|
|
896
1023
|
_ts_metadata3("design:type", Function),
|
|
897
1024
|
_ts_metadata3("design:paramtypes", [
|
|
@@ -899,7 +1026,7 @@ _ts_decorate3([
|
|
|
899
1026
|
]),
|
|
900
1027
|
_ts_metadata3("design:returntype", void 0)
|
|
901
1028
|
], RunFilter.prototype, "applyStatus", null);
|
|
902
|
-
|
|
1029
|
+
_ts_decorate4([
|
|
903
1030
|
(0, import_nestjs_filter.FilterFor)("workflow"),
|
|
904
1031
|
_ts_metadata3("design:type", Function),
|
|
905
1032
|
_ts_metadata3("design:paramtypes", [
|
|
@@ -907,7 +1034,7 @@ _ts_decorate3([
|
|
|
907
1034
|
]),
|
|
908
1035
|
_ts_metadata3("design:returntype", void 0)
|
|
909
1036
|
], RunFilter.prototype, "applyWorkflow", null);
|
|
910
|
-
|
|
1037
|
+
_ts_decorate4([
|
|
911
1038
|
(0, import_nestjs_filter.FilterFor)("namespace"),
|
|
912
1039
|
_ts_metadata3("design:type", Function),
|
|
913
1040
|
_ts_metadata3("design:paramtypes", [
|
|
@@ -915,7 +1042,7 @@ _ts_decorate3([
|
|
|
915
1042
|
]),
|
|
916
1043
|
_ts_metadata3("design:returntype", void 0)
|
|
917
1044
|
], RunFilter.prototype, "applyNamespace", null);
|
|
918
|
-
|
|
1045
|
+
_ts_decorate4([
|
|
919
1046
|
(0, import_nestjs_filter.FilterFor)("tag"),
|
|
920
1047
|
_ts_metadata3("design:type", Function),
|
|
921
1048
|
_ts_metadata3("design:paramtypes", [
|
|
@@ -923,19 +1050,19 @@ _ts_decorate3([
|
|
|
923
1050
|
]),
|
|
924
1051
|
_ts_metadata3("design:returntype", void 0)
|
|
925
1052
|
], RunFilter.prototype, "applyTag", null);
|
|
926
|
-
|
|
1053
|
+
_ts_decorate4([
|
|
927
1054
|
(0, import_nestjs_filter.FilterFor)("origin"),
|
|
928
1055
|
_ts_metadata3("design:type", Function),
|
|
929
1056
|
_ts_metadata3("design:paramtypes", []),
|
|
930
1057
|
_ts_metadata3("design:returntype", void 0)
|
|
931
1058
|
], RunFilter.prototype, "applyOrigin", null);
|
|
932
|
-
|
|
1059
|
+
_ts_decorate4([
|
|
933
1060
|
(0, import_nestjs_filter.FilterFor)("unattributed"),
|
|
934
1061
|
_ts_metadata3("design:type", Function),
|
|
935
1062
|
_ts_metadata3("design:paramtypes", []),
|
|
936
1063
|
_ts_metadata3("design:returntype", void 0)
|
|
937
1064
|
], RunFilter.prototype, "applyUnattributed", null);
|
|
938
|
-
|
|
1065
|
+
_ts_decorate4([
|
|
939
1066
|
(0, import_nestjs_filter.FilterFor)("attr"),
|
|
940
1067
|
_ts_metadata3("design:type", Function),
|
|
941
1068
|
_ts_metadata3("design:paramtypes", [
|
|
@@ -943,7 +1070,7 @@ _ts_decorate3([
|
|
|
943
1070
|
]),
|
|
944
1071
|
_ts_metadata3("design:returntype", void 0)
|
|
945
1072
|
], RunFilter.prototype, "applyAttributes", null);
|
|
946
|
-
|
|
1073
|
+
_ts_decorate4([
|
|
947
1074
|
(0, import_nestjs_filter.FilterFor)("limit"),
|
|
948
1075
|
_ts_metadata3("design:type", Function),
|
|
949
1076
|
_ts_metadata3("design:paramtypes", [
|
|
@@ -951,7 +1078,7 @@ _ts_decorate3([
|
|
|
951
1078
|
]),
|
|
952
1079
|
_ts_metadata3("design:returntype", void 0)
|
|
953
1080
|
], RunFilter.prototype, "applyLimit", null);
|
|
954
|
-
|
|
1081
|
+
_ts_decorate4([
|
|
955
1082
|
(0, import_nestjs_filter.FilterFor)("offset"),
|
|
956
1083
|
_ts_metadata3("design:type", Function),
|
|
957
1084
|
_ts_metadata3("design:paramtypes", [
|
|
@@ -959,8 +1086,8 @@ _ts_decorate3([
|
|
|
959
1086
|
]),
|
|
960
1087
|
_ts_metadata3("design:returntype", void 0)
|
|
961
1088
|
], RunFilter.prototype, "applyOffset", null);
|
|
962
|
-
RunFilter =
|
|
963
|
-
(0,
|
|
1089
|
+
RunFilter = _ts_decorate4([
|
|
1090
|
+
(0, import_common4.Injectable)(),
|
|
964
1091
|
(0, import_nestjs_filter.Filterable)({
|
|
965
1092
|
entity: DurableRun,
|
|
966
1093
|
adapter: RUN_QUERY_ADAPTER,
|
|
@@ -969,7 +1096,7 @@ RunFilter = _ts_decorate3([
|
|
|
969
1096
|
], RunFilter);
|
|
970
1097
|
|
|
971
1098
|
// src/server/durable-api.controller.ts
|
|
972
|
-
function
|
|
1099
|
+
function _ts_decorate5(decorators, target, key, desc) {
|
|
973
1100
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
974
1101
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
975
1102
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -982,7 +1109,7 @@ function _ts_decorate4(decorators, target, key, desc) {
|
|
|
982
1109
|
}
|
|
983
1110
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
984
1111
|
}
|
|
985
|
-
__name(
|
|
1112
|
+
__name(_ts_decorate5, "_ts_decorate");
|
|
986
1113
|
function _ts_metadata4(metadataKey, metadataValue) {
|
|
987
1114
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
988
1115
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
@@ -995,6 +1122,7 @@ function _ts_param2(paramIndex, decorator) {
|
|
|
995
1122
|
};
|
|
996
1123
|
}
|
|
997
1124
|
__name(_ts_param2, "_ts_param");
|
|
1125
|
+
var FAN_INLINE_MAX = 50;
|
|
998
1126
|
var DurableApiController = class {
|
|
999
1127
|
static {
|
|
1000
1128
|
__name(this, "DurableApiController");
|
|
@@ -1093,10 +1221,46 @@ var DurableApiController = class {
|
|
|
1093
1221
|
topology() {
|
|
1094
1222
|
return this.dashboard.topology();
|
|
1095
1223
|
}
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1224
|
+
/**
|
|
1225
|
+
* A run's detail. Fans wider than {@link FAN_INLINE_MAX} come back as one `FanSummary` each, their
|
|
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.
|
|
1231
|
+
*/
|
|
1232
|
+
async run(id, full, ifNoneMatch, response) {
|
|
1233
|
+
const detail = await this.dashboard.getRunDetail(id, full === "true" ? void 0 : {
|
|
1234
|
+
summarizeFansOver: FAN_INLINE_MAX,
|
|
1235
|
+
...ifNoneMatch && {
|
|
1236
|
+
ifNoneMatch
|
|
1237
|
+
}
|
|
1238
|
+
});
|
|
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;
|
|
1246
|
+
}
|
|
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) {
|
|
1249
|
+
const page2 = await this.dashboard.getFanMembers(id, group, {
|
|
1250
|
+
offset: offset === void 0 ? void 0 : Number(offset),
|
|
1251
|
+
limit: limit === void 0 ? void 0 : Number(limit),
|
|
1252
|
+
failedOnly: failed === "true",
|
|
1253
|
+
...ifNoneMatch && {
|
|
1254
|
+
ifNoneMatch
|
|
1255
|
+
}
|
|
1256
|
+
});
|
|
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;
|
|
1100
1264
|
}
|
|
1101
1265
|
/** Server-Sent Events stream of a run's live lifecycle events — the dashboard tails it instead
|
|
1102
1266
|
* of polling. Cross-pod when the transport has a control plane (see DashboardService.streamRun). */
|
|
@@ -1125,18 +1289,18 @@ var DurableApiController = class {
|
|
|
1125
1289
|
const result = await this.dashboard.cancel(id, {
|
|
1126
1290
|
compensate: compensate === "true"
|
|
1127
1291
|
});
|
|
1128
|
-
if (!result) throw new
|
|
1292
|
+
if (!result) throw new import_common5.NotFoundException(`run ${id} not found`);
|
|
1129
1293
|
return result;
|
|
1130
1294
|
}
|
|
1131
1295
|
async continue(id) {
|
|
1132
1296
|
const result = await this.dashboard.continue(id);
|
|
1133
|
-
if (!result) throw new
|
|
1297
|
+
if (!result) throw new import_common5.NotFoundException(`run ${id} is not paused at a breakpoint`);
|
|
1134
1298
|
return result;
|
|
1135
1299
|
}
|
|
1136
1300
|
/** Re-dispatch a run's stuck `pending` remote steps — recovery for a lost step dispatch. */
|
|
1137
1301
|
async redispatch(id) {
|
|
1138
1302
|
const result = await this.dashboard.redispatch(id);
|
|
1139
|
-
if (!result) throw new
|
|
1303
|
+
if (!result) throw new import_common5.NotFoundException(`run ${id} not found`);
|
|
1140
1304
|
return result;
|
|
1141
1305
|
}
|
|
1142
1306
|
/**
|
|
@@ -1147,7 +1311,7 @@ var DurableApiController = class {
|
|
|
1147
1311
|
*/
|
|
1148
1312
|
async webhook(token, body) {
|
|
1149
1313
|
const result = await this.dashboard.deliverWebhook(token, body);
|
|
1150
|
-
if (!result) throw new
|
|
1314
|
+
if (!result) throw new import_common5.NotFoundException(`no run is waiting on webhook ${token}`);
|
|
1151
1315
|
return result;
|
|
1152
1316
|
}
|
|
1153
1317
|
/** Live query: the latest value a run published for `key` via `ctx.setEvent` (no side effect). */
|
|
@@ -1159,8 +1323,8 @@ var DurableApiController = class {
|
|
|
1159
1323
|
return this.dashboard.update(id, name, body);
|
|
1160
1324
|
}
|
|
1161
1325
|
};
|
|
1162
|
-
|
|
1163
|
-
(0,
|
|
1326
|
+
_ts_decorate5([
|
|
1327
|
+
(0, import_common5.Get)("runs"),
|
|
1164
1328
|
_ts_param2(0, (0, import_nestjs_filter2.ApplyFilter)(RunFilter)),
|
|
1165
1329
|
_ts_metadata4("design:type", Function),
|
|
1166
1330
|
_ts_metadata4("design:paramtypes", [
|
|
@@ -1168,8 +1332,8 @@ _ts_decorate4([
|
|
|
1168
1332
|
]),
|
|
1169
1333
|
_ts_metadata4("design:returntype", Promise)
|
|
1170
1334
|
], DurableApiController.prototype, "runs", null);
|
|
1171
|
-
|
|
1172
|
-
(0,
|
|
1335
|
+
_ts_decorate5([
|
|
1336
|
+
(0, import_common5.Get)("runs/facets"),
|
|
1173
1337
|
_ts_param2(0, (0, import_nestjs_filter2.ApplyFilter)(RunFilter)),
|
|
1174
1338
|
_ts_metadata4("design:type", Function),
|
|
1175
1339
|
_ts_metadata4("design:paramtypes", [
|
|
@@ -1177,35 +1341,35 @@ _ts_decorate4([
|
|
|
1177
1341
|
]),
|
|
1178
1342
|
_ts_metadata4("design:returntype", void 0)
|
|
1179
1343
|
], DurableApiController.prototype, "facets", null);
|
|
1180
|
-
|
|
1181
|
-
(0,
|
|
1182
|
-
_ts_param2(0, (0,
|
|
1344
|
+
_ts_decorate5([
|
|
1345
|
+
(0, import_common5.Get)("runs/values"),
|
|
1346
|
+
_ts_param2(0, (0, import_common5.Query)()),
|
|
1183
1347
|
_ts_metadata4("design:type", Function),
|
|
1184
1348
|
_ts_metadata4("design:paramtypes", [
|
|
1185
1349
|
typeof Record === "undefined" ? Object : Record
|
|
1186
1350
|
]),
|
|
1187
1351
|
_ts_metadata4("design:returntype", void 0)
|
|
1188
1352
|
], DurableApiController.prototype, "values", null);
|
|
1189
|
-
|
|
1190
|
-
(0,
|
|
1191
|
-
(0,
|
|
1353
|
+
_ts_decorate5([
|
|
1354
|
+
(0, import_common5.Get)("metrics"),
|
|
1355
|
+
(0, import_common5.Header)("Content-Type", "text/plain; version=0.0.4"),
|
|
1192
1356
|
_ts_metadata4("design:type", Function),
|
|
1193
1357
|
_ts_metadata4("design:paramtypes", []),
|
|
1194
1358
|
_ts_metadata4("design:returntype", void 0)
|
|
1195
1359
|
], DurableApiController.prototype, "metrics", null);
|
|
1196
|
-
|
|
1197
|
-
(0,
|
|
1360
|
+
_ts_decorate5([
|
|
1361
|
+
(0, import_common5.Get)("workers"),
|
|
1198
1362
|
_ts_metadata4("design:type", Function),
|
|
1199
1363
|
_ts_metadata4("design:paramtypes", []),
|
|
1200
1364
|
_ts_metadata4("design:returntype", void 0)
|
|
1201
1365
|
], DurableApiController.prototype, "workers", null);
|
|
1202
|
-
|
|
1203
|
-
(0,
|
|
1204
|
-
_ts_param2(0, (0,
|
|
1205
|
-
_ts_param2(1, (0,
|
|
1206
|
-
_ts_param2(2, (0,
|
|
1207
|
-
_ts_param2(3, (0,
|
|
1208
|
-
_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")),
|
|
1209
1373
|
_ts_metadata4("design:type", Function),
|
|
1210
1374
|
_ts_metadata4("design:paramtypes", [
|
|
1211
1375
|
String,
|
|
@@ -1216,70 +1380,101 @@ _ts_decorate4([
|
|
|
1216
1380
|
]),
|
|
1217
1381
|
_ts_metadata4("design:returntype", void 0)
|
|
1218
1382
|
], DurableApiController.prototype, "schedules", null);
|
|
1219
|
-
|
|
1220
|
-
(0,
|
|
1221
|
-
_ts_param2(0, (0,
|
|
1383
|
+
_ts_decorate5([
|
|
1384
|
+
(0, import_common5.Post)("schedules/:id/pause"),
|
|
1385
|
+
_ts_param2(0, (0, import_common5.Param)("id")),
|
|
1222
1386
|
_ts_metadata4("design:type", Function),
|
|
1223
1387
|
_ts_metadata4("design:paramtypes", [
|
|
1224
1388
|
String
|
|
1225
1389
|
]),
|
|
1226
1390
|
_ts_metadata4("design:returntype", void 0)
|
|
1227
1391
|
], DurableApiController.prototype, "pauseSchedule", null);
|
|
1228
|
-
|
|
1229
|
-
(0,
|
|
1230
|
-
_ts_param2(0, (0,
|
|
1392
|
+
_ts_decorate5([
|
|
1393
|
+
(0, import_common5.Post)("schedules/:id/resume"),
|
|
1394
|
+
_ts_param2(0, (0, import_common5.Param)("id")),
|
|
1231
1395
|
_ts_metadata4("design:type", Function),
|
|
1232
1396
|
_ts_metadata4("design:paramtypes", [
|
|
1233
1397
|
String
|
|
1234
1398
|
]),
|
|
1235
1399
|
_ts_metadata4("design:returntype", void 0)
|
|
1236
1400
|
], DurableApiController.prototype, "resumeSchedule", null);
|
|
1237
|
-
|
|
1238
|
-
(0,
|
|
1239
|
-
_ts_param2(0, (0,
|
|
1401
|
+
_ts_decorate5([
|
|
1402
|
+
(0, import_common5.Post)("schedules/:id/trigger"),
|
|
1403
|
+
_ts_param2(0, (0, import_common5.Param)("id")),
|
|
1240
1404
|
_ts_metadata4("design:type", Function),
|
|
1241
1405
|
_ts_metadata4("design:paramtypes", [
|
|
1242
1406
|
String
|
|
1243
1407
|
]),
|
|
1244
1408
|
_ts_metadata4("design:returntype", void 0)
|
|
1245
1409
|
], DurableApiController.prototype, "triggerSchedule", null);
|
|
1246
|
-
|
|
1247
|
-
(0,
|
|
1410
|
+
_ts_decorate5([
|
|
1411
|
+
(0, import_common5.Get)("topology"),
|
|
1248
1412
|
_ts_metadata4("design:type", Function),
|
|
1249
1413
|
_ts_metadata4("design:paramtypes", []),
|
|
1250
1414
|
_ts_metadata4("design:returntype", void 0)
|
|
1251
1415
|
], DurableApiController.prototype, "topology", null);
|
|
1252
|
-
|
|
1253
|
-
(0,
|
|
1254
|
-
_ts_param2(0, (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
|
+
})),
|
|
1255
1424
|
_ts_metadata4("design:type", Function),
|
|
1256
1425
|
_ts_metadata4("design:paramtypes", [
|
|
1257
|
-
String
|
|
1426
|
+
String,
|
|
1427
|
+
String,
|
|
1428
|
+
String,
|
|
1429
|
+
Object
|
|
1258
1430
|
]),
|
|
1259
1431
|
_ts_metadata4("design:returntype", Promise)
|
|
1260
1432
|
], DurableApiController.prototype, "run", null);
|
|
1261
|
-
|
|
1262
|
-
(0,
|
|
1263
|
-
_ts_param2(0, (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
|
+
})),
|
|
1444
|
+
_ts_metadata4("design:type", Function),
|
|
1445
|
+
_ts_metadata4("design:paramtypes", [
|
|
1446
|
+
String,
|
|
1447
|
+
String,
|
|
1448
|
+
String,
|
|
1449
|
+
String,
|
|
1450
|
+
String,
|
|
1451
|
+
String,
|
|
1452
|
+
Object
|
|
1453
|
+
]),
|
|
1454
|
+
_ts_metadata4("design:returntype", Promise)
|
|
1455
|
+
], DurableApiController.prototype, "fanMembers", null);
|
|
1456
|
+
_ts_decorate5([
|
|
1457
|
+
(0, import_common5.Sse)("runs/:id/stream"),
|
|
1458
|
+
_ts_param2(0, (0, import_common5.Param)("id")),
|
|
1264
1459
|
_ts_metadata4("design:type", Function),
|
|
1265
1460
|
_ts_metadata4("design:paramtypes", [
|
|
1266
1461
|
String
|
|
1267
1462
|
]),
|
|
1268
1463
|
_ts_metadata4("design:returntype", void 0)
|
|
1269
1464
|
], DurableApiController.prototype, "stream", null);
|
|
1270
|
-
|
|
1271
|
-
(0,
|
|
1272
|
-
_ts_param2(0, (0,
|
|
1465
|
+
_ts_decorate5([
|
|
1466
|
+
(0, import_common5.Post)("runs/:id/retry"),
|
|
1467
|
+
_ts_param2(0, (0, import_common5.Param)("id")),
|
|
1273
1468
|
_ts_metadata4("design:type", Function),
|
|
1274
1469
|
_ts_metadata4("design:paramtypes", [
|
|
1275
1470
|
String
|
|
1276
1471
|
]),
|
|
1277
1472
|
_ts_metadata4("design:returntype", void 0)
|
|
1278
1473
|
], DurableApiController.prototype, "retry", null);
|
|
1279
|
-
|
|
1280
|
-
(0,
|
|
1281
|
-
_ts_param2(0, (0,
|
|
1282
|
-
_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)()),
|
|
1283
1478
|
_ts_metadata4("design:type", Function),
|
|
1284
1479
|
_ts_metadata4("design:paramtypes", [
|
|
1285
1480
|
String,
|
|
@@ -1287,11 +1482,11 @@ _ts_decorate4([
|
|
|
1287
1482
|
]),
|
|
1288
1483
|
_ts_metadata4("design:returntype", void 0)
|
|
1289
1484
|
], DurableApiController.prototype, "retryWithInput", null);
|
|
1290
|
-
|
|
1291
|
-
(0,
|
|
1292
|
-
_ts_param2(0, (0,
|
|
1485
|
+
_ts_decorate5([
|
|
1486
|
+
(0, import_common5.Post)("bulk/:action"),
|
|
1487
|
+
_ts_param2(0, (0, import_common5.Param)("action")),
|
|
1293
1488
|
_ts_param2(1, (0, import_nestjs_filter2.ApplyFilter)(RunFilter)),
|
|
1294
|
-
_ts_param2(2, (0,
|
|
1489
|
+
_ts_param2(2, (0, import_common5.Query)("compensate")),
|
|
1295
1490
|
_ts_metadata4("design:type", Function),
|
|
1296
1491
|
_ts_metadata4("design:paramtypes", [
|
|
1297
1492
|
String,
|
|
@@ -1300,10 +1495,10 @@ _ts_decorate4([
|
|
|
1300
1495
|
]),
|
|
1301
1496
|
_ts_metadata4("design:returntype", void 0)
|
|
1302
1497
|
], DurableApiController.prototype, "bulk", null);
|
|
1303
|
-
|
|
1304
|
-
(0,
|
|
1305
|
-
_ts_param2(0, (0,
|
|
1306
|
-
_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")),
|
|
1307
1502
|
_ts_metadata4("design:type", Function),
|
|
1308
1503
|
_ts_metadata4("design:paramtypes", [
|
|
1309
1504
|
String,
|
|
@@ -1311,28 +1506,28 @@ _ts_decorate4([
|
|
|
1311
1506
|
]),
|
|
1312
1507
|
_ts_metadata4("design:returntype", Promise)
|
|
1313
1508
|
], DurableApiController.prototype, "cancel", null);
|
|
1314
|
-
|
|
1315
|
-
(0,
|
|
1316
|
-
_ts_param2(0, (0,
|
|
1509
|
+
_ts_decorate5([
|
|
1510
|
+
(0, import_common5.Post)("runs/:id/continue"),
|
|
1511
|
+
_ts_param2(0, (0, import_common5.Param)("id")),
|
|
1317
1512
|
_ts_metadata4("design:type", Function),
|
|
1318
1513
|
_ts_metadata4("design:paramtypes", [
|
|
1319
1514
|
String
|
|
1320
1515
|
]),
|
|
1321
1516
|
_ts_metadata4("design:returntype", Promise)
|
|
1322
1517
|
], DurableApiController.prototype, "continue", null);
|
|
1323
|
-
|
|
1324
|
-
(0,
|
|
1325
|
-
_ts_param2(0, (0,
|
|
1518
|
+
_ts_decorate5([
|
|
1519
|
+
(0, import_common5.Post)("runs/:id/redispatch"),
|
|
1520
|
+
_ts_param2(0, (0, import_common5.Param)("id")),
|
|
1326
1521
|
_ts_metadata4("design:type", Function),
|
|
1327
1522
|
_ts_metadata4("design:paramtypes", [
|
|
1328
1523
|
String
|
|
1329
1524
|
]),
|
|
1330
1525
|
_ts_metadata4("design:returntype", Promise)
|
|
1331
1526
|
], DurableApiController.prototype, "redispatch", null);
|
|
1332
|
-
|
|
1333
|
-
(0,
|
|
1334
|
-
_ts_param2(0, (0,
|
|
1335
|
-
_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)()),
|
|
1336
1531
|
_ts_metadata4("design:type", Function),
|
|
1337
1532
|
_ts_metadata4("design:paramtypes", [
|
|
1338
1533
|
String,
|
|
@@ -1340,10 +1535,10 @@ _ts_decorate4([
|
|
|
1340
1535
|
]),
|
|
1341
1536
|
_ts_metadata4("design:returntype", Promise)
|
|
1342
1537
|
], DurableApiController.prototype, "webhook", null);
|
|
1343
|
-
|
|
1344
|
-
(0,
|
|
1345
|
-
_ts_param2(0, (0,
|
|
1346
|
-
_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")),
|
|
1347
1542
|
_ts_metadata4("design:type", Function),
|
|
1348
1543
|
_ts_metadata4("design:paramtypes", [
|
|
1349
1544
|
String,
|
|
@@ -1351,11 +1546,11 @@ _ts_decorate4([
|
|
|
1351
1546
|
]),
|
|
1352
1547
|
_ts_metadata4("design:returntype", void 0)
|
|
1353
1548
|
], DurableApiController.prototype, "event", null);
|
|
1354
|
-
|
|
1355
|
-
(0,
|
|
1356
|
-
_ts_param2(0, (0,
|
|
1357
|
-
_ts_param2(1, (0,
|
|
1358
|
-
_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)()),
|
|
1359
1554
|
_ts_metadata4("design:type", Function),
|
|
1360
1555
|
_ts_metadata4("design:paramtypes", [
|
|
1361
1556
|
String,
|
|
@@ -1364,9 +1559,10 @@ _ts_decorate4([
|
|
|
1364
1559
|
]),
|
|
1365
1560
|
_ts_metadata4("design:returntype", void 0)
|
|
1366
1561
|
], DurableApiController.prototype, "update", null);
|
|
1367
|
-
DurableApiController =
|
|
1368
|
-
(0,
|
|
1369
|
-
(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),
|
|
1370
1566
|
_ts_metadata4("design:type", Function),
|
|
1371
1567
|
_ts_metadata4("design:paramtypes", [
|
|
1372
1568
|
typeof DashboardService === "undefined" ? Object : DashboardService,
|
|
@@ -1375,14 +1571,14 @@ DurableApiController = _ts_decorate4([
|
|
|
1375
1571
|
], DurableApiController);
|
|
1376
1572
|
function notFound(error) {
|
|
1377
1573
|
if (error instanceof Error && error.name === "ScheduleNotFoundError") {
|
|
1378
|
-
throw new
|
|
1574
|
+
throw new import_common5.NotFoundException(error.message);
|
|
1379
1575
|
}
|
|
1380
1576
|
throw error;
|
|
1381
1577
|
}
|
|
1382
1578
|
__name(notFound, "notFound");
|
|
1383
1579
|
|
|
1384
1580
|
// src/server/durable-auth.controller.ts
|
|
1385
|
-
var
|
|
1581
|
+
var import_common9 = require("@nestjs/common");
|
|
1386
1582
|
|
|
1387
1583
|
// src/server/auth/dashboard-auth-config.ts
|
|
1388
1584
|
var DASHBOARD_AUTH = Symbol("DASHBOARD_AUTH");
|
|
@@ -1622,14 +1818,14 @@ function renderSessionRequiredPage(basePath) {
|
|
|
1622
1818
|
__name(renderSessionRequiredPage, "renderSessionRequiredPage");
|
|
1623
1819
|
|
|
1624
1820
|
// src/server/auth/request.ts
|
|
1625
|
-
function
|
|
1821
|
+
function isRecord2(value) {
|
|
1626
1822
|
return typeof value === "object" && value !== null;
|
|
1627
1823
|
}
|
|
1628
|
-
__name(
|
|
1824
|
+
__name(isRecord2, "isRecord");
|
|
1629
1825
|
function readHeaders(request) {
|
|
1630
|
-
if (!
|
|
1826
|
+
if (!isRecord2(request)) return {};
|
|
1631
1827
|
const headers = request.headers;
|
|
1632
|
-
return
|
|
1828
|
+
return isRecord2(headers) ? headers : {};
|
|
1633
1829
|
}
|
|
1634
1830
|
__name(readHeaders, "readHeaders");
|
|
1635
1831
|
function headerToString(value) {
|
|
@@ -1645,14 +1841,14 @@ function readCookieHeader(request) {
|
|
|
1645
1841
|
}
|
|
1646
1842
|
__name(readCookieHeader, "readCookieHeader");
|
|
1647
1843
|
function isHttpsRequest(request) {
|
|
1648
|
-
if (
|
|
1844
|
+
if (isRecord2(request) && request.protocol === "https") return true;
|
|
1649
1845
|
const forwarded = headerToString(readHeaders(request)["x-forwarded-proto"]);
|
|
1650
1846
|
if (forwarded === void 0) return false;
|
|
1651
1847
|
return forwarded.split(",").map((proto) => proto.trim().toLowerCase()).includes("https");
|
|
1652
1848
|
}
|
|
1653
1849
|
__name(isHttpsRequest, "isHttpsRequest");
|
|
1654
1850
|
function originalRequestUrl(request) {
|
|
1655
|
-
if (!
|
|
1851
|
+
if (!isRecord2(request)) return "/";
|
|
1656
1852
|
if (typeof request.originalUrl === "string" && request.originalUrl !== "") {
|
|
1657
1853
|
return request.originalUrl;
|
|
1658
1854
|
}
|
|
@@ -1669,72 +1865,6 @@ function sanitizeReturnTo(candidate, fallback) {
|
|
|
1669
1865
|
}
|
|
1670
1866
|
__name(sanitizeReturnTo, "sanitizeReturnTo");
|
|
1671
1867
|
|
|
1672
|
-
// src/server/auth/response.ts
|
|
1673
|
-
function isRecord2(value) {
|
|
1674
|
-
return typeof value === "object" && value !== null;
|
|
1675
|
-
}
|
|
1676
|
-
__name(isRecord2, "isRecord");
|
|
1677
|
-
function isRawCookieResponse(value) {
|
|
1678
|
-
return isRecord2(value) && typeof value.getHeader === "function" && typeof value.setHeader === "function";
|
|
1679
|
-
}
|
|
1680
|
-
__name(isRawCookieResponse, "isRawCookieResponse");
|
|
1681
|
-
function resolveCookieResponse(response) {
|
|
1682
|
-
if (isRawCookieResponse(response)) return response;
|
|
1683
|
-
if (isRecord2(response) && isRawCookieResponse(response.raw)) return response.raw;
|
|
1684
|
-
return null;
|
|
1685
|
-
}
|
|
1686
|
-
__name(resolveCookieResponse, "resolveCookieResponse");
|
|
1687
|
-
function existingSetCookies(response) {
|
|
1688
|
-
const current = response.getHeader("set-cookie");
|
|
1689
|
-
if (Array.isArray(current)) return current;
|
|
1690
|
-
if (typeof current === "string") return [
|
|
1691
|
-
current
|
|
1692
|
-
];
|
|
1693
|
-
return [];
|
|
1694
|
-
}
|
|
1695
|
-
__name(existingSetCookies, "existingSetCookies");
|
|
1696
|
-
function appendSetCookie(response, cookie) {
|
|
1697
|
-
const raw = resolveCookieResponse(response);
|
|
1698
|
-
if (!raw) return;
|
|
1699
|
-
raw.setHeader("set-cookie", [
|
|
1700
|
-
...existingSetCookies(raw),
|
|
1701
|
-
cookie
|
|
1702
|
-
]);
|
|
1703
|
-
}
|
|
1704
|
-
__name(appendSetCookie, "appendSetCookie");
|
|
1705
|
-
function isRawRedirectResponse(value) {
|
|
1706
|
-
return isRecord2(value) && typeof value.getHeader === "function" && typeof value.setHeader === "function" && typeof value.end === "function";
|
|
1707
|
-
}
|
|
1708
|
-
__name(isRawRedirectResponse, "isRawRedirectResponse");
|
|
1709
|
-
function resolveRedirectResponse(response) {
|
|
1710
|
-
if (isRawRedirectResponse(response)) return response;
|
|
1711
|
-
if (isRecord2(response) && isRawRedirectResponse(response.raw)) return response.raw;
|
|
1712
|
-
return null;
|
|
1713
|
-
}
|
|
1714
|
-
__name(resolveRedirectResponse, "resolveRedirectResponse");
|
|
1715
|
-
function redirectRaw(response, location, status = 302) {
|
|
1716
|
-
const raw = resolveRedirectResponse(response);
|
|
1717
|
-
if (!raw) return;
|
|
1718
|
-
raw.statusCode = status;
|
|
1719
|
-
raw.setHeader("location", location);
|
|
1720
|
-
raw.end();
|
|
1721
|
-
}
|
|
1722
|
-
__name(redirectRaw, "redirectRaw");
|
|
1723
|
-
function responseAlreadyWritten(response) {
|
|
1724
|
-
const raw = resolveRedirectResponse(response);
|
|
1725
|
-
return raw?.headersSent === true;
|
|
1726
|
-
}
|
|
1727
|
-
__name(responseAlreadyWritten, "responseAlreadyWritten");
|
|
1728
|
-
function writeHtmlRaw(response, html, status = 200) {
|
|
1729
|
-
const raw = resolveRedirectResponse(response);
|
|
1730
|
-
if (!raw) return;
|
|
1731
|
-
raw.statusCode = status;
|
|
1732
|
-
raw.setHeader("content-type", "text/html; charset=utf-8");
|
|
1733
|
-
raw.setHeader("cache-control", "no-store, must-revalidate");
|
|
1734
|
-
raw.end(html);
|
|
1735
|
-
}
|
|
1736
|
-
__name(writeHtmlRaw, "writeHtmlRaw");
|
|
1737
|
-
|
|
1738
1868
|
// src/server/auth/cookie-header.ts
|
|
1739
1869
|
function parseCookieHeader(header) {
|
|
1740
1870
|
const cookies = {};
|
|
@@ -1934,11 +2064,11 @@ __name(maybeRenewSession, "maybeRenewSession");
|
|
|
1934
2064
|
var import_node_fs = require("fs");
|
|
1935
2065
|
var import_node_path = require("path");
|
|
1936
2066
|
var import_node_url = require("url");
|
|
1937
|
-
var
|
|
2067
|
+
var import_common8 = require("@nestjs/common");
|
|
1938
2068
|
|
|
1939
2069
|
// src/server/auth/login-redirect.exception.ts
|
|
1940
|
-
var
|
|
1941
|
-
function
|
|
2070
|
+
var import_common6 = require("@nestjs/common");
|
|
2071
|
+
function _ts_decorate6(decorators, target, key, desc) {
|
|
1942
2072
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1943
2073
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
1944
2074
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1951,8 +2081,8 @@ function _ts_decorate5(decorators, target, key, desc) {
|
|
|
1951
2081
|
}
|
|
1952
2082
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1953
2083
|
}
|
|
1954
|
-
__name(
|
|
1955
|
-
var DashboardLoginRedirectException = class extends
|
|
2084
|
+
__name(_ts_decorate6, "_ts_decorate");
|
|
2085
|
+
var DashboardLoginRedirectException = class extends import_common6.HttpException {
|
|
1956
2086
|
static {
|
|
1957
2087
|
__name(this, "DashboardLoginRedirectException");
|
|
1958
2088
|
}
|
|
@@ -1960,7 +2090,7 @@ var DashboardLoginRedirectException = class extends import_common5.HttpException
|
|
|
1960
2090
|
constructor(location) {
|
|
1961
2091
|
super({
|
|
1962
2092
|
location
|
|
1963
|
-
},
|
|
2093
|
+
}, import_common6.HttpStatus.FOUND), this.location = location;
|
|
1964
2094
|
}
|
|
1965
2095
|
};
|
|
1966
2096
|
var DashboardLoginRedirectFilter = class {
|
|
@@ -1972,13 +2102,13 @@ var DashboardLoginRedirectFilter = class {
|
|
|
1972
2102
|
redirectRaw(response, exception.location);
|
|
1973
2103
|
}
|
|
1974
2104
|
};
|
|
1975
|
-
DashboardLoginRedirectFilter =
|
|
1976
|
-
(0,
|
|
2105
|
+
DashboardLoginRedirectFilter = _ts_decorate6([
|
|
2106
|
+
(0, import_common6.Catch)(DashboardLoginRedirectException)
|
|
1977
2107
|
], DashboardLoginRedirectFilter);
|
|
1978
2108
|
|
|
1979
2109
|
// src/server/auth/session-required.exception.ts
|
|
1980
|
-
var
|
|
1981
|
-
function
|
|
2110
|
+
var import_common7 = require("@nestjs/common");
|
|
2111
|
+
function _ts_decorate7(decorators, target, key, desc) {
|
|
1982
2112
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
1983
2113
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
1984
2114
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -1991,7 +2121,7 @@ function _ts_decorate6(decorators, target, key, desc) {
|
|
|
1991
2121
|
}
|
|
1992
2122
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
1993
2123
|
}
|
|
1994
|
-
__name(
|
|
2124
|
+
__name(_ts_decorate7, "_ts_decorate");
|
|
1995
2125
|
function _ts_metadata5(metadataKey, metadataValue) {
|
|
1996
2126
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
1997
2127
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
@@ -2004,7 +2134,7 @@ function _ts_param3(paramIndex, decorator) {
|
|
|
2004
2134
|
};
|
|
2005
2135
|
}
|
|
2006
2136
|
__name(_ts_param3, "_ts_param");
|
|
2007
|
-
var DashboardSessionRequiredException = class extends
|
|
2137
|
+
var DashboardSessionRequiredException = class extends import_common7.HttpException {
|
|
2008
2138
|
static {
|
|
2009
2139
|
__name(this, "DashboardSessionRequiredException");
|
|
2010
2140
|
}
|
|
@@ -2012,7 +2142,7 @@ var DashboardSessionRequiredException = class extends import_common6.HttpExcepti
|
|
|
2012
2142
|
constructor(basePath) {
|
|
2013
2143
|
super({
|
|
2014
2144
|
basePath
|
|
2015
|
-
},
|
|
2145
|
+
}, import_common7.HttpStatus.UNAUTHORIZED), this.basePath = basePath;
|
|
2016
2146
|
}
|
|
2017
2147
|
};
|
|
2018
2148
|
var DashboardSessionRequiredFilter = class _DashboardSessionRequiredFilter {
|
|
@@ -2020,7 +2150,7 @@ var DashboardSessionRequiredFilter = class _DashboardSessionRequiredFilter {
|
|
|
2020
2150
|
__name(this, "DashboardSessionRequiredFilter");
|
|
2021
2151
|
}
|
|
2022
2152
|
auth;
|
|
2023
|
-
logger = new
|
|
2153
|
+
logger = new import_common7.Logger(_DashboardSessionRequiredFilter.name);
|
|
2024
2154
|
warned = false;
|
|
2025
2155
|
constructor(auth = null) {
|
|
2026
2156
|
this.auth = auth;
|
|
@@ -2043,7 +2173,7 @@ var DashboardSessionRequiredFilter = class _DashboardSessionRequiredFilter {
|
|
|
2043
2173
|
if (responseAlreadyWritten(response)) return;
|
|
2044
2174
|
}
|
|
2045
2175
|
}
|
|
2046
|
-
writeHtmlRaw(response, renderSessionRequiredPage(exception.basePath),
|
|
2176
|
+
writeHtmlRaw(response, renderSessionRequiredPage(exception.basePath), import_common7.HttpStatus.UNAUTHORIZED);
|
|
2047
2177
|
}
|
|
2048
2178
|
/** Once per process, not once per request: a broken hook fires on every denied navigation. */
|
|
2049
2179
|
warnOnce(message) {
|
|
@@ -2052,10 +2182,10 @@ var DashboardSessionRequiredFilter = class _DashboardSessionRequiredFilter {
|
|
|
2052
2182
|
this.logger.warn(message);
|
|
2053
2183
|
}
|
|
2054
2184
|
};
|
|
2055
|
-
DashboardSessionRequiredFilter =
|
|
2056
|
-
(0,
|
|
2057
|
-
_ts_param3(0, (0,
|
|
2058
|
-
_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)),
|
|
2059
2189
|
_ts_metadata5("design:type", Function),
|
|
2060
2190
|
_ts_metadata5("design:paramtypes", [
|
|
2061
2191
|
Object
|
|
@@ -2063,7 +2193,7 @@ DashboardSessionRequiredFilter = _ts_decorate6([
|
|
|
2063
2193
|
], DashboardSessionRequiredFilter);
|
|
2064
2194
|
|
|
2065
2195
|
// src/server/durable-ui.controller.ts
|
|
2066
|
-
function
|
|
2196
|
+
function _ts_decorate8(decorators, target, key, desc) {
|
|
2067
2197
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2068
2198
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
2069
2199
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2076,7 +2206,7 @@ function _ts_decorate7(decorators, target, key, desc) {
|
|
|
2076
2206
|
}
|
|
2077
2207
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2078
2208
|
}
|
|
2079
|
-
__name(
|
|
2209
|
+
__name(_ts_decorate8, "_ts_decorate");
|
|
2080
2210
|
function _ts_metadata6(metadataKey, metadataValue) {
|
|
2081
2211
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
2082
2212
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
@@ -2121,7 +2251,7 @@ var DurableUiController = class {
|
|
|
2121
2251
|
index() {
|
|
2122
2252
|
const indexPath = (0, import_node_path.join)(this.dir, "index.html");
|
|
2123
2253
|
if (!(0, import_node_fs.existsSync)(indexPath)) {
|
|
2124
|
-
throw new
|
|
2254
|
+
throw new import_common8.NotFoundException("Dashboard is not built. Run the package build.");
|
|
2125
2255
|
}
|
|
2126
2256
|
const html = (0, import_node_fs.readFileSync)(indexPath, "utf8").replaceAll(`="${BUILD_BASE}/`, `="${this.basePath}/`);
|
|
2127
2257
|
const inject = `<script>window.__DURABLE_BASE__='${this.basePath}';window.__DURABLE_API__='${this.apiBasePath}';</script>`;
|
|
@@ -2129,41 +2259,41 @@ var DurableUiController = class {
|
|
|
2129
2259
|
}
|
|
2130
2260
|
asset(file) {
|
|
2131
2261
|
const safe = (0, import_node_path.basename)(file);
|
|
2132
|
-
if (safe !== file) throw new
|
|
2262
|
+
if (safe !== file) throw new import_common8.NotFoundException();
|
|
2133
2263
|
const root = (0, import_node_path.resolve)(this.dir, "assets");
|
|
2134
2264
|
const assetPath = (0, import_node_path.resolve)(root, safe);
|
|
2135
2265
|
if (!assetPath.startsWith(root + import_node_path.sep) || !(0, import_node_fs.existsSync)(assetPath)) {
|
|
2136
|
-
throw new
|
|
2266
|
+
throw new import_common8.NotFoundException();
|
|
2137
2267
|
}
|
|
2138
2268
|
const type = CONTENT_TYPES[(0, import_node_path.extname)(safe)] ?? "application/octet-stream";
|
|
2139
|
-
return new
|
|
2269
|
+
return new import_common8.StreamableFile((0, import_node_fs.readFileSync)(assetPath), {
|
|
2140
2270
|
type
|
|
2141
2271
|
});
|
|
2142
2272
|
}
|
|
2143
2273
|
};
|
|
2144
|
-
|
|
2145
|
-
(0,
|
|
2146
|
-
(0,
|
|
2147
|
-
(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"),
|
|
2148
2278
|
_ts_metadata6("design:type", Function),
|
|
2149
2279
|
_ts_metadata6("design:paramtypes", []),
|
|
2150
2280
|
_ts_metadata6("design:returntype", String)
|
|
2151
2281
|
], DurableUiController.prototype, "index", null);
|
|
2152
|
-
|
|
2153
|
-
(0,
|
|
2154
|
-
(0,
|
|
2155
|
-
_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")),
|
|
2156
2286
|
_ts_metadata6("design:type", Function),
|
|
2157
2287
|
_ts_metadata6("design:paramtypes", [
|
|
2158
2288
|
String
|
|
2159
2289
|
]),
|
|
2160
|
-
_ts_metadata6("design:returntype", typeof
|
|
2290
|
+
_ts_metadata6("design:returntype", typeof import_common8.StreamableFile === "undefined" ? Object : import_common8.StreamableFile)
|
|
2161
2291
|
], DurableUiController.prototype, "asset", null);
|
|
2162
|
-
DurableUiController =
|
|
2163
|
-
(0,
|
|
2164
|
-
(0,
|
|
2165
|
-
_ts_param4(0, (0,
|
|
2166
|
-
_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)),
|
|
2167
2297
|
_ts_metadata6("design:type", Function),
|
|
2168
2298
|
_ts_metadata6("design:paramtypes", [
|
|
2169
2299
|
String,
|
|
@@ -2172,7 +2302,7 @@ DurableUiController = _ts_decorate7([
|
|
|
2172
2302
|
], DurableUiController);
|
|
2173
2303
|
|
|
2174
2304
|
// src/server/durable-auth.controller.ts
|
|
2175
|
-
function
|
|
2305
|
+
function _ts_decorate9(decorators, target, key, desc) {
|
|
2176
2306
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2177
2307
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
2178
2308
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2185,7 +2315,7 @@ function _ts_decorate8(decorators, target, key, desc) {
|
|
|
2185
2315
|
}
|
|
2186
2316
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2187
2317
|
}
|
|
2188
|
-
__name(
|
|
2318
|
+
__name(_ts_decorate9, "_ts_decorate");
|
|
2189
2319
|
function _ts_metadata7(metadataKey, metadataValue) {
|
|
2190
2320
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
2191
2321
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
@@ -2208,7 +2338,7 @@ var DurableAuthController = class _DurableAuthController {
|
|
|
2208
2338
|
}
|
|
2209
2339
|
auth;
|
|
2210
2340
|
basePath;
|
|
2211
|
-
logger = new
|
|
2341
|
+
logger = new import_common9.Logger(_DurableAuthController.name);
|
|
2212
2342
|
/** Warn once per hook kind so a throwing hook doesn't spam logs on every failed attempt. */
|
|
2213
2343
|
warnedHooks = /* @__PURE__ */ new Set();
|
|
2214
2344
|
constructor(auth, basePath) {
|
|
@@ -2220,7 +2350,7 @@ var DurableAuthController = class _DurableAuthController {
|
|
|
2220
2350
|
// the developer-controlled `basePath`.
|
|
2221
2351
|
loginPage() {
|
|
2222
2352
|
const auth = this.requireAuth();
|
|
2223
|
-
if (!auth.modes.includes("login")) throw new
|
|
2353
|
+
if (!auth.modes.includes("login")) throw new import_common9.NotFoundException();
|
|
2224
2354
|
return renderLoginPage(this.basePath);
|
|
2225
2355
|
}
|
|
2226
2356
|
// Called by the login page's own fetch (JSON, not a classic form POST — see `login-page.ts` for
|
|
@@ -2229,13 +2359,13 @@ var DurableAuthController = class _DurableAuthController {
|
|
|
2229
2359
|
// (unknown user, wrong password, throwing hook) — no user-enumeration.
|
|
2230
2360
|
async login(body, request, response) {
|
|
2231
2361
|
const auth = this.requireAuth();
|
|
2232
|
-
if (!auth.modes.includes("login")) throw new
|
|
2362
|
+
if (!auth.modes.includes("login")) throw new import_common9.NotFoundException();
|
|
2233
2363
|
if (!isString(body?.username) || !isString(body?.password)) {
|
|
2234
|
-
throw new
|
|
2364
|
+
throw new import_common9.BadRequestException("Body must include string `username` and `password`.");
|
|
2235
2365
|
}
|
|
2236
2366
|
const { username, password } = body;
|
|
2237
2367
|
const user = await this.runHook("login", () => auth.login?.(username, password) ?? null);
|
|
2238
|
-
if (!user) throw new
|
|
2368
|
+
if (!user) throw new import_common9.UnauthorizedException({
|
|
2239
2369
|
message: "Invalid username or password."
|
|
2240
2370
|
});
|
|
2241
2371
|
issueSessionCookie(user, {
|
|
@@ -2252,9 +2382,9 @@ var DurableAuthController = class _DurableAuthController {
|
|
|
2252
2382
|
// guard decides, and no credential ever reaches this library.
|
|
2253
2383
|
async session(request, response) {
|
|
2254
2384
|
const auth = this.requireAuth();
|
|
2255
|
-
if (!auth.modes.includes("session")) throw new
|
|
2385
|
+
if (!auth.modes.includes("session")) throw new import_common9.NotFoundException();
|
|
2256
2386
|
const user = await this.runHook("session", () => auth.session?.(request) ?? null);
|
|
2257
|
-
if (!user) throw new
|
|
2387
|
+
if (!user) throw new import_common9.UnauthorizedException();
|
|
2258
2388
|
issueSessionCookie(user, {
|
|
2259
2389
|
auth,
|
|
2260
2390
|
request,
|
|
@@ -2273,7 +2403,7 @@ var DurableAuthController = class _DurableAuthController {
|
|
|
2273
2403
|
redirectRaw(response, this.auth?.modes.includes("login") ? `${this.basePath}/login` : this.basePath);
|
|
2274
2404
|
}
|
|
2275
2405
|
requireAuth() {
|
|
2276
|
-
if (!this.auth) throw new
|
|
2406
|
+
if (!this.auth) throw new import_common9.NotFoundException();
|
|
2277
2407
|
return this.auth;
|
|
2278
2408
|
}
|
|
2279
2409
|
/**
|
|
@@ -2293,20 +2423,20 @@ var DurableAuthController = class _DurableAuthController {
|
|
|
2293
2423
|
}
|
|
2294
2424
|
}
|
|
2295
2425
|
};
|
|
2296
|
-
|
|
2297
|
-
(0,
|
|
2298
|
-
(0,
|
|
2299
|
-
(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"),
|
|
2300
2430
|
_ts_metadata7("design:type", Function),
|
|
2301
2431
|
_ts_metadata7("design:paramtypes", []),
|
|
2302
2432
|
_ts_metadata7("design:returntype", String)
|
|
2303
2433
|
], DurableAuthController.prototype, "loginPage", null);
|
|
2304
|
-
|
|
2305
|
-
(0,
|
|
2306
|
-
(0,
|
|
2307
|
-
_ts_param5(0, (0,
|
|
2308
|
-
_ts_param5(1, (0,
|
|
2309
|
-
_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)({
|
|
2310
2440
|
passthrough: true
|
|
2311
2441
|
})),
|
|
2312
2442
|
_ts_metadata7("design:type", Function),
|
|
@@ -2317,11 +2447,11 @@ _ts_decorate8([
|
|
|
2317
2447
|
]),
|
|
2318
2448
|
_ts_metadata7("design:returntype", Promise)
|
|
2319
2449
|
], DurableAuthController.prototype, "login", null);
|
|
2320
|
-
|
|
2321
|
-
(0,
|
|
2322
|
-
(0,
|
|
2323
|
-
_ts_param5(0, (0,
|
|
2324
|
-
_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)({
|
|
2325
2455
|
passthrough: true
|
|
2326
2456
|
})),
|
|
2327
2457
|
_ts_metadata7("design:type", Function),
|
|
@@ -2331,10 +2461,10 @@ _ts_decorate8([
|
|
|
2331
2461
|
]),
|
|
2332
2462
|
_ts_metadata7("design:returntype", Promise)
|
|
2333
2463
|
], DurableAuthController.prototype, "session", null);
|
|
2334
|
-
|
|
2335
|
-
(0,
|
|
2336
|
-
_ts_param5(0, (0,
|
|
2337
|
-
_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)()),
|
|
2338
2468
|
_ts_metadata7("design:type", Function),
|
|
2339
2469
|
_ts_metadata7("design:paramtypes", [
|
|
2340
2470
|
Object,
|
|
@@ -2342,11 +2472,11 @@ _ts_decorate8([
|
|
|
2342
2472
|
]),
|
|
2343
2473
|
_ts_metadata7("design:returntype", void 0)
|
|
2344
2474
|
], DurableAuthController.prototype, "logout", null);
|
|
2345
|
-
DurableAuthController =
|
|
2346
|
-
(0,
|
|
2347
|
-
_ts_param5(0, (0,
|
|
2348
|
-
_ts_param5(0, (0,
|
|
2349
|
-
_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)),
|
|
2350
2480
|
_ts_metadata7("design:type", Function),
|
|
2351
2481
|
_ts_metadata7("design:paramtypes", [
|
|
2352
2482
|
Object,
|
|
@@ -2357,12 +2487,12 @@ DurableAuthController = _ts_decorate8([
|
|
|
2357
2487
|
// src/server/durable-dashboard.module.ts
|
|
2358
2488
|
var import_reflect_metadata = require("reflect-metadata");
|
|
2359
2489
|
var import_nestjs_filter3 = require("@dudousxd/nestjs-filter");
|
|
2360
|
-
var
|
|
2490
|
+
var import_common11 = require("@nestjs/common");
|
|
2361
2491
|
var import_core = require("@nestjs/core");
|
|
2362
2492
|
|
|
2363
2493
|
// src/server/durable-session.guard.ts
|
|
2364
|
-
var
|
|
2365
|
-
function
|
|
2494
|
+
var import_common10 = require("@nestjs/common");
|
|
2495
|
+
function _ts_decorate10(decorators, target, key, desc) {
|
|
2366
2496
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2367
2497
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
2368
2498
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2375,7 +2505,7 @@ function _ts_decorate9(decorators, target, key, desc) {
|
|
|
2375
2505
|
}
|
|
2376
2506
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2377
2507
|
}
|
|
2378
|
-
__name(
|
|
2508
|
+
__name(_ts_decorate10, "_ts_decorate");
|
|
2379
2509
|
function _ts_metadata8(metadataKey, metadataValue) {
|
|
2380
2510
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
2381
2511
|
return Reflect.metadata(metadataKey, metadataValue);
|
|
@@ -2428,10 +2558,10 @@ var DurableUiSessionGuard = class {
|
|
|
2428
2558
|
throw new DashboardLoginRedirectException(`${this.basePath}/login?returnTo=${returnTo}`);
|
|
2429
2559
|
}
|
|
2430
2560
|
};
|
|
2431
|
-
DurableUiSessionGuard =
|
|
2432
|
-
(0,
|
|
2433
|
-
_ts_param6(0, (0,
|
|
2434
|
-
_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)),
|
|
2435
2565
|
_ts_metadata8("design:type", Function),
|
|
2436
2566
|
_ts_metadata8("design:paramtypes", [
|
|
2437
2567
|
Object,
|
|
@@ -2465,16 +2595,16 @@ var DurableApiSessionGuard = class {
|
|
|
2465
2595
|
* 401; `DurableUiSessionGuard`'s redirect/session-required exceptions above don't reach it.
|
|
2466
2596
|
*/
|
|
2467
2597
|
unauthorized(auth) {
|
|
2468
|
-
return new
|
|
2598
|
+
return new import_common10.UnauthorizedException({
|
|
2469
2599
|
auth: {
|
|
2470
2600
|
modes: auth.modes
|
|
2471
2601
|
}
|
|
2472
2602
|
});
|
|
2473
2603
|
}
|
|
2474
2604
|
};
|
|
2475
|
-
DurableApiSessionGuard =
|
|
2476
|
-
(0,
|
|
2477
|
-
_ts_param6(0, (0,
|
|
2605
|
+
DurableApiSessionGuard = _ts_decorate10([
|
|
2606
|
+
(0, import_common10.Injectable)(),
|
|
2607
|
+
_ts_param6(0, (0, import_common10.Inject)(DASHBOARD_AUTH)),
|
|
2478
2608
|
_ts_metadata8("design:type", Function),
|
|
2479
2609
|
_ts_metadata8("design:paramtypes", [
|
|
2480
2610
|
Object
|
|
@@ -2482,7 +2612,7 @@ DurableApiSessionGuard = _ts_decorate9([
|
|
|
2482
2612
|
], DurableApiSessionGuard);
|
|
2483
2613
|
|
|
2484
2614
|
// src/server/durable-dashboard.module.ts
|
|
2485
|
-
function
|
|
2615
|
+
function _ts_decorate11(decorators, target, key, desc) {
|
|
2486
2616
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
2487
2617
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
2488
2618
|
r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -2495,7 +2625,7 @@ function _ts_decorate10(decorators, target, key, desc) {
|
|
|
2495
2625
|
}
|
|
2496
2626
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
2497
2627
|
}
|
|
2498
|
-
__name(
|
|
2628
|
+
__name(_ts_decorate11, "_ts_decorate");
|
|
2499
2629
|
var GUARDS_METADATA = "__guards__";
|
|
2500
2630
|
function normalize(path) {
|
|
2501
2631
|
return `/${path.replace(/^\/+|\/+$/g, "")}`;
|
|
@@ -2568,8 +2698,8 @@ var DurableApiModule = class _DurableApiModule {
|
|
|
2568
2698
|
};
|
|
2569
2699
|
}
|
|
2570
2700
|
};
|
|
2571
|
-
DurableApiModule =
|
|
2572
|
-
(0,
|
|
2701
|
+
DurableApiModule = _ts_decorate11([
|
|
2702
|
+
(0, import_common11.Module)({})
|
|
2573
2703
|
], DurableApiModule);
|
|
2574
2704
|
var DurableDashboardModule = class _DurableDashboardModule {
|
|
2575
2705
|
static {
|
|
@@ -2654,8 +2784,8 @@ var DurableDashboardModule = class _DurableDashboardModule {
|
|
|
2654
2784
|
};
|
|
2655
2785
|
}
|
|
2656
2786
|
};
|
|
2657
|
-
DurableDashboardModule =
|
|
2658
|
-
(0,
|
|
2787
|
+
DurableDashboardModule = _ts_decorate11([
|
|
2788
|
+
(0, import_common11.Module)({})
|
|
2659
2789
|
], DurableDashboardModule);
|
|
2660
2790
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2661
2791
|
0 && (module.exports = {
|