@mj-biz-apps/tasks-core 0.0.1 → 1.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.
@@ -0,0 +1,4 @@
1
+ export * from './services/TaskService.js';
2
+ export * from './services/TaskAssignmentService.js';
3
+ export * from './services/TaskTemplateService.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,4 @@
1
+ export * from './services/TaskService.js';
2
+ export * from './services/TaskAssignmentService.js';
3
+ export * from './services/TaskTemplateService.js';
4
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,qCAAqC,CAAC;AACpD,cAAc,mCAAmC,CAAC"}
@@ -0,0 +1,30 @@
1
+ import { BaseEntity } from "@memberjunction/core";
2
+ /**
3
+ * Service for managing task assignments.
4
+ * Handles polymorphic assignee operations (People and AI Agents)
5
+ * and triggers activity logging on assignment changes.
6
+ */
7
+ export declare class TaskAssignmentService {
8
+ private taskService;
9
+ /**
10
+ * Assigns an entity record (Person or Agent) to a task with an optional role.
11
+ * Logs an activity entry after successful assignment.
12
+ */
13
+ assignToTask(params: {
14
+ taskID: string;
15
+ assigneeEntityID: string;
16
+ assigneeRecordID: string;
17
+ roleID?: string;
18
+ roleNotes?: string;
19
+ assignedByPersonID?: string;
20
+ }): Promise<BaseEntity>;
21
+ /**
22
+ * Removes an assignment and logs the removal.
23
+ */
24
+ removeAssignment(assignmentID: string, removedByPersonID?: string): Promise<void>;
25
+ /**
26
+ * Returns all assignments for a given task.
27
+ */
28
+ getAssignmentsForTask(taskID: string): Promise<BaseEntity[]>;
29
+ }
30
+ //# sourceMappingURL=TaskAssignmentService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TaskAssignmentService.d.ts","sourceRoot":"","sources":["../../src/services/TaskAssignmentService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAmC,MAAM,sBAAsB,CAAC;AAGnF;;;;GAIG;AACH,qBAAa,qBAAqB;IAC9B,OAAO,CAAC,WAAW,CAAqB;IAExC;;;OAGG;IACG,YAAY,CAAC,MAAM,EAAE;QACvB,MAAM,EAAE,MAAM,CAAC;QACf,gBAAgB,EAAE,MAAM,CAAC;QACzB,gBAAgB,EAAE,MAAM,CAAC;QACzB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,kBAAkB,CAAC,EAAE,MAAM,CAAC;KAC/B,GAAG,OAAO,CAAC,UAAU,CAAC;IAuBvB;;OAEG;IACG,gBAAgB,CAAC,YAAY,EAAE,MAAM,EAAE,iBAAiB,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAmBvF;;OAEG;IACG,qBAAqB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;CASrE"}
@@ -0,0 +1,69 @@
1
+ import { CompositeKey, Metadata, RunView } from "@memberjunction/core";
2
+ import { TaskService } from "./TaskService.js";
3
+ /**
4
+ * Service for managing task assignments.
5
+ * Handles polymorphic assignee operations (People and AI Agents)
6
+ * and triggers activity logging on assignment changes.
7
+ */
8
+ export class TaskAssignmentService {
9
+ constructor() {
10
+ this.taskService = new TaskService();
11
+ }
12
+ /**
13
+ * Assigns an entity record (Person or Agent) to a task with an optional role.
14
+ * Logs an activity entry after successful assignment.
15
+ */
16
+ async assignToTask(params) {
17
+ const assignment = await Metadata.Provider.GetEntityObject('MJ_BizApps_Tasks: Task Assignments');
18
+ assignment.NewRecord();
19
+ assignment.Set('TaskID', params.taskID);
20
+ assignment.Set('AssigneeEntityID', params.assigneeEntityID);
21
+ assignment.Set('AssigneeRecordID', params.assigneeRecordID);
22
+ if (params.roleID)
23
+ assignment.Set('RoleID', params.roleID);
24
+ if (params.roleNotes)
25
+ assignment.Set('RoleNotes', params.roleNotes);
26
+ if (params.assignedByPersonID)
27
+ assignment.Set('AssignedByPersonID', params.assignedByPersonID);
28
+ await assignment.Save();
29
+ await this.taskService.logActivity({
30
+ taskID: params.taskID,
31
+ personID: params.assignedByPersonID,
32
+ activityType: 'AssignmentAdded',
33
+ newValue: params.assigneeRecordID,
34
+ description: `Assignee added to task`,
35
+ });
36
+ return assignment;
37
+ }
38
+ /**
39
+ * Removes an assignment and logs the removal.
40
+ */
41
+ async removeAssignment(assignmentID, removedByPersonID) {
42
+ const assignment = await Metadata.Provider.GetEntityObject('MJ_BizApps_Tasks: Task Assignments');
43
+ const pk = new CompositeKey([{ FieldName: 'ID', Value: assignmentID }]);
44
+ await assignment.InnerLoad(pk);
45
+ const taskID = assignment.Get('TaskID');
46
+ const assigneeRecordID = assignment.Get('AssigneeRecordID');
47
+ await assignment.Delete();
48
+ await this.taskService.logActivity({
49
+ taskID,
50
+ personID: removedByPersonID,
51
+ activityType: 'AssignmentRemoved',
52
+ previousValue: assigneeRecordID,
53
+ description: `Assignee removed from task`,
54
+ });
55
+ }
56
+ /**
57
+ * Returns all assignments for a given task.
58
+ */
59
+ async getAssignmentsForTask(taskID) {
60
+ const rv = new RunView();
61
+ const result = await rv.RunView({
62
+ EntityName: 'MJ_BizApps_Tasks: Task Assignments',
63
+ ExtraFilter: `TaskID = '${taskID}'`,
64
+ ResultType: 'entity_object',
65
+ });
66
+ return result?.Results ?? [];
67
+ }
68
+ }
69
+ //# sourceMappingURL=TaskAssignmentService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TaskAssignmentService.js","sourceRoot":"","sources":["../../src/services/TaskAssignmentService.ts"],"names":[],"mappings":"AAAA,OAAO,EAA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AU,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,gBAAgB,CAAC,YAAoB,EAAE,iBAA0B;QACnE,MAAM,UAAU,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,oCAAoC,CAAC,CAAC;QACjG,MAAM,EAAE,GAAG,IAAI,YAAY,CAAC,CAAC,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC;QACxE,MAAM,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QAE/B,MAAM,MAAM,GAAG,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAW,CAAC;QAClD,MAAM,gBAAgB,GAAG,UAAU,CAAC,GAAG,CAAC,kBAAkB,CAAW,CAAC;QAEtE,MAAM,UAAU,CAAC,MAAM,EAAE,CAAC;QAE1B,MAAM,IAAI,CAAC,WAAW,CAAC,WAAW,CAAC;YAC/B,MAAM;YACN,QAAQ,EAAE,iBAAiB;YAC3B,YAAY,EAAE,mBAAmB;YACjC,aAAa,EAAE,gBAAgB;YAC/B,WAAW,EAAE,4BAA4B;SAC5C,CAAC,CAAC;IACP,CAAC;IAED;;OAEG;IACH,KAAK,CAAC,qBAAqB,CAAC,MAAc;QACtC,MAAM,EAAE,GAAG,IAAI,OAAO,EAAE,CAAC;QACzB,MAAM,MAAM,GAAG,MAAM,EAAE,CAAC,OAAO,CAAa;YACxC,UAAU,EAAE,oCAAoC;YAChD,WAAW,EAAE,aAAa,MAAM,GAAG;YACnC,UAAU,EAAE,eAAe;SAC9B,CAAC,CAAC;QACH,OAAO,MAAM,EAAE,OAAO,IAAI,EAAE,CAAC;IACjC,CAAC;CACJ"}
@@ -0,0 +1,32 @@
1
+ import { UserInfo } from "@memberjunction/core";
2
+ /**
3
+ * Core task management service.
4
+ * Handles task CRUD helpers, status transitions, and sub-task progress rollup.
5
+ *
6
+ * All methods operate through the MJ entity API so that entity subclass
7
+ * validation (status side-effects, circular-dependency checks, etc.) fires
8
+ * automatically.
9
+ */
10
+ export declare class TaskService {
11
+ /**
12
+ * Recalculates a parent task's PercentComplete based on its children.
13
+ * Weighting: by HoursEstimated if available, equal weight otherwise.
14
+ * Recurses up the tree so grandparent tasks also update.
15
+ *
16
+ * Call this after saving a child task whose PercentComplete or Status changed.
17
+ */
18
+ rollupParentProgress(parentTaskID: string, contextUser?: UserInfo): Promise<void>;
19
+ /**
20
+ * Creates a TaskActivity record for an auditable change.
21
+ * Called from entity subclass hooks or service methods after a save.
22
+ */
23
+ logActivity(params: {
24
+ taskID: string;
25
+ personID?: string;
26
+ activityType: string;
27
+ previousValue?: string;
28
+ newValue?: string;
29
+ description: string;
30
+ }): Promise<void>;
31
+ }
32
+ //# sourceMappingURL=TaskService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TaskService.d.ts","sourceRoot":"","sources":["../../src/services/TaskService.ts"],"names":[],"mappings":"AAAA,OAAO,EAA+C,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAE7F;;;;;;;GAOG;AACH,qBAAa,WAAW;IAMpB;;;;;;OAMG;IACG,oBAAoB,CAAC,YAAY,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC;IA6DvF;;;OAGG;IACG,WAAW,CAAC,MAAM,EAAE;QACtB,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,YAAY,EAAE,MAAM,CAAC;QACrB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,WAAW,EAAE,MAAM,CAAC;KACvB,GAAG,OAAO,CAAC,IAAI,CAAC;CAWpB"}
@@ -0,0 +1,88 @@
1
+ import { CompositeKey, Metadata, RunView } from "@memberjunction/core";
2
+ /**
3
+ * Core task management service.
4
+ * Handles task CRUD helpers, status transitions, and sub-task progress rollup.
5
+ *
6
+ * All methods operate through the MJ entity API so that entity subclass
7
+ * validation (status side-effects, circular-dependency checks, etc.) fires
8
+ * automatically.
9
+ */
10
+ export class TaskService {
11
+ // ---------------------------------------------------------------
12
+ // Sub-task progress rollup
13
+ // ---------------------------------------------------------------
14
+ /**
15
+ * Recalculates a parent task's PercentComplete based on its children.
16
+ * Weighting: by HoursEstimated if available, equal weight otherwise.
17
+ * Recurses up the tree so grandparent tasks also update.
18
+ *
19
+ * Call this after saving a child task whose PercentComplete or Status changed.
20
+ */
21
+ async rollupParentProgress(parentTaskID, contextUser) {
22
+ const rv = new RunView();
23
+ const children = await rv.RunView({
24
+ EntityName: 'MJ_BizApps_Tasks: Tasks',
25
+ ExtraFilter: `ParentID = '${parentTaskID}'`,
26
+ ResultType: 'simple',
27
+ }, contextUser);
28
+ if (!children?.Results?.length)
29
+ return;
30
+ let totalWeight = 0;
31
+ let weightedSum = 0;
32
+ let allCompleted = true;
33
+ for (const child of children.Results) {
34
+ const pct = child.PercentComplete ?? 0;
35
+ const hours = child.HoursEstimated;
36
+ const weight = hours != null && hours > 0 ? hours : 1;
37
+ weightedSum += pct * weight;
38
+ totalWeight += weight;
39
+ if (child.Status !== 'Completed') {
40
+ allCompleted = false;
41
+ }
42
+ }
43
+ const newPct = totalWeight > 0 ? Math.round(weightedSum / totalWeight) : 0;
44
+ // Load the parent task as an entity to trigger subclass validation
45
+ const parentTask = await Metadata.Provider.GetEntityObject('MJ_BizApps_Tasks: Tasks', contextUser);
46
+ const pk = new CompositeKey([{ FieldName: 'ID', Value: parentTaskID }]);
47
+ await parentTask.InnerLoad(pk);
48
+ const currentPct = parentTask.Get('PercentComplete');
49
+ const shouldComplete = allCompleted && parentTask.Get('Status') !== 'Completed';
50
+ // Only write when something actually changes — this also prevents the
51
+ // server save-event handler from re-triggering rollup in an infinite loop.
52
+ if (currentPct === newPct && !shouldComplete) {
53
+ return;
54
+ }
55
+ parentTask.Set('PercentComplete', newPct);
56
+ if (shouldComplete) {
57
+ parentTask.Set('Status', 'Completed');
58
+ }
59
+ await parentTask.Save();
60
+ // Recurse up the tree
61
+ const grandParentID = parentTask.Get('ParentID');
62
+ if (grandParentID) {
63
+ await this.rollupParentProgress(grandParentID, contextUser);
64
+ }
65
+ }
66
+ // ---------------------------------------------------------------
67
+ // Activity logging
68
+ // ---------------------------------------------------------------
69
+ /**
70
+ * Creates a TaskActivity record for an auditable change.
71
+ * Called from entity subclass hooks or service methods after a save.
72
+ */
73
+ async logActivity(params) {
74
+ const activity = await Metadata.Provider.GetEntityObject('MJ_BizApps_Tasks: Task Activities');
75
+ activity.NewRecord();
76
+ activity.Set('TaskID', params.taskID);
77
+ if (params.personID)
78
+ activity.Set('PersonID', params.personID);
79
+ activity.Set('ActivityType', params.activityType);
80
+ if (params.previousValue)
81
+ activity.Set('PreviousValue', params.previousValue);
82
+ if (params.newValue)
83
+ activity.Set('NewValue', params.newValue);
84
+ activity.Set('Description', params.description);
85
+ await activity.Save();
86
+ }
87
+ }
88
+ //# sourceMappingURL=TaskService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TaskService.js","sourceRoot":"","sources":["../../src/services/TaskService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAY,MAAM,sBAAsB,CAAC;AAE7F;;;;;;;GAOG;AACH,MAAM,OAAO,WAAW;IAEpB,kEAAkE;IAClE,2BAA2B;IAC3B,kEAAkE;IAElE;;;;;;OAMG;IACH,KAAK,CAAC,oBAAoB,CAAC,YAAoB,EAAE,WAAsB;QACnE,MAAM,EAAE,GAAG,IAAI,OAAO,EAAE,CAAC;QACzB,MAAM,QAAQ,GAAG,MAAM,EAAE,CAAC,OAAO,CAAa;YAC1C,UAAU,EAAE,yBAAyB;YACrC,WAAW,EAAE,eAAe,YAAY,GAAG;YAC3C,UAAU,EAAE,QAAQ;SACvB,EAAE,WAAW,CAAC,CAAC;QAEhB,IAAI,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM;YAAE,OAAO;QAEvC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D,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;IAC1B,CAAC;CACJ"}
@@ -0,0 +1,46 @@
1
+ import { BaseEntity } from "@memberjunction/core";
2
+ /**
3
+ * Service for instantiating tasks from templates.
4
+ *
5
+ * "Create from Template" hydrates real Task records from a TaskTemplate:
6
+ * - Converts DaysFromStart offsets to actual DueAt dates
7
+ * - Recreates the sub-task hierarchy (ParentID)
8
+ * - Recreates dependencies between tasks
9
+ * - Creates placeholder TaskAssignment rows for pre-defined roles
10
+ */
11
+ export declare class TaskTemplateService {
12
+ /**
13
+ * Instantiates a full set of Tasks from a template.
14
+ *
15
+ * @param templateID - The TaskTemplate to instantiate
16
+ * @param startDate - The reference date for DaysFromStart calculations
17
+ * @param categoryID - Optional category to assign to all created tasks
18
+ * @param assigneeMap - Optional map of RoleID → { entityID, recordID } for
19
+ * filling in role placeholders with real assignees
20
+ * @returns The created Task entities (root-level + children)
21
+ */
22
+ instantiateTemplate(params: {
23
+ templateID: string;
24
+ startDate: Date;
25
+ categoryID?: string;
26
+ assigneeMap?: Map<string, {
27
+ entityID: string;
28
+ recordID: string;
29
+ }>;
30
+ }): Promise<BaseEntity[]>;
31
+ /**
32
+ * Sort template items so that parents come before children (simple iterative approach).
33
+ */
34
+ private topologicalSortByParent;
35
+ /**
36
+ * Creates TaskAssignment records for a newly created task based on
37
+ * the template item's pre-defined roles.
38
+ */
39
+ private createAssignmentsForItem;
40
+ /**
41
+ * Recreates the dependency graph between newly instantiated tasks
42
+ * based on the template's TaskTemplateItemDependency records.
43
+ */
44
+ private createDependencies;
45
+ }
46
+ //# sourceMappingURL=TaskTemplateService.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TaskTemplateService.d.ts","sourceRoot":"","sources":["../../src/services/TaskTemplateService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAmC,MAAM,sBAAsB,CAAC;AAEnF;;;;;;;;GAQG;AACH,qBAAa,mBAAmB;IAE5B;;;;;;;;;OASG;IACG,mBAAmB,CAAC,MAAM,EAAE;QAC9B,UAAU,EAAE,MAAM,CAAC;QACnB,SAAS,EAAE,IAAI,CAAC;QAChB,UAAU,CAAC,EAAE,MAAM,CAAC;QACpB,WAAW,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE;YAAE,QAAQ,EAAE,MAAM,CAAC;YAAC,QAAQ,EAAE,MAAM,CAAA;SAAE,CAAC,CAAC;KACrE,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC;IAsEzB;;OAEG;IACH,OAAO,CAAC,uBAAuB;IA+B/B;;;OAGG;YACW,wBAAwB;IA6BtC;;;OAGG;YACW,kBAAkB;CAoCnC"}
@@ -0,0 +1,175 @@
1
+ import { CompositeKey, Metadata, RunView } from "@memberjunction/core";
2
+ /**
3
+ * Service for instantiating tasks from templates.
4
+ *
5
+ * "Create from Template" hydrates real Task records from a TaskTemplate:
6
+ * - Converts DaysFromStart offsets to actual DueAt dates
7
+ * - Recreates the sub-task hierarchy (ParentID)
8
+ * - Recreates dependencies between tasks
9
+ * - Creates placeholder TaskAssignment rows for pre-defined roles
10
+ */
11
+ export class TaskTemplateService {
12
+ /**
13
+ * Instantiates a full set of Tasks from a template.
14
+ *
15
+ * @param templateID - The TaskTemplate to instantiate
16
+ * @param startDate - The reference date for DaysFromStart calculations
17
+ * @param categoryID - Optional category to assign to all created tasks
18
+ * @param assigneeMap - Optional map of RoleID → { entityID, recordID } for
19
+ * filling in role placeholders with real assignees
20
+ * @returns The created Task entities (root-level + children)
21
+ */
22
+ async instantiateTemplate(params) {
23
+ const { templateID, startDate, categoryID, assigneeMap } = params;
24
+ const rv = new RunView();
25
+ // 1. Load the template
26
+ const template = await Metadata.Provider.GetEntityObject('MJ_BizApps_Tasks: Task Templates');
27
+ const pk = new CompositeKey([{ FieldName: 'ID', Value: templateID }]);
28
+ await template.InnerLoad(pk);
29
+ // 2. Load all template items
30
+ const itemsResult = await rv.RunView({
31
+ EntityName: 'MJ_BizApps_Tasks: Task Template Items',
32
+ ExtraFilter: `TemplateID = '${templateID}'`,
33
+ OrderBy: 'Sequence ASC',
34
+ ResultType: 'simple',
35
+ });
36
+ const items = itemsResult?.Results ?? [];
37
+ if (items.length === 0)
38
+ return [];
39
+ // 3. Create tasks from items, maintaining a map of templateItemID → new taskID
40
+ const itemToTaskID = new Map();
41
+ const createdTasks = [];
42
+ // Sort items so parents are created before children
43
+ const sorted = this.topologicalSortByParent(items);
44
+ for (const item of sorted) {
45
+ const itemID = item.ID;
46
+ const task = await Metadata.Provider.GetEntityObject('MJ_BizApps_Tasks: Tasks');
47
+ task.NewRecord();
48
+ task.Set('Name', item.Name);
49
+ task.Set('Description', item.Description ?? null);
50
+ task.Set('Priority', item.Priority ?? 'Medium');
51
+ task.Set('HoursEstimated', item.HoursEstimated ?? null);
52
+ task.Set('Sequence', item.Sequence ?? 100);
53
+ // Set type and category from template defaults
54
+ const typeID = template.Get('TypeID');
55
+ if (typeID)
56
+ task.Set('TypeID', typeID);
57
+ if (categoryID)
58
+ task.Set('CategoryID', categoryID);
59
+ // Calculate DueAt from DaysFromStart
60
+ const daysFromStart = item.DaysFromStart;
61
+ if (daysFromStart != null) {
62
+ const dueAt = new Date(startDate);
63
+ dueAt.setDate(dueAt.getDate() + daysFromStart);
64
+ task.Set('DueAt', dueAt);
65
+ }
66
+ // Wire up parent task
67
+ const parentItemID = item.ParentItemID;
68
+ if (parentItemID && itemToTaskID.has(parentItemID)) {
69
+ task.Set('ParentID', itemToTaskID.get(parentItemID));
70
+ }
71
+ await task.Save();
72
+ const newTaskID = task.Get('ID');
73
+ itemToTaskID.set(itemID, newTaskID);
74
+ createdTasks.push(task);
75
+ // 4. Create assignments from template item roles
76
+ await this.createAssignmentsForItem(itemID, newTaskID, assigneeMap);
77
+ }
78
+ // 5. Create dependencies between the new tasks
79
+ await this.createDependencies(templateID, itemToTaskID);
80
+ return createdTasks;
81
+ }
82
+ /**
83
+ * Sort template items so that parents come before children (simple iterative approach).
84
+ */
85
+ topologicalSortByParent(items) {
86
+ const result = [];
87
+ const remaining = [...items];
88
+ const placed = new Set();
89
+ // First pass: items with no parent
90
+ for (let i = remaining.length - 1; i >= 0; i--) {
91
+ if (!remaining[i].ParentItemID) {
92
+ placed.add(remaining[i].ID);
93
+ result.push(remaining[i]);
94
+ remaining.splice(i, 1);
95
+ }
96
+ }
97
+ // Subsequent passes: place items whose parent is already placed
98
+ let maxIterations = remaining.length + 1;
99
+ while (remaining.length > 0 && maxIterations-- > 0) {
100
+ for (let i = remaining.length - 1; i >= 0; i--) {
101
+ if (placed.has(remaining[i].ParentItemID)) {
102
+ placed.add(remaining[i].ID);
103
+ result.push(remaining[i]);
104
+ remaining.splice(i, 1);
105
+ }
106
+ }
107
+ }
108
+ // Any remaining items (orphans) go at the end
109
+ result.push(...remaining);
110
+ return result;
111
+ }
112
+ /**
113
+ * Creates TaskAssignment records for a newly created task based on
114
+ * the template item's pre-defined roles.
115
+ */
116
+ async createAssignmentsForItem(templateItemID, taskID, assigneeMap) {
117
+ if (!assigneeMap || assigneeMap.size === 0)
118
+ return;
119
+ const rv = new RunView();
120
+ const rolesResult = await rv.RunView({
121
+ EntityName: 'MJ_BizApps_Tasks: Task Template Item Roles',
122
+ ExtraFilter: `ItemID = '${templateItemID}'`,
123
+ ResultType: 'simple',
124
+ });
125
+ for (const role of rolesResult?.Results ?? []) {
126
+ const roleID = role.RoleID;
127
+ const assignee = assigneeMap.get(roleID);
128
+ if (!assignee)
129
+ continue;
130
+ const assignment = await Metadata.Provider.GetEntityObject('MJ_BizApps_Tasks: Task Assignments');
131
+ assignment.NewRecord();
132
+ assignment.Set('TaskID', taskID);
133
+ assignment.Set('AssigneeEntityID', assignee.entityID);
134
+ assignment.Set('AssigneeRecordID', assignee.recordID);
135
+ assignment.Set('RoleID', roleID);
136
+ await assignment.Save();
137
+ }
138
+ }
139
+ /**
140
+ * Recreates the dependency graph between newly instantiated tasks
141
+ * based on the template's TaskTemplateItemDependency records.
142
+ */
143
+ async createDependencies(templateID, itemToTaskID) {
144
+ const rv = new RunView();
145
+ // Get all template items for this template (we need their IDs to filter deps)
146
+ const itemsResult = await rv.RunView({
147
+ EntityName: 'MJ_BizApps_Tasks: Task Template Items',
148
+ ExtraFilter: `TemplateID = '${templateID}'`,
149
+ ResultType: 'simple',
150
+ });
151
+ const itemIDs = (itemsResult?.Results ?? []).map((i) => `'${i.ID}'`).join(',');
152
+ if (!itemIDs)
153
+ return;
154
+ const depsResult = await rv.RunView({
155
+ EntityName: 'MJ_BizApps_Tasks: Task Template Item Dependencies',
156
+ ExtraFilter: `ItemID IN (${itemIDs})`,
157
+ ResultType: 'simple',
158
+ });
159
+ for (const dep of depsResult?.Results ?? []) {
160
+ const itemID = dep.ItemID;
161
+ const dependsOnItemID = dep.DependsOnItemID;
162
+ const taskID = itemToTaskID.get(itemID);
163
+ const dependsOnTaskID = itemToTaskID.get(dependsOnItemID);
164
+ if (!taskID || !dependsOnTaskID)
165
+ continue;
166
+ const taskDep = await Metadata.Provider.GetEntityObject('MJ_BizApps_Tasks: Task Dependencies');
167
+ taskDep.NewRecord();
168
+ taskDep.Set('TaskID', taskID);
169
+ taskDep.Set('DependsOnTaskID', dependsOnTaskID);
170
+ taskDep.Set('DependencyType', dep.DependencyType ?? 'FinishToStart');
171
+ await taskDep.Save();
172
+ }
173
+ }
174
+ }
175
+ //# sourceMappingURL=TaskTemplateService.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TaskTemplateService.js","sourceRoot":"","sources":["../../src/services/TaskTemplateService.ts"],"names":[],"mappings":"AAAA,OAAO,EAAc,YAAY,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAC;AAEnF;;;;;;;;GAQG;AACH,MAAM,OAAO,mBAAmB;IAE5B;;;;;;;;;OASG;IACH,KAAK,CAAC,mBAAmB,CAAC,MAKzB;QACG,MAAM,EAAE,UAAU,EAAE,SAAS,EAAE,UAAU,EAAE,WAAW,EAAE,GAAG,MAAM,CAAC;QAClE,M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AAS;YAE1C,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,QAAQ,CAAC,eAAe,CAAC,qCAAqC,CAAC,CAAC;YAC/F,OAAO,CAAC,SAAS,EAAE,CAAC;YACpB,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;YAC9B,OAAO,CAAC,GAAG,CAAC,iBAAiB,EAAE,eAAe,CAAC,CAAC;YAChD,OAAO,CAAC,GAAG,CAAC,gBAAgB,EAAG,GAAW,CAAC,cAAc,IAAI,eAAe,CAAC,CAAC;YAC9E,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC;QACzB,CAAC;IACL,CAAC;CACJ"}
package/package.json CHANGED
@@ -1,10 +1,32 @@
1
1
  {
2
2
  "name": "@mj-biz-apps/tasks-core",
3
- "version": "0.0.1",
4
- "description": "OIDC trusted publishing setup package for @mj-biz-apps/tasks-core",
5
- "keywords": [
6
- "oidc",
7
- "trusted-publishing",
8
- "setup"
9
- ]
3
+ "type": "module",
4
+ "version": "1.0.0",
5
+ "description": "BizApps Tasks Core Services - TaskService, TaskAssignmentService, TaskTemplateService",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "publishConfig": {
9
+ "access": "public"
10
+ },
11
+ "files": ["/dist"],
12
+ "scripts": {
13
+ "build": "tsc && tsc-alias -f",
14
+ "test": "vitest run"
15
+ },
16
+ "author": "MemberJunction.com",
17
+ "license": "ISC",
18
+ "devDependencies": {
19
+ "typescript": "^5.9.3"
20
+ },
21
+ "dependencies": {
22
+ "@mj-biz-apps/tasks-entities": "1.0.0"
23
+ },
24
+ "peerDependencies": {
25
+ "@memberjunction/core": "^5.38.0",
26
+ "@memberjunction/global": "^5.38.0"
27
+ },
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "https://github.com/MemberJunction/bizapps-tasks"
31
+ }
10
32
  }
package/README.md DELETED
@@ -1,45 +0,0 @@
1
- # @mj-biz-apps/tasks-core
2
-
3
- ## ⚠️ IMPORTANT NOTICE ⚠️
4
-
5
- **This package is created solely for the purpose of setting up OIDC (OpenID Connect) trusted publishing with npm.**
6
-
7
- This is **NOT** a functional package and contains **NO** code or functionality beyond the OIDC setup configuration.
8
-
9
- ## Purpose
10
-
11
- This package exists to:
12
- 1. Configure OIDC trusted publishing for the package name `@mj-biz-apps/tasks-core`
13
- 2. Enable secure, token-less publishing from CI/CD workflows
14
- 3. Establish provenance for packages published under this name
15
-
16
- ## What is OIDC Trusted Publishing?
17
-
18
- OIDC trusted publishing allows package maintainers to publish packages directly from their CI/CD workflows without needing to manage npm access tokens. Instead, it uses OpenID Connect to establish trust between the CI/CD provider (like GitHub Actions) and npm.
19
-
20
- ## Setup Instructions
21
-
22
- To properly configure OIDC trusted publishing for this package:
23
-
24
- 1. Go to [npmjs.com](https://www.npmjs.com/) and navigate to your package settings
25
- 2. Configure the trusted publisher (e.g., GitHub Actions)
26
- 3. Specify the repository and workflow that should be allowed to publish
27
- 4. Use the configured workflow to publish your actual package
28
-
29
- ## DO NOT USE THIS PACKAGE
30
-
31
- This package is a placeholder for OIDC configuration only. It:
32
- - Contains no executable code
33
- - Provides no functionality
34
- - Should not be installed as a dependency
35
- - Exists only for administrative purposes
36
-
37
- ## More Information
38
-
39
- For more details about npm's trusted publishing feature, see:
40
- - [npm Trusted Publishing Documentation](https://docs.npmjs.com/generating-provenance-statements)
41
- - [GitHub Actions OIDC Documentation](https://docs.github.com/en/actions/deployment/security-hardening-your-deployments/about-security-hardening-with-openid-connect)
42
-
43
- ---
44
-
45
- **Maintained for OIDC setup purposes only**