@memberjunction/core-actions 2.132.0 → 3.0.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/ai/generate-image.action.d.ts +111 -0
- package/dist/custom/ai/generate-image.action.d.ts.map +1 -0
- package/dist/custom/ai/generate-image.action.js +339 -0
- package/dist/custom/ai/generate-image.action.js.map +1 -0
- package/dist/custom/files/excel-writer.action.d.ts +24 -11
- package/dist/custom/files/excel-writer.action.d.ts.map +1 -1
- package/dist/custom/files/excel-writer.action.js +149 -139
- package/dist/custom/files/excel-writer.action.js.map +1 -1
- package/dist/custom/lists/add-records-to-list.action.d.ts +27 -0
- package/dist/custom/lists/add-records-to-list.action.d.ts.map +1 -0
- package/dist/custom/lists/add-records-to-list.action.js +200 -0
- package/dist/custom/lists/add-records-to-list.action.js.map +1 -0
- package/dist/custom/lists/create-list.action.d.ts +27 -0
- package/dist/custom/lists/create-list.action.d.ts.map +1 -0
- package/dist/custom/lists/create-list.action.js +180 -0
- package/dist/custom/lists/create-list.action.js.map +1 -0
- package/dist/custom/lists/get-list-records.action.d.ts +42 -0
- package/dist/custom/lists/get-list-records.action.d.ts.map +1 -0
- package/dist/custom/lists/get-list-records.action.js +240 -0
- package/dist/custom/lists/get-list-records.action.js.map +1 -0
- package/dist/custom/lists/get-record-list-membership.action.d.ts +24 -0
- package/dist/custom/lists/get-record-list-membership.action.d.ts.map +1 -0
- package/dist/custom/lists/get-record-list-membership.action.js +177 -0
- package/dist/custom/lists/get-record-list-membership.action.js.map +1 -0
- package/dist/custom/lists/index.d.ts +25 -0
- package/dist/custom/lists/index.d.ts.map +1 -0
- package/dist/custom/lists/index.js +56 -0
- package/dist/custom/lists/index.js.map +1 -0
- package/dist/custom/lists/remove-records-from-list.action.d.ts +44 -0
- package/dist/custom/lists/remove-records-from-list.action.d.ts.map +1 -0
- package/dist/custom/lists/remove-records-from-list.action.js +195 -0
- package/dist/custom/lists/remove-records-from-list.action.js.map +1 -0
- package/dist/custom/lists/update-list-item-status.action.d.ts +36 -0
- package/dist/custom/lists/update-list-item-status.action.d.ts.map +1 -0
- package/dist/custom/lists/update-list-item-status.action.js +201 -0
- package/dist/custom/lists/update-list-item-status.action.js.map +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -0
- package/dist/index.js.map +1 -1
- package/package.json +48 -23
|
@@ -0,0 +1,240 @@
|
|
|
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.LoadGetListRecordsAction = exports.GetListRecordsAction = void 0;
|
|
10
|
+
const global_1 = require("@memberjunction/global");
|
|
11
|
+
const actions_1 = require("@memberjunction/actions");
|
|
12
|
+
const core_1 = require("@memberjunction/core");
|
|
13
|
+
/**
|
|
14
|
+
* Action to retrieve records from a list with optional filtering and pagination.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* // Get all records from a list
|
|
19
|
+
* await runAction({
|
|
20
|
+
* ActionName: 'Get List Records',
|
|
21
|
+
* Params: [
|
|
22
|
+
* { Name: 'ListID', Value: 'abc-123-def' }
|
|
23
|
+
* ]
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* // Get filtered records with pagination
|
|
27
|
+
* await runAction({
|
|
28
|
+
* ActionName: 'Get List Records',
|
|
29
|
+
* Params: [
|
|
30
|
+
* { Name: 'ListID', Value: 'abc-123-def' },
|
|
31
|
+
* { Name: 'FilterByStatus', Value: 'Active' },
|
|
32
|
+
* { Name: 'MaxRecords', Value: 100 },
|
|
33
|
+
* { Name: 'IncludeRecordDetails', Value: true }
|
|
34
|
+
* ]
|
|
35
|
+
* });
|
|
36
|
+
* ```
|
|
37
|
+
*/
|
|
38
|
+
let GetListRecordsAction = class GetListRecordsAction extends actions_1.BaseAction {
|
|
39
|
+
async InternalRunAction(params) {
|
|
40
|
+
try {
|
|
41
|
+
// Extract parameters
|
|
42
|
+
const listId = this.getStringParam(params, 'ListID');
|
|
43
|
+
const filterByStatus = this.getStringParam(params, 'FilterByStatus');
|
|
44
|
+
const maxRecords = this.getNumericParam(params, 'MaxRecords', 1000);
|
|
45
|
+
const includeRecordDetails = this.getBooleanParam(params, 'IncludeRecordDetails', false);
|
|
46
|
+
const orderBy = this.getStringParam(params, 'OrderBy') || 'Sequence ASC';
|
|
47
|
+
// Validate required parameters
|
|
48
|
+
if (!listId) {
|
|
49
|
+
return {
|
|
50
|
+
Success: false,
|
|
51
|
+
ResultCode: 'MISSING_PARAMETER',
|
|
52
|
+
Message: 'ListID is required'
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
const rv = new core_1.RunView();
|
|
56
|
+
// Verify list exists and get entity info
|
|
57
|
+
const listResult = await rv.RunView({
|
|
58
|
+
EntityName: 'Lists',
|
|
59
|
+
ExtraFilter: `ID = '${listId}'`,
|
|
60
|
+
ResultType: 'entity_object'
|
|
61
|
+
}, params.ContextUser);
|
|
62
|
+
if (!listResult.Success || !listResult.Results || listResult.Results.length === 0) {
|
|
63
|
+
return {
|
|
64
|
+
Success: false,
|
|
65
|
+
ResultCode: 'LIST_NOT_FOUND',
|
|
66
|
+
Message: `List with ID '${listId}' not found`
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
const list = listResult.Results[0];
|
|
70
|
+
// Build filter
|
|
71
|
+
let filter = `ListID = '${listId}'`;
|
|
72
|
+
if (filterByStatus) {
|
|
73
|
+
filter += ` AND Status = '${filterByStatus}'`;
|
|
74
|
+
}
|
|
75
|
+
// Get list details
|
|
76
|
+
const detailsResult = await rv.RunView({
|
|
77
|
+
EntityName: 'List Details',
|
|
78
|
+
ExtraFilter: filter,
|
|
79
|
+
OrderBy: orderBy,
|
|
80
|
+
MaxRows: maxRecords,
|
|
81
|
+
ResultType: 'entity_object'
|
|
82
|
+
}, params.ContextUser);
|
|
83
|
+
if (!detailsResult.Success) {
|
|
84
|
+
return {
|
|
85
|
+
Success: false,
|
|
86
|
+
ResultCode: 'QUERY_FAILED',
|
|
87
|
+
Message: `Failed to query list records: ${detailsResult.ErrorMessage}`
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
const details = detailsResult.Results || [];
|
|
91
|
+
let records = details.map(d => ({
|
|
92
|
+
ListDetailID: d.ID,
|
|
93
|
+
RecordID: d.RecordID,
|
|
94
|
+
Sequence: d.Sequence,
|
|
95
|
+
Status: d.Status,
|
|
96
|
+
AdditionalData: d.AdditionalData
|
|
97
|
+
}));
|
|
98
|
+
if (includeRecordDetails && details.length > 0) {
|
|
99
|
+
// Get the entity name from the list's entity
|
|
100
|
+
const entityName = list.Entity; // This is the denormalized entity name
|
|
101
|
+
if (entityName) {
|
|
102
|
+
// Get the entity's primary key field(s)
|
|
103
|
+
const md = new core_1.Metadata();
|
|
104
|
+
const entityInfo = md.Entities.find(e => e.Name === entityName);
|
|
105
|
+
if (entityInfo && entityInfo.PrimaryKeys.length > 0) {
|
|
106
|
+
// Build appropriate filter for single vs composite keys
|
|
107
|
+
const extraFilter = this.buildRecordFilter(entityInfo, details);
|
|
108
|
+
const recordsResult = await rv.RunView({
|
|
109
|
+
EntityName: entityName,
|
|
110
|
+
ExtraFilter: extraFilter,
|
|
111
|
+
ResultType: 'entity_object'
|
|
112
|
+
}, params.ContextUser);
|
|
113
|
+
if (recordsResult.Success && recordsResult.Results) {
|
|
114
|
+
// Create a map for quick lookup
|
|
115
|
+
// For single PK, RecordID is just the raw value
|
|
116
|
+
// For composite PK, RecordID is the concatenated string
|
|
117
|
+
const recordMap = new Map();
|
|
118
|
+
const isSinglePK = entityInfo.PrimaryKeys.length === 1;
|
|
119
|
+
for (const rec of recordsResult.Results) {
|
|
120
|
+
let keyString;
|
|
121
|
+
if (isSinglePK) {
|
|
122
|
+
// Single PK: use raw value
|
|
123
|
+
const pkField = entityInfo.PrimaryKeys[0].Name;
|
|
124
|
+
keyString = String(rec.Get ? rec.Get(pkField) : rec[pkField]);
|
|
125
|
+
}
|
|
126
|
+
else {
|
|
127
|
+
// Composite PK: use concatenated format
|
|
128
|
+
const compositeKey = new core_1.CompositeKey();
|
|
129
|
+
compositeKey.LoadFromEntityInfoAndRecord(entityInfo, rec);
|
|
130
|
+
keyString = compositeKey.ToConcatenatedString();
|
|
131
|
+
}
|
|
132
|
+
recordMap.set(keyString, rec.GetAll ? rec.GetAll() : rec);
|
|
133
|
+
}
|
|
134
|
+
// Attach record details
|
|
135
|
+
records = records.map(r => ({
|
|
136
|
+
...r,
|
|
137
|
+
RecordDetails: recordMap.get(r.RecordID) || undefined
|
|
138
|
+
}));
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
// Add output parameters
|
|
144
|
+
this.addOutputParam(params, 'Records', records);
|
|
145
|
+
this.addOutputParam(params, 'TotalCount', details.length);
|
|
146
|
+
this.addOutputParam(params, 'ListName', list.Name);
|
|
147
|
+
this.addOutputParam(params, 'EntityName', list.Entity);
|
|
148
|
+
return {
|
|
149
|
+
Success: true,
|
|
150
|
+
ResultCode: 'SUCCESS',
|
|
151
|
+
Message: `Retrieved ${details.length} record(s) from list '${list.Name}'`
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
catch (error) {
|
|
155
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
156
|
+
return {
|
|
157
|
+
Success: false,
|
|
158
|
+
ResultCode: 'UNEXPECTED_ERROR',
|
|
159
|
+
Message: `Failed to get list records: ${errorMessage}`
|
|
160
|
+
};
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
getStringParam(params, name) {
|
|
164
|
+
const param = params.Params.find(p => p.Name.toLowerCase() === name.toLowerCase() && p.Type === 'Input');
|
|
165
|
+
return param?.Value != null ? String(param.Value) : undefined;
|
|
166
|
+
}
|
|
167
|
+
getNumericParam(params, name, defaultValue) {
|
|
168
|
+
const param = params.Params.find(p => p.Name.toLowerCase() === name.toLowerCase() && p.Type === 'Input');
|
|
169
|
+
if (param?.Value != null) {
|
|
170
|
+
const num = Number(param.Value);
|
|
171
|
+
return isNaN(num) ? defaultValue : num;
|
|
172
|
+
}
|
|
173
|
+
return defaultValue;
|
|
174
|
+
}
|
|
175
|
+
getBooleanParam(params, name, defaultValue) {
|
|
176
|
+
const param = params.Params.find(p => p.Name.toLowerCase() === name.toLowerCase() && p.Type === 'Input');
|
|
177
|
+
if (param?.Value != null) {
|
|
178
|
+
const val = String(param.Value).toLowerCase();
|
|
179
|
+
if (val === 'true' || val === '1' || val === 'yes')
|
|
180
|
+
return true;
|
|
181
|
+
if (val === 'false' || val === '0' || val === 'no')
|
|
182
|
+
return false;
|
|
183
|
+
}
|
|
184
|
+
return defaultValue;
|
|
185
|
+
}
|
|
186
|
+
addOutputParam(params, name, value) {
|
|
187
|
+
params.Params.push({
|
|
188
|
+
Name: name,
|
|
189
|
+
Type: 'Output',
|
|
190
|
+
Value: value
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Build the SQL filter to select records that match the given list details.
|
|
195
|
+
* For single PK entities, uses a simple IN clause with the raw RecordID values.
|
|
196
|
+
* For composite PK entities, uses an OR clause with concatenated key matching.
|
|
197
|
+
*/
|
|
198
|
+
buildRecordFilter(entityInfo, details) {
|
|
199
|
+
const primaryKeys = entityInfo.PrimaryKeys;
|
|
200
|
+
const recordIds = details.map(d => d.RecordID);
|
|
201
|
+
if (primaryKeys.length === 1) {
|
|
202
|
+
// Simple case: single primary key
|
|
203
|
+
// For single PK entities, RecordID stores just the raw value (not concatenated format)
|
|
204
|
+
const pkField = primaryKeys[0].Name;
|
|
205
|
+
const escapedValues = recordIds.map(rid => `'${rid.replace(/'/g, "''")}'`);
|
|
206
|
+
if (escapedValues.length === 0) {
|
|
207
|
+
return '1=0'; // No valid records
|
|
208
|
+
}
|
|
209
|
+
return `${pkField} IN (${escapedValues.join(',')})`;
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
// Composite key case: build concatenation expression and match against RecordID values
|
|
213
|
+
// Build SQL expression that concatenates the PK fields in the same format as RecordID
|
|
214
|
+
// Format: 'Field1|' + CAST(Value1 AS NVARCHAR(MAX)) + '||' + 'Field2|' + CAST(Value2 AS NVARCHAR(MAX))
|
|
215
|
+
const concatParts = primaryKeys.map((pk, index) => {
|
|
216
|
+
const fieldNameLiteral = `'${pk.Name}|'`;
|
|
217
|
+
const fieldValue = `CAST([${pk.Name}] AS NVARCHAR(MAX))`;
|
|
218
|
+
if (index === 0) {
|
|
219
|
+
return `${fieldNameLiteral} + ${fieldValue}`;
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
return `'||' + ${fieldNameLiteral} + ${fieldValue}`;
|
|
223
|
+
}
|
|
224
|
+
});
|
|
225
|
+
const compositeKeyExpr = concatParts.join(' + ');
|
|
226
|
+
// Build IN clause with the RecordID values
|
|
227
|
+
const escapedRecordIds = recordIds.map(id => `'${id.replace(/'/g, "''")}'`).join(',');
|
|
228
|
+
return `(${compositeKeyExpr}) IN (${escapedRecordIds})`;
|
|
229
|
+
}
|
|
230
|
+
}
|
|
231
|
+
};
|
|
232
|
+
exports.GetListRecordsAction = GetListRecordsAction;
|
|
233
|
+
exports.GetListRecordsAction = GetListRecordsAction = __decorate([
|
|
234
|
+
(0, global_1.RegisterClass)(actions_1.BaseAction, "Get List Records")
|
|
235
|
+
], GetListRecordsAction);
|
|
236
|
+
function LoadGetListRecordsAction() {
|
|
237
|
+
// Prevents tree-shaking
|
|
238
|
+
}
|
|
239
|
+
exports.LoadGetListRecordsAction = LoadGetListRecordsAction;
|
|
240
|
+
//# sourceMappingURL=get-list-records.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-list-records.action.js","sourceRoot":"","sources":["../../../src/custom/lists/get-list-records.action.ts"],"names":[],"mappings":";;;;;;;;;AACA,mDAAuD;AACvD,qDAAqD;AACrD,+CAAmF;AAGnF;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEI,IAAM,oBAAoB,GAA1B,MAAM,oBAAqB,SAAQ,oBAAU;IAExC,KAAK,CAAC,iBAAiB,CAAC,MAAuB;QACvD,IAAI,CAAC;YACH,qBAAqB;YACrB,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YACrD,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,gBAAgB,CAAC,CAAC;YACrE,MAAM,UAAU,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,YAAY,EAAE,IAAI,CAAC,CAAC;YACpE,MAAM,oBAAoB,GAAG,IAAI,CAAC,eAAe,CAAC,MAAM,EAAE,sBAAsB,EAAE,KAAK,CAAC,CAAC;YACzF,MAAM,OAAO,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,SAAS,CAAC,IAAI,cAAc,CAAC;YAEzE,+BAA+B;YAC/B,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,UAAU,EAAE,mBAAmB;oBAC/B,OAAO,EAAE,oBAAoB;iBAC9B,CAAC;YACJ,CAAC;YAED,MAAM,EAAE,GAAG,IAAI,cAAO,EAAE,CAAC;YAEzB,yCAAyC;YACzC,MAAM,UAAU,GAAG,MAAM,EAAE,CAAC,OAAO,CAAa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ACH,CAAC;CACF,CAAA;AAzOY,oDAAoB;+BAApB,oBAAoB;IADhC,IAAA,sBAAa,EAAC,oBAAU,EAAE,kBAAkB,CAAC;GACjC,oBAAoB,CAyOhC;AAED,SAAgB,wBAAwB;IACtC,wBAAwB;AAC1B,CAAC;AAFD,4DAEC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ActionResultSimple, RunActionParams } from "@memberjunction/actions-base";
|
|
2
|
+
import { BaseAction } from "@memberjunction/actions";
|
|
3
|
+
/**
|
|
4
|
+
* Action to find which lists a specific record belongs to.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* await runAction({
|
|
9
|
+
* ActionName: 'Get Record List Membership',
|
|
10
|
+
* Params: [
|
|
11
|
+
* { Name: 'EntityName', Value: 'Contacts' },
|
|
12
|
+
* { Name: 'RecordID', Value: 'contact-123' },
|
|
13
|
+
* { Name: 'UserID', Value: 'user-456' } // Optional: filter by list owner
|
|
14
|
+
* ]
|
|
15
|
+
* });
|
|
16
|
+
* ```
|
|
17
|
+
*/
|
|
18
|
+
export declare class GetRecordListMembershipAction extends BaseAction {
|
|
19
|
+
protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
|
|
20
|
+
private getStringParam;
|
|
21
|
+
private addOutputParam;
|
|
22
|
+
}
|
|
23
|
+
export declare function LoadGetRecordListMembershipAction(): void;
|
|
24
|
+
//# sourceMappingURL=get-record-list-membership.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-record-list-membership.action.d.ts","sourceRoot":"","sources":["../../../src/custom/lists/get-record-list-membership.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEnF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAIrD;;;;;;;;;;;;;;GAcG;AACH,qBACa,6BAA8B,SAAQ,UAAU;cAE3C,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAgKvF,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,cAAc;CAOvB;AAED,wBAAgB,iCAAiC,IAAI,IAAI,CAExD"}
|
|
@@ -0,0 +1,177 @@
|
|
|
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.LoadGetRecordListMembershipAction = exports.GetRecordListMembershipAction = void 0;
|
|
10
|
+
const global_1 = require("@memberjunction/global");
|
|
11
|
+
const actions_1 = require("@memberjunction/actions");
|
|
12
|
+
const core_1 = require("@memberjunction/core");
|
|
13
|
+
/**
|
|
14
|
+
* Action to find which lists a specific record belongs to.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```typescript
|
|
18
|
+
* await runAction({
|
|
19
|
+
* ActionName: 'Get Record List Membership',
|
|
20
|
+
* Params: [
|
|
21
|
+
* { Name: 'EntityName', Value: 'Contacts' },
|
|
22
|
+
* { Name: 'RecordID', Value: 'contact-123' },
|
|
23
|
+
* { Name: 'UserID', Value: 'user-456' } // Optional: filter by list owner
|
|
24
|
+
* ]
|
|
25
|
+
* });
|
|
26
|
+
* ```
|
|
27
|
+
*/
|
|
28
|
+
let GetRecordListMembershipAction = class GetRecordListMembershipAction extends actions_1.BaseAction {
|
|
29
|
+
async InternalRunAction(params) {
|
|
30
|
+
try {
|
|
31
|
+
// Extract parameters
|
|
32
|
+
const entityName = this.getStringParam(params, 'EntityName');
|
|
33
|
+
const entityId = this.getStringParam(params, 'EntityID');
|
|
34
|
+
const recordId = this.getStringParam(params, 'RecordID');
|
|
35
|
+
const userId = this.getStringParam(params, 'UserID');
|
|
36
|
+
// Validate required parameters
|
|
37
|
+
if (!recordId) {
|
|
38
|
+
return {
|
|
39
|
+
Success: false,
|
|
40
|
+
ResultCode: 'MISSING_PARAMETER',
|
|
41
|
+
Message: 'RecordID is required'
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
if (!entityName && !entityId) {
|
|
45
|
+
return {
|
|
46
|
+
Success: false,
|
|
47
|
+
ResultCode: 'MISSING_PARAMETER',
|
|
48
|
+
Message: 'Either EntityName or EntityID is required'
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
const rv = new core_1.RunView();
|
|
52
|
+
// Resolve entity ID if name provided
|
|
53
|
+
let resolvedEntityId = entityId;
|
|
54
|
+
if (entityName && !entityId) {
|
|
55
|
+
const entityResult = await rv.RunView({
|
|
56
|
+
EntityName: 'Entities',
|
|
57
|
+
ExtraFilter: `Name = '${entityName}'`,
|
|
58
|
+
ResultType: 'entity_object'
|
|
59
|
+
}, params.ContextUser);
|
|
60
|
+
if (!entityResult.Success || !entityResult.Results || entityResult.Results.length === 0) {
|
|
61
|
+
return {
|
|
62
|
+
Success: false,
|
|
63
|
+
ResultCode: 'ENTITY_NOT_FOUND',
|
|
64
|
+
Message: `Entity '${entityName}' not found`
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
resolvedEntityId = entityResult.Results[0].ID;
|
|
68
|
+
}
|
|
69
|
+
// Get list details for this record
|
|
70
|
+
const detailsResult = await rv.RunView({
|
|
71
|
+
EntityName: 'List Details',
|
|
72
|
+
ExtraFilter: `RecordID = '${recordId}'`,
|
|
73
|
+
ResultType: 'entity_object'
|
|
74
|
+
}, params.ContextUser);
|
|
75
|
+
if (!detailsResult.Success) {
|
|
76
|
+
return {
|
|
77
|
+
Success: false,
|
|
78
|
+
ResultCode: 'QUERY_FAILED',
|
|
79
|
+
Message: `Failed to query list membership: ${detailsResult.ErrorMessage}`
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
const details = detailsResult.Results || [];
|
|
83
|
+
if (details.length === 0) {
|
|
84
|
+
this.addOutputParam(params, 'Lists', []);
|
|
85
|
+
this.addOutputParam(params, 'MembershipDetails', []);
|
|
86
|
+
this.addOutputParam(params, 'Count', 0);
|
|
87
|
+
return {
|
|
88
|
+
Success: true,
|
|
89
|
+
ResultCode: 'SUCCESS',
|
|
90
|
+
Message: 'Record is not a member of any lists'
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
// Get the lists
|
|
94
|
+
const listIds = [...new Set(details.map(d => d.ListID))];
|
|
95
|
+
const listIdFilter = listIds.map(id => `'${id}'`).join(',');
|
|
96
|
+
let listFilter = `ID IN (${listIdFilter}) AND EntityID = '${resolvedEntityId}'`;
|
|
97
|
+
if (userId) {
|
|
98
|
+
listFilter += ` AND UserID = '${userId}'`;
|
|
99
|
+
}
|
|
100
|
+
const listsResult = await rv.RunView({
|
|
101
|
+
EntityName: 'Lists',
|
|
102
|
+
ExtraFilter: listFilter,
|
|
103
|
+
OrderBy: 'Name',
|
|
104
|
+
ResultType: 'entity_object'
|
|
105
|
+
}, params.ContextUser);
|
|
106
|
+
if (!listsResult.Success) {
|
|
107
|
+
return {
|
|
108
|
+
Success: false,
|
|
109
|
+
ResultCode: 'QUERY_FAILED',
|
|
110
|
+
Message: `Failed to query lists: ${listsResult.ErrorMessage}`
|
|
111
|
+
};
|
|
112
|
+
}
|
|
113
|
+
const lists = listsResult.Results || [];
|
|
114
|
+
const membershipDetails = [];
|
|
115
|
+
const listMap = new Map();
|
|
116
|
+
for (const list of lists) {
|
|
117
|
+
listMap.set(list.ID, list);
|
|
118
|
+
}
|
|
119
|
+
for (const detail of details) {
|
|
120
|
+
const list = listMap.get(detail.ListID);
|
|
121
|
+
if (list) {
|
|
122
|
+
membershipDetails.push({
|
|
123
|
+
listId: detail.ListID,
|
|
124
|
+
listName: list.Name,
|
|
125
|
+
addedAt: detail.Get('__mj_CreatedAt'),
|
|
126
|
+
status: detail.Status,
|
|
127
|
+
sequence: detail.Sequence
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
// Prepare output
|
|
132
|
+
const listOutput = lists.map(l => ({
|
|
133
|
+
ID: l.ID,
|
|
134
|
+
Name: l.Name,
|
|
135
|
+
Description: l.Description,
|
|
136
|
+
UserID: l.UserID,
|
|
137
|
+
CategoryID: l.CategoryID
|
|
138
|
+
}));
|
|
139
|
+
this.addOutputParam(params, 'Lists', listOutput);
|
|
140
|
+
this.addOutputParam(params, 'MembershipDetails', membershipDetails);
|
|
141
|
+
this.addOutputParam(params, 'Count', lists.length);
|
|
142
|
+
return {
|
|
143
|
+
Success: true,
|
|
144
|
+
ResultCode: 'SUCCESS',
|
|
145
|
+
Message: `Record is a member of ${lists.length} list(s)`
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
150
|
+
return {
|
|
151
|
+
Success: false,
|
|
152
|
+
ResultCode: 'UNEXPECTED_ERROR',
|
|
153
|
+
Message: `Failed to get record list membership: ${errorMessage}`
|
|
154
|
+
};
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
getStringParam(params, name) {
|
|
158
|
+
const param = params.Params.find(p => p.Name.toLowerCase() === name.toLowerCase() && p.Type === 'Input');
|
|
159
|
+
return param?.Value != null ? String(param.Value) : undefined;
|
|
160
|
+
}
|
|
161
|
+
addOutputParam(params, name, value) {
|
|
162
|
+
params.Params.push({
|
|
163
|
+
Name: name,
|
|
164
|
+
Type: 'Output',
|
|
165
|
+
Value: value
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
exports.GetRecordListMembershipAction = GetRecordListMembershipAction;
|
|
170
|
+
exports.GetRecordListMembershipAction = GetRecordListMembershipAction = __decorate([
|
|
171
|
+
(0, global_1.RegisterClass)(actions_1.BaseAction, "Get Record List Membership")
|
|
172
|
+
], GetRecordListMembershipAction);
|
|
173
|
+
function LoadGetRecordListMembershipAction() {
|
|
174
|
+
// Prevents tree-shaking
|
|
175
|
+
}
|
|
176
|
+
exports.LoadGetRecordListMembershipAction = LoadGetRecordListMembershipAction;
|
|
177
|
+
//# sourceMappingURL=get-record-list-membership.action.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-record-list-membership.action.js","sourceRoot":"","sources":["../../../src/custom/lists/get-record-list-membership.action.ts"],"names":[],"mappings":";;;;;;;;;AACA,mDAAuD;AACvD,qDAAqD;AACrD,+CAA+C;AAG/C;;;;;;;;;;;;;;GAcG;AAEI,IAAM,6BAA6B,GAAnC,MAAM,6BAA8B,SAAQ,oBAAU;IAEjD,KAAK,CAAC,iBAAiB,CAAC,MAAuB;QACvD,IAAI,CAAC;YACH,qBAAqB;YACrB,MAAM,UAAU,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;YAC7D,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;YACzD,MAAM,QAAQ,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;YACzD,MAAM,MAAM,GAAG,IAAI,CAAC,cAAc,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;YAErD,+BAA+B;YAC/B,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACd,OAAO;oBACL,OAAO,EAAE,KAAK;oBACd,UAAU,EAAE,mBAAmB;oBAC/B,OAAO,EAAE,sBAAsB;iBAChC,CAAC;YACJ,CAAC;YAED,IAAI,CAAC,UAAU,IAAI,CAAC,QAAQ,EAAE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FD,8EAEC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* List Management Actions
|
|
3
|
+
*
|
|
4
|
+
* These actions provide comprehensive list management capabilities for AI agents,
|
|
5
|
+
* workflows, and other automation scenarios.
|
|
6
|
+
*
|
|
7
|
+
* Available Actions:
|
|
8
|
+
* - Add Records to List: Add one or more records to a list
|
|
9
|
+
* - Remove Records from List: Remove records from a list
|
|
10
|
+
* - Create List: Create a new list with optional initial records
|
|
11
|
+
* - Get List Records: Retrieve records from a list with filtering
|
|
12
|
+
* - Get Record List Membership: Find which lists contain a specific record
|
|
13
|
+
* - Update List Item Status: Bulk update status on list items
|
|
14
|
+
*/
|
|
15
|
+
export * from './add-records-to-list.action';
|
|
16
|
+
export * from './remove-records-from-list.action';
|
|
17
|
+
export * from './create-list.action';
|
|
18
|
+
export * from './get-list-records.action';
|
|
19
|
+
export * from './get-record-list-membership.action';
|
|
20
|
+
export * from './update-list-item-status.action';
|
|
21
|
+
/**
|
|
22
|
+
* Load all list-related actions to prevent tree-shaking
|
|
23
|
+
*/
|
|
24
|
+
export declare function LoadListActions(): void;
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/custom/lists/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH,cAAc,8BAA8B,CAAC;AAC7C,cAAc,mCAAmC,CAAC;AAClD,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qCAAqC,CAAC;AACpD,cAAc,kCAAkC,CAAC;AASjD;;GAEG;AACH,wBAAgB,eAAe,IAAI,IAAI,CAOtC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* List Management Actions
|
|
4
|
+
*
|
|
5
|
+
* These actions provide comprehensive list management capabilities for AI agents,
|
|
6
|
+
* workflows, and other automation scenarios.
|
|
7
|
+
*
|
|
8
|
+
* Available Actions:
|
|
9
|
+
* - Add Records to List: Add one or more records to a list
|
|
10
|
+
* - Remove Records from List: Remove records from a list
|
|
11
|
+
* - Create List: Create a new list with optional initial records
|
|
12
|
+
* - Get List Records: Retrieve records from a list with filtering
|
|
13
|
+
* - Get Record List Membership: Find which lists contain a specific record
|
|
14
|
+
* - Update List Item Status: Bulk update status on list items
|
|
15
|
+
*/
|
|
16
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
17
|
+
if (k2 === undefined) k2 = k;
|
|
18
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
19
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
20
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
21
|
+
}
|
|
22
|
+
Object.defineProperty(o, k2, desc);
|
|
23
|
+
}) : (function(o, m, k, k2) {
|
|
24
|
+
if (k2 === undefined) k2 = k;
|
|
25
|
+
o[k2] = m[k];
|
|
26
|
+
}));
|
|
27
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
28
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
29
|
+
};
|
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
+
exports.LoadListActions = void 0;
|
|
32
|
+
__exportStar(require("./add-records-to-list.action"), exports);
|
|
33
|
+
__exportStar(require("./remove-records-from-list.action"), exports);
|
|
34
|
+
__exportStar(require("./create-list.action"), exports);
|
|
35
|
+
__exportStar(require("./get-list-records.action"), exports);
|
|
36
|
+
__exportStar(require("./get-record-list-membership.action"), exports);
|
|
37
|
+
__exportStar(require("./update-list-item-status.action"), exports);
|
|
38
|
+
const add_records_to_list_action_1 = require("./add-records-to-list.action");
|
|
39
|
+
const remove_records_from_list_action_1 = require("./remove-records-from-list.action");
|
|
40
|
+
const create_list_action_1 = require("./create-list.action");
|
|
41
|
+
const get_list_records_action_1 = require("./get-list-records.action");
|
|
42
|
+
const get_record_list_membership_action_1 = require("./get-record-list-membership.action");
|
|
43
|
+
const update_list_item_status_action_1 = require("./update-list-item-status.action");
|
|
44
|
+
/**
|
|
45
|
+
* Load all list-related actions to prevent tree-shaking
|
|
46
|
+
*/
|
|
47
|
+
function LoadListActions() {
|
|
48
|
+
(0, add_records_to_list_action_1.LoadAddRecordsToListAction)();
|
|
49
|
+
(0, remove_records_from_list_action_1.LoadRemoveRecordsFromListAction)();
|
|
50
|
+
(0, create_list_action_1.LoadCreateListAction)();
|
|
51
|
+
(0, get_list_records_action_1.LoadGetListRecordsAction)();
|
|
52
|
+
(0, get_record_list_membership_action_1.LoadGetRecordListMembershipAction)();
|
|
53
|
+
(0, update_list_item_status_action_1.LoadUpdateListItemStatusAction)();
|
|
54
|
+
}
|
|
55
|
+
exports.LoadListActions = LoadListActions;
|
|
56
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/custom/lists/index.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;AAEH,+DAA6C;AAC7C,oEAAkD;AAClD,uDAAqC;AACrC,4DAA0C;AAC1C,sEAAoD;AACpD,mEAAiD;AAEjD,6EAA0E;AAC1E,uFAAoF;AACpF,6DAA4D;AAC5D,uEAAqE;AACrE,2FAAwF;AACxF,qFAAkF;AAElF;;GAEG;AACH,SAAgB,eAAe;IAC7B,IAAA,uDAA0B,GAAE,CAAC;IAC7B,IAAA,iEAA+B,GAAE,CAAC;IAClC,IAAA,yCAAoB,GAAE,CAAC;IACvB,IAAA,kDAAwB,GAAE,CAAC;IAC3B,IAAA,qEAAiC,GAAE,CAAC;IACpC,IAAA,+DAA8B,GAAE,CAAC;AACnC,CAAC;AAPD,0CAOC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ActionResultSimple, RunActionParams } from "@memberjunction/actions-base";
|
|
2
|
+
import { BaseAction } from "@memberjunction/actions";
|
|
3
|
+
/**
|
|
4
|
+
* Action to remove records from a list.
|
|
5
|
+
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* // Remove specific records
|
|
9
|
+
* await runAction({
|
|
10
|
+
* ActionName: 'Remove Records from List',
|
|
11
|
+
* Params: [
|
|
12
|
+
* { Name: 'ListID', Value: 'abc-123-def' },
|
|
13
|
+
* { Name: 'RecordIDs', Value: ['rec1', 'rec2'] }
|
|
14
|
+
* ]
|
|
15
|
+
* });
|
|
16
|
+
*
|
|
17
|
+
* // Remove all records with a specific status
|
|
18
|
+
* await runAction({
|
|
19
|
+
* ActionName: 'Remove Records from List',
|
|
20
|
+
* Params: [
|
|
21
|
+
* { Name: 'ListID', Value: 'abc-123-def' },
|
|
22
|
+
* { Name: 'FilterByStatus', Value: 'Complete' }
|
|
23
|
+
* ]
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* // Remove all records from list
|
|
27
|
+
* await runAction({
|
|
28
|
+
* ActionName: 'Remove Records from List',
|
|
29
|
+
* Params: [
|
|
30
|
+
* { Name: 'ListID', Value: 'abc-123-def' },
|
|
31
|
+
* { Name: 'RemoveAll', Value: true }
|
|
32
|
+
* ]
|
|
33
|
+
* });
|
|
34
|
+
* ```
|
|
35
|
+
*/
|
|
36
|
+
export declare class RemoveRecordsFromListAction extends BaseAction {
|
|
37
|
+
protected InternalRunAction(params: RunActionParams): Promise<ActionResultSimple>;
|
|
38
|
+
private getStringParam;
|
|
39
|
+
private getArrayParam;
|
|
40
|
+
private getBooleanParam;
|
|
41
|
+
private addOutputParam;
|
|
42
|
+
}
|
|
43
|
+
export declare function LoadRemoveRecordsFromListAction(): void;
|
|
44
|
+
//# sourceMappingURL=remove-records-from-list.action.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-records-from-list.action.d.ts","sourceRoot":"","sources":["../../../src/custom/lists/remove-records-from-list.action.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEnF,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAIrD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AACH,qBACa,2BAA4B,SAAQ,UAAU;cAEzC,iBAAiB,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAgHvF,OAAO,CAAC,cAAc;IAOtB,OAAO,CAAC,aAAa;IAoBrB,OAAO,CAAC,eAAe;IAYvB,OAAO,CAAC,cAAc;CAOvB;AAED,wBAAgB,+BAA+B,IAAI,IAAI,CAEtD"}
|