@bakers-build/addon-bakers-ui 0.6.1-next.4 → 0.6.1-next.6

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.
Files changed (154) hide show
  1. package/dist/src/Component/section-list/index.d.ts +5 -5
  2. package/dist/src/Component/section-list/index.js +2 -2
  3. package/dist/src/Entity/conductor/Data/conductors.d.ts +2 -12
  4. package/dist/src/Entity/conductor/Data/conductors.js +3 -25
  5. package/dist/src/Entity/conductor/Data/own-conductor.d.ts +5 -7
  6. package/dist/src/Entity/conductor/Data/own-conductor.js +9 -16
  7. package/dist/src/Entity/project/Screen/projects-screen.js +1 -4
  8. package/dist/src/Entity/run/Component/run-detail/index.d.ts +1 -1
  9. package/dist/src/Entity/run/Component/run-detail/index.js +1 -1
  10. package/dist/src/Entity/run/Data/query.d.ts +0 -5
  11. package/dist/src/Entity/run/Data/query.js +0 -8
  12. package/dist/src/Entity/run/Data/runs.d.ts +0 -2
  13. package/dist/src/Entity/run/Data/runs.js +1 -26
  14. package/dist/src/Entity/run/Screen/run-detail.d.ts +1 -1
  15. package/dist/src/Entity/run/Screen/run-detail.js +1 -1
  16. package/dist/src/Entity/ticket/Component/edit-form/index.d.ts +1 -2
  17. package/dist/src/Entity/ticket/Component/edit-form/index.js +1 -2
  18. package/dist/src/Entity/ticket/Component/ticket-content/index.d.ts +3 -8
  19. package/dist/src/Entity/ticket/Component/ticket-content/index.js +4 -71
  20. package/dist/src/Entity/ticket/Component/ticket-content/model.d.ts +0 -25
  21. package/dist/src/Entity/ticket/Component/ticket-content/model.js +0 -195
  22. package/dist/src/Entity/ticket/Data/parents.d.ts +3 -3
  23. package/dist/src/Entity/ticket/Data/parents.js +8 -9
  24. package/dist/src/Entity/ticket/Data/query.d.ts +0 -2
  25. package/dist/src/Entity/ticket/Data/query.js +0 -8
  26. package/dist/src/Entity/ticket/Data/tickets.d.ts +0 -2
  27. package/dist/src/Entity/ticket/Data/tickets.js +1 -20
  28. package/dist/src/Entity/ticket/Data/write.d.ts +0 -32
  29. package/dist/src/Entity/ticket/Data/write.js +0 -94
  30. package/dist/src/Entity/ticket/Form/edit-data.js +10 -4
  31. package/dist/src/Entity/ticket/Form/edit-parent-source.d.ts +1 -1
  32. package/dist/src/Entity/ticket/Form/edit.d.ts +11 -8
  33. package/dist/src/Entity/ticket/Form/edit.js +1 -1
  34. package/dist/src/Entity/ticket/Form/parent-filter.d.ts +2 -2
  35. package/dist/src/Entity/ticket/Form/parent-filter.js +1 -1
  36. package/dist/src/Entity/ticket/Form/parent-source.d.ts +11 -2
  37. package/dist/src/Entity/ticket/Form/parent-source.js +5 -7
  38. package/dist/src/Entity/ticket/Screen/edit-assignment-form.d.ts +2 -2
  39. package/dist/src/Entity/ticket/Screen/edit-assignment-form.js +3 -3
  40. package/dist/src/Entity/ticket/Screen/parent-filter-form.js +3 -4
  41. package/dist/src/Entity/ticket/Screen/ticket-content-screen.d.ts +1 -1
  42. package/dist/src/Entity/ticket/Screen/ticket-content-screen.js +1 -1
  43. package/dist/src/Entity/ticket/Screen/ticket-react-markdown.js +2 -2
  44. package/dist/src/Entity/ticket/Screen/ticket-runs.d.ts +2 -0
  45. package/dist/src/Entity/ticket/Screen/ticket-runs.js +26 -16
  46. package/dist/src/Entity/ticket/Screen/ticket-search.d.ts +1 -1
  47. package/dist/src/Entity/ticket/Screen/tickets.d.ts +1 -2
  48. package/dist/src/Entity/ticket/Screen/tickets.js +0 -23
  49. package/dist/src/Entity/user/Data/member-context.d.ts +1 -1
  50. package/dist/src/Entity/user/Data/users.d.ts +17 -98
  51. package/dist/src/Entity/user/Data/users.js +27 -74
  52. package/dist/src/Entity/user/Screen/member-overview.d.ts +12 -29
  53. package/dist/src/Entity/user/Screen/member-overview.js +38 -38
  54. package/dist/src/Entity/workspace/Screen/workspace-picker.js +1 -2
  55. package/dist/src/Form/field.js +1 -1
  56. package/dist/src/Kernel/key-input.d.ts +1 -2
  57. package/dist/src/Kernel/key-input.js +1 -2
  58. package/dist/src/Kernel/logo.d.ts +3 -0
  59. package/dist/src/Kernel/logo.js +48 -0
  60. package/dist/src/Kernel/splash.js +5 -5
  61. package/dist/src/Kernel/tui-kernel.js +1 -5
  62. package/dist/src/Routing/context.d.ts +0 -5
  63. package/dist/src/Routing/context.js +0 -6
  64. package/dist/src/Routing/registry.js +3 -6
  65. package/dist/src/Routing/routes.js +1 -24
  66. package/dist/src/Screen/async-modal-screen.d.ts +1 -1
  67. package/dist/src/Screen/async-modal-screen.js +1 -1
  68. package/dist/src/Widget/chrome.d.ts +1 -1
  69. package/dist/src/Widget/chrome.js +1 -1
  70. package/dist/src/Widget/option-source.js +3 -3
  71. package/dist/src/Widget/types.d.ts +2 -3
  72. package/dist/src/index.d.ts +0 -1
  73. package/dist/src/index.js +1 -2
  74. package/dist/src/launcher.d.ts +7 -14
  75. package/dist/src/launcher.js +2 -10
  76. package/dist/src/lib/cursor.d.ts +5 -5
  77. package/dist/src/lib/cursor.js +5 -5
  78. package/dist/src/lib/refresh-signal.d.ts +1 -1
  79. package/dist/src/lib/theme.d.ts +7 -23
  80. package/dist/src/lib/theme.js +7 -23
  81. package/dist/src/plugin.d.ts +1 -2
  82. package/dist/src/plugin.js +3 -7
  83. package/dist/src/react-experiment.js +0 -2
  84. package/dist/src/route.js +1 -1
  85. package/dist/src/types.d.ts +5 -56
  86. package/package.json +4 -4
  87. package/dist/src/Agent/launch.d.ts +0 -25
  88. package/dist/src/Agent/launch.js +0 -57
  89. package/dist/src/Component/badge/index.d.ts +0 -11
  90. package/dist/src/Component/badge/index.js +0 -10
  91. package/dist/src/Component/bar-chart/index.d.ts +0 -16
  92. package/dist/src/Component/bar-chart/index.js +0 -63
  93. package/dist/src/Component/heat-map/index.d.ts +0 -21
  94. package/dist/src/Component/heat-map/index.js +0 -86
  95. package/dist/src/Component/stats-panel/index.d.ts +0 -61
  96. package/dist/src/Component/stats-panel/index.js +0 -112
  97. package/dist/src/Component/team-member-workload-list/index.d.ts +0 -9
  98. package/dist/src/Component/team-member-workload-list/index.js +0 -31
  99. package/dist/src/Entity/team/Data/members.d.ts +0 -30
  100. package/dist/src/Entity/team/Data/members.js +0 -83
  101. package/dist/src/Entity/team/Data/projects.d.ts +0 -3
  102. package/dist/src/Entity/team/Data/projects.js +0 -23
  103. package/dist/src/Entity/team/Data/team.d.ts +0 -22
  104. package/dist/src/Entity/team/Data/team.js +0 -38
  105. package/dist/src/Entity/team/Data/teams.d.ts +0 -223
  106. package/dist/src/Entity/team/Data/teams.js +0 -268
  107. package/dist/src/Entity/team/Data/workload.d.ts +0 -25
  108. package/dist/src/Entity/team/Data/workload.js +0 -60
  109. package/dist/src/Entity/team/Screen/team-member-work.d.ts +0 -41
  110. package/dist/src/Entity/team/Screen/team-member-work.js +0 -56
  111. package/dist/src/Entity/team/Screen/team-users.d.ts +0 -63
  112. package/dist/src/Entity/team/Screen/team-users.js +0 -210
  113. package/dist/src/Entity/team/Screen/team-work.d.ts +0 -39
  114. package/dist/src/Entity/team/Screen/team-work.js +0 -112
  115. package/dist/src/Entity/team/Screen/teams-screen.d.ts +0 -110
  116. package/dist/src/Entity/team/Screen/teams-screen.js +0 -264
  117. package/dist/src/Entity/ticket/Component/create-form/index.d.ts +0 -28
  118. package/dist/src/Entity/ticket/Component/create-form/index.js +0 -74
  119. package/dist/src/Entity/ticket/Component/demo-statistics.d.ts +0 -14
  120. package/dist/src/Entity/ticket/Component/demo-statistics.js +0 -88
  121. package/dist/src/Entity/ticket/Component/react-statistics.d.ts +0 -14
  122. package/dist/src/Entity/ticket/Component/react-statistics.js +0 -23
  123. package/dist/src/Entity/ticket/Data/workflow.d.ts +0 -9
  124. package/dist/src/Entity/ticket/Data/workflow.js +0 -18
  125. package/dist/src/Entity/ticket/Form/create-data.d.ts +0 -75
  126. package/dist/src/Entity/ticket/Form/create-data.js +0 -217
  127. package/dist/src/Entity/ticket/Form/create.d.ts +0 -230
  128. package/dist/src/Entity/ticket/Form/create.js +0 -198
  129. package/dist/src/Entity/ticket/Screen/create-ticket-form.d.ts +0 -133
  130. package/dist/src/Entity/ticket/Screen/create-ticket-form.js +0 -621
  131. package/dist/src/Entity/ticket/Screen/ticket-agents.d.ts +0 -134
  132. package/dist/src/Entity/ticket/Screen/ticket-agents.js +0 -253
  133. package/dist/src/Entity/ticket/Screen/ticket-react.d.ts +0 -41
  134. package/dist/src/Entity/ticket/Screen/ticket-react.js +0 -136
  135. package/dist/src/Entity/ticket-template/Data/templates.d.ts +0 -26
  136. package/dist/src/Entity/ticket-template/Data/templates.js +0 -62
  137. package/dist/src/Kernel/braid.d.ts +0 -4
  138. package/dist/src/Kernel/braid.js +0 -10
  139. package/dist/src/Screen/empty-overview.d.ts +0 -9
  140. package/dist/src/Screen/empty-overview.js +0 -14
  141. package/dist/src/Statistics/client.d.ts +0 -73
  142. package/dist/src/Statistics/client.js +0 -220
  143. package/dist/src/Statistics/comparison-chart.d.ts +0 -7
  144. package/dist/src/Statistics/comparison-chart.js +0 -525
  145. package/dist/src/Statistics/dashboard.d.ts +0 -93
  146. package/dist/src/Statistics/dashboard.js +0 -206
  147. package/dist/src/Statistics/figures.d.ts +0 -18
  148. package/dist/src/Statistics/figures.js +0 -162
  149. package/dist/src/Statistics/member-stats.d.ts +0 -58
  150. package/dist/src/Statistics/member-stats.js +0 -152
  151. package/dist/src/Statistics/presentation.d.ts +0 -8
  152. package/dist/src/Statistics/presentation.js +0 -36
  153. package/dist/src/Statistics/screen.d.ts +0 -44
  154. package/dist/src/Statistics/screen.js +0 -204
@@ -1,112 +0,0 @@
1
- // BB-256 spec D11 — Stats' `/usage`-style bar rows.
2
- //
3
- // A SHARED component (the third in `src/Component/`), and it earns that place by
4
- // carrying no entity vocabulary at all: it takes `{ label, numbers }` and draws
5
- // bars. Nothing here knows a ticket from a run from a project — which is exactly
6
- // what G4 asserts, and why Stats can render four different blocks from
7
- // one function.
8
- //
9
- // It produces the ROWS OF ONE BLOCK. Stacking blocks under bold headings is
10
- // `flattenSections`' job (`Component/section-list`), unchanged: this component
11
- // only fills a block's body.
12
- //
13
- // BB-340 Task 13 — a row is CELLS AND THEIR BUDGETS, not a padded string.
14
- // `lib/format.ts`'s `pad` used to fill the label field and a local `padNumber`
15
- // the count columns, both of which had to measure the value in display columns
16
- // first (`lib/width.ts`). The renderer places a value inside its budget, so the
17
- // alignment is Yoga's and nothing here measures. The operator approved what that
18
- // costs: the pipe prints the same values with one space between them and no
19
- // column alignment, because a pipe runs no layout (spec F5, A4 re-pinned).
20
- /** A filled bar cell. U+2588 FULL BLOCK. */
21
- export const BAR_FULL = '█';
22
- /** An empty bar cell. U+2591 LIGHT SHADE. */
23
- export const BAR_EMPTY = '░';
24
- /**
25
- * The bar's width in display columns.
26
- *
27
- * `█`/`░` are narrow per `lib/width-table.ts` — neither is in `WIDE_RANGES` — so
28
- * the row geometry BB-241's hit testing depends on is unaffected. They are NOT
29
- * ASCII, though, and both are East-Asian-AMBIGUOUS: a terminal configured
30
- * ambiguous-as-wide (common in CJK setups) renders them two columns and shifts
31
- * every number column at runtime while every test here stays green, because the
32
- * width table deliberately treats Ambiguous as narrow (the frame's box-drawing
33
- * characters depend on that). Accepted rather than mitigated — spec R9. If it
34
- * ever bites, the fix is an ASCII bar glyph, never a width-table change.
35
- */
36
- export const BAR_WIDTH = 20;
37
- /** The indent every row of a block carries, matching the other body renderers. */
38
- const INDENT = ' ';
39
- /**
40
- * The label column's budget: {@link INDENT} plus 27 columns of text.
41
- *
42
- * The text budget is what the field has to hold, and after BB-324 that is two
43
- * different kinds of text sharing one column: a breakdown row's bare entity name
44
- * (a real project name reaches 26 columns on its own — `bakers-e2e-project` plus a
45
- * suffix used to; a long one still does), and the group TITLE printed in the
46
- * header row's label field above it. Both declare the same budget, which is what
47
- * keeps a title, the labels it captions and the column titles on one geometry.
48
- *
49
- * The indent rides INSIDE the cell's text rather than beside it as a cell of its
50
- * own, so a row's first column starts where the other body renderers' rows do
51
- * and the row's own `gap` is not spent separating an empty cell from the label.
52
- */
53
- const LABEL_WIDTH = INDENT.length + 27;
54
- /** One number column's budget, in display columns. */
55
- const NUMBER_WIDTH = 8;
56
- /**
57
- * The bar for `value` within a group whose largest bar value is `max`.
58
- *
59
- * Scaled RELATIVE TO THE LARGEST VALUE IN ITS OWN GROUP, not to a limit. This is
60
- * the one place the `/usage` analogy does not carry: `/usage` measures against a
61
- * quota, and there is no quota here — so a full bar means "the biggest of these",
62
- * never "100 %". An all-zero group has no maximum to scale by and renders empty
63
- * rather than dividing by zero.
64
- */
65
- function bar(value, max) {
66
- const filled = max > 0
67
- ? Math.max(0, Math.min(BAR_WIDTH, Math.round((value / max) * BAR_WIDTH)))
68
- : 0;
69
- return BAR_FULL.repeat(filled) + BAR_EMPTY.repeat(BAR_WIDTH - filled);
70
- }
71
- /**
72
- * One block's body rows: an optional header row (the group's title, the column
73
- * titles, or both), then one row per entry.
74
- *
75
- * Every row declares the SAME cell budgets in the same order, which is what
76
- * keeps the header's titles over the columns they name — the structural form of
77
- * the claim the padded rows used to make by measuring each field.
78
- */
79
- export function statsPanelRows(rows, { columns, title, emptyMessage } = {}) {
80
- if (rows.length === 0) {
81
- return emptyMessage === undefined ? [] : [`${INDENT}${emptyMessage}`];
82
- }
83
- const barValue = (row) => row.numbers.at(-1) ?? 0;
84
- const max = Math.max(...rows.map(barValue));
85
- const number = (text) => ({
86
- text,
87
- width: NUMBER_WIDTH,
88
- right: true,
89
- });
90
- const out = [];
91
- if ((columns && columns.length > 0) || title !== undefined) {
92
- out.push({
93
- cells: [
94
- { text: `${INDENT}${title ?? ''}`, width: LABEL_WIDTH },
95
- // The bar's column, empty: the header row has no bar, and the cell is
96
- // what holds the column titles over the numbers rather than over it.
97
- { text: '', width: BAR_WIDTH },
98
- ...(columns ?? []).map(number),
99
- ],
100
- });
101
- }
102
- for (const row of rows) {
103
- out.push({
104
- cells: [
105
- { text: `${INDENT}${row.label}`, width: LABEL_WIDTH },
106
- { text: bar(barValue(row), max), width: BAR_WIDTH },
107
- ...row.numbers.map((n) => number(String(n))),
108
- ],
109
- });
110
- }
111
- return out;
112
- }
@@ -1,9 +0,0 @@
1
- import type { SectionLine } from '../section-list/index.js';
2
- export interface TeamMemberWorkloadListItem {
3
- userId: string;
4
- label: string;
5
- open: number;
6
- running: number;
7
- waiting: number;
8
- }
9
- export declare function teamMemberWorkloadRows(members: readonly TeamMemberWorkloadListItem[]): SectionLine[];
@@ -1,31 +0,0 @@
1
- const countCell = (text) => ({
2
- text,
3
- width: 9,
4
- right: true,
5
- });
6
- export function teamMemberWorkloadRows(members) {
7
- const memberCell = (text) => ({
8
- text,
9
- width: 24,
10
- min: 12,
11
- grow: 1,
12
- });
13
- return [
14
- {
15
- cells: [
16
- memberCell('Member'),
17
- countCell('Open'),
18
- countCell('Running'),
19
- countCell('Waiting'),
20
- ],
21
- },
22
- ...members.map((member) => ({
23
- cells: [
24
- memberCell(member.label),
25
- countCell(String(member.open)),
26
- countCell(String(member.running)),
27
- countCell(String(member.waiting)),
28
- ],
29
- })),
30
- ];
31
- }
@@ -1,30 +0,0 @@
1
- import type { DropshClient } from '../../../types.js';
2
- /**
3
- * The member users of one crew, by uuid, in server order.
4
- *
5
- * `ids: null` is NOT ESTABLISHED — the team did not resolve, the membership read
6
- * was refused, or the walk outran its page cap. An EMPTY array is a measurement:
7
- * nobody is in this crew. The two must not collapse into one, because only one of
8
- * them is something an operator can act on.
9
- */
10
- export interface TeamMemberIds {
11
- ids: string[] | null;
12
- /** Why `ids` is null; absent whenever `ids` is an array. */
13
- error?: string;
14
- }
15
- /**
16
- * The active `bb_team` members of one team, as user uuids.
17
- *
18
- * Read from the RELATIONSHIP rather than through an `include`: `og_membership`
19
- * carries its member as `uid`, and a JSON:API document publishes a
20
- * relationship's linkage whether or not it was asked to sideload the resource.
21
- * The uuid is all this function returns, so the sideload would be payload nobody
22
- * here reads.
23
- *
24
- * PAGED against `links.next`, the only end-of-collection signal there is — the
25
- * server caps a page at 50 rows whatever `page[limit]` asked for. A walk that
26
- * outruns {@link MEMBERSHIP_PAGE_CAP} yields `null`, not the prefix it reached:
27
- * a crew list silently missing its last members is worse than one that admits it
28
- * does not know.
29
- */
30
- export declare function listTeamMemberIds(client: DropshClient, teamId: string): Promise<TeamMemberIds>;
@@ -1,83 +0,0 @@
1
- import { DrupalJsonApiParams } from 'drupal-jsonapi-params';
2
- import { messageOf } from '../../transport.js';
3
- import { MEMBERSHIP_PAGE_CAP, MEMBERSHIP_PAGE_SIZE, readMembershipPage, teamsFrom, } from './teams.js';
4
- /** Id of a single-valued relationship linkage (`data` object), or undefined. */
5
- function relId(rel) {
6
- const data = rel?.data;
7
- if (!data || Array.isArray(data))
8
- return undefined;
9
- return data.id ?? undefined;
10
- }
11
- /**
12
- * The active `bb_team` members of one team, as user uuids.
13
- *
14
- * Read from the RELATIONSHIP rather than through an `include`: `og_membership`
15
- * carries its member as `uid`, and a JSON:API document publishes a
16
- * relationship's linkage whether or not it was asked to sideload the resource.
17
- * The uuid is all this function returns, so the sideload would be payload nobody
18
- * here reads.
19
- *
20
- * PAGED against `links.next`, the only end-of-collection signal there is — the
21
- * server caps a page at 50 rows whatever `page[limit]` asked for. A walk that
22
- * outruns {@link MEMBERSHIP_PAGE_CAP} yields `null`, not the prefix it reached:
23
- * a crew list silently missing its last members is worse than one that admits it
24
- * does not know.
25
- */
26
- export async function listTeamMemberIds(client, teamId) {
27
- const internalId = await resolveInternalId(client, teamId);
28
- if (typeof internalId !== 'string')
29
- return internalId;
30
- const ids = [];
31
- for (let index = 0; index < MEMBERSHIP_PAGE_CAP; index += 1) {
32
- try {
33
- const page = await readMembershipPage(client, { entity_type: 'bb_team', entity_id: internalId }, index * MEMBERSHIP_PAGE_SIZE);
34
- // Checked BEFORE the rows are collected: a page that withheld some rows
35
- // and returned others would otherwise yield a crew list that is silently
36
- // missing people, which is the one thing this function refuses to return.
37
- if (page.withheld) {
38
- return {
39
- ids: null,
40
- error: 'the control plane withheld the membership rows (meta.omitted) — ' +
41
- 'the crew was not listed',
42
- };
43
- }
44
- for (const row of page.rows) {
45
- const id = relId(row.relationships?.uid);
46
- // A membership row naming no user is skipped rather than counted as an
47
- // anonymous member — there is no such person to open.
48
- if (id !== undefined)
49
- ids.push(id);
50
- }
51
- if (!page.hasNext)
52
- return { ids };
53
- }
54
- catch (caught) {
55
- return { ids: null, error: messageOf(caught) };
56
- }
57
- }
58
- return {
59
- ids: null,
60
- error: `more than ${MEMBERSHIP_PAGE_CAP * MEMBERSHIP_PAGE_SIZE} memberships — the crew was not listed`,
61
- };
62
- }
63
- /**
64
- * The team's `drupal_internal__id`, or the failure to report instead of it.
65
- *
66
- * A team that does not resolve gets NO membership query at all: without an
67
- * `entity_id` to filter by, the only query left would count every `bb_team`
68
- * membership on the instance and present the result as this crew's.
69
- */
70
- async function resolveInternalId(client, teamId) {
71
- const params = new DrupalJsonApiParams().addFilter('id', teamId);
72
- try {
73
- const doc = await client.get('bb_team/bb_team', params);
74
- const team = teamsFrom(doc)[0];
75
- if (team?.internalId === undefined) {
76
- return { ids: null, error: `no readable bb_team with uuid ${teamId}` };
77
- }
78
- return team.internalId;
79
- }
80
- catch (caught) {
81
- return { ids: null, error: messageOf(caught) };
82
- }
83
- }
@@ -1,3 +0,0 @@
1
- import type { DropshClient } from '../../../types.js';
2
- /** Complete project UUID set linked to one team. */
3
- export declare function listLinkedProjectIds(client: DropshClient, teamId: string): Promise<string[]>;
@@ -1,23 +0,0 @@
1
- import { DrupalJsonApiParams } from 'drupal-jsonapi-params';
2
- import { LIST_PAGE_SIZE } from '../../cycle.js';
3
- /** Complete project UUID set linked to one team. */
4
- export async function listLinkedProjectIds(client, teamId) {
5
- const ids = [];
6
- let offset = 0;
7
- while (true) {
8
- const params = new DrupalJsonApiParams()
9
- .addFilter('teams.id', teamId)
10
- .addSort('drupal_internal__id', 'ASC')
11
- .addPageLimit(LIST_PAGE_SIZE);
12
- if (offset > 0)
13
- params.addPageOffset(offset);
14
- const document = (await client.get('bb_project/bb_project', params));
15
- if (document.meta?.omitted !== undefined) {
16
- throw new Error('the control plane withheld linked project rows');
17
- }
18
- ids.push(...(document.data ?? []).flatMap((project) => project.id ? [project.id] : []));
19
- if (!document.links?.next)
20
- return ids;
21
- offset += LIST_PAGE_SIZE;
22
- }
23
- }
@@ -1,22 +0,0 @@
1
- import type { DropshClient } from '../../../types.js';
2
- /** One team, resolved: identity, workspace, and headcount when countable. */
3
- export interface ResolvedTeam {
4
- id: string;
5
- /** Never empty — the uuid is the last fallback, so nothing renders blank. */
6
- name: string;
7
- workspace: string | undefined;
8
- /**
9
- * Active members, or `null` for NOT COUNTED — see
10
- * {@link countActiveMembersByTeam}. Never `0` as a stand-in for a refused read.
11
- */
12
- members: number | null;
13
- }
14
- /**
15
- * Resolve one team by uuid, with its workspace name and member count.
16
- *
17
- * Filtered rather than paged: the detail knows the uuid it was routed with, so it
18
- * asks for that team instead of walking the collection the list already walked.
19
- * The two reads go in parallel — neither answer depends on the other — and a
20
- * refused membership read leaves the identity intact with `members: null`.
21
- */
22
- export declare function resolveTeam(client: DropshClient, teamId: string): Promise<ResolvedTeam>;
@@ -1,38 +0,0 @@
1
- import { DrupalJsonApiParams } from 'drupal-jsonapi-params';
2
- import { countActiveMembersByTeam, teamsFrom } from './teams.js';
3
- /**
4
- * Resolve one team by uuid, with its workspace name and member count.
5
- *
6
- * Filtered rather than paged: the detail knows the uuid it was routed with, so it
7
- * asks for that team instead of walking the collection the list already walked.
8
- * The two reads go in parallel — neither answer depends on the other — and a
9
- * refused membership read leaves the identity intact with `members: null`.
10
- */
11
- export async function resolveTeam(client, teamId) {
12
- const params = new DrupalJsonApiParams()
13
- .addFilter('id', teamId)
14
- .addInclude(['workspace_id']);
15
- const [doc, counts] = await Promise.all([
16
- (async () => {
17
- try {
18
- return (await client.get('bb_team/bb_team', params));
19
- }
20
- catch {
21
- return {};
22
- }
23
- })(),
24
- countActiveMembersByTeam(client),
25
- ]);
26
- const team = teamsFrom(doc)[0];
27
- if (team === undefined) {
28
- return { id: teamId, name: teamId, workspace: undefined, members: null };
29
- }
30
- return {
31
- id: team.id,
32
- name: team.name,
33
- workspace: team.workspace,
34
- members: counts === null || team.internalId === undefined
35
- ? null
36
- : (counts.get(team.internalId) ?? 0),
37
- };
38
- }
@@ -1,223 +0,0 @@
1
- import type { DropshClient, JsonApiResource } from '../../../types.js';
2
- import { type JsonApiCollectionDoc } from '../../collection.js';
3
- import { type ListOutcome } from '../../transport.js';
4
- /**
5
- * Drupal JSON:API default page size (`OffsetPage::SIZE_MAX`), declared because
6
- * this read ASKS for it rather than letting the server apply it silently — the
7
- * Teams tab does not page further, and `page[limit]` bounds the QUERY, so the
8
- * bound has to be a number this file can name in its own chrome.
9
- */
10
- export declare const TEAM_LIST_PAGE_SIZE = 50;
11
- /** One page of `og_membership` rows, at the same server-imposed bound. */
12
- export declare const MEMBERSHIP_PAGE_SIZE = 50;
13
- /**
14
- * How many membership pages the count is allowed to walk before giving up.
15
- *
16
- * A BOUND rather than a while-true: this read runs on every draw of the Teams
17
- * tab, and `og_membership` is the one collection in this renderer whose size is
18
- * a property of the whole instance rather than of a screen. 20 pages is 1000
19
- * active `bb_team` memberships; past that the walk stops and the count is
20
- * reported as NOT COUNTED (`null`), never as the partial sum it reached — see
21
- * {@link countActiveMembersByTeam}.
22
- */
23
- export declare const MEMBERSHIP_PAGE_CAP = 20;
24
- /** What a team is, as this renderer needs it. */
25
- export interface Team {
26
- /** The `bb_team` uuid — what a route param and a row node key on. */
27
- id: string;
28
- name: string;
29
- /**
30
- * `drupal_internal__id`, as a STRING.
31
- *
32
- * The one value `bb_team` and `og_membership` agree on. Membership has a
33
- * single system-wide mechanism (`og_membership`) whose `entity_id` is a plain
34
- * `string` base field holding the group's NUMERIC id, not its uuid — BB-321's
35
- * Fact 12, which is also why an `og_membership` is awkward to express as recipe
36
- * content. `undefined` when the document withheld it, which costs this team its
37
- * member count and nothing else.
38
- */
39
- internalId: string | undefined;
40
- /** The sideloaded `bb_workspace` name; `undefined` when unresolvable. */
41
- workspace: string | undefined;
42
- }
43
- /** One Teams-tab row: who the crew is, where it lives, how many are in it. */
44
- export interface TeamListRow {
45
- id: string;
46
- name: string;
47
- /** Already formatted — `—` when the relationship did not resolve. */
48
- workspace: string;
49
- /**
50
- * Already formatted, and `—` for UNCOUNTED as opposed to `0` for counted-empty.
51
- * The distinction is the point: the membership read is the refusable one.
52
- */
53
- members: string;
54
- }
55
- /**
56
- * The Teams list table — its columns, the noun every node id is prefixed with,
57
- * and what it says when there is nothing.
58
- */
59
- export declare const TEAM_TABLE: {
60
- readonly noun: "team";
61
- readonly emptyMessage: "No teams.";
62
- readonly columns: readonly [{
63
- /**
64
- * FREE TEXT, and therefore the GROWER — the same trade the projects list
65
- * takes, for the same reason: a fixed width cuts an ordinary team name at
66
- * every terminal size, while a `width: 0` column declared FIRST takes the
67
- * row's surplus and leaves the two bounded columns their budgets.
68
- */
69
- readonly key: "name";
70
- readonly label: "TEAM";
71
- readonly width: 0;
72
- readonly fields: readonly ["name"];
73
- readonly get: (row: TeamListRow) => string;
74
- }, {
75
- /** A workspace name is free text too, but it is not the row's subject, so
76
- * it takes a budget and says when it was cut. */
77
- readonly key: "workspace";
78
- readonly label: "WORKSPACE";
79
- readonly width: 20;
80
- readonly fields: readonly ["workspace_id"];
81
- readonly get: (row: TeamListRow) => string;
82
- }, {
83
- /**
84
- * A count and an em dash, so 8 columns show every value this can hold
85
- * whole — a DOMAIN constant read off the vocabulary, never a measurement of
86
- * the page.
87
- */
88
- readonly key: "members";
89
- readonly label: "MEMBERS";
90
- readonly width: 8;
91
- readonly fields: readonly [];
92
- readonly get: (row: TeamListRow) => string;
93
- }];
94
- };
95
- /**
96
- * The team collection read, as much of it as one page holds.
97
- *
98
- * `hasNext` is JSON:API's own `links.next` and the ONLY honest truncation
99
- * signal: the server caps a page at 50 rows whatever `page[limit]` asked for,
100
- * so `rows.length === TEAM_LIST_PAGE_SIZE` is exactly as consistent with "that
101
- * was all" as with "more follows" — it false-positives on an instance with
102
- * exactly 50 teams and false-negatives on nothing at all.
103
- */
104
- export interface TeamCollection extends ListOutcome<Team> {
105
- hasNext: boolean;
106
- }
107
- /**
108
- * The team collection in server order, with each team's workspace name.
109
- *
110
- * Yields the OUTCOME rather than a swallowed array, for the reason BB-257 D4
111
- * gives: "there are no teams" and "the read was refused" are different answers,
112
- * and only the read knows which one happened. Read through `loadPage`, the ONE
113
- * page read this renderer has (BB-294), so the truncation signal is the same
114
- * `links.next` reading every other list uses rather than a second one here.
115
- */
116
- export declare function listTeams(client: DropshClient): Promise<TeamCollection>;
117
- /** Map one `bb_team` collection document onto {@link Team} rows. */
118
- export declare function teamsFrom(doc: JsonApiCollectionDoc): Team[];
119
- /** OG's own constant for an active membership (`OgMembershipInterface::STATE_ACTIVE`). */
120
- export declare const MEMBERSHIP_STATE_ACTIVE = "active";
121
- /** The og_membership JSON:API resource, spelled once for both readers here. */
122
- export declare const MEMBERSHIP_RESOURCE = "og_membership/default";
123
- /**
124
- * One page of `og_membership` rows, plus the two signals that end a walk.
125
- *
126
- * `withheld` is the one this renderer's shared `loadPage` cannot carry, and it is
127
- * the whole reason these two reads do not use it. A control plane that REFUSES a
128
- * membership read does not throw: JSON:API answers **HTTP 200 with `data: []` and
129
- * a `meta.omitted` block** naming each row it kept back (measured at BB-391 —
130
- * five rows omitted for two crews with five members between them). `loadPage`
131
- * reports `rows: []` for that, and an empty page is indistinguishable from an
132
- * empty collection — so the count came out as `0`, which by this file's contract
133
- * means COUNTED. A number nobody established is worse than the `—` that admits
134
- * it, because only one of the two can be acted on.
135
- */
136
- export interface MembershipPage {
137
- rows: JsonApiResource[];
138
- /** JSON:API's `links.next`, the only honest end-of-collection signal. */
139
- hasNext: boolean;
140
- /** TRUE when the document carried `meta.omitted`: rows were WITHHELD. */
141
- withheld: boolean;
142
- }
143
- /**
144
- * Reads one page of `og_membership`, filtered as the caller asked.
145
- *
146
- * Shared by the Teams-list COUNT and the team-level ROSTER so the two cannot
147
- * disagree about what a refusal looks like, and so both send the same three
148
- * filters. Throws whatever the client throws: a transport failure and a withheld
149
- * page are different answers and each caller says so in its own vocabulary.
150
- *
151
- * @param client The dropsh client.
152
- * @param filters The `filter[…]` pairs to send beyond `state`.
153
- * @param offset The `page[offset]` to send; omitted when 0, as the first read is.
154
- */
155
- export declare function readMembershipPage(client: DropshClient, filters: Record<string, string>, offset: number): Promise<MembershipPage>;
156
- /**
157
- * Active `bb_team` memberships, counted per INTERNAL team id.
158
- *
159
- * `null` — not an empty Map — when the count could not be COMPLETED, and that is
160
- * the whole contract of this function. An empty Map means "every team measured
161
- * zero members", which is a measurement an operator can act on; anything that
162
- * did not finish has measured nothing. The refusal is the likely case rather
163
- * than the exotic one: `og_membership` is OG's resource, not a bakers.build one, so
164
- * nothing in this project's rank model has an opinion about reading it.
165
- *
166
- * Both filters are load-bearing. Without `entity_type` the count would fold in
167
- * project and workspace memberships, which use the same table; without `state` it
168
- * would count pending and blocked people as crew.
169
- *
170
- * PAGED, and that is the second-round fix: the read used to send no
171
- * `page[limit]` at all and read `data` once. The control plane caps every page
172
- * at `OffsetPage::SIZE_MAX` regardless — `page[limit]` bounds the QUERY, not the
173
- * rows it returns — so past 50 active memberships the MEMBERS column showed a
174
- * number that was quietly a fraction of the crew. A wrong number is worse than
175
- * the `—` this file falls back to, because only one of the two admits it does
176
- * not know. The walk therefore follows `links.next`, the sole end-of-collection
177
- * signal, and gives up as `null` when it outruns {@link MEMBERSHIP_PAGE_CAP}
178
- * rather than returning the partial sum it had reached.
179
- *
180
- * A WITHHELD page is the third-round fix, and it is the one that was actually
181
- * biting. A refusal on this resource is not a throw: the control plane answered
182
- * HTTP 200 with `data: []` and a `meta.omitted` block, so the walk saw an empty
183
- * page, no `links.next`, and reported `0` for every crew — a NUMBER, which this
184
- * function's whole contract reserves for a measurement. BB-391's server half
185
- * makes the rows filtered rather than omitted, so a current deployment never
186
- * sends that shape; a deployment without the `bb:session:view_bakers_memberships`
187
- * child scope still does, and it must read as `—`.
188
- */
189
- export declare function countActiveMembersByTeam(client: DropshClient): Promise<Map<string, number> | null>;
190
- /** Format one team's member count for a cell: `—` when it was never counted. */
191
- export declare const formatMemberCount: (count: number | null) => string;
192
- /**
193
- * What the Teams screen needs: the rows, whether the collection was refused, and
194
- * whether the server said more of it follows.
195
- *
196
- * The `error` is CARRIED rather than dropped, which is the second-round fix.
197
- * `listTeams` has always yielded a `ListOutcome` — a shape whose only purpose is
198
- * to tell a refused read from an empty collection (BB-257 D4) — and this loader
199
- * used to throw the `error` half away and return a bare array, so a 403 rendered
200
- * as `No teams.` and both the shape and the comment justifying it were decorative.
201
- * BB-391 D9 declines to rebuild this CLI's error handling in general; it does
202
- * not license discarding a distinction the code already carries.
203
- */
204
- export interface TeamListResult {
205
- rows: TeamListRow[];
206
- /** Present only when the COLLECTION read failed; see {@link TeamCollection}. */
207
- error?: string;
208
- /** `links.next` on the collection page — never a row count. */
209
- hasNext: boolean;
210
- }
211
- /**
212
- * The Teams screen's rows: the collection and the membership count, read in
213
- * parallel because neither answer depends on the other.
214
- *
215
- * The two failures are deliberately NOT merged. A refused COLLECTION read has no
216
- * rows to show and the screen says so; a refused or incomplete MEMBERSHIP count
217
- * still has every team's identity and loses only the MEMBERS cell, which is what
218
- * the `—` says. Folding them into one flag would make the second look like the
219
- * first.
220
- */
221
- export declare function loadTeamRows({ client, }: {
222
- client: DropshClient;
223
- }): Promise<TeamListResult>;