@memberjunction/core-actions 2.43.0 → 2.44.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/package.json +9 -9
- package/readme.md +213 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@memberjunction/core-actions",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.44.0",
|
|
4
4
|
"description": "Library of generated and custom actions for the core MemberJunction framework. This library is maintained by MemberJunction and includes actions for use within the framework itself.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
"typescript": "^5.4.5"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@memberjunction/global": "2.
|
|
23
|
-
"@memberjunction/core": "2.
|
|
24
|
-
"@memberjunction/core-entities": "2.
|
|
25
|
-
"@memberjunction/actions": "2.
|
|
26
|
-
"@memberjunction/communication-engine": "2.
|
|
27
|
-
"@memberjunction/external-change-detection": "2.
|
|
28
|
-
"@memberjunction/ai-vector-sync": "2.
|
|
29
|
-
"@memberjunction/content-autotagging": "2.
|
|
22
|
+
"@memberjunction/global": "2.44.0",
|
|
23
|
+
"@memberjunction/core": "2.44.0",
|
|
24
|
+
"@memberjunction/core-entities": "2.44.0",
|
|
25
|
+
"@memberjunction/actions": "2.44.0",
|
|
26
|
+
"@memberjunction/communication-engine": "2.44.0",
|
|
27
|
+
"@memberjunction/external-change-detection": "2.44.0",
|
|
28
|
+
"@memberjunction/ai-vector-sync": "2.44.0",
|
|
29
|
+
"@memberjunction/content-autotagging": "2.44.0"
|
|
30
30
|
}
|
|
31
31
|
}
|
package/readme.md
CHANGED
|
@@ -1,6 +1,215 @@
|
|
|
1
|
-
# @memberjunction/actions
|
|
1
|
+
# @memberjunction/core-actions
|
|
2
2
|
|
|
3
|
-
The `@memberjunction/core-actions` library
|
|
3
|
+
The `@memberjunction/core-actions` library provides a collection of pre-built actions that are essential to the MemberJunction framework. These actions handle common operations like sending messages, detecting external changes, and vectorizing entities for AI processing.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
This package contains both custom-built and generated actions that extend the MemberJunction Actions framework. It provides ready-to-use implementations for core functionality that many MemberJunction applications require.
|
|
8
|
+
|
|
9
|
+
## Important Note
|
|
10
|
+
|
|
11
|
+
**This library should only be imported on the server side.** It contains server-specific dependencies and functionality that are not suitable for client-side applications.
|
|
12
|
+
|
|
13
|
+
## Installation
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
npm install @memberjunction/core-actions
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
## Available Actions
|
|
20
|
+
|
|
21
|
+
### 1. Send Single Message Action
|
|
22
|
+
|
|
23
|
+
Provides a simple wrapper around the MemberJunction Communication Framework to send single messages through various communication providers.
|
|
24
|
+
|
|
25
|
+
**Class:** `SendSingleMessageAction`
|
|
26
|
+
**Registration Name:** `"Send Single Message"`
|
|
27
|
+
|
|
28
|
+
**Parameters:**
|
|
29
|
+
- `Subject` (string): The subject of the message
|
|
30
|
+
- `Body` (string): The body content of the message
|
|
31
|
+
- `To` (string): The recipient's address
|
|
32
|
+
- `From` (string): The sender's address
|
|
33
|
+
- `Provider` (string): The name of the Communication Provider to use
|
|
34
|
+
- `MessageType` (string): The name of the Message Type within the provider
|
|
35
|
+
|
|
36
|
+
**Example Usage:**
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
import { SendSingleMessageAction } from '@memberjunction/core-actions';
|
|
40
|
+
import { ActionEngine } from '@memberjunction/actions';
|
|
41
|
+
|
|
42
|
+
// Execute the action through the Action Engine
|
|
43
|
+
const result = await ActionEngine.RunAction({
|
|
44
|
+
ActionName: 'Send Single Message',
|
|
45
|
+
Params: [
|
|
46
|
+
{ Name: 'Subject', Value: 'Welcome to MemberJunction' },
|
|
47
|
+
{ Name: 'Body', Value: 'Thank you for joining our platform!' },
|
|
48
|
+
{ Name: 'To', Value: 'user@example.com' },
|
|
49
|
+
{ Name: 'From', Value: 'noreply@memberjunction.com' },
|
|
50
|
+
{ Name: 'Provider', Value: 'SendGrid' },
|
|
51
|
+
{ Name: 'MessageType', Value: 'Email' }
|
|
52
|
+
],
|
|
53
|
+
ContextUser: currentUser
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
if (result.Success) {
|
|
57
|
+
console.log('Message sent successfully');
|
|
58
|
+
} else {
|
|
59
|
+
console.error('Failed to send message:', result.Message);
|
|
60
|
+
}
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
### 2. Vectorize Entity Action
|
|
64
|
+
|
|
65
|
+
Enables vectorization of entity data for AI and machine learning operations. This action integrates with MemberJunction's AI vector synchronization system to create vector embeddings of entity records.
|
|
66
|
+
|
|
67
|
+
**Class:** `VectorizeEntityAction`
|
|
68
|
+
**Registration Name:** `"Vectorize Entity"`
|
|
69
|
+
|
|
70
|
+
**Parameters:**
|
|
71
|
+
- `EntityNames` (string | string[]): Entity name(s) to vectorize. Can be:
|
|
72
|
+
- A single entity name as a string
|
|
73
|
+
- Multiple entity names as a comma-separated string
|
|
74
|
+
- An array of entity names
|
|
75
|
+
|
|
76
|
+
**Example Usage:**
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
import { VectorizeEntityAction } from '@memberjunction/core-actions';
|
|
80
|
+
import { ActionEngine } from '@memberjunction/actions';
|
|
81
|
+
|
|
82
|
+
// Vectorize a single entity
|
|
83
|
+
const singleResult = await ActionEngine.RunAction({
|
|
84
|
+
ActionName: 'Vectorize Entity',
|
|
85
|
+
Params: [
|
|
86
|
+
{ Name: 'EntityNames', Value: 'Customers' }
|
|
87
|
+
],
|
|
88
|
+
ContextUser: currentUser
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
// Vectorize multiple entities
|
|
92
|
+
const multiResult = await ActionEngine.RunAction({
|
|
93
|
+
ActionName: 'Vectorize Entity',
|
|
94
|
+
Params: [
|
|
95
|
+
{ Name: 'EntityNames', Value: 'Customers,Products,Orders' }
|
|
96
|
+
],
|
|
97
|
+
ContextUser: currentUser
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// Or using an array
|
|
101
|
+
const arrayResult = await ActionEngine.RunAction({
|
|
102
|
+
ActionName: 'Vectorize Entity',
|
|
103
|
+
Params: [
|
|
104
|
+
{ Name: 'EntityNames', Value: ['Customers', 'Products', 'Orders'] }
|
|
105
|
+
],
|
|
106
|
+
ContextUser: currentUser
|
|
107
|
+
});
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### 3. External Change Detection Action
|
|
111
|
+
|
|
112
|
+
Detects and replays changes from external systems that have modified data outside of the MemberJunction framework. This is crucial for maintaining data consistency when external systems directly modify the database.
|
|
113
|
+
|
|
114
|
+
**Class:** `ExternalChangeDetectionAction`
|
|
115
|
+
**Registration Name:** `"Run External Change Detection"`
|
|
116
|
+
|
|
117
|
+
**Parameters:**
|
|
118
|
+
- `EntityList` (string, optional): Comma-separated list of entity names to check for changes. If not provided, all eligible entities will be processed.
|
|
119
|
+
|
|
120
|
+
**Example Usage:**
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
import { ExternalChangeDetectionAction } from '@memberjunction/core-actions';
|
|
124
|
+
import { ActionEngine } from '@memberjunction/actions';
|
|
125
|
+
|
|
126
|
+
// Check specific entities for changes
|
|
127
|
+
const specificResult = await ActionEngine.RunAction({
|
|
128
|
+
ActionName: 'Run External Change Detection',
|
|
129
|
+
Params: [
|
|
130
|
+
{ Name: 'EntityList', Value: 'Customers,Orders,Invoices' }
|
|
131
|
+
],
|
|
132
|
+
ContextUser: currentUser
|
|
133
|
+
});
|
|
134
|
+
|
|
135
|
+
// Check all eligible entities
|
|
136
|
+
const allResult = await ActionEngine.RunAction({
|
|
137
|
+
ActionName: 'Run External Change Detection',
|
|
138
|
+
Params: [],
|
|
139
|
+
ContextUser: currentUser
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
if (specificResult.Success) {
|
|
143
|
+
console.log('External changes detected and replayed successfully');
|
|
144
|
+
} else {
|
|
145
|
+
console.error('Change detection failed:', specificResult.Message);
|
|
146
|
+
}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
## Integration with MemberJunction Actions Framework
|
|
150
|
+
|
|
151
|
+
All actions in this package extend the `BaseAction` class from `@memberjunction/actions` and are automatically registered with the MemberJunction class factory system using the `@RegisterClass` decorator.
|
|
152
|
+
|
|
153
|
+
To use these actions, you typically interact with them through the `ActionEngine` rather than instantiating them directly:
|
|
154
|
+
|
|
155
|
+
```typescript
|
|
156
|
+
import { ActionEngine } from '@memberjunction/actions';
|
|
157
|
+
|
|
158
|
+
// The actions are automatically registered when the module is loaded
|
|
159
|
+
const result = await ActionEngine.RunAction({
|
|
160
|
+
ActionName: 'Action Name Here',
|
|
161
|
+
Params: [...],
|
|
162
|
+
ContextUser: user
|
|
163
|
+
});
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
## Dependencies
|
|
167
|
+
|
|
168
|
+
This package depends on several core MemberJunction packages:
|
|
169
|
+
|
|
170
|
+
- `@memberjunction/global` - Global utilities and class registration
|
|
171
|
+
- `@memberjunction/core` - Core MemberJunction functionality
|
|
172
|
+
- `@memberjunction/core-entities` - Entity definitions
|
|
173
|
+
- `@memberjunction/actions` - Base action framework
|
|
174
|
+
- `@memberjunction/communication-engine` - Communication framework
|
|
175
|
+
- `@memberjunction/external-change-detection` - Change detection engine
|
|
176
|
+
- `@memberjunction/ai-vector-sync` - AI vectorization functionality
|
|
177
|
+
- `@memberjunction/content-autotagging` - Content tagging capabilities
|
|
178
|
+
|
|
179
|
+
## Building and Development
|
|
180
|
+
|
|
181
|
+
To build this package:
|
|
182
|
+
|
|
183
|
+
```bash
|
|
184
|
+
# From the package directory
|
|
185
|
+
npm run build
|
|
186
|
+
|
|
187
|
+
# Or from the repository root using Turbo
|
|
188
|
+
turbo build --filter="@memberjunction/core-actions"
|
|
189
|
+
```
|
|
190
|
+
|
|
191
|
+
The package uses TypeScript and compiles to JavaScript with type definitions included.
|
|
192
|
+
|
|
193
|
+
## Result Handling
|
|
194
|
+
|
|
195
|
+
All actions return an `ActionResultSimple` object with the following structure:
|
|
196
|
+
|
|
197
|
+
```typescript
|
|
198
|
+
interface ActionResultSimple {
|
|
199
|
+
Success: boolean; // Whether the action completed successfully
|
|
200
|
+
Message?: string; // Error message or additional information
|
|
201
|
+
ResultCode: string; // Either "SUCCESS" or "FAILED"
|
|
202
|
+
}
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
Always check the `Success` property before proceeding with dependent operations.
|
|
206
|
+
|
|
207
|
+
## Server-Side Only
|
|
208
|
+
|
|
209
|
+
This package contains server-side dependencies and should never be imported in client-side code. It relies on:
|
|
210
|
+
- Database connections
|
|
211
|
+
- File system access
|
|
212
|
+
- Server-side API integrations
|
|
213
|
+
- Heavy computational processes
|
|
214
|
+
|
|
215
|
+
For client-side action needs, refer to client-safe action packages in the MemberJunction ecosystem.
|