@memberjunction/scheduling-engine 2.107.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/BaseScheduledJob.d.ts +122 -0
- package/dist/BaseScheduledJob.d.ts.map +1 -0
- package/dist/BaseScheduledJob.js +105 -0
- package/dist/BaseScheduledJob.js.map +1 -0
- package/dist/CronExpressionHelper.d.ts +36 -0
- package/dist/CronExpressionHelper.d.ts.map +1 -0
- package/dist/CronExpressionHelper.js +106 -0
- package/dist/CronExpressionHelper.js.map +1 -0
- package/dist/NotificationManager.d.ts +19 -0
- package/dist/NotificationManager.d.ts.map +1 -0
- package/dist/NotificationManager.js +44 -0
- package/dist/NotificationManager.js.map +1 -0
- package/dist/ScheduledJobEngine.d.ts +188 -0
- package/dist/ScheduledJobEngine.d.ts.map +1 -0
- package/dist/ScheduledJobEngine.js +601 -0
- package/dist/ScheduledJobEngine.js.map +1 -0
- package/dist/drivers/ActionScheduledJobDriver.d.ts +40 -0
- package/dist/drivers/ActionScheduledJobDriver.d.ts.map +1 -0
- package/dist/drivers/ActionScheduledJobDriver.js +175 -0
- package/dist/drivers/ActionScheduledJobDriver.js.map +1 -0
- package/dist/drivers/AgentScheduledJobDriver.d.ts +40 -0
- package/dist/drivers/AgentScheduledJobDriver.d.ts.map +1 -0
- package/dist/drivers/AgentScheduledJobDriver.js +149 -0
- package/dist/drivers/AgentScheduledJobDriver.js.map +1 -0
- package/dist/drivers/index.d.ts +12 -0
- package/dist/drivers/index.d.ts.map +1 -0
- package/dist/drivers/index.js +35 -0
- package/dist/drivers/index.js.map +1 -0
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +38 -0
- package/dist/index.js.map +1 -0
- package/package.json +31 -0
|
@@ -0,0 +1,175 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Driver for executing scheduled Action jobs
|
|
4
|
+
* @module @memberjunction/scheduling-engine
|
|
5
|
+
*/
|
|
6
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
7
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
9
|
+
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;
|
|
10
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.LoadActionScheduledJobDriver = exports.ActionScheduledJobDriver = void 0;
|
|
14
|
+
const global_1 = require("@memberjunction/global");
|
|
15
|
+
const BaseScheduledJob_1 = require("../BaseScheduledJob");
|
|
16
|
+
const core_1 = require("@memberjunction/core");
|
|
17
|
+
const actions_1 = require("@memberjunction/actions");
|
|
18
|
+
/**
|
|
19
|
+
* Driver for executing scheduled Action jobs
|
|
20
|
+
*
|
|
21
|
+
* Configuration schema (stored in ScheduledJob.Configuration):
|
|
22
|
+
* {
|
|
23
|
+
* ActionID: string,
|
|
24
|
+
* Params?: Array<{
|
|
25
|
+
* ActionParamID: string,
|
|
26
|
+
* ValueType: 'Static' | 'SQL Statement',
|
|
27
|
+
* Value: string
|
|
28
|
+
* }>
|
|
29
|
+
* }
|
|
30
|
+
*
|
|
31
|
+
* Execution result details (stored in ScheduledJobRun.Details):
|
|
32
|
+
* {
|
|
33
|
+
* ResultCode: string,
|
|
34
|
+
* IsSuccess: boolean,
|
|
35
|
+
* OutputParams?: any
|
|
36
|
+
* }
|
|
37
|
+
*/
|
|
38
|
+
let ActionScheduledJobDriver = class ActionScheduledJobDriver extends BaseScheduledJob_1.BaseScheduledJob {
|
|
39
|
+
async Execute(context) {
|
|
40
|
+
const config = this.parseConfiguration(context.Schedule);
|
|
41
|
+
// Load the action
|
|
42
|
+
await actions_1.ActionEngineServer.Instance.Config(false, context.ContextUser);
|
|
43
|
+
const action = actions_1.ActionEngineServer.Instance.Actions.find(a => a.ID === config.ActionID);
|
|
44
|
+
if (!action) {
|
|
45
|
+
throw new Error(`Action with ID ${config.ActionID} not found`);
|
|
46
|
+
}
|
|
47
|
+
this.log(`Executing action: ${action.Name}`);
|
|
48
|
+
// Process parameters (static values or SQL queries)
|
|
49
|
+
const params = await this.processParams(config.Params || [], context.ContextUser);
|
|
50
|
+
// Execute the action
|
|
51
|
+
const actionResult = await actions_1.ActionEngineServer.Instance.RunAction({
|
|
52
|
+
Action: action,
|
|
53
|
+
ContextUser: context.ContextUser,
|
|
54
|
+
Filters: [],
|
|
55
|
+
Params: params
|
|
56
|
+
});
|
|
57
|
+
return {
|
|
58
|
+
Success: actionResult.Success,
|
|
59
|
+
ErrorMessage: actionResult.Message || undefined,
|
|
60
|
+
Details: {
|
|
61
|
+
ResultCode: actionResult.Result?.ResultCode,
|
|
62
|
+
IsSuccess: actionResult.Success,
|
|
63
|
+
OutputParams: actionResult.Params
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
ValidateConfiguration(schedule) {
|
|
68
|
+
const result = new core_1.ValidationResult();
|
|
69
|
+
try {
|
|
70
|
+
const config = this.parseConfiguration(schedule);
|
|
71
|
+
if (!config.ActionID) {
|
|
72
|
+
result.Errors.push(new core_1.ValidationErrorInfo('Configuration.ActionID', 'ActionID is required', config.ActionID, core_1.ValidationErrorType.Failure));
|
|
73
|
+
}
|
|
74
|
+
// Validate params structure
|
|
75
|
+
if (config.Params) {
|
|
76
|
+
if (!Array.isArray(config.Params)) {
|
|
77
|
+
result.Errors.push(new core_1.ValidationErrorInfo('Configuration.Params', 'Params must be an array', config.Params, core_1.ValidationErrorType.Failure));
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
for (let i = 0; i < config.Params.length; i++) {
|
|
81
|
+
const param = config.Params[i];
|
|
82
|
+
if (!param.ActionParamID) {
|
|
83
|
+
result.Errors.push(new core_1.ValidationErrorInfo(`Configuration.Params[${i}].ActionParamID`, 'ActionParamID is required', param.ActionParamID, core_1.ValidationErrorType.Failure));
|
|
84
|
+
}
|
|
85
|
+
if (!param.ValueType || !['Static', 'SQL Statement'].includes(param.ValueType)) {
|
|
86
|
+
result.Errors.push(new core_1.ValidationErrorInfo(`Configuration.Params[${i}].ValueType`, 'ValueType must be "Static" or "SQL Statement"', param.ValueType, core_1.ValidationErrorType.Failure));
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
catch (error) {
|
|
93
|
+
const errorMessage = error instanceof Error ? error.message : 'Invalid configuration';
|
|
94
|
+
result.Errors.push(new core_1.ValidationErrorInfo('Configuration', errorMessage, schedule.Configuration, core_1.ValidationErrorType.Failure));
|
|
95
|
+
}
|
|
96
|
+
result.Success = result.Errors.length === 0;
|
|
97
|
+
return result;
|
|
98
|
+
}
|
|
99
|
+
FormatNotification(context, result) {
|
|
100
|
+
const details = result.Details;
|
|
101
|
+
const subject = result.Success
|
|
102
|
+
? `Scheduled Action Completed: ${context.Schedule.Name}`
|
|
103
|
+
: `Scheduled Action Failed: ${context.Schedule.Name}`;
|
|
104
|
+
const body = result.Success
|
|
105
|
+
? `The scheduled action "${context.Schedule.Name}" completed successfully.\n\n` +
|
|
106
|
+
`Result Code: ${details?.ResultCode || 'N/A'}`
|
|
107
|
+
: `The scheduled action "${context.Schedule.Name}" failed.\n\n` +
|
|
108
|
+
`Error: ${result.ErrorMessage}`;
|
|
109
|
+
return {
|
|
110
|
+
Subject: subject,
|
|
111
|
+
Body: body,
|
|
112
|
+
Priority: result.Success ? 'Normal' : 'High',
|
|
113
|
+
Metadata: {
|
|
114
|
+
ScheduleID: context.Schedule.ID,
|
|
115
|
+
JobType: 'Action',
|
|
116
|
+
ResultCode: details?.ResultCode
|
|
117
|
+
}
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
async processParams(params, contextUser) {
|
|
121
|
+
if (!params) {
|
|
122
|
+
return [];
|
|
123
|
+
}
|
|
124
|
+
const allActionParams = actions_1.ActionEngineServer.Instance.ActionParams;
|
|
125
|
+
const result = [];
|
|
126
|
+
for (const param of params) {
|
|
127
|
+
const actionParam = allActionParams.find(p => p.ID === param.ActionParamID);
|
|
128
|
+
if (!actionParam) {
|
|
129
|
+
this.logError(`Action param ${param.ActionParamID} not found`);
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
let value = null;
|
|
133
|
+
switch (param.ValueType) {
|
|
134
|
+
case 'Static':
|
|
135
|
+
// Value could be scalar or JSON
|
|
136
|
+
const jsonValue = (0, global_1.SafeJSONParse)(param.Value);
|
|
137
|
+
value = jsonValue !== null ? jsonValue : param.Value;
|
|
138
|
+
break;
|
|
139
|
+
case 'SQL Statement':
|
|
140
|
+
value = await this.executeSQL(param.Value);
|
|
141
|
+
break;
|
|
142
|
+
}
|
|
143
|
+
result.push({
|
|
144
|
+
Name: actionParam.Name,
|
|
145
|
+
Value: value,
|
|
146
|
+
Type: actionParam.Type
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
return result;
|
|
150
|
+
}
|
|
151
|
+
async executeSQL(sql) {
|
|
152
|
+
try {
|
|
153
|
+
const sqlProvider = core_1.Metadata.Provider;
|
|
154
|
+
const result = await sqlProvider.ExecuteSQL(sql);
|
|
155
|
+
return result;
|
|
156
|
+
}
|
|
157
|
+
catch (error) {
|
|
158
|
+
this.logError(`Error executing SQL: ${sql}`, error);
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
exports.ActionScheduledJobDriver = ActionScheduledJobDriver;
|
|
164
|
+
exports.ActionScheduledJobDriver = ActionScheduledJobDriver = __decorate([
|
|
165
|
+
(0, global_1.RegisterClass)(BaseScheduledJob_1.BaseScheduledJob, 'ActionScheduledJobDriver')
|
|
166
|
+
], ActionScheduledJobDriver);
|
|
167
|
+
/**
|
|
168
|
+
* Loader function to ensure this driver is registered
|
|
169
|
+
* Prevents tree-shaking from removing the class
|
|
170
|
+
*/
|
|
171
|
+
function LoadActionScheduledJobDriver() {
|
|
172
|
+
// No-op function, just ensures class is loaded
|
|
173
|
+
}
|
|
174
|
+
exports.LoadActionScheduledJobDriver = LoadActionScheduledJobDriver;
|
|
175
|
+
//# sourceMappingURL=ActionScheduledJobDriver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActionScheduledJobDriver.js","sourceRoot":"","sources":["../../src/drivers/ActionScheduledJobDriver.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;AAEH,mDAAsE;AACtE,0DAAqF;AACrF,+CAAsH;AACtH,qDAA6D;AAS7D;;;;;;;;;;;;;;;;;;;GAmBG;AAEI,IAAM,wBAAwB,GAA9B,MAAM,wBAAyB,SAAQ,mCAAgB;IACnD,KAAK,CAAC,OAAO,CAAC,OAAqC;QACtD,MAAM,MAAM,GAAG,IAAI,CAAC,kBAAkB,CAAyB,OAAO,CAAC,QAAQ,CAAC,CAAC;QAEjF,kBAAkB;QAClB,MAAM,4BAAkB,CAAC,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;QACrE,MAAM,MAAM,GAAG,4BAAkB,CAAC,QAAQ,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,KAAK,MAAM,CAAC,QAAQ,CAAC,CAAC;QAEvF,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,MAAM,IAAI,KAAK,CAAC,kBAAkB,MAAM,CAAC,QAAQ,YAAY,CAAC,CAAC;QACnE,CAAC;QAED,IAAI,CAAC,GAAG,CAAC,qBAAqB,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;QAE7C,oDAAoD;QACpD,MAAM,MAAM,GA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AE,0BAA0B,CAAC;GAC/C,wBAAwB,CAiLpC;AAED;;;GAGG;AACH,SAAgB,4BAA4B;IACxC,+CAA+C;AACnD,CAAC;AAFD,oEAEC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Driver for executing scheduled AI Agent jobs
|
|
3
|
+
* @module @memberjunction/scheduling-engine
|
|
4
|
+
*/
|
|
5
|
+
import { BaseScheduledJob, ScheduledJobExecutionContext } from '../BaseScheduledJob';
|
|
6
|
+
import { ValidationResult } from '@memberjunction/core';
|
|
7
|
+
import { ScheduledJobResult, NotificationContent } from '@memberjunction/scheduling-base-types';
|
|
8
|
+
/**
|
|
9
|
+
* Driver for executing scheduled AI Agent jobs
|
|
10
|
+
*
|
|
11
|
+
* Configuration schema (stored in ScheduledJob.Configuration):
|
|
12
|
+
* {
|
|
13
|
+
* AgentID: string,
|
|
14
|
+
* ConversationID?: string,
|
|
15
|
+
* StartingPayload?: any,
|
|
16
|
+
* InitialMessage?: string,
|
|
17
|
+
* ConfigurationID?: string,
|
|
18
|
+
* OverrideModelID?: string
|
|
19
|
+
* }
|
|
20
|
+
*
|
|
21
|
+
* Execution result details (stored in ScheduledJobRun.Details):
|
|
22
|
+
* {
|
|
23
|
+
* AgentRunID: string,
|
|
24
|
+
* TokensUsed: number,
|
|
25
|
+
* Cost: number,
|
|
26
|
+
* ConversationID?: string
|
|
27
|
+
* }
|
|
28
|
+
*/
|
|
29
|
+
export declare class AgentScheduledJobDriver extends BaseScheduledJob {
|
|
30
|
+
Execute(context: ScheduledJobExecutionContext): Promise<ScheduledJobResult>;
|
|
31
|
+
ValidateConfiguration(schedule: any): ValidationResult;
|
|
32
|
+
FormatNotification(context: ScheduledJobExecutionContext, result: ScheduledJobResult): NotificationContent;
|
|
33
|
+
private loadAgent;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Loader function to ensure this driver is registered
|
|
37
|
+
* Prevents tree-shaking from removing the class
|
|
38
|
+
*/
|
|
39
|
+
export declare function LoadAgentScheduledJobDriver(): void;
|
|
40
|
+
//# sourceMappingURL=AgentScheduledJobDriver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentScheduledJobDriver.d.ts","sourceRoot":"","sources":["../../src/drivers/AgentScheduledJobDriver.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,gBAAgB,EAAE,4BAA4B,EAAE,MAAM,qBAAqB,CAAC;AACrF,OAAO,EAAE,gBAAgB,EAAgE,MAAM,sBAAsB,CAAC;AAGtH,OAAO,EACH,kBAAkB,EAClB,mBAAmB,EAEtB,MAAM,uCAAuC,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,qBACa,uBAAwB,SAAQ,gBAAgB;IAC5C,OAAO,CAAC,OAAO,EAAE,4BAA4B,GAAG,OAAO,CAAC,kBAAkB,CAAC;IA4CjF,qBAAqB,CAAC,QAAQ,EAAE,GAAG,GAAG,gBAAgB;IA4CtD,kBAAkB,CACrB,OAAO,EAAE,4BAA4B,EACrC,MAAM,EAAE,kBAAkB,GAC3B,mBAAmB;YA8BR,SAAS;CAW1B;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,IAAI,IAAI,CAElD"}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Driver for executing scheduled AI Agent jobs
|
|
4
|
+
* @module @memberjunction/scheduling-engine
|
|
5
|
+
*/
|
|
6
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
7
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
9
|
+
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;
|
|
10
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
11
|
+
};
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.LoadAgentScheduledJobDriver = exports.AgentScheduledJobDriver = void 0;
|
|
14
|
+
const global_1 = require("@memberjunction/global");
|
|
15
|
+
const BaseScheduledJob_1 = require("../BaseScheduledJob");
|
|
16
|
+
const core_1 = require("@memberjunction/core");
|
|
17
|
+
const ai_agents_1 = require("@memberjunction/ai-agents");
|
|
18
|
+
/**
|
|
19
|
+
* Driver for executing scheduled AI Agent jobs
|
|
20
|
+
*
|
|
21
|
+
* Configuration schema (stored in ScheduledJob.Configuration):
|
|
22
|
+
* {
|
|
23
|
+
* AgentID: string,
|
|
24
|
+
* ConversationID?: string,
|
|
25
|
+
* StartingPayload?: any,
|
|
26
|
+
* InitialMessage?: string,
|
|
27
|
+
* ConfigurationID?: string,
|
|
28
|
+
* OverrideModelID?: string
|
|
29
|
+
* }
|
|
30
|
+
*
|
|
31
|
+
* Execution result details (stored in ScheduledJobRun.Details):
|
|
32
|
+
* {
|
|
33
|
+
* AgentRunID: string,
|
|
34
|
+
* TokensUsed: number,
|
|
35
|
+
* Cost: number,
|
|
36
|
+
* ConversationID?: string
|
|
37
|
+
* }
|
|
38
|
+
*/
|
|
39
|
+
let AgentScheduledJobDriver = class AgentScheduledJobDriver extends BaseScheduledJob_1.BaseScheduledJob {
|
|
40
|
+
async Execute(context) {
|
|
41
|
+
// Parse agent-specific configuration
|
|
42
|
+
const config = this.parseConfiguration(context.Schedule);
|
|
43
|
+
// Load the agent entity
|
|
44
|
+
const agent = await this.loadAgent(config.AgentID, context.ContextUser);
|
|
45
|
+
this.log(`Executing agent: ${agent.Name}`);
|
|
46
|
+
// Execute the agent
|
|
47
|
+
const runner = new ai_agents_1.AgentRunner();
|
|
48
|
+
// Build conversation messages - if initial message provided, add it as user message
|
|
49
|
+
const conversationMessages = config.InitialMessage
|
|
50
|
+
? [{ role: 'user', content: config.InitialMessage }]
|
|
51
|
+
: [];
|
|
52
|
+
const result = await runner.RunAgent({
|
|
53
|
+
agent: agent,
|
|
54
|
+
conversationMessages: conversationMessages,
|
|
55
|
+
payload: config.StartingPayload,
|
|
56
|
+
contextUser: context.ContextUser
|
|
57
|
+
});
|
|
58
|
+
// Link agent run back to scheduled job run
|
|
59
|
+
if (result.agentRun.ID && context.Run.ID) {
|
|
60
|
+
result.agentRun.ScheduledJobRunID = context.Run.ID;
|
|
61
|
+
await result.agentRun.Save();
|
|
62
|
+
}
|
|
63
|
+
// Build result with agent-specific details
|
|
64
|
+
return {
|
|
65
|
+
Success: result.success,
|
|
66
|
+
ErrorMessage: result.agentRun.ErrorMessage || undefined,
|
|
67
|
+
Details: {
|
|
68
|
+
AgentRunID: result.agentRun.ID,
|
|
69
|
+
TokensUsed: result.agentRun.TotalTokensUsed,
|
|
70
|
+
Cost: result.agentRun.TotalCost,
|
|
71
|
+
ConversationID: result.agentRun.ConversationID,
|
|
72
|
+
Status: result.agentRun.Status
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
ValidateConfiguration(schedule) {
|
|
77
|
+
const result = new core_1.ValidationResult();
|
|
78
|
+
try {
|
|
79
|
+
const config = this.parseConfiguration(schedule);
|
|
80
|
+
// Validate required fields
|
|
81
|
+
if (!config.AgentID) {
|
|
82
|
+
result.Errors.push(new core_1.ValidationErrorInfo('Configuration.AgentID', 'AgentID is required', config.AgentID, core_1.ValidationErrorType.Failure));
|
|
83
|
+
}
|
|
84
|
+
// Validate StartingPayload is valid JSON if provided
|
|
85
|
+
if (config.StartingPayload) {
|
|
86
|
+
try {
|
|
87
|
+
JSON.stringify(config.StartingPayload);
|
|
88
|
+
}
|
|
89
|
+
catch {
|
|
90
|
+
result.Errors.push(new core_1.ValidationErrorInfo('Configuration.StartingPayload', 'StartingPayload must be valid JSON', config.StartingPayload, core_1.ValidationErrorType.Failure));
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
const errorMessage = error instanceof Error ? error.message : 'Invalid configuration';
|
|
96
|
+
result.Errors.push(new core_1.ValidationErrorInfo('Configuration', errorMessage, schedule.Configuration, core_1.ValidationErrorType.Failure));
|
|
97
|
+
}
|
|
98
|
+
result.Success = result.Errors.length === 0;
|
|
99
|
+
return result;
|
|
100
|
+
}
|
|
101
|
+
FormatNotification(context, result) {
|
|
102
|
+
const config = this.parseConfiguration(context.Schedule);
|
|
103
|
+
const details = result.Details;
|
|
104
|
+
const subject = result.Success
|
|
105
|
+
? `Scheduled Agent Completed: ${context.Schedule.Name}`
|
|
106
|
+
: `Scheduled Agent Failed: ${context.Schedule.Name}`;
|
|
107
|
+
const body = result.Success
|
|
108
|
+
? `The scheduled agent "${context.Schedule.Name}" completed successfully.\n\n` +
|
|
109
|
+
`Tokens Used: ${details?.TokensUsed || 'N/A'}\n` +
|
|
110
|
+
`Cost: $${details?.Cost?.toFixed(6) || 'N/A'}\n` +
|
|
111
|
+
`Agent Run ID: ${details?.AgentRunID}`
|
|
112
|
+
: `The scheduled agent "${context.Schedule.Name}" failed.\n\n` +
|
|
113
|
+
`Error: ${result.ErrorMessage}\n` +
|
|
114
|
+
`Agent Run ID: ${details?.AgentRunID || 'N/A'}`;
|
|
115
|
+
return {
|
|
116
|
+
Subject: subject,
|
|
117
|
+
Body: body,
|
|
118
|
+
Priority: result.Success ? 'Normal' : 'High',
|
|
119
|
+
Metadata: {
|
|
120
|
+
ScheduleID: context.Schedule.ID,
|
|
121
|
+
JobType: 'Agent',
|
|
122
|
+
AgentID: config.AgentID,
|
|
123
|
+
AgentRunID: details?.AgentRunID
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
async loadAgent(agentId, contextUser) {
|
|
128
|
+
const md = new core_1.Metadata();
|
|
129
|
+
const agent = await md.GetEntityObject('AI Agents', contextUser);
|
|
130
|
+
const loaded = await agent.Load(agentId);
|
|
131
|
+
if (!loaded) {
|
|
132
|
+
throw new Error(`Agent with ID ${agentId} not found`);
|
|
133
|
+
}
|
|
134
|
+
return agent;
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
exports.AgentScheduledJobDriver = AgentScheduledJobDriver;
|
|
138
|
+
exports.AgentScheduledJobDriver = AgentScheduledJobDriver = __decorate([
|
|
139
|
+
(0, global_1.RegisterClass)(BaseScheduledJob_1.BaseScheduledJob, 'AgentScheduledJobDriver')
|
|
140
|
+
], AgentScheduledJobDriver);
|
|
141
|
+
/**
|
|
142
|
+
* Loader function to ensure this driver is registered
|
|
143
|
+
* Prevents tree-shaking from removing the class
|
|
144
|
+
*/
|
|
145
|
+
function LoadAgentScheduledJobDriver() {
|
|
146
|
+
// No-op function, just ensures class is loaded
|
|
147
|
+
}
|
|
148
|
+
exports.LoadAgentScheduledJobDriver = LoadAgentScheduledJobDriver;
|
|
149
|
+
//# sourceMappingURL=AgentScheduledJobDriver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AgentScheduledJobDriver.js","sourceRoot":"","sources":["../../src/drivers/AgentScheduledJobDriver.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;AAEH,mDAAuD;AACvD,0DAAqF;AACrF,+CAAsH;AAEtH,yDAAwD;AAOxD;;;;;;;;;;;;;;;;;;;;GAoBG;AAEI,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,mCAAgB;IAClD,KAAK,CAAC,OAAO,CAAC,OAAqC;QACtD,qCAAqC;QACrC,MAAM,MAAM,GAAG,IAAI,CAAC,kBAAkB,CAAwB,OAAO,CAAC,QAAQ,CAAC,CAAC;QAEhF,wBAAwB;QACxB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;QAExE,IAAI,CAAC,GAAG,CAAC,oBAAoB,KA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AAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAEzC,IAAI,CAAC,MAAM,EAAE,CAAC;YACV,MAAM,IAAI,KAAK,CAAC,iBAAiB,OAAO,YAAY,CAAC,CAAC;QAC1D,CAAC;QAED,OAAO,KAAK,CAAC;IACjB,CAAC;CACJ,CAAA;AArIY,0DAAuB;kCAAvB,uBAAuB;IADnC,IAAA,sBAAa,EAAC,mCAAgB,EAAE,yBAAyB,CAAC;GAC9C,uBAAuB,CAqInC;AAED;;;GAGG;AACH,SAAgB,2BAA2B;IACvC,+CAA+C;AACnD,CAAC;AAFD,kEAEC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Export all scheduled job drivers
|
|
3
|
+
* @module @memberjunction/scheduling-engine
|
|
4
|
+
*/
|
|
5
|
+
export * from './AgentScheduledJobDriver';
|
|
6
|
+
export * from './ActionScheduledJobDriver';
|
|
7
|
+
/**
|
|
8
|
+
* Loader function to ensure all drivers are registered
|
|
9
|
+
* Call this at application startup to prevent tree-shaking
|
|
10
|
+
*/
|
|
11
|
+
export declare function LoadScheduledJobDrivers(): void;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/drivers/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC;AAE3C;;;GAGG;AACH,wBAAgB,uBAAuB,IAAI,IAAI,CAG9C"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Export all scheduled job drivers
|
|
4
|
+
* @module @memberjunction/scheduling-engine
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
18
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.LoadScheduledJobDrivers = void 0;
|
|
22
|
+
const AgentScheduledJobDriver_1 = require("./AgentScheduledJobDriver");
|
|
23
|
+
const ActionScheduledJobDriver_1 = require("./ActionScheduledJobDriver");
|
|
24
|
+
__exportStar(require("./AgentScheduledJobDriver"), exports);
|
|
25
|
+
__exportStar(require("./ActionScheduledJobDriver"), exports);
|
|
26
|
+
/**
|
|
27
|
+
* Loader function to ensure all drivers are registered
|
|
28
|
+
* Call this at application startup to prevent tree-shaking
|
|
29
|
+
*/
|
|
30
|
+
function LoadScheduledJobDrivers() {
|
|
31
|
+
(0, AgentScheduledJobDriver_1.LoadAgentScheduledJobDriver)();
|
|
32
|
+
(0, ActionScheduledJobDriver_1.LoadActionScheduledJobDriver)();
|
|
33
|
+
}
|
|
34
|
+
exports.LoadScheduledJobDrivers = LoadScheduledJobDrivers;
|
|
35
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/drivers/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;AAEH,uEAAwE;AACxE,yEAA0E;AAE1E,4DAA0C;AAC1C,6DAA2C;AAE3C;;;GAGG;AACH,SAAgB,uBAAuB;IACnC,IAAA,qDAA2B,GAAE,CAAC;IAC9B,IAAA,uDAA4B,GAAE,CAAC;AACnC,CAAC;AAHD,0DAGC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Main export for Scheduling Engine
|
|
3
|
+
* @module @memberjunction/scheduling-engine
|
|
4
|
+
*/
|
|
5
|
+
export * from './BaseScheduledJob';
|
|
6
|
+
export * from './ScheduledJobEngine';
|
|
7
|
+
export * from './CronExpressionHelper';
|
|
8
|
+
export * from './NotificationManager';
|
|
9
|
+
export * from './drivers';
|
|
10
|
+
/**
|
|
11
|
+
* Loader function to ensure all drivers and extended entities are registered
|
|
12
|
+
* Call this at application startup
|
|
13
|
+
*/
|
|
14
|
+
export declare function LoadSchedulingEngine(): void;
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,wBAAwB,CAAC;AACvC,cAAc,uBAAuB,CAAC;AACtC,cAAc,WAAW,CAAC;AAE1B;;;GAGG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAG3C"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @fileoverview Main export for Scheduling Engine
|
|
4
|
+
* @module @memberjunction/scheduling-engine
|
|
5
|
+
*/
|
|
6
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
|
+
if (k2 === undefined) k2 = k;
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
13
|
+
}) : (function(o, m, k, k2) {
|
|
14
|
+
if (k2 === undefined) k2 = k;
|
|
15
|
+
o[k2] = m[k];
|
|
16
|
+
}));
|
|
17
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
18
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
19
|
+
};
|
|
20
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
21
|
+
exports.LoadSchedulingEngine = void 0;
|
|
22
|
+
const drivers_1 = require("./drivers");
|
|
23
|
+
const scheduling_engine_base_1 = require("@memberjunction/scheduling-engine-base");
|
|
24
|
+
__exportStar(require("./BaseScheduledJob"), exports);
|
|
25
|
+
__exportStar(require("./ScheduledJobEngine"), exports);
|
|
26
|
+
__exportStar(require("./CronExpressionHelper"), exports);
|
|
27
|
+
__exportStar(require("./NotificationManager"), exports);
|
|
28
|
+
__exportStar(require("./drivers"), exports);
|
|
29
|
+
/**
|
|
30
|
+
* Loader function to ensure all drivers and extended entities are registered
|
|
31
|
+
* Call this at application startup
|
|
32
|
+
*/
|
|
33
|
+
function LoadSchedulingEngine() {
|
|
34
|
+
(0, scheduling_engine_base_1.LoadBaseSchedulingEngine)();
|
|
35
|
+
(0, drivers_1.LoadScheduledJobDrivers)();
|
|
36
|
+
}
|
|
37
|
+
exports.LoadSchedulingEngine = LoadSchedulingEngine;
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;AAEH,uCAAoD;AACpD,mFAAkF;AAElF,qDAAmC;AACnC,uDAAqC;AACrC,yDAAuC;AACvC,wDAAsC;AACtC,4CAA0B;AAE1B;;;GAGG;AACH,SAAgB,oBAAoB;IAChC,IAAA,iDAAwB,GAAE,CAAC;IAC3B,IAAA,iCAAuB,GAAE,CAAC;AAC9B,CAAC;AAHD,oDAGC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@memberjunction/scheduling-engine",
|
|
3
|
+
"version": "2.107.0",
|
|
4
|
+
"description": "MemberJunction: Scheduling Engine - core engine for executing scheduled jobs with plugin architecture",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"/dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsc",
|
|
12
|
+
"watch": "tsc --watch"
|
|
13
|
+
},
|
|
14
|
+
"author": "MemberJunction.com",
|
|
15
|
+
"license": "ISC",
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"@memberjunction/core": "2.100.3",
|
|
18
|
+
"@memberjunction/core-entities": "2.107.0",
|
|
19
|
+
"@memberjunction/global": "2.100.3",
|
|
20
|
+
"@memberjunction/scheduling-base-types": "2.107.0",
|
|
21
|
+
"@memberjunction/scheduling-engine-base": "2.107.0",
|
|
22
|
+
"@memberjunction/ai-agents": "2.107.0",
|
|
23
|
+
"@memberjunction/actions": "2.107.0",
|
|
24
|
+
"@memberjunction/sqlserver-dataprovider": "2.107.0",
|
|
25
|
+
"cron-parser": "^4.9.0"
|
|
26
|
+
},
|
|
27
|
+
"devDependencies": {
|
|
28
|
+
"@types/node": "20.14.2",
|
|
29
|
+
"typescript": "^5.4.5"
|
|
30
|
+
}
|
|
31
|
+
}
|