@foxford/den 3.7.0 → 4.1.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.
Files changed (40) hide show
  1. package/README.mdx +58 -7
  2. package/adapter.d.cts +1 -1
  3. package/adapter.d.ts +1 -1
  4. package/bin/den.cjs +3 -3
  5. package/bin/den.js +1 -1
  6. package/builder/index.cjs +2 -2
  7. package/builder/index.d.cts +4 -2
  8. package/builder/index.d.ts +4 -2
  9. package/builder/index.js +1 -1
  10. package/{chunk-2GTQK2PZ.js → chunk-7FOG2MJV.js} +9 -6
  11. package/chunk-A2CYL5LY.js +240 -0
  12. package/chunk-HJFBEJT6.cjs +240 -0
  13. package/{chunk-P4J4M2WZ.cjs → chunk-IATA5QZ7.cjs} +9 -6
  14. package/{define-repository-AO7JI6Cb.d.ts → define-repository-Ck45La_2.d.ts} +1 -1
  15. package/{define-repository-C0MI-J32.d.cts → define-repository-DAyeXF48.d.cts} +1 -1
  16. package/{define-slot-CdWdFM16.d.ts → define-slot-BTlLQ__T.d.ts} +1 -1
  17. package/{define-slot-BEeHNEph.d.cts → define-slot-C6hrdJS3.d.cts} +1 -1
  18. package/define.d.cts +3 -3
  19. package/define.d.ts +3 -3
  20. package/{descriptor-BSaHM5B4.d.ts → descriptor-CNJFrEbS.d.ts} +2 -2
  21. package/{descriptor-C2j6Zz6c.d.cts → descriptor-DmfJP4jQ.d.cts} +2 -2
  22. package/index.d.cts +6 -6
  23. package/index.d.ts +6 -6
  24. package/island/index.d.cts +9 -6
  25. package/island/index.d.ts +9 -6
  26. package/ops/index.cjs +17 -0
  27. package/ops/index.d.cts +39 -0
  28. package/ops/index.d.ts +39 -0
  29. package/ops/index.js +17 -0
  30. package/package.json +25 -16
  31. package/{routes-BvV405k4.d.cts → routes-DQ4ud4bu.d.cts} +1 -1
  32. package/{routes-Di3K_0uQ.d.ts → routes-TkIxQ0Uc.d.ts} +1 -1
  33. package/serve/index.cjs +270 -17
  34. package/serve/index.d.cts +21 -6
  35. package/serve/index.d.ts +21 -6
  36. package/serve/index.js +273 -20
  37. package/{types-BxMQ-VOd.d.cts → types-Ccd5bmt1.d.cts} +23 -4
  38. package/{types-BxMQ-VOd.d.ts → types-Ccd5bmt1.d.ts} +23 -4
  39. package/{view-adapter-DMLlp3Iu.d.cts → view-adapter-CrHh7CjB.d.cts} +2 -2
  40. package/{view-adapter-DNLRSFka.d.ts → view-adapter-DPDvv09J.d.ts} +2 -2
@@ -0,0 +1,240 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
2
+
3
+ var _chunkT5QVCXVBcjs = require('./chunk-T5QVCXVB.cjs');
4
+
5
+ // src/ops/index.ts
6
+ var _http = require('http');
7
+ var _client = require('@prometheus-io/client');
8
+
9
+ // src/ops/metrics.ts
10
+
11
+
12
+ // src/ops/runtime.ts
13
+ var _cluster = require('cluster'); var _cluster2 = _interopRequireDefault(_cluster);
14
+ var _perf_hooks = require('perf_hooks');
15
+
16
+ function collectRuntime(registry, appName) {
17
+ registry.setDefaultLabels({ app: appName, process_role: _cluster2.default.isWorker ? "worker" : "main" });
18
+ _client.collectDefaultMetrics.call(void 0, { register: registry });
19
+ let previousElu = _perf_hooks.performance.eventLoopUtilization();
20
+ new (0, _client.Gauge)({
21
+ aggregator: "max",
22
+ collect() {
23
+ const current = _perf_hooks.performance.eventLoopUtilization();
24
+ this.set(_perf_hooks.performance.eventLoopUtilization(current, previousElu).utilization);
25
+ previousElu = current;
26
+ },
27
+ help: "Event loop utilization since the last scrape; maximum across workers",
28
+ name: "nodejs_eventloop_utilization_ratio",
29
+ registers: [registry]
30
+ });
31
+ let previousCpu = process.cpuUsage();
32
+ let previousTime = _perf_hooks.performance.now();
33
+ new (0, _client.Gauge)({
34
+ aggregator: "sum",
35
+ collect() {
36
+ const currentCpu = process.cpuUsage();
37
+ const currentTime = _perf_hooks.performance.now();
38
+ const elapsed = currentTime - previousTime;
39
+ this.set(
40
+ elapsed > 0 ? (currentCpu.user - previousCpu.user + currentCpu.system - previousCpu.system) / (elapsed * 1e3) : 0
41
+ );
42
+ previousCpu = currentCpu;
43
+ previousTime = currentTime;
44
+ },
45
+ help: "CPU time divided by elapsed wall time since the last scrape",
46
+ name: "process_cpu_utilization_ratio",
47
+ registers: [registry]
48
+ });
49
+ new (0, _client.Gauge)({
50
+ collect() {
51
+ this.set(process.uptime());
52
+ },
53
+ help: "Process uptime in seconds",
54
+ name: "process_uptime_seconds",
55
+ registers: [registry]
56
+ });
57
+ new (0, _client.Gauge)({
58
+ collect() {
59
+ this.set(process.memoryUsage().arrayBuffers);
60
+ },
61
+ help: "Memory used by ArrayBuffers in bytes",
62
+ name: "nodejs_arraybuffer_memory_bytes",
63
+ registers: [registry]
64
+ });
65
+ new (0, _client.Gauge)({
66
+ aggregator: "max",
67
+ collect() {
68
+ this.set(process.resourceUsage().maxRSS * 1024);
69
+ },
70
+ help: "Maximum resident memory in bytes",
71
+ name: "process_max_resident_memory_bytes",
72
+ registers: [registry]
73
+ });
74
+ for (const [name, field] of [
75
+ ["minor_page_faults", "minorPageFault"],
76
+ ["major_page_faults", "majorPageFault"],
77
+ ["filesystem_reads", "fsRead"],
78
+ ["filesystem_writes", "fsWrite"],
79
+ ["voluntary_context_switches", "voluntaryContextSwitches"],
80
+ ["involuntary_context_switches", "involuntaryContextSwitches"]
81
+ ]) {
82
+ new (0, _client.Gauge)({
83
+ collect() {
84
+ this.set(process.resourceUsage()[field]);
85
+ },
86
+ help: `Process ${name} since startup`,
87
+ name: `process_${name}_total`,
88
+ registers: [registry]
89
+ });
90
+ }
91
+ }
92
+
93
+ // src/ops/metrics.ts
94
+ var HTTP_LABELS = ["method", "route", "status"];
95
+ var SECOND_BUCKETS = [5e-3, 0.01, 0.025, 0.05, 0.1, 0.25, 0.5, 1, 2.5, 5, 10, 30];
96
+ var ProcessMetrics = class {
97
+ constructor() {
98
+ this.registry = new (0, _client.Registry)();
99
+ this.runtimeStarted = false;
100
+ }
101
+ counter(name, labelNames = []) {
102
+ const existing = this.registry.getSingleMetric(name);
103
+ if (existing) {
104
+ return existing;
105
+ }
106
+ return new (0, _client.Counter)({ help: name, labelNames, name, registers: [this.registry] });
107
+ }
108
+ histogram(name, labelNames = []) {
109
+ const existing = this.registry.getSingleMetric(name);
110
+ if (existing) {
111
+ return existing;
112
+ }
113
+ return new (0, _client.Histogram)({ buckets: SECOND_BUCKETS, help: name, labelNames, name, registers: [this.registry] });
114
+ }
115
+ /** Полный штатный набор Node/process-метрик клиента и дополнительные данные процесса. */
116
+ startRuntime(appName) {
117
+ if (this.runtimeStarted) {
118
+ return;
119
+ }
120
+ this.runtimeStarted = true;
121
+ collectRuntime(this.registry, appName);
122
+ }
123
+ /** HTTP-измерения с ограниченными метками маршрута; вызывается один раз на запрос. */
124
+ trackHttp(req, res, route) {
125
+ const active = this.registry.getSingleMetric("http_requests_in_flight");
126
+ const gauge = active != null ? active : new (0, _client.Gauge)({
127
+ help: "HTTP requests currently being served",
128
+ name: "http_requests_in_flight",
129
+ registers: [this.registry]
130
+ });
131
+ const started = performance.now();
132
+ gauge.inc();
133
+ let finished = false;
134
+ const finish = () => {
135
+ var _a;
136
+ if (finished) {
137
+ return;
138
+ }
139
+ finished = true;
140
+ gauge.dec();
141
+ const labels = { method: (_a = req.method) != null ? _a : "UNKNOWN", route: route(), status: String(res.statusCode) };
142
+ this.counter("http_requests_total", HTTP_LABELS).inc(labels);
143
+ this.histogram("http_request_duration_seconds", HTTP_LABELS).observe(labels, (performance.now() - started) / 1e3);
144
+ };
145
+ res.once("finish", finish);
146
+ res.once("close", finish);
147
+ }
148
+ };
149
+ var PROCESS_METRICS = /* @__PURE__ */ Symbol.for("@foxford/den/process-metrics");
150
+ var storage = globalThis;
151
+ function getProcessMetrics() {
152
+ var _a;
153
+ return (_a = storage[PROCESS_METRICS]) != null ? _a : storage[PROCESS_METRICS] = new ProcessMetrics();
154
+ }
155
+
156
+ // src/ops/index.ts
157
+ var RESERVED_PATHS = /* @__PURE__ */ new Set(["/healthz", "/livez", "/metrics"]);
158
+ function isOpsPath(url = "/") {
159
+ var _a;
160
+ return RESERVED_PATHS.has((_a = url.split("?")[0]) != null ? _a : "/");
161
+ }
162
+ function clusterMetrics(metrics = getProcessMetrics()) {
163
+ const aggregator = new (0, _client.ClusterRegistry)();
164
+ _client.ClusterRegistry.setRegistries(metrics.registry);
165
+ const lifecycle = aggregator;
166
+ return {
167
+ collect: () => aggregator.clusterMetrics(),
168
+ contentType: metrics.registry.contentType,
169
+ shutdown: () => lifecycle.shutdown()
170
+ };
171
+ }
172
+ function startOpsServer() {
173
+ return _chunkT5QVCXVBcjs.__async.call(void 0, this, arguments, function* (options = {}) {
174
+ var _a;
175
+ const metrics = (_a = options.metrics) != null ? _a : getProcessMetrics();
176
+ const server = _http.createServer.call(void 0, (req, res) => {
177
+ var _a2, _b, _c, _d;
178
+ const path = (_a2 = req.url) == null ? void 0 : _a2.split("?")[0];
179
+ res.setHeader("cache-control", "no-store");
180
+ if (req.method !== "GET" || !["/healthz", "/livez", "/metrics"].includes(path != null ? path : "")) {
181
+ res.writeHead(404).end();
182
+ return;
183
+ }
184
+ if (path !== "/metrics") {
185
+ res.writeHead(path === "/livez" && ((_b = options.isLive) == null ? void 0 : _b.call(options)) === false ? 503 : 200, {
186
+ "content-type": "text/plain; charset=utf-8"
187
+ }).end("ok");
188
+ return;
189
+ }
190
+ void ((_d = (_c = options.collect) == null ? void 0 : _c.call(options)) != null ? _d : metrics.registry.metrics()).then((body) => {
191
+ var _a3;
192
+ if (!res.destroyed) {
193
+ res.writeHead(200, { "content-type": (_a3 = options.contentType) != null ? _a3 : metrics.registry.contentType }).end(body);
194
+ }
195
+ }).catch(() => {
196
+ if (!res.destroyed) {
197
+ res.writeHead(503).end("metrics unavailable");
198
+ }
199
+ });
200
+ });
201
+ yield new Promise((resolve, reject) => {
202
+ var _a2, _b;
203
+ server.once("error", reject);
204
+ server.listen((_a2 = options.port) != null ? _a2 : 9090, (_b = options.host) != null ? _b : "0.0.0.0", () => {
205
+ server.removeListener("error", reject);
206
+ resolve();
207
+ });
208
+ });
209
+ return server;
210
+ });
211
+ }
212
+ function closeHttpServer(server, timeoutMs = 5e3) {
213
+ return _chunkT5QVCXVBcjs.__async.call(void 0, this, null, function* () {
214
+ if (!server.listening) {
215
+ return;
216
+ }
217
+ yield new Promise((resolve, reject) => {
218
+ const timer = setTimeout(() => server.closeAllConnections(), timeoutMs);
219
+ timer.unref();
220
+ server.close((error) => {
221
+ clearTimeout(timer);
222
+ if (error) {
223
+ reject(error);
224
+ } else {
225
+ resolve();
226
+ }
227
+ });
228
+ server.closeIdleConnections();
229
+ });
230
+ });
231
+ }
232
+
233
+
234
+
235
+
236
+
237
+
238
+
239
+
240
+ exports.ProcessMetrics = ProcessMetrics; exports.getProcessMetrics = getProcessMetrics; exports.isOpsPath = isOpsPath; exports.clusterMetrics = clusterMetrics; exports.startOpsServer = startOpsServer; exports.closeHttpServer = closeHttpServer;
@@ -66,7 +66,7 @@ function collectAssets(outDir, base) {
66
66
  }
67
67
 
68
68
  // src/serve/port.ts
69
- var DEFAULT_PORT = 3e3;
69
+ var DEFAULT_PORT = 8080;
70
70
  function resolvePort(declared) {
71
71
  var _a, _b;
72
72
  return Number((_b = (_a = process.env["PORT"]) != null ? _a : declared) != null ? _b : DEFAULT_PORT);
@@ -134,7 +134,7 @@ function generateServerProcess(configPath, base, mode) {
134
134
  ` : "";
135
135
  return `import { fileURLToPath } from 'node:url'
136
136
 
137
- import { loadAppEnv, serveApp } from '@foxford/den/serve'
137
+ import { loadAppEnv, serveAppProcess } from '@foxford/den/serve'
138
138
 
139
139
  import app from ${JSON.stringify(VIRTUAL_SERVER_APP)}
140
140
  import config from ${JSON.stringify(configPath)}
@@ -142,10 +142,12 @@ import config from ${JSON.stringify(configPath)}
142
142
  // \u0423\u043C\u043E\u043B\u0447\u0430\u043D\u0438\u044F \u043E\u043A\u0440\u0443\u0436\u0435\u043D\u0438\u044F \u2014 \u0434\u043E \u043F\u0435\u0440\u0432\u043E\u0433\u043E \u0447\u0442\u0435\u043D\u0438\u044F: \u043F\u043E\u0440\u0442 \u0438 \u0430\u0434\u0440\u0435\u0441\u0430 \u0447\u0438\u0442\u0430\u044E\u0442\u0441\u044F \u043D\u0438\u0436\u0435
143
143
  loadAppEnv(fileURLToPath(new URL('..', import.meta.url)))
144
144
 
145
- await serveApp(app, {
145
+ await serveAppProcess(app, {
146
146
  ${assets} configure: config.server?.configure,
147
147
  host: process.env.HOST,
148
- port: Number(process.env.PORT ?? config.server?.port ?? ${String(DEFAULT_PORT)}),
148
+ ops: { host: process.env.OPS_HOST, port: Number(process.env.SERVICE_PORT ?? ${mode === "development" ? "config.server?.opsPort ?? 9090" : "9090"}) },
149
+ port: Number(process.env.PORT ?? ${mode === "development" ? "config.server?.port ?? " : ""}${String(DEFAULT_PORT)}),
150
+ workers: Number(process.env.WORKERS ?? 1),
149
151
  })
150
152
  `;
151
153
  }
@@ -201,7 +203,8 @@ function loadAppConfig(root) {
201
203
  configFile: false,
202
204
  logLevel: "silent",
203
205
  root,
204
- server: { middlewareMode: true }
206
+ // Этот сервер только загружает конфиг; пересборкой в dev управляет watchSources.
207
+ server: { middlewareMode: true, watch: null }
205
208
  });
206
209
  try {
207
210
  const loaded = yield server.ssrLoadModule(configPath);
@@ -324,7 +327,7 @@ var _url = require('url');
324
327
  var _os = require('os'); var _os2 = _interopRequireDefault(_os);
325
328
  var TOOL = "den";
326
329
  var PAD = 11;
327
- var ENDPOINTS = ["/_render?url=<\u043F\u0443\u0442\u044C>", "/_routes", "/_health"];
330
+ var ENDPOINTS = ["/_render?url=<\u043F\u0443\u0442\u044C>", "/_routes"];
328
331
  var OUTPUTS = ["build/client", "build/server", "build/server.mjs"];
329
332
  var SHORTCUTS = [
330
333
  { key: "r", title: "\u043F\u0435\u0440\u0435\u0441\u043E\u0431\u0440\u0430\u0442\u044C" },
@@ -1,4 +1,4 @@
1
- import { a as DefineServiceOptions, S as ServiceDefinition, b as DefineViewModelOptions, V as ViewModelDefinition, D as DefineRepositoryOptions, d as RepositoryDefinition } from './types-BxMQ-VOd.js';
1
+ import { a as DefineServiceOptions, S as ServiceDefinition, b as DefineViewModelOptions, V as ViewModelDefinition, D as DefineRepositoryOptions, d as RepositoryDefinition } from './types-Ccd5bmt1.js';
2
2
  import { Token } from '@foxford/ioc';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { a as DefineServiceOptions, S as ServiceDefinition, b as DefineViewModelOptions, V as ViewModelDefinition, D as DefineRepositoryOptions, d as RepositoryDefinition } from './types-BxMQ-VOd.cjs';
1
+ import { a as DefineServiceOptions, S as ServiceDefinition, b as DefineViewModelOptions, V as ViewModelDefinition, D as DefineRepositoryOptions, d as RepositoryDefinition } from './types-Ccd5bmt1.cjs';
2
2
  import { Token } from '@foxford/ioc';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { c as Definition, L as LayerDefinition } from './types-BxMQ-VOd.js';
1
+ import { c as Definition, L as LayerDefinition } from './types-Ccd5bmt1.js';
2
2
  import { Container } from '@foxford/ioc';
3
3
 
4
4
  /**
@@ -1,4 +1,4 @@
1
- import { c as Definition, L as LayerDefinition } from './types-BxMQ-VOd.cjs';
1
+ import { c as Definition, L as LayerDefinition } from './types-Ccd5bmt1.cjs';
2
2
  import { Container } from '@foxford/ioc';
3
3
 
4
4
  /**
package/define.d.cts CHANGED
@@ -1,6 +1,6 @@
1
- export { d as defineRepository, a as defineService, b as defineViewModel } from './define-repository-C0MI-J32.cjs';
2
- export { D as DefineSlotOptions, S as SlotDefinition, d as defineSlot } from './define-slot-BEeHNEph.cjs';
3
- export { D as DefineRepositoryOptions, a as DefineServiceOptions, b as DefineViewModelOptions, c as Definition, d as RepositoryDefinition, S as ServiceDefinition, e as SlotEntry, f as SlotRegistry, g as SlotRegistryToken, V as ViewModelDefinition } from './types-BxMQ-VOd.cjs';
1
+ export { d as defineRepository, a as defineService, b as defineViewModel } from './define-repository-DAyeXF48.cjs';
2
+ export { D as DefineSlotOptions, S as SlotDefinition, d as defineSlot } from './define-slot-C6hrdJS3.cjs';
3
+ export { D as DefineRepositoryOptions, a as DefineServiceOptions, b as DefineViewModelOptions, c as Definition, d as RepositoryDefinition, S as ServiceDefinition, e as SlotEntry, f as SlotRegistry, g as SlotRegistryToken, V as ViewModelDefinition } from './types-Ccd5bmt1.cjs';
4
4
  import { Token, Container } from '@foxford/ioc';
5
5
  import { HierarchicalLogger } from '@foxford/logger';
6
6
 
package/define.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- export { d as defineRepository, a as defineService, b as defineViewModel } from './define-repository-AO7JI6Cb.js';
2
- export { D as DefineSlotOptions, S as SlotDefinition, d as defineSlot } from './define-slot-CdWdFM16.js';
3
- export { D as DefineRepositoryOptions, a as DefineServiceOptions, b as DefineViewModelOptions, c as Definition, d as RepositoryDefinition, S as ServiceDefinition, e as SlotEntry, f as SlotRegistry, g as SlotRegistryToken, V as ViewModelDefinition } from './types-BxMQ-VOd.js';
1
+ export { d as defineRepository, a as defineService, b as defineViewModel } from './define-repository-Ck45La_2.js';
2
+ export { D as DefineSlotOptions, S as SlotDefinition, d as defineSlot } from './define-slot-BTlLQ__T.js';
3
+ export { D as DefineRepositoryOptions, a as DefineServiceOptions, b as DefineViewModelOptions, c as Definition, d as RepositoryDefinition, S as ServiceDefinition, e as SlotEntry, f as SlotRegistry, g as SlotRegistryToken, V as ViewModelDefinition } from './types-Ccd5bmt1.js';
4
4
  import { Token, Container } from '@foxford/ioc';
5
5
  import { HierarchicalLogger } from '@foxford/logger';
6
6
 
@@ -1,5 +1,5 @@
1
- import { S as SlotDefinition } from './define-slot-CdWdFM16.js';
2
- import { L as LayerDefinition, c as Definition } from './types-BxMQ-VOd.js';
1
+ import { S as SlotDefinition } from './define-slot-BTlLQ__T.js';
2
+ import { L as LayerDefinition, c as Definition } from './types-Ccd5bmt1.js';
3
3
  import { Token } from '@foxford/ioc';
4
4
 
5
5
  /**
@@ -1,5 +1,5 @@
1
- import { S as SlotDefinition } from './define-slot-BEeHNEph.cjs';
2
- import { L as LayerDefinition, c as Definition } from './types-BxMQ-VOd.cjs';
1
+ import { S as SlotDefinition } from './define-slot-C6hrdJS3.cjs';
2
+ import { L as LayerDefinition, c as Definition } from './types-Ccd5bmt1.cjs';
3
3
  import { Token } from '@foxford/ioc';
4
4
 
5
5
  /**
package/index.d.cts CHANGED
@@ -1,11 +1,11 @@
1
- import { C as Core, j as ContainerManager, R as RequestContext, k as GuardRunner, l as Guard, m as GuardResult, N as NavigationManager, n as NavigationEntry, o as NavigationInterceptor, p as Disposable, q as LeaveGuardResult, r as StateSerializer, s as DefineGuardOptions, G as GuardDefinition, E as ExtensionConfig, t as DefineExtensionOptions, u as ExtensionDefinition, A as ActionGuard, v as DefineActionGuardOptions, w as ActionGuardDefinition, x as LayoutConfig, y as DefineLayoutOptions, z as LayoutDefinition, h as LayerConfig, B as DefineLayerOptions, L as LayerDefinition } from './types-BxMQ-VOd.cjs';
2
- export { F as Activatable, H as ActivatableToken, I as ContainerManagerToken, D as DefineRepositoryOptions, a as DefineServiceOptions, b as DefineViewModelOptions, c as Definition, J as GuardRunnerToken, K as NavigationManagerToken, d as RepositoryDefinition, i as RequestContextToken, S as ServiceDefinition, e as SlotEntry, f as SlotRegistry, g as SlotRegistryToken, M as StateCache, O as StateParticipant, P as StateRegistry, Q as StateRegistryToken, T as StateSerializerToken, V as ViewModelDefinition } from './types-BxMQ-VOd.cjs';
1
+ import { C as Core, j as ContainerManager, R as RequestContext, k as GuardRunner, l as Guard, m as GuardResult, N as NavigationManager, n as NavigationEntry, o as NavigationInterceptor, p as Disposable, q as LeaveGuardResult, r as StateSerializer, s as DefineGuardOptions, G as GuardDefinition, E as ExtensionConfig, t as DefineExtensionOptions, u as ExtensionDefinition, A as ActionGuard, v as DefineActionGuardOptions, w as ActionGuardDefinition, x as LayoutConfig, y as DefineLayoutOptions, z as LayoutDefinition, h as LayerConfig, B as DefineLayerOptions, L as LayerDefinition } from './types-Ccd5bmt1.cjs';
2
+ export { F as Activatable, H as ActivatableToken, I as ContainerManagerToken, D as DefineRepositoryOptions, a as DefineServiceOptions, b as DefineViewModelOptions, c as Definition, J as GuardRunnerToken, K as NavigationManagerToken, d as RepositoryDefinition, i as RequestContextToken, S as ServiceDefinition, e as SlotEntry, f as SlotRegistry, g as SlotRegistryToken, M as StateCache, O as StateParticipant, P as StateRegistry, Q as StateRegistryToken, T as StateSerializerToken, V as ViewModelDefinition } from './types-Ccd5bmt1.cjs';
3
3
  import { Container, Token } from '@foxford/ioc';
4
4
  import { DefinitionResolver } from './adapter.cjs';
5
- export { d as defineRepository, a as defineService, b as defineViewModel } from './define-repository-C0MI-J32.cjs';
6
- export { D as DefineSlotOptions, S as SlotDefinition, d as defineSlot } from './define-slot-BEeHNEph.cjs';
7
- export { V as ViewAdapter, a as ViewLayerDefinition, b as ViewLayerToken } from './view-adapter-DMLlp3Iu.cjs';
8
- import './descriptor-C2j6Zz6c.cjs';
5
+ export { d as defineRepository, a as defineService, b as defineViewModel } from './define-repository-DAyeXF48.cjs';
6
+ export { D as DefineSlotOptions, S as SlotDefinition, d as defineSlot } from './define-slot-C6hrdJS3.cjs';
7
+ export { V as ViewAdapter, a as ViewLayerDefinition, b as ViewLayerToken } from './view-adapter-CrHh7CjB.cjs';
8
+ import './descriptor-DmfJP4jQ.cjs';
9
9
  import './server-render-CocWXQKC.cjs';
10
10
 
11
11
  /**
package/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { C as Core, j as ContainerManager, R as RequestContext, k as GuardRunner, l as Guard, m as GuardResult, N as NavigationManager, n as NavigationEntry, o as NavigationInterceptor, p as Disposable, q as LeaveGuardResult, r as StateSerializer, s as DefineGuardOptions, G as GuardDefinition, E as ExtensionConfig, t as DefineExtensionOptions, u as ExtensionDefinition, A as ActionGuard, v as DefineActionGuardOptions, w as ActionGuardDefinition, x as LayoutConfig, y as DefineLayoutOptions, z as LayoutDefinition, h as LayerConfig, B as DefineLayerOptions, L as LayerDefinition } from './types-BxMQ-VOd.js';
2
- export { F as Activatable, H as ActivatableToken, I as ContainerManagerToken, D as DefineRepositoryOptions, a as DefineServiceOptions, b as DefineViewModelOptions, c as Definition, J as GuardRunnerToken, K as NavigationManagerToken, d as RepositoryDefinition, i as RequestContextToken, S as ServiceDefinition, e as SlotEntry, f as SlotRegistry, g as SlotRegistryToken, M as StateCache, O as StateParticipant, P as StateRegistry, Q as StateRegistryToken, T as StateSerializerToken, V as ViewModelDefinition } from './types-BxMQ-VOd.js';
1
+ import { C as Core, j as ContainerManager, R as RequestContext, k as GuardRunner, l as Guard, m as GuardResult, N as NavigationManager, n as NavigationEntry, o as NavigationInterceptor, p as Disposable, q as LeaveGuardResult, r as StateSerializer, s as DefineGuardOptions, G as GuardDefinition, E as ExtensionConfig, t as DefineExtensionOptions, u as ExtensionDefinition, A as ActionGuard, v as DefineActionGuardOptions, w as ActionGuardDefinition, x as LayoutConfig, y as DefineLayoutOptions, z as LayoutDefinition, h as LayerConfig, B as DefineLayerOptions, L as LayerDefinition } from './types-Ccd5bmt1.js';
2
+ export { F as Activatable, H as ActivatableToken, I as ContainerManagerToken, D as DefineRepositoryOptions, a as DefineServiceOptions, b as DefineViewModelOptions, c as Definition, J as GuardRunnerToken, K as NavigationManagerToken, d as RepositoryDefinition, i as RequestContextToken, S as ServiceDefinition, e as SlotEntry, f as SlotRegistry, g as SlotRegistryToken, M as StateCache, O as StateParticipant, P as StateRegistry, Q as StateRegistryToken, T as StateSerializerToken, V as ViewModelDefinition } from './types-Ccd5bmt1.js';
3
3
  import { Container, Token } from '@foxford/ioc';
4
4
  import { DefinitionResolver } from './adapter.js';
5
- export { d as defineRepository, a as defineService, b as defineViewModel } from './define-repository-AO7JI6Cb.js';
6
- export { D as DefineSlotOptions, S as SlotDefinition, d as defineSlot } from './define-slot-CdWdFM16.js';
7
- export { V as ViewAdapter, a as ViewLayerDefinition, b as ViewLayerToken } from './view-adapter-DNLRSFka.js';
8
- import './descriptor-BSaHM5B4.js';
5
+ export { d as defineRepository, a as defineService, b as defineViewModel } from './define-repository-Ck45La_2.js';
6
+ export { D as DefineSlotOptions, S as SlotDefinition, d as defineSlot } from './define-slot-BTlLQ__T.js';
7
+ export { V as ViewAdapter, a as ViewLayerDefinition, b as ViewLayerToken } from './view-adapter-DPDvv09J.js';
8
+ import './descriptor-CNJFrEbS.js';
9
9
  import './server-render-CocWXQKC.js';
10
10
 
11
11
  /**
@@ -1,11 +1,11 @@
1
- import { A as AppAssets, I as IslandDescriptor } from '../descriptor-C2j6Zz6c.cjs';
2
- import { R as RequestContext, c as Definition } from '../types-BxMQ-VOd.cjs';
3
- export { i as RequestContextToken } from '../types-BxMQ-VOd.cjs';
1
+ import { A as AppAssets, I as IslandDescriptor } from '../descriptor-DmfJP4jQ.cjs';
2
+ import { R as RequestContext, c as Definition } from '../types-Ccd5bmt1.cjs';
3
+ export { i as RequestContextToken } from '../types-Ccd5bmt1.cjs';
4
4
  import { Container, Token } from '@foxford/ioc';
5
- export { A as AppRoute, R as RouteDeclaration, a as RouteMatch, m as matchRoute, n as normalizeRoutes, p as pathPattern } from '../routes-BvV405k4.cjs';
5
+ export { A as AppRoute, R as RouteDeclaration, a as RouteMatch, m as matchRoute, n as normalizeRoutes, p as pathPattern } from '../routes-DQ4ud4bu.cjs';
6
6
  export { R as RenderTree, a as ServerRender, S as ServerRenderResult } from '../server-render-CocWXQKC.cjs';
7
- export { R as RenderIslandOptions, V as ViewAdapter, a as ViewLayerDefinition, b as ViewLayerToken, r as resolveViewAdapter, v as viewAdapterOf } from '../view-adapter-DMLlp3Iu.cjs';
8
- import '../define-slot-BEeHNEph.cjs';
7
+ export { R as RenderIslandOptions, V as ViewAdapter, a as ViewLayerDefinition, b as ViewLayerToken, r as resolveViewAdapter, v as viewAdapterOf } from '../view-adapter-CrHh7CjB.cjs';
8
+ import '../define-slot-C6hrdJS3.cjs';
9
9
 
10
10
  /** Вклад приложения в `<head>` документа. */
11
11
  interface DocumentHead {
@@ -278,6 +278,9 @@ declare function parseCookieHeader(header: string | undefined): Record<string, s
278
278
  /**
279
279
  * Реквизиты запроса в браузере: куки документа, заголовков нет.
280
280
  *
281
+ * Реквизитов бэкенда тоже нет: в браузере их подставляет он сам — куку по своим правилам,
282
+ * остальное ему предъявлять нечем и незачем.
283
+ *
281
284
  * Биндится в контейнер острова при сборке, чтобы единица, требующая `RequestContextToken`,
282
285
  * резолвилась на обеих сторонах одинаково; иначе приложению пришлось бы держать две
283
286
  * реализации и переключать их по среде.
package/island/index.d.ts CHANGED
@@ -1,11 +1,11 @@
1
- import { A as AppAssets, I as IslandDescriptor } from '../descriptor-BSaHM5B4.js';
2
- import { R as RequestContext, c as Definition } from '../types-BxMQ-VOd.js';
3
- export { i as RequestContextToken } from '../types-BxMQ-VOd.js';
1
+ import { A as AppAssets, I as IslandDescriptor } from '../descriptor-CNJFrEbS.js';
2
+ import { R as RequestContext, c as Definition } from '../types-Ccd5bmt1.js';
3
+ export { i as RequestContextToken } from '../types-Ccd5bmt1.js';
4
4
  import { Container, Token } from '@foxford/ioc';
5
- export { A as AppRoute, R as RouteDeclaration, a as RouteMatch, m as matchRoute, n as normalizeRoutes, p as pathPattern } from '../routes-Di3K_0uQ.js';
5
+ export { A as AppRoute, R as RouteDeclaration, a as RouteMatch, m as matchRoute, n as normalizeRoutes, p as pathPattern } from '../routes-TkIxQ0Uc.js';
6
6
  export { R as RenderTree, a as ServerRender, S as ServerRenderResult } from '../server-render-CocWXQKC.js';
7
- export { R as RenderIslandOptions, V as ViewAdapter, a as ViewLayerDefinition, b as ViewLayerToken, r as resolveViewAdapter, v as viewAdapterOf } from '../view-adapter-DNLRSFka.js';
8
- import '../define-slot-CdWdFM16.js';
7
+ export { R as RenderIslandOptions, V as ViewAdapter, a as ViewLayerDefinition, b as ViewLayerToken, r as resolveViewAdapter, v as viewAdapterOf } from '../view-adapter-DPDvv09J.js';
8
+ import '../define-slot-BTlLQ__T.js';
9
9
 
10
10
  /** Вклад приложения в `<head>` документа. */
11
11
  interface DocumentHead {
@@ -278,6 +278,9 @@ declare function parseCookieHeader(header: string | undefined): Record<string, s
278
278
  /**
279
279
  * Реквизиты запроса в браузере: куки документа, заголовков нет.
280
280
  *
281
+ * Реквизитов бэкенда тоже нет: в браузере их подставляет он сам — куку по своим правилам,
282
+ * остальное ему предъявлять нечем и незачем.
283
+ *
281
284
  * Биндится в контейнер острова при сборке, чтобы единица, требующая `RequestContextToken`,
282
285
  * резолвилась на обеих сторонах одинаково; иначе приложению пришлось бы держать две
283
286
  * реализации и переключать их по среде.
package/ops/index.cjs ADDED
@@ -0,0 +1,17 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+
7
+
8
+ var _chunkHJFBEJT6cjs = require('../chunk-HJFBEJT6.cjs');
9
+ require('../chunk-T5QVCXVB.cjs');
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+ exports.ProcessMetrics = _chunkHJFBEJT6cjs.ProcessMetrics; exports.closeHttpServer = _chunkHJFBEJT6cjs.closeHttpServer; exports.clusterMetrics = _chunkHJFBEJT6cjs.clusterMetrics; exports.getProcessMetrics = _chunkHJFBEJT6cjs.getProcessMetrics; exports.isOpsPath = _chunkHJFBEJT6cjs.isOpsPath; exports.startOpsServer = _chunkHJFBEJT6cjs.startOpsServer;
@@ -0,0 +1,39 @@
1
+ import * as _prometheus_io_client from '@prometheus-io/client';
2
+ import { Registry, Counter, Histogram } from '@prometheus-io/client';
3
+ import { IncomingMessage, ServerResponse, Server } from 'node:http';
4
+
5
+ /** Реестр одного процесса; точкам измерений не нужен включённый Sentry. */
6
+ declare class ProcessMetrics {
7
+ readonly registry: Registry<_prometheus_io_client.RegistryContentType>;
8
+ private runtimeStarted;
9
+ counter(name: string, labelNames?: string[]): Counter<string>;
10
+ histogram(name: string, labelNames?: string[]): Histogram<string>;
11
+ /** Полный штатный набор Node/process-метрик клиента и дополнительные данные процесса. */
12
+ startRuntime(appName: string): void;
13
+ /** HTTP-измерения с ограниченными метками маршрута; вызывается один раз на запрос. */
14
+ trackHttp(req: IncomingMessage, res: ServerResponse, route: () => string): void;
15
+ }
16
+ declare function getProcessMetrics(): ProcessMetrics;
17
+
18
+ /** Служебный путь без query; работает и с относительным URL node:http. */
19
+ declare function isOpsPath(url?: string): boolean;
20
+ /** Подключает штатную межпроцессную агрегацию; вызывается и в primary, и в воркерах. */
21
+ declare function clusterMetrics(metrics?: ProcessMetrics): {
22
+ contentType: string;
23
+ collect: () => Promise<string>;
24
+ shutdown: () => Promise<void>;
25
+ };
26
+ interface OpsOptions {
27
+ port?: number;
28
+ host?: string;
29
+ metrics?: ProcessMetrics;
30
+ collect?: () => Promise<string>;
31
+ contentType?: string;
32
+ isLive?: () => boolean;
33
+ }
34
+ /** Второй HTTP-сервер в том же приложении. GET /healthz и /livez отвечают 200. */
35
+ declare function startOpsServer(options?: OpsOptions): Promise<Server>;
36
+ /** Ограниченное по времени закрытие обоих видов серверов node:http. */
37
+ declare function closeHttpServer(server: Server, timeoutMs?: number): Promise<void>;
38
+
39
+ export { type OpsOptions, ProcessMetrics, closeHttpServer, clusterMetrics, getProcessMetrics, isOpsPath, startOpsServer };
package/ops/index.d.ts ADDED
@@ -0,0 +1,39 @@
1
+ import * as _prometheus_io_client from '@prometheus-io/client';
2
+ import { Registry, Counter, Histogram } from '@prometheus-io/client';
3
+ import { IncomingMessage, ServerResponse, Server } from 'node:http';
4
+
5
+ /** Реестр одного процесса; точкам измерений не нужен включённый Sentry. */
6
+ declare class ProcessMetrics {
7
+ readonly registry: Registry<_prometheus_io_client.RegistryContentType>;
8
+ private runtimeStarted;
9
+ counter(name: string, labelNames?: string[]): Counter<string>;
10
+ histogram(name: string, labelNames?: string[]): Histogram<string>;
11
+ /** Полный штатный набор Node/process-метрик клиента и дополнительные данные процесса. */
12
+ startRuntime(appName: string): void;
13
+ /** HTTP-измерения с ограниченными метками маршрута; вызывается один раз на запрос. */
14
+ trackHttp(req: IncomingMessage, res: ServerResponse, route: () => string): void;
15
+ }
16
+ declare function getProcessMetrics(): ProcessMetrics;
17
+
18
+ /** Служебный путь без query; работает и с относительным URL node:http. */
19
+ declare function isOpsPath(url?: string): boolean;
20
+ /** Подключает штатную межпроцессную агрегацию; вызывается и в primary, и в воркерах. */
21
+ declare function clusterMetrics(metrics?: ProcessMetrics): {
22
+ contentType: string;
23
+ collect: () => Promise<string>;
24
+ shutdown: () => Promise<void>;
25
+ };
26
+ interface OpsOptions {
27
+ port?: number;
28
+ host?: string;
29
+ metrics?: ProcessMetrics;
30
+ collect?: () => Promise<string>;
31
+ contentType?: string;
32
+ isLive?: () => boolean;
33
+ }
34
+ /** Второй HTTP-сервер в том же приложении. GET /healthz и /livez отвечают 200. */
35
+ declare function startOpsServer(options?: OpsOptions): Promise<Server>;
36
+ /** Ограниченное по времени закрытие обоих видов серверов node:http. */
37
+ declare function closeHttpServer(server: Server, timeoutMs?: number): Promise<void>;
38
+
39
+ export { type OpsOptions, ProcessMetrics, closeHttpServer, clusterMetrics, getProcessMetrics, isOpsPath, startOpsServer };
package/ops/index.js ADDED
@@ -0,0 +1,17 @@
1
+ import {
2
+ ProcessMetrics,
3
+ closeHttpServer,
4
+ clusterMetrics,
5
+ getProcessMetrics,
6
+ isOpsPath,
7
+ startOpsServer
8
+ } from "../chunk-A2CYL5LY.js";
9
+ import "../chunk-6FNC3XMI.js";
10
+ export {
11
+ ProcessMetrics,
12
+ closeHttpServer,
13
+ clusterMetrics,
14
+ getProcessMetrics,
15
+ isOpsPath,
16
+ startOpsServer
17
+ };