@memberjunction/queue 0.9.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,8 @@
1
+ import { QueueBase, TaskBase, TaskResult } from "../generic/QueueBase";
2
+ export declare class AIActionQueue extends QueueBase {
3
+ protected ProcessTask(task: TaskBase): Promise<TaskResult>;
4
+ protected ProcessGeneric(task: TaskBase, entityAIAction: boolean): Promise<TaskResult>;
5
+ }
6
+ export declare class EntityAIActionQueue extends AIActionQueue {
7
+ protected ProcessTask(task: TaskBase): Promise<TaskResult>;
8
+ }
@@ -0,0 +1,56 @@
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.EntityAIActionQueue = exports.AIActionQueue = void 0;
10
+ const QueueBase_1 = require("../generic/QueueBase");
11
+ const global_1 = require("@memberjunction/global");
12
+ const ai_1 = require("@memberjunction/ai");
13
+ let AIActionQueue = class AIActionQueue extends QueueBase_1.QueueBase {
14
+ async ProcessTask(task) {
15
+ return this.ProcessGeneric(task, false);
16
+ }
17
+ async ProcessGeneric(task, entityAIAction) {
18
+ try {
19
+ await ai_1.AIEngine.LoadAIMetadata(this._contextUser);
20
+ const ai = new ai_1.AIEngine();
21
+ let result = null;
22
+ if (entityAIAction)
23
+ result = await ai.ExecuteEntityAIAction(task.Data);
24
+ else
25
+ result = await ai.ExecuteAIAction(task.Data);
26
+ return {
27
+ success: result ? result.success : false,
28
+ output: result ? (result.success ? null : result.errorMessage) : null,
29
+ userMessage: result ? result.errorMessage : null,
30
+ exception: null
31
+ };
32
+ }
33
+ catch (e) {
34
+ return {
35
+ success: false,
36
+ output: null,
37
+ userMessage: 'Execution Error: ' + e.message,
38
+ exception: e
39
+ };
40
+ }
41
+ }
42
+ };
43
+ AIActionQueue = __decorate([
44
+ (0, global_1.RegisterClass)(QueueBase_1.QueueBase, 'AI Action', 1)
45
+ ], AIActionQueue);
46
+ exports.AIActionQueue = AIActionQueue;
47
+ let EntityAIActionQueue = class EntityAIActionQueue extends AIActionQueue {
48
+ async ProcessTask(task) {
49
+ return this.ProcessGeneric(task, true);
50
+ }
51
+ };
52
+ EntityAIActionQueue = __decorate([
53
+ (0, global_1.RegisterClass)(QueueBase_1.QueueBase, 'Entity AI Action', 1)
54
+ ], EntityAIActionQueue);
55
+ exports.EntityAIActionQueue = EntityAIActionQueue;
56
+ //# sourceMappingURL=AIActionQueue.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"AIActionQueue.js","sourceRoot":"","sources":["../../src/drivers/AIActionQueue.ts"],"names":[],"mappings":";;;;;;;;;AAAA,oDAAuE;AACvE,mDAAsD;AACtD,2CAA8C;AAG9C,IAAa,aAAa,GAA1B,MAAa,aAAc,SAAQ,qBAAS;IAC9B,KAAK,CAAC,WAAW,CAAC,IAAc;QACtC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;IAC3C,CAAC;IAES,KAAK,CAAC,cAAc,CAAC,IAAc,EAAE,cAAuB;QAClE,IAAI;YACA,MAAM,aAAQ,CAAC,cAAc,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;YACjD,MAAM,EAAE,GAAG,IAAI,aAAQ,EAAE,CAAC;YAC1B,IAAI,MAAM,GAAQ,IAAI,CAAC;YAEvB,IAAI,cAAc;gBACd,MAAM,GAAG,MAAM,EAAE,CAAC,qBAAqB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;;gBAEnD,MAAM,GAAG,MAAM,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;YAEjD,OAAO;gBACH,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK;gBACxC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,CAAC,IAAI;gBACrE,WAAW,EAAE,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI;gBAChD,SAAS,EAAE,IAAI;aAClB,CAAA;SACJ;QACD,OAAO,CAAC,EAAE;YACN,OAAO;gBACH,OAAO,EAAE,KAAK;gBACd,MAAM,EAAE,IAAI;gBACZ,WAAW,EAAE,mBAAmB,GAAG,CAAC,CAAC,OAAO;gBAC5C,SAAS,EAAE,CAAC;aACf,CAAA;SACJ;IACL,CAAC;CACJ,CAAA;AAhCY,aAAa;IADzB,IAAA,sBAAa,EAAC,qBAAS,EAAE,WAAW,EAAE,CAAC,CAAC;GAC5B,aAAa,CAgCzB;AAhCY,sCAAa;AAmC1B,IAAa,mBAAmB,GAAhC,MAAa,mBAAoB,SAAQ,aAAa;IACxC,KAAK,CAAC,WAAW,CAAC,IAAc;QACtC,OAAO,IAAI,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC,CAAA;IAC1C,CAAC;CACJ,CAAA;AAJY,mBAAmB;IAD/B,IAAA,sBAAa,EAAC,qBAAS,EAAE,kBAAkB,EAAE,CAAC,CAAC;GACnC,mBAAmB,CAI/B;AAJY,kDAAmB"}
@@ -0,0 +1,47 @@
1
+ import { UserInfo, BaseEntity } from '@memberjunction/core';
2
+ export declare class TaskResult {
3
+ success: boolean;
4
+ userMessage: string;
5
+ output: any;
6
+ exception: any;
7
+ }
8
+ export interface TaskOptions {
9
+ priority?: number;
10
+ }
11
+ export declare enum TaskStatus {
12
+ Pending = 1,
13
+ InProgress = 2,
14
+ Complete = 3,
15
+ Failed = 4,
16
+ Cancelled = 5
17
+ }
18
+ export declare class TaskBase {
19
+ private _options;
20
+ private _data;
21
+ private _taskRecord;
22
+ private _status;
23
+ get Options(): TaskOptions;
24
+ get Data(): any;
25
+ get ID(): number;
26
+ constructor(taskRecord: BaseEntity, data: any, options: TaskOptions);
27
+ get TaskRecord(): BaseEntity;
28
+ get Status(): TaskStatus;
29
+ set Status(value: TaskStatus);
30
+ }
31
+ export declare abstract class QueueBase {
32
+ private _queue;
33
+ private _queueTypeId;
34
+ protected _contextUser: UserInfo;
35
+ private _maxTasks;
36
+ private _checkInterval;
37
+ private _queueRecord;
38
+ constructor(QueueRecord: BaseEntity, QueueTypeID: number, ContextUser: UserInfo);
39
+ get QueueID(): number;
40
+ get QueueTypeID(): number;
41
+ private _processing;
42
+ protected ProcessTasks(): void;
43
+ AddTask(task: TaskBase): boolean;
44
+ protected abstract ProcessTask(task: TaskBase, contextUser: UserInfo): Promise<TaskResult>;
45
+ protected StartTask(task: TaskBase, contextUser: UserInfo): Promise<TaskResult>;
46
+ FindTask(ID: number): TaskBase;
47
+ }
@@ -0,0 +1,129 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.QueueBase = exports.TaskBase = exports.TaskStatus = exports.TaskResult = void 0;
4
+ //import { QueueTaskEntity, QueueEntity } from 'mj_generatedentities';
5
+ class TaskResult {
6
+ }
7
+ exports.TaskResult = TaskResult;
8
+ var TaskStatus;
9
+ (function (TaskStatus) {
10
+ TaskStatus[TaskStatus["Pending"] = 1] = "Pending";
11
+ TaskStatus[TaskStatus["InProgress"] = 2] = "InProgress";
12
+ TaskStatus[TaskStatus["Complete"] = 3] = "Complete";
13
+ TaskStatus[TaskStatus["Failed"] = 4] = "Failed";
14
+ TaskStatus[TaskStatus["Cancelled"] = 5] = "Cancelled";
15
+ })(TaskStatus = exports.TaskStatus || (exports.TaskStatus = {}));
16
+ class TaskBase {
17
+ get Options() {
18
+ return this._options;
19
+ }
20
+ get Data() {
21
+ return this._data;
22
+ }
23
+ get ID() {
24
+ return this._taskRecord.ID;
25
+ }
26
+ constructor(taskRecord, data, options) {
27
+ this._status = TaskStatus.Pending;
28
+ this._taskRecord = taskRecord;
29
+ this._options = options;
30
+ this._data = data;
31
+ }
32
+ get TaskRecord() {
33
+ return this._taskRecord;
34
+ }
35
+ get Status() {
36
+ return this._status;
37
+ }
38
+ set Status(value) {
39
+ this._status = value;
40
+ }
41
+ }
42
+ exports.TaskBase = TaskBase;
43
+ class QueueBase {
44
+ constructor(QueueRecord, QueueTypeID, ContextUser) {
45
+ this._queue = [];
46
+ this._maxTasks = 3; // move to metadata or config param
47
+ this._checkInterval = 250; // move to metadata or config param
48
+ this._processing = false;
49
+ this._queueRecord = QueueRecord;
50
+ this._queueTypeId = QueueTypeID;
51
+ this._contextUser = ContextUser;
52
+ }
53
+ get QueueID() {
54
+ return this._queueRecord.ID;
55
+ }
56
+ get QueueTypeID() {
57
+ return this._queueTypeId;
58
+ }
59
+ ProcessTasks() {
60
+ if (!this._processing) {
61
+ try {
62
+ this._processing = true;
63
+ // this method will be called upon instantiation of the queue and will check for pending tasks
64
+ // it will re-run itself with a timer to check for new tasks
65
+ // this will be the main loop for the queue
66
+ if (this._queue.length > 0) {
67
+ let processing = this._queue.filter(t => t.Status === TaskStatus.InProgress);
68
+ let pending = this._queue.filter(t => t.Status === TaskStatus.Pending);
69
+ // we have room to process one or more additional tasks now
70
+ while (processing.length < this._maxTasks && pending.length > 0) {
71
+ let task = pending.shift();
72
+ this.StartTask(task, this._contextUser); // INTENTIONAL - do not await as we want to fire off all the tasks we can do, and then move on
73
+ }
74
+ }
75
+ }
76
+ catch (e) {
77
+ console.log(e);
78
+ }
79
+ finally {
80
+ this._processing = false;
81
+ setTimeout(() => {
82
+ this.ProcessTasks();
83
+ }, this._checkInterval); // setup the next check
84
+ }
85
+ }
86
+ }
87
+ AddTask(task) {
88
+ try {
89
+ // Add a task to the queue
90
+ this._queue.push(task);
91
+ // fire off the process tasks function immediately but don't wait for it to finish
92
+ this.ProcessTasks();
93
+ return true;
94
+ }
95
+ catch (e) {
96
+ return false;
97
+ }
98
+ }
99
+ async StartTask(task, contextUser) {
100
+ // the process function is responsible for calling the processor function
101
+ try {
102
+ task.Status = TaskStatus.InProgress; // immediately flag this task so it isn't picked up again...
103
+ // run the task
104
+ let result = await this.ProcessTask(task, contextUser);
105
+ // now set the record data for the DB
106
+ task.TaskRecord.Status = result.success ? "Complete" : "Failed";
107
+ task.TaskRecord.Output = result.output;
108
+ task.TaskRecord.ErrorMessage = result.exception ? JSON.stringify(result.exception) : null;
109
+ await task.TaskRecord.Save();
110
+ // update the task status
111
+ task.Status = result.success ? TaskStatus.Complete : TaskStatus.Failed;
112
+ return result;
113
+ }
114
+ catch (e) {
115
+ console.log(e);
116
+ return {
117
+ success: false,
118
+ output: null,
119
+ userMessage: 'Execution Error: ' + e.message,
120
+ exception: e
121
+ };
122
+ }
123
+ }
124
+ FindTask(ID) {
125
+ return this._queue.find(t => t.ID === ID);
126
+ }
127
+ }
128
+ exports.QueueBase = QueueBase;
129
+ //# sourceMappingURL=QueueBase.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueueBase.js","sourceRoot":"","sources":["../../src/generic/QueueBase.ts"],"names":[],"mappings":";;;AACA,sEAAsE;AAEtE,MAAa,UAAU;CAKtB;AALD,gCAKC;AAOD,IAAY,UAMX;AAND,WAAY,UAAU;IACpB,iDAAW,CAAA;IACX,uDAAc,CAAA;IACd,mDAAY,CAAA;IACZ,+CAAU,CAAA;IACV,qDAAa,CAAA;AACf,CAAC,EANW,UAAU,GAAV,kBAAU,KAAV,kBAAU,QAMrB;AAED,MAAa,QAAQ;IAMnB,IAAW,OAAO;QAEhB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACvB,CAAC;IACD,IAAW,IAAI;QAE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{ UserInfo, BaseEntity } from "@memberjunction/core";
3
+ /**
4
+ *QueueManager class is a generic manager of all active queues for the process.
5
+ *
6
+ *Whenever a new task is added, the queue manager will see if the TYPE of task already has a queue running
7
+ *or not. If that type of queue isn't running, it will start one up.
8
+ *
9
+ *Then, a new task is processed by logging into the database the new task and then it will be assigned
10
+ *to the queue that is responsible for processing that type of task.
11
+ *
12
+ *The queue manager is also responseible for updating all of its active Queues in the DB with heartbeat
13
+ *information. Heartbeat information is used to determine if a queue has crashed or not by other processes
14
+ *or not. After a heartbeat timeout is reached, other queues can pick up tasks from a crashed process.
15
+ */
16
+ export declare class QueueManager {
17
+ private _queueTypes;
18
+ private _queues;
19
+ private static _instance;
20
+ private static _globalInstanceKey;
21
+ static get QueueTypes(): BaseEntity[];
22
+ static get Instance(): QueueManager;
23
+ private configPromise;
24
+ Config(contextUser: UserInfo): Promise<void>;
25
+ static Config(contextUser: UserInfo): Promise<void>;
26
+ protected loadQueueTypes(contextUser: UserInfo): Promise<void>;
27
+ constructor();
28
+ static AddTask(QueueType: string, data: any, options: any, contextUser: UserInfo): Promise<TaskBase | undefined>;
29
+ AddTask(QueueTypeID: number, data: any, options: any, contextUser: UserInfo): Promise<TaskBase | undefined>;
30
+ private ongoingQueueCreations;
31
+ protected CheckCreateQueue(queueType: BaseEntity, contextUser: UserInfo): Promise<QueueBase | undefined>;
32
+ protected CreateQueue(queueType: BaseEntity, contextUser: UserInfo): Promise<QueueBase | null | undefined>;
33
+ protected get Queues(): QueueBase[];
34
+ }
@@ -0,0 +1,189 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.QueueManager = void 0;
7
+ //import { QueueEntity, QueueTaskEntity, QueueTypeEntity } from "mj_generatedentities";
8
+ const QueueBase_1 = require("./QueueBase");
9
+ const core_1 = require("@memberjunction/core");
10
+ const global_1 = require("@memberjunction/global");
11
+ const os_1 = __importDefault(require("os"));
12
+ /**
13
+ *QueueManager class is a generic manager of all active queues for the process.
14
+ *
15
+ *Whenever a new task is added, the queue manager will see if the TYPE of task already has a queue running
16
+ *or not. If that type of queue isn't running, it will start one up.
17
+ *
18
+ *Then, a new task is processed by logging into the database the new task and then it will be assigned
19
+ *to the queue that is responsible for processing that type of task.
20
+ *
21
+ *The queue manager is also responseible for updating all of its active Queues in the DB with heartbeat
22
+ *information. Heartbeat information is used to determine if a queue has crashed or not by other processes
23
+ *or not. After a heartbeat timeout is reached, other queues can pick up tasks from a crashed process.
24
+ */
25
+ class QueueManager {
26
+ static get QueueTypes() {
27
+ return QueueManager.Instance._queueTypes;
28
+ }
29
+ static get Instance() {
30
+ if (QueueManager._instance === null)
31
+ QueueManager._instance = new QueueManager();
32
+ return QueueManager._instance;
33
+ }
34
+ async Config(contextUser) {
35
+ if (this._queueTypes.length === 0) {
36
+ if (!this.configPromise) {
37
+ this.configPromise = this.loadQueueTypes(contextUser);
38
+ }
39
+ try {
40
+ await this.configPromise;
41
+ }
42
+ finally {
43
+ this.configPromise = null;
44
+ }
45
+ }
46
+ }
47
+ static async Config(contextUser) {
48
+ await QueueManager.Instance.Config(contextUser);
49
+ }
50
+ async loadQueueTypes(contextUser) {
51
+ // load all of the queue types from the database
52
+ const rv = new core_1.RunView();
53
+ const queueTypes = await rv.RunView({
54
+ EntityName: 'Queue Types',
55
+ }, contextUser);
56
+ QueueManager.Instance._queueTypes = queueTypes.Results;
57
+ }
58
+ constructor() {
59
+ this._queueTypes = [];
60
+ this._queues = [];
61
+ this.configPromise = null;
62
+ // Initialize a map to hold ongoing queue creation promises
63
+ this.ongoingQueueCreations = new Map();
64
+ if (QueueManager._instance === null) {
65
+ // check the global object first to see if we have an instance there since multiple modules might load this code
66
+ // and the static instance colud be different for each module based on JS import paths
67
+ const g = global_1.MJGlobal.Instance.GetGlobalObjectStore();
68
+ if (g && g[QueueManager._globalInstanceKey]) {
69
+ QueueManager._instance = g[QueueManager._globalInstanceKey];
70
+ }
71
+ else {
72
+ if (g)
73
+ g[QueueManager._globalInstanceKey] = this; // save the instance to the global object store if we have a global object store
74
+ QueueManager._instance = this; // and save our new instance to the static member for future use
75
+ }
76
+ }
77
+ return QueueManager._instance;
78
+ }
79
+ static async AddTask(QueueType, data, options, contextUser) {
80
+ await QueueManager.Config(contextUser);
81
+ const queueType = QueueManager.QueueTypes.find(qt => qt.Name == QueueType);
82
+ if (queueType == null)
83
+ throw new Error(`Queue Type ${QueueType} not found.`);
84
+ return QueueManager.Instance.AddTask(queueType.ID, data, options, contextUser);
85
+ }
86
+ async AddTask(QueueTypeID, data, options, contextUser) {
87
+ try {
88
+ // STEP 1: Find the queue type
89
+ const queueType = QueueManager.QueueTypes.find(qt => qt.ID == QueueTypeID);
90
+ if (queueType == null)
91
+ throw new Error(`Queue Type ID ${QueueTypeID} not found.`);
92
+ if (queueType.IsActive === false)
93
+ throw new Error(`Queue Type ID ${QueueTypeID} is not active.`);
94
+ // STEP 2: Find the queue for this type, create it if we don't have one running yet for the specified queue type
95
+ const queue = await this.CheckCreateQueue(queueType, contextUser);
96
+ if (queue) {
97
+ // STEP 3: Create a task in the database for this new task
98
+ const md = new core_1.Metadata();
99
+ const taskRecord = await md.GetEntityObject('Queue Tasks', contextUser);
100
+ taskRecord.Set('QueueID', queue.QueueID);
101
+ taskRecord.Set('Status', 'Pending');
102
+ taskRecord.Set('Data', JSON.stringify(data));
103
+ taskRecord.Set('Options', JSON.stringify(options));
104
+ if (await taskRecord.Save()) {
105
+ // db save worked, now we can create a taskBase object
106
+ const task = new QueueBase_1.TaskBase(taskRecord, data, options);
107
+ queue.AddTask(task);
108
+ return task;
109
+ }
110
+ else
111
+ throw new Error(`Failed to save new task to the database.`);
112
+ }
113
+ }
114
+ catch (e) {
115
+ (0, core_1.LogError)(e.message);
116
+ }
117
+ }
118
+ async CheckCreateQueue(queueType, contextUser) {
119
+ let queue = this._queues.find(q => q.QueueTypeID == queueType.ID);
120
+ if (queue === null || queue === undefined) {
121
+ // If a queue creation for this type is not already in progress, start one
122
+ if (!this.ongoingQueueCreations.has(queueType.ID)) {
123
+ this.ongoingQueueCreations.set(queueType.ID, this.CreateQueue(queueType, contextUser));
124
+ }
125
+ try {
126
+ // Wait for the ongoing queue creation to finish
127
+ queue = await this.ongoingQueueCreations.get(queueType.ID);
128
+ }
129
+ catch (error) {
130
+ // If there's an error, remove the promise from the map and rethrow the error
131
+ this.ongoingQueueCreations.delete(queueType.ID);
132
+ throw error;
133
+ }
134
+ // Once the queue creation has completed successfully, remove the promise from the map
135
+ this.ongoingQueueCreations.delete(queueType.ID);
136
+ }
137
+ return queue;
138
+ }
139
+ async CreateQueue(queueType, contextUser) {
140
+ try {
141
+ // create a new queue, based on the Queue Type metadata and process info
142
+ const md = new core_1.Metadata();
143
+ const newQueueRecord = await md.GetEntityObject('Queues', contextUser);
144
+ newQueueRecord.NewRecord();
145
+ newQueueRecord.Set('QueueTypeID', queueType.ID);
146
+ newQueueRecord.Set('Name', queueType.Name);
147
+ newQueueRecord.Set('IsActive', true);
148
+ newQueueRecord.Set('ProcessPID', process.pid);
149
+ newQueueRecord.Set('ProcessPlatform', process.platform);
150
+ newQueueRecord.Set('ProcessVersion', process.version);
151
+ newQueueRecord.Set('ProcessCwd', process.cwd());
152
+ const networkInterfaces = os_1.default.networkInterfaces();
153
+ const interfaceNames = Object.keys(networkInterfaces);
154
+ if (interfaceNames.length > 0) {
155
+ const firstInterfaceName = interfaceNames[0];
156
+ const firstInterface = networkInterfaces[firstInterfaceName];
157
+ if (firstInterface && firstInterface.length > 0) {
158
+ newQueueRecord.Set('ProcessIPAddress', firstInterface[0].address);
159
+ newQueueRecord.Set('ProcessMacAddress', firstInterface[0].mac);
160
+ }
161
+ }
162
+ newQueueRecord.Set('ProcessOSName', os_1.default.type());
163
+ newQueueRecord.Set('ProcessOSVersion', os_1.default.release());
164
+ newQueueRecord.Set('ProcessHostName', os_1.default.hostname());
165
+ newQueueRecord.Set('ProcessUserID', os_1.default.userInfo().uid.toString());
166
+ newQueueRecord.Set('ProcessUserName', os_1.default.userInfo().username);
167
+ newQueueRecord.Set('LastHeartbeat', new Date());
168
+ if (await newQueueRecord.Save()) {
169
+ const newQueue = global_1.MJGlobal.Instance.ClassFactory.CreateInstance(QueueBase_1.QueueBase, queueType.Name, newQueueRecord, queueType.ID, contextUser);
170
+ if (newQueue)
171
+ this._queues.push(newQueue);
172
+ return newQueue;
173
+ }
174
+ else
175
+ throw new Error(`Unable to create new queue for Queue Type ID ${queueType.ID}.`);
176
+ }
177
+ catch (e) {
178
+ (0, core_1.LogError)(e.message);
179
+ return null;
180
+ }
181
+ }
182
+ get Queues() {
183
+ return this._queues;
184
+ }
185
+ }
186
+ QueueManager._instance = null;
187
+ QueueManager._globalInstanceKey = '__mj_queue_manager_instance__';
188
+ exports.QueueManager = QueueManager;
189
+ //# sourceMappingURL=QueueManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"QueueManager.js","sourceRoot":"","sources":["../../src/generic/QueueManager.ts"],"names":[],"mappings":";;;;;;AAAA,uFAAuF;AACvF,2CAAkD;AAClD,+CAAyF;AACzF,mDAAkD;AAClD,4CAAoB;AAEpB;;;;;;;;;;;;GAYG;AACH,MAAa,YAAY;IAMhB,MAAM,KAAK,UAAU;QAC1B,OAAO,YAAY,CAAC,QAAQ,CAAC,WAAW,CAAC;IAC3C,CAAC;IAEM,MAAM,KAAK,QAAQ;QACxB,IAAI,YAAY,CAAC,SAAS,KAAK,IAAI;YACjC,YAAY,CAAC,SAAS,GAAG,IAAI,YAAY,EAAE,CAAC;QAE9C,OAAO,YAAY,CAAC,SAAS,CAAC;IAChC,CAAC;IAGM,KAAK,CAAC,MAAM,CAAC,WAAqB;QACvC,IAAI,IAAI,CAAC,WAAW,CAAC,MAAM,KAAK,CAAC,EAAE;YACjC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE;gBACvB,IAAI,CAAC,aAAa,GAAG,IAA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AQ;oBACV,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;gBAC9B,OAAO,QAAQ,CAAC;aACjB;;gBAEC,MAAM,IAAI,KAAK,CAAC,gDAAgD,SAAS,CAAC,EAAE,GAAG,CAAC,CAAC;SACpF;QACD,OAAO,CAAM,EAAE;YACb,IAAA,eAAQ,EAAC,CAAC,CAAC,OAAO,CAAC,CAAC;YACpB,OAAO,IAAI,CAAC;SACb;IACH,CAAC;IAED,IAAc,MAAM;QAClB,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;;AA1Lc,sBAAS,GAAwB,IAAI,AAA5B,CAA6B;AACtC,+BAAkB,GAAG,+BAA+B,AAAlC,CAAmC;AAJzD,oCAAY"}
@@ -0,0 +1,3 @@
1
+ export * from './generic/QueueBase';
2
+ export * from './generic/QueueManager';
3
+ export * from './drivers/AIActionQueue';
package/dist/index.js ADDED
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./generic/QueueBase"), exports);
18
+ __exportStar(require("./generic/QueueManager"), exports);
19
+ __exportStar(require("./drivers/AIActionQueue"), exports);
20
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,sDAAoC;AACpC,yDAAuC;AACvC,0DAAwC"}
package/package.json ADDED
@@ -0,0 +1,28 @@
1
+ {
2
+ "name": "@memberjunction/queue",
3
+ "version": "0.9.1",
4
+ "description": "MemberJunction: Queue Library for managing server side queues",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": [
8
+ "/dist"
9
+ ],
10
+ "scripts": {
11
+ "start": "ts-node-dev src/index.ts",
12
+ "build": "tsc",
13
+ "test": "echo \"Error: no test specified\" && exit 1"
14
+ },
15
+ "author": "MemberJunction.com",
16
+ "license": "ISC",
17
+ "devDependencies": {
18
+ "ts-node-dev": "^2.0.0",
19
+ "typescript": "^5.0.3"
20
+ },
21
+ "dependencies": {
22
+ "@memberjunction/ai": "^0.9.0",
23
+ "@memberjunction/core": "^0.9.0",
24
+ "@memberjunction/global": "^0.9.0",
25
+ "@types/uuid": "^9.0.1",
26
+ "uuid": "^9.0.0"
27
+ }
28
+ }