@markwharton/liquidplanner 1.9.0 → 1.11.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/client.d.ts CHANGED
@@ -53,6 +53,12 @@ export declare class LPClient {
53
53
  * data changed but the write didn't go through this client instance.
54
54
  */
55
55
  invalidateTimesheetCache(): void;
56
+ /**
57
+ * Invalidate cached assignments only.
58
+ * Use when an external event indicates assignment data changed
59
+ * (e.g., after logging time which updates loggedHoursRollup).
60
+ */
61
+ invalidateAssignmentsCache(): void;
56
62
  /**
57
63
  * Make an authenticated request to the LP API
58
64
  *
package/dist/client.js CHANGED
@@ -10,9 +10,9 @@ import { buildAuthHeader, hoursToMinutes, normalizeItemType, filterIs, filterIn,
10
10
  import { parseLPErrorResponse } from './errors.js';
11
11
  import { LP_API_BASE } from './constants.js';
12
12
  import { TTLCache, batchMap, getErrorMessage, fetchWithRetry } from '@markwharton/api-core';
13
- /** Transform raw API item to LPItem */
13
+ /** Transform raw API item to LPItem, preserving scheduling and effort fields */
14
14
  function transformItem(raw) {
15
- return {
15
+ const item = {
16
16
  id: raw.id,
17
17
  name: raw.name || null,
18
18
  itemType: normalizeItemType(raw.itemType),
@@ -20,6 +20,50 @@ function transformItem(raw) {
20
20
  costCodeId: raw.costCodeId,
21
21
  userId: raw.userId,
22
22
  };
23
+ // Scheduling fields — only include if present
24
+ if (raw.expectedStart)
25
+ item.expectedStart = raw.expectedStart;
26
+ if (raw.expectedFinish)
27
+ item.expectedFinish = raw.expectedFinish;
28
+ if (raw.latestFinish)
29
+ item.latestFinish = raw.latestFinish;
30
+ if (raw.late !== undefined)
31
+ item.late = raw.late;
32
+ if (raw.targetStart)
33
+ item.targetStart = raw.targetStart;
34
+ if (raw.targetFinish)
35
+ item.targetFinish = raw.targetFinish;
36
+ if (raw.targetFinishType)
37
+ item.targetFinishType = raw.targetFinishType;
38
+ if (raw.inheritedTargetStartDate)
39
+ item.inheritedTargetStartDate = raw.inheritedTargetStartDate;
40
+ if (raw.inheritedTargetFinishDate)
41
+ item.inheritedTargetFinishDate = raw.inheritedTargetFinishDate;
42
+ if (raw.scheduleDirective)
43
+ item.scheduleDirective = raw.scheduleDirective;
44
+ if (raw.doneDate)
45
+ item.doneDate = raw.doneDate;
46
+ // Effort & hours fields — only include if present
47
+ if (raw.lowEffort !== undefined)
48
+ item.lowEffort = raw.lowEffort;
49
+ if (raw.highEffort !== undefined)
50
+ item.highEffort = raw.highEffort;
51
+ if (raw.loggedHoursRollup !== undefined)
52
+ item.loggedHoursRollup = raw.loggedHoursRollup;
53
+ if (raw.lowRemainingHoursRollup !== undefined)
54
+ item.lowRemainingHoursRollup = raw.lowRemainingHoursRollup;
55
+ if (raw.highRemainingHoursRollup !== undefined)
56
+ item.highRemainingHoursRollup = raw.highRemainingHoursRollup;
57
+ // Status & metadata fields — only include if present
58
+ if (raw.taskStatusId !== undefined)
59
+ item.taskStatusId = raw.taskStatusId;
60
+ if (raw.packageStatus)
61
+ item.packageStatus = raw.packageStatus;
62
+ if (raw.folderStatus)
63
+ item.folderStatus = raw.folderStatus;
64
+ if (raw.globalPriority)
65
+ item.globalPriority = raw.globalPriority;
66
+ return item;
23
67
  }
24
68
  /**
25
69
  * LiquidPlanner API Client
@@ -93,6 +137,14 @@ export class LPClient {
93
137
  invalidateTimesheetCache() {
94
138
  this.cache?.invalidate('timesheet:');
95
139
  }
140
+ /**
141
+ * Invalidate cached assignments only.
142
+ * Use when an external event indicates assignment data changed
143
+ * (e.g., after logging time which updates loggedHoursRollup).
144
+ */
145
+ invalidateAssignmentsCache() {
146
+ this.cache?.invalidate('assignments:');
147
+ }
96
148
  /**
97
149
  * Make an authenticated request to the LP API
98
150
  *
package/dist/index.d.ts CHANGED
@@ -31,7 +31,7 @@ export { resolveTaskToAssignment } from './workflows.js';
31
31
  export type { LPConfig, LPCacheConfig, LPRetryConfig, LPItemType, HierarchyItem, LPItem, LPAncestor, LPWorkspace, LPMember, LPCostCode, LPSyncResult, LPTimesheetEntry, LPTimesheetEntryWithId, LPTaskResolution, LPResult, LPUpsertOptions, LPAssignmentWithContext, LPErrorInfo, } from './types.js';
32
32
  export { hoursToMinutes, normalizeItemType, buildAuthHeader, filterIs, filterIn, paginatedFetch, } from './utils.js';
33
33
  export type { PaginateOptions } from './utils.js';
34
- export { batchMap, getErrorMessage } from '@markwharton/api-core';
34
+ export { getErrorMessage } from '@markwharton/api-core';
35
35
  export { LP_API_BASE } from './constants.js';
36
36
  export { LPError, parseLPErrorResponse } from './errors.js';
37
37
  export type { LPParsedError } from './errors.js';
package/dist/index.js CHANGED
@@ -32,7 +32,7 @@ export { LPClient } from './client.js';
32
32
  export { resolveTaskToAssignment } from './workflows.js';
33
33
  // Utilities
34
34
  export { hoursToMinutes, normalizeItemType, buildAuthHeader, filterIs, filterIn, paginatedFetch, } from './utils.js';
35
- export { batchMap, getErrorMessage } from '@markwharton/api-core';
35
+ export { getErrorMessage } from '@markwharton/api-core';
36
36
  // Constants
37
37
  export { LP_API_BASE } from './constants.js';
38
38
  // Errors
package/dist/types.d.ts CHANGED
@@ -51,6 +51,46 @@ export interface LPItem {
51
51
  costCodeId?: number;
52
52
  /** User ID this assignment is for (if Assignment type) */
53
53
  userId?: number;
54
+ /** Calculated start date from LP scheduling (ISO string) */
55
+ expectedStart?: string;
56
+ /** Calculated finish date from LP scheduling (ISO string) */
57
+ expectedFinish?: string;
58
+ /** Latest permissible finish date (ISO string) */
59
+ latestFinish?: string;
60
+ /** True when targetFinish < expectedFinish */
61
+ late?: boolean;
62
+ /** Manually set target start (ISO string) */
63
+ targetStart?: string;
64
+ /** Manually set target finish (ISO string) */
65
+ targetFinish?: string;
66
+ /** Scheduling behavior: stopScheduling, keepScheduling */
67
+ targetFinishType?: string;
68
+ /** Inherited target start from parent container (ISO string) */
69
+ inheritedTargetStartDate?: string;
70
+ /** Inherited target finish from parent container (ISO string) */
71
+ inheritedTargetFinishDate?: string;
72
+ /** Scheduling priority: normal, asapInProject, asapInPackage, asapInWorkspace, trackingOnly */
73
+ scheduleDirective?: string;
74
+ /** Completion date (ISO string, set when task is marked done) */
75
+ doneDate?: string;
76
+ /** Low effort estimate in seconds */
77
+ lowEffort?: number;
78
+ /** High effort estimate in seconds */
79
+ highEffort?: number;
80
+ /** Total hours logged (rolled up) */
81
+ loggedHoursRollup?: number;
82
+ /** Low remaining estimate hours (rolled up) */
83
+ lowRemainingHoursRollup?: number;
84
+ /** High remaining estimate hours (rolled up) */
85
+ highRemainingHoursRollup?: number;
86
+ /** Custom task status ID */
87
+ taskStatusId?: number;
88
+ /** Package status: archived, backlog, template, scheduled */
89
+ packageStatus?: string;
90
+ /** Folder status: active, onHold, done */
91
+ folderStatus?: string;
92
+ /** Priority ordering (global priority array from LP) */
93
+ globalPriority?: string[];
54
94
  }
55
95
  /**
56
96
  * A cost code from LiquidPlanner
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markwharton/liquidplanner",
3
- "version": "1.9.0",
3
+ "version": "1.11.0",
4
4
  "description": "LiquidPlanner API client for timesheet integration",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",