@mj-biz-apps/common-server 5.44.0 → 5.46.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/get-party-signals.action.d.ts +21 -0
- package/dist/custom/get-party-signals.action.d.ts.map +1 -0
- package/dist/custom/get-party-signals.action.js +91 -0
- package/dist/custom/get-party-signals.action.js.map +1 -0
- package/dist/generated/graphql-schemas/__mj_BizAppsCommon.d.ts +297 -117
- package/dist/generated/graphql-schemas/__mj_BizAppsCommon.d.ts.map +1 -1
- package/dist/generated/graphql-schemas/__mj_BizAppsCommon.js +1248 -292
- package/dist/generated/graphql-schemas/__mj_BizAppsCommon.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -1
- package/package.json +6 -5
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `Common.GetPartySignals` — the server-side union of every `Party Signals` query.
|
|
3
|
+
*
|
|
4
|
+
* Explorer's party pickers use the client store, which does this in the browser. This action is
|
|
5
|
+
* the same answer for everything that is not Angular: Skip, agents, MCP, and any report or script
|
|
6
|
+
* that needs to know which organizations and people are customers. One definition of "customer",
|
|
7
|
+
* discovered from metadata rather than hard-coded, so the two can never drift.
|
|
8
|
+
*
|
|
9
|
+
* Runs every query as the CALLING user, so the roster a caller gets back is the one their
|
|
10
|
+
* permissions allow. A query the user cannot read contributes nothing and is named in `Warnings`
|
|
11
|
+
* — a missing signal degrades ranking, it does not fail the call.
|
|
12
|
+
*/
|
|
13
|
+
import { BaseAction } from '@memberjunction/actions';
|
|
14
|
+
import type { ActionResultSimple, RunActionParams } from '@memberjunction/actions-base';
|
|
15
|
+
export declare class GetPartySignalsAction extends BaseAction {
|
|
16
|
+
protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
|
|
17
|
+
private union;
|
|
18
|
+
private runSource;
|
|
19
|
+
}
|
|
20
|
+
export declare function LoadGetPartySignalsAction(): void;
|
|
21
|
+
//# sourceMappingURL=get-party-signals.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-party-signals.action.d.ts","sourceRoot":"","sources":["../../src/custom/get-party-signals.action.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,KAAK,EAAe,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAsBrG,qBACa,qBAAsB,SAAQ,UAAU;cACjC,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;YAezE,KAAK;YAkBL,SAAS;CAoB1B;AAMD,wBAAgB,yBAAyB,IAAI,IAAI,CAEhD"}
|
|
@@ -0,0 +1,91 @@
|
|
|
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
|
+
/**
|
|
8
|
+
* `Common.GetPartySignals` — the server-side union of every `Party Signals` query.
|
|
9
|
+
*
|
|
10
|
+
* Explorer's party pickers use the client store, which does this in the browser. This action is
|
|
11
|
+
* the same answer for everything that is not Angular: Skip, agents, MCP, and any report or script
|
|
12
|
+
* that needs to know which organizations and people are customers. One definition of "customer",
|
|
13
|
+
* discovered from metadata rather than hard-coded, so the two can never drift.
|
|
14
|
+
*
|
|
15
|
+
* Runs every query as the CALLING user, so the roster a caller gets back is the one their
|
|
16
|
+
* permissions allow. A query the user cannot read contributes nothing and is named in `Warnings`
|
|
17
|
+
* — a missing signal degrades ranking, it does not fail the call.
|
|
18
|
+
*/
|
|
19
|
+
import { BaseAction } from '@memberjunction/actions';
|
|
20
|
+
import { RunQuery } from '@memberjunction/core';
|
|
21
|
+
import { QueryEngine } from '@memberjunction/core-entities';
|
|
22
|
+
import { RegisterClass } from '@memberjunction/global';
|
|
23
|
+
import { MergePartySignalRows, ParseSignalNouns, PARTY_SIGNALS_CATEGORY, } from '@mj-biz-apps/common-entities';
|
|
24
|
+
function setOutput(params, name, value) {
|
|
25
|
+
const existing = params.Params?.find((p) => p.Name?.toLowerCase() === name.toLowerCase());
|
|
26
|
+
if (existing) {
|
|
27
|
+
existing.Value = value;
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
params.Params = params.Params ?? [];
|
|
31
|
+
params.Params.push({ Name: name, Value: value, Type: 'Output' });
|
|
32
|
+
}
|
|
33
|
+
let GetPartySignalsAction = class GetPartySignalsAction extends BaseAction {
|
|
34
|
+
async InternalRunAction(params) {
|
|
35
|
+
if (!params.ContextUser) {
|
|
36
|
+
return { Success: false, ResultCode: 'VALIDATION_ERROR', Message: 'ContextUser is required.' };
|
|
37
|
+
}
|
|
38
|
+
try {
|
|
39
|
+
return await this.union(params, params.ContextUser);
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
return {
|
|
43
|
+
Success: false,
|
|
44
|
+
ResultCode: 'ERROR',
|
|
45
|
+
Message: `GetPartySignals failed: ${messageOf(error)}`,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
async union(params, user) {
|
|
50
|
+
const warnings = [];
|
|
51
|
+
await QueryEngine.Instance.Config(false, user);
|
|
52
|
+
const queries = QueryEngine.Instance.Queries.filter((query) => query.Category === PARTY_SIGNALS_CATEGORY);
|
|
53
|
+
const sources = await Promise.all(queries.map((query) => this.runSource(query.ID, query.Name, query.Description, user, warnings)));
|
|
54
|
+
const roster = MergePartySignalRows(sources);
|
|
55
|
+
setOutput(params, 'Roster', JSON.stringify(roster));
|
|
56
|
+
setOutput(params, 'Warnings', JSON.stringify(warnings));
|
|
57
|
+
return {
|
|
58
|
+
Success: true,
|
|
59
|
+
ResultCode: 'SUCCESS',
|
|
60
|
+
Message: `${roster.length} part${roster.length === 1 ? 'y' : 'ies'} from ${sources.length} signal quer${sources.length === 1 ? 'y' : 'ies'}`
|
|
61
|
+
+ `${warnings.length > 0 ? `, ${warnings.length} unavailable` : ''}.`,
|
|
62
|
+
};
|
|
63
|
+
}
|
|
64
|
+
async runSource(id, name, description, user, warnings) {
|
|
65
|
+
const source = { QueryKey: name, ...ParseSignalNouns(description), Rows: [] };
|
|
66
|
+
try {
|
|
67
|
+
const result = await new RunQuery().RunQuery({ QueryID: id }, user);
|
|
68
|
+
if (result.Success) {
|
|
69
|
+
source.Rows = result.Results ?? [];
|
|
70
|
+
}
|
|
71
|
+
else {
|
|
72
|
+
warnings.push(`${name}: ${result.ErrorMessage ?? 'failed'}`);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch (error) {
|
|
76
|
+
warnings.push(`${name}: ${messageOf(error)}`);
|
|
77
|
+
}
|
|
78
|
+
return source;
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
GetPartySignalsAction = __decorate([
|
|
82
|
+
RegisterClass(BaseAction, 'Common.GetPartySignals')
|
|
83
|
+
], GetPartySignalsAction);
|
|
84
|
+
export { GetPartySignalsAction };
|
|
85
|
+
function messageOf(error) {
|
|
86
|
+
return error instanceof Error ? error.message : String(error);
|
|
87
|
+
}
|
|
88
|
+
export function LoadGetPartySignalsAction() {
|
|
89
|
+
void GetPartySignalsAction;
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=get-party-signals.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-party-signals.action.js","sourceRoot":"","sources":["../../src/custom/get-party-signals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