@memberjunction/entity-communications-base 1.5.3

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/base.d.ts ADDED
@@ -0,0 +1,39 @@
1
+ import { BaseEngine, RunViewParams, UserInfo } from "@memberjunction/core";
2
+ import { EntityCommunicationFieldEntity, EntityCommunicationMessageTypeEntity } from "@memberjunction/core-entities";
3
+ import { Message } from '@memberjunction/communication-types';
4
+ export declare class EntityCommunicationMessageTypeExtended extends EntityCommunicationMessageTypeEntity {
5
+ CommunicationFields: EntityCommunicationFieldEntity[];
6
+ }
7
+ export declare abstract class EntityCommunicationsEngineBase extends BaseEngine<EntityCommunicationsEngineBase> {
8
+ Config(forceRefresh?: boolean, contextUser?: UserInfo): Promise<void>;
9
+ static get Instance(): EntityCommunicationsEngineBase;
10
+ private _EntityCommunicationMessageTypes;
11
+ private _EntityCommunicationFields;
12
+ get EntityCommunicationMessageTypes(): EntityCommunicationMessageTypeExtended[];
13
+ get EntityCommunicationFields(): EntityCommunicationFieldEntity[];
14
+ protected AdditionalLoading(contextUser?: UserInfo): Promise<void>;
15
+ /**
16
+ * Returns a list of communication message types for the given entity
17
+ * @param entityID
18
+ * @returns
19
+ */
20
+ GetEntityCommunicationMessageTypes(entityID: number): EntityCommunicationMessageTypeExtended[];
21
+ /**
22
+ * Returns true if the specified entity has any communication message types
23
+ * @param entityID
24
+ */
25
+ EntitySupportsCommunication(entityID: number): boolean;
26
+ /**
27
+ * Executes a given message request against a view of records for a given entity
28
+ * @param entityID
29
+ * @param runViewParams
30
+ * @param providerName
31
+ * @param providerMessageTypeName
32
+ * @param message
33
+ */
34
+ abstract RunEntityCommunication(entityID: number, runViewParams: RunViewParams, providerName: string, providerMessageTypeName: string, message: Message): Promise<{
35
+ Success: boolean;
36
+ ErrorMessage: string;
37
+ }>;
38
+ }
39
+ //# sourceMappingURL=base.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAwC,aAAa,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AACjH,OAAO,EAAE,8BAA8B,EAAE,oCAAoC,EAAE,MAAM,+BAA+B,CAAC;AAErH,OAAO,EAAE,OAAO,EAAE,MAAM,qCAAqC,CAAC;AAE9D,qBACa,sCAAuC,SAAQ,oCAAoC;IACrF,mBAAmB,EAAE,8BAA8B,EAAE,CAAM;CACrE;AAED,8BAAsB,8BAA+B,SAAQ,UAAU,CAAC,8BAA8B,CAAC;IACtF,MAAM,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,QAAQ;IAclE,WAAkB,QAAQ,IAAI,8BAA8B,CAE3D;IAED,OAAO,CAAC,gCAAgC,CAAgD;IACxF,OAAO,CAAC,0BAA0B,CAAwC;IAC1E,IAAW,+BAA+B,IAAI,sCAAsC,EAAE,CAErF;IACD,IAAW,yBAAyB,IAAI,8BAA8B,EAAE,CAEvE;cAEe,iBAAiB,CAAC,WAAW,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IAOxE;;;;OAIG;IACI,kCAAkC,CAAC,QAAQ,EAAE,MAAM,GAAG,sCAAsC,EAAE;IAKrG;;;OAGG;IACI,2BAA2B,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAa7D;;;;;;;OAOG;aACa,sBAAsB,CAAC,QAAQ,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,EAAE,uBAAuB,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,GAAG,OAAO,CAAC;QAAC,OAAO,EAAE,OAAO,CAAC;QAAC,YAAY,EAAE,MAAM,CAAA;KAAC,CAAC;CACrN"}
package/dist/base.js ADDED
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
3
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
4
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
5
+ 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;
6
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
7
+ };
8
+ Object.defineProperty(exports, "__esModule", { value: true });
9
+ exports.EntityCommunicationsEngineBase = exports.EntityCommunicationMessageTypeExtended = void 0;
10
+ const core_1 = require("@memberjunction/core");
11
+ const core_entities_1 = require("@memberjunction/core-entities");
12
+ const global_1 = require("@memberjunction/global");
13
+ let EntityCommunicationMessageTypeExtended = class EntityCommunicationMessageTypeExtended extends core_entities_1.EntityCommunicationMessageTypeEntity {
14
+ constructor() {
15
+ super(...arguments);
16
+ this.CommunicationFields = [];
17
+ }
18
+ };
19
+ exports.EntityCommunicationMessageTypeExtended = EntityCommunicationMessageTypeExtended;
20
+ exports.EntityCommunicationMessageTypeExtended = EntityCommunicationMessageTypeExtended = __decorate([
21
+ (0, global_1.RegisterClass)(core_1.BaseEntity, 'Entity Communication Message Types')
22
+ ], EntityCommunicationMessageTypeExtended);
23
+ class EntityCommunicationsEngineBase extends core_1.BaseEngine {
24
+ constructor() {
25
+ super(...arguments);
26
+ this._EntityCommunicationMessageTypes = [];
27
+ this._EntityCommunicationFields = [];
28
+ }
29
+ async Config(forceRefresh, contextUser) {
30
+ const c = [
31
+ {
32
+ EntityName: "Entity Communication Message Types",
33
+ PropertyName: "_EntityCommunicationMessageTypes"
34
+ },
35
+ {
36
+ EntityName: "Entity Communication Fields",
37
+ PropertyName: "_EntityCommunicationFields"
38
+ }
39
+ ];
40
+ return await this.Load(c, forceRefresh, contextUser);
41
+ }
42
+ static get Instance() {
43
+ return super.getInstance();
44
+ }
45
+ get EntityCommunicationMessageTypes() {
46
+ return this._EntityCommunicationMessageTypes;
47
+ }
48
+ get EntityCommunicationFields() {
49
+ return this._EntityCommunicationFields;
50
+ }
51
+ async AdditionalLoading(contextUser) {
52
+ // post-process the fields to be linked to the message types they're part of
53
+ this.EntityCommunicationMessageTypes.forEach(m => {
54
+ m.CommunicationFields = this.EntityCommunicationFields.filter(f => f.EntityCommunicationMessageTypeID === m.ID);
55
+ });
56
+ }
57
+ /**
58
+ * Returns a list of communication message types for the given entity
59
+ * @param entityID
60
+ * @returns
61
+ */
62
+ GetEntityCommunicationMessageTypes(entityID) {
63
+ this.TryThrowIfNotLoaded();
64
+ return this.EntityCommunicationMessageTypes.filter(m => m.EntityID === entityID);
65
+ }
66
+ /**
67
+ * Returns true if the specified entity has any communication message types
68
+ * @param entityID
69
+ */
70
+ EntitySupportsCommunication(entityID) {
71
+ this.TryThrowIfNotLoaded();
72
+ return this.GetEntityCommunicationMessageTypes(entityID).length > 0;
73
+ }
74
+ }
75
+ exports.EntityCommunicationsEngineBase = EntityCommunicationsEngineBase;
76
+ //# sourceMappingURL=base.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.js","sourceRoot":"","sources":["../src/base.ts"],"names":[],"mappings":";;;;;;;;;AAAA,+CAAiH;AACjH,iEAAqH;AACrH,mDAAuD;AAIhD,IAAM,sCAAsC,GAA5C,MAAM,sCAAuC,SAAQ,oDAAoC;IAAzF;;QACI,wBAAmB,GAAqC,EAAE,CAAC;IACtE,CAAC;CAAA,CAAA;AAFY,wFAAsC;iDAAtC,sCAAsC;IADlD,IAAA,sBAAa,EAAC,iBAAU,EAAE,oCAAoC,CAAC;GACnD,sCAAsC,CAElD;AAED,MAAsB,8BAA+B,SAAQ,iBAA0C;IAAvG;;QAmBY,qCAAgC,GAA6C,EAAE,CAAC;QAChF,+BAA0B,GAAqC,EAAE,CAAC;IAmD9E,CAAC;IAtEU,KAAK,CAAC,MAAM,CAAC,YAAsB,EAAE,WAAsB;QAC9D,MAAM,CAAC,GAA+B;YAClC;gBACI,UAAU,EAAE,oCAAoC;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":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,QAAQ,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ // PUBLIC API SURFACE AREA
18
+ __exportStar(require("./base"), exports);
19
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0BAA0B;AAC1B,yCAAuB"}
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@memberjunction/entity-communications-base",
3
+ "version": "1.5.3",
4
+ "description": "MemberJunction: Base Types for Client/Server use with Entity Communications Engine",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "/dist"
9
+ ],
10
+ "scripts": {
11
+ "start": "ts-node-dev src/index.ts",
12
+ "build": "tsc",
13
+ "test": "echo \"Error: no test specified\" && exit 1"
14
+ },
15
+ "author": "MemberJunction.com",
16
+ "license": "ISC",
17
+ "devDependencies": {
18
+ "ts-node-dev": "^2.0.0",
19
+ "typescript": "^5.4.5"
20
+ },
21
+ "dependencies": {
22
+ "@memberjunction/global": "1.5.3",
23
+ "@memberjunction/core": "1.5.3",
24
+ "@memberjunction/core-entities": "1.5.3",
25
+ "@memberjunction/communication-types": "1.5.3"
26
+ }
27
+ }