@ttctl/cli 0.1.0-rc.2 → 0.1.0-rc.3
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/commands/applications/index.d.ts +9 -3
- package/dist/commands/applications/index.d.ts.map +1 -1
- package/dist/commands/applications/index.js +29 -3
- package/dist/commands/applications/index.js.map +1 -1
- package/dist/commands/applications/list.d.ts +12 -8
- package/dist/commands/applications/list.d.ts.map +1 -1
- package/dist/commands/applications/list.js +29 -6
- package/dist/commands/applications/list.js.map +1 -1
- package/dist/commands/applications/shared.d.ts +35 -0
- package/dist/commands/applications/shared.d.ts.map +1 -1
- package/dist/commands/applications/shared.js +40 -0
- package/dist/commands/applications/shared.js.map +1 -1
- package/dist/commands/engagements/index.d.ts.map +1 -1
- package/dist/commands/engagements/index.js +21 -0
- package/dist/commands/engagements/index.js.map +1 -1
- package/dist/commands/engagements/list.d.ts +10 -8
- package/dist/commands/engagements/list.d.ts.map +1 -1
- package/dist/commands/engagements/list.js +25 -6
- package/dist/commands/engagements/list.js.map +1 -1
- package/dist/commands/engagements/shared.d.ts +40 -0
- package/dist/commands/engagements/shared.d.ts.map +1 -1
- package/dist/commands/engagements/shared.js +45 -0
- package/dist/commands/engagements/shared.js.map +1 -1
- package/dist/commands/jobs/index.d.ts +9 -6
- package/dist/commands/jobs/index.d.ts.map +1 -1
- package/dist/commands/jobs/index.js +10 -7
- package/dist/commands/jobs/index.js.map +1 -1
- package/dist/commands/jobs/list.d.ts +17 -11
- package/dist/commands/jobs/list.d.ts.map +1 -1
- package/dist/commands/jobs/list.js +17 -11
- package/dist/commands/jobs/list.js.map +1 -1
- package/dist/commands/payments/index.d.ts.map +1 -1
- package/dist/commands/payments/index.js +22 -1
- package/dist/commands/payments/index.js.map +1 -1
- package/dist/commands/payments/payouts.d.ts +43 -10
- package/dist/commands/payments/payouts.d.ts.map +1 -1
- package/dist/commands/payments/payouts.js +50 -3
- package/dist/commands/payments/payouts.js.map +1 -1
- package/dist/commands/timesheet/index.d.ts +11 -2
- package/dist/commands/timesheet/index.d.ts.map +1 -1
- package/dist/commands/timesheet/index.js +30 -2
- package/dist/commands/timesheet/index.js.map +1 -1
- package/dist/commands/timesheet/pending/list.d.ts +33 -0
- package/dist/commands/timesheet/pending/list.d.ts.map +1 -0
- package/dist/commands/timesheet/pending/list.js +26 -0
- package/dist/commands/timesheet/pending/list.js.map +1 -0
- package/package.json +2 -2
|
@@ -13,9 +13,15 @@ import { Command } from "commander";
|
|
|
13
13
|
* Per project non-goals (#15): no apply / withdraw / edit operations
|
|
14
14
|
* are exposed. The CLI is read-only by design.
|
|
15
15
|
*
|
|
16
|
-
* **
|
|
17
|
-
* `--
|
|
18
|
-
*
|
|
16
|
+
* **Pagination (#377)**: the `list` leaf declares `--page` /
|
|
17
|
+
* `--per-page` (1-indexed positive integers; same `parsePaginationFlag`
|
|
18
|
+
* enforcement as the jobs leaves per #183). `#377` added the
|
|
19
|
+
* `$page` / `$pageSize` wire args to the hand-authored
|
|
20
|
+
* `JobActivityItems` document.
|
|
21
|
+
*
|
|
22
|
+
* **Still out of scope** (see `.tmp/workitem-15.md` § Open Questions):
|
|
23
|
+
* `--from` / `--to` date filters — captured operation accepts no date
|
|
24
|
+
* args.
|
|
19
25
|
*/
|
|
20
26
|
export declare function buildApplicationsCommand(): Command;
|
|
21
27
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/applications/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAgC,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/applications/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAgC,MAAM,WAAW,CAAC;AA4BlE;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,wBAAwB,IAAI,OAAO,CAoElD"}
|
|
@@ -3,9 +3,23 @@
|
|
|
3
3
|
import { Command, InvalidArgumentError, Option } from "commander";
|
|
4
4
|
import { applications } from "@ttctl/core";
|
|
5
5
|
import { OUTPUT_FORMATS } from "../../lib/output.js";
|
|
6
|
+
import { parsePaginationFlag } from "../../lib/pagination.js";
|
|
6
7
|
import { runApplicationsList } from "./list.js";
|
|
7
8
|
import { runApplicationsShow } from "./show.js";
|
|
8
9
|
import { runApplicationsStats } from "./stats.js";
|
|
10
|
+
/**
|
|
11
|
+
* Page-number option factory (#377, per-command flags per #183). The
|
|
12
|
+
* `list` leaf declares its own `--page` / `--per-page`; the parser and
|
|
13
|
+
* description are shared via these factories so the surface stays
|
|
14
|
+
* byte-identical with the four jobs paginating leaves in `--help`
|
|
15
|
+
* output (same `parsePaginationFlag` positive-integer enforcement).
|
|
16
|
+
*/
|
|
17
|
+
function pageOption() {
|
|
18
|
+
return new Option("--page <number>", "page number (1-indexed)").argParser((raw) => parsePaginationFlag("--page", raw));
|
|
19
|
+
}
|
|
20
|
+
function perPageOption() {
|
|
21
|
+
return new Option("--per-page <number>", "items per page").argParser((raw) => parsePaginationFlag("--per-page", raw));
|
|
22
|
+
}
|
|
9
23
|
/**
|
|
10
24
|
* Build the `ttctl applications` command tree. Read-only access to the
|
|
11
25
|
* user's Toptal Talent **Activity** view (which Toptal colloquially
|
|
@@ -20,9 +34,15 @@ import { runApplicationsStats } from "./stats.js";
|
|
|
20
34
|
* Per project non-goals (#15): no apply / withdraw / edit operations
|
|
21
35
|
* are exposed. The CLI is read-only by design.
|
|
22
36
|
*
|
|
23
|
-
* **
|
|
24
|
-
* `--
|
|
25
|
-
*
|
|
37
|
+
* **Pagination (#377)**: the `list` leaf declares `--page` /
|
|
38
|
+
* `--per-page` (1-indexed positive integers; same `parsePaginationFlag`
|
|
39
|
+
* enforcement as the jobs leaves per #183). `#377` added the
|
|
40
|
+
* `$page` / `$pageSize` wire args to the hand-authored
|
|
41
|
+
* `JobActivityItems` document.
|
|
42
|
+
*
|
|
43
|
+
* **Still out of scope** (see `.tmp/workitem-15.md` § Open Questions):
|
|
44
|
+
* `--from` / `--to` date filters — captured operation accepts no date
|
|
45
|
+
* args.
|
|
26
46
|
*/
|
|
27
47
|
export function buildApplicationsCommand() {
|
|
28
48
|
const cmd = new Command("applications").description("View your Toptal Talent activity (applications, availability requests, interviews, engagements)");
|
|
@@ -33,6 +53,8 @@ export function buildApplicationsCommand() {
|
|
|
33
53
|
.addOption(new Option("--status-group <group...>", "filter by status group (repeatable; OR across groups)").choices([
|
|
34
54
|
...applications.STATUS_GROUPS,
|
|
35
55
|
]))
|
|
56
|
+
.addOption(pageOption())
|
|
57
|
+
.addOption(perPageOption())
|
|
36
58
|
.addOption(new Option("-o, --output <format>", "output format")
|
|
37
59
|
.choices(OUTPUT_FORMATS)
|
|
38
60
|
.default("pretty"))
|
|
@@ -46,6 +68,10 @@ export function buildApplicationsCommand() {
|
|
|
46
68
|
listOpts.keywords = options.keywords;
|
|
47
69
|
if (options.statusGroup !== undefined)
|
|
48
70
|
listOpts.statusGroups = options.statusGroup;
|
|
71
|
+
if (options.page !== undefined)
|
|
72
|
+
listOpts.page = options.page;
|
|
73
|
+
if (options.perPage !== undefined)
|
|
74
|
+
listOpts.perPage = options.perPage;
|
|
49
75
|
await runApplicationsList(listOpts);
|
|
50
76
|
});
|
|
51
77
|
cmd
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/applications/index.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAEpC,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAElE,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EAAE,mBAAmB,EAAE,MAAM,WAAW,CAAC;AAChD,OAAO,EAAE,mBA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AC,KAAK,EAAE,EAAU,EAAE,OAAiC,EAAE,EAAE;QAC9D,MAAM,mBAAmB,CAAC,EAAE,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;IAEL,GAAG;SACA,OAAO,CAAC,OAAO,CAAC;SAChB,WAAW,CAAC,sEAAsE,CAAC;SACnF,SAAS,CACR,IAAI,MAAM,CAAC,uBAAuB,EAAE,eAAe,CAAC;SACjD,OAAO,CAAC,cAAc,CAAC;SACvB,OAAO,CAAC,QAA+B,CAAC,CAC5C;SACA,MAAM,CAAC,KAAK,EAAE,OAAiC,EAAE,EAAE;QAClD,MAAM,oBAAoB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7C,CAAC,CAAC,CAAC;IAEL,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,UAAU,CAAC,KAAa;IAC/B,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,oBAAoB,CAAC,sBAAsB,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -4,24 +4,28 @@ import type { OutputFormat } from "../../lib/output.js";
|
|
|
4
4
|
* Action handler for `ttctl applications list`. Reads the user's
|
|
5
5
|
* activity items (applications, availability requests, interviews,
|
|
6
6
|
* engagements) and emits via the cross-CLI output helper, wrapped in
|
|
7
|
-
* the v0.4 list envelope (`{version, items, pageInfo
|
|
7
|
+
* the v0.4 list envelope (`{version, items, pageInfo}` from #128) for
|
|
8
8
|
* `json` / `yaml`.
|
|
9
9
|
*
|
|
10
10
|
* Filters: `--keywords` (free-text, repeatable) and `--status-group`
|
|
11
11
|
* (one of the five `JobActivityItemStatusGroupEnum` values, repeatable
|
|
12
12
|
* — server-side AND across instances).
|
|
13
13
|
*
|
|
14
|
-
* **Pagination
|
|
15
|
-
* `
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
14
|
+
* **Pagination (#377, per-command flags per #183)**: reads `--page` /
|
|
15
|
+
* `--per-page` directly from the leaf's parsed options. When neither
|
|
16
|
+
* flag is set, the service applies defaults (`page: 1, perPage: 20`).
|
|
17
|
+
* `#377` added `$page` / `$pageSize` to the hand-authored
|
|
18
|
+
* `JobActivityItems` document — a wire-shape change gated by the
|
|
19
|
+
* mandatory live E2E (schema/contract rule). `pageInfo` is always
|
|
20
|
+
* surfaced (the service always returns the resolved page metadata),
|
|
21
|
+
* mirroring the post-#138 jobs behavior. Date filters (`--from` /
|
|
22
|
+
* `--to`) remain out of scope per #15 § Open Questions (RESOLVED).
|
|
21
23
|
*/
|
|
22
24
|
export interface ApplicationsListOptions {
|
|
23
25
|
keywords?: string[];
|
|
24
26
|
statusGroups?: applications.StatusGroup[];
|
|
27
|
+
page?: number;
|
|
28
|
+
perPage?: number;
|
|
25
29
|
output: OutputFormat;
|
|
26
30
|
}
|
|
27
31
|
export declare function runApplicationsList(opts: ApplicationsListOptions): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/applications/list.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAI3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/applications/list.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAI3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAQxD;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,YAAY,CAAC,EAAE,YAAY,CAAC,WAAW,EAAE,CAAC;IAC1C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,YAAY,CAAC;CACtB;AAED,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,uBAAuB,GAAG,OAAO,CAAC,IAAI,CAAC,CAyBtF;AAuBD;;;;;;;;;;;;GAYG;AACH,wBAAgB,uBAAuB,CACrC,KAAK,EAAE,YAAY,CAAC,eAAe,EAAE,EACrC,aAAa,GAAE,MAAsC,GACpD,MAAM,CA8BR;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAexD;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAG9C"}
|
|
@@ -4,7 +4,7 @@ import Table from "cli-table3";
|
|
|
4
4
|
import { applications } from "@ttctl/core";
|
|
5
5
|
import { wrapListEnvelope } from "../../lib/envelopes.js";
|
|
6
6
|
import { emitResult } from "../../lib/output.js";
|
|
7
|
-
import { handleApplicationsError, loadAuthTokenOrExit } from "./shared.js";
|
|
7
|
+
import { buildApplicationsPageInfo, formatApplicationsPageFooter, handleApplicationsError, loadAuthTokenOrExit, } from "./shared.js";
|
|
8
8
|
export async function runApplicationsList(opts) {
|
|
9
9
|
const token = await loadAuthTokenOrExit("applications list", opts.output);
|
|
10
10
|
// `exactOptionalPropertyTypes: true` requires us to OMIT optional
|
|
@@ -15,19 +15,42 @@ export async function runApplicationsList(opts) {
|
|
|
15
15
|
listOpts.keywords = opts.keywords;
|
|
16
16
|
if (opts.statusGroups !== undefined)
|
|
17
17
|
listOpts.statusGroups = opts.statusGroups;
|
|
18
|
-
|
|
18
|
+
if (opts.page !== undefined)
|
|
19
|
+
listOpts.page = opts.page;
|
|
20
|
+
if (opts.perPage !== undefined)
|
|
21
|
+
listOpts.perPage = opts.perPage;
|
|
22
|
+
let page;
|
|
19
23
|
try {
|
|
20
|
-
|
|
24
|
+
page = await applications.list(token, listOpts);
|
|
21
25
|
}
|
|
22
26
|
catch (err) {
|
|
23
27
|
handleApplicationsError("applications list", err, opts.output);
|
|
24
28
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
29
|
+
const pageInfo = buildApplicationsPageInfo(page);
|
|
30
|
+
emitResult(wrapListEnvelope(page.items, pageInfo), opts.output, {
|
|
31
|
+
pretty: (data) => renderApplicationsListPretty(data.items, page),
|
|
32
|
+
table: (data) => renderApplicationsListPretty(data.items, page),
|
|
28
33
|
empty: { command: "applications.list" },
|
|
29
34
|
});
|
|
30
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Render the activity table plus the pretty-mode pagination footer
|
|
38
|
+
* underneath (#377). Single source of truth for the `pretty` / `table`
|
|
39
|
+
* slots so footer styling stays uniform — structural twin of jobs'
|
|
40
|
+
* `renderJobsListPretty`.
|
|
41
|
+
*
|
|
42
|
+
* The footer is appended only when `totalCount > 0` — empty pages
|
|
43
|
+
* route through the empty-state CTA wrapper BEFORE this renderer
|
|
44
|
+
* fires, so the `items.length === 0` branch in `formatApplicationsTable`
|
|
45
|
+
* is unreachable from this path. The defensive `if` preserves the
|
|
46
|
+
* direct-call surface (tests, future programmatic use).
|
|
47
|
+
*/
|
|
48
|
+
function renderApplicationsListPretty(items, page) {
|
|
49
|
+
const table = formatApplicationsTable(items);
|
|
50
|
+
if (page.totalCount <= 0)
|
|
51
|
+
return table;
|
|
52
|
+
return `${table}\n${formatApplicationsPageFooter(page.page, page.perPage, page.totalCount)}`;
|
|
53
|
+
}
|
|
31
54
|
/**
|
|
32
55
|
* Render the activity list as a `cli-table3` table sized to the
|
|
33
56
|
* current terminal width. Columns: id, status (verbose), group, job
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/applications/list.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC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M,UAAU,kBAAkB,CAAC,KAAa;IAC9C,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,mBAAmB;YACtB,OAAO,QAAQ,CAAC;QAClB,KAAK,UAAU;YACb,OAAO,UAAU,CAAC;QACpB,KAAK,mBAAmB;YACtB,OAAO,QAAQ,CAAC;QAClB,KAAK,kBAAkB;YACrB,OAAO,QAAQ,CAAC;QAClB,KAAK,qBAAqB;YACxB,OAAO,WAAW,CAAC;QACrB;YACE,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,GAAW;IACpC,MAAM,CAAC,GAAG,sBAAsB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC3C,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC;AACvB,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { applications } from "@ttctl/core";
|
|
1
2
|
import type { OutputFormat } from "../../lib/output.js";
|
|
2
3
|
export { loadAuthTokenOrExit } from "../profile/shared.js";
|
|
3
4
|
/**
|
|
@@ -11,4 +12,38 @@ export { loadAuthTokenOrExit } from "../profile/shared.js";
|
|
|
11
12
|
* codes do not carry actionable next-step hints today.
|
|
12
13
|
*/
|
|
13
14
|
export declare function handleApplicationsError(commandLabel: string, err: unknown, format?: OutputFormat): never;
|
|
15
|
+
/**
|
|
16
|
+
* Render the pretty-format pagination footer "Page X of Y
|
|
17
|
+
* (per_page=Z)" appended below the activity table for `applications
|
|
18
|
+
* list` (#377). Domain-local twin of `jobs/shared.ts`'s
|
|
19
|
+
* `formatPageFooter` — per the project's one-copy-per-CLI-surface
|
|
20
|
+
* convention (no cross-domain import). Appended ONLY when the server
|
|
21
|
+
* returned `totalCount > 0`; empty pages route through the empty-state
|
|
22
|
+
* CTA wrapper before per-format dispatch.
|
|
23
|
+
*
|
|
24
|
+
* `totalPages = Math.max(1, Math.ceil(totalCount / perPage))` so a
|
|
25
|
+
* single-page non-empty result renders "Page 1 of 1". Pure — directly
|
|
26
|
+
* unit-testable.
|
|
27
|
+
*/
|
|
28
|
+
export declare function formatApplicationsPageFooter(currentPage: number, perPage: number, totalCount: number): string;
|
|
29
|
+
/**
|
|
30
|
+
* Build the offset-style `pageInfo` block for the list envelope (#377)
|
|
31
|
+
* from the service-layer's {@link applications.JobActivityListPage}.
|
|
32
|
+
* Structural twin of `jobs/shared.ts`'s `buildJobsPageInfo`; centralises
|
|
33
|
+
* the `totalPages` / `hasNextPage` arithmetic so the action handler and
|
|
34
|
+
* unit tests share one source of truth.
|
|
35
|
+
*
|
|
36
|
+
* - `currentPage`, `perPage`: verbatim from the service (the effective
|
|
37
|
+
* values used in the query, after defaults).
|
|
38
|
+
* - `totalPages`: `Math.max(1, Math.ceil(totalCount / perPage))`.
|
|
39
|
+
* - `hasNextPage`: `currentPage < totalPages`.
|
|
40
|
+
*
|
|
41
|
+
* Pure — directly unit-testable.
|
|
42
|
+
*/
|
|
43
|
+
export declare function buildApplicationsPageInfo(page: applications.JobActivityListPage): {
|
|
44
|
+
currentPage: number;
|
|
45
|
+
perPage: number;
|
|
46
|
+
totalPages: number;
|
|
47
|
+
hasNextPage: boolean;
|
|
48
|
+
};
|
|
14
49
|
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/commands/applications/shared.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/commands/applications/shared.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D;;;;;;;;;GASG;AACH,wBAAgB,uBAAuB,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,GAAE,YAAuB,GAAG,KAAK,CAElH;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,4BAA4B,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAG7G;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,YAAY,CAAC,mBAAmB,GAAG;IACjF,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;CACtB,CAQA"}
|
|
@@ -16,4 +16,44 @@ export { loadAuthTokenOrExit } from "../profile/shared.js";
|
|
|
16
16
|
export function handleApplicationsError(commandLabel, err, format = "pretty") {
|
|
17
17
|
handleDomainError(commandLabel, err, applications.ApplicationsError, format);
|
|
18
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Render the pretty-format pagination footer "Page X of Y
|
|
21
|
+
* (per_page=Z)" appended below the activity table for `applications
|
|
22
|
+
* list` (#377). Domain-local twin of `jobs/shared.ts`'s
|
|
23
|
+
* `formatPageFooter` — per the project's one-copy-per-CLI-surface
|
|
24
|
+
* convention (no cross-domain import). Appended ONLY when the server
|
|
25
|
+
* returned `totalCount > 0`; empty pages route through the empty-state
|
|
26
|
+
* CTA wrapper before per-format dispatch.
|
|
27
|
+
*
|
|
28
|
+
* `totalPages = Math.max(1, Math.ceil(totalCount / perPage))` so a
|
|
29
|
+
* single-page non-empty result renders "Page 1 of 1". Pure — directly
|
|
30
|
+
* unit-testable.
|
|
31
|
+
*/
|
|
32
|
+
export function formatApplicationsPageFooter(currentPage, perPage, totalCount) {
|
|
33
|
+
const totalPages = Math.max(1, Math.ceil(totalCount / perPage));
|
|
34
|
+
return `Page ${currentPage.toString()} of ${totalPages.toString()} (per_page=${perPage.toString()})`;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Build the offset-style `pageInfo` block for the list envelope (#377)
|
|
38
|
+
* from the service-layer's {@link applications.JobActivityListPage}.
|
|
39
|
+
* Structural twin of `jobs/shared.ts`'s `buildJobsPageInfo`; centralises
|
|
40
|
+
* the `totalPages` / `hasNextPage` arithmetic so the action handler and
|
|
41
|
+
* unit tests share one source of truth.
|
|
42
|
+
*
|
|
43
|
+
* - `currentPage`, `perPage`: verbatim from the service (the effective
|
|
44
|
+
* values used in the query, after defaults).
|
|
45
|
+
* - `totalPages`: `Math.max(1, Math.ceil(totalCount / perPage))`.
|
|
46
|
+
* - `hasNextPage`: `currentPage < totalPages`.
|
|
47
|
+
*
|
|
48
|
+
* Pure — directly unit-testable.
|
|
49
|
+
*/
|
|
50
|
+
export function buildApplicationsPageInfo(page) {
|
|
51
|
+
const totalPages = Math.max(1, Math.ceil(page.totalCount / page.perPage));
|
|
52
|
+
return {
|
|
53
|
+
currentPage: page.page,
|
|
54
|
+
perPage: page.perPage,
|
|
55
|
+
totalPages,
|
|
56
|
+
hasNextPage: page.page < totalPages,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
19
59
|
//# sourceMappingURL=shared.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/commands/applications/shared.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAEpC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAG/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D;;;;;;;;;GASG;AACH,MAAM,UAAU,uBAAuB,CAAC,YAAoB,EAAE,GAAY,EAAE,SAAuB,QAAQ;IACzG,iBAAiB,CAAC,YAAY,EAAE,GAAG,EAAE,YAAY,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;AAC/E,CAAC"}
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../src/commands/applications/shared.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAEpC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAE3C,OAAO,EAAE,iBAAiB,EAAE,MAAM,4BAA4B,CAAC;AAG/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D;;;;;;;;;GASG;AACH,MAAM,UAAU,uBAAuB,CAAC,YAAoB,EAAE,GAAY,EAAE,SAAuB,QAAQ;IACzG,iBAAiB,CAAC,YAAY,EAAE,GAAG,EAAE,YAAY,CAAC,iBAAiB,EAAE,MAAM,CAAC,CAAC;AAC/E,CAAC;AAED;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,4BAA4B,CAAC,WAAmB,EAAE,OAAe,EAAE,UAAkB;IACnG,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,OAAO,CAAC,CAAC,CAAC;IAChE,OAAO,QAAQ,WAAW,CAAC,QAAQ,EAAE,OAAO,UAAU,CAAC,QAAQ,EAAE,cAAc,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC;AACvG,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,yBAAyB,CAAC,IAAsC;IAM9E,MAAM,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAC1E,OAAO;QACL,WAAW,EAAE,IAAI,CAAC,IAAI;QACtB,OAAO,EAAE,IAAI,CAAC,OAAO;QACrB,UAAU;QACV,WAAW,EAAE,IAAI,CAAC,IAAI,GAAG,UAAU;KACpC,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/engagements/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAgC,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/engagements/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAgC,MAAM,WAAW,CAAC;AAqClE;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,uBAAuB,IAAI,OAAO,CAsLjD"}
|
|
@@ -4,10 +4,25 @@ import { Command, InvalidArgumentError, Option } from "commander";
|
|
|
4
4
|
import { engagements } from "@ttctl/core";
|
|
5
5
|
import { markMutation } from "../../lib/dry-run.js";
|
|
6
6
|
import { OUTPUT_FORMATS } from "../../lib/output.js";
|
|
7
|
+
import { parsePaginationFlag } from "../../lib/pagination.js";
|
|
7
8
|
import { runEngagementsBreaksAdd, runEngagementsBreaksList, runEngagementsBreaksRemove, runEngagementsBreaksReschedule, runEngagementsBreaksReasonsList, } from "./breaks.js";
|
|
8
9
|
import { runEngagementsList } from "./list.js";
|
|
9
10
|
import { runEngagementsShow } from "./show.js";
|
|
10
11
|
import { runEngagementsStats } from "./stats.js";
|
|
12
|
+
/**
|
|
13
|
+
* Page-number / page-size option factories (#375, following the #183
|
|
14
|
+
* per-leaf pattern). The `list` leaf declares its own copy of
|
|
15
|
+
* `--page` / `--per-page`; the parser (`parsePaginationFlag`) and
|
|
16
|
+
* descriptions are shared via these factories so the engagements
|
|
17
|
+
* surface stays byte-identical with the jobs surface in `--help`
|
|
18
|
+
* output.
|
|
19
|
+
*/
|
|
20
|
+
function pageOption() {
|
|
21
|
+
return new Option("--page <number>", "page number (1-indexed)").argParser((raw) => parsePaginationFlag("--page", raw));
|
|
22
|
+
}
|
|
23
|
+
function perPageOption() {
|
|
24
|
+
return new Option("--per-page <number>", "items per page").argParser((raw) => parsePaginationFlag("--per-page", raw));
|
|
25
|
+
}
|
|
11
26
|
/**
|
|
12
27
|
* Build the `ttctl engagements` command tree (#147, extended by #155).
|
|
13
28
|
* Seven leaves across the top-level group and one nested sub-group
|
|
@@ -43,6 +58,8 @@ export function buildEngagementsCommand() {
|
|
|
43
58
|
.choices([...engagements.ENGAGEMENT_LIST_STATUSES])
|
|
44
59
|
.default("active"))
|
|
45
60
|
.option("--keywords <keyword...>", "free-text keyword filter (repeatable; AND across keywords)")
|
|
61
|
+
.addOption(pageOption())
|
|
62
|
+
.addOption(perPageOption())
|
|
46
63
|
.addOption(new Option("-o, --output <format>", "output format")
|
|
47
64
|
.choices(OUTPUT_FORMATS)
|
|
48
65
|
.default("pretty"))
|
|
@@ -53,6 +70,10 @@ export function buildEngagementsCommand() {
|
|
|
53
70
|
};
|
|
54
71
|
if (options.keywords !== undefined)
|
|
55
72
|
listOpts.keywords = options.keywords;
|
|
73
|
+
if (options.page !== undefined)
|
|
74
|
+
listOpts.page = options.page;
|
|
75
|
+
if (options.perPage !== undefined)
|
|
76
|
+
listOpts.perPage = options.perPage;
|
|
56
77
|
await runEngagementsList(listOpts);
|
|
57
78
|
});
|
|
58
79
|
cmd
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/commands/engagements/index.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAEpC,OAAO,EAAE,OAAO,EAAE,oBAAoB,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAElE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,OAAO,EACL,uBAAuB,EACvB,wBAAwB,EACxB,0BAA0B,EAC1B,8BAA8B,EAC9B,+BAA+B,GAChC,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW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IACL,CAAC,CAAC,CACL,CAAC;IAEF,0EAA0E;IAC1E,oEAAoE;IACpE,iCAAiC;IACjC,MAAM,OAAO,GAAG,MAAM;SACnB,OAAO,CAAC,SAAS,CAAC;SAClB,WAAW,CAAC,iEAAiE,CAAC,CAAC;IAElF,OAAO;SACJ,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,qFAAqF,CAAC;SAClG,SAAS,CACR,IAAI,MAAM,CAAC,uBAAuB,EAAE,eAAe,CAAC;SACjD,OAAO,CAAC,cAAc,CAAC;SACvB,OAAO,CAAC,QAA+B,CAAC,CAC5C;SACA,MAAM,CAAC,KAAK,EAAE,OAAiC,EAAE,EAAE;QAClD,MAAM,+BAA+B,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;IAEL,OAAO,GAAG,CAAC;AACb,CAAC;AAED;;;GAGG;AACH,SAAS,UAAU,CAAC,KAAa;IAC/B,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,oBAAoB,CAAC,sBAAsB,CAAC,CAAC;IACzD,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -8,18 +8,20 @@ import type { OutputFormat } from "../../lib/output.js";
|
|
|
8
8
|
* Filters: `--status active|past|all` (default `active`) and
|
|
9
9
|
* `--keywords` (free-text, repeatable; passed through to the gateway).
|
|
10
10
|
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
* `
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
* `
|
|
11
|
+
* Pagination (#375): `--page` (1-indexed) / `--per-page` are declared
|
|
12
|
+
* on this leaf (per #183, per paginating leaf) and threaded to the
|
|
13
|
+
* service's `jobActivityList.page` / `pageSize` wire args. When
|
|
14
|
+
* neither flag is set, the service applies defaults
|
|
15
|
+
* (`page: 1, perPage: 20`). The JSON / YAML envelope carries
|
|
16
|
+
* `pageInfo` (`currentPage`, `perPage`, `totalPages`, `hasNextPage`);
|
|
17
|
+
* the pretty / table footer renders "Page X of Y (per_page=Z)" when
|
|
18
|
+
* `totalCount > 0`.
|
|
19
19
|
*/
|
|
20
20
|
export interface EngagementsListOptions {
|
|
21
21
|
status?: engagements.EngagementListStatus;
|
|
22
22
|
keywords?: string[];
|
|
23
|
+
page?: number;
|
|
24
|
+
perPage?: number;
|
|
23
25
|
output: OutputFormat;
|
|
24
26
|
}
|
|
25
27
|
export declare function runEngagementsList(opts: EngagementsListOptions): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/engagements/list.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGxD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,sBAAsB;IACrC,MAAM,CAAC,EAAE,WAAW,CAAC,oBAAoB,CAAC;IAC1C,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,MAAM,EAAE,YAAY,CAAC;CACtB;AAED,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"list.d.ts","sourceRoot":"","sources":["../../../src/commands/engagements/list.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAI1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGxD;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,WAAW,sBAAsB;IACrC,MAAM,CAAC,EAAE,WAAW,CAAC,oBAAoB,CAAC;IAC1C,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;IACpB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,YAAY,CAAC;CACtB;AAED,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,sBAAsB,GAAG,OAAO,CAAC,IAAI,CAAC,CAsBpF;AAmBD;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,WAAW,CAAC,kBAAkB,EAAE,EACvC,aAAa,GAAE,MAAsC,GACpD,MAAM,CA8BR;AAED;;;;GAIG;AACH,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAS7D;AAED;;;;GAIG;AACH,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,CAIvD"}
|
|
@@ -4,7 +4,7 @@ import Table from "cli-table3";
|
|
|
4
4
|
import { engagements } from "@ttctl/core";
|
|
5
5
|
import { wrapListEnvelope } from "../../lib/envelopes.js";
|
|
6
6
|
import { emitResult } from "../../lib/output.js";
|
|
7
|
-
import { handleEngagementsError, loadAuthTokenOrExit } from "./shared.js";
|
|
7
|
+
import { buildEngagementsPageInfo, formatPageFooter, handleEngagementsError, loadAuthTokenOrExit } from "./shared.js";
|
|
8
8
|
export async function runEngagementsList(opts) {
|
|
9
9
|
const token = await loadAuthTokenOrExit("engagements list", opts.output);
|
|
10
10
|
const listOpts = {};
|
|
@@ -12,19 +12,38 @@ export async function runEngagementsList(opts) {
|
|
|
12
12
|
listOpts.status = opts.status;
|
|
13
13
|
if (opts.keywords !== undefined)
|
|
14
14
|
listOpts.keywords = opts.keywords;
|
|
15
|
-
|
|
15
|
+
if (opts.page !== undefined)
|
|
16
|
+
listOpts.page = opts.page;
|
|
17
|
+
if (opts.perPage !== undefined)
|
|
18
|
+
listOpts.perPage = opts.perPage;
|
|
19
|
+
let page;
|
|
16
20
|
try {
|
|
17
|
-
|
|
21
|
+
page = await engagements.list(token, listOpts);
|
|
18
22
|
}
|
|
19
23
|
catch (err) {
|
|
20
24
|
handleEngagementsError("engagements list", err, opts.output);
|
|
21
25
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
const pageInfo = buildEngagementsPageInfo(page);
|
|
27
|
+
emitResult(wrapListEnvelope(page.items, pageInfo), opts.output, {
|
|
28
|
+
pretty: (data) => renderEngagementsListPretty(data.items, page),
|
|
29
|
+
table: (data) => renderEngagementsListPretty(data.items, page),
|
|
25
30
|
empty: { command: "engagements.list" },
|
|
26
31
|
});
|
|
27
32
|
}
|
|
33
|
+
/**
|
|
34
|
+
* Render the engagements table plus the pretty-mode pagination footer
|
|
35
|
+
* underneath (#375). Mirrors `renderJobsListPretty` in
|
|
36
|
+
* `jobs/list.ts`: the footer is appended only when `totalCount > 0` —
|
|
37
|
+
* empty pages route through the empty-state CTA wrapper BEFORE this
|
|
38
|
+
* renderer fires, so the defensive `if` here preserves the
|
|
39
|
+
* direct-call surface (tests, future programmatic use).
|
|
40
|
+
*/
|
|
41
|
+
function renderEngagementsListPretty(items, page) {
|
|
42
|
+
const table = formatEngagementsTable(items);
|
|
43
|
+
if (page.totalCount <= 0)
|
|
44
|
+
return table;
|
|
45
|
+
return `${table}\n${formatPageFooter(page.page, page.perPage, page.totalCount)}`;
|
|
46
|
+
}
|
|
28
47
|
/**
|
|
29
48
|
* Render the engagements list as a `cli-table3` table sized to the
|
|
30
49
|
* current terminal width. Columns: id, status, client, job title,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"list.js","sourceRoot":"","sources":["../../../src/commands/engagements/list.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC,oCAAoC;AAEpC,OAAO,KAAK,MAAM,YAAY,CAAC;AAC/B,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAE1C,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAEjD,OA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IACD,OAAO,KAAK,CAAC,QAAQ,EAAE,CAAC;AAC1B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,uBAAuB,CAAC,KAAa;IACnD,QAAQ,KAAK,EAAE,CAAC;QACd,KAAK,mBAAmB;YACtB,OAAO,QAAQ,CAAC;QAClB,KAAK,mBAAmB;YACtB,OAAO,QAAQ,CAAC;QAClB;YACE,OAAO,KAAK,CAAC;IACjB,CAAC;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,UAAU,CAAC,KAAoB;IAC7C,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,EAAE;QAAE,OAAO,GAAG,CAAC;IAC/C,MAAM,CAAC,GAAG,sBAAsB,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC7C,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC;AACzB,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { engagements } from "@ttctl/core";
|
|
1
2
|
import type { OutputFormat } from "../../lib/output.js";
|
|
2
3
|
export { loadAuthTokenOrExit } from "../profile/shared.js";
|
|
3
4
|
/**
|
|
@@ -7,4 +8,43 @@ export { loadAuthTokenOrExit } from "../profile/shared.js";
|
|
|
7
8
|
* sub-domains.
|
|
8
9
|
*/
|
|
9
10
|
export declare function handleEngagementsError(commandLabel: string, err: unknown, format?: OutputFormat): never;
|
|
11
|
+
/**
|
|
12
|
+
* Render the pretty-format pagination footer "Page X of Y
|
|
13
|
+
* (per_page=Z)" appended below the table for `engagements list`
|
|
14
|
+
* (#375). The footer is appended ONLY when the server returned
|
|
15
|
+
* `totalCount > 0` — empty pages route through the empty-state CTA
|
|
16
|
+
* wrapper BEFORE per-format dispatch, so this helper never fires on
|
|
17
|
+
* `items.length === 0`.
|
|
18
|
+
*
|
|
19
|
+
* `totalPages` is `Math.max(1, Math.ceil(totalCount / perPage))` so a
|
|
20
|
+
* single-page result with `totalCount > 0` renders "Page 1 of 1".
|
|
21
|
+
*
|
|
22
|
+
* Domain-local copy of the `jobs/shared.ts` formatter — per #183 each
|
|
23
|
+
* paginating domain owns its pagination primitives rather than
|
|
24
|
+
* cross-importing (the jobs surface is already merged; promoting this
|
|
25
|
+
* to a shared lib is a separate refactor out of #375's scope). Pure —
|
|
26
|
+
* directly unit-testable.
|
|
27
|
+
*/
|
|
28
|
+
export declare function formatPageFooter(currentPage: number, perPage: number, totalCount: number): string;
|
|
29
|
+
/**
|
|
30
|
+
* Build the offset-style `pageInfo` block for the list envelope
|
|
31
|
+
* (#375) from the service-layer's {@link
|
|
32
|
+
* engagements.EngagementListPage}. Wraps the `totalPages` /
|
|
33
|
+
* `hasNextPage` arithmetic so the action handler and the unit tests
|
|
34
|
+
* share one source of truth. Mirrors `buildJobsPageInfo` in
|
|
35
|
+
* `jobs/shared.ts`.
|
|
36
|
+
*
|
|
37
|
+
* - `currentPage`, `perPage`: passed through verbatim (the service
|
|
38
|
+
* returns the values actually used in the query, after defaults).
|
|
39
|
+
* - `totalPages`: `Math.max(1, Math.ceil(totalCount / perPage))`.
|
|
40
|
+
* - `hasNextPage`: `currentPage < totalPages`.
|
|
41
|
+
*
|
|
42
|
+
* Pure — directly unit-testable.
|
|
43
|
+
*/
|
|
44
|
+
export declare function buildEngagementsPageInfo(page: engagements.EngagementListPage): {
|
|
45
|
+
currentPage: number;
|
|
46
|
+
perPage: number;
|
|
47
|
+
totalPages: number;
|
|
48
|
+
hasNextPage: boolean;
|
|
49
|
+
};
|
|
10
50
|
//# sourceMappingURL=shared.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/commands/engagements/shared.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"shared.d.ts","sourceRoot":"","sources":["../../../src/commands/engagements/shared.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAG1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,GAAE,YAAuB,GAAG,KAAK,CAEjH;AAmBD;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,gBAAgB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,MAAM,CAGjG;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,wBAAwB,CAAC,IAAI,EAAE,WAAW,CAAC,kBAAkB,GAAG;IAC9E,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,OAAO,CAAC;CACtB,CAQA"}
|
|
@@ -28,4 +28,49 @@ function hintForEngagementsCode(code) {
|
|
|
28
28
|
return undefined;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
|
+
/**
|
|
32
|
+
* Render the pretty-format pagination footer "Page X of Y
|
|
33
|
+
* (per_page=Z)" appended below the table for `engagements list`
|
|
34
|
+
* (#375). The footer is appended ONLY when the server returned
|
|
35
|
+
* `totalCount > 0` — empty pages route through the empty-state CTA
|
|
36
|
+
* wrapper BEFORE per-format dispatch, so this helper never fires on
|
|
37
|
+
* `items.length === 0`.
|
|
38
|
+
*
|
|
39
|
+
* `totalPages` is `Math.max(1, Math.ceil(totalCount / perPage))` so a
|
|
40
|
+
* single-page result with `totalCount > 0` renders "Page 1 of 1".
|
|
41
|
+
*
|
|
42
|
+
* Domain-local copy of the `jobs/shared.ts` formatter — per #183 each
|
|
43
|
+
* paginating domain owns its pagination primitives rather than
|
|
44
|
+
* cross-importing (the jobs surface is already merged; promoting this
|
|
45
|
+
* to a shared lib is a separate refactor out of #375's scope). Pure —
|
|
46
|
+
* directly unit-testable.
|
|
47
|
+
*/
|
|
48
|
+
export function formatPageFooter(currentPage, perPage, totalCount) {
|
|
49
|
+
const totalPages = Math.max(1, Math.ceil(totalCount / perPage));
|
|
50
|
+
return `Page ${currentPage.toString()} of ${totalPages.toString()} (per_page=${perPage.toString()})`;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Build the offset-style `pageInfo` block for the list envelope
|
|
54
|
+
* (#375) from the service-layer's {@link
|
|
55
|
+
* engagements.EngagementListPage}. Wraps the `totalPages` /
|
|
56
|
+
* `hasNextPage` arithmetic so the action handler and the unit tests
|
|
57
|
+
* share one source of truth. Mirrors `buildJobsPageInfo` in
|
|
58
|
+
* `jobs/shared.ts`.
|
|
59
|
+
*
|
|
60
|
+
* - `currentPage`, `perPage`: passed through verbatim (the service
|
|
61
|
+
* returns the values actually used in the query, after defaults).
|
|
62
|
+
* - `totalPages`: `Math.max(1, Math.ceil(totalCount / perPage))`.
|
|
63
|
+
* - `hasNextPage`: `currentPage < totalPages`.
|
|
64
|
+
*
|
|
65
|
+
* Pure — directly unit-testable.
|
|
66
|
+
*/
|
|
67
|
+
export function buildEngagementsPageInfo(page) {
|
|
68
|
+
const totalPages = Math.max(1, Math.ceil(page.totalCount / page.perPage));
|
|
69
|
+
return {
|
|
70
|
+
currentPage: page.page,
|
|
71
|
+
perPage: page.perPage,
|
|
72
|
+
totalPages,
|
|
73
|
+
hasNextPage: page.page < totalPages,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
31
76
|
//# sourceMappingURL=shared.js.map
|