@letpeoplework/lighthouse-client 0.4.0 → 0.6.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 +142 -22
- package/dist/index.d.cts +21 -2
- package/dist/index.d.ts +21 -2
- package/dist/index.js +142 -22
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -161,7 +161,7 @@ var getResolvedEndpoint = (mode, lighthouseUrl) => {
|
|
|
161
161
|
mode,
|
|
162
162
|
lighthouseUrl,
|
|
163
163
|
apiBaseUrl,
|
|
164
|
-
healthCheckUrl: `${apiBaseUrl}/v1/version`
|
|
164
|
+
healthCheckUrl: `${apiBaseUrl}/v1/version/current`
|
|
165
165
|
};
|
|
166
166
|
};
|
|
167
167
|
var getMisconfiguredResult = (reason) => ({
|
|
@@ -350,18 +350,6 @@ var mapAuthMode = (serverMode) => {
|
|
|
350
350
|
return "misconfigured";
|
|
351
351
|
}
|
|
352
352
|
};
|
|
353
|
-
var getAuthStartFailureCategory = (statusCode) => {
|
|
354
|
-
if (statusCode === 401 || statusCode === 403) {
|
|
355
|
-
return "unauthorized";
|
|
356
|
-
}
|
|
357
|
-
if (statusCode === 404) {
|
|
358
|
-
return "misconfigured";
|
|
359
|
-
}
|
|
360
|
-
if (statusCode >= 500 && statusCode <= 599) {
|
|
361
|
-
return "dependency-failure";
|
|
362
|
-
}
|
|
363
|
-
return "unexpected";
|
|
364
|
-
};
|
|
365
353
|
var getErrorReasonFromResponse = async (response, fallback) => {
|
|
366
354
|
try {
|
|
367
355
|
const body = (await response.text()).trim();
|
|
@@ -427,7 +415,7 @@ var startCliAuthSession = async (endpointUrl, dependencies) => {
|
|
|
427
415
|
if (!response.ok) {
|
|
428
416
|
return {
|
|
429
417
|
status: "error",
|
|
430
|
-
category:
|
|
418
|
+
category: getFailureCategoryForStatus(response.status),
|
|
431
419
|
reason: await getErrorReasonFromResponse(
|
|
432
420
|
response,
|
|
433
421
|
`HTTP ${response.status}`
|
|
@@ -607,7 +595,13 @@ var requestJson = async (configuration, dependencies, route, requestOptions) =>
|
|
|
607
595
|
)
|
|
608
596
|
);
|
|
609
597
|
}
|
|
610
|
-
|
|
598
|
+
if (response.json === void 0) {
|
|
599
|
+
return {
|
|
600
|
+
ok: true,
|
|
601
|
+
value: JSON.parse(await response.text())
|
|
602
|
+
};
|
|
603
|
+
}
|
|
604
|
+
const value = await response.json();
|
|
611
605
|
return {
|
|
612
606
|
ok: true,
|
|
613
607
|
value
|
|
@@ -659,6 +653,9 @@ var requestNoContent = async (configuration, dependencies, route, requestOptions
|
|
|
659
653
|
});
|
|
660
654
|
}
|
|
661
655
|
};
|
|
656
|
+
var getResolvedMetricsDateRange = (range) => range ?? getDefaultMetricsDateRange();
|
|
657
|
+
var getMetricsDateRangeQuery = (range) => `startDate=${encodeURIComponent(range.startDate)}&endDate=${encodeURIComponent(range.endDate)}`;
|
|
658
|
+
var getMetricsAsOfDateQuery = (asOfDate) => `asOfDate=${encodeURIComponent(asOfDate)}`;
|
|
662
659
|
var createLighthouseClient = (configuration, dependencies = {}) => ({
|
|
663
660
|
checkConnectivity: async () => {
|
|
664
661
|
const fetchDependency = getFetchDependency(dependencies);
|
|
@@ -670,7 +667,7 @@ var createLighthouseClient = (configuration, dependencies = {}) => ({
|
|
|
670
667
|
getRequestInit(configuration.auth)
|
|
671
668
|
);
|
|
672
669
|
},
|
|
673
|
-
getVersion: async () => requestText(configuration, dependencies, "/v1/version"),
|
|
670
|
+
getVersion: async () => requestText(configuration, dependencies, "/v1/version/current"),
|
|
674
671
|
listWorkTrackingConnections: async () => requestJson(
|
|
675
672
|
configuration,
|
|
676
673
|
dependencies,
|
|
@@ -779,29 +776,152 @@ var createLighthouseClient = (configuration, dependencies = {}) => ({
|
|
|
779
776
|
}
|
|
780
777
|
),
|
|
781
778
|
getTeamThroughput: async (teamId, range) => {
|
|
782
|
-
const r = range
|
|
779
|
+
const r = getResolvedMetricsDateRange(range);
|
|
780
|
+
return requestJson(
|
|
781
|
+
configuration,
|
|
782
|
+
dependencies,
|
|
783
|
+
`/v1/teams/${teamId}/metrics/throughput?${getMetricsDateRangeQuery(r)}`,
|
|
784
|
+
{ method: "GET" }
|
|
785
|
+
);
|
|
786
|
+
},
|
|
787
|
+
getTeamArrivals: async (teamId, range) => {
|
|
788
|
+
const r = getResolvedMetricsDateRange(range);
|
|
789
|
+
return requestJson(
|
|
790
|
+
configuration,
|
|
791
|
+
dependencies,
|
|
792
|
+
`/v1/teams/${teamId}/metrics/arrivals?${getMetricsDateRangeQuery(r)}`,
|
|
793
|
+
{ method: "GET" }
|
|
794
|
+
);
|
|
795
|
+
},
|
|
796
|
+
getTeamWipOverTime: async (teamId, range) => {
|
|
797
|
+
const r = getResolvedMetricsDateRange(range);
|
|
783
798
|
return requestJson(
|
|
784
799
|
configuration,
|
|
785
800
|
dependencies,
|
|
786
|
-
`/v1/teams/${teamId}/metrics/
|
|
801
|
+
`/v1/teams/${teamId}/metrics/wipOverTime?${getMetricsDateRangeQuery(r)}`,
|
|
787
802
|
{ method: "GET" }
|
|
788
803
|
);
|
|
789
804
|
},
|
|
805
|
+
getTeamWip: async (teamId, asOfDate) => requestJson(
|
|
806
|
+
configuration,
|
|
807
|
+
dependencies,
|
|
808
|
+
`/v1/teams/${teamId}/metrics/wip?${getMetricsAsOfDateQuery(asOfDate)}`,
|
|
809
|
+
{ method: "GET" }
|
|
810
|
+
),
|
|
790
811
|
getTeamCycleTimePercentiles: async (teamId, range) => {
|
|
791
|
-
const r = range
|
|
812
|
+
const r = getResolvedMetricsDateRange(range);
|
|
813
|
+
return requestJson(
|
|
814
|
+
configuration,
|
|
815
|
+
dependencies,
|
|
816
|
+
`/v1/teams/${teamId}/metrics/cycleTimePercentiles?${getMetricsDateRangeQuery(r)}`,
|
|
817
|
+
{ method: "GET" }
|
|
818
|
+
);
|
|
819
|
+
},
|
|
820
|
+
getTeamCycleTimeData: async (teamId, range) => {
|
|
821
|
+
const r = getResolvedMetricsDateRange(range);
|
|
822
|
+
return requestJson(
|
|
823
|
+
configuration,
|
|
824
|
+
dependencies,
|
|
825
|
+
`/v1/teams/${teamId}/metrics/cycleTimeData?${getMetricsDateRangeQuery(r)}`,
|
|
826
|
+
{ method: "GET" }
|
|
827
|
+
);
|
|
828
|
+
},
|
|
829
|
+
getTeamPredictabilityScore: async (teamId, range) => {
|
|
830
|
+
const r = getResolvedMetricsDateRange(range);
|
|
831
|
+
return requestJson(
|
|
832
|
+
configuration,
|
|
833
|
+
dependencies,
|
|
834
|
+
`/v1/teams/${teamId}/metrics/multiitemforecastpredictabilityscore?${getMetricsDateRangeQuery(r)}`,
|
|
835
|
+
{ method: "GET" }
|
|
836
|
+
);
|
|
837
|
+
},
|
|
838
|
+
getTeamTotalWorkItemAge: async (teamId, asOfDate) => requestJson(
|
|
839
|
+
configuration,
|
|
840
|
+
dependencies,
|
|
841
|
+
`/v1/teams/${teamId}/metrics/totalWorkItemAge?${getMetricsAsOfDateQuery(asOfDate)}`,
|
|
842
|
+
{ method: "GET" }
|
|
843
|
+
),
|
|
844
|
+
getTeamTotalWorkItemAgePbc: async (teamId, range) => {
|
|
845
|
+
const r = getResolvedMetricsDateRange(range);
|
|
792
846
|
return requestJson(
|
|
793
847
|
configuration,
|
|
794
848
|
dependencies,
|
|
795
|
-
`/v1/teams/${teamId}/metrics/
|
|
849
|
+
`/v1/teams/${teamId}/metrics/totalWorkItemAge/pbc?${getMetricsDateRangeQuery(r)}`,
|
|
796
850
|
{ method: "GET" }
|
|
797
851
|
);
|
|
798
852
|
},
|
|
799
853
|
getPortfolioThroughput: async (portfolioId, range) => {
|
|
800
|
-
const r = range
|
|
854
|
+
const r = getResolvedMetricsDateRange(range);
|
|
855
|
+
return requestJson(
|
|
856
|
+
configuration,
|
|
857
|
+
dependencies,
|
|
858
|
+
`/v1/portfolios/${portfolioId}/metrics/throughput?${getMetricsDateRangeQuery(r)}`,
|
|
859
|
+
{ method: "GET" }
|
|
860
|
+
);
|
|
861
|
+
},
|
|
862
|
+
getPortfolioCycleTimePercentiles: async (portfolioId, range) => {
|
|
863
|
+
const r = getResolvedMetricsDateRange(range);
|
|
864
|
+
return requestJson(
|
|
865
|
+
configuration,
|
|
866
|
+
dependencies,
|
|
867
|
+
`/v1/portfolios/${portfolioId}/metrics/cycleTimePercentiles?${getMetricsDateRangeQuery(r)}`,
|
|
868
|
+
{ method: "GET" }
|
|
869
|
+
);
|
|
870
|
+
},
|
|
871
|
+
getPortfolioArrivals: async (portfolioId, range) => {
|
|
872
|
+
const r = getResolvedMetricsDateRange(range);
|
|
873
|
+
return requestJson(
|
|
874
|
+
configuration,
|
|
875
|
+
dependencies,
|
|
876
|
+
`/v1/portfolios/${portfolioId}/metrics/arrivals?${getMetricsDateRangeQuery(r)}`,
|
|
877
|
+
{ method: "GET" }
|
|
878
|
+
);
|
|
879
|
+
},
|
|
880
|
+
getPortfolioWipOverTime: async (portfolioId, range) => {
|
|
881
|
+
const r = getResolvedMetricsDateRange(range);
|
|
882
|
+
return requestJson(
|
|
883
|
+
configuration,
|
|
884
|
+
dependencies,
|
|
885
|
+
`/v1/portfolios/${portfolioId}/metrics/wipOverTime?${getMetricsDateRangeQuery(r)}`,
|
|
886
|
+
{ method: "GET" }
|
|
887
|
+
);
|
|
888
|
+
},
|
|
889
|
+
getPortfolioWip: async (portfolioId, asOfDate) => requestJson(
|
|
890
|
+
configuration,
|
|
891
|
+
dependencies,
|
|
892
|
+
`/v1/portfolios/${portfolioId}/metrics/wip?${getMetricsAsOfDateQuery(asOfDate)}`,
|
|
893
|
+
{ method: "GET" }
|
|
894
|
+
),
|
|
895
|
+
getPortfolioCycleTimeData: async (portfolioId, range) => {
|
|
896
|
+
const r = getResolvedMetricsDateRange(range);
|
|
897
|
+
return requestJson(
|
|
898
|
+
configuration,
|
|
899
|
+
dependencies,
|
|
900
|
+
`/v1/portfolios/${portfolioId}/metrics/cycleTimeData?${getMetricsDateRangeQuery(r)}`,
|
|
901
|
+
{ method: "GET" }
|
|
902
|
+
);
|
|
903
|
+
},
|
|
904
|
+
getPortfolioPredictabilityScore: async (portfolioId, range) => {
|
|
905
|
+
const r = getResolvedMetricsDateRange(range);
|
|
906
|
+
return requestJson(
|
|
907
|
+
configuration,
|
|
908
|
+
dependencies,
|
|
909
|
+
`/v1/portfolios/${portfolioId}/metrics/multiitemforecastpredictabilityscore?${getMetricsDateRangeQuery(r)}`,
|
|
910
|
+
{ method: "GET" }
|
|
911
|
+
);
|
|
912
|
+
},
|
|
913
|
+
getPortfolioTotalWorkItemAge: async (portfolioId, asOfDate) => requestJson(
|
|
914
|
+
configuration,
|
|
915
|
+
dependencies,
|
|
916
|
+
`/v1/portfolios/${portfolioId}/metrics/totalWorkItemAge?${getMetricsAsOfDateQuery(asOfDate)}`,
|
|
917
|
+
{ method: "GET" }
|
|
918
|
+
),
|
|
919
|
+
getPortfolioTotalWorkItemAgePbc: async (portfolioId, range) => {
|
|
920
|
+
const r = getResolvedMetricsDateRange(range);
|
|
801
921
|
return requestJson(
|
|
802
922
|
configuration,
|
|
803
923
|
dependencies,
|
|
804
|
-
`/v1/portfolios/${portfolioId}/metrics/
|
|
924
|
+
`/v1/portfolios/${portfolioId}/metrics/totalWorkItemAge/pbc?${getMetricsDateRangeQuery(r)}`,
|
|
805
925
|
{ method: "GET" }
|
|
806
926
|
);
|
|
807
927
|
},
|
package/dist/index.d.cts
CHANGED
|
@@ -124,7 +124,11 @@ type CliServerConnection = {
|
|
|
124
124
|
readonly insecure?: boolean;
|
|
125
125
|
readonly auth?: StoredLighthouseAuth;
|
|
126
126
|
};
|
|
127
|
-
type
|
|
127
|
+
type CliStandaloneConnection = {
|
|
128
|
+
readonly mode: "standalone";
|
|
129
|
+
readonly authMode: "disabled";
|
|
130
|
+
};
|
|
131
|
+
type CliConnection = CliServerConnection | CliStandaloneConnection;
|
|
128
132
|
type CliAuthDependencies = {
|
|
129
133
|
readonly fetch: typeof globalThis.fetch;
|
|
130
134
|
};
|
|
@@ -184,8 +188,23 @@ type LighthouseClient = {
|
|
|
184
188
|
readonly deletePortfolio: (portfolioId: number) => Promise<LighthouseApiResult<void>>;
|
|
185
189
|
readonly refreshPortfolio: (portfolioId: number) => Promise<LighthouseApiResult<void>>;
|
|
186
190
|
readonly getTeamThroughput: (teamId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<unknown>>;
|
|
191
|
+
readonly getTeamArrivals: (teamId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<unknown>>;
|
|
192
|
+
readonly getTeamWipOverTime: (teamId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<unknown>>;
|
|
193
|
+
readonly getTeamWip: (teamId: number, asOfDate: string) => Promise<LighthouseApiResult<readonly unknown[]>>;
|
|
187
194
|
readonly getTeamCycleTimePercentiles: (teamId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<readonly unknown[]>>;
|
|
195
|
+
readonly getTeamCycleTimeData: (teamId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<readonly unknown[]>>;
|
|
196
|
+
readonly getTeamPredictabilityScore: (teamId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<unknown>>;
|
|
197
|
+
readonly getTeamTotalWorkItemAge: (teamId: number, asOfDate: string) => Promise<LighthouseApiResult<number>>;
|
|
198
|
+
readonly getTeamTotalWorkItemAgePbc: (teamId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<unknown>>;
|
|
188
199
|
readonly getPortfolioThroughput: (portfolioId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<unknown>>;
|
|
200
|
+
readonly getPortfolioCycleTimePercentiles: (portfolioId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<readonly unknown[]>>;
|
|
201
|
+
readonly getPortfolioArrivals: (portfolioId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<unknown>>;
|
|
202
|
+
readonly getPortfolioWipOverTime: (portfolioId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<unknown>>;
|
|
203
|
+
readonly getPortfolioWip: (portfolioId: number, asOfDate: string) => Promise<LighthouseApiResult<readonly unknown[]>>;
|
|
204
|
+
readonly getPortfolioCycleTimeData: (portfolioId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<readonly unknown[]>>;
|
|
205
|
+
readonly getPortfolioPredictabilityScore: (portfolioId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<unknown>>;
|
|
206
|
+
readonly getPortfolioTotalWorkItemAge: (portfolioId: number, asOfDate: string) => Promise<LighthouseApiResult<number>>;
|
|
207
|
+
readonly getPortfolioTotalWorkItemAgePbc: (portfolioId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<unknown>>;
|
|
189
208
|
readonly getFeaturesByIds: (ids: readonly number[]) => Promise<LighthouseApiResult<readonly unknown[]>>;
|
|
190
209
|
readonly getFeaturesByReferences: (refs: readonly string[]) => Promise<LighthouseApiResult<readonly unknown[]>>;
|
|
191
210
|
readonly getFeatureWorkItems: (featureId: number) => Promise<LighthouseApiResult<readonly unknown[]>>;
|
|
@@ -201,4 +220,4 @@ type LighthouseClientDependencies = {
|
|
|
201
220
|
};
|
|
202
221
|
declare const createLighthouseClient: (configuration: LighthouseClientConfiguration, dependencies?: LighthouseClientDependencies) => LighthouseClient;
|
|
203
222
|
|
|
204
|
-
export { type BacktestInput, type CliAuthSessionPollResult, type CliAuthSessionStartError, type CliAuthSessionStartOutcome, type CliAuthSessionStartResult, type CliConnection, type CliServerAuthMode, type CliServerConnection, 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, parseStandaloneDiscoveryContract, pollCliAuthSession, queryServerAuthMode, startCliAuthSession, validateLighthouseConnectivity };
|
|
223
|
+
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, parseStandaloneDiscoveryContract, pollCliAuthSession, queryServerAuthMode, startCliAuthSession, validateLighthouseConnectivity };
|
package/dist/index.d.ts
CHANGED
|
@@ -124,7 +124,11 @@ type CliServerConnection = {
|
|
|
124
124
|
readonly insecure?: boolean;
|
|
125
125
|
readonly auth?: StoredLighthouseAuth;
|
|
126
126
|
};
|
|
127
|
-
type
|
|
127
|
+
type CliStandaloneConnection = {
|
|
128
|
+
readonly mode: "standalone";
|
|
129
|
+
readonly authMode: "disabled";
|
|
130
|
+
};
|
|
131
|
+
type CliConnection = CliServerConnection | CliStandaloneConnection;
|
|
128
132
|
type CliAuthDependencies = {
|
|
129
133
|
readonly fetch: typeof globalThis.fetch;
|
|
130
134
|
};
|
|
@@ -184,8 +188,23 @@ type LighthouseClient = {
|
|
|
184
188
|
readonly deletePortfolio: (portfolioId: number) => Promise<LighthouseApiResult<void>>;
|
|
185
189
|
readonly refreshPortfolio: (portfolioId: number) => Promise<LighthouseApiResult<void>>;
|
|
186
190
|
readonly getTeamThroughput: (teamId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<unknown>>;
|
|
191
|
+
readonly getTeamArrivals: (teamId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<unknown>>;
|
|
192
|
+
readonly getTeamWipOverTime: (teamId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<unknown>>;
|
|
193
|
+
readonly getTeamWip: (teamId: number, asOfDate: string) => Promise<LighthouseApiResult<readonly unknown[]>>;
|
|
187
194
|
readonly getTeamCycleTimePercentiles: (teamId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<readonly unknown[]>>;
|
|
195
|
+
readonly getTeamCycleTimeData: (teamId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<readonly unknown[]>>;
|
|
196
|
+
readonly getTeamPredictabilityScore: (teamId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<unknown>>;
|
|
197
|
+
readonly getTeamTotalWorkItemAge: (teamId: number, asOfDate: string) => Promise<LighthouseApiResult<number>>;
|
|
198
|
+
readonly getTeamTotalWorkItemAgePbc: (teamId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<unknown>>;
|
|
188
199
|
readonly getPortfolioThroughput: (portfolioId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<unknown>>;
|
|
200
|
+
readonly getPortfolioCycleTimePercentiles: (portfolioId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<readonly unknown[]>>;
|
|
201
|
+
readonly getPortfolioArrivals: (portfolioId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<unknown>>;
|
|
202
|
+
readonly getPortfolioWipOverTime: (portfolioId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<unknown>>;
|
|
203
|
+
readonly getPortfolioWip: (portfolioId: number, asOfDate: string) => Promise<LighthouseApiResult<readonly unknown[]>>;
|
|
204
|
+
readonly getPortfolioCycleTimeData: (portfolioId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<readonly unknown[]>>;
|
|
205
|
+
readonly getPortfolioPredictabilityScore: (portfolioId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<unknown>>;
|
|
206
|
+
readonly getPortfolioTotalWorkItemAge: (portfolioId: number, asOfDate: string) => Promise<LighthouseApiResult<number>>;
|
|
207
|
+
readonly getPortfolioTotalWorkItemAgePbc: (portfolioId: number, range?: MetricsDateRange) => Promise<LighthouseApiResult<unknown>>;
|
|
189
208
|
readonly getFeaturesByIds: (ids: readonly number[]) => Promise<LighthouseApiResult<readonly unknown[]>>;
|
|
190
209
|
readonly getFeaturesByReferences: (refs: readonly string[]) => Promise<LighthouseApiResult<readonly unknown[]>>;
|
|
191
210
|
readonly getFeatureWorkItems: (featureId: number) => Promise<LighthouseApiResult<readonly unknown[]>>;
|
|
@@ -201,4 +220,4 @@ type LighthouseClientDependencies = {
|
|
|
201
220
|
};
|
|
202
221
|
declare const createLighthouseClient: (configuration: LighthouseClientConfiguration, dependencies?: LighthouseClientDependencies) => LighthouseClient;
|
|
203
222
|
|
|
204
|
-
export { type BacktestInput, type CliAuthSessionPollResult, type CliAuthSessionStartError, type CliAuthSessionStartOutcome, type CliAuthSessionStartResult, type CliConnection, type CliServerAuthMode, type CliServerConnection, 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, parseStandaloneDiscoveryContract, pollCliAuthSession, queryServerAuthMode, startCliAuthSession, validateLighthouseConnectivity };
|
|
223
|
+
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, parseStandaloneDiscoveryContract, pollCliAuthSession, queryServerAuthMode, startCliAuthSession, validateLighthouseConnectivity };
|
package/dist/index.js
CHANGED
|
@@ -129,7 +129,7 @@ var getResolvedEndpoint = (mode, lighthouseUrl) => {
|
|
|
129
129
|
mode,
|
|
130
130
|
lighthouseUrl,
|
|
131
131
|
apiBaseUrl,
|
|
132
|
-
healthCheckUrl: `${apiBaseUrl}/v1/version`
|
|
132
|
+
healthCheckUrl: `${apiBaseUrl}/v1/version/current`
|
|
133
133
|
};
|
|
134
134
|
};
|
|
135
135
|
var getMisconfiguredResult = (reason) => ({
|
|
@@ -318,18 +318,6 @@ var mapAuthMode = (serverMode) => {
|
|
|
318
318
|
return "misconfigured";
|
|
319
319
|
}
|
|
320
320
|
};
|
|
321
|
-
var getAuthStartFailureCategory = (statusCode) => {
|
|
322
|
-
if (statusCode === 401 || statusCode === 403) {
|
|
323
|
-
return "unauthorized";
|
|
324
|
-
}
|
|
325
|
-
if (statusCode === 404) {
|
|
326
|
-
return "misconfigured";
|
|
327
|
-
}
|
|
328
|
-
if (statusCode >= 500 && statusCode <= 599) {
|
|
329
|
-
return "dependency-failure";
|
|
330
|
-
}
|
|
331
|
-
return "unexpected";
|
|
332
|
-
};
|
|
333
321
|
var getErrorReasonFromResponse = async (response, fallback) => {
|
|
334
322
|
try {
|
|
335
323
|
const body = (await response.text()).trim();
|
|
@@ -395,7 +383,7 @@ var startCliAuthSession = async (endpointUrl, dependencies) => {
|
|
|
395
383
|
if (!response.ok) {
|
|
396
384
|
return {
|
|
397
385
|
status: "error",
|
|
398
|
-
category:
|
|
386
|
+
category: getFailureCategoryForStatus(response.status),
|
|
399
387
|
reason: await getErrorReasonFromResponse(
|
|
400
388
|
response,
|
|
401
389
|
`HTTP ${response.status}`
|
|
@@ -575,7 +563,13 @@ var requestJson = async (configuration, dependencies, route, requestOptions) =>
|
|
|
575
563
|
)
|
|
576
564
|
);
|
|
577
565
|
}
|
|
578
|
-
|
|
566
|
+
if (response.json === void 0) {
|
|
567
|
+
return {
|
|
568
|
+
ok: true,
|
|
569
|
+
value: JSON.parse(await response.text())
|
|
570
|
+
};
|
|
571
|
+
}
|
|
572
|
+
const value = await response.json();
|
|
579
573
|
return {
|
|
580
574
|
ok: true,
|
|
581
575
|
value
|
|
@@ -627,6 +621,9 @@ var requestNoContent = async (configuration, dependencies, route, requestOptions
|
|
|
627
621
|
});
|
|
628
622
|
}
|
|
629
623
|
};
|
|
624
|
+
var getResolvedMetricsDateRange = (range) => range ?? getDefaultMetricsDateRange();
|
|
625
|
+
var getMetricsDateRangeQuery = (range) => `startDate=${encodeURIComponent(range.startDate)}&endDate=${encodeURIComponent(range.endDate)}`;
|
|
626
|
+
var getMetricsAsOfDateQuery = (asOfDate) => `asOfDate=${encodeURIComponent(asOfDate)}`;
|
|
630
627
|
var createLighthouseClient = (configuration, dependencies = {}) => ({
|
|
631
628
|
checkConnectivity: async () => {
|
|
632
629
|
const fetchDependency = getFetchDependency(dependencies);
|
|
@@ -638,7 +635,7 @@ var createLighthouseClient = (configuration, dependencies = {}) => ({
|
|
|
638
635
|
getRequestInit(configuration.auth)
|
|
639
636
|
);
|
|
640
637
|
},
|
|
641
|
-
getVersion: async () => requestText(configuration, dependencies, "/v1/version"),
|
|
638
|
+
getVersion: async () => requestText(configuration, dependencies, "/v1/version/current"),
|
|
642
639
|
listWorkTrackingConnections: async () => requestJson(
|
|
643
640
|
configuration,
|
|
644
641
|
dependencies,
|
|
@@ -747,29 +744,152 @@ var createLighthouseClient = (configuration, dependencies = {}) => ({
|
|
|
747
744
|
}
|
|
748
745
|
),
|
|
749
746
|
getTeamThroughput: async (teamId, range) => {
|
|
750
|
-
const r = range
|
|
747
|
+
const r = getResolvedMetricsDateRange(range);
|
|
748
|
+
return requestJson(
|
|
749
|
+
configuration,
|
|
750
|
+
dependencies,
|
|
751
|
+
`/v1/teams/${teamId}/metrics/throughput?${getMetricsDateRangeQuery(r)}`,
|
|
752
|
+
{ method: "GET" }
|
|
753
|
+
);
|
|
754
|
+
},
|
|
755
|
+
getTeamArrivals: async (teamId, range) => {
|
|
756
|
+
const r = getResolvedMetricsDateRange(range);
|
|
757
|
+
return requestJson(
|
|
758
|
+
configuration,
|
|
759
|
+
dependencies,
|
|
760
|
+
`/v1/teams/${teamId}/metrics/arrivals?${getMetricsDateRangeQuery(r)}`,
|
|
761
|
+
{ method: "GET" }
|
|
762
|
+
);
|
|
763
|
+
},
|
|
764
|
+
getTeamWipOverTime: async (teamId, range) => {
|
|
765
|
+
const r = getResolvedMetricsDateRange(range);
|
|
751
766
|
return requestJson(
|
|
752
767
|
configuration,
|
|
753
768
|
dependencies,
|
|
754
|
-
`/v1/teams/${teamId}/metrics/
|
|
769
|
+
`/v1/teams/${teamId}/metrics/wipOverTime?${getMetricsDateRangeQuery(r)}`,
|
|
755
770
|
{ method: "GET" }
|
|
756
771
|
);
|
|
757
772
|
},
|
|
773
|
+
getTeamWip: async (teamId, asOfDate) => requestJson(
|
|
774
|
+
configuration,
|
|
775
|
+
dependencies,
|
|
776
|
+
`/v1/teams/${teamId}/metrics/wip?${getMetricsAsOfDateQuery(asOfDate)}`,
|
|
777
|
+
{ method: "GET" }
|
|
778
|
+
),
|
|
758
779
|
getTeamCycleTimePercentiles: async (teamId, range) => {
|
|
759
|
-
const r = range
|
|
780
|
+
const r = getResolvedMetricsDateRange(range);
|
|
781
|
+
return requestJson(
|
|
782
|
+
configuration,
|
|
783
|
+
dependencies,
|
|
784
|
+
`/v1/teams/${teamId}/metrics/cycleTimePercentiles?${getMetricsDateRangeQuery(r)}`,
|
|
785
|
+
{ method: "GET" }
|
|
786
|
+
);
|
|
787
|
+
},
|
|
788
|
+
getTeamCycleTimeData: async (teamId, range) => {
|
|
789
|
+
const r = getResolvedMetricsDateRange(range);
|
|
790
|
+
return requestJson(
|
|
791
|
+
configuration,
|
|
792
|
+
dependencies,
|
|
793
|
+
`/v1/teams/${teamId}/metrics/cycleTimeData?${getMetricsDateRangeQuery(r)}`,
|
|
794
|
+
{ method: "GET" }
|
|
795
|
+
);
|
|
796
|
+
},
|
|
797
|
+
getTeamPredictabilityScore: async (teamId, range) => {
|
|
798
|
+
const r = getResolvedMetricsDateRange(range);
|
|
799
|
+
return requestJson(
|
|
800
|
+
configuration,
|
|
801
|
+
dependencies,
|
|
802
|
+
`/v1/teams/${teamId}/metrics/multiitemforecastpredictabilityscore?${getMetricsDateRangeQuery(r)}`,
|
|
803
|
+
{ method: "GET" }
|
|
804
|
+
);
|
|
805
|
+
},
|
|
806
|
+
getTeamTotalWorkItemAge: async (teamId, asOfDate) => requestJson(
|
|
807
|
+
configuration,
|
|
808
|
+
dependencies,
|
|
809
|
+
`/v1/teams/${teamId}/metrics/totalWorkItemAge?${getMetricsAsOfDateQuery(asOfDate)}`,
|
|
810
|
+
{ method: "GET" }
|
|
811
|
+
),
|
|
812
|
+
getTeamTotalWorkItemAgePbc: async (teamId, range) => {
|
|
813
|
+
const r = getResolvedMetricsDateRange(range);
|
|
760
814
|
return requestJson(
|
|
761
815
|
configuration,
|
|
762
816
|
dependencies,
|
|
763
|
-
`/v1/teams/${teamId}/metrics/
|
|
817
|
+
`/v1/teams/${teamId}/metrics/totalWorkItemAge/pbc?${getMetricsDateRangeQuery(r)}`,
|
|
764
818
|
{ method: "GET" }
|
|
765
819
|
);
|
|
766
820
|
},
|
|
767
821
|
getPortfolioThroughput: async (portfolioId, range) => {
|
|
768
|
-
const r = range
|
|
822
|
+
const r = getResolvedMetricsDateRange(range);
|
|
823
|
+
return requestJson(
|
|
824
|
+
configuration,
|
|
825
|
+
dependencies,
|
|
826
|
+
`/v1/portfolios/${portfolioId}/metrics/throughput?${getMetricsDateRangeQuery(r)}`,
|
|
827
|
+
{ method: "GET" }
|
|
828
|
+
);
|
|
829
|
+
},
|
|
830
|
+
getPortfolioCycleTimePercentiles: async (portfolioId, range) => {
|
|
831
|
+
const r = getResolvedMetricsDateRange(range);
|
|
832
|
+
return requestJson(
|
|
833
|
+
configuration,
|
|
834
|
+
dependencies,
|
|
835
|
+
`/v1/portfolios/${portfolioId}/metrics/cycleTimePercentiles?${getMetricsDateRangeQuery(r)}`,
|
|
836
|
+
{ method: "GET" }
|
|
837
|
+
);
|
|
838
|
+
},
|
|
839
|
+
getPortfolioArrivals: async (portfolioId, range) => {
|
|
840
|
+
const r = getResolvedMetricsDateRange(range);
|
|
841
|
+
return requestJson(
|
|
842
|
+
configuration,
|
|
843
|
+
dependencies,
|
|
844
|
+
`/v1/portfolios/${portfolioId}/metrics/arrivals?${getMetricsDateRangeQuery(r)}`,
|
|
845
|
+
{ method: "GET" }
|
|
846
|
+
);
|
|
847
|
+
},
|
|
848
|
+
getPortfolioWipOverTime: async (portfolioId, range) => {
|
|
849
|
+
const r = getResolvedMetricsDateRange(range);
|
|
850
|
+
return requestJson(
|
|
851
|
+
configuration,
|
|
852
|
+
dependencies,
|
|
853
|
+
`/v1/portfolios/${portfolioId}/metrics/wipOverTime?${getMetricsDateRangeQuery(r)}`,
|
|
854
|
+
{ method: "GET" }
|
|
855
|
+
);
|
|
856
|
+
},
|
|
857
|
+
getPortfolioWip: async (portfolioId, asOfDate) => requestJson(
|
|
858
|
+
configuration,
|
|
859
|
+
dependencies,
|
|
860
|
+
`/v1/portfolios/${portfolioId}/metrics/wip?${getMetricsAsOfDateQuery(asOfDate)}`,
|
|
861
|
+
{ method: "GET" }
|
|
862
|
+
),
|
|
863
|
+
getPortfolioCycleTimeData: async (portfolioId, range) => {
|
|
864
|
+
const r = getResolvedMetricsDateRange(range);
|
|
865
|
+
return requestJson(
|
|
866
|
+
configuration,
|
|
867
|
+
dependencies,
|
|
868
|
+
`/v1/portfolios/${portfolioId}/metrics/cycleTimeData?${getMetricsDateRangeQuery(r)}`,
|
|
869
|
+
{ method: "GET" }
|
|
870
|
+
);
|
|
871
|
+
},
|
|
872
|
+
getPortfolioPredictabilityScore: async (portfolioId, range) => {
|
|
873
|
+
const r = getResolvedMetricsDateRange(range);
|
|
874
|
+
return requestJson(
|
|
875
|
+
configuration,
|
|
876
|
+
dependencies,
|
|
877
|
+
`/v1/portfolios/${portfolioId}/metrics/multiitemforecastpredictabilityscore?${getMetricsDateRangeQuery(r)}`,
|
|
878
|
+
{ method: "GET" }
|
|
879
|
+
);
|
|
880
|
+
},
|
|
881
|
+
getPortfolioTotalWorkItemAge: async (portfolioId, asOfDate) => requestJson(
|
|
882
|
+
configuration,
|
|
883
|
+
dependencies,
|
|
884
|
+
`/v1/portfolios/${portfolioId}/metrics/totalWorkItemAge?${getMetricsAsOfDateQuery(asOfDate)}`,
|
|
885
|
+
{ method: "GET" }
|
|
886
|
+
),
|
|
887
|
+
getPortfolioTotalWorkItemAgePbc: async (portfolioId, range) => {
|
|
888
|
+
const r = getResolvedMetricsDateRange(range);
|
|
769
889
|
return requestJson(
|
|
770
890
|
configuration,
|
|
771
891
|
dependencies,
|
|
772
|
-
`/v1/portfolios/${portfolioId}/metrics/
|
|
892
|
+
`/v1/portfolios/${portfolioId}/metrics/totalWorkItemAge/pbc?${getMetricsDateRangeQuery(r)}`,
|
|
773
893
|
{ method: "GET" }
|
|
774
894
|
);
|
|
775
895
|
},
|
package/package.json
CHANGED