@forklaunch/core 1.6.7 → 2.0.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/lib/persistence/encryptedType.d.ts +55 -2
- package/lib/persistence/encryptedType.d.ts.map +1 -1
- package/lib/persistence/index.d.ts +1 -1
- package/lib/persistence/index.d.ts.map +1 -1
- package/lib/persistence/index.js +45 -5
- package/lib/persistence/index.js.map +1 -1
- package/lib/persistence/index.mjs +41 -5
- package/lib/persistence/index.mjs.map +1 -1
- package/lib/persistence/tenantEm.d.ts +18 -15
- package/lib/persistence/tenantEm.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -48,26 +48,29 @@ import type { EntityManager } from '@mikro-orm/core';
|
|
|
48
48
|
* }
|
|
49
49
|
* ```
|
|
50
50
|
*
|
|
51
|
-
* # The empty tenant is a tenant
|
|
51
|
+
* # The empty tenant is not a tenant
|
|
52
52
|
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
* yet, and wrong for anything that writes.
|
|
53
|
+
* `''` is rejected: it throws `EmptyTenantError`. It used to mean "bind the
|
|
54
|
+
* no-tenant key", which is how global rows (a billing plan, a trial, a
|
|
55
|
+
* template) were encrypted — and it made a deliberate global row and a tenant
|
|
56
|
+
* nobody resolved the same key. A path that forgot to bind wrote perfectly
|
|
57
|
+
* readable rows under `''`, and the mistake surfaced later, somewhere else, as
|
|
58
|
+
* the owning tenant's "Failed to decrypt encrypted column value".
|
|
60
59
|
*
|
|
61
|
-
*
|
|
62
|
-
*
|
|
63
|
-
*
|
|
64
|
-
*
|
|
65
|
-
*
|
|
66
|
-
*
|
|
60
|
+
* Global rows need an id you can name and search for. Pick a constant no
|
|
61
|
+
* organization can collide with — the platform uses `'_internal'` — and bind
|
|
62
|
+
* it like any other tenant.
|
|
63
|
+
*
|
|
64
|
+
* `undefined` still means "do not wrap": the EM is returned as is and inherits
|
|
65
|
+
* whatever context is already bound. That is right only for a lookup that has
|
|
66
|
+
* not resolved a tenant yet and reads no encrypted column; anything that
|
|
67
|
+
* touches one now fails with `UnboundTenantError` rather than quietly using
|
|
68
|
+
* the empty key.
|
|
67
69
|
*
|
|
68
70
|
* @param em a freshly forked `EntityManager` from `orm.em.fork(...)`
|
|
69
|
-
* @param tenantId the org/tenant id to bind; `''`
|
|
71
|
+
* @param tenantId the org/tenant id to bind; `''` throws;
|
|
70
72
|
* `undefined` skips wrapping entirely
|
|
73
|
+
* @throws EmptyTenantError when `tenantId` is `''`
|
|
71
74
|
*/
|
|
72
75
|
export declare function wrapEmWithTenantContext(em: EntityManager, tenantId: string | undefined): EntityManager;
|
|
73
76
|
//# 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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwEG;AACH,wBAAgB,uBAAuB,CACrC,EAAE,EAAE,aAAa,EACjB,QAAQ,EAAE,MAAM,GAAG,SAAS,GAC3B,aAAa,CA4Bf"}
|