@dudousxd/nestjs-durable 0.28.0 → 0.30.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/index.cjs +42 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -1
- package/dist/index.d.ts +8 -1
- package/dist/index.js +42 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -489,12 +489,21 @@ function tenantGatewayUnavailable(method) {
|
|
|
489
489
|
__name(tenantGatewayUnavailable, "tenantGatewayUnavailable");
|
|
490
490
|
function unavailableRunGateway() {
|
|
491
491
|
return {
|
|
492
|
+
// Topology is local metadata, always answerable — a thin worker with no transport is still a tenant.
|
|
493
|
+
topology() {
|
|
494
|
+
return {
|
|
495
|
+
role: "tenant"
|
|
496
|
+
};
|
|
497
|
+
},
|
|
492
498
|
getRunDetail(_runId) {
|
|
493
499
|
return tenantGatewayUnavailable("getRunDetail");
|
|
494
500
|
},
|
|
495
501
|
listRuns(_query) {
|
|
496
502
|
return tenantGatewayUnavailable("listRuns");
|
|
497
503
|
},
|
|
504
|
+
workerHealth() {
|
|
505
|
+
return tenantGatewayUnavailable("workerHealth");
|
|
506
|
+
},
|
|
498
507
|
cancel(_runId) {
|
|
499
508
|
return tenantGatewayUnavailable("cancel");
|
|
500
509
|
},
|
|
@@ -880,6 +889,12 @@ var ProxyRunGateway = class {
|
|
|
880
889
|
});
|
|
881
890
|
});
|
|
882
891
|
}
|
|
892
|
+
topology() {
|
|
893
|
+
return {
|
|
894
|
+
role: "tenant",
|
|
895
|
+
tenant: this.tenant
|
|
896
|
+
};
|
|
897
|
+
}
|
|
883
898
|
getRunDetail(runId) {
|
|
884
899
|
return this.request({
|
|
885
900
|
kind: "getRunDetail",
|
|
@@ -892,6 +907,12 @@ var ProxyRunGateway = class {
|
|
|
892
907
|
query
|
|
893
908
|
});
|
|
894
909
|
}
|
|
910
|
+
/** Round-trips to the operator, which scopes the result to this tenant's own `@<tenant>` groups. */
|
|
911
|
+
workerHealth() {
|
|
912
|
+
return this.request({
|
|
913
|
+
kind: "workerHealth"
|
|
914
|
+
});
|
|
915
|
+
}
|
|
895
916
|
cancel(runId, opts) {
|
|
896
917
|
return this.request(opts === void 0 ? {
|
|
897
918
|
kind: "cancel",
|
|
@@ -1088,6 +1109,17 @@ var RunRequestResponder = class {
|
|
|
1088
1109
|
}
|
|
1089
1110
|
};
|
|
1090
1111
|
}
|
|
1112
|
+
if (body.kind === "workerHealth") {
|
|
1113
|
+
const all = await this.gateway.workerHealth();
|
|
1114
|
+
const data = all.filter((h) => h.group.endsWith(`@${msg.tenant}`));
|
|
1115
|
+
return {
|
|
1116
|
+
requestId: msg.requestId,
|
|
1117
|
+
result: {
|
|
1118
|
+
ok: true,
|
|
1119
|
+
data
|
|
1120
|
+
}
|
|
1121
|
+
};
|
|
1122
|
+
}
|
|
1091
1123
|
const detail = await this.gateway.getRunDetail(body.runId);
|
|
1092
1124
|
if (detail && detail.run.namespace !== msg.tenant) {
|
|
1093
1125
|
return {
|
|
@@ -1175,6 +1207,11 @@ var StoreRunGateway = class {
|
|
|
1175
1207
|
this.store = store;
|
|
1176
1208
|
this.engine = engine;
|
|
1177
1209
|
}
|
|
1210
|
+
topology() {
|
|
1211
|
+
return {
|
|
1212
|
+
role: "control-plane"
|
|
1213
|
+
};
|
|
1214
|
+
}
|
|
1178
1215
|
async getRunDetail(runId) {
|
|
1179
1216
|
const run = await this.store.getRun(runId);
|
|
1180
1217
|
if (!run) return null;
|
|
@@ -1191,6 +1228,11 @@ var StoreRunGateway = class {
|
|
|
1191
1228
|
listRuns(query) {
|
|
1192
1229
|
return this.store.listRuns(query);
|
|
1193
1230
|
}
|
|
1231
|
+
/** Every group the engine knows about — unscoped. A tenant proxy's request is scoped by the
|
|
1232
|
+
* `RunRequestResponder` (to the requester's `@<tenant>` groups); the operator's own UI sees all. */
|
|
1233
|
+
workerHealth() {
|
|
1234
|
+
return this.engine.workerHealth();
|
|
1235
|
+
}
|
|
1194
1236
|
cancel(runId, opts) {
|
|
1195
1237
|
return this.engine.cancel(runId, opts);
|
|
1196
1238
|
}
|