@forklaunch/core 1.6.0 → 1.6.2

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.
@@ -48,13 +48,26 @@ import type { EntityManager } from '@mikro-orm/core';
48
48
  * }
49
49
  * ```
50
50
  *
51
- * If `tenantId` is `undefined` or empty, the original EM is returned
52
- * unwrapped — useful for super-admin / lookup paths that need an
53
- * unscoped query before they know the tenant.
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 for filter params + ALS;
57
- * pass `undefined` to skip wrapping entirely
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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwDG;AACH,wBAAgB,uBAAuB,CACrC,EAAE,EAAE,aAAa,EACjB,QAAQ,EAAE,MAAM,GAAG,SAAS,GAC3B,aAAa,CA0Bf"}
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.0",
3
+ "version": "1.6.2",
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.15",
85
- "@mikro-orm/mongodb": "7.1.15",
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": "^17.4.2",
102
- "fastmcp": "^4.20.11",
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.4",
111
- "@forklaunch/common": "^1.2.26",
112
- "@forklaunch/validator": "^1.2.27"
110
+ "zod": "^4.6.5",
111
+ "@forklaunch/common": "^1.2.27",
112
+ "@forklaunch/validator": "^1.2.28"
113
113
  },
114
114
  "devDependencies": {
115
115
  "@eslint/js": "^10.0.1",
116
- "@scalar/express-api-reference": "^0.10.18",
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.1",
122
+ "jest": "^30.5.2",
123
123
  "jose": "6.1.3",
124
- "prettier": "^3.9.6",
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",