@forklaunch/core 4.1.1 → 4.3.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/bin/gateway-mock/routes/payments.mjs +5 -2
- package/lib/agent/agent.d.ts +14 -0
- package/lib/agent/agent.d.ts.map +1 -1
- package/lib/agent/approvals.d.ts +52 -0
- package/lib/agent/approvals.d.ts.map +1 -0
- package/lib/agent/continuation.d.ts +28 -3
- package/lib/agent/continuation.d.ts.map +1 -1
- package/lib/agent/index.d.ts +4 -2
- package/lib/agent/index.d.ts.map +1 -1
- package/lib/agent/index.js +191 -50
- package/lib/agent/index.js.map +1 -1
- package/lib/agent/index.mjs +185 -49
- package/lib/agent/index.mjs.map +1 -1
- package/lib/agent/types.d.ts +22 -2
- package/lib/agent/types.d.ts.map +1 -1
- package/lib/http/index.d.ts +2 -0
- package/lib/http/index.d.ts.map +1 -1
- package/lib/http/index.js +610 -221
- package/lib/http/index.js.map +1 -1
- package/lib/http/index.mjs +607 -222
- package/lib/http/index.mjs.map +1 -1
- package/lib/http/mcpGenerator/mcpAuth.d.ts +52 -0
- package/lib/http/mcpGenerator/mcpAuth.d.ts.map +1 -0
- package/lib/http/mcpGenerator/mcpGenerator.d.ts +2 -1
- package/lib/http/mcpGenerator/mcpGenerator.d.ts.map +1 -1
- package/lib/http/mcpGenerator/mcpHttpHandler.d.ts +14 -1
- package/lib/http/mcpGenerator/mcpHttpHandler.d.ts.map +1 -1
- package/lib/http/mcpGenerator/mcpOAuth.d.ts +110 -0
- package/lib/http/mcpGenerator/mcpOAuth.d.ts.map +1 -0
- package/lib/http/paymentsClient.d.ts +6 -0
- package/lib/http/paymentsClient.d.ts.map +1 -1
- package/lib/http/telemetry/pinoLogger.d.ts +2 -1
- package/lib/http/telemetry/pinoLogger.d.ts.map +1 -1
- package/lib/http/types/expressLikeOptions.d.ts +8 -0
- package/lib/http/types/expressLikeOptions.d.ts.map +1 -1
- package/lib/persistence/index.d.ts +1 -0
- package/lib/persistence/index.d.ts.map +1 -1
- package/lib/persistence/index.js +39 -0
- package/lib/persistence/index.js.map +1 -1
- package/lib/persistence/index.mjs +38 -0
- package/lib/persistence/index.mjs.map +1 -1
- package/lib/persistence/migrationLock.d.ts +61 -0
- package/lib/persistence/migrationLock.d.ts.map +1 -0
- package/package.json +5 -4
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serialise schema migrations across processes.
|
|
3
|
+
*
|
|
4
|
+
* Every generated component that owns a database (the service, its
|
|
5
|
+
* scheduled retention task, a worker, a scale-to-zero image build) runs its
|
|
6
|
+
* migrations when it starts. On a brand-new database, several of them can
|
|
7
|
+
* start at once, and two `CREATE TABLE` statements for the same table race
|
|
8
|
+
* inside Postgres: the loser fails with `23505` on
|
|
9
|
+
* `pg_type_typname_nsp_index` ("Key (typname, typnamespace)=(...) already
|
|
10
|
+
* exists") and the process exits, which fails the first deploy.
|
|
11
|
+
*
|
|
12
|
+
* `runMigrationsWithLock` takes a Postgres transaction-level advisory lock
|
|
13
|
+
* keyed on the database name, runs the migrations while holding it, and lets
|
|
14
|
+
* the commit release it. A second starter waits for the first, then finds the
|
|
15
|
+
* migrations already recorded and applies nothing. A crashed holder cannot
|
|
16
|
+
* leave the lock behind: Postgres drops it when the session ends.
|
|
17
|
+
*
|
|
18
|
+
* Databases other than Postgres run the migrations directly (their DDL is not
|
|
19
|
+
* subject to this race, or has no advisory locks).
|
|
20
|
+
*/
|
|
21
|
+
type Execute = (sql: string, params?: unknown[], method?: 'all' | 'get' | 'run', ctx?: unknown) => Promise<unknown>;
|
|
22
|
+
/** The slice of a MikroORM instance the lock needs. */
|
|
23
|
+
export interface MigrationLockOrm {
|
|
24
|
+
em: {
|
|
25
|
+
getConnection(): {
|
|
26
|
+
execute: Execute;
|
|
27
|
+
transactional<T>(cb: (trx: unknown) => Promise<T>): Promise<T>;
|
|
28
|
+
};
|
|
29
|
+
getPlatform(): {
|
|
30
|
+
getDefaultSchemaName?(): string | undefined;
|
|
31
|
+
};
|
|
32
|
+
};
|
|
33
|
+
migrator?: {
|
|
34
|
+
up(): Promise<unknown>;
|
|
35
|
+
};
|
|
36
|
+
getMigrator?: () => {
|
|
37
|
+
up(): Promise<unknown>;
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
export interface RunMigrationsWithLockOptions {
|
|
41
|
+
/**
|
|
42
|
+
* What to run while holding the lock. Defaults to `migrator.up()`.
|
|
43
|
+
*/
|
|
44
|
+
run?: () => Promise<unknown>;
|
|
45
|
+
/**
|
|
46
|
+
* Lock on this name instead of `<database>:migrations`. Two migrators that
|
|
47
|
+
* must not overlap must use the same name.
|
|
48
|
+
*/
|
|
49
|
+
lockName?: string;
|
|
50
|
+
log?: (message: string) => void;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Run the migrations, one migrator at a time per database.
|
|
54
|
+
*
|
|
55
|
+
* The lock is held on one pooled connection inside a transaction while the
|
|
56
|
+
* migrator uses its own connections, so the pool needs at least two
|
|
57
|
+
* connections (MikroORM's default is 2 to 10).
|
|
58
|
+
*/
|
|
59
|
+
export declare function runMigrationsWithLock(orm: MigrationLockOrm, options?: RunMigrationsWithLockOptions): Promise<void>;
|
|
60
|
+
export {};
|
|
61
|
+
//# sourceMappingURL=migrationLock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"migrationLock.d.ts","sourceRoot":"","sources":["../../src/persistence/migrationLock.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,KAAK,OAAO,GAAG,CACb,GAAG,EAAE,MAAM,EACX,MAAM,CAAC,EAAE,OAAO,EAAE,EAClB,MAAM,CAAC,EAAE,KAAK,GAAG,KAAK,GAAG,KAAK,EAC9B,GAAG,CAAC,EAAE,OAAO,KACV,OAAO,CAAC,OAAO,CAAC,CAAC;AAEtB,uDAAuD;AACvD,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE;QACF,aAAa,IAAI;YACf,OAAO,EAAE,OAAO,CAAC;YACjB,aAAa,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,EAAE,OAAO,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;SAChE,CAAC;QACF,WAAW,IAAI;YAAE,oBAAoB,CAAC,IAAI,MAAM,GAAG,SAAS,CAAA;SAAE,CAAC;KAChE,CAAC;IACF,QAAQ,CAAC,EAAE;QAAE,EAAE,IAAI,OAAO,CAAC,OAAO,CAAC,CAAA;KAAE,CAAC;IACtC,WAAW,CAAC,EAAE,MAAM;QAAE,EAAE,IAAI,OAAO,CAAC,OAAO,CAAC,CAAA;KAAE,CAAC;CAChD;AAED,MAAM,WAAW,4BAA4B;IAC3C;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CACjC;AAED;;;;;;GAMG;AACH,wBAAsB,qBAAqB,CACzC,GAAG,EAAE,gBAAgB,EACrB,OAAO,GAAE,4BAAiC,GACzC,OAAO,CAAC,IAAI,CAAC,CA6Cf"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forklaunch/core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.3.0",
|
|
4
4
|
"description": "forklaunch-js core package. Contains useful building blocks.",
|
|
5
5
|
"homepage": "https://github.com/forklaunch/forklaunch-js#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -99,7 +99,6 @@
|
|
|
99
99
|
"@mikro-orm/mongodb": "7.2.13",
|
|
100
100
|
"@modelcontextprotocol/sdk": "^1.32.2",
|
|
101
101
|
"@opentelemetry/api": "^1.10.0",
|
|
102
|
-
"@opentelemetry/api-logs": "^0.223.0",
|
|
103
102
|
"@opentelemetry/exporter-logs-otlp-http": "^0.301.2",
|
|
104
103
|
"@opentelemetry/exporter-metrics-otlp-http": "^0.301.2",
|
|
105
104
|
"@opentelemetry/exporter-prometheus": "^0.301.2",
|
|
@@ -115,7 +114,7 @@
|
|
|
115
114
|
"cors": "^2.8.6",
|
|
116
115
|
"dotenv": "^18.0.10",
|
|
117
116
|
"fastmcp": "^4.30.2",
|
|
118
|
-
"jose": "6.2.
|
|
117
|
+
"jose": "6.2.19",
|
|
119
118
|
"openapi3-ts": "^4.6.2",
|
|
120
119
|
"pino": "^10.4.0",
|
|
121
120
|
"pino-http": "^11.0.0",
|
|
@@ -127,7 +126,9 @@
|
|
|
127
126
|
"devDependencies": {
|
|
128
127
|
"@eslint/js": "^10.0.1",
|
|
129
128
|
"@mikro-orm/libsql": "7.2.13",
|
|
130
|
-
"@
|
|
129
|
+
"@mikro-orm/migrations": "7.2.13",
|
|
130
|
+
"@mikro-orm/postgresql": "7.2.13",
|
|
131
|
+
"@scalar/express-api-reference": "^0.10.44",
|
|
131
132
|
"@types/cors": "^2.8.19",
|
|
132
133
|
"@types/qs": "^6.15.1",
|
|
133
134
|
"@types/uuid": "^11.0.0",
|