@mj-biz-apps/common-server 5.43.0 → 5.44.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.
@@ -0,0 +1,63 @@
1
+ /**
2
+ * The cipher this host protects captured content with.
3
+ *
4
+ * WHAT IT IS FOR. `ActivitySyncRunDetail.CapturedContent` holds content from messages the engine
5
+ * deliberately declined to ingest, kept so an auditor asking "what was in the message you did not
6
+ * file?" has an answer. Its own description settles how: *"Ciphertext, always — never plaintext,
7
+ * whatever the policy... Encrypted through MJ's EncryptionEngine against an MJ: Encryption Keys row;
8
+ * this app never implements its own crypto."*
9
+ *
10
+ * WHY IT LIVES HERE. `common-activity-sync` holds to the second half of that sentence by taking no
11
+ * runtime dependency on the Encryption engine and asking a host for a cipher instead. This package
12
+ * already depends on MJ's engines, already runs at MJAPI startup, and already fills the other two
13
+ * seams the same way — so it fills this one too.
14
+ *
15
+ * That last part is the whole point. A seam nothing implements is the defect this subsystem keeps
16
+ * being cleaned of: `ActivityFileSink` is exported, documented and registered, and its `Store()` has
17
+ * no caller on any real path. This interface ships WITH its implementation so it never reaches that
18
+ * state.
19
+ *
20
+ * @module @mj-biz-apps/common-server
21
+ */
22
+ import type { UserInfo } from '@memberjunction/core';
23
+ import { type ActivityContentCipher } from '@mj-biz-apps/common-activity-sync';
24
+ /**
25
+ * Encrypts through MJ, and does nothing else.
26
+ *
27
+ * NO DECRYPTION, deliberately. `ActivityContentCipher` has one method because the sync engine never
28
+ * needs to read captured content back — that is an audit action performed by a person holding the
29
+ * key. An engine that cannot decrypt cannot leak, and keeping the interface to one direction means
30
+ * the capability is not sitting there to be misused later.
31
+ */
32
+ export declare class MJActivityContentCipher implements ActivityContentCipher {
33
+ /**
34
+ * The user is forwarded because the SEAM carries it, not because this engine needs it.
35
+ *
36
+ * `Encrypt` only consults `contextUser` when the engine has not been configured, and by the time
37
+ * any capture runs it always has: `setupSQLServerClient` calls `StartupManager.Startup()`, which
38
+ * configures this engine with a system user. That holds even when key validation FAILS — `Loaded`
39
+ * means the metadata loaded, and the key-material check is a separate step. Measured in a fresh
40
+ * process against a host with no usable key: with and without a user, `Encrypt` returns the same
41
+ * error either way.
42
+ *
43
+ * So this forwards an argument MJ does not presently read. It is still right to forward: MJ's own
44
+ * `ResolverBase` passes the user at both of its call sites rather than trusting startup, and the
45
+ * interface's contract is written for hosts whose cipher must reach key material as somebody.
46
+ *
47
+ * @throws whatever `EncryptionEngine` throws for a missing or unusable key. Throwing is correct:
48
+ * the engine records the failure as a run issue and saves the decision without content.
49
+ * The alternative — returning the plaintext, or an empty string — would put unprotected
50
+ * content in a column whose contract is "ciphertext, always".
51
+ */
52
+ Encrypt(plaintext: string, encryptionKeyID: string, contextUser: UserInfo): Promise<string>;
53
+ }
54
+ /**
55
+ * Register it. Called from `LoadBizAppsCommonServer` at MJAPI startup.
56
+ *
57
+ * Unconditional, and cheap to be so: registering a cipher does not turn retention on. Retention is
58
+ * off unless a provider type or connection sets `SkippedContentPolicy` above `None`, and the engine
59
+ * refuses to run at all if a policy asks for capture that this host cannot encrypt. Registering
60
+ * always means that refusal is about the POLICY being wrong, never about the host being half-wired.
61
+ */
62
+ export declare function LoadActivityContentCipher(): void;
63
+ //# sourceMappingURL=activity-content-cipher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activity-content-cipher.d.ts","sourceRoot":"","sources":["../../src/custom/activity-content-cipher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAiC,KAAK,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE9G;;;;;;;GAOG;AACH,qBAAa,uBAAwB,YAAW,qBAAqB;IACjE;;;;;;;;;;;;;;;;;;OAkBG;IACU,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,WAAW,EAAE,QAAQ,GAAG,OAAO,CAAC,MAAM,CAAC;CAG3G;AAED;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,IAAI,IAAI,CAEhD"}
@@ -0,0 +1,46 @@
1
+ import { EncryptionEngine } from '@memberjunction/encryption';
2
+ import { RegisterActivityContentCipher } from '@mj-biz-apps/common-activity-sync';
3
+ /**
4
+ * Encrypts through MJ, and does nothing else.
5
+ *
6
+ * NO DECRYPTION, deliberately. `ActivityContentCipher` has one method because the sync engine never
7
+ * needs to read captured content back — that is an audit action performed by a person holding the
8
+ * key. An engine that cannot decrypt cannot leak, and keeping the interface to one direction means
9
+ * the capability is not sitting there to be misused later.
10
+ */
11
+ export class MJActivityContentCipher {
12
+ /**
13
+ * The user is forwarded because the SEAM carries it, not because this engine needs it.
14
+ *
15
+ * `Encrypt` only consults `contextUser` when the engine has not been configured, and by the time
16
+ * any capture runs it always has: `setupSQLServerClient` calls `StartupManager.Startup()`, which
17
+ * configures this engine with a system user. That holds even when key validation FAILS — `Loaded`
18
+ * means the metadata loaded, and the key-material check is a separate step. Measured in a fresh
19
+ * process against a host with no usable key: with and without a user, `Encrypt` returns the same
20
+ * error either way.
21
+ *
22
+ * So this forwards an argument MJ does not presently read. It is still right to forward: MJ's own
23
+ * `ResolverBase` passes the user at both of its call sites rather than trusting startup, and the
24
+ * interface's contract is written for hosts whose cipher must reach key material as somebody.
25
+ *
26
+ * @throws whatever `EncryptionEngine` throws for a missing or unusable key. Throwing is correct:
27
+ * the engine records the failure as a run issue and saves the decision without content.
28
+ * The alternative — returning the plaintext, or an empty string — would put unprotected
29
+ * content in a column whose contract is "ciphertext, always".
30
+ */
31
+ async Encrypt(plaintext, encryptionKeyID, contextUser) {
32
+ return EncryptionEngine.Instance.Encrypt(plaintext, encryptionKeyID, contextUser);
33
+ }
34
+ }
35
+ /**
36
+ * Register it. Called from `LoadBizAppsCommonServer` at MJAPI startup.
37
+ *
38
+ * Unconditional, and cheap to be so: registering a cipher does not turn retention on. Retention is
39
+ * off unless a provider type or connection sets `SkippedContentPolicy` above `None`, and the engine
40
+ * refuses to run at all if a policy asks for capture that this host cannot encrypt. Registering
41
+ * always means that refusal is about the POLICY being wrong, never about the host being half-wired.
42
+ */
43
+ export function LoadActivityContentCipher() {
44
+ RegisterActivityContentCipher(new MJActivityContentCipher());
45
+ }
46
+ //# sourceMappingURL=activity-content-cipher.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"activity-content-cipher.js","sourceRoot":"","sources":["../../src/custom/activity-content-cipher.ts"],"names":[],"mappings":"AAsBA,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,6BAA6B,EAA8B,MAAM,mCAAmC,CAAC;AAE9G;;;;;;;GAOG;AACH,MAAM,OAAO,uBAAuB;IAChC;;;;;;;;;;;;;;;;;;OAkBG;IACI,KAAK,CAAC,OAAO,CAAC,SAAiB,EAAE,eAAuB,EAAE,WAAqB;QAClF,OAAO,gBAAgB,CAAC,QAAQ,CAAC,OAAO,CAAC,SAAS,EAAE,eAAe,EAAE,WAAW,CAAC,CAAC;IACtF,CAAC;CACJ;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,yBAAyB;IACrC,6BAA6B,CAAC,IAAI,uBAAuB,EAAE,CAAC,CAAC;AACjE,CAAC"}
package/dist/index.d.ts CHANGED
@@ -21,5 +21,6 @@ export declare function LoadBizAppsCommonServer(): void;
21
21
  export { SyncActivitiesAction, LoadSyncActivitiesAction } from './custom/sync-activities.action.js';
22
22
  export { LogActivityAction, LoadLogActivityAction } from './custom/log-activity.action.js';
23
23
  export { GraphTransportFactory, LoadGraphTransportFactory } from './custom/graph-transport-factory.js';
24
+ export { MJActivityContentCipher, LoadActivityContentCipher } from './custom/activity-content-cipher.js';
24
25
  export { LoadLiveMailboxPolicyFromEnv, ENV_GROUP, ENV_ACCEPTED_RISK, ENV_CONFIRMED_BY, ENV_CONFIRMED_AT, } from './custom/live-mailbox-policy.js';
25
26
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,8BAA8B,CAAC;AACtC,OAAO,6BAA6B,CAAC;AAIrC,OAAO,0CAA0C,CAAC;AAQlD,OAAO,0BAA0B,CAAC;AAMlC,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAOlF,oFAAoF;AACpF,eAAO,MAAM,cAAc,UAAsD,CAAC;AAElF;;;;GAIG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,CAa9C;AAED,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AACpG,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAC3F,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AACvG,OAAO,EACH,4BAA4B,EAC5B,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,GACnB,MAAM,iCAAiC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,8BAA8B,CAAC;AACtC,OAAO,6BAA6B,CAAC;AAIrC,OAAO,0CAA0C,CAAC;AASlD,OAAO,0BAA0B,CAAC;AAMlC,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAOlF,oFAAoF;AACpF,eAAO,MAAM,cAAc,UAAsD,CAAC;AAElF;;;;GAIG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,CAkB9C;AAED,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AACpG,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAC3F,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AACvG,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AACzG,OAAO,EACH,4BAA4B,EAC5B,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,GACnB,MAAM,iCAAiC,CAAC"}
package/dist/index.js CHANGED
@@ -16,6 +16,7 @@ import { LoadSyncActivitiesAction } from './custom/sync-activities.action.js';
16
16
  import { LoadLogActivityAction } from './custom/log-activity.action.js';
17
17
  import { LoadGraphTransportFactory } from './custom/graph-transport-factory.js';
18
18
  import { LoadLiveMailboxPolicyFromEnv } from './custom/live-mailbox-policy.js';
19
+ import { LoadActivityContentCipher } from './custom/activity-content-cipher.js';
19
20
  // Import generated GraphQL resolvers
20
21
  import './generated/generated.js';
21
22
  // Re-export the manifest for consumers
@@ -43,9 +44,15 @@ export function LoadBizAppsCommonServer() {
43
44
  // And that attestation, when this deployment has one. Absent, every live read stays refused;
44
45
  // partially configured, this THROWS during bootstrap rather than leaving a misleading refusal.
45
46
  LoadLiveMailboxPolicyFromEnv();
47
+ // And the cipher that protects content captured from messages the engine declined to ingest.
48
+ // Registering it turns nothing on: retention is off unless a policy asks for it. What it does is
49
+ // make the engine's refusal, when a policy DOES ask, be about the policy rather than about this
50
+ // host being half-wired.
51
+ LoadActivityContentCipher();
46
52
  }
47
53
  export { SyncActivitiesAction, LoadSyncActivitiesAction } from './custom/sync-activities.action.js';
48
54
  export { LogActivityAction, LoadLogActivityAction } from './custom/log-activity.action.js';
49
55
  export { GraphTransportFactory, LoadGraphTransportFactory } from './custom/graph-transport-factory.js';
56
+ export { MJActivityContentCipher, LoadActivityContentCipher } from './custom/activity-content-cipher.js';
50
57
  export { LoadLiveMailboxPolicyFromEnv, ENV_GROUP, ENV_ACCEPTED_RISK, ENV_CONFIRMED_BY, ENV_CONFIRMED_AT, } from './custom/live-mailbox-policy.js';
51
58
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":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G;AACH,MAAM,UAAU,uBAAuB;IACnC,0DAA0D;IAC1D,kFAAkF;IAClF,sBAAsB,EAAE,CAAC;IACzB,wBAAwB,EAAE,CAAC;IAC3B,qBAAqB,EAAE,CAAC;IACxB,2FAA2F;IAC3F,4FAA4F;IAC5F,oDAAoD;IACpD,yBAAyB,EAAE,CAAC;IAC5B,6FAA6F;IAC7F,+FAA+F;IAC/F,4BAA4B,EAAE,CAAC;IAC/B,6FAA6F;IAC7F,iGAAiG;IACjG,gGAAgG;IAChG,yBAAyB;IACzB,yBAAyB,EAAE,CAAC;AAChC,CAAC;AAED,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AACpG,OAAO,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AAC3F,OAAO,EAAE,qBAAqB,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AACvG,OAAO,EAAE,uBAAuB,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AACzG,OAAO,EACH,4BAA4B,EAC5B,SAAS,EACT,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,GACnB,MAAM,iCAAiC,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@mj-biz-apps/common-server",
3
3
  "type": "module",
4
- "version": "5.43.0",
4
+ "version": "5.44.0",
5
5
  "description": "BizApps Common server bootstrap - GraphQL resolvers and class registrations for the Common business entities Open App",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -18,10 +18,10 @@
18
18
  "vitest": "^3.2.4"
19
19
  },
20
20
  "dependencies": {
21
- "@mj-biz-apps/common-activity-sync": "5.43.0",
22
- "@mj-biz-apps/common-core-entities-server": "5.43.0",
23
- "@mj-biz-apps/common-entities": "5.43.0",
24
- "@mj-biz-apps/common-actions": "5.43.0",
21
+ "@mj-biz-apps/common-activity-sync": "5.44.0",
22
+ "@mj-biz-apps/common-core-entities-server": "5.44.0",
23
+ "@mj-biz-apps/common-entities": "5.44.0",
24
+ "@mj-biz-apps/common-actions": "5.44.0",
25
25
  "class-validator": "^0.14.3"
26
26
  },
27
27
  "peerDependencies": {
@@ -30,6 +30,7 @@
30
30
  "@memberjunction/communication-types": "^6.1.0-edge.6",
31
31
  "@memberjunction/core": "^6.1.0-edge.6",
32
32
  "@memberjunction/credentials": "^6.1.0-edge.6",
33
+ "@memberjunction/encryption": "^6.1.0-edge.6",
33
34
  "@memberjunction/global": "^6.1.0-edge.6",
34
35
  "@memberjunction/server": "^6.1.0-edge.6",
35
36
  "@memberjunction/sqlserver-dataprovider": "^6.1.0-edge.6"