@dooboostore/simple-boot-http-server 1.0.31 → 1.0.32
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/cjs/models/RequestResponse.js +15 -2
- package/dist/cjs/models/RequestResponse.js.map +2 -2
- package/dist/cjs/option/HttpServerOption.js +2 -1
- package/dist/cjs/option/HttpServerOption.js.map +2 -2
- package/dist/esm/models/RequestResponse.js +15 -2
- package/dist/esm/models/RequestResponse.js.map +2 -2
- package/dist/esm/option/HttpServerOption.js +2 -1
- package/dist/esm/option/HttpServerOption.js.map +2 -2
- package/dist/esm-bundle/dooboostore-simple-boot-http-server.esm.js +53 -22
- package/dist/esm-bundle/dooboostore-simple-boot-http-server.esm.js.map +2 -2
- package/dist/types/models/RequestResponse.d.ts.map +1 -1
- package/dist/types/option/HttpServerOption.d.ts.map +1 -1
- package/dist/umd-bundle/dooboostore-simple-boot-http-server.umd.js +53 -22
- package/dist/umd-bundle/dooboostore-simple-boot-http-server.umd.js.map +2 -2
- package/package.json +3 -3
- package/src/models/RequestResponse.ts +18 -2
- package/src/option/HttpServerOption.ts +8 -1
|
@@ -25584,26 +25584,45 @@ var SimstanceManager = class _SimstanceManager {
|
|
|
25584
25584
|
return registed.instance;
|
|
25585
25585
|
}
|
|
25586
25586
|
if (this.storage.has(targetKey) && void 0 === registed?.instance) {
|
|
25587
|
-
newInstanceCarrier.
|
|
25588
|
-
|
|
25589
|
-
|
|
25590
|
-
|
|
25591
|
-
|
|
25592
|
-
|
|
25593
|
-
|
|
25587
|
+
const resolving = newInstanceCarrier.resolving ??= [];
|
|
25588
|
+
if (resolving.includes(targetKey)) {
|
|
25589
|
+
const nameOf = (t) => typeof t === "symbol" ? t.toString() : t?.name ?? String(t);
|
|
25590
|
+
throw new Error(
|
|
25591
|
+
`Circular dependency detected: ${[...resolving.map(nameOf), nameOf(targetKey)].join(" -> ")}`
|
|
25592
|
+
);
|
|
25593
|
+
}
|
|
25594
|
+
resolving.push(targetKey);
|
|
25595
|
+
let settled = false;
|
|
25596
|
+
try {
|
|
25597
|
+
newInstanceCarrier.depth++;
|
|
25598
|
+
const newSim = this.newSim({
|
|
25599
|
+
target: registed?.type ?? targetKey,
|
|
25600
|
+
newInstanceCarrier,
|
|
25601
|
+
simCreateAfter: (data) => {
|
|
25602
|
+
if (getSim(registed?.type ?? target ?? targetKey)?.scope === Lifecycle.Singleton) {
|
|
25603
|
+
this.setStoreSet(targetKey, data, target);
|
|
25604
|
+
}
|
|
25594
25605
|
}
|
|
25595
|
-
}
|
|
25596
|
-
});
|
|
25597
|
-
newInstanceCarrier.depth--;
|
|
25598
|
-
if (newInstanceCarrier.depth === 0) {
|
|
25599
|
-
newInstanceCarrier.newInstances.forEach((it) => {
|
|
25600
|
-
this.callBindPostConstruct(it);
|
|
25601
25606
|
});
|
|
25607
|
+
newInstanceCarrier.depth--;
|
|
25608
|
+
resolving.pop();
|
|
25609
|
+
settled = true;
|
|
25610
|
+
if (newInstanceCarrier.depth === 0) {
|
|
25611
|
+
newInstanceCarrier.newInstances.forEach((it) => {
|
|
25612
|
+
this.callBindPostConstruct(it);
|
|
25613
|
+
});
|
|
25614
|
+
}
|
|
25615
|
+
if (isOnSimCreate(newSim)) {
|
|
25616
|
+
newSim.onSimCreate();
|
|
25617
|
+
}
|
|
25618
|
+
return newSim;
|
|
25619
|
+
} finally {
|
|
25620
|
+
if (!settled) {
|
|
25621
|
+
newInstanceCarrier.depth--;
|
|
25622
|
+
const idx = resolving.lastIndexOf(targetKey);
|
|
25623
|
+
if (idx !== -1) resolving.splice(idx, 1);
|
|
25624
|
+
}
|
|
25602
25625
|
}
|
|
25603
|
-
if (isOnSimCreate(newSim)) {
|
|
25604
|
-
newSim.onSimCreate();
|
|
25605
|
-
}
|
|
25606
|
-
return newSim;
|
|
25607
25626
|
}
|
|
25608
25627
|
const simNoSuch = new SimNoSuch("SimNoSuch: no simple instance(resolve) name:" + targetKey?.prototype?.constructor?.name + "," + targetKey);
|
|
25609
25628
|
console.error(simNoSuch);
|
|
@@ -28851,7 +28870,12 @@ var RequestResponse = class _RequestResponse {
|
|
|
28851
28870
|
return data;
|
|
28852
28871
|
}
|
|
28853
28872
|
async reqBodyJsonData() {
|
|
28854
|
-
|
|
28873
|
+
const raw = await this.reqBodyStringData();
|
|
28874
|
+
try {
|
|
28875
|
+
return JSON.parse(raw);
|
|
28876
|
+
} catch (e) {
|
|
28877
|
+
throw new BadRequestError({ message: `Invalid JSON body: ${e?.message ?? e}` });
|
|
28878
|
+
}
|
|
28855
28879
|
}
|
|
28856
28880
|
async reqBodyFormUrlData() {
|
|
28857
28881
|
const data = await this.reqBodyStringData();
|
|
@@ -28874,7 +28898,14 @@ var RequestResponse = class _RequestResponse {
|
|
|
28874
28898
|
}
|
|
28875
28899
|
async reqBodyReqJsonBody() {
|
|
28876
28900
|
const data = await this.reqBodyStringData();
|
|
28877
|
-
|
|
28901
|
+
if (!data) {
|
|
28902
|
+
return Object.assign(new ReqJsonBody(), {});
|
|
28903
|
+
}
|
|
28904
|
+
try {
|
|
28905
|
+
return Object.assign(new ReqJsonBody(), JSON.parse(data));
|
|
28906
|
+
} catch (e) {
|
|
28907
|
+
throw new BadRequestError({ message: `Invalid JSON body: ${e?.message ?? e}` });
|
|
28908
|
+
}
|
|
28878
28909
|
}
|
|
28879
28910
|
resBodyJsonData() {
|
|
28880
28911
|
const data = ConvertUtils2.toString(this.resBodyData());
|
|
@@ -29213,7 +29244,7 @@ var HttpServerOption = class _HttpServerOption extends SimOption {
|
|
|
29213
29244
|
);
|
|
29214
29245
|
this.globalAdvice = globalAdvice;
|
|
29215
29246
|
this.fileUploadTempPath = fileUploadTempPath;
|
|
29216
|
-
this.noSuchRouteEndPointMappingThrow = noSuchRouteEndPointMappingThrow;
|
|
29247
|
+
this.noSuchRouteEndPointMappingThrow = noSuchRouteEndPointMappingThrow ?? ((rr) => new NotFoundError({ message: `no route ${rr.reqMethod?.() ?? ""} ${rr.reqUrlPathName ?? ""}`.trim() }));
|
|
29217
29248
|
this.transactionManagerFactory = transactionManagerFactory;
|
|
29218
29249
|
}
|
|
29219
29250
|
get hostname() {
|
|
@@ -29957,12 +29988,12 @@ var ElementApply = class _ElementApply {
|
|
|
29957
29988
|
const endPrefix = `${eaPrefix}:${eaId}:end:${type}`;
|
|
29958
29989
|
let next = node.nextSibling;
|
|
29959
29990
|
while (next) {
|
|
29960
|
-
if (next.nodeType === Node.COMMENT_NODE && next.data?.trim?.()?.startsWith(endPrefix)) {
|
|
29991
|
+
if (next.nodeType === this.window.Node.COMMENT_NODE && next.data?.trim?.()?.startsWith(endPrefix)) {
|
|
29961
29992
|
return { nodeType: "comment", type, start: node, end: next, script: script ?? "", variables: this.findVariables(script) };
|
|
29962
29993
|
}
|
|
29963
29994
|
next = next.nextSibling;
|
|
29964
29995
|
}
|
|
29965
|
-
} else if (node.nodeType === Node.ELEMENT_NODE) {
|
|
29996
|
+
} else if (node.nodeType === this.window.Node.ELEMENT_NODE) {
|
|
29966
29997
|
const aa = node.getAttributeNames().filter((name) => {
|
|
29967
29998
|
return name.startsWith(`ea:${id}:attribute:`) || name.startsWith(`ea:${id}:event:`) || name.startsWith(`ea:${id}:property:`);
|
|
29968
29999
|
});
|