@memberjunction/entity-communications-base 1.8.1 → 2.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/base.d.ts CHANGED
@@ -1,14 +1,31 @@
1
1
  import { BaseEngine, RunViewParams, UserInfo } from "@memberjunction/core";
2
2
  import { EntityCommunicationFieldEntity, EntityCommunicationMessageTypeEntity } from "@memberjunction/core-entities";
3
- import { Message } from '@memberjunction/communication-types';
3
+ import { Message, ProcessedMessage } from '@memberjunction/communication-types';
4
4
  export declare class EntityCommunicationMessageTypeExtended extends EntityCommunicationMessageTypeEntity {
5
5
  CommunicationFields: EntityCommunicationFieldEntity[];
6
6
  }
7
+ export declare class EntityCommunicationParams {
8
+ EntityID: string;
9
+ RunViewParams: RunViewParams;
10
+ ProviderName: string;
11
+ ProviderMessageTypeName: string;
12
+ Message: Message;
13
+ PreviewOnly?: boolean;
14
+ IncludeProcessedMessages?: boolean;
15
+ }
16
+ export declare class EntityCommunicationResultItem {
17
+ RecipientData: any;
18
+ Message: ProcessedMessage;
19
+ }
20
+ export declare class EntityCommunicationResult {
21
+ Success: boolean;
22
+ ErrorMessage?: string;
23
+ Results?: EntityCommunicationResultItem[];
24
+ }
7
25
  export declare abstract class EntityCommunicationsEngineBase extends BaseEngine<EntityCommunicationsEngineBase> {
8
26
  Config(forceRefresh?: boolean, contextUser?: UserInfo): Promise<void>;
9
27
  static get Instance(): EntityCommunicationsEngineBase;
10
- private _EntityCommunicationMessageTypes;
11
- private _EntityCommunicationFields;
28
+ private _Metadata;
12
29
  get EntityCommunicationMessageTypes(): EntityCommunicationMessageTypeExtended[];
13
30
  get EntityCommunicationFields(): EntityCommunicationFieldEntity[];
14
31
  protected AdditionalLoading(contextUser?: UserInfo): Promise<void>;
@@ -17,23 +34,16 @@ export declare abstract class EntityCommunicationsEngineBase extends BaseEngine<
17
34
  * @param entityID
18
35
  * @returns
19
36
  */
20
- GetEntityCommunicationMessageTypes(entityID: number): EntityCommunicationMessageTypeExtended[];
37
+ GetEntityCommunicationMessageTypes(entityID: string): EntityCommunicationMessageTypeExtended[];
21
38
  /**
22
39
  * Returns true if the specified entity has any communication message types
23
40
  * @param entityID
24
41
  */
25
- EntitySupportsCommunication(entityID: number): boolean;
42
+ EntitySupportsCommunication(entityID: string): boolean;
26
43
  /**
27
44
  * 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
45
+ * @param params
33
46
  */
34
- abstract RunEntityCommunication(entityID: number, runViewParams: RunViewParams, providerName: string, providerMessageTypeName: string, message: Message): Promise<{
35
- Success: boolean;
36
- ErrorMessage: string;
37
- }>;
47
+ abstract RunEntityCommunication(params: EntityCommunicationParams): Promise<EntityCommunicationResult>;
38
48
  }
39
49
  //# sourceMappingURL=base.d.ts.map
@@ -1 +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;c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AAA;IAChB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,OAAO,CAAC,EAAE,6BAA6B,EAAE,CAAA;CAC5C;AAED,8BAAsB,8BAA+B,SAAQ,UAAU,CAAC,8BAA8B,CAAC;IACtF,MAAM,CAAC,YAAY,CAAC,EAAE,OAAO,EAAE,WAAW,CAAC,EAAE,QAAQ;IASlE,WAAkB,QAAQ,IAAI,8BAA8B,CAE3D;IAED,OAAO,CAAC,SAAS,CAGwD;IAEzE,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;IASxE;;;;OAIG;IACI,kCAAkC,CAAC,QAAQ,EAAE,MAAM,GAAG,sCAAsC,EAAE;IAKrG;;;OAGG;IACI,2BAA2B,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO;IAa7D;;;OAGG;aACa,sBAAsB,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,yBAAyB,CAAC;CAEhH"}
package/dist/base.js CHANGED
@@ -6,10 +6,11 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
6
6
  return c > 3 && r && Object.defineProperty(target, key, r), r;
7
7
  };
8
8
  Object.defineProperty(exports, "__esModule", { value: true });
9
- exports.EntityCommunicationsEngineBase = exports.EntityCommunicationMessageTypeExtended = void 0;
9
+ exports.EntityCommunicationsEngineBase = exports.EntityCommunicationResult = exports.EntityCommunicationResultItem = exports.EntityCommunicationParams = exports.EntityCommunicationMessageTypeExtended = void 0;
10
10
  const core_1 = require("@memberjunction/core");
11
11
  const core_entities_1 = require("@memberjunction/core-entities");
12
12
  const global_1 = require("@memberjunction/global");
13
+ const communication_types_1 = require("@memberjunction/communication-types");
13
14
  let EntityCommunicationMessageTypeExtended = class EntityCommunicationMessageTypeExtended extends core_entities_1.EntityCommunicationMessageTypeEntity {
14
15
  constructor() {
15
16
  super(...arguments);
@@ -20,36 +21,44 @@ exports.EntityCommunicationMessageTypeExtended = EntityCommunicationMessageTypeE
20
21
  exports.EntityCommunicationMessageTypeExtended = EntityCommunicationMessageTypeExtended = __decorate([
21
22
  (0, global_1.RegisterClass)(core_1.BaseEntity, 'Entity Communication Message Types')
22
23
  ], EntityCommunicationMessageTypeExtended);
24
+ class EntityCommunicationParams {
25
+ constructor() {
26
+ this.PreviewOnly = false;
27
+ this.IncludeProcessedMessages = false;
28
+ }
29
+ }
30
+ exports.EntityCommunicationParams = EntityCommunicationParams;
31
+ class EntityCommunicationResultItem {
32
+ }
33
+ exports.EntityCommunicationResultItem = EntityCommunicationResultItem;
34
+ class EntityCommunicationResult {
35
+ }
36
+ exports.EntityCommunicationResult = EntityCommunicationResult;
23
37
  class EntityCommunicationsEngineBase extends core_1.BaseEngine {
24
38
  constructor() {
25
39
  super(...arguments);
26
- this._EntityCommunicationMessageTypes = [];
27
- this._EntityCommunicationFields = [];
40
+ this._Metadata = { EntityCommunicationMessageTypes: [], EntityCommunicationFields: [] };
28
41
  }
29
42
  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);
43
+ // just rely on the metadata from the base engine, can do extra loading here down the road as needed
44
+ // it is faster to use the base engine's metadata than to load it again here even though the metadata
45
+ // is cached we still have to check to see if the dataset is up to date and that takes time
46
+ await communication_types_1.CommunicationEngineBase.Instance.Config(forceRefresh, contextUser);
47
+ await this.Load([], forceRefresh, contextUser); // even though we have NO configs, we need to call Load so that the lifecycle of this object is properly managed where the Loaded flag is set and AdditionalLoading is called
41
48
  }
42
49
  static get Instance() {
43
50
  return super.getInstance();
44
51
  }
45
52
  get EntityCommunicationMessageTypes() {
46
- return this._EntityCommunicationMessageTypes;
53
+ return this._Metadata.EntityCommunicationMessageTypes;
47
54
  }
48
55
  get EntityCommunicationFields() {
49
- return this._EntityCommunicationFields;
56
+ return this._Metadata.EntityCommunicationFields;
50
57
  }
51
58
  async AdditionalLoading(contextUser) {
52
59
  // post-process the fields to be linked to the message types they're part of
60
+ this._Metadata.EntityCommunicationFields = communication_types_1.CommunicationEngineBase.Instance.Metadata.EntityCommunicationFields;
61
+ this._Metadata.EntityCommunicationMessageTypes = communication_types_1.CommunicationEngineBase.Instance.Metadata.EntityCommunicationMessageTypes;
53
62
  this.EntityCommunicationMessageTypes.forEach(m => {
54
63
  m.CommunicationFields = this.EntityCommunicationFields.filter(f => f.EntityCommunicationMessageTypeID === m.ID);
55
64
  });
package/dist/base.js.map CHANGED
@@ -1 +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,GAAwC;YAC3C;gBACI,UAAU,EAAE,oCAAoC;gBAChD,YAAY,EAAE,kCAAkC;aACnD;YACD;gBACI,UAAU,EAAE,6BAA6B;gBACzC,YAAY,EAAE,4BAA4B;aAC7C;SACJ,CAAC;QACF,OAAO,MAAM,IAAI,CAAC,IAAI,C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Q,CAAC,+BAA+B,CAAC;QACrK,IAAI,CAAC,+BAA+B,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;YAC7C,CAAC,CAAC,mBAAmB,GAAG,IAAI,CAAC,yBAAyB,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,gCAAgC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;QACpH,CAAC,CAAC,CAAC;IACP,CAAC;IAED;;;;OAIG;IACI,kCAAkC,CAAC,QAAgB;QACtD,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC,+BAA+B,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,QAAQ,KAAK,QAAQ,CAAC,CAAC;IACrF,CAAC;IAED;;;OAGG;IACI,2BAA2B,CAAC,QAAgB;QAC/C,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC,kCAAkC,CAAC,QAAQ,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IACxE,CAAC;CAgBJ;AApED,wEAoEC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memberjunction/entity-communications-base",
3
- "version": "1.8.1",
3
+ "version": "2.1.0",
4
4
  "description": "MemberJunction: Base Types for Client/Server use with Entity Communications Engine",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -19,9 +19,9 @@
19
19
  "typescript": "^5.4.5"
20
20
  },
21
21
  "dependencies": {
22
- "@memberjunction/global": "1.8.1",
23
- "@memberjunction/core": "1.8.1",
24
- "@memberjunction/core-entities": "1.8.1",
25
- "@memberjunction/communication-types": "1.8.1"
22
+ "@memberjunction/global": "2.1.0",
23
+ "@memberjunction/core": "2.1.0",
24
+ "@memberjunction/core-entities": "2.1.0",
25
+ "@memberjunction/communication-types": "2.1.0"
26
26
  }
27
27
  }