@memberjunction/core-entities-server 6.1.0-edge.6 → 6.1.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/dist/custom/MJAIBridgeProviderEntityServer.server.d.ts +1 -5
- package/dist/custom/MJAIBridgeProviderEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJAIBridgeProviderEntityServer.server.js +13 -12
- package/dist/custom/MJAIBridgeProviderEntityServer.server.js.map +1 -1
- package/dist/custom/MJAIRemoteBrowserProviderEntityServer.server.d.ts +2 -6
- package/dist/custom/MJAIRemoteBrowserProviderEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJAIRemoteBrowserProviderEntityServer.server.js +16 -14
- package/dist/custom/MJAIRemoteBrowserProviderEntityServer.server.js.map +1 -1
- package/dist/custom/MJEntityEntityServer.server.d.ts +36 -0
- package/dist/custom/MJEntityEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJEntityEntityServer.server.js +77 -0
- package/dist/custom/MJEntityEntityServer.server.js.map +1 -0
- package/dist/custom/MJEntityFieldPermissionEntityServer.server.d.ts +167 -0
- package/dist/custom/MJEntityFieldPermissionEntityServer.server.d.ts.map +1 -0
- package/dist/custom/MJEntityFieldPermissionEntityServer.server.js +347 -0
- package/dist/custom/MJEntityFieldPermissionEntityServer.server.js.map +1 -0
- package/dist/custom/MJUserRoleEntityServer.server.d.ts +105 -8
- package/dist/custom/MJUserRoleEntityServer.server.d.ts.map +1 -1
- package/dist/custom/MJUserRoleEntityServer.server.js +170 -10
- package/dist/custom/MJUserRoleEntityServer.server.js.map +1 -1
- package/dist/custom/fieldPermissionDelta.d.ts +57 -0
- package/dist/custom/fieldPermissionDelta.d.ts.map +1 -0
- package/dist/custom/fieldPermissionDelta.js +196 -0
- package/dist/custom/fieldPermissionDelta.js.map +1 -0
- package/dist/custom/fieldPermissionReconciler.d.ts +34 -0
- package/dist/custom/fieldPermissionReconciler.d.ts.map +1 -0
- package/dist/custom/fieldPermissionReconciler.js +96 -0
- package/dist/custom/fieldPermissionReconciler.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/package.json +28 -28
|
@@ -4,11 +4,7 @@ import { MJAIBridgeProviderEntity } from '@memberjunction/core-entities';
|
|
|
4
4
|
* The complete set of known `IBridgeProviderFeatures` keys (see the generated
|
|
5
5
|
* `MJAIBridgeProviderEntity_IBridgeProviderFeatures` interface and
|
|
6
6
|
* `metadata/entities/JSONType-interfaces/IBridgeProviderFeatures.ts`). `SupportedFeatures` is a
|
|
7
|
-
* flat object of optional booleans,
|
|
8
|
-
* and every value must be a boolean. Keeping the list here (rather than reflecting off a runtime
|
|
9
|
-
* value) makes the validator a PURE, dependency-free, easily-unit-tested function and gives a
|
|
10
|
-
* friendly "unknown feature flag" message that a free-form `additionalProperties:false` schema
|
|
11
|
-
* would not.
|
|
7
|
+
* flat object of optional booleans, verified at compile-time to track the generated interface.
|
|
12
8
|
*/
|
|
13
9
|
export declare const KNOWN_BRIDGE_PROVIDER_FEATURE_KEYS: ReadonlySet<string>;
|
|
14
10
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MJAIBridgeProviderEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJAIBridgeProviderEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,mBAAmB,EAAuB,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE9G,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"MJAIBridgeProviderEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJAIBridgeProviderEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,mBAAmB,EAAuB,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE9G,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAiCzE;;;;;GAKG;AACH,eAAO,MAAM,kCAAkC,EAAE,WAAW,CAAC,MAAM,CAAiC,CAAC;AAErG;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBACa,8BAA+B,SAAQ,wBAAwB;IACxE,2EAA2E;IAC3E,IAAoB,0BAA0B,IAAI,OAAO,CAExD;IAEqB,aAAa,IAAI,OAAO,CAAC,gBAAgB,CAAC;CA0BnE;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,mBAAmB,GAAG,IAAI,CAatG;AAED;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,mBAAmB,EAAE,CA8BnG"}
|
|
@@ -7,17 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { BaseEntity, ValidationErrorInfo, ValidationErrorType } from '@memberjunction/core';
|
|
8
8
|
import { RegisterClass } from '@memberjunction/global';
|
|
9
9
|
import { MJAIBridgeProviderEntity } from '@memberjunction/core-entities';
|
|
10
|
-
|
|
11
|
-
* The complete set of known `IBridgeProviderFeatures` keys (see the generated
|
|
12
|
-
* `MJAIBridgeProviderEntity_IBridgeProviderFeatures` interface and
|
|
13
|
-
* `metadata/entities/JSONType-interfaces/IBridgeProviderFeatures.ts`). `SupportedFeatures` is a
|
|
14
|
-
* flat object of optional booleans, so the validation is: every present key must be in this set
|
|
15
|
-
* and every value must be a boolean. Keeping the list here (rather than reflecting off a runtime
|
|
16
|
-
* value) makes the validator a PURE, dependency-free, easily-unit-tested function and gives a
|
|
17
|
-
* friendly "unknown feature flag" message that a free-form `additionalProperties:false` schema
|
|
18
|
-
* would not.
|
|
19
|
-
*/
|
|
20
|
-
export const KNOWN_BRIDGE_PROVIDER_FEATURE_KEYS = new Set([
|
|
10
|
+
const FEATURE_KEYS = [
|
|
21
11
|
// Join methods
|
|
22
12
|
'OnDemandJoin',
|
|
23
13
|
'ScheduledJoin',
|
|
@@ -37,7 +27,18 @@ export const KNOWN_BRIDGE_PROVIDER_FEATURE_KEYS = new Set([
|
|
|
37
27
|
'DTMF',
|
|
38
28
|
'CallTransfer',
|
|
39
29
|
'Recording',
|
|
40
|
-
|
|
30
|
+
'DetachedMediaPlane',
|
|
31
|
+
];
|
|
32
|
+
// Compile-time check: fails build if any key in MJAIBridgeProviderEntity_IBridgeProviderFeatures is omitted
|
|
33
|
+
const _exhaustive = true;
|
|
34
|
+
void _exhaustive;
|
|
35
|
+
/**
|
|
36
|
+
* The complete set of known `IBridgeProviderFeatures` keys (see the generated
|
|
37
|
+
* `MJAIBridgeProviderEntity_IBridgeProviderFeatures` interface and
|
|
38
|
+
* `metadata/entities/JSONType-interfaces/IBridgeProviderFeatures.ts`). `SupportedFeatures` is a
|
|
39
|
+
* flat object of optional booleans, verified at compile-time to track the generated interface.
|
|
40
|
+
*/
|
|
41
|
+
export const KNOWN_BRIDGE_PROVIDER_FEATURE_KEYS = new Set(FEATURE_KEYS);
|
|
41
42
|
/**
|
|
42
43
|
* Server-side `MJ: AI Bridge Providers` entity enforcing the invariants the architecture documents
|
|
43
44
|
* (see `/plans/realtime/realtime-bridges-architecture.md` §3): the engine GATES every optional
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MJAIBridgeProviderEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJAIBridgeProviderEntityServer.server.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,mBAAmB,EAAoB,MAAM,sBAAsB,CAAC;AAC9G,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"MJAIBridgeProviderEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJAIBridgeProviderEntityServer.server.ts"],"names":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AAO,CAAC,CAAC;AACrG,CAAC;AAED,6DAA6D;AAC7D,SAAS,gBAAgB,CAAC,KAAc;IACpC,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC;IAClC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC;IACzC,OAAO,OAAO,KAAK,CAAC;AACxB,CAAC"}
|
|
@@ -4,14 +4,10 @@ import { MJAIRemoteBrowserProviderEntity } from '@memberjunction/core-entities';
|
|
|
4
4
|
* The complete set of known `IRemoteBrowserProviderFeatures` keys (see the generated
|
|
5
5
|
* `MJAIRemoteBrowserProviderEntity_IRemoteBrowserProviderFeatures` interface and
|
|
6
6
|
* `metadata/entities/JSONType-interfaces/IRemoteBrowserProviderFeatures.ts`). `SupportedFeatures`
|
|
7
|
-
* is a flat object of optional booleans,
|
|
8
|
-
* set and every value must be a boolean. Keeping the list here (rather than reflecting off a
|
|
9
|
-
* runtime value) makes the validator a PURE, dependency-free, easily-unit-tested function and
|
|
10
|
-
* gives a friendly "unknown feature flag" message that a free-form `additionalProperties:false`
|
|
11
|
-
* schema would not. Mirrors `KNOWN_BRIDGE_PROVIDER_FEATURE_KEYS`.
|
|
7
|
+
* is a flat object of optional booleans, verified at compile time against the generated interface.
|
|
12
8
|
*/
|
|
13
9
|
export declare const KNOWN_REMOTE_BROWSER_PROVIDER_FEATURE_KEYS: ReadonlySet<string>;
|
|
14
|
-
/** The valid `DefaultControlMode` values (
|
|
10
|
+
/** The valid `DefaultControlMode` values (derived from entity type + verified at compile time). */
|
|
15
11
|
export declare const REMOTE_BROWSER_CONTROL_MODES: ReadonlySet<string>;
|
|
16
12
|
/**
|
|
17
13
|
* Server-side `MJ: AI Remote Browser Providers` entity enforcing the invariants the Remote Browser
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MJAIRemoteBrowserProviderEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJAIRemoteBrowserProviderEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,mBAAmB,EAAuB,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE9G,OAAO,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"MJAIRemoteBrowserProviderEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJAIRemoteBrowserProviderEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,mBAAmB,EAAuB,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAE9G,OAAO,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAC;AA2BhF;;;;;GAKG;AACH,eAAO,MAAM,0CAA0C,EAAE,WAAW,CAAC,MAAM,CAAgD,CAAC;AAQ5H,mGAAmG;AACnG,eAAO,MAAM,4BAA4B,EAAE,WAAW,CAAC,MAAM,CAAkC,CAAC;AAEhG;;;;;;;;;;;;;;;;GAgBG;AACH,qBACa,qCAAsC,SAAQ,+BAA+B;IACtF,2EAA2E;IAC3E,IAAoB,0BAA0B,IAAI,OAAO,CAExD;IAEqB,aAAa,IAAI,OAAO,CAAC,gBAAgB,CAAC;CAqCnE;AAED;;;GAGG;AACH,wBAAgB,gCAAgC,CAAC,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,mBAAmB,GAAG,IAAI,CAanH;AAED;;;;;;;GAOG;AACH,wBAAgB,0CAA0C,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,mBAAmB,EAAE,CA8BhH;AAED;;;;;;;;;GASG;AACH,wBAAgB,kCAAkC,CAC9C,IAAI,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC/B,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACvC,mBAAmB,GAAG,IAAI,CA2B5B"}
|
|
@@ -7,17 +7,7 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
import { BaseEntity, ValidationErrorInfo, ValidationErrorType } from '@memberjunction/core';
|
|
8
8
|
import { RegisterClass } from '@memberjunction/global';
|
|
9
9
|
import { MJAIRemoteBrowserProviderEntity } from '@memberjunction/core-entities';
|
|
10
|
-
|
|
11
|
-
* The complete set of known `IRemoteBrowserProviderFeatures` keys (see the generated
|
|
12
|
-
* `MJAIRemoteBrowserProviderEntity_IRemoteBrowserProviderFeatures` interface and
|
|
13
|
-
* `metadata/entities/JSONType-interfaces/IRemoteBrowserProviderFeatures.ts`). `SupportedFeatures`
|
|
14
|
-
* is a flat object of optional booleans, so the validation is: every present key must be in this
|
|
15
|
-
* set and every value must be a boolean. Keeping the list here (rather than reflecting off a
|
|
16
|
-
* runtime value) makes the validator a PURE, dependency-free, easily-unit-tested function and
|
|
17
|
-
* gives a friendly "unknown feature flag" message that a free-form `additionalProperties:false`
|
|
18
|
-
* schema would not. Mirrors `KNOWN_BRIDGE_PROVIDER_FEATURE_KEYS`.
|
|
19
|
-
*/
|
|
20
|
-
export const KNOWN_REMOTE_BROWSER_PROVIDER_FEATURE_KEYS = new Set([
|
|
10
|
+
const REMOTE_BROWSER_FEATURE_KEYS = [
|
|
21
11
|
// Control substrate & strategies
|
|
22
12
|
'RawCdpControl',
|
|
23
13
|
'NativeAIControl',
|
|
@@ -33,9 +23,21 @@ export const KNOWN_REMOTE_BROWSER_PROVIDER_FEATURE_KEYS = new Set([
|
|
|
33
23
|
'MultiTab',
|
|
34
24
|
'FileDownloads',
|
|
35
25
|
'CaptchaSolving',
|
|
36
|
-
]
|
|
37
|
-
|
|
38
|
-
|
|
26
|
+
];
|
|
27
|
+
const _exhaustiveFeature = true;
|
|
28
|
+
void _exhaustiveFeature;
|
|
29
|
+
/**
|
|
30
|
+
* The complete set of known `IRemoteBrowserProviderFeatures` keys (see the generated
|
|
31
|
+
* `MJAIRemoteBrowserProviderEntity_IRemoteBrowserProviderFeatures` interface and
|
|
32
|
+
* `metadata/entities/JSONType-interfaces/IRemoteBrowserProviderFeatures.ts`). `SupportedFeatures`
|
|
33
|
+
* is a flat object of optional booleans, verified at compile time against the generated interface.
|
|
34
|
+
*/
|
|
35
|
+
export const KNOWN_REMOTE_BROWSER_PROVIDER_FEATURE_KEYS = new Set(REMOTE_BROWSER_FEATURE_KEYS);
|
|
36
|
+
const CONTROL_MODES = ['AgentOnly', 'ViewOnly', 'Collaborative'];
|
|
37
|
+
const _exhaustiveMode = true;
|
|
38
|
+
void _exhaustiveMode;
|
|
39
|
+
/** The valid `DefaultControlMode` values (derived from entity type + verified at compile time). */
|
|
40
|
+
export const REMOTE_BROWSER_CONTROL_MODES = new Set(CONTROL_MODES);
|
|
39
41
|
/**
|
|
40
42
|
* Server-side `MJ: AI Remote Browser Providers` entity enforcing the invariants the Remote Browser
|
|
41
43
|
* channel relies on (see `/plans/realtime/realtime-bridges-architecture.md` §4d-i). The engine GATES
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MJAIRemoteBrowserProviderEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJAIRemoteBrowserProviderEntityServer.server.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,mBAAmB,EAAoB,MAAM,sBAAsB,CAAC;AAC9G,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAC;
|
|
1
|
+
{"version":3,"file":"MJAIRemoteBrowserProviderEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJAIRemoteBrowserProviderEntityServer.server.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,mBAAmB,EAAE,mBAAmB,EAAoB,MAAM,sBAAsB,CAAC;AAC9G,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,+BAA+B,EAAE,MAAM,+BAA+B,CAAC;AAKhF,MAAM,2BAA2B,GAAG;IAChC,iCAAiC;IACjC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OAAO,CAC9B,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,SAAS,iBAAiB,CAAC,GAA8B;IACrD,IAAI,GAAG,IAAI,IAAI,IAAI,GAAG,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzC,OAAO,EAAE,CAAC;IACd,CAAC;IACD,IAAI,CAAC;QACD,MAAM,MAAM,GAAY,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QACxC,IAAI,MAAM,KAAK,IAAI,IAAI,OAAO,MAAM,KAAK,QAAQ,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,CAAC;YAC1E,OAAO,MAAiC,CAAC;QAC7C,CAAC;IACL,CAAC;IAAC,MAAM,CAAC;QACL,gGAAgG;IACpG,CAAC;IACD,OAAO,EAAE,CAAC;AACd,CAAC;AAED,0EAA0E;AAC1E,SAAS,kBAAkB,CAAC,OAAe,EAAE,KAAa;IACtD,OAAO,IAAI,mBAAmB,CAAC,mBAAmB,EAAE,OAAO,EAAE,KAAK,EAAE,mBAAmB,CAAC,OAAO,CAAC,CAAC;AACrG,CAAC;AAED,6DAA6D;AAC7D,SAAS,gBAAgB,CAAC,KAAc;IACpC,IAAI,KAAK,KAAK,IAAI;QAAE,OAAO,MAAM,CAAC;IAClC,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,OAAO,CAAC;IACzC,OAAO,OAAO,KAAK,CAAC;AACxB,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { EntitySaveOptions } from '@memberjunction/core';
|
|
2
|
+
import { MJEntityEntityExtended } from '@memberjunction/core-entities';
|
|
3
|
+
/**
|
|
4
|
+
* Server-side `MJ: Entities` entity — the runtime half of field-security lifecycle management.
|
|
5
|
+
*
|
|
6
|
+
* Turning `EnableFieldLevelSecurity` ON has to snapshot the entity's existing entity-level
|
|
7
|
+
* permissions into per-field rows, or the entity comes up with every field denied: on an
|
|
8
|
+
* enabled entity a field with no rows is denied, not open. The flag and its rows therefore have
|
|
9
|
+
* to land together — a committed flag with no rows locks every user out of every field until
|
|
10
|
+
* someone notices.
|
|
11
|
+
*
|
|
12
|
+
* Turning it OFF writes nothing. Rows are retained and simply stop being consulted, so
|
|
13
|
+
* re-enabling does not lose an administrator's configuration. Re-enabling runs the same
|
|
14
|
+
* reconciliation, which adds whatever the schema gained in the meantime and leaves existing
|
|
15
|
+
* rows alone.
|
|
16
|
+
*/
|
|
17
|
+
export declare class MJEntityEntityServer extends MJEntityEntityExtended {
|
|
18
|
+
Save(options?: EntitySaveOptions): Promise<boolean>;
|
|
19
|
+
/**
|
|
20
|
+
* True when this save switches field security from off to on.
|
|
21
|
+
*
|
|
22
|
+
* A new record with the flag already set counts — there is no prior state, so the rows
|
|
23
|
+
* still have to be created. On an existing record the field must be dirty, or every
|
|
24
|
+
* unrelated edit to an entity enabled months ago would re-run reconciliation.
|
|
25
|
+
*/
|
|
26
|
+
private isTurningFieldSecurityOn;
|
|
27
|
+
/**
|
|
28
|
+
* Writes the snapshot rows for this entity, inside the caller's transaction.
|
|
29
|
+
*
|
|
30
|
+
* Resolves the `EntityInfo` from the provider rather than trusting a captured reference:
|
|
31
|
+
* the delta is computed from the entity's fields and entity-level permissions, and those
|
|
32
|
+
* live on metadata rather than on this record.
|
|
33
|
+
*/
|
|
34
|
+
private snapshotFieldPermissions;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=MJEntityEntityServer.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MJEntityEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJEntityEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,iBAAiB,EAAuD,MAAM,sBAAsB,CAAC;AAC1H,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AAIvE;;;;;;;;;;;;;GAaG;AACH,qBACa,oBAAqB,SAAQ,sBAAsB;IACtC,IAAI,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;IAiBzE;;;;;;OAMG;IACH,OAAO,CAAC,wBAAwB;IAOhC;;;;;;OAMG;YACW,wBAAwB;CAWzC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { BaseEntity, LogDebug, RunInEntityTransaction } from '@memberjunction/core';
|
|
8
|
+
import { MJEntityEntityExtended } from '@memberjunction/core-entities';
|
|
9
|
+
import { RegisterClass, UUIDsEqual } from '@memberjunction/global';
|
|
10
|
+
import { ReconcileFieldPermissions } from './fieldPermissionReconciler.js';
|
|
11
|
+
/**
|
|
12
|
+
* Server-side `MJ: Entities` entity — the runtime half of field-security lifecycle management.
|
|
13
|
+
*
|
|
14
|
+
* Turning `EnableFieldLevelSecurity` ON has to snapshot the entity's existing entity-level
|
|
15
|
+
* permissions into per-field rows, or the entity comes up with every field denied: on an
|
|
16
|
+
* enabled entity a field with no rows is denied, not open. The flag and its rows therefore have
|
|
17
|
+
* to land together — a committed flag with no rows locks every user out of every field until
|
|
18
|
+
* someone notices.
|
|
19
|
+
*
|
|
20
|
+
* Turning it OFF writes nothing. Rows are retained and simply stop being consulted, so
|
|
21
|
+
* re-enabling does not lose an administrator's configuration. Re-enabling runs the same
|
|
22
|
+
* reconciliation, which adds whatever the schema gained in the meantime and leaves existing
|
|
23
|
+
* rows alone.
|
|
24
|
+
*/
|
|
25
|
+
let MJEntityEntityServer = class MJEntityEntityServer extends MJEntityEntityExtended {
|
|
26
|
+
async Save(options) {
|
|
27
|
+
if (!this.isTurningFieldSecurityOn()) {
|
|
28
|
+
return super.Save(options);
|
|
29
|
+
}
|
|
30
|
+
const provider = this.ProviderToUse;
|
|
31
|
+
return RunInEntityTransaction(this.ProviderToUse, async () => {
|
|
32
|
+
// The flag has to persist BEFORE reconciliation: the rows it writes are only
|
|
33
|
+
// meaningful once the flag says they apply.
|
|
34
|
+
if (!(await super.Save(options))) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
await this.snapshotFieldPermissions(provider);
|
|
38
|
+
return true;
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* True when this save switches field security from off to on.
|
|
43
|
+
*
|
|
44
|
+
* A new record with the flag already set counts — there is no prior state, so the rows
|
|
45
|
+
* still have to be created. On an existing record the field must be dirty, or every
|
|
46
|
+
* unrelated edit to an entity enabled months ago would re-run reconciliation.
|
|
47
|
+
*/
|
|
48
|
+
isTurningFieldSecurityOn() {
|
|
49
|
+
if (!this.EnableFieldLevelSecurity) {
|
|
50
|
+
return false;
|
|
51
|
+
}
|
|
52
|
+
return !this.IsSaved || this.GetFieldByName('EnableFieldLevelSecurity').Dirty;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Writes the snapshot rows for this entity, inside the caller's transaction.
|
|
56
|
+
*
|
|
57
|
+
* Resolves the `EntityInfo` from the provider rather than trusting a captured reference:
|
|
58
|
+
* the delta is computed from the entity's fields and entity-level permissions, and those
|
|
59
|
+
* live on metadata rather than on this record.
|
|
60
|
+
*/
|
|
61
|
+
async snapshotFieldPermissions(provider) {
|
|
62
|
+
const entityInfo = provider.Entities?.find(e => UUIDsEqual(e.ID, this.ID));
|
|
63
|
+
if (!entityInfo) {
|
|
64
|
+
// Metadata has not caught up with a brand-new entity yet. CodeGen's manage-metadata
|
|
65
|
+
// pass reconciles it on its next run, which is the same path a schema change takes.
|
|
66
|
+
LogDebug(`[FieldSecurity] '${this.Name}' enabled before its metadata was available; deferring snapshot`);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
const result = await ReconcileFieldPermissions(entityInfo, provider, this.ContextCurrentUser);
|
|
70
|
+
LogDebug(`[FieldSecurity] '${this.Name}' enabled; snapshot wrote ${result.Inserted} row(s)`);
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
MJEntityEntityServer = __decorate([
|
|
74
|
+
RegisterClass(BaseEntity, 'MJ: Entities')
|
|
75
|
+
], MJEntityEntityServer);
|
|
76
|
+
export { MJEntityEntityServer };
|
|
77
|
+
//# sourceMappingURL=MJEntityEntityServer.server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MJEntityEntityServer.server.js","sourceRoot":"","sources":["../../src/custom/MJEntityEntityServer.server.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAwC,QAAQ,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAC;AAC1H,OAAO,EAAE,sBAAsB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACnE,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AAExE;;;;;;;;;;;;;GAaG;AAEI,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,sBAAsB;IAC5C,KAAK,CAAC,IAAI,CAAC,OAA2B;QAClD,IAAI,CAAC,IAAI,CAAC,wBAAwB,EAAE,EAAE,CAAC;YACnC,OAAO,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC/B,CAAC;QAED,MAAM,QAAQ,GAAG,IAAI,CAAC,aAA6C,CAAC;QACpE,OAAO,sBAAsB,CAAC,IAAI,CAAC,aAAa,EAAE,KAAK,IAAI,EAAE;YACzD,6EA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veOptions, EntityInfo, FieldPermissionRuleVerbs, ValidationResult } from '@memberjunction/core';
|
|
2
|
+
import { MJEntityFieldPermissionEntity } from '@memberjunction/core-entities';
|
|
3
|
+
/**
|
|
4
|
+
* Server-side `MJ: Entity Field Permissions` entity — the save-time half of the
|
|
5
|
+
* unrestrictable-target guard for field-level security.
|
|
6
|
+
*
|
|
7
|
+
* The runtime aggregation (`EntityFieldInfo.GetUserFieldPermissions`) already forces access
|
|
8
|
+
* open for these targets, so this subclass is not what makes the system safe. It is what makes
|
|
9
|
+
* the system *diagnosable*: without it an administrator can save a row that silently does
|
|
10
|
+
* nothing, then reasonably conclude the feature is broken. Rejecting at save says why.
|
|
11
|
+
*
|
|
12
|
+
* Two categories are refused, matching the two runtime guards exactly:
|
|
13
|
+
*
|
|
14
|
+
* 1. **Primary keys and system columns.** Stripping a primary key from a result breaks entity
|
|
15
|
+
* load, `CompositeKey` construction, relationship resolution, and cache fingerprinting —
|
|
16
|
+
* failures that surface nowhere near the permission record that caused them.
|
|
17
|
+
* 2. **The security-configuration and identity surface** (see
|
|
18
|
+
* {@link EntityFieldInfo.IsOnUnrestrictableEntity}). Restricting a column on the very
|
|
19
|
+
* entities field security is administered through produces a configuration that cannot be
|
|
20
|
+
* reversed through the product — recovery would mean direct SQL against the database.
|
|
21
|
+
*
|
|
22
|
+
* A third category is refused for a different reason: a **`Deny`** aimed at a role the MJ system
|
|
23
|
+
* user holds (see {@link SystemUserRoleRejectionReason}). That one is not about diagnosability —
|
|
24
|
+
* it is what lets the runtime aggregation have no exempt user at all. The server's own account
|
|
25
|
+
* gets its access from ordinary `Allow` rows like everyone else, and this guard is what stops
|
|
26
|
+
* those being revoked.
|
|
27
|
+
*
|
|
28
|
+
* Note what is deliberately NOT here: any notion of a user who is exempt from a Deny at
|
|
29
|
+
* RUNTIME. The guards are on which *targets* are restrictable and on what may be *configured*,
|
|
30
|
+
* never on whose access is evaluated. A feature whose purpose is compensation and donor-giving
|
|
31
|
+
* confidentiality cannot ship with a role that quietly reads everything.
|
|
32
|
+
*/
|
|
33
|
+
export declare class MJEntityFieldPermissionEntityServer extends MJEntityFieldPermissionEntity {
|
|
34
|
+
Validate(): ValidationResult;
|
|
35
|
+
/**
|
|
36
|
+
* Refuses an EDIT that would strip the MJ system user's last `Allow` on a field.
|
|
37
|
+
*
|
|
38
|
+
* Not in `Validate()` for two reasons. It needs the field's rules as they stand in the
|
|
39
|
+
* DATABASE — loaded metadata lags recent writes, and reading a stale sibling row as `Allow` is
|
|
40
|
+
* exactly how three individually-innocent `No Access` edits get through one at a time. And
|
|
41
|
+
* loading them is asynchronous, which `Validate()` is not.
|
|
42
|
+
*
|
|
43
|
+
* Inserts are deliberately not checked: adding a rule can only add access, never remove an
|
|
44
|
+
* existing `Allow`, so the `Deny` check in `Validate()` covers them completely. It has to —
|
|
45
|
+
* snapshot initialization writes its rows one at a time, and an aggregate check would refuse
|
|
46
|
+
* the half-built state.
|
|
47
|
+
*/
|
|
48
|
+
Save(options?: EntitySaveOptions): Promise<boolean>;
|
|
49
|
+
/**
|
|
50
|
+
* Refuses a DELETE that would strip the MJ system user's last `Allow` on a field — the other
|
|
51
|
+
* way, besides editing one to `No Access`, to remove access without writing a `Deny`.
|
|
52
|
+
*
|
|
53
|
+
* Reconciliation's own orphan deletes are unaffected: it only removes rows whose role has lost
|
|
54
|
+
* entity-level read (so the system user is already denied one level up and the guard stands
|
|
55
|
+
* down) or whose field became unrestrictable (forced open regardless).
|
|
56
|
+
*/
|
|
57
|
+
Delete(options?: EntityDeleteOptions): Promise<boolean>;
|
|
58
|
+
/**
|
|
59
|
+
* Records a refusal on the result history so `LatestResult.CompleteMessage` explains it, and
|
|
60
|
+
* returns false — the contract `Save()` and `Delete()` already have for a logical failure.
|
|
61
|
+
*/
|
|
62
|
+
private refuse;
|
|
63
|
+
/**
|
|
64
|
+
* Why the pending change would leave the system user short of its entity-level access, or null.
|
|
65
|
+
*
|
|
66
|
+
* @param removing true when this row is being deleted rather than edited
|
|
67
|
+
*/
|
|
68
|
+
private systemUserAccessLossReason;
|
|
69
|
+
/**
|
|
70
|
+
* Every rule currently stored against this field, straight from the database.
|
|
71
|
+
*
|
|
72
|
+
* `BypassCache` because this decides an access-control question: a cached result that predates
|
|
73
|
+
* a sibling row's edit would answer it with data the guard is specifically trying to catch up
|
|
74
|
+
* with. Inside a transaction this reads the scope's own uncommitted writes, which is what
|
|
75
|
+
* reconciliation needs.
|
|
76
|
+
*/
|
|
77
|
+
private loadCurrentRules;
|
|
78
|
+
/**
|
|
79
|
+
* Why this rule may not target this role, or null when it may.
|
|
80
|
+
*
|
|
81
|
+
* Refuses a **restricting** rule aimed at a role the MJ **system user** holds. The system
|
|
82
|
+
* user is what the server runs background work as: it pre-warms the shared engine caches at
|
|
83
|
+
* startup, and in task mode (job and agent runners) whichever caller touches an engine first
|
|
84
|
+
* configures it for the whole process. Restricting that account does not just restrict it —
|
|
85
|
+
* engines cache their data process-wide, so a partially loaded engine would then serve
|
|
86
|
+
* incomplete records to every user afterward. The damage is silent and nowhere near the rule
|
|
87
|
+
* that caused it.
|
|
88
|
+
*
|
|
89
|
+
* **Only a `Deny` is refused.** Field security has no runtime exemption for any user, so the
|
|
90
|
+
* system user's own access comes from ordinary rows: snapshot initialization writes it
|
|
91
|
+
* `Allow` on every field its roles can read, and this guard is what stops that access being
|
|
92
|
+
* taken away again. `Allow` and `No Access` both save — `Allow` is the grant the server
|
|
93
|
+
* depends on, and `No Access` is neutral, unable to reduce access another role has granted.
|
|
94
|
+
* Refusing those would make it impossible to enable field security on any entity at all,
|
|
95
|
+
* since the standard roles (UI, Developer, Integration) carry entity permissions almost
|
|
96
|
+
* everywhere.
|
|
97
|
+
*
|
|
98
|
+
* This is a guard on CONFIGURATION, not a runtime exemption. What is refused is the
|
|
99
|
+
* arrangement that would make the server unable to do its own work. Take the role off the
|
|
100
|
+
* system user and the rule saves.
|
|
101
|
+
*
|
|
102
|
+
* The database tier already refuses the equivalent arrangement: CodeGen skips a column DENY
|
|
103
|
+
* for any role a service login belongs to, and warns. This is the same rule for the
|
|
104
|
+
* application tier.
|
|
105
|
+
*
|
|
106
|
+
* @param roleID the role the rule targets
|
|
107
|
+
* @param rule the rule's three verbs; omitted only by callers that are pre-checking a role
|
|
108
|
+
* rather than a specific rule, which are answered as though the rule denied
|
|
109
|
+
*/
|
|
110
|
+
static SystemUserRoleRejectionReason(roleID: string | null, rule?: FieldPermissionRuleVerbs): string | null;
|
|
111
|
+
/**
|
|
112
|
+
* Why this rule's Update/Create verbs may not target this field, or null when they may.
|
|
113
|
+
*
|
|
114
|
+
* A **read-only** field cannot be written through the API by anyone: it is excluded from the
|
|
115
|
+
* generated create input type and from the update SET list, and `BaseEntity` never marks it
|
|
116
|
+
* dirty. So an Update or Create verb on it is inert in both directions — a `Deny` prevents
|
|
117
|
+
* nothing that was possible, and an `Allow` grants nothing that was not. Left to save, it
|
|
118
|
+
* reads on screen as a working permission and silently is not one.
|
|
119
|
+
*
|
|
120
|
+
* **Read is untouched, deliberately.** Restricting READ on a read-only field is legitimate
|
|
121
|
+
* and is one of the main things administrators want: foreign-key display columns are
|
|
122
|
+
* read-only, and "hide which client this contract belongs to" is exactly a read restriction
|
|
123
|
+
* on one. Only the two write verbs are refused.
|
|
124
|
+
*
|
|
125
|
+
* Note `EntityFieldInfo.ReadOnly` is the right predicate here, not `IsVirtual`: IS-A parent
|
|
126
|
+
* fields are virtual but ARE writable through the child's save chain, and `ReadOnly` is
|
|
127
|
+
* defined off `AllowUpdateAPI` precisely to tell those apart from joined display columns.
|
|
128
|
+
*/
|
|
129
|
+
static WriteVerbRejectionReason(field: EntityFieldInfo, rule: FieldPermissionRuleVerbs): string | null;
|
|
130
|
+
/**
|
|
131
|
+
* Why this field may not be secured, or null when it may be.
|
|
132
|
+
* Static + field-driven so the same wording can back a future admin-UI pre-check.
|
|
133
|
+
*/
|
|
134
|
+
static RejectionReason(field: EntityFieldInfo): string | null;
|
|
135
|
+
/**
|
|
136
|
+
* Resolves `EntityFieldID` to its {@link EntityFieldInfo} from loaded metadata.
|
|
137
|
+
*
|
|
138
|
+
* Returns null when metadata cannot resolve it — for instance immediately after a schema
|
|
139
|
+
* change, before the metadata cache has refreshed. That case passes validation rather than
|
|
140
|
+
* blocking the administrator: the foreign key already guarantees the row points at a real
|
|
141
|
+
* field, and the runtime aggregation guards hold regardless of what is stored here. Failing
|
|
142
|
+
* closed would trade a real, recurring workflow block for no additional protection.
|
|
143
|
+
*/
|
|
144
|
+
/**
|
|
145
|
+
* Why this role may not carry a field rule on this entity, or null when it may.
|
|
146
|
+
*
|
|
147
|
+
* A field permission REFINES an entity permission — the entity gate decides whether you reach
|
|
148
|
+
* the record at all, and field rules then decide which columns of it you see. A rule bound to a
|
|
149
|
+
* role that has no relationship to the entity is not a refinement of anything, and it is the
|
|
150
|
+
* configuration that made the reconciler's orphan test ambiguous: such a row is fully live at
|
|
151
|
+
* runtime (aggregation matches on role membership alone) while looking inert to any check that
|
|
152
|
+
* asks what the role can do on its own.
|
|
153
|
+
*
|
|
154
|
+
* Requires only that an entity-permission row EXISTS, not that it grants read. A role whose
|
|
155
|
+
* entity permission grants nothing is the ordinary way to express a deny-only carve-out —
|
|
156
|
+
* "these users are normal, minus this column" — and demanding a grant would force an
|
|
157
|
+
* administrator to hand out entity access in order to take a column away. Deleting the entity
|
|
158
|
+
* permission removes the relationship, and reconciliation then cleans up the field rules with
|
|
159
|
+
* it; see `computeOrphanRowIDs`, which tests exactly this condition.
|
|
160
|
+
*
|
|
161
|
+
* Attributed to `RoleID` because that is the value the administrator must change — either pick
|
|
162
|
+
* a role that has entity access, or grant this one an entity permission first.
|
|
163
|
+
*/
|
|
164
|
+
static EntityPermissionRequiredRejectionReason(entity: EntityInfo, roleID: string | null): string | null;
|
|
165
|
+
private resolveTarget;
|
|
166
|
+
}
|
|
167
|
+
//# sourceMappingURL=MJEntityFieldPermissionEntityServer.server.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MJEntityFieldPermissionEntityServer.server.d.ts","sourceRoot":"","sources":["../../src/custom/MJEntityFieldPermissionEntityServer.server.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,mBAAmB,EACnB,eAAe,EACf,iBAAiB,EACjB,UAAU,EAGV,wBAAwB,EAOxB,gBAAgB,EACnB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EAAE,6BAA6B,EAAE,MAAM,+BAA+B,CAAC;AAG9E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,qBACa,mCAAoC,SAAQ,6BAA6B;IAClE,QAAQ,IAAI,gBAAgB;IAyC5C;;;;;;;;;;;;OAYG;IACmB,IAAI,CAAC,OAAO,CAAC,EAAE,iBAAiB,GAAG,OAAO,CAAC,OAAO,CAAC;IAUzE;;;;;;;OAOG;IACmB,MAAM,CAAC,OAAO,CAAC,EAAE,mBAAmB,GAAG,OAAO,CAAC,OAAO,CAAC;IAQ7E;;;OAGG;IACH,OAAO,CAAC,MAAM;IAWd;;;;OAIG;YACW,0BAA0B;IA6BxC;;;;;;;OAOG;YACW,gBAAgB;IAyB9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA+BG;WACW,6BAA6B,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,IAAI,CAAC,EAAE,wBAAwB,GAAG,MAAM,GAAG,IAAI;IA0BlH;;;;;;;;;;;;;;;;;OAiBG;WACW,wBAAwB,CAAC,KAAK,EAAE,eAAe,EAAE,IAAI,EAAE,wBAAwB,GAAG,MAAM,GAAG,IAAI;IAkB7G;;;OAGG;WACW,eAAe,CAAC,KAAK,EAAE,eAAe,GAAG,MAAM,GAAG,IAAI;IAqBpE;;;;;;;;OAQG;IACH;;;;;;;;;;;;;;;;;;;OAmBG;WACW,uCAAuC,CAAC,MAAM,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI;IAe/G,OAAO,CAAC,aAAa;CAaxB"}
|