@forklaunch/core 1.6.0 → 1.6.3
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/persistence/index.d.ts +1 -1
- package/lib/persistence/index.d.ts.map +1 -1
- package/lib/persistence/index.js +4 -3
- package/lib/persistence/index.js.map +1 -1
- package/lib/persistence/index.mjs +4 -3
- package/lib/persistence/index.mjs.map +1 -1
- package/lib/persistence/mikroOrm.types.d.ts +18 -2
- package/lib/persistence/mikroOrm.types.d.ts.map +1 -1
- package/lib/persistence/tenantEm.d.ts +18 -5
- package/lib/persistence/tenantEm.d.ts.map +1 -1
- package/package.json +11 -11
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MikroORM } from '@mikro-orm/core';
|
|
1
|
+
import type { Collection, IndexHints, MikroORM, Reference } from '@mikro-orm/core';
|
|
2
2
|
/**
|
|
3
3
|
* `MikroORM` with relaxed type parameters.
|
|
4
4
|
*
|
|
@@ -35,8 +35,24 @@ export type AnyMikroORM = Awaited<ReturnType<typeof MikroORM.init>>;
|
|
|
35
35
|
* should compare `ResolvedEntity<(typeof X)['~entity']>` so compatibility is
|
|
36
36
|
* judged on the actual field types, which is what the consuming code reads
|
|
37
37
|
* and writes.
|
|
38
|
+
*
|
|
39
|
+
* Relations are resolved the same way. A `Collection<Permission>`, a
|
|
40
|
+
* `Reference<Organization>` or a bare `Organization` on the entity carries the
|
|
41
|
+
* related entity's builder record too, and since mikro-orm 7.2 the builders
|
|
42
|
+
* are declared `in out` (invariant), so a concrete `Role` whose `permissions`
|
|
43
|
+
* point at the app's `Permission` would never satisfy a constraint written
|
|
44
|
+
* against a module's minimal `Permission` unless the relation target is
|
|
45
|
+
* stripped of its metadata slots as well.
|
|
38
46
|
*/
|
|
39
47
|
export type ResolvedEntity<T> = {
|
|
40
|
-
[K in keyof T as K extends string ? K : never]: T[K]
|
|
48
|
+
[K in keyof T as K extends string ? K : never]: ResolvedRelation<T[K]>;
|
|
41
49
|
};
|
|
50
|
+
/**
|
|
51
|
+
* `ResolvedEntity` applied through a relation wrapper: `Collection<E>` becomes
|
|
52
|
+
* `Collection<ResolvedEntity<E>>`, references likewise, and a bare entity
|
|
53
|
+
* object (a `manyToOne` without `.ref()`) resolves in place. Scalars, dates,
|
|
54
|
+
* enums, `null` and `undefined` pass through untouched: only a value that
|
|
55
|
+
* carries the `IndexHints` slot is an entity.
|
|
56
|
+
*/
|
|
57
|
+
export type ResolvedRelation<V> = V extends Collection<infer E extends object, infer O extends object> ? Collection<ResolvedEntity<E>, O> : V extends Reference<infer E extends object> ? Reference<ResolvedEntity<E>> : typeof IndexHints extends keyof V ? ResolvedEntity<V> : V;
|
|
42
58
|
//# sourceMappingURL=mikroOrm.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mikroOrm.types.d.ts","sourceRoot":"","sources":["../../src/persistence/mikroOrm.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"mikroOrm.types.d.ts","sourceRoot":"","sources":["../../src/persistence/mikroOrm.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,UAAU,EACV,UAAU,EACV,QAAQ,EACR,SAAS,EACV,MAAM,iBAAiB,CAAC;AAEzB;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,MAAM,MAAM,WAAW,GAAG,OAAO,CAAC,UAAU,CAAC,OAAO,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AAEpE;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,MAAM,cAAc,CAAC,CAAC,IAAI;KAC7B,CAAC,IAAI,MAAM,CAAC,IAAI,CAAC,SAAS,MAAM,GAAG,CAAC,GAAG,KAAK,GAAG,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;CACvE,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,CAAC,CAAC,IAC5B,CAAC,SAAS,UAAU,CAAC,MAAM,CAAC,SAAS,MAAM,EAAE,MAAM,CAAC,SAAS,MAAM,CAAC,GAChE,UAAU,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,GAChC,CAAC,SAAS,SAAS,CAAC,MAAM,CAAC,SAAS,MAAM,CAAC,GACzC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,GAC5B,OAAO,UAAU,SAAS,MAAM,CAAC,GAC/B,cAAc,CAAC,CAAC,CAAC,GACjB,CAAC,CAAC"}
|
|
@@ -48,13 +48,26 @@ import type { EntityManager } from '@mikro-orm/core';
|
|
|
48
48
|
* }
|
|
49
49
|
* ```
|
|
50
50
|
*
|
|
51
|
-
*
|
|
52
|
-
*
|
|
53
|
-
*
|
|
51
|
+
* # The empty tenant is a tenant
|
|
52
|
+
*
|
|
53
|
+
* Global rows (a billing plan, a trial, a template) are encrypted under the
|
|
54
|
+
* empty tenant `''`. A caller that passes `''` means "bind the no-tenant
|
|
55
|
+
* key", and gets a Proxy that runs every EM call inside
|
|
56
|
+
* `withEncryptionContext('', …)`. Only `undefined` means "do not wrap": the
|
|
57
|
+
* EM is returned as is and inherits whatever context is already bound,
|
|
58
|
+
* which is right for a super-admin lookup that has not resolved a tenant
|
|
59
|
+
* yet, and wrong for anything that writes.
|
|
60
|
+
*
|
|
61
|
+
* Earlier versions treated `''` like `undefined` and also seeded the ALS
|
|
62
|
+
* with `enterWith`, which mutates the *calling* async resource. Together
|
|
63
|
+
* those meant: after one org-scoped EM was created on a request, a later
|
|
64
|
+
* "no-tenant" EM on the same resource silently read and wrote under that
|
|
65
|
+
* org's key. Global rows then came out unreadable ("Failed to decrypt
|
|
66
|
+
* encrypted column value") depending on what had run before on the worker.
|
|
54
67
|
*
|
|
55
68
|
* @param em a freshly forked `EntityManager` from `orm.em.fork(...)`
|
|
56
|
-
* @param tenantId the org/tenant id to bind
|
|
57
|
-
*
|
|
69
|
+
* @param tenantId the org/tenant id to bind; `''` binds the no-tenant key;
|
|
70
|
+
* `undefined` skips wrapping entirely
|
|
58
71
|
*/
|
|
59
72
|
export declare function wrapEmWithTenantContext(em: EntityManager, tenantId: string | undefined): EntityManager;
|
|
60
73
|
//# sourceMappingURL=tenantEm.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tenantEm.d.ts","sourceRoot":"","sources":["../../src/persistence/tenantEm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD
|
|
1
|
+
{"version":3,"file":"tenantEm.d.ts","sourceRoot":"","sources":["../../src/persistence/tenantEm.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAGrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqEG;AACH,wBAAgB,uBAAuB,CACrC,EAAE,EAAE,aAAa,EACjB,QAAQ,EAAE,MAAM,GAAG,SAAS,GAC3B,aAAa,CA4Bf"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forklaunch/core",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.3",
|
|
4
4
|
"description": "forklaunch-js core package. Contains useful building blocks.",
|
|
5
5
|
"homepage": "https://github.com/forklaunch/forklaunch-js#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -81,8 +81,8 @@
|
|
|
81
81
|
"dependencies": {
|
|
82
82
|
"@asyncapi/parser": "^3.6.3",
|
|
83
83
|
"@forklaunch/opentelemetry-instrumentation-hyper-express": "0.0.5",
|
|
84
|
-
"@mikro-orm/core": "7.1
|
|
85
|
-
"@mikro-orm/mongodb": "7.1
|
|
84
|
+
"@mikro-orm/core": "7.2.1",
|
|
85
|
+
"@mikro-orm/mongodb": "7.2.1",
|
|
86
86
|
"@opentelemetry/api": "^1.9.1",
|
|
87
87
|
"@opentelemetry/api-logs": "^0.222.0",
|
|
88
88
|
"@opentelemetry/exporter-logs-otlp-http": "^0.222.0",
|
|
@@ -98,8 +98,8 @@
|
|
|
98
98
|
"@opentelemetry/sdk-trace-node": "^2.11.0",
|
|
99
99
|
"@opentelemetry/semantic-conventions": "^1.43.0",
|
|
100
100
|
"cors": "^2.8.6",
|
|
101
|
-
"dotenv": "^
|
|
102
|
-
"fastmcp": "^4.20.
|
|
101
|
+
"dotenv": "^18.0.1",
|
|
102
|
+
"fastmcp": "^4.20.14",
|
|
103
103
|
"jose": "6.2.12",
|
|
104
104
|
"openapi3-ts": "^4.6.1",
|
|
105
105
|
"pino": "^10.3.1",
|
|
@@ -107,21 +107,21 @@
|
|
|
107
107
|
"pino-pretty": "^13.1.3",
|
|
108
108
|
"redis": "^6.2.1",
|
|
109
109
|
"uuid": "^14.0.2",
|
|
110
|
-
"zod": "^4.6.
|
|
111
|
-
"@forklaunch/
|
|
112
|
-
"@forklaunch/
|
|
110
|
+
"zod": "^4.6.5",
|
|
111
|
+
"@forklaunch/validator": "^1.2.28",
|
|
112
|
+
"@forklaunch/common": "^1.2.27"
|
|
113
113
|
},
|
|
114
114
|
"devDependencies": {
|
|
115
115
|
"@eslint/js": "^10.0.1",
|
|
116
|
-
"@scalar/express-api-reference": "^0.10.
|
|
116
|
+
"@scalar/express-api-reference": "^0.10.19",
|
|
117
117
|
"@types/cors": "^2.8.19",
|
|
118
118
|
"@types/jest": "^30.0.0",
|
|
119
119
|
"@types/qs": "^6.15.1",
|
|
120
120
|
"@types/uuid": "^11.0.0",
|
|
121
121
|
"globals": "^17.12.0",
|
|
122
|
-
"jest": "^30.5.
|
|
122
|
+
"jest": "^30.5.2",
|
|
123
123
|
"jose": "6.1.3",
|
|
124
|
-
"prettier": "^3.9.
|
|
124
|
+
"prettier": "^3.9.8",
|
|
125
125
|
"testcontainers": "^12.1.0",
|
|
126
126
|
"ts-jest": "^29.4.12",
|
|
127
127
|
"ts-node": "^10.9.2",
|