@_tc/template-core 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.skills/tc-component-usage-skills/reference/component-api.md +27 -0
- package/.skills/tc-generator/SKILL.md +1 -1
- package/.skills/tc-generator/reference/project-template/ssr/apps/hello/hello.entry.tsx +6 -1
- package/.skills/tc-generator/reference/runtime-extensions.md +10 -0
- package/AGENT_README.md +8 -2
- package/CHANGE.md +27 -0
- package/README.md +157 -8
- package/cjs/app/ai/agent/agent-scanner.service.js +1 -1
- package/cjs/app/ai/agent/agent.module.js +1 -1
- package/cjs/app/ai/ai-config.module.js +1 -1
- package/cjs/app/ai/ai-config.service.js +1 -1
- package/cjs/app/ai/ai.controller.js +1 -1
- package/cjs/app/ai/ai.module.js +1 -1
- package/cjs/app/ai/guardrail/guardrail.module.js +1 -1
- package/cjs/app/ai/guardrail/guardrail.service.js +1 -1
- package/cjs/app/ai/index.js +1 -0
- package/cjs/app/ai/mcp/internal/read-sse-response.js +2 -0
- package/cjs/app/ai/mcp/internal/stdio-process.js +1 -0
- package/cjs/app/ai/mcp/mcp-registry.service.js +2 -2
- package/cjs/app/ai/mcp/mcp.client.js +2 -3
- package/cjs/app/ai/mcp/mcp.loader.js +1 -1
- package/cjs/app/ai/mcp/mcp.module.js +1 -1
- package/cjs/app/ai/memory/checkpoint.service.js +1 -1
- package/cjs/app/ai/memory/memory.module.js +1 -1
- package/cjs/app/ai/memory/thread.service.js +1 -1
- package/cjs/app/ai/models/chat-sse.js +4 -0
- package/cjs/app/ai/models/chat.js +1 -0
- package/cjs/app/ai/models/http.js +1 -0
- package/cjs/app/ai/models/image.js +1 -0
- package/cjs/app/ai/models/video.js +1 -0
- package/cjs/app/ai/nest-service-provider.js +1 -0
- package/cjs/app/ai/rag/rag.module.js +1 -1
- package/cjs/app/ai/rag/retriever.service.js +1 -1
- package/cjs/app/ai/retention/conversation-retention.service.js +1 -1
- package/cjs/app/ai/runtime/ai-runtime-startup.validator.js +1 -1
- package/cjs/app/ai/runtime/ai-runtime.js +1 -0
- package/cjs/app/ai/runtime/internal/context-compaction.service.js +3 -3
- package/cjs/app/ai/runtime/internal/declaration-snapshot.js +1 -0
- package/cjs/app/ai/runtime/internal/owned-runtime-resources.js +1 -0
- package/cjs/app/ai/runtime/langchain/langchain-planner.service.js +1 -1
- package/cjs/app/ai/runtime/langgraph/langgraph-orchestrator.service.js +1 -1
- package/cjs/app/ai/runtime/runtime.module.js +1 -1
- package/cjs/app/ai/skill/skill-scanner.service.js +1 -1
- package/cjs/app/ai/skill/skill.module.js +1 -1
- package/cjs/app/ai/snapshot-data.js +1 -0
- package/cjs/app/ai/store/internal/create-vector-store.js +1 -0
- package/cjs/app/ai/store/store.module.js +1 -1
- package/cjs/app/ai/tool/builtin/index.js +1 -1
- package/cjs/app/ai/tool/builtin/invoke-agent.tool.js +1 -1
- package/cjs/app/ai/tool/builtin/retrieve.tool.js +1 -1
- package/cjs/app/ai/tool/executor.service.js +1 -1
- package/cjs/app/ai/tool/tool-registry.service.js +1 -1
- package/cjs/app/ai/tool/tool.module.js +1 -1
- package/cjs/app/ai/trace/trace.service.js +1 -1
- package/cjs/app/csr/controller.js +1 -1
- package/cjs/app/csr/types.js +0 -0
- package/cjs/app/html/browser-options.js +1 -1
- package/cjs/app/html/shell.js +31 -16
- package/cjs/app/http/api-signing.js +1 -0
- package/cjs/app/http/body-parser.middleware.js +1 -1
- package/cjs/app/http/csp-nonce.js +1 -0
- package/cjs/app/http/error-response.js +1 -1
- package/cjs/app/http/exception-filter.js +1 -1
- package/cjs/app/http/request-body-parser-policy.js +1 -0
- package/cjs/app/http/security.guard.js +1 -1
- package/cjs/app/project/controller.js +1 -1
- package/cjs/app/project/service.js +1 -1
- package/cjs/app/providers/foundation.js +1 -1
- package/cjs/app/ssr/artifacts.js +1 -1
- package/cjs/app/ssr/controller.js +1 -1
- package/cjs/app/ssr/html.js +17 -17
- package/cjs/app/ssr/stream.js +1 -1
- package/cjs/app/static-assets.middleware.js +1 -1
- package/cjs/app/template-core.module.js +1 -1
- package/cjs/app/view/entry.tpl +2 -2
- package/cjs/bundler/buildSSR.js +1 -1
- package/cjs/bundler/entryCollect.js +1 -1
- package/cjs/bundler/feSharedConfig.js +1 -1
- package/cjs/bundler/utils.js +3 -3
- package/cjs/config/config.default.js +1 -1
- package/cjs/packages/common/index.js +1 -1
- package/cjs/packages/core/bootstrap.js +1 -1
- package/cjs/packages/core/startup.js +1 -1
- package/esm/app/ai/agent/agent-scanner.service.js +33 -36
- package/esm/app/ai/agent/agent.module.js +9 -7
- package/esm/app/ai/ai-config.module.js +14 -7
- package/esm/app/ai/ai-config.service.js +24 -20
- package/esm/app/ai/ai.controller.js +41 -41
- package/esm/app/ai/ai.module.js +15 -15
- package/esm/app/ai/guardrail/guardrail.module.js +11 -9
- package/esm/app/ai/guardrail/guardrail.service.js +5 -10
- package/esm/app/ai/index.js +2 -0
- package/esm/app/ai/mcp/internal/read-sse-response.js +35 -0
- package/esm/app/ai/mcp/internal/stdio-process.js +59 -0
- package/esm/app/ai/mcp/mcp-registry.service.js +10 -15
- package/esm/app/ai/mcp/mcp.client.js +77 -78
- package/esm/app/ai/mcp/mcp.loader.js +64 -42
- package/esm/app/ai/mcp/mcp.module.js +62 -22
- package/esm/app/ai/memory/checkpoint.service.js +18 -28
- package/esm/app/ai/memory/memory.module.js +15 -12
- package/esm/app/ai/memory/thread.service.js +21 -26
- package/esm/app/ai/models/chat-sse.js +44 -0
- package/esm/app/ai/models/chat.js +60 -0
- package/esm/app/ai/models/http.js +52 -0
- package/esm/app/ai/models/image.js +37 -0
- package/esm/app/ai/models/video.js +32 -0
- package/esm/app/ai/nest-service-provider.js +10 -0
- package/esm/app/ai/rag/rag.module.js +24 -15
- package/esm/app/ai/rag/retriever.service.js +37 -54
- package/esm/app/ai/retention/conversation-retention.service.js +16 -34
- package/esm/app/ai/runtime/ai-runtime-startup.validator.js +2 -19
- package/esm/app/ai/runtime/ai-runtime.js +104 -0
- package/esm/app/ai/runtime/internal/context-compaction.service.js +139 -145
- package/esm/app/ai/runtime/internal/declaration-snapshot.js +32 -0
- package/esm/app/ai/runtime/internal/owned-runtime-resources.js +21 -0
- package/esm/app/ai/runtime/langchain/langchain-planner.service.js +43 -49
- package/esm/app/ai/runtime/langgraph/langgraph-orchestrator.service.js +273 -225
- package/esm/app/ai/runtime/runtime.module.js +56 -35
- package/esm/app/ai/skill/skill-scanner.service.js +11 -16
- package/esm/app/ai/skill/skill.module.js +11 -9
- package/esm/app/ai/snapshot-data.js +24 -0
- package/esm/app/ai/store/internal/create-vector-store.js +10 -0
- package/esm/app/ai/store/store.module.js +9 -13
- package/esm/app/ai/tool/builtin/index.js +16 -4
- package/esm/app/ai/tool/builtin/invoke-agent.tool.js +30 -34
- package/esm/app/ai/tool/builtin/retrieve.tool.js +9 -13
- package/esm/app/ai/tool/executor.service.js +22 -29
- package/esm/app/ai/tool/tool-registry.service.js +6 -16
- package/esm/app/ai/tool/tool.module.js +26 -12
- package/esm/app/ai/trace/trace.service.js +15 -28
- package/esm/app/csr/controller.js +114 -63
- package/esm/app/csr/types.js +0 -0
- package/esm/app/html/browser-options.js +2 -2
- package/esm/app/html/shell.js +173 -32
- package/esm/app/http/api-signing.js +13 -0
- package/esm/app/http/body-parser.middleware.js +47 -27
- package/esm/app/http/csp-nonce.js +13 -0
- package/esm/app/http/error-response.js +8 -5
- package/esm/app/http/exception-filter.js +4 -4
- package/esm/app/http/request-body-parser-policy.js +46 -0
- package/esm/app/http/security.guard.js +23 -21
- package/esm/app/project/controller.js +15 -15
- package/esm/app/project/service.js +3 -3
- package/esm/app/providers/foundation.js +5 -5
- package/esm/app/ssr/artifacts.js +25 -21
- package/esm/app/ssr/controller.js +148 -75
- package/esm/app/ssr/html.js +49 -44
- package/esm/app/ssr/stream.js +25 -24
- package/esm/app/static-assets.middleware.js +4 -4
- package/esm/app/template-core.module.js +57 -52
- package/esm/app/view/entry.tpl +2 -2
- package/esm/bundler/buildSSR.js +1 -1
- package/esm/bundler/entryCollect.js +9 -9
- package/esm/bundler/feSharedConfig.js +42 -42
- package/esm/bundler/utils.js +78 -90
- package/esm/config/config.default.js +4 -3
- package/esm/packages/common/index.js +6 -6
- package/esm/packages/core/bootstrap.js +5 -5
- package/esm/packages/core/startup.js +69 -46
- package/fe/frontend/src/common/request.js +5 -2
- package/fe/frontend/src/hooks/useRouterParams.d.ts +4 -2
- package/fe/packages/common/ssr/hydration.d.ts +9 -0
- package/fe/packages/react/core/Label/Label.d.ts +1 -0
- package/fe/packages/react/core/Label/Label.js +3 -1
- package/fe/packages/react/core/internal/i18n/default.d.ts +13 -0
- package/fe/packages/react/core/internal/i18n/default.js +16 -1
- package/fe/packages/react/core/internal/i18n/en-US.d.ts +13 -0
- package/fe/packages/react/core/internal/i18n/en-US.js +16 -1
- package/fe/packages/react/forms/DataTable/index.d.ts +2 -0
- package/fe/packages/react/forms/DataTable/index.js +43 -29
- package/fe/packages/react/forms/Form/FormItem.js +39 -12
- package/fe/packages/react/forms/MultiSelect/MultiSelect.d.ts +26 -0
- package/fe/packages/react/forms/MultiSelect/MultiSelect.js +218 -0
- package/fe/packages/react/forms/MultiSelect/index.d.ts +1 -0
- package/fe/packages/react/forms/MultiSelect/index.js +2 -0
- package/fe/packages/react/forms/Pagination/Pagination.d.ts +6 -1
- package/fe/packages/react/forms/Pagination/Pagination.js +13 -4
- package/fe/packages/react/forms/Select/Select.d.ts +11 -0
- package/fe/packages/react/forms/Select/Select.js +20 -7
- package/fe/packages/react/forms/index.d.ts +1 -0
- package/fe/packages/react/forms/index.js +3 -1
- package/fe/packages/react/i18n/getUiReactLocale.d.ts +26 -0
- package/fe/packages/react/index.js +2 -1
- package/fe/packages/react/overlays/Drawer/Drawer.d.ts +3 -2
- package/fe/packages/react/overlays/Drawer/Drawer.js +16 -2
- package/fe/packages/react/overlays/Dropdown/Dropdown.d.ts +12 -2
- package/fe/packages/react/overlays/Dropdown/Dropdown.js +27 -14
- package/fe/packages/react/overlays/Modal/Modal.d.ts +11 -3
- package/fe/packages/react/overlays/Modal/Modal.js +26 -2
- package/fe/packages/react/overlays/Modal/ModalManager.d.ts +13 -12
- package/fe/packages/react/overlays/Modal/ModalManager.js +15 -5
- package/fe/packages/react/overlays/Modal/index.d.ts +1 -0
- package/fe/packages/react/overlays/Overlay/Overlay.d.ts +6 -2
- package/fe/packages/react/overlays/Overlay/Overlay.js +31 -14
- package/fe/packages/react/overlays/Overlay/focusTypes.d.ts +8 -0
- package/fe/packages/react/overlays/Overlay/focusTypes.js +0 -0
- package/fe/packages/react/overlays/Overlay/index.d.ts +1 -0
- package/fe/packages/react/overlays/Overlay/overlayStack.d.ts +16 -0
- package/fe/packages/react/overlays/Overlay/overlayStack.js +290 -0
- package/fe/packages/react/overlays/Popup/Popup.d.ts +5 -4
- package/fe/packages/react/overlays/Popup/Popup.js +28 -11
- package/fe/packages/react/ui/components/index.js +2 -1
- package/fe/packages/react/ui/index.js +2 -1
- package/fe/ssr/components/StreamingRender/StreamingCache.d.ts +1 -0
- package/fe/ssr/components/StreamingRender/StreamingCache.js +5 -1
- package/fe/ssr/components/StreamingRender/StreamingRender.js +1 -1
- package/fe/ssr/components/StreamingRender/StreamingScript.d.ts +1 -0
- package/fe/ssr/components/StreamingRender/StreamingScript.js +9 -1
- package/fe/ssr/createSSREntry.d.ts +9 -3
- package/fe/ssr/createSSREntry.js +43 -19
- package/fe/ssr/index.d.ts +4 -1
- package/fe/ssr/index.js +2 -1
- package/fe/ssr/router.d.ts +76 -0
- package/fe/ssr/router.js +349 -0
- package/fe/ssr/types.d.ts +1 -1
- package/models/packages/common/ssr/hydration.d.ts +9 -0
- package/models/packages/react/core/Label/Label.d.ts +1 -0
- package/models/packages/react/core/internal/i18n/default.d.ts +13 -0
- package/models/packages/react/core/internal/i18n/en-US.d.ts +13 -0
- package/models/packages/react/forms/DataTable/index.d.ts +2 -0
- package/models/packages/react/forms/MultiSelect/MultiSelect.d.ts +26 -0
- package/models/packages/react/forms/MultiSelect/index.d.ts +1 -0
- package/models/packages/react/forms/Pagination/Pagination.d.ts +6 -1
- package/models/packages/react/forms/Select/Select.d.ts +11 -0
- package/models/packages/react/forms/index.d.ts +1 -0
- package/models/packages/react/i18n/getUiReactLocale.d.ts +26 -0
- package/models/packages/react/overlays/Drawer/Drawer.d.ts +3 -2
- package/models/packages/react/overlays/Dropdown/Dropdown.d.ts +12 -2
- package/models/packages/react/overlays/Modal/Modal.d.ts +11 -3
- package/models/packages/react/overlays/Modal/ModalManager.d.ts +13 -12
- package/models/packages/react/overlays/Modal/index.d.ts +1 -0
- package/models/packages/react/overlays/Overlay/Overlay.d.ts +6 -2
- package/models/packages/react/overlays/Overlay/focusTypes.d.ts +8 -0
- package/models/packages/react/overlays/Overlay/index.d.ts +1 -0
- package/models/packages/react/overlays/Overlay/overlayStack.d.ts +16 -0
- package/models/packages/react/overlays/Popup/Popup.d.ts +5 -4
- package/package.json +26 -1
- package/types/app/ai/agent/agent-scanner.service.d.ts +4 -4
- package/types/app/ai/ai-config.service.d.ts +7 -3
- package/types/app/ai/guardrail/guardrail.service.d.ts +2 -2
- package/types/app/ai/index.d.ts +9 -0
- package/types/app/ai/mcp/internal/load-mcp-config.d.ts +2 -2
- package/types/app/ai/mcp/internal/read-sse-response.d.ts +2 -0
- package/types/app/ai/mcp/internal/stdio-process.d.ts +5 -0
- package/types/app/ai/mcp/mcp-registry.service.d.ts +5 -3
- package/types/app/ai/mcp/mcp.client.d.ts +7 -4
- package/types/app/ai/mcp/mcp.loader.d.ts +11 -11
- package/types/app/ai/mcp/mcp.module.d.ts +5 -5
- package/types/app/ai/memory/thread.service.d.ts +3 -3
- package/types/app/ai/models/chat-sse.d.ts +5 -0
- package/types/app/ai/models/chat.d.ts +22 -0
- package/types/app/ai/models/http.d.ts +20 -0
- package/types/app/ai/models/image.d.ts +69 -0
- package/types/app/ai/models/video.d.ts +99 -0
- package/types/app/ai/nest-service-provider.d.ts +6 -0
- package/types/app/ai/retention/conversation-retention.service.d.ts +3 -4
- package/types/app/ai/runtime/ai-runtime-startup.validator.d.ts +2 -3
- package/types/app/ai/runtime/ai-runtime.d.ts +46 -0
- package/types/app/ai/runtime/internal/agent-run-context.d.ts +4 -0
- package/types/app/ai/runtime/internal/context-compaction.service.d.ts +2 -2
- package/types/app/ai/runtime/internal/declaration-snapshot.d.ts +8 -0
- package/types/app/ai/runtime/internal/owned-runtime-resources.d.ts +5 -0
- package/types/app/ai/runtime/langchain/langchain-planner.service.d.ts +1 -1
- package/types/app/ai/runtime/langgraph/langgraph-orchestrator.service.d.ts +33 -16
- package/types/app/ai/skill/skill-scanner.service.d.ts +3 -4
- package/types/app/ai/snapshot-data.d.ts +1 -0
- package/types/app/ai/store/internal/create-vector-store.d.ts +4 -0
- package/types/app/ai/tool/builtin/index.d.ts +1 -1
- package/types/app/ai/tool/builtin/invoke-agent.tool.d.ts +10 -3
- package/types/app/ai/tool/builtin/retrieve.tool.d.ts +4 -3
- package/types/app/ai/tool/executor.service.d.ts +3 -3
- package/types/app/ai/tool/tool-registry.service.d.ts +2 -7
- package/types/app/ai/tool/tool.interface.d.ts +1 -1
- package/types/app/ai/tool/tool.module.d.ts +8 -1
- package/types/app/ai/trace/trace.service.d.ts +4 -5
- package/types/app/csr/types.d.ts +10 -0
- package/types/app/html/browser-options.d.ts +1 -1
- package/types/app/html/shell.d.ts +37 -10
- package/types/app/http/api-signing.d.ts +16 -0
- package/types/app/http/body-parser.middleware.d.ts +6 -2
- package/types/app/http/csp-nonce.d.ts +3 -0
- package/types/app/http/error-response.d.ts +1 -0
- package/types/app/http/request-body-parser-policy.d.ts +8 -0
- package/types/app/http/security.guard.d.ts +1 -0
- package/types/app/ssr/artifacts.d.ts +6 -3
- package/types/app/ssr/html.d.ts +7 -0
- package/types/app/ssr/stream.d.ts +1 -1
- package/types/app/ssr/types.d.ts +56 -0
- package/types/bundler/buildSSR.d.ts +2 -1
- package/types/bundler/index.d.ts +1 -1
- package/types/bundler/state.d.ts +13 -0
- package/types/bundler/utils.d.ts +3 -14
- package/types/config/config.default.d.ts +9 -3
- package/types/index.d.ts +4 -1
- package/types/packages/common/ssr/hydration.d.ts +13 -0
- package/types/packages/core/index.d.ts +1 -1
- package/types/packages/core/startup.d.ts +41 -0
|
@@ -1,31 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { RETENTION_SWEEP_INTERVAL_MS as n, isExpired as r, resolveRetentionDays as i } from "../retention/retention-policy.js";
|
|
4
|
-
import { Inject as a, Injectable as o, Logger as s, Optional as c } from "@nestjs/common";
|
|
5
|
-
import l from "@oxc-project/runtime/helpers/decorateMetadata";
|
|
6
|
-
import u from "@oxc-project/runtime/helpers/decorate";
|
|
7
|
-
import d from "@oxc-project/runtime/helpers/decorateParam";
|
|
8
|
-
import { randomUUID as f } from "crypto";
|
|
1
|
+
import { RETENTION_SWEEP_INTERVAL_MS as e, isExpired as t, resolveRetentionDays as n } from "../retention/retention-policy.js";
|
|
2
|
+
import { randomUUID as r } from "crypto";
|
|
9
3
|
//#region app/ai/trace/trace.service.ts
|
|
10
|
-
var
|
|
4
|
+
var i = class {
|
|
11
5
|
runs = /* @__PURE__ */ new Map();
|
|
12
|
-
logger = new s(m.name);
|
|
13
6
|
timer;
|
|
14
7
|
cleanupPromise;
|
|
15
|
-
constructor(e, t) {
|
|
16
|
-
this.store = e, this.configService = t;
|
|
8
|
+
constructor(e, t, n = console) {
|
|
9
|
+
this.store = e, this.configService = t, this.logger = n;
|
|
17
10
|
}
|
|
18
11
|
async onModuleInit() {
|
|
19
12
|
this.retentionDays() !== void 0 && (this.assertStoreCapabilities(), this.timer = setInterval(() => {
|
|
20
13
|
this.runScheduledCleanup();
|
|
21
|
-
},
|
|
14
|
+
}, e), this.timer.unref?.(), await this.runScheduledCleanup());
|
|
22
15
|
}
|
|
23
16
|
async onModuleDestroy() {
|
|
24
17
|
this.timer && clearInterval(this.timer), this.timer = void 0, await this.cleanupPromise;
|
|
25
18
|
}
|
|
26
19
|
async createRun(e, t) {
|
|
27
20
|
let n = {
|
|
28
|
-
runId:
|
|
21
|
+
runId: r(),
|
|
29
22
|
agent: e,
|
|
30
23
|
input: t,
|
|
31
24
|
output: null,
|
|
@@ -55,10 +48,10 @@ var p, m, h = m = class {
|
|
|
55
48
|
let e = this.retentionDays();
|
|
56
49
|
if (e === void 0) return 0;
|
|
57
50
|
this.assertStoreCapabilities();
|
|
58
|
-
let
|
|
59
|
-
for (let a of
|
|
60
|
-
let
|
|
61
|
-
!
|
|
51
|
+
let n = await this.store.listRunIds?.() ?? [], r = Date.now(), i = 0;
|
|
52
|
+
for (let a of n) {
|
|
53
|
+
let n = this.runs.get(a) ?? await this.store.load(a);
|
|
54
|
+
!n || !t(Date.parse(n.createdAt), e, r) || (await this.store.delete?.(a), this.runs.delete(a), i += 1);
|
|
62
55
|
}
|
|
63
56
|
return i;
|
|
64
57
|
}
|
|
@@ -68,11 +61,11 @@ var p, m, h = m = class {
|
|
|
68
61
|
return this.runs.set(e, t), t;
|
|
69
62
|
}
|
|
70
63
|
retentionDays() {
|
|
71
|
-
if (this.configService) return
|
|
64
|
+
if (this.configService) return n(this.configService, "ai.store.traceRetentionDays");
|
|
72
65
|
}
|
|
73
66
|
isRunExpired(e) {
|
|
74
|
-
let
|
|
75
|
-
return
|
|
67
|
+
let n = this.retentionDays();
|
|
68
|
+
return n !== void 0 && t(Date.parse(e.createdAt), n);
|
|
76
69
|
}
|
|
77
70
|
assertStoreCapabilities() {
|
|
78
71
|
if (typeof this.store.listRunIds != "function" || typeof this.store.delete != "function") throw Error("[ai] ai.store.traceRetentionDays requires TraceStore listRunIds and delete");
|
|
@@ -83,11 +76,5 @@ var p, m, h = m = class {
|
|
|
83
76
|
}), this.cleanupPromise;
|
|
84
77
|
}
|
|
85
78
|
};
|
|
86
|
-
h = m = u([
|
|
87
|
-
o(),
|
|
88
|
-
d(0, a(t)),
|
|
89
|
-
d(1, c()),
|
|
90
|
-
l("design:paramtypes", [Object, typeof (p = e !== void 0 && e) == "function" ? p : Object])
|
|
91
|
-
], h);
|
|
92
79
|
//#endregion
|
|
93
|
-
export {
|
|
80
|
+
export { i as TraceService };
|
|
@@ -6,27 +6,49 @@ import "../../packages/core/index.js";
|
|
|
6
6
|
import { FrontendDevelopment as c } from "../frontend-development.js";
|
|
7
7
|
import { createTemplateCoreError as l } from "../http/errors.js";
|
|
8
8
|
import { projectBrowserOptions as u } from "../html/browser-options.js";
|
|
9
|
-
import {
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import
|
|
9
|
+
import { resolveCspNonce as d } from "../http/csp-nonce.js";
|
|
10
|
+
import { resolveBrowserSignKey as f } from "../http/api-signing.js";
|
|
11
|
+
import { getRequestLanguage as p } from "../utils/i18n.js";
|
|
12
|
+
import { renderHtmlBodyAttributes as m, renderHtmlHeadContent as h, renderScriptNonceAttribute as g, resolveHtmlShellOptions as _ } from "../html/shell.js";
|
|
13
|
+
import { Controller as v, Get as y, Inject as b, Next as x, Param as S, Req as C, Res as w } from "@nestjs/common";
|
|
14
|
+
import T from "@oxc-project/runtime/helpers/decorate";
|
|
15
|
+
import E from "@oxc-project/runtime/helpers/decorateMetadata";
|
|
16
|
+
import D from "@oxc-project/runtime/helpers/decorateParam";
|
|
13
17
|
//#region app/csr/controller.ts
|
|
14
|
-
|
|
18
|
+
var O = "Accept-Language, x-tc-language, tc_language, tc-language, language, lang, locale";
|
|
19
|
+
function k(e) {
|
|
15
20
|
return (JSON.stringify(e) ?? "null").replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/&/g, "\\u0026").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
16
21
|
}
|
|
17
|
-
function
|
|
22
|
+
function A(e, t) {
|
|
18
23
|
return e === t || e.startsWith(`${t}/`);
|
|
19
24
|
}
|
|
20
|
-
function
|
|
25
|
+
function j(e) {
|
|
26
|
+
let t = e.csr;
|
|
27
|
+
if (!t || typeof t != "object" || Array.isArray(t)) return;
|
|
28
|
+
let n = t.head;
|
|
29
|
+
return typeof n == "function" ? n : void 0;
|
|
30
|
+
}
|
|
31
|
+
function M(e) {
|
|
32
|
+
if (!e || typeof e != "object" || Array.isArray(e)) return {};
|
|
33
|
+
let t = e;
|
|
34
|
+
return {
|
|
35
|
+
...typeof t.title == "string" ? { title: t.title } : {},
|
|
36
|
+
...typeof t.description == "string" ? { description: t.description } : {},
|
|
37
|
+
...Array.isArray(t.meta) ? { meta: t.meta.filter((e) => !!e && typeof e == "object" && !Array.isArray(e)) } : {},
|
|
38
|
+
...Array.isArray(t.link) ? { link: t.link.filter((e) => !!e && typeof e == "object" && !Array.isArray(e)) } : {},
|
|
39
|
+
...Array.isArray(t.jsonLd) ? { jsonLd: t.jsonLd } : {}
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function N(e, t) {
|
|
21
43
|
if (!t || e.method !== "GET" && e.method !== "HEAD") return !1;
|
|
22
44
|
let n = e.headers["if-none-match"];
|
|
23
45
|
if (!n) return !1;
|
|
24
46
|
let r = `"${t}"`;
|
|
25
47
|
return n.split(",").map((e) => e.trim().replace(/^W\//, "")).some((e) => e === "*" || e === r);
|
|
26
48
|
}
|
|
27
|
-
function
|
|
28
|
-
var
|
|
29
|
-
let
|
|
49
|
+
function P(P) {
|
|
50
|
+
var F, I, L;
|
|
51
|
+
let R = t(P) || "", z = class {
|
|
30
52
|
notFoundAttempts = /* @__PURE__ */ new Map();
|
|
31
53
|
constructor(e, t, n, r, i, a, o) {
|
|
32
54
|
this.runtime = e, this.development = t, this.config = n, this.renderer = r, this.etagCache = i, this.crypto = a, this.logger = o;
|
|
@@ -38,30 +60,50 @@ function w(w) {
|
|
|
38
60
|
await this.render(t, n, r, e);
|
|
39
61
|
}
|
|
40
62
|
async render(e, t, n, r) {
|
|
41
|
-
if (
|
|
63
|
+
if (A(e.path, this.runtime.options.apiPrefix)) {
|
|
42
64
|
delete e.route, n();
|
|
43
65
|
return;
|
|
44
66
|
}
|
|
45
|
-
let i, a;
|
|
67
|
+
let i, a, o, s = !1, c;
|
|
46
68
|
this.etagCache.keepFreshFEBuildKey();
|
|
47
69
|
try {
|
|
48
|
-
let
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
70
|
+
let n = e.query.projk, l = Array.isArray(n) ? n.map(String).join(",") : n ?? "", v = R ? `${R}/${r}` : `/${r}`, y = this.runtime.options.name ?? "", b = this.runtime.environment;
|
|
71
|
+
c = _(this.runtime.options.html, this.runtime.config.html, p(e));
|
|
72
|
+
let x = j(this.runtime.config);
|
|
73
|
+
s = !!x, o = await d(e, t, this.runtime.config);
|
|
74
|
+
let S = x ? M(await x(e)) : void 0, C = {
|
|
75
|
+
projKey: l,
|
|
76
|
+
name: y,
|
|
77
|
+
env: b,
|
|
78
|
+
FEBasePage: k(R || "/"),
|
|
79
|
+
basePath: k(v),
|
|
80
|
+
projKeyJson: k(String(n ?? "")),
|
|
81
|
+
signKey: k(f({
|
|
82
|
+
signKey: this.config.get("signKey"),
|
|
83
|
+
apiSignVerify: this.config.get("apiSignVerify")
|
|
84
|
+
})),
|
|
85
|
+
options: k(u(this.runtime.options)),
|
|
86
|
+
htmlLang: c.lang,
|
|
87
|
+
htmlHeadTags: h(c, S, S?.description, o),
|
|
88
|
+
htmlTitle: S?.title ?? y,
|
|
89
|
+
htmlBodyAttributes: m(c.body),
|
|
90
|
+
htmlThemeClass: c.theme.initialClassName,
|
|
91
|
+
htmlThemeColorScheme: c.theme.initialColorScheme,
|
|
92
|
+
htmlThemeDefault: k(c.theme.default),
|
|
93
|
+
htmlThemeStorageKey: k(c.theme.storageKey),
|
|
94
|
+
htmlThemeStorageValuePath: k(c.theme.storageValuePath ?? "")
|
|
95
|
+
}, w = this.development.session, T = w ? await w.renderCSR(r, e.originalUrl) : void 0;
|
|
96
|
+
if (T === null) throw Error(`[CSR] Development entry not found: ${r}`);
|
|
97
|
+
i = this.renderer.render(`${r}.entry.tpl`, {
|
|
98
|
+
...C,
|
|
99
|
+
cspNonceAttr: g(o)
|
|
100
|
+
}, T), a = [
|
|
101
|
+
C.basePath,
|
|
102
|
+
y,
|
|
103
|
+
b,
|
|
104
|
+
l,
|
|
105
|
+
c.lang
|
|
106
|
+
].filter(Boolean).join(" "), !o && !s && !this.etagCache.hasEtag(a) && this.etagCache.setEtag(a, this.crypto.hmacSign(i));
|
|
65
107
|
} catch (n) {
|
|
66
108
|
this.logger.info(`error info -> ${n instanceof Error ? n.message : String(n)}`), this.logger.error("-- [exception] --", n);
|
|
67
109
|
let r = e.path, i = this.notFoundAttempts.get(r) ?? 0;
|
|
@@ -75,62 +117,71 @@ function w(w) {
|
|
|
75
117
|
});
|
|
76
118
|
}
|
|
77
119
|
if (this.development.session) {
|
|
78
|
-
t.status(200).setHeader("Cache-Control", "no-store"), t.type("html").send(i);
|
|
120
|
+
t.status(200).setHeader("Cache-Control", "no-store"), c?.languageIsRequestDerived && t.setHeader("Vary", O), t.type("html").send(i);
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
if (s) {
|
|
124
|
+
t.status(200).setHeader("Cache-Control", "private, no-store"), c?.languageIsRequestDerived && t.setHeader("Vary", O), t.type("html").end(i);
|
|
125
|
+
return;
|
|
126
|
+
}
|
|
127
|
+
if (o) {
|
|
128
|
+
t.status(200).setHeader("Cache-Control", "no-store"), c?.languageIsRequestDerived && t.setHeader("Vary", O), t.type("html").send(i);
|
|
79
129
|
return;
|
|
80
130
|
}
|
|
81
|
-
|
|
82
|
-
|
|
131
|
+
c?.languageIsRequestDerived && t.setHeader("Vary", O);
|
|
132
|
+
let v = this.etagCache.getEtag(a);
|
|
133
|
+
if (t.status(200), t.setHeader("ETag", v ? `"${v}"` : `"${Date.now()}"`), t.setHeader("Cache-Control", `public, max-age=${(this.config.get("resourceCacheTimeMs") ?? 300 * 1e3) / 1e3}, immutable`), N(e, v)) {
|
|
83
134
|
t.status(304).end();
|
|
84
135
|
return;
|
|
85
136
|
}
|
|
86
137
|
t.type("html").send(i);
|
|
87
138
|
}
|
|
88
139
|
};
|
|
89
|
-
return
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
140
|
+
return T([
|
|
141
|
+
y(":page"),
|
|
142
|
+
D(0, S("page")),
|
|
143
|
+
D(1, C()),
|
|
144
|
+
D(2, w()),
|
|
145
|
+
D(3, x()),
|
|
146
|
+
E("design:type", Function),
|
|
147
|
+
E("design:paramtypes", [
|
|
97
148
|
String,
|
|
98
149
|
Object,
|
|
99
150
|
Object,
|
|
100
151
|
Object
|
|
101
152
|
]),
|
|
102
|
-
|
|
103
|
-
],
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
153
|
+
E("design:returntype", Promise)
|
|
154
|
+
], z.prototype, "renderPage", null), T([
|
|
155
|
+
y(":page/{*rest}"),
|
|
156
|
+
D(0, S("page")),
|
|
157
|
+
D(1, C()),
|
|
158
|
+
D(2, w()),
|
|
159
|
+
D(3, x()),
|
|
160
|
+
E("design:type", Function),
|
|
161
|
+
E("design:paramtypes", [
|
|
111
162
|
String,
|
|
112
163
|
Object,
|
|
113
164
|
Object,
|
|
114
165
|
Object
|
|
115
166
|
]),
|
|
116
|
-
|
|
117
|
-
],
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
typeof (
|
|
126
|
-
typeof (
|
|
127
|
-
typeof (
|
|
167
|
+
E("design:returntype", Promise)
|
|
168
|
+
], z.prototype, "renderNestedPage", null), z = T([
|
|
169
|
+
v(R),
|
|
170
|
+
D(2, b(n)),
|
|
171
|
+
D(3, b(o)),
|
|
172
|
+
D(4, b(i)),
|
|
173
|
+
D(5, b(r)),
|
|
174
|
+
D(6, b(a)),
|
|
175
|
+
E("design:paramtypes", [
|
|
176
|
+
typeof (F = s !== void 0 && s) == "function" ? F : Object,
|
|
177
|
+
typeof (I = c !== void 0 && c) == "function" ? I : Object,
|
|
178
|
+
typeof (L = e !== void 0 && e) == "function" ? L : Object,
|
|
128
179
|
Object,
|
|
129
180
|
Object,
|
|
130
181
|
Object,
|
|
131
182
|
Object
|
|
132
183
|
])
|
|
133
|
-
],
|
|
184
|
+
], z), z;
|
|
134
185
|
}
|
|
135
186
|
//#endregion
|
|
136
|
-
export {
|
|
187
|
+
export { P as createCSRPageController };
|
|
File without changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
//#region app/html/browser-options.ts
|
|
2
2
|
function e(e) {
|
|
3
|
-
let { businessModules: t, providerOverrides: n,
|
|
4
|
-
return
|
|
3
|
+
let { businessModules: t, providerOverrides: n, requestBodyParser: r, ...i } = e;
|
|
4
|
+
return i;
|
|
5
5
|
}
|
|
6
6
|
//#endregion
|
|
7
7
|
export { e as projectBrowserOptions };
|
package/esm/app/html/shell.js
CHANGED
|
@@ -2,31 +2,170 @@
|
|
|
2
2
|
var e = {
|
|
3
3
|
head: "<!-- TC_SHARED_HEAD -->",
|
|
4
4
|
runtimeContext: "<!-- TC_RUNTIME_CONTEXT -->"
|
|
5
|
-
}, t =
|
|
6
|
-
|
|
5
|
+
}, t = "en", n = "width=device-width, initial-scale=1.0", r = "tc_theme", i = "dark", a = [{
|
|
6
|
+
rel: "icon",
|
|
7
|
+
type: "image/x-icon",
|
|
8
|
+
href: "/static/logo.png"
|
|
9
|
+
}];
|
|
10
|
+
function o(e) {
|
|
11
|
+
return !!e && typeof e == "object" && !Array.isArray(e);
|
|
12
|
+
}
|
|
13
|
+
function s(e) {
|
|
14
|
+
return o(e) && o(e.theme) ? e.theme : {};
|
|
15
|
+
}
|
|
16
|
+
function c(e) {
|
|
17
|
+
return Array.isArray(e) ? e.filter(o) : [];
|
|
18
|
+
}
|
|
19
|
+
function l(e, t) {
|
|
20
|
+
if (e === "link") {
|
|
21
|
+
if (typeof t.rel != "string" || !t.rel.trim()) return;
|
|
22
|
+
let e = t.rel.trim().toLowerCase();
|
|
23
|
+
return [
|
|
24
|
+
"canonical",
|
|
25
|
+
"icon",
|
|
26
|
+
"manifest",
|
|
27
|
+
"shortcut icon",
|
|
28
|
+
"apple-touch-icon"
|
|
29
|
+
].includes(e) ? `rel:${e}` : [
|
|
30
|
+
e,
|
|
31
|
+
t.href,
|
|
32
|
+
t.hreflang,
|
|
33
|
+
t.media,
|
|
34
|
+
t.sizes,
|
|
35
|
+
t.type
|
|
36
|
+
].map((e) => String(e ?? "").trim().toLowerCase()).join(":");
|
|
37
|
+
}
|
|
38
|
+
let n = [
|
|
39
|
+
"name",
|
|
40
|
+
"property",
|
|
41
|
+
"http-equiv",
|
|
42
|
+
"charset"
|
|
43
|
+
].find((e) => {
|
|
44
|
+
let n = t[e];
|
|
45
|
+
return typeof n == "string" && n.trim();
|
|
46
|
+
});
|
|
47
|
+
if (!n) return;
|
|
48
|
+
let r = String(t[n]).trim().toLowerCase();
|
|
49
|
+
return `${n}:${r}:${r === "theme-color" ? String(t.media ?? "").trim().toLowerCase() : ""}`;
|
|
50
|
+
}
|
|
51
|
+
function u(e, t, n = []) {
|
|
52
|
+
let r = new Set(n.map((t) => l(e, t)).filter(Boolean));
|
|
53
|
+
return [...t.filter((t) => !r.has(l(e, t))), ...n];
|
|
54
|
+
}
|
|
55
|
+
function d(e) {
|
|
56
|
+
return Object.entries(e).filter(([e, t]) => /^[A-Za-z_:][A-Za-z0-9:._-]*$/.test(e) && !/^on/i.test(e) && t != null && t !== !1).map(([e, t]) => ` ${e}="${v(t)}"`).join("");
|
|
57
|
+
}
|
|
58
|
+
function f(e, t = {}, n, r) {
|
|
59
|
+
let i = n === void 0 ? [] : [{
|
|
60
|
+
name: "description",
|
|
61
|
+
content: n
|
|
62
|
+
}], a = u("meta", e.meta, [...i, ...t.meta ?? []]), o = u("link", e.link, t.link), s = (e, t) => t.map((t) => `<${e}${d(t)} />`), c = (t.jsonLd ?? []).map((e) => `<script type="application/ld+json"${S(r)}>${g(e)}<\/script>`);
|
|
63
|
+
return [
|
|
64
|
+
...s("meta", a),
|
|
65
|
+
...s("link", o),
|
|
66
|
+
...c
|
|
67
|
+
].join("\n ");
|
|
68
|
+
}
|
|
69
|
+
function p(e) {
|
|
70
|
+
let t = {};
|
|
71
|
+
return e.class !== void 0 && (t.class = e.class), e.style !== void 0 && (t.style = e.style), d(t);
|
|
72
|
+
}
|
|
73
|
+
function m(e, l, d) {
|
|
74
|
+
let f = o(l) ? l : {}, p = s(f), m = o(e?.theme) ? e.theme : {}, h = (typeof e?.lang == "string" ? e.lang : typeof f.lang == "string" ? f.lang : void 0)?.trim(), g = d?.trim(), _ = h || g || t, v = m.default ?? p.default, y = v === "light" || v === "system" ? v : i, b = m.storageKey ?? p.storageKey, x = typeof b == "string" && b.trim() ? b : r, S = m.storageValuePath ?? p.storageValuePath, C = typeof S == "string" && S.trim() ? S.trim() : void 0, w = e?.viewportContent ?? f.viewportContent, T = typeof w == "string" && w.trim() ? w : n, E = e?.meta ?? c(f.meta), D = e?.link ?? c(f.link), O = o(f.body) ? f.body : {}, k = o(e?.body) ? e.body : {}, A = typeof k.class == "string" ? k.class : typeof O.class == "string" ? O.class : void 0, j = typeof k.style == "string" ? k.style : typeof O.style == "string" ? O.style : void 0, M = {
|
|
75
|
+
...A === void 0 ? {} : { class: A },
|
|
76
|
+
...j === void 0 ? {} : { style: j }
|
|
77
|
+
};
|
|
78
|
+
return {
|
|
79
|
+
lang: _,
|
|
80
|
+
languageIsRequestDerived: !h && !!g,
|
|
81
|
+
viewportContent: T,
|
|
82
|
+
meta: u("meta", [{
|
|
83
|
+
name: "viewport",
|
|
84
|
+
content: T
|
|
85
|
+
}], E),
|
|
86
|
+
link: u("link", a, D),
|
|
87
|
+
body: M,
|
|
88
|
+
theme: {
|
|
89
|
+
default: y,
|
|
90
|
+
storageKey: x,
|
|
91
|
+
storageValuePath: C,
|
|
92
|
+
initialClassName: y === "dark" ? "dark" : "",
|
|
93
|
+
initialColorScheme: y === "system" ? "light dark" : y
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
function h(e) {
|
|
98
|
+
return `<html lang="${v(e.lang)}" class="${v(e.theme.initialClassName)}" style="color-scheme: ${v(e.theme.initialColorScheme)}">`;
|
|
99
|
+
}
|
|
100
|
+
var g = (e) => (JSON.stringify(e) ?? "null").replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/&/g, "\\u0026").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
|
|
101
|
+
function _(e) {
|
|
7
102
|
return String(e).replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
8
103
|
}
|
|
9
|
-
function
|
|
10
|
-
return
|
|
104
|
+
function v(e) {
|
|
105
|
+
return _(e);
|
|
106
|
+
}
|
|
107
|
+
function y(e, t, n) {
|
|
108
|
+
return `;(() => {
|
|
109
|
+
const storageKey = ${e}
|
|
110
|
+
const storageValuePath = ${n}
|
|
111
|
+
let mode = ${t}
|
|
112
|
+
|
|
113
|
+
try {
|
|
114
|
+
const storedValue = localStorage.getItem(storageKey)
|
|
115
|
+
let storedMode = storedValue
|
|
116
|
+
if (storageValuePath && storedValue) {
|
|
117
|
+
let parsedValue = JSON.parse(storedValue)
|
|
118
|
+
for (const key of storageValuePath.split('.')) {
|
|
119
|
+
if (!parsedValue || typeof parsedValue !== 'object') {
|
|
120
|
+
parsedValue = null
|
|
121
|
+
break
|
|
122
|
+
}
|
|
123
|
+
parsedValue = parsedValue[key]
|
|
124
|
+
}
|
|
125
|
+
storedMode = parsedValue
|
|
126
|
+
}
|
|
127
|
+
if (storedMode === 'light' || storedMode === 'dark') {
|
|
128
|
+
mode = storedMode
|
|
129
|
+
}
|
|
130
|
+
} catch (error) {
|
|
131
|
+
// Keep the template default when localStorage is unavailable.
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
const root = document.documentElement
|
|
135
|
+
if (mode === 'system') {
|
|
136
|
+
mode = window.matchMedia?.('(prefers-color-scheme: dark)')?.matches ? 'dark' : 'light'
|
|
137
|
+
}
|
|
138
|
+
root.classList.toggle('dark', mode === 'dark')
|
|
139
|
+
root.style.colorScheme = mode
|
|
140
|
+
})()`;
|
|
11
141
|
}
|
|
12
|
-
function
|
|
13
|
-
return
|
|
142
|
+
function b(e = m(void 0, void 0)) {
|
|
143
|
+
return y(g(e.theme.storageKey), g(e.theme.default), g(e.theme.storageValuePath ?? ""));
|
|
14
144
|
}
|
|
15
|
-
function
|
|
16
|
-
return
|
|
145
|
+
function x() {
|
|
146
|
+
return y("{{ htmlThemeStorageKey | safe }}", "{{ htmlThemeDefault | safe }}", "{{ htmlThemeStorageValuePath | safe }}");
|
|
17
147
|
}
|
|
18
|
-
function
|
|
19
|
-
|
|
148
|
+
function S(e) {
|
|
149
|
+
return e ? ` nonce="${v(e)}"` : "";
|
|
150
|
+
}
|
|
151
|
+
function C(e = "", t = b()) {
|
|
152
|
+
return `<script${e}>${t}<\/script>`;
|
|
153
|
+
}
|
|
154
|
+
function w({ titleHtml: e, preloadLinks: t = "", extraHeadHtml: n = "", nonceAttr: r = "", themeScriptContent: i = b() }) {
|
|
155
|
+
let a = t ? `\n ${t}` : "";
|
|
20
156
|
return ` <meta charset="UTF-8" />
|
|
21
|
-
${
|
|
22
|
-
<
|
|
23
|
-
<link rel="icon" type="image/x-icon" href="/static/logo.png" />
|
|
24
|
-
<title>${e}</title>${r}${i}`;
|
|
157
|
+
${C(r, i)}
|
|
158
|
+
<title>${e}</title>${a}${n ? `\n ${n}` : ""}`;
|
|
25
159
|
}
|
|
26
|
-
function
|
|
27
|
-
return
|
|
160
|
+
function T() {
|
|
161
|
+
return w({
|
|
162
|
+
titleHtml: "{{ htmlTitle }}",
|
|
163
|
+
extraHeadHtml: "{{ htmlHeadTags | safe }}",
|
|
164
|
+
nonceAttr: "{{ cspNonceAttr | safe }}",
|
|
165
|
+
themeScriptContent: x()
|
|
166
|
+
});
|
|
28
167
|
}
|
|
29
|
-
function
|
|
168
|
+
function E({ basePathExpression: e, feBasePageExpression: t, projKeyExpression: n, signKeyExpression: r, renderModeExpression: i }) {
|
|
30
169
|
return `window['_basePath'] = ${e}
|
|
31
170
|
window['_FEBasePage'] = ${t}
|
|
32
171
|
window['_projKey'] = ${n}
|
|
@@ -36,34 +175,36 @@ window['_isSSR'] = window['_renderMode'] === 'ssr'
|
|
|
36
175
|
const s = document.getElementById('input')
|
|
37
176
|
s.parentElement.removeChild(s)`;
|
|
38
177
|
}
|
|
39
|
-
function
|
|
178
|
+
function D() {
|
|
40
179
|
return "const appOptionsScript = document.getElementById('app-options-data')\nwindow['appOptions'] = JSON.parse(appOptionsScript.textContent || '{}')\nappOptionsScript.parentElement.removeChild(appOptionsScript)";
|
|
41
180
|
}
|
|
42
|
-
function
|
|
43
|
-
|
|
44
|
-
|
|
181
|
+
function O(e) {
|
|
182
|
+
let t = e.nonceAttr ?? "";
|
|
183
|
+
return `<script id="input"${t}>
|
|
184
|
+
${E(e)}
|
|
45
185
|
<\/script>
|
|
46
|
-
<script type="application/json" id="app-options-data">${e.optionsJsonHtml}<\/script>
|
|
47
|
-
<script>
|
|
48
|
-
${
|
|
186
|
+
<script type="application/json" id="app-options-data"${t}>${e.optionsJsonHtml}<\/script>
|
|
187
|
+
<script${t}>
|
|
188
|
+
${D()}
|
|
49
189
|
<\/script>`;
|
|
50
190
|
}
|
|
51
|
-
function
|
|
52
|
-
return
|
|
191
|
+
function k() {
|
|
192
|
+
return O({
|
|
53
193
|
basePathExpression: "{{basePath | safe}}",
|
|
54
194
|
feBasePageExpression: "{{FEBasePage | safe}}",
|
|
55
195
|
projKeyExpression: "{{projKeyJson | safe}}",
|
|
56
196
|
signKeyExpression: "{{signKey | safe}}",
|
|
57
|
-
renderModeExpression:
|
|
58
|
-
optionsJsonHtml: "{{ options | safe }}"
|
|
197
|
+
renderModeExpression: g("csr"),
|
|
198
|
+
optionsJsonHtml: "{{ options | safe }}",
|
|
199
|
+
nonceAttr: "{{ cspNonceAttr | safe }}"
|
|
59
200
|
});
|
|
60
201
|
}
|
|
61
|
-
function
|
|
202
|
+
function A(e, t, n) {
|
|
62
203
|
if (!e.includes(t)) throw Error(`CSR entry template is missing shared shell marker: ${t}`);
|
|
63
204
|
return e.replace(t, n);
|
|
64
205
|
}
|
|
65
|
-
function
|
|
66
|
-
return
|
|
206
|
+
function j(t) {
|
|
207
|
+
return A(A(t, e.head, T()), e.runtimeContext, k());
|
|
67
208
|
}
|
|
68
209
|
//#endregion
|
|
69
|
-
export {
|
|
210
|
+
export { j as applySharedCSRShellTemplate, _ as escapeHtml, v as escapeHtmlAttr, u as mergeHtmlHeadEntries, D as renderAppOptionsScriptContent, T as renderCSRDocumentHeadTemplate, k as renderCSRRuntimeContextScriptsTemplate, w as renderDocumentHeadHtml, p as renderHtmlBodyAttributes, h as renderHtmlDocumentStart, f as renderHtmlHeadContent, O as renderRuntimeContextScriptsFromExpressions, E as renderRuntimeInputScriptContentFromExpressions, S as renderScriptNonceAttribute, C as renderThemeScript, b as renderThemeScriptContent, m as resolveHtmlShellOptions, g as serializeForHtmlScript, e as sharedCSRShellMarkers };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
//#region app/http/api-signing.ts
|
|
2
|
+
var e = "sakjdfnkjwjfnfkjkjldljksndf";
|
|
3
|
+
function t(e) {
|
|
4
|
+
let t = e.apiSignVerify, n = t && typeof t == "object" && "mode" in t ? t.mode : void 0, r = n === void 0 ? "shared" : n;
|
|
5
|
+
if (r !== "shared" && r !== "private") throw Error("[TemplateCore] apiSignVerify.mode must be \"shared\" or \"private\"");
|
|
6
|
+
if (r === "private" && (typeof e.signKey != "string" || !e.signKey.trim() || e.signKey === "sakjdfnkjwjfnfkjkjldljksndf")) throw Error("[TemplateCore] Private API signing requires a non-empty, non-default signKey");
|
|
7
|
+
return r;
|
|
8
|
+
}
|
|
9
|
+
function n(e) {
|
|
10
|
+
return t(e) === "private" ? "" : e.signKey;
|
|
11
|
+
}
|
|
12
|
+
//#endregion
|
|
13
|
+
export { e as DEFAULT_API_SIGN_KEY, t as resolveApiSigningMode, n as resolveBrowserSignKey };
|