@forklaunch/core 4.0.0 → 4.1.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/lib/http/index.js +11 -5
- package/lib/http/index.js.map +1 -1
- package/lib/http/index.mjs +17 -6
- package/lib/http/index.mjs.map +1 -1
- package/lib/http/mcpGenerator/mcpGenerator.d.ts.map +1 -1
- package/lib/http/middleware/request/cors.middleware.d.ts +6 -1
- package/lib/http/middleware/request/cors.middleware.d.ts.map +1 -1
- package/lib/http/types/expressLikeOptions.d.ts +11 -6
- package/lib/http/types/expressLikeOptions.d.ts.map +1 -1
- package/lib/persistence/compliancePropertyBuilder.d.ts.map +1 -1
- package/lib/persistence/complianceTypes.d.ts.map +1 -1
- package/lib/persistence/encryptedType.d.ts.map +1 -1
- package/lib/persistence/index.js +27 -12
- package/lib/persistence/index.js.map +1 -1
- package/lib/persistence/index.mjs +28 -13
- package/lib/persistence/index.mjs.map +1 -1
- package/lib/services/index.js +82 -19
- package/lib/services/index.js.map +1 -1
- package/lib/services/index.mjs +82 -19
- package/lib/services/index.mjs.map +1 -1
- package/lib/services/runRetentionEnforcement.d.ts +33 -2
- package/lib/services/runRetentionEnforcement.d.ts.map +1 -1
- package/package.json +13 -13
|
@@ -1,10 +1,40 @@
|
|
|
1
1
|
import type { MetricsDefinition } from '../http/types/openTelemetryCollector.types';
|
|
2
2
|
import type { OpenTelemetryCollector } from '../http/telemetry/openTelemetryCollector';
|
|
3
3
|
import type { RetentionService } from './retentionService';
|
|
4
|
+
/** A one-shot run that has not finished after this long is stopped. */
|
|
5
|
+
export declare const DEFAULT_RETENTION_TIMEOUT_MS: number;
|
|
6
|
+
/** How long `close` may take before the process exits anyway. */
|
|
7
|
+
export declare const DEFAULT_RETENTION_CLOSE_TIMEOUT_MS = 5000;
|
|
8
|
+
/** Exit codes: 0 clean, 1 enforcement errors or a fatal error, 2 timed out. */
|
|
9
|
+
export declare const RETENTION_EXIT_CODES: {
|
|
10
|
+
readonly ok: 0;
|
|
11
|
+
readonly failed: 1;
|
|
12
|
+
readonly timedOut: 2;
|
|
13
|
+
};
|
|
14
|
+
export type RunRetentionEnforcementOptions = {
|
|
15
|
+
/**
|
|
16
|
+
* Releases what keeps the process alive (ORM pool, cache client), e.g.
|
|
17
|
+
* `() => ci.resolve(tokens.Orm).close()`. Optional: the process exits
|
|
18
|
+
* either way. Bounded by `closeTimeoutMs`; a failure is logged, not fatal.
|
|
19
|
+
*/
|
|
20
|
+
close?: () => unknown;
|
|
21
|
+
/** Hard limit for the whole run. Default 30 minutes. */
|
|
22
|
+
timeoutMs?: number;
|
|
23
|
+
/** Hard limit for `close`. Default 5 seconds. */
|
|
24
|
+
closeTimeoutMs?: number;
|
|
25
|
+
/** Injected in tests; defaults to `process.exit`. */
|
|
26
|
+
exit?: (code: number) => void;
|
|
27
|
+
};
|
|
4
28
|
/**
|
|
5
29
|
* Shared retention enforcement runner.
|
|
6
30
|
* Designed to be called from a one-shot script (ECS RunTask / cron).
|
|
7
31
|
*
|
|
32
|
+
* The process ALWAYS exits: on success, on enforcement errors, on a thrown
|
|
33
|
+
* error, and after `timeoutMs` if enforcement hangs. A scheduled job that
|
|
34
|
+
* never exits keeps its task running, and the scheduler starts another one
|
|
35
|
+
* the next day (2026-11: tasks piled up for 11 days in production because
|
|
36
|
+
* open database and Redis connections kept Node alive after the work was done).
|
|
37
|
+
*
|
|
8
38
|
* @example
|
|
9
39
|
* ```ts
|
|
10
40
|
* import { ci, tokens } from '../bootstrapper';
|
|
@@ -12,9 +42,10 @@ import type { RetentionService } from './retentionService';
|
|
|
12
42
|
*
|
|
13
43
|
* runRetentionEnforcement(
|
|
14
44
|
* ci.resolve(tokens.RetentionService),
|
|
15
|
-
* ci.resolve(tokens.OtelCollector)
|
|
45
|
+
* ci.resolve(tokens.OtelCollector),
|
|
46
|
+
* { close: () => ci.resolve(tokens.Orm).close() }
|
|
16
47
|
* );
|
|
17
48
|
* ```
|
|
18
49
|
*/
|
|
19
|
-
export declare function runRetentionEnforcement<AppliedMetricsDefinition extends MetricsDefinition = MetricsDefinition>(retentionService: RetentionService<AppliedMetricsDefinition>, otel: OpenTelemetryCollector<AppliedMetricsDefinition
|
|
50
|
+
export declare function runRetentionEnforcement<AppliedMetricsDefinition extends MetricsDefinition = MetricsDefinition>(retentionService: RetentionService<AppliedMetricsDefinition>, otel: OpenTelemetryCollector<AppliedMetricsDefinition>, options?: RunRetentionEnforcementOptions): Promise<void>;
|
|
20
51
|
//# sourceMappingURL=runRetentionEnforcement.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runRetentionEnforcement.d.ts","sourceRoot":"","sources":["../../src/services/runRetentionEnforcement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AACpF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AACvF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D
|
|
1
|
+
{"version":3,"file":"runRetentionEnforcement.d.ts","sourceRoot":"","sources":["../../src/services/runRetentionEnforcement.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,4CAA4C,CAAC;AACpF,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AACvF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE3D,uEAAuE;AACvE,eAAO,MAAM,4BAA4B,QAAiB,CAAC;AAC3D,iEAAiE;AACjE,eAAO,MAAM,kCAAkC,OAAQ,CAAC;AAExD,+EAA+E;AAC/E,eAAO,MAAM,oBAAoB;aAAK,EAAE,EAAE,CAAC;aAAE,MAAM,EAAE,CAAC;aAAE,QAAQ,EAAE,CAAC;CAAW,CAAC;AAE/E,MAAM,MAAM,8BAA8B,GAAG;IAC3C;;;;OAIG;IACH,KAAK,CAAC,EAAE,MAAM,OAAO,CAAC;IACtB,wDAAwD;IACxD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iDAAiD;IACjD,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,qDAAqD;IACrD,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAsB,uBAAuB,CAC3C,wBAAwB,SAAS,iBAAiB,GAAG,iBAAiB,EAEtE,gBAAgB,EAAE,gBAAgB,CAAC,wBAAwB,CAAC,EAC5D,IAAI,EAAE,sBAAsB,CAAC,wBAAwB,CAAC,EACtD,OAAO,GAAE,8BAAmC,GAC3C,OAAO,CAAC,IAAI,CAAC,CAiDf"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forklaunch/core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.1",
|
|
4
4
|
"description": "forklaunch-js core package. Contains useful building blocks.",
|
|
5
5
|
"homepage": "https://github.com/forklaunch/forklaunch-js#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -92,11 +92,11 @@
|
|
|
92
92
|
},
|
|
93
93
|
"dependencies": {
|
|
94
94
|
"@asyncapi/parser": "^3.6.6",
|
|
95
|
-
"@forklaunch/common": "^
|
|
95
|
+
"@forklaunch/common": "^2.0.0",
|
|
96
96
|
"@forklaunch/opentelemetry-instrumentation-hyper-express": "0.0.6",
|
|
97
|
-
"@forklaunch/validator": "^1.3.
|
|
98
|
-
"@mikro-orm/core": "7.2.
|
|
99
|
-
"@mikro-orm/mongodb": "7.2.
|
|
97
|
+
"@forklaunch/validator": "^1.3.1",
|
|
98
|
+
"@mikro-orm/core": "7.2.13",
|
|
99
|
+
"@mikro-orm/mongodb": "7.2.13",
|
|
100
100
|
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
101
101
|
"@opentelemetry/api": "^1.10.0",
|
|
102
102
|
"@opentelemetry/api-logs": "^0.223.0",
|
|
@@ -114,32 +114,32 @@
|
|
|
114
114
|
"@opentelemetry/semantic-conventions": "^1.45.0",
|
|
115
115
|
"cors": "^2.8.6",
|
|
116
116
|
"dotenv": "^18.0.10",
|
|
117
|
-
"fastmcp": "^4.
|
|
118
|
-
"jose": "6.2.
|
|
117
|
+
"fastmcp": "^4.30.2",
|
|
118
|
+
"jose": "6.2.18",
|
|
119
119
|
"openapi3-ts": "^4.6.2",
|
|
120
120
|
"pino": "^10.4.0",
|
|
121
121
|
"pino-http": "^11.0.0",
|
|
122
122
|
"pino-pretty": "^13.2.0",
|
|
123
|
-
"redis": "^6.
|
|
123
|
+
"redis": "^6.4.0",
|
|
124
124
|
"uuid": "^14.0.3",
|
|
125
125
|
"zod": "^4.6.7"
|
|
126
126
|
},
|
|
127
127
|
"devDependencies": {
|
|
128
128
|
"@eslint/js": "^10.0.1",
|
|
129
|
-
"@mikro-orm/libsql": "7.2.
|
|
130
|
-
"@scalar/express-api-reference": "^0.10.
|
|
129
|
+
"@mikro-orm/libsql": "7.2.13",
|
|
130
|
+
"@scalar/express-api-reference": "^0.10.43",
|
|
131
131
|
"@types/cors": "^2.8.19",
|
|
132
132
|
"@types/qs": "^6.15.1",
|
|
133
133
|
"@types/uuid": "^11.0.0",
|
|
134
134
|
"globals": "^17.14.0",
|
|
135
135
|
"jose": "6.1.3",
|
|
136
136
|
"prettier": "^3.10.1",
|
|
137
|
-
"stripe": "^23.
|
|
138
|
-
"testcontainers": "^12.2.
|
|
137
|
+
"stripe": "^23.2.0",
|
|
138
|
+
"testcontainers": "^12.2.2",
|
|
139
139
|
"ts-node": "^10.9.2",
|
|
140
140
|
"tsup": "^9.0.0",
|
|
141
141
|
"typescript": "^7.0.2",
|
|
142
|
-
"typescript-eslint": "^8.
|
|
142
|
+
"typescript-eslint": "^8.74.0"
|
|
143
143
|
},
|
|
144
144
|
"peerDependencies": {
|
|
145
145
|
"stripe": "^22.0.0"
|