@kici-dev/shared 0.1.26 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/agent-platform.d.ts +32 -0
- package/dist/agent-platform.js +27 -0
- package/dist/agent-platform.test.d.ts +2 -0
- package/dist/ci-env.d.ts +2 -0
- package/dist/ci-env.js +3 -0
- package/dist/cold-store/bucket.d.ts +1 -1
- package/dist/cold-store/cold-store.d.ts +24 -1
- package/dist/cold-store/cold-store.js +17 -5
- package/dist/cold-store/index.js +1 -1
- package/dist/db-admin.d.ts +206 -65
- package/dist/db-admin.js +236 -122
- package/dist/db-collation.d.ts +49 -0
- package/dist/db-collation.js +68 -1
- package/dist/db.d.ts +34 -0
- package/dist/db.js +30 -1
- package/dist/diagnostics/bundle-archive.js +5 -5
- package/dist/env/allowlist.d.ts +5 -0
- package/dist/env/allowlist.js +6 -1
- package/dist/env/define-env.d.ts +19 -2
- package/dist/env/define-env.js +18 -3
- package/dist/env/logger-env.d.ts +11 -9
- package/dist/env/logger-env.js +25 -9
- package/dist/idempotency-files.d.ts +7 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +6 -4
- package/dist/telemetry/init.d.ts +18 -7
- package/dist/telemetry/init.js +36 -11
- package/dist/tmp-dir.d.ts +14 -0
- package/dist/tmp-dir.js +13 -0
- package/dist/tmp-dir.test.d.ts +2 -0
- package/dist/tmp.d.ts +2 -0
- package/dist/tmp.js +3 -0
- package/package.json +26 -17
- package/sbom.spdx.json +1222 -1618
package/dist/telemetry/init.d.ts
CHANGED
|
@@ -17,14 +17,25 @@ export interface TelemetryConfig {
|
|
|
17
17
|
export declare function initTelemetry(config: TelemetryConfig): NodeSDK;
|
|
18
18
|
/** Get the PrometheusExporter instance created by initTelemetry(). */
|
|
19
19
|
export declare function getPrometheusExporter(): PrometheusExporter | undefined;
|
|
20
|
+
/** One instrument's identity plus the descriptor facts that decide its wire kind. */
|
|
21
|
+
export interface RuntimeMetricDescriptor {
|
|
22
|
+
name: string;
|
|
23
|
+
dataPointType: number;
|
|
24
|
+
isMonotonic?: boolean;
|
|
25
|
+
}
|
|
20
26
|
/**
|
|
21
|
-
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
24
|
-
* catalog drift guard (`scripts/generate-prometheus.ts`). It deliberately
|
|
25
|
-
* does NOT touch the singleton `_prometheusExporter` — it spins up an
|
|
26
|
-
* isolated SDK so it can be called from tooling without affecting a running
|
|
27
|
-
* service's telemetry.
|
|
27
|
+
* The sorted set of dotted instrument names `RuntimeNodeInstrumentation`
|
|
28
|
+
* emits. This is the ground truth for the curated runtime-metrics catalog
|
|
29
|
+
* drift guard (`scripts/generate-prometheus.ts`).
|
|
28
30
|
*/
|
|
29
31
|
export declare function collectRuntimeMetricNames(): Promise<string[]>;
|
|
32
|
+
/**
|
|
33
|
+
* Like `collectRuntimeMetricNames`, but also returns each instrument's
|
|
34
|
+
* descriptor type and monotonicity — the facts that decide the wire kind the
|
|
35
|
+
* Platform admits it as. Ground truth for the drift guard's kind check.
|
|
36
|
+
*
|
|
37
|
+
* Deliberately not exported from the package barrel: it is tooling ground truth,
|
|
38
|
+
* and `@kici-dev/shared` is a published surface.
|
|
39
|
+
*/
|
|
40
|
+
export declare function collectRuntimeMetricDescriptors(): Promise<RuntimeMetricDescriptor[]>;
|
|
30
41
|
//# sourceMappingURL=init.d.ts.map
|
package/dist/telemetry/init.js
CHANGED
|
@@ -38,14 +38,12 @@ function getPrometheusExporter() {
|
|
|
38
38
|
}
|
|
39
39
|
/**
|
|
40
40
|
* Boot `RuntimeNodeInstrumentation` standalone, exercise the event loop and
|
|
41
|
-
* garbage collector, collect once, and return
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* isolated SDK so it can be called from tooling without affecting a running
|
|
46
|
-
* service's telemetry.
|
|
41
|
+
* garbage collector, collect once, and return one descriptor per instrument it
|
|
42
|
+
* emitted. It deliberately does NOT touch the singleton `_prometheusExporter` —
|
|
43
|
+
* it spins up an isolated SDK so it can be called from tooling without
|
|
44
|
+
* affecting a running service's telemetry.
|
|
47
45
|
*/
|
|
48
|
-
async function
|
|
46
|
+
async function probeRuntimeInstruments() {
|
|
49
47
|
const exporter = new PrometheusExporter({ preventServerStart: true });
|
|
50
48
|
const sdk = new NodeSDK({
|
|
51
49
|
resource: resourceFromAttributes({ [ATTR_SERVICE_NAME]: "runtime-metrics-drift-guard" }),
|
|
@@ -61,13 +59,40 @@ async function collectRuntimeMetricNames() {
|
|
|
61
59
|
}
|
|
62
60
|
if (typeof global.gc === "function") global.gc();
|
|
63
61
|
await new Promise((r) => setTimeout(r, 500));
|
|
64
|
-
const
|
|
62
|
+
const descriptors = [];
|
|
65
63
|
const { resourceMetrics } = await exporter.collect();
|
|
66
|
-
for (const scopeMetrics of resourceMetrics.scopeMetrics) for (const metric of scopeMetrics.metrics)
|
|
64
|
+
for (const scopeMetrics of resourceMetrics.scopeMetrics) for (const metric of scopeMetrics.metrics) {
|
|
65
|
+
const m = metric;
|
|
66
|
+
descriptors.push({
|
|
67
|
+
name: m.descriptor.name,
|
|
68
|
+
dataPointType: m.dataPointType,
|
|
69
|
+
...m.isMonotonic === void 0 ? {} : { isMonotonic: m.isMonotonic }
|
|
70
|
+
});
|
|
71
|
+
}
|
|
67
72
|
await sdk.shutdown();
|
|
68
|
-
return
|
|
73
|
+
return descriptors;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* The sorted set of dotted instrument names `RuntimeNodeInstrumentation`
|
|
77
|
+
* emits. This is the ground truth for the curated runtime-metrics catalog
|
|
78
|
+
* drift guard (`scripts/generate-prometheus.ts`).
|
|
79
|
+
*/
|
|
80
|
+
async function collectRuntimeMetricNames() {
|
|
81
|
+
const descriptors = await probeRuntimeInstruments();
|
|
82
|
+
return [...new Set(descriptors.map((d) => d.name))].sort();
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Like `collectRuntimeMetricNames`, but also returns each instrument's
|
|
86
|
+
* descriptor type and monotonicity — the facts that decide the wire kind the
|
|
87
|
+
* Platform admits it as. Ground truth for the drift guard's kind check.
|
|
88
|
+
*
|
|
89
|
+
* Deliberately not exported from the package barrel: it is tooling ground truth,
|
|
90
|
+
* and `@kici-dev/shared` is a published surface.
|
|
91
|
+
*/
|
|
92
|
+
async function collectRuntimeMetricDescriptors() {
|
|
93
|
+
return (await probeRuntimeInstruments()).sort((a, b) => a.name.localeCompare(b.name));
|
|
69
94
|
}
|
|
70
95
|
//#endregion
|
|
71
|
-
export { collectRuntimeMetricNames, getPrometheusExporter, initTelemetry };
|
|
96
|
+
export { collectRuntimeMetricDescriptors, collectRuntimeMetricNames, getPrometheusExporter, initTelemetry };
|
|
72
97
|
|
|
73
98
|
//# sourceMappingURL=init.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { kiciTmpBase } from '@kici-dev/core/tmp';
|
|
2
|
+
/**
|
|
3
|
+
* Base directory for KiCI-created temp files. Honors the `KICI_TMPDIR` env var
|
|
4
|
+
* (creating it if it does not yet exist) so an operator can route KiCI's temp
|
|
5
|
+
* footprint onto a volume with room; falls back to the OS temp dir otherwise.
|
|
6
|
+
* Server-side only (Node fs/os) — do NOT import from browser-bundled code.
|
|
7
|
+
*
|
|
8
|
+
* Delegates to `@kici-dev/core/tmp`'s resolver so `KICI_TMPDIR` is read in
|
|
9
|
+
* exactly one place across the codebase.
|
|
10
|
+
*/
|
|
11
|
+
export { kiciTmpBase };
|
|
12
|
+
/** Create a fresh unique temp dir under {@link kiciTmpBase} with `prefix`. */
|
|
13
|
+
export declare function kiciMkdtemp(prefix: string): string;
|
|
14
|
+
//# sourceMappingURL=tmp-dir.d.ts.map
|
package/dist/tmp-dir.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import "./rolldown-runtime-ClRpJifh.js";
|
|
2
|
+
import { mkdtempSync } from "node:fs";
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { kiciTmpBase } from "@kici-dev/core/tmp";
|
|
5
|
+
//#region src/tmp-dir.ts
|
|
6
|
+
/** Create a fresh unique temp dir under {@link kiciTmpBase} with `prefix`. */
|
|
7
|
+
function kiciMkdtemp(prefix) {
|
|
8
|
+
return mkdtempSync(path.join(kiciTmpBase(), prefix));
|
|
9
|
+
}
|
|
10
|
+
//#endregion
|
|
11
|
+
export { kiciMkdtemp, kiciTmpBase };
|
|
12
|
+
|
|
13
|
+
//# sourceMappingURL=tmp-dir.js.map
|
package/dist/tmp.d.ts
ADDED
package/dist/tmp.js
ADDED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kici-dev/shared",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Shared utilities for the KiCI CI/CD stack — logging, zx setup, crypto, telemetry, health and metrics routes. No business logic.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ci",
|
|
@@ -50,10 +50,18 @@
|
|
|
50
50
|
"import": "./dist/ts-loader-hook.js",
|
|
51
51
|
"types": "./dist/ts-loader-hook.d.ts"
|
|
52
52
|
},
|
|
53
|
+
"./tmp": {
|
|
54
|
+
"import": "./dist/tmp.js",
|
|
55
|
+
"types": "./dist/tmp.d.ts"
|
|
56
|
+
},
|
|
53
57
|
"./idempotency": {
|
|
54
58
|
"import": "./dist/idempotency.js",
|
|
55
59
|
"types": "./dist/idempotency.d.ts"
|
|
56
60
|
},
|
|
61
|
+
"./ci-env": {
|
|
62
|
+
"import": "./dist/ci-env.js",
|
|
63
|
+
"types": "./dist/ci-env.d.ts"
|
|
64
|
+
},
|
|
57
65
|
"./idempotency-files": {
|
|
58
66
|
"import": "./dist/idempotency-files.js",
|
|
59
67
|
"types": "./dist/idempotency-files.d.ts"
|
|
@@ -84,36 +92,37 @@
|
|
|
84
92
|
}
|
|
85
93
|
},
|
|
86
94
|
"dependencies": {
|
|
87
|
-
"@aws-sdk/client-s3": "^3.
|
|
95
|
+
"@aws-sdk/client-s3": "^3.1089.0",
|
|
88
96
|
"@opentelemetry/api": "^1.9.1",
|
|
89
|
-
"@opentelemetry/exporter-metrics-otlp-http": "^0.
|
|
90
|
-
"@opentelemetry/exporter-prometheus": "^0.
|
|
91
|
-
"@opentelemetry/exporter-trace-otlp-http": "^0.
|
|
92
|
-
"@opentelemetry/instrumentation-runtime-node": "^0.
|
|
93
|
-
"@opentelemetry/resources": "^2.
|
|
94
|
-
"@opentelemetry/sdk-node": "^0.
|
|
95
|
-
"@opentelemetry/semantic-conventions": "^1.
|
|
97
|
+
"@opentelemetry/exporter-metrics-otlp-http": "^0.221.0",
|
|
98
|
+
"@opentelemetry/exporter-prometheus": "^0.221.0",
|
|
99
|
+
"@opentelemetry/exporter-trace-otlp-http": "^0.221.0",
|
|
100
|
+
"@opentelemetry/instrumentation-runtime-node": "^0.34.0",
|
|
101
|
+
"@opentelemetry/resources": "^2.10.0",
|
|
102
|
+
"@opentelemetry/sdk-node": "^0.221.0",
|
|
103
|
+
"@opentelemetry/semantic-conventions": "^1.43.0",
|
|
96
104
|
"archiver": "^8.0.0",
|
|
97
105
|
"diff": "^9.0.0",
|
|
98
|
-
"hono": "^4.12.
|
|
99
|
-
"kysely": "^0.29.
|
|
100
|
-
"oxc-transform": "0.
|
|
101
|
-
"pg": "^8.
|
|
106
|
+
"hono": "^4.12.32",
|
|
107
|
+
"kysely": "^0.29.4",
|
|
108
|
+
"oxc-transform": "0.140.0",
|
|
109
|
+
"pg": "^8.22.0",
|
|
102
110
|
"picocolors": "^1.1.1",
|
|
103
111
|
"winston": "^3.19.0",
|
|
104
112
|
"winston-daily-rotate-file": "^5.0.0",
|
|
105
113
|
"yaml": "^2.9.0",
|
|
106
114
|
"zod": "^4.4.3",
|
|
107
115
|
"zx": "^8.8.5",
|
|
108
|
-
"@kici-dev/core": "0.
|
|
116
|
+
"@kici-dev/core": "0.2.0",
|
|
117
|
+
"@kici-dev/engine": "0.2.0"
|
|
109
118
|
},
|
|
110
119
|
"devDependencies": {
|
|
111
|
-
"@opentelemetry/sdk-trace-base": "^2.
|
|
120
|
+
"@opentelemetry/sdk-trace-base": "^2.10.0",
|
|
112
121
|
"@types/archiver": "^8.0.0"
|
|
113
122
|
},
|
|
114
123
|
"scripts": {
|
|
115
|
-
"build": "node ../../scripts/build-ts.mjs &&
|
|
124
|
+
"build": "node ../../scripts/build-ts.mjs && tsgo --emitDeclarationOnly",
|
|
116
125
|
"test": "vitest run",
|
|
117
|
-
"typecheck": "
|
|
126
|
+
"typecheck": "tsgo --noEmit"
|
|
118
127
|
}
|
|
119
128
|
}
|