@letpeoplework/lighthouse-client 1.9.0 → 1.10.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 CHANGED
@@ -627,6 +627,7 @@ const readFeatureWording = (source, featureId) => readAnswerWording(source, {
627
627
  //#region src/deliveryWording.ts
628
628
  const LISTED_CHANCE = 85;
629
629
  const flagOf = (value) => typeof value === "boolean" ? value : void 0;
630
+ const teamsWithoutForecastIn = (value) => Array.isArray(value.teamsWithoutForecast) && value.teamsWithoutForecast.length > 0;
630
631
  const readDeliveryListItem = (value) => {
631
632
  if (!isRecord(value) || typeof value.id !== "number" || typeof value.totalWork !== "number" || typeof value.remainingWork !== "number") return null;
632
633
  const name = textOf(value.name);
@@ -640,7 +641,7 @@ const readDeliveryListItem = (value) => {
640
641
  totalWork: value.totalWork,
641
642
  remainingWork: value.remainingWork,
642
643
  likelihood: typeof value.likelihoodPercentage === "number" ? value.likelihoodPercentage : null,
643
- cannotBeForecast: Array.isArray(value.teamsWithoutForecast) && value.teamsWithoutForecast.length > 0,
644
+ cannotBeForecast: teamsWithoutForecastIn(value),
644
645
  hasSufficientData: flagOf(value.hasSufficientData),
645
646
  isOverdue: flagOf(value.isOverdue),
646
647
  likelyBy: expectedDateAt(value.completionDates, LISTED_CHANCE)
@@ -655,6 +656,40 @@ const readDeliveryList = (value) => {
655
656
  const items = value.map(readDeliveryListItem);
656
657
  return items.every((item) => item !== null) ? items : null;
657
658
  };
659
+ const doneWorkOf = (value) => {
660
+ if (typeof value.doneWork === "number") return value.doneWork;
661
+ return typeof value.totalWork === "number" && typeof value.remainingWork === "number" ? value.totalWork - value.remainingWork : void 0;
662
+ };
663
+ /** One archived Delivery, or null when it comes without its id, name, dates or work. */
664
+ const readArchivedDeliveryItem = (value) => {
665
+ if (!isRecord(value) || typeof value.id !== "number" || typeof value.totalWork !== "number") return null;
666
+ const name = textOf(value.name);
667
+ const date = textOf(value.date);
668
+ const archivedOn = textOf(value.archivedOn);
669
+ const doneWork = doneWorkOf(value);
670
+ if (name === void 0 || date === void 0 || archivedOn === void 0 || doneWork === void 0) return null;
671
+ return {
672
+ id: value.id,
673
+ name,
674
+ date,
675
+ archivedOn,
676
+ totalWork: value.totalWork,
677
+ doneWork,
678
+ likelihood: typeof value.likelihoodPercentage === "number" ? value.likelihoodPercentage : null,
679
+ cannotBeForecast: teamsWithoutForecastIn(value),
680
+ hasSufficientData: flagOf(value.hasSufficientData)
681
+ };
682
+ };
683
+ /** A Portfolio's active and archived Deliveries, or null when either list or any row in it cannot be read. */
684
+ const readPortfolioDeliveries = (value) => {
685
+ if (!isRecord(value) || !Array.isArray(value.archived)) return null;
686
+ const active = readDeliveryList(value.active);
687
+ const archived = value.archived.map(readArchivedDeliveryItem);
688
+ return active !== null && archived.every((item) => item !== null) ? {
689
+ active,
690
+ archived
691
+ } : null;
692
+ };
658
693
  /** "Ocean Explorer · Deliveries", or the Portfolio by its id when its name could not be read. */
659
694
  const describeDeliveryListTitle = (owner, terms) => {
660
695
  return `${owner.name === void 0 ? `${terms.portfolio} [id: ${owner.id}]` : owner.name} · ${terms.deliveries}`;
@@ -695,6 +730,36 @@ const describeDeliveryRow = (delivery, terms) => [
695
730
  describeDeliveryLikelihood(delivery),
696
731
  delivery.likelyBy === void 0 ? "—" : dayOf(delivery.likelyBy)
697
732
  ];
733
+ /** What heads the archived Deliveries, below the active ones: "Archived Deliveries". */
734
+ const describeArchivedDeliveriesTitle = (terms) => `Archived ${terms.deliveries}`;
735
+ /** The archived table's column headings: when it was due, when it closed, and what it reached. */
736
+ const describeArchivedDeliveryHeadings = (terms) => [
737
+ "Name",
738
+ `${terms.delivery} Date`,
739
+ "Archived On",
740
+ "Done",
741
+ "Likelihood"
742
+ ];
743
+ /** One archived Delivery as a row of its table, in the order of its headings. */
744
+ const describeArchivedDeliveryRow = (delivery, terms) => {
745
+ const remainingWork = delivery.totalWork - delivery.doneWork;
746
+ return [
747
+ describeOwnerName(delivery),
748
+ dayOf(delivery.date),
749
+ dayOf(delivery.archivedOn),
750
+ describeDeliveryDone({
751
+ totalWork: delivery.totalWork,
752
+ remainingWork
753
+ }, terms),
754
+ likelihoodAnswer({
755
+ likelihood: delivery.likelihood,
756
+ cannotBeForecast: delivery.cannotBeForecast,
757
+ hasRemainingWork: remainingWork > 0,
758
+ hasSufficientData: delivery.hasSufficientData,
759
+ precision: "round"
760
+ })
761
+ ];
762
+ };
698
763
  const isNullableNumber = (value) => value === null || typeof value === "number";
699
764
  const isFeatureMetric = (value) => isRecord(value) && typeof value.referenceId === "string" && typeof value.name === "string" && typeof value.completion === "number" && isNullableNumber(value.likelihood);
700
765
  const isChance = (value) => isRecord(value) && typeof value.probability === "number" && textOf(value.expectedDate) !== void 0;
@@ -2796,6 +2861,16 @@ const pollCliAuthSession = async (endpointUrl, sessionId, dependencies) => {
2796
2861
  return { status: "expired" };
2797
2862
  }
2798
2863
  };
2864
+ const toPortfolioDeliveries = (value) => {
2865
+ if (Array.isArray(value)) return {
2866
+ active: value,
2867
+ archived: []
2868
+ };
2869
+ return isObjectRecord(value) && Array.isArray(value.active) && Array.isArray(value.archived) ? {
2870
+ active: value.active,
2871
+ archived: value.archived
2872
+ } : null;
2873
+ };
2799
2874
  const getDefaultMetricsDateRange = () => {
2800
2875
  const end = /* @__PURE__ */ new Date();
2801
2876
  const start = /* @__PURE__ */ new Date();
@@ -3431,7 +3506,18 @@ const createLighthouseClient = (configuration, dependencies = {}) => {
3431
3506
  return requestJson(configuration, dependencies, `/v1/features/references?${queryString}`, { method: "GET" });
3432
3507
  },
3433
3508
  getFeatureWorkItems: async (featureId) => requestJson(configuration, dependencies, `/v1/features/${featureId}/workitems`, { method: "GET" }),
3434
- listDeliveries: async (portfolioId) => requestJson(configuration, dependencies, `/v1/deliveries/portfolio/${portfolioId}`, { method: "GET" }),
3509
+ listDeliveries: async (portfolioId) => {
3510
+ const result = await requestJson(configuration, dependencies, `/v1/deliveries/portfolio/${portfolioId}`, { method: "GET" });
3511
+ if (!result.ok) return result;
3512
+ const deliveries = toPortfolioDeliveries(result.value);
3513
+ return deliveries === null ? getErrorResult({
3514
+ category: "unexpected",
3515
+ reason: "Lighthouse's list of Deliveries is not readable."
3516
+ }) : {
3517
+ ok: true,
3518
+ value: deliveries
3519
+ };
3520
+ },
3435
3521
  createDelivery: async (portfolioId, payload) => requestJson(configuration, dependencies, `/v1/deliveries/portfolio/${portfolioId}`, {
3436
3522
  method: "POST",
3437
3523
  body: payload
@@ -3561,6 +3647,9 @@ exports.createLighthouseClient = createLighthouseClient;
3561
3647
  exports.daysInRange = daysInRange;
3562
3648
  exports.deliveryLikelihoodAnswer = deliveryLikelihoodAnswer;
3563
3649
  exports.describeAnswer = describeAnswer;
3650
+ exports.describeArchivedDeliveriesTitle = describeArchivedDeliveriesTitle;
3651
+ exports.describeArchivedDeliveryHeadings = describeArchivedDeliveryHeadings;
3652
+ exports.describeArchivedDeliveryRow = describeArchivedDeliveryRow;
3564
3653
  exports.describeArrivalsDays = describeArrivalsDays;
3565
3654
  exports.describeAsOfHeading = describeAsOfHeading;
3566
3655
  exports.describeBacktestActual = describeBacktestActual;
@@ -3696,6 +3785,7 @@ exports.pollCliAuthSession = pollCliAuthSession;
3696
3785
  exports.processBehaviorChartTitle = processBehaviorChartTitle;
3697
3786
  exports.queryServerAuthMode = queryServerAuthMode;
3698
3787
  exports.readAnswerWording = readAnswerWording;
3788
+ exports.readArchivedDeliveryItem = readArchivedDeliveryItem;
3699
3789
  exports.readArrivals = readArrivals;
3700
3790
  exports.readBacktest = readBacktest;
3701
3791
  exports.readBlackoutRules = readBlackoutRules;
@@ -3717,6 +3807,7 @@ exports.readNameOfMyVote = readNameOfMyVote;
3717
3807
  exports.readOwnerList = readOwnerList;
3718
3808
  exports.readPercentilesOverTime = readPercentilesOverTime;
3719
3809
  exports.readPortfolio = readPortfolio;
3810
+ exports.readPortfolioDeliveries = readPortfolioDeliveries;
3720
3811
  exports.readPredictabilityScore = readPredictabilityScore;
3721
3812
  exports.readProcessBehaviorChart = readProcessBehaviorChart;
3722
3813
  exports.readProcessBehaviorOverTime = readProcessBehaviorOverTime;
package/dist/index.d.cts CHANGED
@@ -206,6 +206,25 @@ export type DeliveryListOwner = {
206
206
  * id, name, date or work: a row that cannot say what it is or when it is due would misstate the list.
207
207
  */
208
208
  export declare const readDeliveryList: (value: unknown) => DeliveryListItem[] | null;
209
+ /** One archived Delivery as the archived table states it: the numbers written down the day it closed. */
210
+ export type ArchivedDeliveryItem = {
211
+ readonly id: number;
212
+ readonly name: string;
213
+ readonly date: string;
214
+ readonly archivedOn: string;
215
+ readonly totalWork: number;
216
+ readonly doneWork: number;
217
+ readonly likelihood: number | null;
218
+ readonly cannotBeForecast: boolean;
219
+ readonly hasSufficientData: boolean | undefined;
220
+ };
221
+ /** One archived Delivery, or null when it comes without its id, name, dates or work. */
222
+ export declare const readArchivedDeliveryItem: (value: unknown) => ArchivedDeliveryItem | null;
223
+ /** A Portfolio's active and archived Deliveries, or null when either list or any row in it cannot be read. */
224
+ export declare const readPortfolioDeliveries: (value: unknown) => {
225
+ active: DeliveryListItem[];
226
+ archived: ArchivedDeliveryItem[];
227
+ } | null;
209
228
  /** "Ocean Explorer · Deliveries", or the Portfolio by its id when its name could not be read. */
210
229
  export declare const describeDeliveryListTitle: (owner: DeliveryListOwner, terms: Terms) => string;
211
230
  /** What a Portfolio without any Delivery shows instead of the table. */
@@ -220,6 +239,12 @@ export declare const describeDeliveryDone: (delivery: Pick<DeliveryListItem, "to
220
239
  export declare const describeDeliveryLikelihood: (delivery: DeliveryListItem) => string;
221
240
  /** One Delivery as a row of the list, in the order of its headings. */
222
241
  export declare const describeDeliveryRow: (delivery: DeliveryListItem, terms: Terms) => string[];
242
+ /** What heads the archived Deliveries, below the active ones: "Archived Deliveries". */
243
+ export declare const describeArchivedDeliveriesTitle: (terms: Terms) => string;
244
+ /** The archived table's column headings: when it was due, when it closed, and what it reached. */
245
+ export declare const describeArchivedDeliveryHeadings: (terms: Terms) => string[];
246
+ /** One archived Delivery as a row of its table, in the order of its headings. */
247
+ export declare const describeArchivedDeliveryRow: (delivery: ArchivedDeliveryItem, terms: Terms) => string[];
223
248
  /**
224
249
  * A Delivery's recorded days, or null when the answer lacks its Delivery Date or any day lacks a fact its
225
250
  * row or detail states: a table with a hole in it would misstate the trend.
@@ -1303,6 +1328,11 @@ export type LighthouseApiResult<TValue> = {
1303
1328
  readonly error: LighthouseApiError;
1304
1329
  };
1305
1330
  export type LighthouseWritePayload = Readonly<Record<string, unknown>>;
1331
+ /** A Portfolio's Deliveries: the ones still running apart from the archived ones. */
1332
+ export type PortfolioDeliveries = {
1333
+ readonly active: readonly unknown[];
1334
+ readonly archived: readonly unknown[];
1335
+ };
1306
1336
  export type MetricsDateRange = {
1307
1337
  readonly startDate: string;
1308
1338
  readonly endDate: string;
@@ -1773,7 +1803,7 @@ export type LighthouseClient = {
1773
1803
  readonly getFeaturesByIds: (ids: readonly number[]) => Promise<LighthouseApiResult<readonly unknown[]>>;
1774
1804
  readonly getFeaturesByReferences: (refs: readonly string[]) => Promise<LighthouseApiResult<readonly unknown[]>>;
1775
1805
  readonly getFeatureWorkItems: (featureId: number) => Promise<LighthouseApiResult<readonly unknown[]>>;
1776
- readonly listDeliveries: (portfolioId: number) => Promise<LighthouseApiResult<readonly unknown[]>>;
1806
+ readonly listDeliveries: (portfolioId: number) => Promise<LighthouseApiResult<PortfolioDeliveries>>;
1777
1807
  readonly createDelivery: (portfolioId: number, payload: LighthouseWritePayload) => Promise<LighthouseApiResult<unknown>>;
1778
1808
  readonly updateDelivery: (deliveryId: number, payload: LighthouseWritePayload) => Promise<LighthouseApiResult<unknown>>;
1779
1809
  readonly deleteDelivery: (deliveryId: number) => Promise<LighthouseApiResult<undefined>>;
package/dist/index.d.ts CHANGED
@@ -206,6 +206,25 @@ export type DeliveryListOwner = {
206
206
  * id, name, date or work: a row that cannot say what it is or when it is due would misstate the list.
207
207
  */
208
208
  export declare const readDeliveryList: (value: unknown) => DeliveryListItem[] | null;
209
+ /** One archived Delivery as the archived table states it: the numbers written down the day it closed. */
210
+ export type ArchivedDeliveryItem = {
211
+ readonly id: number;
212
+ readonly name: string;
213
+ readonly date: string;
214
+ readonly archivedOn: string;
215
+ readonly totalWork: number;
216
+ readonly doneWork: number;
217
+ readonly likelihood: number | null;
218
+ readonly cannotBeForecast: boolean;
219
+ readonly hasSufficientData: boolean | undefined;
220
+ };
221
+ /** One archived Delivery, or null when it comes without its id, name, dates or work. */
222
+ export declare const readArchivedDeliveryItem: (value: unknown) => ArchivedDeliveryItem | null;
223
+ /** A Portfolio's active and archived Deliveries, or null when either list or any row in it cannot be read. */
224
+ export declare const readPortfolioDeliveries: (value: unknown) => {
225
+ active: DeliveryListItem[];
226
+ archived: ArchivedDeliveryItem[];
227
+ } | null;
209
228
  /** "Ocean Explorer · Deliveries", or the Portfolio by its id when its name could not be read. */
210
229
  export declare const describeDeliveryListTitle: (owner: DeliveryListOwner, terms: Terms) => string;
211
230
  /** What a Portfolio without any Delivery shows instead of the table. */
@@ -220,6 +239,12 @@ export declare const describeDeliveryDone: (delivery: Pick<DeliveryListItem, "to
220
239
  export declare const describeDeliveryLikelihood: (delivery: DeliveryListItem) => string;
221
240
  /** One Delivery as a row of the list, in the order of its headings. */
222
241
  export declare const describeDeliveryRow: (delivery: DeliveryListItem, terms: Terms) => string[];
242
+ /** What heads the archived Deliveries, below the active ones: "Archived Deliveries". */
243
+ export declare const describeArchivedDeliveriesTitle: (terms: Terms) => string;
244
+ /** The archived table's column headings: when it was due, when it closed, and what it reached. */
245
+ export declare const describeArchivedDeliveryHeadings: (terms: Terms) => string[];
246
+ /** One archived Delivery as a row of its table, in the order of its headings. */
247
+ export declare const describeArchivedDeliveryRow: (delivery: ArchivedDeliveryItem, terms: Terms) => string[];
223
248
  /**
224
249
  * A Delivery's recorded days, or null when the answer lacks its Delivery Date or any day lacks a fact its
225
250
  * row or detail states: a table with a hole in it would misstate the trend.
@@ -1303,6 +1328,11 @@ export type LighthouseApiResult<TValue> = {
1303
1328
  readonly error: LighthouseApiError;
1304
1329
  };
1305
1330
  export type LighthouseWritePayload = Readonly<Record<string, unknown>>;
1331
+ /** A Portfolio's Deliveries: the ones still running apart from the archived ones. */
1332
+ export type PortfolioDeliveries = {
1333
+ readonly active: readonly unknown[];
1334
+ readonly archived: readonly unknown[];
1335
+ };
1306
1336
  export type MetricsDateRange = {
1307
1337
  readonly startDate: string;
1308
1338
  readonly endDate: string;
@@ -1773,7 +1803,7 @@ export type LighthouseClient = {
1773
1803
  readonly getFeaturesByIds: (ids: readonly number[]) => Promise<LighthouseApiResult<readonly unknown[]>>;
1774
1804
  readonly getFeaturesByReferences: (refs: readonly string[]) => Promise<LighthouseApiResult<readonly unknown[]>>;
1775
1805
  readonly getFeatureWorkItems: (featureId: number) => Promise<LighthouseApiResult<readonly unknown[]>>;
1776
- readonly listDeliveries: (portfolioId: number) => Promise<LighthouseApiResult<readonly unknown[]>>;
1806
+ readonly listDeliveries: (portfolioId: number) => Promise<LighthouseApiResult<PortfolioDeliveries>>;
1777
1807
  readonly createDelivery: (portfolioId: number, payload: LighthouseWritePayload) => Promise<LighthouseApiResult<unknown>>;
1778
1808
  readonly updateDelivery: (deliveryId: number, payload: LighthouseWritePayload) => Promise<LighthouseApiResult<unknown>>;
1779
1809
  readonly deleteDelivery: (deliveryId: number) => Promise<LighthouseApiResult<undefined>>;
package/dist/index.js CHANGED
@@ -626,6 +626,7 @@ const readFeatureWording = (source, featureId) => readAnswerWording(source, {
626
626
  //#region src/deliveryWording.ts
627
627
  const LISTED_CHANCE = 85;
628
628
  const flagOf = (value) => typeof value === "boolean" ? value : void 0;
629
+ const teamsWithoutForecastIn = (value) => Array.isArray(value.teamsWithoutForecast) && value.teamsWithoutForecast.length > 0;
629
630
  const readDeliveryListItem = (value) => {
630
631
  if (!isRecord(value) || typeof value.id !== "number" || typeof value.totalWork !== "number" || typeof value.remainingWork !== "number") return null;
631
632
  const name = textOf(value.name);
@@ -639,7 +640,7 @@ const readDeliveryListItem = (value) => {
639
640
  totalWork: value.totalWork,
640
641
  remainingWork: value.remainingWork,
641
642
  likelihood: typeof value.likelihoodPercentage === "number" ? value.likelihoodPercentage : null,
642
- cannotBeForecast: Array.isArray(value.teamsWithoutForecast) && value.teamsWithoutForecast.length > 0,
643
+ cannotBeForecast: teamsWithoutForecastIn(value),
643
644
  hasSufficientData: flagOf(value.hasSufficientData),
644
645
  isOverdue: flagOf(value.isOverdue),
645
646
  likelyBy: expectedDateAt(value.completionDates, LISTED_CHANCE)
@@ -654,6 +655,40 @@ const readDeliveryList = (value) => {
654
655
  const items = value.map(readDeliveryListItem);
655
656
  return items.every((item) => item !== null) ? items : null;
656
657
  };
658
+ const doneWorkOf = (value) => {
659
+ if (typeof value.doneWork === "number") return value.doneWork;
660
+ return typeof value.totalWork === "number" && typeof value.remainingWork === "number" ? value.totalWork - value.remainingWork : void 0;
661
+ };
662
+ /** One archived Delivery, or null when it comes without its id, name, dates or work. */
663
+ const readArchivedDeliveryItem = (value) => {
664
+ if (!isRecord(value) || typeof value.id !== "number" || typeof value.totalWork !== "number") return null;
665
+ const name = textOf(value.name);
666
+ const date = textOf(value.date);
667
+ const archivedOn = textOf(value.archivedOn);
668
+ const doneWork = doneWorkOf(value);
669
+ if (name === void 0 || date === void 0 || archivedOn === void 0 || doneWork === void 0) return null;
670
+ return {
671
+ id: value.id,
672
+ name,
673
+ date,
674
+ archivedOn,
675
+ totalWork: value.totalWork,
676
+ doneWork,
677
+ likelihood: typeof value.likelihoodPercentage === "number" ? value.likelihoodPercentage : null,
678
+ cannotBeForecast: teamsWithoutForecastIn(value),
679
+ hasSufficientData: flagOf(value.hasSufficientData)
680
+ };
681
+ };
682
+ /** A Portfolio's active and archived Deliveries, or null when either list or any row in it cannot be read. */
683
+ const readPortfolioDeliveries = (value) => {
684
+ if (!isRecord(value) || !Array.isArray(value.archived)) return null;
685
+ const active = readDeliveryList(value.active);
686
+ const archived = value.archived.map(readArchivedDeliveryItem);
687
+ return active !== null && archived.every((item) => item !== null) ? {
688
+ active,
689
+ archived
690
+ } : null;
691
+ };
657
692
  /** "Ocean Explorer · Deliveries", or the Portfolio by its id when its name could not be read. */
658
693
  const describeDeliveryListTitle = (owner, terms) => {
659
694
  return `${owner.name === void 0 ? `${terms.portfolio} [id: ${owner.id}]` : owner.name} · ${terms.deliveries}`;
@@ -694,6 +729,36 @@ const describeDeliveryRow = (delivery, terms) => [
694
729
  describeDeliveryLikelihood(delivery),
695
730
  delivery.likelyBy === void 0 ? "—" : dayOf(delivery.likelyBy)
696
731
  ];
732
+ /** What heads the archived Deliveries, below the active ones: "Archived Deliveries". */
733
+ const describeArchivedDeliveriesTitle = (terms) => `Archived ${terms.deliveries}`;
734
+ /** The archived table's column headings: when it was due, when it closed, and what it reached. */
735
+ const describeArchivedDeliveryHeadings = (terms) => [
736
+ "Name",
737
+ `${terms.delivery} Date`,
738
+ "Archived On",
739
+ "Done",
740
+ "Likelihood"
741
+ ];
742
+ /** One archived Delivery as a row of its table, in the order of its headings. */
743
+ const describeArchivedDeliveryRow = (delivery, terms) => {
744
+ const remainingWork = delivery.totalWork - delivery.doneWork;
745
+ return [
746
+ describeOwnerName(delivery),
747
+ dayOf(delivery.date),
748
+ dayOf(delivery.archivedOn),
749
+ describeDeliveryDone({
750
+ totalWork: delivery.totalWork,
751
+ remainingWork
752
+ }, terms),
753
+ likelihoodAnswer({
754
+ likelihood: delivery.likelihood,
755
+ cannotBeForecast: delivery.cannotBeForecast,
756
+ hasRemainingWork: remainingWork > 0,
757
+ hasSufficientData: delivery.hasSufficientData,
758
+ precision: "round"
759
+ })
760
+ ];
761
+ };
697
762
  const isNullableNumber = (value) => value === null || typeof value === "number";
698
763
  const isFeatureMetric = (value) => isRecord(value) && typeof value.referenceId === "string" && typeof value.name === "string" && typeof value.completion === "number" && isNullableNumber(value.likelihood);
699
764
  const isChance = (value) => isRecord(value) && typeof value.probability === "number" && textOf(value.expectedDate) !== void 0;
@@ -2795,6 +2860,16 @@ const pollCliAuthSession = async (endpointUrl, sessionId, dependencies) => {
2795
2860
  return { status: "expired" };
2796
2861
  }
2797
2862
  };
2863
+ const toPortfolioDeliveries = (value) => {
2864
+ if (Array.isArray(value)) return {
2865
+ active: value,
2866
+ archived: []
2867
+ };
2868
+ return isObjectRecord(value) && Array.isArray(value.active) && Array.isArray(value.archived) ? {
2869
+ active: value.active,
2870
+ archived: value.archived
2871
+ } : null;
2872
+ };
2798
2873
  const getDefaultMetricsDateRange = () => {
2799
2874
  const end = /* @__PURE__ */ new Date();
2800
2875
  const start = /* @__PURE__ */ new Date();
@@ -3430,7 +3505,18 @@ const createLighthouseClient = (configuration, dependencies = {}) => {
3430
3505
  return requestJson(configuration, dependencies, `/v1/features/references?${queryString}`, { method: "GET" });
3431
3506
  },
3432
3507
  getFeatureWorkItems: async (featureId) => requestJson(configuration, dependencies, `/v1/features/${featureId}/workitems`, { method: "GET" }),
3433
- listDeliveries: async (portfolioId) => requestJson(configuration, dependencies, `/v1/deliveries/portfolio/${portfolioId}`, { method: "GET" }),
3508
+ listDeliveries: async (portfolioId) => {
3509
+ const result = await requestJson(configuration, dependencies, `/v1/deliveries/portfolio/${portfolioId}`, { method: "GET" });
3510
+ if (!result.ok) return result;
3511
+ const deliveries = toPortfolioDeliveries(result.value);
3512
+ return deliveries === null ? getErrorResult({
3513
+ category: "unexpected",
3514
+ reason: "Lighthouse's list of Deliveries is not readable."
3515
+ }) : {
3516
+ ok: true,
3517
+ value: deliveries
3518
+ };
3519
+ },
3434
3520
  createDelivery: async (portfolioId, payload) => requestJson(configuration, dependencies, `/v1/deliveries/portfolio/${portfolioId}`, {
3435
3521
  method: "POST",
3436
3522
  body: payload
@@ -3529,4 +3615,4 @@ const usageDataCalls = (configuration, dependencies) => {
3529
3615
  };
3530
3616
  };
3531
3617
  //#endregion
3532
- export { BLACKOUT_RULE_LIST_HEADINGS, BLACKOUT_RULE_LIST_TITLE, CANNOT_FORECAST_SHORT, FEATURE_REQUIRES_SERVER_NEWER_THAN, INSUFFICIENT_FORECAST_DATA_SENTENCE, INSUFFICIENT_FORECAST_DATA_SHORT, LIGHTHOUSE_IS_REACHABLE, NOT_SENT, NOT_SET, NO_DATA_YET, OVERDUE_SHORT, OVER_TIME_EMPTY_SENTENCE, PREDICTABILITY_SCORE_EXPLANATION, REFINEMENT_ANSWERS, SECRET_NOT_SHOWN, SEEDED_TERMS, SLE_RISK_AT_RISK_FROM, STANDALONE_VOTER_KEY_SCOPE, UNKNOWN_SHAPE_NOTE, USAGE_DATA_BUDGET_MS, VOTER_KEY_HEADER, WORK_TRACKING_CONNECTION_LIST_HEADINGS, WORK_TRACKING_OPTION_HEADINGS, countNumberedRows, createFileUsageDataStore, createFileVoterKeyStore, createLighthouseAuthContext, createLighthouseClient, daysInRange, deliveryLikelihoodAnswer, describeAnswer, describeArrivalsDays, describeAsOfHeading, describeBacktestActual, describeBacktestPeriod, describeBacktestSummary, describeBlackoutRuleCount, describeBlackoutRuleSchedule, describeBlackoutRuleWriteConfirmation, describeBlockedDays, describeBlockedNow, describeBlockedOverTime, describeConnectionName, describeConnectionSummary, describeConnectionType, describeCycleTimeDays, describeDays, describeDeliveryChanceHeadings, describeDeliveryChanceRow, describeDeliveryCount, describeDeliveryDone, describeDeliveryFeatureHeadings, describeDeliveryFeatureRow, describeDeliveryLikelihood, describeDeliveryListHeadings, describeDeliveryListTitle, describeDeliveryMetricsHeading, describeDeliveryRow, describeFeatureCompletion, describeFeatureCount, describeFeatureListCount, describeFeatureListHeadings, describeFeatureProgress, describeFeatureRow, describeFeatureStart, describeFeatureTitle, describeFeatureWorkItemHeadings, describeFeatureWorkItemRow, describeFeatureWorkItemsHeading, describeHowManyTitle, describeInProgressNow, describeLastUpdated, describeManualForecastLikelihood, describeManualForecastSummary, describeMetricSummary, describeMetricsHeading, describeMissingCondition, describeNoBlackoutRules, describeNoDeliveries, describeNothingToTakeBack, describeOptionValue, describeOverTimeHeading, describeOwnerCount, describeOwnerListHeadings, describeOwnerListTitle, describeOwnerName, describeOwnerWriteConfirmation, describePercentileRows, describePercentilesOverTime, describePercentilesOverTimeDays, describePortfolioSummary, describePredictabilityScore, describePredictabilityScoreDays, describeProcessBehaviorChart, describeProcessBehaviorOverTime, describeProcessBehaviorOverTimeDays, describeReachable, describeReadiness, describeRecordedComment, describeRecordedDayHeadings, describeRecordedDayRow, describeRecordedDayTitle, describeRecordedVote, describeRefinementSummary, describeRefreshConfirmation, describeRefusedMetric, describeSleRiskNow, describeTags, describeTakenBack, describeTeamSummary, describeThroughputDays, describeTimeInState, describeTimeInStateContributorDays, describeTimeInStateDays, describeTotalArrivals, describeTotalThroughput, describeTotalWorkItemAge, describeTotalWorkItemAgeDays, describeUnknownMetric, describeVersion, describeVoteRefusal, describeVotes, describeWarnings, describeWhatWipLeavesUnsaid, describeWhenTitle, describeWipDays, describeWorkItemAgeDays, describeWorkItemAgePercentiles, describeWorkTrackingSystemCount, formatCalendarDay, formatLikelihood, formatTimestamp, getClientPackageContract, getDefaultMetricsDateRange, getStandaloneDiscoveryLockfilePath, getUsageDataStorePath, getVoterKeyScope, getVoterKeyStorePath, hideConnectionSecrets, isAPersonAtTheTerminal, isAtRiskOfMissingTheSle, isCalendarDay, isDoNotTrackSet, isMetricRefusal, isMissingItsCondition, isProcessBehaviorMetricType, isRefinementAnswer, isServerVersionNewerThan, keepVoterKey, latestRecordedDay, levelOf, likelihoodAnswer, loadStandaloneDiscoveryContract, metricsHeadlineLabel, mintVoterKey, myVoteOn, nameOrFallback, ordinalOf, parseStandaloneDiscoveryContract, placeActualAmongPercentiles, placeEnoughForLine, planUsageDataStep, pollCliAuthSession, processBehaviorChartTitle, queryServerAuthMode, readAnswerWording, readArrivals, readBacktest, readBlackoutRules, readBlocked, readCumulativeStateTime, readCycleTime, readCycleTimeDefinitionName, readCycleTimePercentiles, readDeliveryList, readDeliveryMetricsHistory, readFeatureList, readFeatureWording, readFeatureWorkItems, readInProgressItems, readManualForecast, readMetricAnswer, readMetricsSubject, readNameOfMyVote, readOwnerList, readPercentilesOverTime, readPortfolio, readPredictabilityScore, readProcessBehaviorChart, readProcessBehaviorOverTime, readRefinementTerms, readRefinementWording, readRunChart, readServiceLevelExpectation, readSleRisk, readStoredUsageDataAnswer, readSystemWipLimit, readTeam, readTerms, readThroughput, readTimeInStateBar, readTimeInStateContributors, readTotalWorkItemAge, readUsageDataState, readVoteRefusal, readWip, readWorkItemAge, readWorkItemAgePercentiles, readWorkTrackingConnection, readWorkTrackingConnections, readWrittenBlackoutRule, readWrittenOwner, refinementDayVerdictOf, resolveTerms, settleUsageDataStep, sizingMomentOf, startCliAuthSession, summariseDeliveryMetricsHistory, switchUsageDataOn, timeInStateItemCount, usageDataStoreFor, validateLighthouseConnectivity, voterKeyStoreFor, withdrawUsageData };
3618
+ export { BLACKOUT_RULE_LIST_HEADINGS, BLACKOUT_RULE_LIST_TITLE, CANNOT_FORECAST_SHORT, FEATURE_REQUIRES_SERVER_NEWER_THAN, INSUFFICIENT_FORECAST_DATA_SENTENCE, INSUFFICIENT_FORECAST_DATA_SHORT, LIGHTHOUSE_IS_REACHABLE, NOT_SENT, NOT_SET, NO_DATA_YET, OVERDUE_SHORT, OVER_TIME_EMPTY_SENTENCE, PREDICTABILITY_SCORE_EXPLANATION, REFINEMENT_ANSWERS, SECRET_NOT_SHOWN, SEEDED_TERMS, SLE_RISK_AT_RISK_FROM, STANDALONE_VOTER_KEY_SCOPE, UNKNOWN_SHAPE_NOTE, USAGE_DATA_BUDGET_MS, VOTER_KEY_HEADER, WORK_TRACKING_CONNECTION_LIST_HEADINGS, WORK_TRACKING_OPTION_HEADINGS, countNumberedRows, createFileUsageDataStore, createFileVoterKeyStore, createLighthouseAuthContext, createLighthouseClient, daysInRange, deliveryLikelihoodAnswer, describeAnswer, describeArchivedDeliveriesTitle, describeArchivedDeliveryHeadings, describeArchivedDeliveryRow, describeArrivalsDays, describeAsOfHeading, describeBacktestActual, describeBacktestPeriod, describeBacktestSummary, describeBlackoutRuleCount, describeBlackoutRuleSchedule, describeBlackoutRuleWriteConfirmation, describeBlockedDays, describeBlockedNow, describeBlockedOverTime, describeConnectionName, describeConnectionSummary, describeConnectionType, describeCycleTimeDays, describeDays, describeDeliveryChanceHeadings, describeDeliveryChanceRow, describeDeliveryCount, describeDeliveryDone, describeDeliveryFeatureHeadings, describeDeliveryFeatureRow, describeDeliveryLikelihood, describeDeliveryListHeadings, describeDeliveryListTitle, describeDeliveryMetricsHeading, describeDeliveryRow, describeFeatureCompletion, describeFeatureCount, describeFeatureListCount, describeFeatureListHeadings, describeFeatureProgress, describeFeatureRow, describeFeatureStart, describeFeatureTitle, describeFeatureWorkItemHeadings, describeFeatureWorkItemRow, describeFeatureWorkItemsHeading, describeHowManyTitle, describeInProgressNow, describeLastUpdated, describeManualForecastLikelihood, describeManualForecastSummary, describeMetricSummary, describeMetricsHeading, describeMissingCondition, describeNoBlackoutRules, describeNoDeliveries, describeNothingToTakeBack, describeOptionValue, describeOverTimeHeading, describeOwnerCount, describeOwnerListHeadings, describeOwnerListTitle, describeOwnerName, describeOwnerWriteConfirmation, describePercentileRows, describePercentilesOverTime, describePercentilesOverTimeDays, describePortfolioSummary, describePredictabilityScore, describePredictabilityScoreDays, describeProcessBehaviorChart, describeProcessBehaviorOverTime, describeProcessBehaviorOverTimeDays, describeReachable, describeReadiness, describeRecordedComment, describeRecordedDayHeadings, describeRecordedDayRow, describeRecordedDayTitle, describeRecordedVote, describeRefinementSummary, describeRefreshConfirmation, describeRefusedMetric, describeSleRiskNow, describeTags, describeTakenBack, describeTeamSummary, describeThroughputDays, describeTimeInState, describeTimeInStateContributorDays, describeTimeInStateDays, describeTotalArrivals, describeTotalThroughput, describeTotalWorkItemAge, describeTotalWorkItemAgeDays, describeUnknownMetric, describeVersion, describeVoteRefusal, describeVotes, describeWarnings, describeWhatWipLeavesUnsaid, describeWhenTitle, describeWipDays, describeWorkItemAgeDays, describeWorkItemAgePercentiles, describeWorkTrackingSystemCount, formatCalendarDay, formatLikelihood, formatTimestamp, getClientPackageContract, getDefaultMetricsDateRange, getStandaloneDiscoveryLockfilePath, getUsageDataStorePath, getVoterKeyScope, getVoterKeyStorePath, hideConnectionSecrets, isAPersonAtTheTerminal, isAtRiskOfMissingTheSle, isCalendarDay, isDoNotTrackSet, isMetricRefusal, isMissingItsCondition, isProcessBehaviorMetricType, isRefinementAnswer, isServerVersionNewerThan, keepVoterKey, latestRecordedDay, levelOf, likelihoodAnswer, loadStandaloneDiscoveryContract, metricsHeadlineLabel, mintVoterKey, myVoteOn, nameOrFallback, ordinalOf, parseStandaloneDiscoveryContract, placeActualAmongPercentiles, placeEnoughForLine, planUsageDataStep, pollCliAuthSession, processBehaviorChartTitle, queryServerAuthMode, readAnswerWording, readArchivedDeliveryItem, readArrivals, readBacktest, readBlackoutRules, readBlocked, readCumulativeStateTime, readCycleTime, readCycleTimeDefinitionName, readCycleTimePercentiles, readDeliveryList, readDeliveryMetricsHistory, readFeatureList, readFeatureWording, readFeatureWorkItems, readInProgressItems, readManualForecast, readMetricAnswer, readMetricsSubject, readNameOfMyVote, readOwnerList, readPercentilesOverTime, readPortfolio, readPortfolioDeliveries, readPredictabilityScore, readProcessBehaviorChart, readProcessBehaviorOverTime, readRefinementTerms, readRefinementWording, readRunChart, readServiceLevelExpectation, readSleRisk, readStoredUsageDataAnswer, readSystemWipLimit, readTeam, readTerms, readThroughput, readTimeInStateBar, readTimeInStateContributors, readTotalWorkItemAge, readUsageDataState, readVoteRefusal, readWip, readWorkItemAge, readWorkItemAgePercentiles, readWorkTrackingConnection, readWorkTrackingConnections, readWrittenBlackoutRule, readWrittenOwner, refinementDayVerdictOf, resolveTerms, settleUsageDataStep, sizingMomentOf, startCliAuthSession, summariseDeliveryMetricsHistory, switchUsageDataOn, timeInStateItemCount, usageDataStoreFor, validateLighthouseConnectivity, voterKeyStoreFor, withdrawUsageData };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@letpeoplework/lighthouse-client",
3
- "version": "1.9.0",
3
+ "version": "1.10.0",
4
4
  "description": "Shared Lighthouse API client contracts",
5
5
  "repository": {
6
6
  "type": "git",