@letpeoplework/lighthouse-client 0.8.0 → 1.0.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.
package/dist/index.cjs CHANGED
@@ -703,6 +703,55 @@ var requestNoContent = async (configuration, dependencies, route, requestOptions
703
703
  var getResolvedMetricsDateRange = (range) => range ?? getDefaultMetricsDateRange();
704
704
  var getMetricsDateRangeQuery = (range) => `startDate=${encodeURIComponent(range.startDate)}&endDate=${encodeURIComponent(range.endDate)}`;
705
705
  var getMetricsAsOfDateQuery = (asOfDate) => `asOfDate=${encodeURIComponent(asOfDate)}`;
706
+ var addUtcDays = (dateStr, days) => {
707
+ const d = /* @__PURE__ */ new Date(`${dateStr}T00:00:00Z`);
708
+ d.setUTCDate(d.getUTCDate() + days);
709
+ return d.toISOString().split("T")[0];
710
+ };
711
+ var computeItemAge = (dayDate, startedDate) => {
712
+ const day = Date.parse(`${dayDate}T00:00:00Z`);
713
+ const startedDateOnly = startedDate.substring(0, 10);
714
+ const started = Date.parse(`${startedDateOnly}T00:00:00Z`);
715
+ const diffDays = Math.floor((day - started) / 864e5);
716
+ return Math.max(1, diffDays + 1);
717
+ };
718
+ var deriveWorkItemAgeOverTime = (startDate, endDate, wipData) => {
719
+ const daily = Object.entries(
720
+ wipData.workItemsPerUnitOfTime
721
+ ).map(([dayIndexStr, items]) => {
722
+ const dayIndex = Number.parseInt(dayIndexStr, 10);
723
+ const date = addUtcDays(startDate, dayIndex);
724
+ const ageItems = items.filter(
725
+ (item) => item.startedDate != null && item.startedDate.length > 0
726
+ ).map((item) => ({
727
+ id: item.id,
728
+ name: item.name,
729
+ referenceId: item.referenceId,
730
+ age: computeItemAge(date, item.startedDate)
731
+ }));
732
+ return { date, items: ageItems };
733
+ });
734
+ daily.sort((a, b) => a.date.localeCompare(b.date));
735
+ return { startDate, endDate, daily };
736
+ };
737
+ var deriveTotalWorkItemAgeOverTime = (startDate, endDate, wipData) => {
738
+ const daily = Object.entries(
739
+ wipData.workItemsPerUnitOfTime
740
+ ).map(([dayIndexStr, items]) => {
741
+ const dayIndex = Number.parseInt(dayIndexStr, 10);
742
+ const date = addUtcDays(startDate, dayIndex);
743
+ const activeItems = items.filter(
744
+ (item) => item.startedDate != null && item.startedDate.length > 0
745
+ );
746
+ const totalAge = activeItems.reduce(
747
+ (sum, item) => sum + computeItemAge(date, item.startedDate),
748
+ 0
749
+ );
750
+ return { date, totalAge, itemCount: activeItems.length };
751
+ });
752
+ daily.sort((a, b) => a.date.localeCompare(b.date));
753
+ return { startDate, endDate, daily };
754
+ };
706
755
  var createLighthouseClient = (configuration, dependencies = {}) => ({
707
756
  checkConnectivity: async () => {
708
757
  const fetchDependency = getFetchDependency(dependencies);
@@ -897,6 +946,42 @@ var createLighthouseClient = (configuration, dependencies = {}) => ({
897
946
  { method: "GET" }
898
947
  );
899
948
  },
949
+ getTeamWorkItemAgeOverTime: async (teamId, range) => {
950
+ const r = getResolvedMetricsDateRange(range);
951
+ const wipResult = await requestJson(
952
+ configuration,
953
+ dependencies,
954
+ `/v1/teams/${teamId}/metrics/wipOverTime?${getMetricsDateRangeQuery(r)}`,
955
+ { method: "GET" }
956
+ );
957
+ if (!wipResult.ok) {
958
+ return wipResult;
959
+ }
960
+ return {
961
+ ok: true,
962
+ value: deriveWorkItemAgeOverTime(r.startDate, r.endDate, wipResult.value)
963
+ };
964
+ },
965
+ getTeamTotalWorkItemAgeOverTime: async (teamId, range) => {
966
+ const r = getResolvedMetricsDateRange(range);
967
+ const wipResult = await requestJson(
968
+ configuration,
969
+ dependencies,
970
+ `/v1/teams/${teamId}/metrics/wipOverTime?${getMetricsDateRangeQuery(r)}`,
971
+ { method: "GET" }
972
+ );
973
+ if (!wipResult.ok) {
974
+ return wipResult;
975
+ }
976
+ return {
977
+ ok: true,
978
+ value: deriveTotalWorkItemAgeOverTime(
979
+ r.startDate,
980
+ r.endDate,
981
+ wipResult.value
982
+ )
983
+ };
984
+ },
900
985
  getPortfolioThroughput: async (portfolioId, range) => {
901
986
  const r = getResolvedMetricsDateRange(range);
902
987
  return requestJson(
@@ -972,6 +1057,42 @@ var createLighthouseClient = (configuration, dependencies = {}) => ({
972
1057
  { method: "GET" }
973
1058
  );
974
1059
  },
1060
+ getPortfolioWorkItemAgeOverTime: async (portfolioId, range) => {
1061
+ const r = getResolvedMetricsDateRange(range);
1062
+ const wipResult = await requestJson(
1063
+ configuration,
1064
+ dependencies,
1065
+ `/v1/portfolios/${portfolioId}/metrics/wipOverTime?${getMetricsDateRangeQuery(r)}`,
1066
+ { method: "GET" }
1067
+ );
1068
+ if (!wipResult.ok) {
1069
+ return wipResult;
1070
+ }
1071
+ return {
1072
+ ok: true,
1073
+ value: deriveWorkItemAgeOverTime(r.startDate, r.endDate, wipResult.value)
1074
+ };
1075
+ },
1076
+ getPortfolioTotalWorkItemAgeOverTime: async (portfolioId, range) => {
1077
+ const r = getResolvedMetricsDateRange(range);
1078
+ const wipResult = await requestJson(
1079
+ configuration,
1080
+ dependencies,
1081
+ `/v1/portfolios/${portfolioId}/metrics/wipOverTime?${getMetricsDateRangeQuery(r)}`,
1082
+ { method: "GET" }
1083
+ );
1084
+ if (!wipResult.ok) {
1085
+ return wipResult;
1086
+ }
1087
+ return {
1088
+ ok: true,
1089
+ value: deriveTotalWorkItemAgeOverTime(
1090
+ r.startDate,
1091
+ r.endDate,
1092
+ wipResult.value
1093
+ )
1094
+ };
1095
+ },
975
1096
  getFeaturesByIds: async (ids) => {
976
1097
  const queryString = ids.map((id) => `ids=${encodeURIComponent(id)}`).join("&");
977
1098
  return requestJson(
package/dist/index.d.cts CHANGED
@@ -169,6 +169,31 @@ type BacktestInput = {
169
169
  readonly historicalStartDate: string;
170
170
  readonly historicalEndDate: string;
171
171
  };
172
+ type WorkItemAgeEntry = {
173
+ readonly id: number;
174
+ readonly name: string;
175
+ readonly referenceId: string;
176
+ readonly age: number;
177
+ };
178
+ type DailyWorkItemAge = {
179
+ readonly date: string;
180
+ readonly items: readonly WorkItemAgeEntry[];
181
+ };
182
+ type DailyTotalWorkItemAge = {
183
+ readonly date: string;
184
+ readonly totalAge: number;
185
+ readonly itemCount: number;
186
+ };
187
+ type WorkItemAgeOverTimeResult = {
188
+ readonly startDate: string;
189
+ readonly endDate: string;
190
+ readonly daily: readonly DailyWorkItemAge[];
191
+ };
192
+ type TotalWorkItemAgeOverTimeResult = {
193
+ readonly startDate: string;
194
+ readonly endDate: string;
195
+ readonly daily: readonly DailyTotalWorkItemAge[];
196
+ };
172
197
  type LighthouseClient = {
173
198
  readonly checkConnectivity: () => Promise<ConnectivityValidationResult>;
174
199
  readonly getVersion: () => Promise<LighthouseApiResult<string>>;
@@ -205,8 +230,12 @@ type LighthouseClient = {
205
230
  readonly getPortfolioWip: (portfolioId: number, asOfDate: string) => Promise<LighthouseApiResult<readonly unknown[]>>;
206
231
  readonly getPortfolioCycleTimeData: (portfolioId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<readonly unknown[]>>;
207
232
  readonly getPortfolioPredictabilityScore: (portfolioId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<unknown>>;
233
+ readonly getTeamWorkItemAgeOverTime: (teamId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<WorkItemAgeOverTimeResult>>;
234
+ readonly getTeamTotalWorkItemAgeOverTime: (teamId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<TotalWorkItemAgeOverTimeResult>>;
208
235
  readonly getPortfolioTotalWorkItemAge: (portfolioId: number, asOfDate: string) => Promise<LighthouseApiResult<number>>;
209
236
  readonly getPortfolioTotalWorkItemAgeInfo: (portfolioId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<unknown>>;
237
+ readonly getPortfolioWorkItemAgeOverTime: (portfolioId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<WorkItemAgeOverTimeResult>>;
238
+ readonly getPortfolioTotalWorkItemAgeOverTime: (portfolioId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<TotalWorkItemAgeOverTimeResult>>;
210
239
  readonly getFeaturesByIds: (ids: readonly number[]) => Promise<LighthouseApiResult<readonly unknown[]>>;
211
240
  readonly getFeaturesByReferences: (refs: readonly string[]) => Promise<LighthouseApiResult<readonly unknown[]>>;
212
241
  readonly getFeatureWorkItems: (featureId: number) => Promise<LighthouseApiResult<readonly unknown[]>>;
@@ -222,4 +251,4 @@ type LighthouseClientDependencies = {
222
251
  };
223
252
  declare const createLighthouseClient: (configuration: LighthouseClientConfiguration, dependencies?: LighthouseClientDependencies) => LighthouseClient;
224
253
 
225
- export { type BacktestInput, type CliAuthSessionPollResult, type CliAuthSessionStartError, type CliAuthSessionStartOutcome, type CliAuthSessionStartResult, type CliConnection, type CliServerAuthMode, type CliServerConnection, type CliStandaloneConnection, type ClientCapability, type ClientPackageContract, type ConnectivityCategory, type ConnectivityDependencies, type ConnectivityFetchResponse, type ConnectivityValidationResult, type LighthouseApiError, type LighthouseApiResult, type LighthouseAuthContext, type LighthouseAuthOverrides, type LighthouseAuthStatus, type LighthouseAuthStore, type LighthouseClient, type LighthouseClientAuth, type LighthouseClientConfiguration, type LighthouseClientDependencies, type LighthouseConnectionConfiguration, type LighthouseWritePayload, type ManualForecastInput, type MetricsDateRange, type ResolvedLighthouseEndpoint, type ServerAuthModeResult, type StandaloneDiscoveryContract, type StandaloneDiscoveryContractParseResult, type StoredLighthouseAuth, createLighthouseAuthContext, createLighthouseClient, getClientPackageContract, getDefaultMetricsDateRange, getStandaloneDiscoveryLockfilePath, loadStandaloneDiscoveryContract, parseStandaloneDiscoveryContract, pollCliAuthSession, queryServerAuthMode, startCliAuthSession, validateLighthouseConnectivity };
254
+ export { type BacktestInput, type CliAuthSessionPollResult, type CliAuthSessionStartError, type CliAuthSessionStartOutcome, type CliAuthSessionStartResult, type CliConnection, type CliServerAuthMode, type CliServerConnection, type CliStandaloneConnection, type ClientCapability, type ClientPackageContract, type ConnectivityCategory, type ConnectivityDependencies, type ConnectivityFetchResponse, type ConnectivityValidationResult, type DailyTotalWorkItemAge, type DailyWorkItemAge, type LighthouseApiError, type LighthouseApiResult, type LighthouseAuthContext, type LighthouseAuthOverrides, type LighthouseAuthStatus, type LighthouseAuthStore, type LighthouseClient, type LighthouseClientAuth, type LighthouseClientConfiguration, type LighthouseClientDependencies, type LighthouseConnectionConfiguration, type LighthouseWritePayload, type ManualForecastInput, type MetricsDateRange, type ResolvedLighthouseEndpoint, type ServerAuthModeResult, type StandaloneDiscoveryContract, type StandaloneDiscoveryContractParseResult, type StoredLighthouseAuth, type TotalWorkItemAgeOverTimeResult, type WorkItemAgeEntry, type WorkItemAgeOverTimeResult, createLighthouseAuthContext, createLighthouseClient, getClientPackageContract, getDefaultMetricsDateRange, getStandaloneDiscoveryLockfilePath, loadStandaloneDiscoveryContract, parseStandaloneDiscoveryContract, pollCliAuthSession, queryServerAuthMode, startCliAuthSession, validateLighthouseConnectivity };
package/dist/index.d.ts CHANGED
@@ -169,6 +169,31 @@ type BacktestInput = {
169
169
  readonly historicalStartDate: string;
170
170
  readonly historicalEndDate: string;
171
171
  };
172
+ type WorkItemAgeEntry = {
173
+ readonly id: number;
174
+ readonly name: string;
175
+ readonly referenceId: string;
176
+ readonly age: number;
177
+ };
178
+ type DailyWorkItemAge = {
179
+ readonly date: string;
180
+ readonly items: readonly WorkItemAgeEntry[];
181
+ };
182
+ type DailyTotalWorkItemAge = {
183
+ readonly date: string;
184
+ readonly totalAge: number;
185
+ readonly itemCount: number;
186
+ };
187
+ type WorkItemAgeOverTimeResult = {
188
+ readonly startDate: string;
189
+ readonly endDate: string;
190
+ readonly daily: readonly DailyWorkItemAge[];
191
+ };
192
+ type TotalWorkItemAgeOverTimeResult = {
193
+ readonly startDate: string;
194
+ readonly endDate: string;
195
+ readonly daily: readonly DailyTotalWorkItemAge[];
196
+ };
172
197
  type LighthouseClient = {
173
198
  readonly checkConnectivity: () => Promise<ConnectivityValidationResult>;
174
199
  readonly getVersion: () => Promise<LighthouseApiResult<string>>;
@@ -205,8 +230,12 @@ type LighthouseClient = {
205
230
  readonly getPortfolioWip: (portfolioId: number, asOfDate: string) => Promise<LighthouseApiResult<readonly unknown[]>>;
206
231
  readonly getPortfolioCycleTimeData: (portfolioId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<readonly unknown[]>>;
207
232
  readonly getPortfolioPredictabilityScore: (portfolioId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<unknown>>;
233
+ readonly getTeamWorkItemAgeOverTime: (teamId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<WorkItemAgeOverTimeResult>>;
234
+ readonly getTeamTotalWorkItemAgeOverTime: (teamId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<TotalWorkItemAgeOverTimeResult>>;
208
235
  readonly getPortfolioTotalWorkItemAge: (portfolioId: number, asOfDate: string) => Promise<LighthouseApiResult<number>>;
209
236
  readonly getPortfolioTotalWorkItemAgeInfo: (portfolioId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<unknown>>;
237
+ readonly getPortfolioWorkItemAgeOverTime: (portfolioId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<WorkItemAgeOverTimeResult>>;
238
+ readonly getPortfolioTotalWorkItemAgeOverTime: (portfolioId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<TotalWorkItemAgeOverTimeResult>>;
210
239
  readonly getFeaturesByIds: (ids: readonly number[]) => Promise<LighthouseApiResult<readonly unknown[]>>;
211
240
  readonly getFeaturesByReferences: (refs: readonly string[]) => Promise<LighthouseApiResult<readonly unknown[]>>;
212
241
  readonly getFeatureWorkItems: (featureId: number) => Promise<LighthouseApiResult<readonly unknown[]>>;
@@ -222,4 +251,4 @@ type LighthouseClientDependencies = {
222
251
  };
223
252
  declare const createLighthouseClient: (configuration: LighthouseClientConfiguration, dependencies?: LighthouseClientDependencies) => LighthouseClient;
224
253
 
225
- export { type BacktestInput, type CliAuthSessionPollResult, type CliAuthSessionStartError, type CliAuthSessionStartOutcome, type CliAuthSessionStartResult, type CliConnection, type CliServerAuthMode, type CliServerConnection, type CliStandaloneConnection, type ClientCapability, type ClientPackageContract, type ConnectivityCategory, type ConnectivityDependencies, type ConnectivityFetchResponse, type ConnectivityValidationResult, type LighthouseApiError, type LighthouseApiResult, type LighthouseAuthContext, type LighthouseAuthOverrides, type LighthouseAuthStatus, type LighthouseAuthStore, type LighthouseClient, type LighthouseClientAuth, type LighthouseClientConfiguration, type LighthouseClientDependencies, type LighthouseConnectionConfiguration, type LighthouseWritePayload, type ManualForecastInput, type MetricsDateRange, type ResolvedLighthouseEndpoint, type ServerAuthModeResult, type StandaloneDiscoveryContract, type StandaloneDiscoveryContractParseResult, type StoredLighthouseAuth, createLighthouseAuthContext, createLighthouseClient, getClientPackageContract, getDefaultMetricsDateRange, getStandaloneDiscoveryLockfilePath, loadStandaloneDiscoveryContract, parseStandaloneDiscoveryContract, pollCliAuthSession, queryServerAuthMode, startCliAuthSession, validateLighthouseConnectivity };
254
+ export { type BacktestInput, type CliAuthSessionPollResult, type CliAuthSessionStartError, type CliAuthSessionStartOutcome, type CliAuthSessionStartResult, type CliConnection, type CliServerAuthMode, type CliServerConnection, type CliStandaloneConnection, type ClientCapability, type ClientPackageContract, type ConnectivityCategory, type ConnectivityDependencies, type ConnectivityFetchResponse, type ConnectivityValidationResult, type DailyTotalWorkItemAge, type DailyWorkItemAge, type LighthouseApiError, type LighthouseApiResult, type LighthouseAuthContext, type LighthouseAuthOverrides, type LighthouseAuthStatus, type LighthouseAuthStore, type LighthouseClient, type LighthouseClientAuth, type LighthouseClientConfiguration, type LighthouseClientDependencies, type LighthouseConnectionConfiguration, type LighthouseWritePayload, type ManualForecastInput, type MetricsDateRange, type ResolvedLighthouseEndpoint, type ServerAuthModeResult, type StandaloneDiscoveryContract, type StandaloneDiscoveryContractParseResult, type StoredLighthouseAuth, type TotalWorkItemAgeOverTimeResult, type WorkItemAgeEntry, type WorkItemAgeOverTimeResult, createLighthouseAuthContext, createLighthouseClient, getClientPackageContract, getDefaultMetricsDateRange, getStandaloneDiscoveryLockfilePath, loadStandaloneDiscoveryContract, parseStandaloneDiscoveryContract, pollCliAuthSession, queryServerAuthMode, startCliAuthSession, validateLighthouseConnectivity };
package/dist/index.js CHANGED
@@ -669,6 +669,55 @@ var requestNoContent = async (configuration, dependencies, route, requestOptions
669
669
  var getResolvedMetricsDateRange = (range) => range ?? getDefaultMetricsDateRange();
670
670
  var getMetricsDateRangeQuery = (range) => `startDate=${encodeURIComponent(range.startDate)}&endDate=${encodeURIComponent(range.endDate)}`;
671
671
  var getMetricsAsOfDateQuery = (asOfDate) => `asOfDate=${encodeURIComponent(asOfDate)}`;
672
+ var addUtcDays = (dateStr, days) => {
673
+ const d = /* @__PURE__ */ new Date(`${dateStr}T00:00:00Z`);
674
+ d.setUTCDate(d.getUTCDate() + days);
675
+ return d.toISOString().split("T")[0];
676
+ };
677
+ var computeItemAge = (dayDate, startedDate) => {
678
+ const day = Date.parse(`${dayDate}T00:00:00Z`);
679
+ const startedDateOnly = startedDate.substring(0, 10);
680
+ const started = Date.parse(`${startedDateOnly}T00:00:00Z`);
681
+ const diffDays = Math.floor((day - started) / 864e5);
682
+ return Math.max(1, diffDays + 1);
683
+ };
684
+ var deriveWorkItemAgeOverTime = (startDate, endDate, wipData) => {
685
+ const daily = Object.entries(
686
+ wipData.workItemsPerUnitOfTime
687
+ ).map(([dayIndexStr, items]) => {
688
+ const dayIndex = Number.parseInt(dayIndexStr, 10);
689
+ const date = addUtcDays(startDate, dayIndex);
690
+ const ageItems = items.filter(
691
+ (item) => item.startedDate != null && item.startedDate.length > 0
692
+ ).map((item) => ({
693
+ id: item.id,
694
+ name: item.name,
695
+ referenceId: item.referenceId,
696
+ age: computeItemAge(date, item.startedDate)
697
+ }));
698
+ return { date, items: ageItems };
699
+ });
700
+ daily.sort((a, b) => a.date.localeCompare(b.date));
701
+ return { startDate, endDate, daily };
702
+ };
703
+ var deriveTotalWorkItemAgeOverTime = (startDate, endDate, wipData) => {
704
+ const daily = Object.entries(
705
+ wipData.workItemsPerUnitOfTime
706
+ ).map(([dayIndexStr, items]) => {
707
+ const dayIndex = Number.parseInt(dayIndexStr, 10);
708
+ const date = addUtcDays(startDate, dayIndex);
709
+ const activeItems = items.filter(
710
+ (item) => item.startedDate != null && item.startedDate.length > 0
711
+ );
712
+ const totalAge = activeItems.reduce(
713
+ (sum, item) => sum + computeItemAge(date, item.startedDate),
714
+ 0
715
+ );
716
+ return { date, totalAge, itemCount: activeItems.length };
717
+ });
718
+ daily.sort((a, b) => a.date.localeCompare(b.date));
719
+ return { startDate, endDate, daily };
720
+ };
672
721
  var createLighthouseClient = (configuration, dependencies = {}) => ({
673
722
  checkConnectivity: async () => {
674
723
  const fetchDependency = getFetchDependency(dependencies);
@@ -863,6 +912,42 @@ var createLighthouseClient = (configuration, dependencies = {}) => ({
863
912
  { method: "GET" }
864
913
  );
865
914
  },
915
+ getTeamWorkItemAgeOverTime: async (teamId, range) => {
916
+ const r = getResolvedMetricsDateRange(range);
917
+ const wipResult = await requestJson(
918
+ configuration,
919
+ dependencies,
920
+ `/v1/teams/${teamId}/metrics/wipOverTime?${getMetricsDateRangeQuery(r)}`,
921
+ { method: "GET" }
922
+ );
923
+ if (!wipResult.ok) {
924
+ return wipResult;
925
+ }
926
+ return {
927
+ ok: true,
928
+ value: deriveWorkItemAgeOverTime(r.startDate, r.endDate, wipResult.value)
929
+ };
930
+ },
931
+ getTeamTotalWorkItemAgeOverTime: async (teamId, range) => {
932
+ const r = getResolvedMetricsDateRange(range);
933
+ const wipResult = await requestJson(
934
+ configuration,
935
+ dependencies,
936
+ `/v1/teams/${teamId}/metrics/wipOverTime?${getMetricsDateRangeQuery(r)}`,
937
+ { method: "GET" }
938
+ );
939
+ if (!wipResult.ok) {
940
+ return wipResult;
941
+ }
942
+ return {
943
+ ok: true,
944
+ value: deriveTotalWorkItemAgeOverTime(
945
+ r.startDate,
946
+ r.endDate,
947
+ wipResult.value
948
+ )
949
+ };
950
+ },
866
951
  getPortfolioThroughput: async (portfolioId, range) => {
867
952
  const r = getResolvedMetricsDateRange(range);
868
953
  return requestJson(
@@ -938,6 +1023,42 @@ var createLighthouseClient = (configuration, dependencies = {}) => ({
938
1023
  { method: "GET" }
939
1024
  );
940
1025
  },
1026
+ getPortfolioWorkItemAgeOverTime: async (portfolioId, range) => {
1027
+ const r = getResolvedMetricsDateRange(range);
1028
+ const wipResult = await requestJson(
1029
+ configuration,
1030
+ dependencies,
1031
+ `/v1/portfolios/${portfolioId}/metrics/wipOverTime?${getMetricsDateRangeQuery(r)}`,
1032
+ { method: "GET" }
1033
+ );
1034
+ if (!wipResult.ok) {
1035
+ return wipResult;
1036
+ }
1037
+ return {
1038
+ ok: true,
1039
+ value: deriveWorkItemAgeOverTime(r.startDate, r.endDate, wipResult.value)
1040
+ };
1041
+ },
1042
+ getPortfolioTotalWorkItemAgeOverTime: async (portfolioId, range) => {
1043
+ const r = getResolvedMetricsDateRange(range);
1044
+ const wipResult = await requestJson(
1045
+ configuration,
1046
+ dependencies,
1047
+ `/v1/portfolios/${portfolioId}/metrics/wipOverTime?${getMetricsDateRangeQuery(r)}`,
1048
+ { method: "GET" }
1049
+ );
1050
+ if (!wipResult.ok) {
1051
+ return wipResult;
1052
+ }
1053
+ return {
1054
+ ok: true,
1055
+ value: deriveTotalWorkItemAgeOverTime(
1056
+ r.startDate,
1057
+ r.endDate,
1058
+ wipResult.value
1059
+ )
1060
+ };
1061
+ },
941
1062
  getFeaturesByIds: async (ids) => {
942
1063
  const queryString = ids.map((id) => `ids=${encodeURIComponent(id)}`).join("&");
943
1064
  return requestJson(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letpeoplework/lighthouse-client",
3
- "version": "0.8.0",
3
+ "version": "1.0.1",
4
4
  "description": "Shared Lighthouse API client contracts",
5
5
  "repository": "https://github.com/LetPeopleWork/lighthouse-clients",
6
6
  "type": "module",