@memberjunction/entity-communications-base 4.2.0 → 4.3.1

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,2 @@
1
+ export {};
2
+ //# sourceMappingURL=base.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/base.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,114 @@
1
+ import { describe, it, expect, vi } from 'vitest';
2
+ vi.mock('@memberjunction/core', () => {
3
+ class MockBaseEngine {
4
+ constructor() {
5
+ this.ContextUser = { ID: 'user-1' };
6
+ this._loaded = false;
7
+ }
8
+ async Load() { this._loaded = true; }
9
+ TryThrowIfNotLoaded() {
10
+ if (!this._loaded)
11
+ throw new Error('Engine not loaded');
12
+ }
13
+ static getInstance() { return new MockBaseEngine(); }
14
+ }
15
+ return {
16
+ BaseEngine: MockBaseEngine,
17
+ BaseEnginePropertyConfig: class {
18
+ },
19
+ BaseEntity: class {
20
+ },
21
+ IMetadataProvider: class {
22
+ },
23
+ RunViewParams: class {
24
+ },
25
+ UserInfo: class {
26
+ },
27
+ };
28
+ });
29
+ vi.mock('@memberjunction/core-entities', () => ({
30
+ EntityCommunicationFieldEntity: class {
31
+ constructor() {
32
+ this.EntityCommunicationMessageTypeID = '';
33
+ }
34
+ },
35
+ EntityCommunicationMessageTypeEntity: class {
36
+ constructor() {
37
+ this.ID = '';
38
+ this.EntityID = '';
39
+ }
40
+ },
41
+ }));
42
+ vi.mock('@memberjunction/global', () => ({
43
+ RegisterClass: () => () => { },
44
+ }));
45
+ vi.mock('@memberjunction/communication-types', () => ({
46
+ Message: class {
47
+ },
48
+ ProcessedMessage: class {
49
+ },
50
+ CommunicationEngineBase: {
51
+ Instance: {
52
+ Config: vi.fn(),
53
+ Metadata: {
54
+ EntityCommunicationFields: [
55
+ { EntityCommunicationMessageTypeID: 'ecmt-1', FieldName: 'Email' },
56
+ { EntityCommunicationMessageTypeID: 'ecmt-2', FieldName: 'Phone' },
57
+ ],
58
+ EntityCommunicationMessageTypes: [
59
+ { ID: 'ecmt-1', EntityID: 'entity-1', CommunicationFields: [] },
60
+ { ID: 'ecmt-2', EntityID: 'entity-2', CommunicationFields: [] },
61
+ ],
62
+ },
63
+ },
64
+ },
65
+ }));
66
+ import { EntityCommunicationMessageTypeExtended, EntityCommunicationParams, EntityCommunicationResult, EntityCommunicationResultItem, EntityCommunicationsEngineBase, } from '../base.js';
67
+ describe('EntityCommunicationMessageTypeExtended', () => {
68
+ it('should have CommunicationFields default to empty array', () => {
69
+ const ext = new EntityCommunicationMessageTypeExtended();
70
+ expect(ext.CommunicationFields).toEqual([]);
71
+ });
72
+ it('should allow setting CommunicationFields', () => {
73
+ const ext = new EntityCommunicationMessageTypeExtended();
74
+ const fields = [{ FieldName: 'Email' }];
75
+ ext.CommunicationFields = fields;
76
+ expect(ext.CommunicationFields).toBe(fields);
77
+ });
78
+ });
79
+ describe('EntityCommunicationParams', () => {
80
+ it('should have default values', () => {
81
+ const params = new EntityCommunicationParams();
82
+ expect(params.PreviewOnly).toBe(false);
83
+ expect(params.IncludeProcessedMessages).toBe(false);
84
+ });
85
+ });
86
+ describe('EntityCommunicationResult', () => {
87
+ it('should be constructible with properties', () => {
88
+ const result = new EntityCommunicationResult();
89
+ result.Success = true;
90
+ result.ErrorMessage = undefined;
91
+ result.Results = [];
92
+ expect(result.Success).toBe(true);
93
+ expect(result.Results).toEqual([]);
94
+ });
95
+ });
96
+ describe('EntityCommunicationResultItem', () => {
97
+ it('should be constructible', () => {
98
+ const item = new EntityCommunicationResultItem();
99
+ expect(item.RecipientData).toBeUndefined();
100
+ expect(item.Message).toBeUndefined();
101
+ });
102
+ });
103
+ describe('EntityCommunicationsEngineBase', () => {
104
+ describe('GetEntityCommunicationMessageTypes', () => {
105
+ it('should filter message types by entityID', async () => {
106
+ // We need to test through the abstract class indirectly
107
+ // The abstract class has concrete methods that filter _Metadata
108
+ // Since it's abstract, we can verify the data class structures
109
+ const engine = EntityCommunicationsEngineBase.Instance;
110
+ expect(engine).toBeDefined();
111
+ });
112
+ });
113
+ });
114
+ //# sourceMappingURL=base.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base.test.js","sourceRoot":"","sources":["../../src/__tests__/base.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,EAAE,EAAc,MAAM,QAAQ,CAAC;AAE9D,EAAE,CAAC,IAAI,CAAC,sBAAsB,EAAE,GAAG,EAAE;IACjC,MAAM,cAAc;QAApB;YACc,gBAAW,GAAG,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC;YACjC,YAAO,GAAG,KAAK,CAAC;QAM5B,CAAC;QALa,KAAK,CAAC,IAAI,KAAK,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC,CAAC;QACrC,mBAAmB;YACzB,IAAI,CAAC,IAAI,CAAC,OAAO;gBAAE,MAAM,IAAI,KAAK,CAAC,mBAAmB,CAAC,CAAC;QAC5D,CAAC;QACD,MAAM,CAAC,WAAW,KAAK,OAAO,IAAI,cAAc,EAAE,CAAC,CAAC,CAAC;KACxD;IACD,OAAO;QACH,UAAU,EAAE,cAAc;QAC1B,wBAAwB,EAAE;SAAQ;QAClC,UAAU,EAAE;SAAQ;QACpB,iBAAiB,EAAE;SAAQ;QAC3B,aAAa,EAAE;SAAQ;QACvB,QAAQ,EAAE;SAAQ;KACrB,CAAC;AACN,CAAC,CAAC,CAAC;AAEH,EAAE,CAAC,IAAI,CAAC,+BAA+B,EAAE,GAAG,EAAE,CAAC,CAAC;IAC5C,8BAA8B,EAAE;QAAA;YAAQ,qCAAgC,GAAG,EAAE,CAAC;QAAC,CAAC;KAAA;IAChF,oCAAoC,EAAE;QAAA;YAAQ,OAAE,GAAG,EAAE,CAAC;YAAC,aAAQ,GAAG,EAAE,CAAC;QAAC,CAAC;KAAA;CAC1E,CAAC,C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jD,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,aAAa,EAAE,CAAC;QAC3C,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,aAAa,EAAE,CAAC;IACzC,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,gCAAgC,EAAE,GAAG,EAAE;IAC5C,QAAQ,CAAC,oCAAoC,EAAE,GAAG,EAAE;QAChD,EAAE,CAAC,yCAAyC,EAAE,KAAK,IAAI,EAAE;YACrD,wDAAwD;YACxD,gEAAgE;YAChE,+DAA+D;YAC/D,MAAM,MAAM,GAAG,8BAA8B,CAAC,QAAQ,CAAC;YACvD,MAAM,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC;QACjC,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@memberjunction/entity-communications-base",
3
3
  "type": "module",
4
- "version": "4.2.0",
4
+ "version": "4.3.1",
5
5
  "description": "MemberJunction: Base Types for Client/Server use with Entity Communications Engine",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",
@@ -11,7 +11,7 @@
11
11
  "scripts": {
12
12
  "start": "ts-node-dev src/index.ts",
13
13
  "build": "tsc && tsc-alias -f",
14
- "test": "echo \"Error: no test specified\" && exit 1"
14
+ "test": "echo \"No tests configured yet\""
15
15
  },
16
16
  "author": "MemberJunction.com",
17
17
  "license": "ISC",
@@ -20,10 +20,10 @@
20
20
  "typescript": "^5.9.3"
21
21
  },
22
22
  "dependencies": {
23
- "@memberjunction/global": "4.2.0",
24
- "@memberjunction/core": "4.2.0",
25
- "@memberjunction/core-entities": "4.2.0",
26
- "@memberjunction/communication-types": "4.2.0"
23
+ "@memberjunction/global": "4.3.1",
24
+ "@memberjunction/core": "4.3.1",
25
+ "@memberjunction/core-entities": "4.3.1",
26
+ "@memberjunction/communication-types": "4.3.1"
27
27
  },
28
28
  "repository": {
29
29
  "type": "git",