@_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.
Files changed (297) hide show
  1. package/.skills/tc-component-usage-skills/reference/component-api.md +27 -0
  2. package/.skills/tc-generator/SKILL.md +1 -1
  3. package/.skills/tc-generator/reference/project-template/ssr/apps/hello/hello.entry.tsx +6 -1
  4. package/.skills/tc-generator/reference/runtime-extensions.md +10 -0
  5. package/AGENT_README.md +8 -2
  6. package/CHANGE.md +27 -0
  7. package/README.md +157 -8
  8. package/cjs/app/ai/agent/agent-scanner.service.js +1 -1
  9. package/cjs/app/ai/agent/agent.module.js +1 -1
  10. package/cjs/app/ai/ai-config.module.js +1 -1
  11. package/cjs/app/ai/ai-config.service.js +1 -1
  12. package/cjs/app/ai/ai.controller.js +1 -1
  13. package/cjs/app/ai/ai.module.js +1 -1
  14. package/cjs/app/ai/guardrail/guardrail.module.js +1 -1
  15. package/cjs/app/ai/guardrail/guardrail.service.js +1 -1
  16. package/cjs/app/ai/index.js +1 -0
  17. package/cjs/app/ai/mcp/internal/read-sse-response.js +2 -0
  18. package/cjs/app/ai/mcp/internal/stdio-process.js +1 -0
  19. package/cjs/app/ai/mcp/mcp-registry.service.js +2 -2
  20. package/cjs/app/ai/mcp/mcp.client.js +2 -3
  21. package/cjs/app/ai/mcp/mcp.loader.js +1 -1
  22. package/cjs/app/ai/mcp/mcp.module.js +1 -1
  23. package/cjs/app/ai/memory/checkpoint.service.js +1 -1
  24. package/cjs/app/ai/memory/memory.module.js +1 -1
  25. package/cjs/app/ai/memory/thread.service.js +1 -1
  26. package/cjs/app/ai/models/chat-sse.js +4 -0
  27. package/cjs/app/ai/models/chat.js +1 -0
  28. package/cjs/app/ai/models/http.js +1 -0
  29. package/cjs/app/ai/models/image.js +1 -0
  30. package/cjs/app/ai/models/video.js +1 -0
  31. package/cjs/app/ai/nest-service-provider.js +1 -0
  32. package/cjs/app/ai/rag/rag.module.js +1 -1
  33. package/cjs/app/ai/rag/retriever.service.js +1 -1
  34. package/cjs/app/ai/retention/conversation-retention.service.js +1 -1
  35. package/cjs/app/ai/runtime/ai-runtime-startup.validator.js +1 -1
  36. package/cjs/app/ai/runtime/ai-runtime.js +1 -0
  37. package/cjs/app/ai/runtime/internal/context-compaction.service.js +3 -3
  38. package/cjs/app/ai/runtime/internal/declaration-snapshot.js +1 -0
  39. package/cjs/app/ai/runtime/internal/owned-runtime-resources.js +1 -0
  40. package/cjs/app/ai/runtime/langchain/langchain-planner.service.js +1 -1
  41. package/cjs/app/ai/runtime/langgraph/langgraph-orchestrator.service.js +1 -1
  42. package/cjs/app/ai/runtime/runtime.module.js +1 -1
  43. package/cjs/app/ai/skill/skill-scanner.service.js +1 -1
  44. package/cjs/app/ai/skill/skill.module.js +1 -1
  45. package/cjs/app/ai/snapshot-data.js +1 -0
  46. package/cjs/app/ai/store/internal/create-vector-store.js +1 -0
  47. package/cjs/app/ai/store/store.module.js +1 -1
  48. package/cjs/app/ai/tool/builtin/index.js +1 -1
  49. package/cjs/app/ai/tool/builtin/invoke-agent.tool.js +1 -1
  50. package/cjs/app/ai/tool/builtin/retrieve.tool.js +1 -1
  51. package/cjs/app/ai/tool/executor.service.js +1 -1
  52. package/cjs/app/ai/tool/tool-registry.service.js +1 -1
  53. package/cjs/app/ai/tool/tool.module.js +1 -1
  54. package/cjs/app/ai/trace/trace.service.js +1 -1
  55. package/cjs/app/csr/controller.js +1 -1
  56. package/cjs/app/csr/types.js +0 -0
  57. package/cjs/app/html/browser-options.js +1 -1
  58. package/cjs/app/html/shell.js +31 -16
  59. package/cjs/app/http/api-signing.js +1 -0
  60. package/cjs/app/http/body-parser.middleware.js +1 -1
  61. package/cjs/app/http/csp-nonce.js +1 -0
  62. package/cjs/app/http/error-response.js +1 -1
  63. package/cjs/app/http/exception-filter.js +1 -1
  64. package/cjs/app/http/request-body-parser-policy.js +1 -0
  65. package/cjs/app/http/security.guard.js +1 -1
  66. package/cjs/app/project/controller.js +1 -1
  67. package/cjs/app/project/service.js +1 -1
  68. package/cjs/app/providers/foundation.js +1 -1
  69. package/cjs/app/ssr/artifacts.js +1 -1
  70. package/cjs/app/ssr/controller.js +1 -1
  71. package/cjs/app/ssr/html.js +17 -17
  72. package/cjs/app/ssr/stream.js +1 -1
  73. package/cjs/app/static-assets.middleware.js +1 -1
  74. package/cjs/app/template-core.module.js +1 -1
  75. package/cjs/app/view/entry.tpl +2 -2
  76. package/cjs/bundler/buildSSR.js +1 -1
  77. package/cjs/bundler/entryCollect.js +1 -1
  78. package/cjs/bundler/feSharedConfig.js +1 -1
  79. package/cjs/bundler/utils.js +3 -3
  80. package/cjs/config/config.default.js +1 -1
  81. package/cjs/packages/common/index.js +1 -1
  82. package/cjs/packages/core/bootstrap.js +1 -1
  83. package/cjs/packages/core/startup.js +1 -1
  84. package/esm/app/ai/agent/agent-scanner.service.js +33 -36
  85. package/esm/app/ai/agent/agent.module.js +9 -7
  86. package/esm/app/ai/ai-config.module.js +14 -7
  87. package/esm/app/ai/ai-config.service.js +24 -20
  88. package/esm/app/ai/ai.controller.js +41 -41
  89. package/esm/app/ai/ai.module.js +15 -15
  90. package/esm/app/ai/guardrail/guardrail.module.js +11 -9
  91. package/esm/app/ai/guardrail/guardrail.service.js +5 -10
  92. package/esm/app/ai/index.js +2 -0
  93. package/esm/app/ai/mcp/internal/read-sse-response.js +35 -0
  94. package/esm/app/ai/mcp/internal/stdio-process.js +59 -0
  95. package/esm/app/ai/mcp/mcp-registry.service.js +10 -15
  96. package/esm/app/ai/mcp/mcp.client.js +77 -78
  97. package/esm/app/ai/mcp/mcp.loader.js +64 -42
  98. package/esm/app/ai/mcp/mcp.module.js +62 -22
  99. package/esm/app/ai/memory/checkpoint.service.js +18 -28
  100. package/esm/app/ai/memory/memory.module.js +15 -12
  101. package/esm/app/ai/memory/thread.service.js +21 -26
  102. package/esm/app/ai/models/chat-sse.js +44 -0
  103. package/esm/app/ai/models/chat.js +60 -0
  104. package/esm/app/ai/models/http.js +52 -0
  105. package/esm/app/ai/models/image.js +37 -0
  106. package/esm/app/ai/models/video.js +32 -0
  107. package/esm/app/ai/nest-service-provider.js +10 -0
  108. package/esm/app/ai/rag/rag.module.js +24 -15
  109. package/esm/app/ai/rag/retriever.service.js +37 -54
  110. package/esm/app/ai/retention/conversation-retention.service.js +16 -34
  111. package/esm/app/ai/runtime/ai-runtime-startup.validator.js +2 -19
  112. package/esm/app/ai/runtime/ai-runtime.js +104 -0
  113. package/esm/app/ai/runtime/internal/context-compaction.service.js +139 -145
  114. package/esm/app/ai/runtime/internal/declaration-snapshot.js +32 -0
  115. package/esm/app/ai/runtime/internal/owned-runtime-resources.js +21 -0
  116. package/esm/app/ai/runtime/langchain/langchain-planner.service.js +43 -49
  117. package/esm/app/ai/runtime/langgraph/langgraph-orchestrator.service.js +273 -225
  118. package/esm/app/ai/runtime/runtime.module.js +56 -35
  119. package/esm/app/ai/skill/skill-scanner.service.js +11 -16
  120. package/esm/app/ai/skill/skill.module.js +11 -9
  121. package/esm/app/ai/snapshot-data.js +24 -0
  122. package/esm/app/ai/store/internal/create-vector-store.js +10 -0
  123. package/esm/app/ai/store/store.module.js +9 -13
  124. package/esm/app/ai/tool/builtin/index.js +16 -4
  125. package/esm/app/ai/tool/builtin/invoke-agent.tool.js +30 -34
  126. package/esm/app/ai/tool/builtin/retrieve.tool.js +9 -13
  127. package/esm/app/ai/tool/executor.service.js +22 -29
  128. package/esm/app/ai/tool/tool-registry.service.js +6 -16
  129. package/esm/app/ai/tool/tool.module.js +26 -12
  130. package/esm/app/ai/trace/trace.service.js +15 -28
  131. package/esm/app/csr/controller.js +114 -63
  132. package/esm/app/csr/types.js +0 -0
  133. package/esm/app/html/browser-options.js +2 -2
  134. package/esm/app/html/shell.js +173 -32
  135. package/esm/app/http/api-signing.js +13 -0
  136. package/esm/app/http/body-parser.middleware.js +47 -27
  137. package/esm/app/http/csp-nonce.js +13 -0
  138. package/esm/app/http/error-response.js +8 -5
  139. package/esm/app/http/exception-filter.js +4 -4
  140. package/esm/app/http/request-body-parser-policy.js +46 -0
  141. package/esm/app/http/security.guard.js +23 -21
  142. package/esm/app/project/controller.js +15 -15
  143. package/esm/app/project/service.js +3 -3
  144. package/esm/app/providers/foundation.js +5 -5
  145. package/esm/app/ssr/artifacts.js +25 -21
  146. package/esm/app/ssr/controller.js +148 -75
  147. package/esm/app/ssr/html.js +49 -44
  148. package/esm/app/ssr/stream.js +25 -24
  149. package/esm/app/static-assets.middleware.js +4 -4
  150. package/esm/app/template-core.module.js +57 -52
  151. package/esm/app/view/entry.tpl +2 -2
  152. package/esm/bundler/buildSSR.js +1 -1
  153. package/esm/bundler/entryCollect.js +9 -9
  154. package/esm/bundler/feSharedConfig.js +42 -42
  155. package/esm/bundler/utils.js +78 -90
  156. package/esm/config/config.default.js +4 -3
  157. package/esm/packages/common/index.js +6 -6
  158. package/esm/packages/core/bootstrap.js +5 -5
  159. package/esm/packages/core/startup.js +69 -46
  160. package/fe/frontend/src/common/request.js +5 -2
  161. package/fe/frontend/src/hooks/useRouterParams.d.ts +4 -2
  162. package/fe/packages/common/ssr/hydration.d.ts +9 -0
  163. package/fe/packages/react/core/Label/Label.d.ts +1 -0
  164. package/fe/packages/react/core/Label/Label.js +3 -1
  165. package/fe/packages/react/core/internal/i18n/default.d.ts +13 -0
  166. package/fe/packages/react/core/internal/i18n/default.js +16 -1
  167. package/fe/packages/react/core/internal/i18n/en-US.d.ts +13 -0
  168. package/fe/packages/react/core/internal/i18n/en-US.js +16 -1
  169. package/fe/packages/react/forms/DataTable/index.d.ts +2 -0
  170. package/fe/packages/react/forms/DataTable/index.js +43 -29
  171. package/fe/packages/react/forms/Form/FormItem.js +39 -12
  172. package/fe/packages/react/forms/MultiSelect/MultiSelect.d.ts +26 -0
  173. package/fe/packages/react/forms/MultiSelect/MultiSelect.js +218 -0
  174. package/fe/packages/react/forms/MultiSelect/index.d.ts +1 -0
  175. package/fe/packages/react/forms/MultiSelect/index.js +2 -0
  176. package/fe/packages/react/forms/Pagination/Pagination.d.ts +6 -1
  177. package/fe/packages/react/forms/Pagination/Pagination.js +13 -4
  178. package/fe/packages/react/forms/Select/Select.d.ts +11 -0
  179. package/fe/packages/react/forms/Select/Select.js +20 -7
  180. package/fe/packages/react/forms/index.d.ts +1 -0
  181. package/fe/packages/react/forms/index.js +3 -1
  182. package/fe/packages/react/i18n/getUiReactLocale.d.ts +26 -0
  183. package/fe/packages/react/index.js +2 -1
  184. package/fe/packages/react/overlays/Drawer/Drawer.d.ts +3 -2
  185. package/fe/packages/react/overlays/Drawer/Drawer.js +16 -2
  186. package/fe/packages/react/overlays/Dropdown/Dropdown.d.ts +12 -2
  187. package/fe/packages/react/overlays/Dropdown/Dropdown.js +27 -14
  188. package/fe/packages/react/overlays/Modal/Modal.d.ts +11 -3
  189. package/fe/packages/react/overlays/Modal/Modal.js +26 -2
  190. package/fe/packages/react/overlays/Modal/ModalManager.d.ts +13 -12
  191. package/fe/packages/react/overlays/Modal/ModalManager.js +15 -5
  192. package/fe/packages/react/overlays/Modal/index.d.ts +1 -0
  193. package/fe/packages/react/overlays/Overlay/Overlay.d.ts +6 -2
  194. package/fe/packages/react/overlays/Overlay/Overlay.js +31 -14
  195. package/fe/packages/react/overlays/Overlay/focusTypes.d.ts +8 -0
  196. package/fe/packages/react/overlays/Overlay/focusTypes.js +0 -0
  197. package/fe/packages/react/overlays/Overlay/index.d.ts +1 -0
  198. package/fe/packages/react/overlays/Overlay/overlayStack.d.ts +16 -0
  199. package/fe/packages/react/overlays/Overlay/overlayStack.js +290 -0
  200. package/fe/packages/react/overlays/Popup/Popup.d.ts +5 -4
  201. package/fe/packages/react/overlays/Popup/Popup.js +28 -11
  202. package/fe/packages/react/ui/components/index.js +2 -1
  203. package/fe/packages/react/ui/index.js +2 -1
  204. package/fe/ssr/components/StreamingRender/StreamingCache.d.ts +1 -0
  205. package/fe/ssr/components/StreamingRender/StreamingCache.js +5 -1
  206. package/fe/ssr/components/StreamingRender/StreamingRender.js +1 -1
  207. package/fe/ssr/components/StreamingRender/StreamingScript.d.ts +1 -0
  208. package/fe/ssr/components/StreamingRender/StreamingScript.js +9 -1
  209. package/fe/ssr/createSSREntry.d.ts +9 -3
  210. package/fe/ssr/createSSREntry.js +43 -19
  211. package/fe/ssr/index.d.ts +4 -1
  212. package/fe/ssr/index.js +2 -1
  213. package/fe/ssr/router.d.ts +76 -0
  214. package/fe/ssr/router.js +349 -0
  215. package/fe/ssr/types.d.ts +1 -1
  216. package/models/packages/common/ssr/hydration.d.ts +9 -0
  217. package/models/packages/react/core/Label/Label.d.ts +1 -0
  218. package/models/packages/react/core/internal/i18n/default.d.ts +13 -0
  219. package/models/packages/react/core/internal/i18n/en-US.d.ts +13 -0
  220. package/models/packages/react/forms/DataTable/index.d.ts +2 -0
  221. package/models/packages/react/forms/MultiSelect/MultiSelect.d.ts +26 -0
  222. package/models/packages/react/forms/MultiSelect/index.d.ts +1 -0
  223. package/models/packages/react/forms/Pagination/Pagination.d.ts +6 -1
  224. package/models/packages/react/forms/Select/Select.d.ts +11 -0
  225. package/models/packages/react/forms/index.d.ts +1 -0
  226. package/models/packages/react/i18n/getUiReactLocale.d.ts +26 -0
  227. package/models/packages/react/overlays/Drawer/Drawer.d.ts +3 -2
  228. package/models/packages/react/overlays/Dropdown/Dropdown.d.ts +12 -2
  229. package/models/packages/react/overlays/Modal/Modal.d.ts +11 -3
  230. package/models/packages/react/overlays/Modal/ModalManager.d.ts +13 -12
  231. package/models/packages/react/overlays/Modal/index.d.ts +1 -0
  232. package/models/packages/react/overlays/Overlay/Overlay.d.ts +6 -2
  233. package/models/packages/react/overlays/Overlay/focusTypes.d.ts +8 -0
  234. package/models/packages/react/overlays/Overlay/index.d.ts +1 -0
  235. package/models/packages/react/overlays/Overlay/overlayStack.d.ts +16 -0
  236. package/models/packages/react/overlays/Popup/Popup.d.ts +5 -4
  237. package/package.json +26 -1
  238. package/types/app/ai/agent/agent-scanner.service.d.ts +4 -4
  239. package/types/app/ai/ai-config.service.d.ts +7 -3
  240. package/types/app/ai/guardrail/guardrail.service.d.ts +2 -2
  241. package/types/app/ai/index.d.ts +9 -0
  242. package/types/app/ai/mcp/internal/load-mcp-config.d.ts +2 -2
  243. package/types/app/ai/mcp/internal/read-sse-response.d.ts +2 -0
  244. package/types/app/ai/mcp/internal/stdio-process.d.ts +5 -0
  245. package/types/app/ai/mcp/mcp-registry.service.d.ts +5 -3
  246. package/types/app/ai/mcp/mcp.client.d.ts +7 -4
  247. package/types/app/ai/mcp/mcp.loader.d.ts +11 -11
  248. package/types/app/ai/mcp/mcp.module.d.ts +5 -5
  249. package/types/app/ai/memory/thread.service.d.ts +3 -3
  250. package/types/app/ai/models/chat-sse.d.ts +5 -0
  251. package/types/app/ai/models/chat.d.ts +22 -0
  252. package/types/app/ai/models/http.d.ts +20 -0
  253. package/types/app/ai/models/image.d.ts +69 -0
  254. package/types/app/ai/models/video.d.ts +99 -0
  255. package/types/app/ai/nest-service-provider.d.ts +6 -0
  256. package/types/app/ai/retention/conversation-retention.service.d.ts +3 -4
  257. package/types/app/ai/runtime/ai-runtime-startup.validator.d.ts +2 -3
  258. package/types/app/ai/runtime/ai-runtime.d.ts +46 -0
  259. package/types/app/ai/runtime/internal/agent-run-context.d.ts +4 -0
  260. package/types/app/ai/runtime/internal/context-compaction.service.d.ts +2 -2
  261. package/types/app/ai/runtime/internal/declaration-snapshot.d.ts +8 -0
  262. package/types/app/ai/runtime/internal/owned-runtime-resources.d.ts +5 -0
  263. package/types/app/ai/runtime/langchain/langchain-planner.service.d.ts +1 -1
  264. package/types/app/ai/runtime/langgraph/langgraph-orchestrator.service.d.ts +33 -16
  265. package/types/app/ai/skill/skill-scanner.service.d.ts +3 -4
  266. package/types/app/ai/snapshot-data.d.ts +1 -0
  267. package/types/app/ai/store/internal/create-vector-store.d.ts +4 -0
  268. package/types/app/ai/tool/builtin/index.d.ts +1 -1
  269. package/types/app/ai/tool/builtin/invoke-agent.tool.d.ts +10 -3
  270. package/types/app/ai/tool/builtin/retrieve.tool.d.ts +4 -3
  271. package/types/app/ai/tool/executor.service.d.ts +3 -3
  272. package/types/app/ai/tool/tool-registry.service.d.ts +2 -7
  273. package/types/app/ai/tool/tool.interface.d.ts +1 -1
  274. package/types/app/ai/tool/tool.module.d.ts +8 -1
  275. package/types/app/ai/trace/trace.service.d.ts +4 -5
  276. package/types/app/csr/types.d.ts +10 -0
  277. package/types/app/html/browser-options.d.ts +1 -1
  278. package/types/app/html/shell.d.ts +37 -10
  279. package/types/app/http/api-signing.d.ts +16 -0
  280. package/types/app/http/body-parser.middleware.d.ts +6 -2
  281. package/types/app/http/csp-nonce.d.ts +3 -0
  282. package/types/app/http/error-response.d.ts +1 -0
  283. package/types/app/http/request-body-parser-policy.d.ts +8 -0
  284. package/types/app/http/security.guard.d.ts +1 -0
  285. package/types/app/ssr/artifacts.d.ts +6 -3
  286. package/types/app/ssr/html.d.ts +7 -0
  287. package/types/app/ssr/stream.d.ts +1 -1
  288. package/types/app/ssr/types.d.ts +56 -0
  289. package/types/bundler/buildSSR.d.ts +2 -1
  290. package/types/bundler/index.d.ts +1 -1
  291. package/types/bundler/state.d.ts +13 -0
  292. package/types/bundler/utils.d.ts +3 -14
  293. package/types/config/config.default.d.ts +9 -3
  294. package/types/index.d.ts +4 -1
  295. package/types/packages/common/ssr/hydration.d.ts +13 -0
  296. package/types/packages/core/index.d.ts +1 -1
  297. package/types/packages/core/startup.d.ts +41 -0
@@ -1,31 +1,24 @@
1
- import { AiConfigService as e } from "../ai-config.service.js";
2
- import { TRACE_STORE as t } from "../store/store.interface.js";
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 p, m, h = m = class {
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
- }, n), this.timer.unref?.(), await this.runScheduledCleanup());
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: f(),
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 t = await this.store.listRunIds?.() ?? [], n = Date.now(), i = 0;
59
- for (let a of t) {
60
- let t = this.runs.get(a) ?? await this.store.load(a);
61
- !t || !r(Date.parse(t.createdAt), e, n) || (await this.store.delete?.(a), this.runs.delete(a), i += 1);
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 i(this.configService, "ai.store.traceRetentionDays");
64
+ if (this.configService) return n(this.configService, "ai.store.traceRetentionDays");
72
65
  }
73
66
  isRunExpired(e) {
74
- let t = this.retentionDays();
75
- return t !== void 0 && r(Date.parse(e.createdAt), t);
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 { h as TraceService };
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 { Controller as d, Get as f, Inject as p, Next as m, Param as h, Req as g, Res as _ } from "@nestjs/common";
10
- import v from "@oxc-project/runtime/helpers/decorateMetadata";
11
- import y from "@oxc-project/runtime/helpers/decorate";
12
- import b from "@oxc-project/runtime/helpers/decorateParam";
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
- function x(e) {
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 S(e, t) {
22
+ function A(e, t) {
18
23
  return e === t || e.startsWith(`${t}/`);
19
24
  }
20
- function C(e, t) {
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 w(w) {
28
- var T, E, D;
29
- let O = t(w) || "", k = class {
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 (S(e.path, this.runtime.options.apiPrefix)) {
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 t = e.query.projk, n = Array.isArray(t) ? t.map(String).join(",") : t ?? "", o = O ? `${O}/${r}` : `/${r}`, s = this.runtime.options.name ?? "", c = this.runtime.environment, l = {
49
- projKey: n,
50
- name: s,
51
- env: c,
52
- FEBasePage: x(O || "/"),
53
- basePath: x(o),
54
- projKeyJson: x(String(t ?? "")),
55
- signKey: x(this.config.get("signKey")),
56
- options: x(u(this.runtime.options))
57
- }, d = this.development.session, f = d ? await d.renderCSR(r, e.originalUrl) : void 0;
58
- if (f === null) throw Error(`[CSR] Development entry not found: ${r}`);
59
- i = this.renderer.render(`${r}.entry.tpl`, l, f), a = [
60
- l.basePath,
61
- s,
62
- c,
63
- n
64
- ].filter(Boolean).join(" "), this.etagCache.hasEtag(a) || this.etagCache.setEtag(a, this.crypto.hmacSign(i));
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
- let o = this.etagCache.getEtag(a);
82
- if (t.status(200), t.setHeader("ETag", o ? `"${o}"` : `"${Date.now()}"`), t.setHeader("Cache-Control", `public, max-age=${(this.config.get("resourceCacheTimeMs") ?? 300 * 1e3) / 1e3}, immutable`), C(e, o)) {
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 y([
90
- f(":page"),
91
- b(0, h("page")),
92
- b(1, g()),
93
- b(2, _()),
94
- b(3, m()),
95
- v("design:type", Function),
96
- v("design:paramtypes", [
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
- v("design:returntype", Promise)
103
- ], k.prototype, "renderPage", null), y([
104
- f(":page/{*rest}"),
105
- b(0, h("page")),
106
- b(1, g()),
107
- b(2, _()),
108
- b(3, m()),
109
- v("design:type", Function),
110
- v("design:paramtypes", [
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
- v("design:returntype", Promise)
117
- ], k.prototype, "renderNestedPage", null), k = y([
118
- d(O),
119
- b(2, p(n)),
120
- b(3, p(o)),
121
- b(4, p(i)),
122
- b(5, p(r)),
123
- b(6, p(a)),
124
- v("design:paramtypes", [
125
- typeof (T = s !== void 0 && s) == "function" ? T : Object,
126
- typeof (E = c !== void 0 && c) == "function" ? E : Object,
127
- typeof (D = e !== void 0 && e) == "function" ? D : Object,
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
- ], k), k;
184
+ ], z), z;
134
185
  }
135
186
  //#endregion
136
- export { w as createCSRPageController };
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, ...r } = e;
4
- return r;
3
+ let { businessModules: t, providerOverrides: n, requestBodyParser: r, ...i } = e;
4
+ return i;
5
5
  }
6
6
  //#endregion
7
7
  export { e as projectBrowserOptions };
@@ -2,31 +2,170 @@
2
2
  var e = {
3
3
  head: "<!-- TC_SHARED_HEAD -->",
4
4
  runtimeContext: "<!-- TC_RUNTIME_CONTEXT -->"
5
- }, t = (e) => JSON.stringify(e).replace(/</g, "\\u003c").replace(/>/g, "\\u003e").replace(/&/g, "\\u0026").replace(/\u2028/g, "\\u2028").replace(/\u2029/g, "\\u2029");
6
- function n(e) {
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, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;");
8
103
  }
9
- function r(e) {
10
- return n(e);
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 i() {
13
- return ";(() => {\n const storageKey = 'tc_theme'\n let mode = 'dark'\n\n try {\n const storedMode = localStorage.getItem(storageKey)\n if (storedMode === 'light' || storedMode === 'dark') {\n mode = storedMode\n }\n } catch (error) {\n // Keep the template default when localStorage is unavailable.\n }\n\n const root = document.documentElement\n root.classList.toggle('dark', mode === 'dark')\n root.style.colorScheme = mode\n})()";
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 a() {
16
- return `<script>${i()}<\/script>`;
145
+ function x() {
146
+ return y("{{ htmlThemeStorageKey | safe }}", "{{ htmlThemeDefault | safe }}", "{{ htmlThemeStorageValuePath | safe }}");
17
147
  }
18
- function o({ titleHtml: e, descriptionAttr: t, preloadLinks: n = "" }) {
19
- let r = typeof t == "string" ? `\n <meta name="description" content="${t}" />` : "", i = n ? `\n ${n}` : "";
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
- ${a()}
22
- <meta name="viewport" content="width=device-width, initial-scale=1.0" />
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 s() {
27
- return o({ titleHtml: "{{ name }}" });
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 c({ basePathExpression: e, feBasePageExpression: t, projKeyExpression: n, signKeyExpression: r, renderModeExpression: i }) {
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 l() {
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 u(e) {
43
- return `<script id="input">
44
- ${c(e)}
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
- ${l()}
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 d() {
52
- return u({
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: t("csr"),
58
- optionsJsonHtml: "{{ options | safe }}"
197
+ renderModeExpression: g("csr"),
198
+ optionsJsonHtml: "{{ options | safe }}",
199
+ nonceAttr: "{{ cspNonceAttr | safe }}"
59
200
  });
60
201
  }
61
- function f(e, t, n) {
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 p(t) {
66
- return f(f(t, e.head, s()), e.runtimeContext, d());
206
+ function j(t) {
207
+ return A(A(t, e.head, T()), e.runtimeContext, k());
67
208
  }
68
209
  //#endregion
69
- export { p as applySharedCSRShellTemplate, n as escapeHtml, r as escapeHtmlAttr, l as renderAppOptionsScriptContent, s as renderCSRDocumentHeadTemplate, d as renderCSRRuntimeContextScriptsTemplate, o as renderDocumentHeadHtml, u as renderRuntimeContextScriptsFromExpressions, c as renderRuntimeInputScriptContentFromExpressions, a as renderThemeScript, i as renderThemeScriptContent, t as serializeForHtmlScript, e as sharedCSRShellMarkers };
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 };