@letpeoplework/lighthouse-client 1.1.0 → 1.2.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/index.cjs +511 -351
- package/dist/index.d.cts +51 -1
- package/dist/index.d.ts +51 -1
- package/dist/index.js +510 -351
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -669,6 +669,7 @@ 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 getItemIdsQuerySuffix = (itemIds) => itemIds && itemIds.length > 0 ? itemIds.map((id) => `&itemIds=${encodeURIComponent(id)}`).join("") : "";
|
|
672
673
|
var getViewQuerySuffix = (view) => view === "filtered" ? "&view=filtered" : "";
|
|
673
674
|
var addUtcDays = (dateStr, days) => {
|
|
674
675
|
const d = /* @__PURE__ */ new Date(`${dateStr}T00:00:00Z`);
|
|
@@ -719,414 +720,572 @@ var deriveTotalWorkItemAgeOverTime = (startDate, endDate, wipData) => {
|
|
|
719
720
|
daily.sort((a, b) => a.date.localeCompare(b.date));
|
|
720
721
|
return { startDate, endDate, daily };
|
|
721
722
|
};
|
|
722
|
-
var
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
configuration,
|
|
736
|
-
dependencies,
|
|
737
|
-
"/v1/worktrackingsystemconnections",
|
|
738
|
-
{
|
|
739
|
-
method: "GET"
|
|
740
|
-
}
|
|
741
|
-
),
|
|
742
|
-
getWorkTrackingConnection: async (connectionId) => requestJson(
|
|
743
|
-
configuration,
|
|
744
|
-
dependencies,
|
|
745
|
-
`/v1/worktrackingsystemconnections/${connectionId}`,
|
|
746
|
-
{
|
|
747
|
-
method: "GET"
|
|
748
|
-
}
|
|
749
|
-
),
|
|
750
|
-
createWorkTrackingConnection: async (payload) => requestJson(
|
|
751
|
-
configuration,
|
|
752
|
-
dependencies,
|
|
753
|
-
"/v1/worktrackingsystemconnections",
|
|
754
|
-
{
|
|
755
|
-
method: "POST",
|
|
756
|
-
body: payload
|
|
757
|
-
}
|
|
758
|
-
),
|
|
759
|
-
updateWorkTrackingConnection: async (connectionId, payload) => requestJson(
|
|
760
|
-
configuration,
|
|
761
|
-
dependencies,
|
|
762
|
-
`/v1/worktrackingsystemconnections/${connectionId}`,
|
|
763
|
-
{
|
|
764
|
-
method: "PUT",
|
|
765
|
-
body: payload
|
|
766
|
-
}
|
|
767
|
-
),
|
|
768
|
-
deleteWorkTrackingConnection: async (connectionId) => requestNoContent(
|
|
769
|
-
configuration,
|
|
770
|
-
dependencies,
|
|
771
|
-
`/v1/worktrackingsystemconnections/${connectionId}`,
|
|
772
|
-
{
|
|
773
|
-
method: "DELETE"
|
|
774
|
-
}
|
|
775
|
-
),
|
|
776
|
-
listTeams: async () => requestJson(configuration, dependencies, "/v1/teams", {
|
|
777
|
-
method: "GET"
|
|
778
|
-
}),
|
|
779
|
-
getTeam: async (teamId) => requestJson(configuration, dependencies, `/v1/teams/${teamId}`, {
|
|
780
|
-
method: "GET"
|
|
781
|
-
}),
|
|
782
|
-
createTeam: async (payload) => requestJson(configuration, dependencies, "/v1/teams", {
|
|
783
|
-
method: "POST",
|
|
784
|
-
body: payload
|
|
785
|
-
}),
|
|
786
|
-
updateTeam: async (teamId, payload) => requestJson(configuration, dependencies, `/v1/teams/${teamId}`, {
|
|
787
|
-
method: "PUT",
|
|
788
|
-
body: payload
|
|
789
|
-
}),
|
|
790
|
-
deleteTeam: async (teamId) => requestNoContent(configuration, dependencies, `/v1/teams/${teamId}`, {
|
|
791
|
-
method: "DELETE"
|
|
792
|
-
}),
|
|
793
|
-
refreshTeam: async (teamId) => requestNoContent(configuration, dependencies, `/v1/teams/${teamId}`, {
|
|
794
|
-
method: "POST"
|
|
795
|
-
}),
|
|
796
|
-
listPortfolios: async () => requestJson(
|
|
797
|
-
configuration,
|
|
798
|
-
dependencies,
|
|
799
|
-
"/v1/portfolios",
|
|
800
|
-
{
|
|
801
|
-
method: "GET"
|
|
723
|
+
var FEATURE_REQUIRES_SERVER_NEWER_THAN = {
|
|
724
|
+
cumulativeStateTime: "v26.5.24.10"
|
|
725
|
+
};
|
|
726
|
+
var parseServerVersion = (raw) => {
|
|
727
|
+
const trimmed = raw.trim().replace(/^v/iu, "");
|
|
728
|
+
if (trimmed.length === 0) {
|
|
729
|
+
return null;
|
|
730
|
+
}
|
|
731
|
+
const segments = trimmed.split(".");
|
|
732
|
+
const parsed = [];
|
|
733
|
+
for (const segment of segments) {
|
|
734
|
+
if (!/^\d+$/u.test(segment)) {
|
|
735
|
+
return null;
|
|
802
736
|
}
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
807
|
-
|
|
808
|
-
|
|
809
|
-
|
|
737
|
+
parsed.push(Number(segment));
|
|
738
|
+
}
|
|
739
|
+
return parsed.length > 0 ? parsed : null;
|
|
740
|
+
};
|
|
741
|
+
var isServerVersionNewerThan = (candidate, baseline) => {
|
|
742
|
+
const left = parseServerVersion(candidate);
|
|
743
|
+
const right = parseServerVersion(baseline);
|
|
744
|
+
if (left === null || right === null) {
|
|
745
|
+
return null;
|
|
746
|
+
}
|
|
747
|
+
const length = Math.max(left.length, right.length);
|
|
748
|
+
for (let index = 0; index < length; index += 1) {
|
|
749
|
+
const l = left[index] ?? 0;
|
|
750
|
+
const r = right[index] ?? 0;
|
|
751
|
+
if (l !== r) {
|
|
752
|
+
return l > r;
|
|
810
753
|
}
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
754
|
+
}
|
|
755
|
+
return false;
|
|
756
|
+
};
|
|
757
|
+
var createLighthouseClient = (configuration, dependencies = {}) => {
|
|
758
|
+
let cachedServerVersion;
|
|
759
|
+
const getCachedServerVersion = async () => {
|
|
760
|
+
if (cachedServerVersion === void 0) {
|
|
761
|
+
const result = await requestText(
|
|
762
|
+
configuration,
|
|
763
|
+
dependencies,
|
|
764
|
+
"/v1/version/current"
|
|
765
|
+
);
|
|
766
|
+
cachedServerVersion = result.ok ? result.value : null;
|
|
823
767
|
}
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
method: "DELETE"
|
|
768
|
+
return cachedServerVersion;
|
|
769
|
+
};
|
|
770
|
+
const ensureServerSupports = async (feature) => {
|
|
771
|
+
const version = await getCachedServerVersion();
|
|
772
|
+
if (version === null) {
|
|
773
|
+
return null;
|
|
831
774
|
}
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
`/v1/portfolios/${portfolioId}/refresh`,
|
|
837
|
-
{
|
|
838
|
-
method: "POST"
|
|
775
|
+
const baseline = FEATURE_REQUIRES_SERVER_NEWER_THAN[feature];
|
|
776
|
+
const newer = isServerVersionNewerThan(version, baseline);
|
|
777
|
+
if (newer === null || newer) {
|
|
778
|
+
return null;
|
|
839
779
|
}
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
780
|
+
return {
|
|
781
|
+
ok: false,
|
|
782
|
+
error: {
|
|
783
|
+
category: "misconfigured",
|
|
784
|
+
reason: `This Lighthouse server (${version}) does not support "${feature}" \u2014 it requires a version newer than ${baseline}. Upgrade Lighthouse to use this client feature.`
|
|
785
|
+
}
|
|
786
|
+
};
|
|
787
|
+
};
|
|
788
|
+
return {
|
|
789
|
+
checkConnectivity: async () => {
|
|
790
|
+
const fetchDependency = getFetchDependency(dependencies);
|
|
791
|
+
return validateLighthouseConnectivity(
|
|
792
|
+
configuration.connection,
|
|
793
|
+
{
|
|
794
|
+
fetch: fetchDependency
|
|
795
|
+
},
|
|
796
|
+
getRequestInit(configuration.auth)
|
|
797
|
+
);
|
|
798
|
+
},
|
|
799
|
+
getVersion: async () => requestText(configuration, dependencies, "/v1/version/current"),
|
|
800
|
+
listWorkTrackingConnections: async () => requestJson(
|
|
844
801
|
configuration,
|
|
845
802
|
dependencies,
|
|
846
|
-
|
|
847
|
-
{
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
return requestJson(
|
|
803
|
+
"/v1/worktrackingsystemconnections",
|
|
804
|
+
{
|
|
805
|
+
method: "GET"
|
|
806
|
+
}
|
|
807
|
+
),
|
|
808
|
+
getWorkTrackingConnection: async (connectionId) => requestJson(
|
|
853
809
|
configuration,
|
|
854
810
|
dependencies,
|
|
855
|
-
`/v1/
|
|
856
|
-
{
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
return requestJson(
|
|
811
|
+
`/v1/worktrackingsystemconnections/${connectionId}`,
|
|
812
|
+
{
|
|
813
|
+
method: "GET"
|
|
814
|
+
}
|
|
815
|
+
),
|
|
816
|
+
createWorkTrackingConnection: async (payload) => requestJson(
|
|
862
817
|
configuration,
|
|
863
818
|
dependencies,
|
|
864
|
-
|
|
865
|
-
{
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
`/v1/teams/${teamId}/metrics/wip?${getMetricsAsOfDateQuery(asOfDate)}`,
|
|
872
|
-
{ method: "GET" }
|
|
873
|
-
),
|
|
874
|
-
getTeamCycleTimePercentiles: async (teamId, range) => {
|
|
875
|
-
const r = getResolvedMetricsDateRange(range);
|
|
876
|
-
return requestJson(
|
|
819
|
+
"/v1/worktrackingsystemconnections",
|
|
820
|
+
{
|
|
821
|
+
method: "POST",
|
|
822
|
+
body: payload
|
|
823
|
+
}
|
|
824
|
+
),
|
|
825
|
+
updateWorkTrackingConnection: async (connectionId, payload) => requestJson(
|
|
877
826
|
configuration,
|
|
878
827
|
dependencies,
|
|
879
|
-
`/v1/
|
|
880
|
-
{
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
828
|
+
`/v1/worktrackingsystemconnections/${connectionId}`,
|
|
829
|
+
{
|
|
830
|
+
method: "PUT",
|
|
831
|
+
body: payload
|
|
832
|
+
}
|
|
833
|
+
),
|
|
834
|
+
deleteWorkTrackingConnection: async (connectionId) => requestNoContent(
|
|
886
835
|
configuration,
|
|
887
836
|
dependencies,
|
|
888
|
-
`/v1/
|
|
889
|
-
{
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
return requestJson(
|
|
837
|
+
`/v1/worktrackingsystemconnections/${connectionId}`,
|
|
838
|
+
{
|
|
839
|
+
method: "DELETE"
|
|
840
|
+
}
|
|
841
|
+
),
|
|
842
|
+
listTeams: async () => requestJson(
|
|
895
843
|
configuration,
|
|
896
844
|
dependencies,
|
|
897
|
-
|
|
898
|
-
{
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
configuration,
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
845
|
+
"/v1/teams",
|
|
846
|
+
{
|
|
847
|
+
method: "GET"
|
|
848
|
+
}
|
|
849
|
+
),
|
|
850
|
+
getTeam: async (teamId) => requestJson(configuration, dependencies, `/v1/teams/${teamId}`, {
|
|
851
|
+
method: "GET"
|
|
852
|
+
}),
|
|
853
|
+
createTeam: async (payload) => requestJson(configuration, dependencies, "/v1/teams", {
|
|
854
|
+
method: "POST",
|
|
855
|
+
body: payload
|
|
856
|
+
}),
|
|
857
|
+
updateTeam: async (teamId, payload) => requestJson(configuration, dependencies, `/v1/teams/${teamId}`, {
|
|
858
|
+
method: "PUT",
|
|
859
|
+
body: payload
|
|
860
|
+
}),
|
|
861
|
+
deleteTeam: async (teamId) => requestNoContent(configuration, dependencies, `/v1/teams/${teamId}`, {
|
|
862
|
+
method: "DELETE"
|
|
863
|
+
}),
|
|
864
|
+
refreshTeam: async (teamId) => requestNoContent(configuration, dependencies, `/v1/teams/${teamId}`, {
|
|
865
|
+
method: "POST"
|
|
866
|
+
}),
|
|
867
|
+
listPortfolios: async () => requestJson(
|
|
910
868
|
configuration,
|
|
911
869
|
dependencies,
|
|
912
|
-
|
|
913
|
-
{
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
const wipResult = await requestJson(
|
|
870
|
+
"/v1/portfolios",
|
|
871
|
+
{
|
|
872
|
+
method: "GET"
|
|
873
|
+
}
|
|
874
|
+
),
|
|
875
|
+
getPortfolio: async (portfolioId) => requestJson(
|
|
919
876
|
configuration,
|
|
920
877
|
dependencies,
|
|
921
|
-
`/v1/
|
|
922
|
-
{
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
},
|
|
932
|
-
getTeamTotalWorkItemAgeOverTime: async (teamId, range) => {
|
|
933
|
-
const r = getResolvedMetricsDateRange(range);
|
|
934
|
-
const wipResult = await requestJson(
|
|
878
|
+
`/v1/portfolios/${portfolioId}`,
|
|
879
|
+
{
|
|
880
|
+
method: "GET"
|
|
881
|
+
}
|
|
882
|
+
),
|
|
883
|
+
createPortfolio: async (payload) => requestJson(configuration, dependencies, "/v1/portfolios", {
|
|
884
|
+
method: "POST",
|
|
885
|
+
body: payload
|
|
886
|
+
}),
|
|
887
|
+
updatePortfolio: async (portfolioId, payload) => requestJson(
|
|
935
888
|
configuration,
|
|
936
889
|
dependencies,
|
|
937
|
-
`/v1/
|
|
938
|
-
{
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
ok: true,
|
|
945
|
-
value: deriveTotalWorkItemAgeOverTime(
|
|
946
|
-
r.startDate,
|
|
947
|
-
r.endDate,
|
|
948
|
-
wipResult.value
|
|
949
|
-
)
|
|
950
|
-
};
|
|
951
|
-
},
|
|
952
|
-
getPortfolioThroughput: async (portfolioId, range) => {
|
|
953
|
-
const r = getResolvedMetricsDateRange(range);
|
|
954
|
-
return requestJson(
|
|
890
|
+
`/v1/portfolios/${portfolioId}`,
|
|
891
|
+
{
|
|
892
|
+
method: "PUT",
|
|
893
|
+
body: payload
|
|
894
|
+
}
|
|
895
|
+
),
|
|
896
|
+
deletePortfolio: async (portfolioId) => requestNoContent(
|
|
955
897
|
configuration,
|
|
956
898
|
dependencies,
|
|
957
|
-
`/v1/portfolios/${portfolioId}
|
|
958
|
-
{
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
return requestJson(
|
|
899
|
+
`/v1/portfolios/${portfolioId}`,
|
|
900
|
+
{
|
|
901
|
+
method: "DELETE"
|
|
902
|
+
}
|
|
903
|
+
),
|
|
904
|
+
refreshPortfolio: async (portfolioId) => requestNoContent(
|
|
964
905
|
configuration,
|
|
965
906
|
dependencies,
|
|
966
|
-
`/v1/portfolios/${portfolioId}/
|
|
967
|
-
{
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
907
|
+
`/v1/portfolios/${portfolioId}/refresh`,
|
|
908
|
+
{
|
|
909
|
+
method: "POST"
|
|
910
|
+
}
|
|
911
|
+
),
|
|
912
|
+
getTeamThroughput: async (teamId, range, view) => {
|
|
913
|
+
const r = getResolvedMetricsDateRange(range);
|
|
914
|
+
return requestJson(
|
|
915
|
+
configuration,
|
|
916
|
+
dependencies,
|
|
917
|
+
`/v1/teams/${teamId}/metrics/throughput?${getMetricsDateRangeQuery(r)}${getViewQuerySuffix(view)}`,
|
|
918
|
+
{ method: "GET" }
|
|
919
|
+
);
|
|
920
|
+
},
|
|
921
|
+
getTeamArrivals: async (teamId, range) => {
|
|
922
|
+
const r = getResolvedMetricsDateRange(range);
|
|
923
|
+
return requestJson(
|
|
924
|
+
configuration,
|
|
925
|
+
dependencies,
|
|
926
|
+
`/v1/teams/${teamId}/metrics/arrivals?${getMetricsDateRangeQuery(r)}`,
|
|
927
|
+
{ method: "GET" }
|
|
928
|
+
);
|
|
929
|
+
},
|
|
930
|
+
getTeamWipOverTime: async (teamId, range) => {
|
|
931
|
+
const r = getResolvedMetricsDateRange(range);
|
|
932
|
+
return requestJson(
|
|
933
|
+
configuration,
|
|
934
|
+
dependencies,
|
|
935
|
+
`/v1/teams/${teamId}/metrics/wipOverTime?${getMetricsDateRangeQuery(r)}`,
|
|
936
|
+
{ method: "GET" }
|
|
937
|
+
);
|
|
938
|
+
},
|
|
939
|
+
getTeamWip: async (teamId, asOfDate) => requestJson(
|
|
973
940
|
configuration,
|
|
974
941
|
dependencies,
|
|
975
|
-
`/v1/
|
|
942
|
+
`/v1/teams/${teamId}/metrics/wip?${getMetricsAsOfDateQuery(asOfDate)}`,
|
|
976
943
|
{ method: "GET" }
|
|
977
|
-
)
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
944
|
+
),
|
|
945
|
+
getTeamCycleTimePercentiles: async (teamId, range) => {
|
|
946
|
+
const r = getResolvedMetricsDateRange(range);
|
|
947
|
+
return requestJson(
|
|
948
|
+
configuration,
|
|
949
|
+
dependencies,
|
|
950
|
+
`/v1/teams/${teamId}/metrics/cycleTimePercentiles?${getMetricsDateRangeQuery(r)}`,
|
|
951
|
+
{ method: "GET" }
|
|
952
|
+
);
|
|
953
|
+
},
|
|
954
|
+
getTeamCycleTimeData: async (teamId, range) => {
|
|
955
|
+
const r = getResolvedMetricsDateRange(range);
|
|
956
|
+
return requestJson(
|
|
957
|
+
configuration,
|
|
958
|
+
dependencies,
|
|
959
|
+
`/v1/teams/${teamId}/metrics/cycleTimeData?${getMetricsDateRangeQuery(r)}`,
|
|
960
|
+
{ method: "GET" }
|
|
961
|
+
);
|
|
962
|
+
},
|
|
963
|
+
getTeamPredictabilityScore: async (teamId, range, view) => {
|
|
964
|
+
const r = getResolvedMetricsDateRange(range);
|
|
965
|
+
return requestJson(
|
|
966
|
+
configuration,
|
|
967
|
+
dependencies,
|
|
968
|
+
`/v1/teams/${teamId}/metrics/multiitemforecastpredictabilityscore?${getMetricsDateRangeQuery(r)}${getViewQuerySuffix(view)}`,
|
|
969
|
+
{ method: "GET" }
|
|
970
|
+
);
|
|
971
|
+
},
|
|
972
|
+
getTeamTotalWorkItemAge: async (teamId, asOfDate) => requestJson(
|
|
982
973
|
configuration,
|
|
983
974
|
dependencies,
|
|
984
|
-
`/v1/
|
|
975
|
+
`/v1/teams/${teamId}/metrics/totalWorkItemAge?${getMetricsAsOfDateQuery(asOfDate)}`,
|
|
985
976
|
{ method: "GET" }
|
|
986
|
-
)
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
977
|
+
),
|
|
978
|
+
getTeamTotalWorkItemAgeInfo: async (teamId, range) => {
|
|
979
|
+
const r = getResolvedMetricsDateRange(range);
|
|
980
|
+
return requestJson(
|
|
981
|
+
configuration,
|
|
982
|
+
dependencies,
|
|
983
|
+
`/v1/teams/${teamId}/metrics/totalWorkItemAgeInfo?${getMetricsDateRangeQuery(r)}`,
|
|
984
|
+
{ method: "GET" }
|
|
985
|
+
);
|
|
986
|
+
},
|
|
987
|
+
getTeamWorkItemAgeOverTime: async (teamId, range) => {
|
|
988
|
+
const r = getResolvedMetricsDateRange(range);
|
|
989
|
+
const wipResult = await requestJson(
|
|
990
|
+
configuration,
|
|
991
|
+
dependencies,
|
|
992
|
+
`/v1/teams/${teamId}/metrics/wipOverTime?${getMetricsDateRangeQuery(r)}`,
|
|
993
|
+
{ method: "GET" }
|
|
994
|
+
);
|
|
995
|
+
if (!wipResult.ok) {
|
|
996
|
+
return wipResult;
|
|
997
|
+
}
|
|
998
|
+
return {
|
|
999
|
+
ok: true,
|
|
1000
|
+
value: deriveWorkItemAgeOverTime(
|
|
1001
|
+
r.startDate,
|
|
1002
|
+
r.endDate,
|
|
1003
|
+
wipResult.value
|
|
1004
|
+
)
|
|
1005
|
+
};
|
|
1006
|
+
},
|
|
1007
|
+
getTeamTotalWorkItemAgeOverTime: async (teamId, range) => {
|
|
1008
|
+
const r = getResolvedMetricsDateRange(range);
|
|
1009
|
+
const wipResult = await requestJson(
|
|
1010
|
+
configuration,
|
|
1011
|
+
dependencies,
|
|
1012
|
+
`/v1/teams/${teamId}/metrics/wipOverTime?${getMetricsDateRangeQuery(r)}`,
|
|
1013
|
+
{ method: "GET" }
|
|
1014
|
+
);
|
|
1015
|
+
if (!wipResult.ok) {
|
|
1016
|
+
return wipResult;
|
|
1017
|
+
}
|
|
1018
|
+
return {
|
|
1019
|
+
ok: true,
|
|
1020
|
+
value: deriveTotalWorkItemAgeOverTime(
|
|
1021
|
+
r.startDate,
|
|
1022
|
+
r.endDate,
|
|
1023
|
+
wipResult.value
|
|
1024
|
+
)
|
|
1025
|
+
};
|
|
1026
|
+
},
|
|
1027
|
+
getPortfolioThroughput: async (portfolioId, range) => {
|
|
1028
|
+
const r = getResolvedMetricsDateRange(range);
|
|
1029
|
+
return requestJson(
|
|
1030
|
+
configuration,
|
|
1031
|
+
dependencies,
|
|
1032
|
+
`/v1/portfolios/${portfolioId}/metrics/throughput?${getMetricsDateRangeQuery(r)}`,
|
|
1033
|
+
{ method: "GET" }
|
|
1034
|
+
);
|
|
1035
|
+
},
|
|
1036
|
+
getPortfolioCycleTimePercentiles: async (portfolioId, range) => {
|
|
1037
|
+
const r = getResolvedMetricsDateRange(range);
|
|
1038
|
+
return requestJson(
|
|
1039
|
+
configuration,
|
|
1040
|
+
dependencies,
|
|
1041
|
+
`/v1/portfolios/${portfolioId}/metrics/cycleTimePercentiles?${getMetricsDateRangeQuery(r)}`,
|
|
1042
|
+
{ method: "GET" }
|
|
1043
|
+
);
|
|
1044
|
+
},
|
|
1045
|
+
getPortfolioArrivals: async (portfolioId, range) => {
|
|
1046
|
+
const r = getResolvedMetricsDateRange(range);
|
|
1047
|
+
return requestJson(
|
|
1048
|
+
configuration,
|
|
1049
|
+
dependencies,
|
|
1050
|
+
`/v1/portfolios/${portfolioId}/metrics/arrivals?${getMetricsDateRangeQuery(r)}`,
|
|
1051
|
+
{ method: "GET" }
|
|
1052
|
+
);
|
|
1053
|
+
},
|
|
1054
|
+
getPortfolioWipOverTime: async (portfolioId, range) => {
|
|
1055
|
+
const r = getResolvedMetricsDateRange(range);
|
|
1056
|
+
return requestJson(
|
|
1057
|
+
configuration,
|
|
1058
|
+
dependencies,
|
|
1059
|
+
`/v1/portfolios/${portfolioId}/metrics/wipOverTime?${getMetricsDateRangeQuery(r)}`,
|
|
1060
|
+
{ method: "GET" }
|
|
1061
|
+
);
|
|
1062
|
+
},
|
|
1063
|
+
getPortfolioWip: async (portfolioId, asOfDate) => requestJson(
|
|
997
1064
|
configuration,
|
|
998
1065
|
dependencies,
|
|
999
|
-
`/v1/portfolios/${portfolioId}/metrics/
|
|
1066
|
+
`/v1/portfolios/${portfolioId}/metrics/wip?${getMetricsAsOfDateQuery(asOfDate)}`,
|
|
1000
1067
|
{ method: "GET" }
|
|
1001
|
-
)
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1068
|
+
),
|
|
1069
|
+
getPortfolioCycleTimeData: async (portfolioId, range) => {
|
|
1070
|
+
const r = getResolvedMetricsDateRange(range);
|
|
1071
|
+
return requestJson(
|
|
1072
|
+
configuration,
|
|
1073
|
+
dependencies,
|
|
1074
|
+
`/v1/portfolios/${portfolioId}/metrics/cycleTimeData?${getMetricsDateRangeQuery(r)}`,
|
|
1075
|
+
{ method: "GET" }
|
|
1076
|
+
);
|
|
1077
|
+
},
|
|
1078
|
+
getPortfolioPredictabilityScore: async (portfolioId, range) => {
|
|
1079
|
+
const r = getResolvedMetricsDateRange(range);
|
|
1080
|
+
return requestJson(
|
|
1081
|
+
configuration,
|
|
1082
|
+
dependencies,
|
|
1083
|
+
`/v1/portfolios/${portfolioId}/metrics/multiitemforecastpredictabilityscore?${getMetricsDateRangeQuery(r)}`,
|
|
1084
|
+
{ method: "GET" }
|
|
1085
|
+
);
|
|
1086
|
+
},
|
|
1087
|
+
getPortfolioTotalWorkItemAge: async (portfolioId, asOfDate) => requestJson(
|
|
1006
1088
|
configuration,
|
|
1007
1089
|
dependencies,
|
|
1008
|
-
`/v1/portfolios/${portfolioId}/metrics/
|
|
1090
|
+
`/v1/portfolios/${portfolioId}/metrics/totalWorkItemAge?${getMetricsAsOfDateQuery(asOfDate)}`,
|
|
1009
1091
|
{ method: "GET" }
|
|
1010
|
-
)
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1092
|
+
),
|
|
1093
|
+
getPortfolioTotalWorkItemAgeInfo: async (portfolioId, range) => {
|
|
1094
|
+
const r = getResolvedMetricsDateRange(range);
|
|
1095
|
+
return requestJson(
|
|
1096
|
+
configuration,
|
|
1097
|
+
dependencies,
|
|
1098
|
+
`/v1/portfolios/${portfolioId}/metrics/totalWorkItemAgeInfo?${getMetricsDateRangeQuery(r)}`,
|
|
1099
|
+
{ method: "GET" }
|
|
1100
|
+
);
|
|
1101
|
+
},
|
|
1102
|
+
getPortfolioWorkItemAgeOverTime: async (portfolioId, range) => {
|
|
1103
|
+
const r = getResolvedMetricsDateRange(range);
|
|
1104
|
+
const wipResult = await requestJson(
|
|
1105
|
+
configuration,
|
|
1106
|
+
dependencies,
|
|
1107
|
+
`/v1/portfolios/${portfolioId}/metrics/wipOverTime?${getMetricsDateRangeQuery(r)}`,
|
|
1108
|
+
{ method: "GET" }
|
|
1109
|
+
);
|
|
1110
|
+
if (!wipResult.ok) {
|
|
1111
|
+
return wipResult;
|
|
1112
|
+
}
|
|
1113
|
+
return {
|
|
1114
|
+
ok: true,
|
|
1115
|
+
value: deriveWorkItemAgeOverTime(
|
|
1116
|
+
r.startDate,
|
|
1117
|
+
r.endDate,
|
|
1118
|
+
wipResult.value
|
|
1119
|
+
)
|
|
1120
|
+
};
|
|
1121
|
+
},
|
|
1122
|
+
getPortfolioTotalWorkItemAgeOverTime: async (portfolioId, range) => {
|
|
1123
|
+
const r = getResolvedMetricsDateRange(range);
|
|
1124
|
+
const wipResult = await requestJson(
|
|
1125
|
+
configuration,
|
|
1126
|
+
dependencies,
|
|
1127
|
+
`/v1/portfolios/${portfolioId}/metrics/wipOverTime?${getMetricsDateRangeQuery(r)}`,
|
|
1128
|
+
{ method: "GET" }
|
|
1129
|
+
);
|
|
1130
|
+
if (!wipResult.ok) {
|
|
1131
|
+
return wipResult;
|
|
1132
|
+
}
|
|
1133
|
+
return {
|
|
1134
|
+
ok: true,
|
|
1135
|
+
value: deriveTotalWorkItemAgeOverTime(
|
|
1136
|
+
r.startDate,
|
|
1137
|
+
r.endDate,
|
|
1138
|
+
wipResult.value
|
|
1139
|
+
)
|
|
1140
|
+
};
|
|
1141
|
+
},
|
|
1142
|
+
getTeamCumulativeStateTime: async (teamId, range, itemIds) => {
|
|
1143
|
+
const unsupported = await ensureServerSupports("cumulativeStateTime");
|
|
1144
|
+
if (unsupported) {
|
|
1145
|
+
return unsupported;
|
|
1146
|
+
}
|
|
1147
|
+
const r = getResolvedMetricsDateRange(range);
|
|
1148
|
+
return requestJson(
|
|
1149
|
+
configuration,
|
|
1150
|
+
dependencies,
|
|
1151
|
+
`/v1/teams/${teamId}/metrics/cumulativeStateTime?${getMetricsDateRangeQuery(r)}${getItemIdsQuerySuffix(itemIds)}`,
|
|
1152
|
+
{ method: "GET" }
|
|
1153
|
+
);
|
|
1154
|
+
},
|
|
1155
|
+
getTeamCumulativeStateTimeItems: async (teamId, state, range, itemIds) => {
|
|
1156
|
+
const unsupported = await ensureServerSupports("cumulativeStateTime");
|
|
1157
|
+
if (unsupported) {
|
|
1158
|
+
return unsupported;
|
|
1159
|
+
}
|
|
1160
|
+
const r = getResolvedMetricsDateRange(range);
|
|
1161
|
+
return requestJson(
|
|
1162
|
+
configuration,
|
|
1163
|
+
dependencies,
|
|
1164
|
+
`/v1/teams/${teamId}/metrics/cumulativeStateTime/items?state=${encodeURIComponent(state)}&${getMetricsDateRangeQuery(r)}${getItemIdsQuerySuffix(itemIds)}`,
|
|
1165
|
+
{ method: "GET" }
|
|
1166
|
+
);
|
|
1167
|
+
},
|
|
1168
|
+
getTeamCumulativeStateTimeCandidates: async (teamId, range) => {
|
|
1169
|
+
const unsupported = await ensureServerSupports("cumulativeStateTime");
|
|
1170
|
+
if (unsupported) {
|
|
1171
|
+
return unsupported;
|
|
1172
|
+
}
|
|
1173
|
+
const r = getResolvedMetricsDateRange(range);
|
|
1174
|
+
return requestJson(
|
|
1175
|
+
configuration,
|
|
1176
|
+
dependencies,
|
|
1177
|
+
`/v1/teams/${teamId}/metrics/cumulativeStateTime/candidates?${getMetricsDateRangeQuery(r)}`,
|
|
1178
|
+
{ method: "GET" }
|
|
1179
|
+
);
|
|
1180
|
+
},
|
|
1181
|
+
getPortfolioCumulativeStateTime: async (portfolioId, range, itemIds) => {
|
|
1182
|
+
const unsupported = await ensureServerSupports("cumulativeStateTime");
|
|
1183
|
+
if (unsupported) {
|
|
1184
|
+
return unsupported;
|
|
1185
|
+
}
|
|
1186
|
+
const r = getResolvedMetricsDateRange(range);
|
|
1187
|
+
return requestJson(
|
|
1188
|
+
configuration,
|
|
1189
|
+
dependencies,
|
|
1190
|
+
`/v1/portfolios/${portfolioId}/metrics/cumulativeStateTime?${getMetricsDateRangeQuery(r)}${getItemIdsQuerySuffix(itemIds)}`,
|
|
1191
|
+
{ method: "GET" }
|
|
1192
|
+
);
|
|
1193
|
+
},
|
|
1194
|
+
getPortfolioCumulativeStateTimeItems: async (portfolioId, state, range, itemIds) => {
|
|
1195
|
+
const unsupported = await ensureServerSupports("cumulativeStateTime");
|
|
1196
|
+
if (unsupported) {
|
|
1197
|
+
return unsupported;
|
|
1198
|
+
}
|
|
1199
|
+
const r = getResolvedMetricsDateRange(range);
|
|
1200
|
+
return requestJson(
|
|
1201
|
+
configuration,
|
|
1202
|
+
dependencies,
|
|
1203
|
+
`/v1/portfolios/${portfolioId}/metrics/cumulativeStateTime/items?state=${encodeURIComponent(state)}&${getMetricsDateRangeQuery(r)}${getItemIdsQuerySuffix(itemIds)}`,
|
|
1204
|
+
{ method: "GET" }
|
|
1205
|
+
);
|
|
1206
|
+
},
|
|
1207
|
+
getPortfolioCumulativeStateTimeCandidates: async (portfolioId, range) => {
|
|
1208
|
+
const unsupported = await ensureServerSupports("cumulativeStateTime");
|
|
1209
|
+
if (unsupported) {
|
|
1210
|
+
return unsupported;
|
|
1211
|
+
}
|
|
1212
|
+
const r = getResolvedMetricsDateRange(range);
|
|
1213
|
+
return requestJson(
|
|
1214
|
+
configuration,
|
|
1215
|
+
dependencies,
|
|
1216
|
+
`/v1/portfolios/${portfolioId}/metrics/cumulativeStateTime/candidates?${getMetricsDateRangeQuery(r)}`,
|
|
1217
|
+
{ method: "GET" }
|
|
1218
|
+
);
|
|
1219
|
+
},
|
|
1220
|
+
getFeaturesByIds: async (ids) => {
|
|
1221
|
+
const queryString = ids.map((id) => `ids=${encodeURIComponent(id)}`).join("&");
|
|
1222
|
+
return requestJson(
|
|
1223
|
+
configuration,
|
|
1224
|
+
dependencies,
|
|
1225
|
+
`/v1/features?${queryString}`,
|
|
1226
|
+
{ method: "GET" }
|
|
1227
|
+
);
|
|
1228
|
+
},
|
|
1229
|
+
getFeaturesByReferences: async (refs) => {
|
|
1230
|
+
const queryString = refs.map((r) => `featureReferences=${encodeURIComponent(r)}`).join("&");
|
|
1231
|
+
return requestJson(
|
|
1232
|
+
configuration,
|
|
1233
|
+
dependencies,
|
|
1234
|
+
`/v1/features/references?${queryString}`,
|
|
1235
|
+
{ method: "GET" }
|
|
1236
|
+
);
|
|
1237
|
+
},
|
|
1238
|
+
getFeatureWorkItems: async (featureId) => requestJson(
|
|
1021
1239
|
configuration,
|
|
1022
1240
|
dependencies,
|
|
1023
|
-
`/v1/
|
|
1241
|
+
`/v1/features/${featureId}/workitems`,
|
|
1024
1242
|
{ method: "GET" }
|
|
1025
|
-
)
|
|
1026
|
-
|
|
1027
|
-
getPortfolioWorkItemAgeOverTime: async (portfolioId, range) => {
|
|
1028
|
-
const r = getResolvedMetricsDateRange(range);
|
|
1029
|
-
const wipResult = await requestJson(
|
|
1243
|
+
),
|
|
1244
|
+
listDeliveries: async (portfolioId) => requestJson(
|
|
1030
1245
|
configuration,
|
|
1031
1246
|
dependencies,
|
|
1032
|
-
`/v1/
|
|
1247
|
+
`/v1/deliveries/portfolio/${portfolioId}`,
|
|
1033
1248
|
{ method: "GET" }
|
|
1034
|
-
)
|
|
1035
|
-
|
|
1036
|
-
return wipResult;
|
|
1037
|
-
}
|
|
1038
|
-
return {
|
|
1039
|
-
ok: true,
|
|
1040
|
-
value: deriveWorkItemAgeOverTime(r.startDate, r.endDate, wipResult.value)
|
|
1041
|
-
};
|
|
1042
|
-
},
|
|
1043
|
-
getPortfolioTotalWorkItemAgeOverTime: async (portfolioId, range) => {
|
|
1044
|
-
const r = getResolvedMetricsDateRange(range);
|
|
1045
|
-
const wipResult = await requestJson(
|
|
1249
|
+
),
|
|
1250
|
+
createDelivery: async (portfolioId, payload) => requestJson(
|
|
1046
1251
|
configuration,
|
|
1047
1252
|
dependencies,
|
|
1048
|
-
`/v1/
|
|
1049
|
-
{ method: "
|
|
1050
|
-
)
|
|
1051
|
-
|
|
1052
|
-
return wipResult;
|
|
1053
|
-
}
|
|
1054
|
-
return {
|
|
1055
|
-
ok: true,
|
|
1056
|
-
value: deriveTotalWorkItemAgeOverTime(
|
|
1057
|
-
r.startDate,
|
|
1058
|
-
r.endDate,
|
|
1059
|
-
wipResult.value
|
|
1060
|
-
)
|
|
1061
|
-
};
|
|
1062
|
-
},
|
|
1063
|
-
getFeaturesByIds: async (ids) => {
|
|
1064
|
-
const queryString = ids.map((id) => `ids=${encodeURIComponent(id)}`).join("&");
|
|
1065
|
-
return requestJson(
|
|
1253
|
+
`/v1/deliveries/portfolio/${portfolioId}`,
|
|
1254
|
+
{ method: "POST", body: payload }
|
|
1255
|
+
),
|
|
1256
|
+
updateDelivery: async (deliveryId, payload) => requestJson(
|
|
1066
1257
|
configuration,
|
|
1067
1258
|
dependencies,
|
|
1068
|
-
`/v1/
|
|
1069
|
-
{ method: "
|
|
1070
|
-
)
|
|
1071
|
-
|
|
1072
|
-
getFeaturesByReferences: async (refs) => {
|
|
1073
|
-
const queryString = refs.map((r) => `featureReferences=${encodeURIComponent(r)}`).join("&");
|
|
1074
|
-
return requestJson(
|
|
1259
|
+
`/v1/deliveries/${deliveryId}`,
|
|
1260
|
+
{ method: "PUT", body: payload }
|
|
1261
|
+
),
|
|
1262
|
+
deleteDelivery: async (deliveryId) => requestNoContent(
|
|
1075
1263
|
configuration,
|
|
1076
1264
|
dependencies,
|
|
1077
|
-
`/v1/
|
|
1078
|
-
{ method: "
|
|
1079
|
-
)
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
configuration,
|
|
1095
|
-
dependencies,
|
|
1096
|
-
`/v1/deliveries/portfolio/${portfolioId}`,
|
|
1097
|
-
{ method: "POST", body: payload }
|
|
1098
|
-
),
|
|
1099
|
-
updateDelivery: async (deliveryId, payload) => requestJson(
|
|
1100
|
-
configuration,
|
|
1101
|
-
dependencies,
|
|
1102
|
-
`/v1/deliveries/${deliveryId}`,
|
|
1103
|
-
{ method: "PUT", body: payload }
|
|
1104
|
-
),
|
|
1105
|
-
deleteDelivery: async (deliveryId) => requestNoContent(
|
|
1106
|
-
configuration,
|
|
1107
|
-
dependencies,
|
|
1108
|
-
`/v1/deliveries/${deliveryId}`,
|
|
1109
|
-
{ method: "DELETE" }
|
|
1110
|
-
),
|
|
1111
|
-
runManualForecast: async (teamId, payload) => requestJson(
|
|
1112
|
-
configuration,
|
|
1113
|
-
dependencies,
|
|
1114
|
-
`/v1/forecast/manual/${teamId}`,
|
|
1115
|
-
{ method: "POST", body: payload }
|
|
1116
|
-
),
|
|
1117
|
-
runBacktest: async (teamId, payload) => requestJson(
|
|
1118
|
-
configuration,
|
|
1119
|
-
dependencies,
|
|
1120
|
-
`/v1/forecast/backtest/${teamId}`,
|
|
1121
|
-
{ method: "POST", body: payload }
|
|
1122
|
-
)
|
|
1123
|
-
});
|
|
1265
|
+
`/v1/deliveries/${deliveryId}`,
|
|
1266
|
+
{ method: "DELETE" }
|
|
1267
|
+
),
|
|
1268
|
+
runManualForecast: async (teamId, payload) => requestJson(
|
|
1269
|
+
configuration,
|
|
1270
|
+
dependencies,
|
|
1271
|
+
`/v1/forecast/manual/${teamId}`,
|
|
1272
|
+
{ method: "POST", body: payload }
|
|
1273
|
+
),
|
|
1274
|
+
runBacktest: async (teamId, payload) => requestJson(
|
|
1275
|
+
configuration,
|
|
1276
|
+
dependencies,
|
|
1277
|
+
`/v1/forecast/backtest/${teamId}`,
|
|
1278
|
+
{ method: "POST", body: payload }
|
|
1279
|
+
)
|
|
1280
|
+
};
|
|
1281
|
+
};
|
|
1124
1282
|
export {
|
|
1125
1283
|
createLighthouseAuthContext,
|
|
1126
1284
|
createLighthouseClient,
|
|
1127
1285
|
getClientPackageContract,
|
|
1128
1286
|
getDefaultMetricsDateRange,
|
|
1129
1287
|
getStandaloneDiscoveryLockfilePath,
|
|
1288
|
+
isServerVersionNewerThan,
|
|
1130
1289
|
loadStandaloneDiscoveryContract,
|
|
1131
1290
|
parseStandaloneDiscoveryContract,
|
|
1132
1291
|
pollCliAuthSession,
|