@mj-biz-apps/common-server 5.41.0 → 5.43.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.
@@ -1 +1 @@
1
- {"version":3,"file":"graph-transport-factory.d.ts","sourceRoot":"","sources":["../../src/custom/graph-transport-factory.ts"],"names":[],"mappings":"AAoBA,OAAO,EACH,4BAA4B,EAI5B,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAEhC,MAAM,mCAAmC,CAAC;AAK3C;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,wBAAwB,GAAG,wBAAwB,GAAG,IAAI,CAiBxG;AAgDD;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,IAAI,IAAI,CAEhD;AAED,8EAA8E;AAC9E,OAAO,EAAE,4BAA4B,EAAE,CAAC"}
1
+ {"version":3,"file":"graph-transport-factory.d.ts","sourceRoot":"","sources":["../../src/custom/graph-transport-factory.ts"],"names":[],"mappings":"AAoBA,OAAO,EACH,4BAA4B,EAM5B,KAAK,wBAAwB,EAC7B,KAAK,wBAAwB,EAGhC,MAAM,mCAAmC,CAAC;AAO3C;;;;;;;;;;;;GAYG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,wBAAwB,GAAG,wBAAwB,GAAG,IAAI,CAoCxG;AA2DD;;;;;;;GAOG;AACH,wBAAgB,yBAAyB,IAAI,IAAI,CAEhD;AAED,8EAA8E;AAC9E,OAAO,EAAE,4BAA4B,EAAE,CAAC"}
@@ -17,9 +17,11 @@
17
17
  import { BaseCommunicationProvider } from '@memberjunction/communication-types';
18
18
  import { CredentialEngine } from '@memberjunction/credentials';
19
19
  import { MJGlobal } from '@memberjunction/global';
20
- import { GRAPH_COMMUNICATION_PROVIDER, GraphCommunicationTransport, MJGraphTransportDeps, RegisterActivityTransportFactory, } from '@mj-biz-apps/common-activity-sync';
21
- /** The `ActivitySyncProviderType.DriverClass` this factory serves. It serves exactly one. */
20
+ import { GRAPH_COMMUNICATION_PROVIDER, GraphCalendarTransport, GraphCommunicationTransport, MJGraphCalendarTransportDeps, MJGraphTransportDeps, RegisterActivityTransportFactory, } from '@mj-biz-apps/common-activity-sync';
21
+ /** `ActivitySyncProviderType.DriverClass` — the mail surface. */
22
22
  const MICROSOFT_365 = 'Microsoft365';
23
+ /** `ActivitySyncProviderType.CalendarDriverClass` — the calendar surface of the same connection. */
24
+ const MICROSOFT_365_CALENDAR = 'Microsoft365.Calendar';
23
25
  /**
24
26
  * Build a live Graph transport for one connection, or null when this factory cannot serve it.
25
27
  *
@@ -34,17 +36,32 @@ const MICROSOFT_365 = 'Microsoft365';
34
36
  * Anything else is a wiring fault and is left to throw.
35
37
  */
36
38
  export function GraphTransportFactory(context) {
37
- if (context.DriverClass !== MICROSOFT_365) {
39
+ const isMail = context.DriverClass === MICROSOFT_365;
40
+ const isCalendar = context.DriverClass === MICROSOFT_365_CALENDAR;
41
+ if (!isMail && !isCalendar) {
38
42
  return null;
39
43
  }
40
44
  const credentialName = (context.CredentialsRef ?? '').trim();
41
45
  if (!credentialName) {
42
46
  return null;
43
47
  }
44
- return new GraphCommunicationTransport(MJGraphTransportDeps({
48
+ // ONE FACTORY, TWO SURFACES, ONE CREDENTIAL. A connection configures a single CredentialsRef and
49
+ // both of its surfaces resolve through it — the same app registration holds Mail.Read and
50
+ // Calendars.Read, and the same Exchange policy scopes both. Separate factories would let a
51
+ // connection end up reading mail as one principal and calendar as another.
52
+ const shared = {
45
53
  CredentialName: credentialName,
46
54
  ContextUser: context.ContextUser,
47
55
  GetCredentialEngine: () => CredentialLoader(context.ContextUser),
56
+ };
57
+ if (isCalendar) {
58
+ return new GraphCalendarTransport(MJGraphCalendarTransportDeps({
59
+ ...shared,
60
+ GetCommunicationProvider: ResolveCommunicationProviderForEvents,
61
+ }));
62
+ }
63
+ return new GraphCommunicationTransport(MJGraphTransportDeps({
64
+ ...shared,
48
65
  GetCommunicationProvider: ResolveCommunicationProvider,
49
66
  }));
50
67
  }
@@ -89,6 +106,16 @@ function ResolveCommunicationProvider(name) {
89
106
  }
90
107
  return instance;
91
108
  }
109
+ /**
110
+ * The same registered provider, viewed as an event reader.
111
+ *
112
+ * Delegates rather than duplicating the base-class check: `ClassFactory.CreateInstance` returns an
113
+ * instance of the BASE class when no registration matches, so a missing provider comes back truthy
114
+ * and answers nothing usefully. That check is load-bearing and must not exist in two places.
115
+ */
116
+ function ResolveCommunicationProviderForEvents(name) {
117
+ return ResolveCommunicationProvider(name);
118
+ }
92
119
  /**
93
120
  * Register this host's factory. Called once from the package bootstrap.
94
121
  *
@@ -1 +1 @@
1
- {"version":3,"file":"graph-transport-factory.js","sourceRoot":"","sources":["../../src/custom/graph-transport-factory.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AACH,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAChF,OAAO,EAAE,gBAAgB,EAAE,MAAM,6BAA6B,CAAC;AAE/D,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EACH,4BAA4B,EAC5B,2BAA2B,EAC3B,oBAAoB,EACpB,gCAAgC,GAInC,MAAM,mCAAmC,CAAC;AAE3C,6FAA6F;AAC7F,MAAM,aAAa,GAAG,cAAc,CAAC;AAErC;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,qBAAqB,CAAC,OAAiC;IACnE,IAAI,OAAO,CAAC,WAAW,KAAK,aAAa,EAAE,CAAC;QACxC,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,MAAM,cAAc,GAAG,CAAC,OAAO,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IAC7D,IAAI,CAAC,cAAc,EAAE,CAAC;QAClB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,IAAI,2BAA2B,CAClC,oBAAoB,CAAC;QACjB,cAAc,EAAE,cAAc;QAC9B,WAAW,EAAE,OAAO,CAAC,WAAW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KACzD,CAAC,CACL,CAAC;AACN,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,gBAAgB,CAAC,WAAsB;IAC5C,OAAO;QACH,KAAK,CAAC,aAAa,CAAI,IAAY,EAAE,OAAiC;YAClE,MAAM,IAAI,GAAI,OAAO,EAAE,WAAoC,IAAI,WAAW,CAAC;YAC3E,MAAM,gBAAgB,CAAC,QAAQ,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;YACnD,OAAO,gBAAgB,CAAC,QAAQ,CAAC,aAAa,CAAC,IAAI,EAAE;gBACjD,WAAW,EAAE,IAAI;gBACjB,SAAS,EAAE,6BAA6B;aAC3C,CAAsC,CAAC;QAC5C,CAAC;KACJ,CAAC;AACN,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,SAAS,4BAA4B,CAAC,IAAY;IAC9C,MAAM,QAAQ,GAAG,QAAQ,CAAC,QAAQ,CAAC,YAAY,CAAC,cAAc,CAC1D,yBAAyB,EACzB,IAAI,CACP,CAAC;IACF,IAAI,CAAC,QAAQ,IAAI,QAAQ,CAAC,WAAW,CAAC,IAAI,KAAK,2BAA2B,EAAE,CAAC;QACzE,OAAO,IAAI,CAAC;IAChB,CAAC;IACD,OAAO,QAAyC,CAAC;AACrD,CAAC;AAED;;;;;;GAMG;AACH,SAAS,qCAAqC,CAAC,IAAY;IACvD,OAAO,4BAA4B,CAAC,IAAI,CAAuC,CAAC;AACpF,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,yBAAyB;IACrC,gCAAgC,CAAC,qBAAqB,CAAC,CAAC;AAC5D,CAAC;AAED,8EAA8E;AAC9E,OAAO,EAAE,4BAA4B,EAAE,CAAC"}
@@ -0,0 +1,31 @@
1
+ /**
2
+ * The mail-enabled security group the Exchange assignment names — when the app IS restricted.
3
+ *
4
+ * Set this OR `ACTIVITY_SYNC_MAILBOX_POLICY_ACCEPTED_RISK`, never both. They record the two decisions
5
+ * an organisation actually makes, and claiming both would say the app is simultaneously restricted
6
+ * and knowingly unrestricted.
7
+ */
8
+ export declare const ENV_GROUP = "ACTIVITY_SYNC_MAILBOX_POLICY_GROUP";
9
+ /**
10
+ * A sentence saying what is being accepted — when the tenant-wide grant is accepted as-is.
11
+ *
12
+ * Adding an API permission in Entra and creating an Exchange RBAC assignment are different jobs owned
13
+ * by different people, and plenty of deployments will do the first and not the second. That is a
14
+ * legitimate outcome; refusing to model it would leave those deployments inventing a group name or
15
+ * bypassing the gate, and both destroy the record this exists to keep.
16
+ */
17
+ export declare const ENV_ACCEPTED_RISK = "ACTIVITY_SYNC_MAILBOX_POLICY_ACCEPTED_RISK";
18
+ /** Who verified the policy exists. A person — the decision needs an owner. */
19
+ export declare const ENV_CONFIRMED_BY = "ACTIVITY_SYNC_MAILBOX_POLICY_CONFIRMED_BY";
20
+ /** When they verified it, as an ISO-8601 date. Policies get deleted; staleness should be visible. */
21
+ export declare const ENV_CONFIRMED_AT = "ACTIVITY_SYNC_MAILBOX_POLICY_CONFIRMED_AT";
22
+ /**
23
+ * Read the attestation from the environment and register it, if this host has one.
24
+ *
25
+ * Returns true when live fetch was enabled, false when the host is not configured for it. Throws
26
+ * only on a configuration that is present but wrong — see "set all three or none" above.
27
+ *
28
+ * @param env the environment to read; injected so this is testable without mutating process.env.
29
+ */
30
+ export declare function LoadLiveMailboxPolicyFromEnv(env?: NodeJS.ProcessEnv): boolean;
31
+ //# sourceMappingURL=live-mailbox-policy.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"live-mailbox-policy.d.ts","sourceRoot":"","sources":["../../src/custom/live-mailbox-policy.ts"],"names":[],"mappings":"AAyBA;;;;;;GAMG;AACH,eAAO,MAAM,SAAS,uCAAuC,CAAC;AAE9D;;;;;;;GAOG;AACH,eAAO,MAAM,iBAAiB,+CAA+C,CAAC;AAC9E,8EAA8E;AAC9E,eAAO,MAAM,gBAAgB,8CAA8C,CAAC;AAC5E,qGAAqG;AACrG,eAAO,MAAM,gBAAgB,8CAA8C,CAAC;AAO5E;;;;;;;GAOG;AACH,wBAAgB,4BAA4B,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAmE1F"}
@@ -0,0 +1,107 @@
1
+ /**
2
+ * How THIS host says it is scoped to read real mailboxes.
3
+ *
4
+ * WHAT IT IS PROTECTING. `MSGraphProvider` authenticates app-only, so the `Mail.Read` APPLICATION
5
+ * permission is granted against the tenant, not against a mailbox: it reads EVERY mailbox in the
6
+ * organisation. The `Mailbox` column on a connection narrows what we ASK for, not what we are
7
+ * ALLOWED to read. Only an Exchange Application Access Policy, binding the app registration to a
8
+ * mail-enabled security group, narrows the grant itself.
9
+ *
10
+ * WHY ENVIRONMENT AND NOT A DATABASE ROW. `ActivitySyncConnection` is an ordinary editable entity.
11
+ * If the opt-in lived there, anyone who could edit a row could turn on tenant-wide mail reading from
12
+ * a form. Deployment configuration is the right altitude: changing it needs access to the host, and
13
+ * it is reviewed and deployed rather than typed. This is the same reasoning the package already
14
+ * applies to the transport itself — "a database row should not be able to reach in and swap it".
15
+ *
16
+ * SET ALL THREE OR NONE. A partial configuration THROWS rather than quietly staying off. Silently
17
+ * ignoring a half-filled opt-in is the failure this codebase keeps being written against: an
18
+ * operator who set two of three variables would see refusals, believe the policy was wrong, and go
19
+ * looking in Exchange for a fault that is in their .env.
20
+ *
21
+ * @module @mj-biz-apps/common-server
22
+ */
23
+ import { LogStatus } from '@memberjunction/core';
24
+ import { AllowLiveMailboxFetch } from '@mj-biz-apps/common-activity-sync';
25
+ /**
26
+ * The mail-enabled security group the Exchange assignment names — when the app IS restricted.
27
+ *
28
+ * Set this OR `ACTIVITY_SYNC_MAILBOX_POLICY_ACCEPTED_RISK`, never both. They record the two decisions
29
+ * an organisation actually makes, and claiming both would say the app is simultaneously restricted
30
+ * and knowingly unrestricted.
31
+ */
32
+ export const ENV_GROUP = 'ACTIVITY_SYNC_MAILBOX_POLICY_GROUP';
33
+ /**
34
+ * A sentence saying what is being accepted — when the tenant-wide grant is accepted as-is.
35
+ *
36
+ * Adding an API permission in Entra and creating an Exchange RBAC assignment are different jobs owned
37
+ * by different people, and plenty of deployments will do the first and not the second. That is a
38
+ * legitimate outcome; refusing to model it would leave those deployments inventing a group name or
39
+ * bypassing the gate, and both destroy the record this exists to keep.
40
+ */
41
+ export const ENV_ACCEPTED_RISK = 'ACTIVITY_SYNC_MAILBOX_POLICY_ACCEPTED_RISK';
42
+ /** Who verified the policy exists. A person — the decision needs an owner. */
43
+ export const ENV_CONFIRMED_BY = 'ACTIVITY_SYNC_MAILBOX_POLICY_CONFIRMED_BY';
44
+ /** When they verified it, as an ISO-8601 date. Policies get deleted; staleness should be visible. */
45
+ export const ENV_CONFIRMED_AT = 'ACTIVITY_SYNC_MAILBOX_POLICY_CONFIRMED_AT';
46
+ /** Required whichever decision was made. */
47
+ const ALWAYS = [ENV_CONFIRMED_BY, ENV_CONFIRMED_AT];
48
+ /** Exactly one of these says WHICH decision it was. */
49
+ const EITHER = [ENV_GROUP, ENV_ACCEPTED_RISK];
50
+ /**
51
+ * Read the attestation from the environment and register it, if this host has one.
52
+ *
53
+ * Returns true when live fetch was enabled, false when the host is not configured for it. Throws
54
+ * only on a configuration that is present but wrong — see "set all three or none" above.
55
+ *
56
+ * @param env the environment to read; injected so this is testable without mutating process.env.
57
+ */
58
+ export function LoadLiveMailboxPolicyFromEnv(env = process.env) {
59
+ const set = (k) => (env[k] ?? '').trim();
60
+ const present = [...ALWAYS, ...EITHER].filter((k) => set(k).length > 0);
61
+ if (present.length === 0) {
62
+ // The ordinary case for every host that has not opted in. Not an error, and not logged as
63
+ // one — the provider's own refusal already explains what is off and how to turn it on.
64
+ return false;
65
+ }
66
+ const missingAlways = ALWAYS.filter((k) => !set(k));
67
+ if (missingAlways.length > 0) {
68
+ throw new Error(`Live mailbox fetch is partially configured: ${missingAlways.join(', ')} missing. Whichever ` +
69
+ 'decision was made, it needs a name and a date — a partial opt-in stays OFF, and silently ' +
70
+ 'doing so would send you looking for an Exchange fault that is not there.');
71
+ }
72
+ const group = set(ENV_GROUP);
73
+ const acceptedRisk = set(ENV_ACCEPTED_RISK);
74
+ // EXACTLY ONE. Both would claim the app is restricted AND knowingly unrestricted; neither leaves
75
+ // the decision unstated while the other variables imply one was made.
76
+ if (group && acceptedRisk) {
77
+ throw new Error(`Set ${ENV_GROUP} or ${ENV_ACCEPTED_RISK}, not both. The first says the app is restricted to ` +
78
+ 'a group; the second says the tenant-wide grant was accepted as-is. They cannot both be true.');
79
+ }
80
+ if (!group && !acceptedRisk) {
81
+ throw new Error(`Set ${ENV_GROUP} when an Exchange assignment restricts the app to a security group, or ` +
82
+ `${ENV_ACCEPTED_RISK} to record that the tenant-wide grant was accepted and why. Live fetch ` +
83
+ 'stays off until one of them says which.');
84
+ }
85
+ const confirmedAt = new Date(set(ENV_CONFIRMED_AT));
86
+ if (Number.isNaN(confirmedAt.getTime())) {
87
+ throw new Error(`${ENV_CONFIRMED_AT} is not a valid date: "${env[ENV_CONFIRMED_AT]}". Use ISO-8601.`);
88
+ }
89
+ const common = { Confirmed: true, ConfirmedBy: set(ENV_CONFIRMED_BY), ConfirmedAt: confirmedAt };
90
+ AllowLiveMailboxFetch(group
91
+ ? { ...common, Scope: 'RestrictedToGroup', ScopedToGroup: group }
92
+ : { ...common, Scope: 'TenantWideAccepted', AcceptedRisk: acceptedRisk });
93
+ /**
94
+ * Say it out loud, once, at bootstrap.
95
+ *
96
+ * Without this the attestation is written and never read by anything: `ConfirmedAt` in particular
97
+ * exists because "policies get deleted; staleness should be visible", and nothing was making it
98
+ * visible — it was reachable only through `HostLiveMailboxPolicy()`, which has no callers. A
99
+ * recorded decision nobody surfaces is the same silent shape this package is being cleaned of.
100
+ *
101
+ * It also puts the fact in the host log at the moment it starts mattering: this line is the
102
+ * difference between an operator discovering that a host reads real mailboxes, and not.
103
+ */
104
+ LogStatus(`Activity Sync: LIVE mailbox fetch ENABLED — ${group ? `restricted to group "${group}"` : `tenant-wide grant accepted ("${acceptedRisk}")`}, confirmed by ${set(ENV_CONFIRMED_BY)} on ${confirmedAt.toISOString().slice(0, 10)}.`);
105
+ return true;
106
+ }
107
+ //# sourceMappingURL=live-mailbox-policy.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"live-mailbox-policy.js","sourceRoot":"","sources":["../../src/custom/live-mailbox-policy.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAE1E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,oCAAoC,CAAC;AAE9D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG,4CAA4C,CAAC;AAC9E,8EAA8E;AAC9E,MAAM,CAAC,MAAM,gBAAgB,GAAG,2CAA2C,CAAC;AAC5E,qGAAqG;AACrG,MAAM,CAAC,MAAM,gBAAgB,GAAG,2CAA2C,CAAC;AAE5E,4CAA4C;AAC5C,MAAM,MAAM,GAAG,CAAC,gBAAgB,EAAE,gBAAgB,CAAU,CAAC;AAC7D,uDAAuD;AACvD,MAAM,MAAM,GAAG,CAAC,SAAS,EAAE,iBAAiB,CAAU,CAAC;AAEvD;;;;;;;GAOG;AACH,MAAM,UAAU,4BAA4B,CAAC,MAAyB,OAAO,CAAC,GAAG;IAC7E,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC;IACjD,MAAM,OAAO,GAAG,CAAC,GAAG,MAAM,EAAE,GAAG,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;IAExE,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,0FAA0F;QAC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,KAAK;QACD,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,mBAAmB,EAAE,aAAa,EAAE,KAAK,EAAE;QACjE,CAAC,CAAC,EAAE,GAAG,MAAM,EAAE,KAAK,EAAE,oBAAoB,EAAE,YAAY,EAAE,YAAY,EAAE,CAC/E,CAAC;IAEF;;;;;;;;;;OAUG;IACH,SAAS,CACL,+CACI,KAAK,CAAC,CAAC,CAAC,wBAAwB,KAAK,GAAG,CAAC,CAAC,CAAC,gCAAgC,YAAY,IAC3F,kBAAkB,GAAG,CAAC,gBAAgB,CAAC,OAAO,WAAW,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAC1F,CAAC;IACF,OAAO,IAAI,CAAC;AAChB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -21,4 +21,5 @@ 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 { LoadLiveMailboxPolicyFromEnv, ENV_GROUP, ENV_ACCEPTED_RISK, ENV_CONFIRMED_BY, ENV_CONFIRMED_AT, } from './custom/live-mailbox-policy.js';
24
25
  //# 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;AAOlD,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,CAS9C;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"}
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"}
package/dist/index.js CHANGED
@@ -15,6 +15,7 @@ import { LoadActivitySyncEngine } from '@mj-biz-apps/common-core-entities-server
15
15
  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
+ import { LoadLiveMailboxPolicyFromEnv } from './custom/live-mailbox-policy.js';
18
19
  // Import generated GraphQL resolvers
19
20
  import './generated/generated.js';
20
21
  // Re-export the manifest for consumers
@@ -36,10 +37,15 @@ export function LoadBizAppsCommonServer() {
36
37
  LoadSyncActivitiesAction();
37
38
  LoadLogActivityAction();
38
39
  // Registers the seam that turns a connection's CredentialsRef into a live Graph transport.
39
- // Nothing about this enables a live read on its own — AllowLiveFetch still defaults false.
40
+ // Nothing about this enables a live read on its own — the provider still refuses until this
41
+ // host attests that its app registration is scoped.
40
42
  LoadGraphTransportFactory();
43
+ // And that attestation, when this deployment has one. Absent, every live read stays refused;
44
+ // partially configured, this THROWS during bootstrap rather than leaving a misleading refusal.
45
+ LoadLiveMailboxPolicyFromEnv();
41
46
  }
42
47
  export { SyncActivitiesAction, LoadSyncActivitiesAction } from './custom/sync-activities.action.js';
43
48
  export { LogActivityAction, LoadLogActivityAction } from './custom/log-activity.action.js';
44
49
  export { GraphTransportFactory, LoadGraphTransportFactory } from './custom/graph-transport-factory.js';
50
+ export { LoadLiveMailboxPolicyFromEnv, ENV_GROUP, ENV_ACCEPTED_RISK, ENV_CONFIRMED_BY, ENV_CONFIRMED_AT, } from './custom/live-mailbox-policy.js';
45
51
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,yEAAyE;AACzE,OAAO,8BAA8B,CAAC;AACtC,OAAO,6BAA6B,CAAC;AAErC,qEAAqE;AACrE,4DAA4D;AAC5D,OAAO,0CAA0C,CAAC;AAClD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0CAA0C,CAAC;AAClF,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,qBAAqB,EAAE,MAAM,iCAAiC,CAAC;AACxE,OAAO,EAAE,yBAAyB,EAAE,MAAM,qCAAqC,CAAC;AAEhF,qCAAqC;AACrC,OAAO,0BAA0B,CAAC;AAKlC,uCAAuC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAElF,OAA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,0BAA0B,CAAC;AAKlC,uCAAuC;AACvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,6CAA6C,CAAC;AAElF,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,MAAM,SAAS,GAAG,aAAa,CAAC,IAAI,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;AAE/D,oFAAoF;AACpF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,OAAO,CAAC,SAAS,EAAE,6BAA6B,CAAC,CAAC,CAAC;AAElF;;;;GAIG;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;AACnC,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,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.41.0",
4
+ "version": "5.43.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,21 +18,21 @@
18
18
  "vitest": "^3.2.4"
19
19
  },
20
20
  "dependencies": {
21
- "@mj-biz-apps/common-activity-sync": "5.41.0",
22
- "@mj-biz-apps/common-core-entities-server": "5.41.0",
23
- "@mj-biz-apps/common-entities": "5.41.0",
24
- "@mj-biz-apps/common-actions": "5.41.0",
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",
25
25
  "class-validator": "^0.14.3"
26
26
  },
27
27
  "peerDependencies": {
28
- "@memberjunction/actions": "^6.1.0-edge.5",
29
- "@memberjunction/actions-base": "^6.1.0-edge.5",
30
- "@memberjunction/communication-types": "^6.1.0-edge.5",
31
- "@memberjunction/core": "^6.1.0-edge.5",
32
- "@memberjunction/credentials": "^6.1.0-edge.5",
33
- "@memberjunction/global": "^6.1.0-edge.5",
34
- "@memberjunction/server": "^6.1.0-edge.5",
35
- "@memberjunction/sqlserver-dataprovider": "^6.1.0-edge.5"
28
+ "@memberjunction/actions": "^6.1.0-edge.6",
29
+ "@memberjunction/actions-base": "^6.1.0-edge.6",
30
+ "@memberjunction/communication-types": "^6.1.0-edge.6",
31
+ "@memberjunction/core": "^6.1.0-edge.6",
32
+ "@memberjunction/credentials": "^6.1.0-edge.6",
33
+ "@memberjunction/global": "^6.1.0-edge.6",
34
+ "@memberjunction/server": "^6.1.0-edge.6",
35
+ "@memberjunction/sqlserver-dataprovider": "^6.1.0-edge.6"
36
36
  },
37
37
  "repository": {
38
38
  "type": "git",
@@ -40,6 +40,7 @@
40
40
  },
41
41
  "scripts": {
42
42
  "build": "tsc && tsc-alias -f",
43
- "test": "vitest run"
43
+ "test": "tsc -p tsconfig.typecheck.json && vitest run",
44
+ "test:mutants": "node test-harnesses/mutate-checks.mjs"
44
45
  }
45
46
  }