@gitkraken/core-gitlens 0.5.103 → 0.5.105
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/CHANGELOG.md +26 -1
- package/dist/git/models/issue.d.ts +78 -0
- package/dist/git/models/issue.d.ts.map +1 -1
- package/dist/git/models/issue.js.map +1 -1
- package/dist/plus/git-github/api/config.d.ts +12 -0
- package/dist/plus/git-github/api/config.d.ts.map +1 -1
- package/dist/plus/git-github/api/config.js +12 -1
- package/dist/plus/git-github/api/config.js.map +1 -1
- package/dist/plus/git-github/api/github.d.ts +77 -7
- package/dist/plus/git-github/api/github.d.ts.map +1 -1
- package/dist/plus/git-github/api/github.js +241 -120
- package/dist/plus/git-github/api/github.js.map +1 -1
- package/dist/plus/git-github/api/issueSearchQuery.d.ts +70 -0
- package/dist/plus/git-github/api/issueSearchQuery.d.ts.map +1 -0
- package/dist/plus/git-github/api/issueSearchQuery.js +143 -0
- package/dist/plus/git-github/api/issueSearchQuery.js.map +1 -0
- package/dist/plus/integrations/authentication/configuredIntegrationService.d.ts +1 -0
- package/dist/plus/integrations/authentication/configuredIntegrationService.d.ts.map +1 -1
- package/dist/plus/integrations/authentication/configuredIntegrationService.js +4 -1
- package/dist/plus/integrations/authentication/configuredIntegrationService.js.map +1 -1
- package/dist/plus/integrations/index.d.ts +2 -0
- package/dist/plus/integrations/index.d.ts.map +1 -1
- package/dist/plus/integrations/integrationService.d.ts +39 -2
- package/dist/plus/integrations/integrationService.d.ts.map +1 -1
- package/dist/plus/integrations/integrationService.js +46 -23
- package/dist/plus/integrations/integrationService.js.map +1 -1
- package/dist/plus/integrations/manager.d.ts +88 -2
- package/dist/plus/integrations/manager.d.ts.map +1 -1
- package/dist/plus/integrations/models/gitHostIntegration.d.ts +61 -3
- package/dist/plus/integrations/models/gitHostIntegration.d.ts.map +1 -1
- package/dist/plus/integrations/models/gitHostIntegration.js +51 -0
- package/dist/plus/integrations/models/gitHostIntegration.js.map +1 -1
- package/dist/plus/integrations/models/integration.d.ts +3 -46
- package/dist/plus/integrations/models/integration.d.ts.map +1 -1
- package/dist/plus/integrations/models/integration.js.map +1 -1
- package/dist/plus/integrations/models/issueReads.d.ts +70 -0
- package/dist/plus/integrations/models/issueReads.d.ts.map +1 -0
- package/dist/plus/integrations/models/issueReads.js +2 -0
- package/dist/plus/integrations/models/issueReads.js.map +1 -0
- package/dist/plus/integrations/providerFilters.d.ts +10 -0
- package/dist/plus/integrations/providerFilters.d.ts.map +1 -1
- package/dist/plus/integrations/providers/github.d.ts +26 -3
- package/dist/plus/integrations/providers/github.d.ts.map +1 -1
- package/dist/plus/integrations/providers/github.js +34 -0
- package/dist/plus/integrations/providers/github.js.map +1 -1
- package/dist/plus/integrations/providers/models.d.ts +22 -0
- package/dist/plus/integrations/providers/models.d.ts.map +1 -1
- package/dist/plus/integrations/providers/models.js +26 -0
- package/dist/plus/integrations/providers/models.js.map +1 -1
- package/dist/plus/integrations/reads/broaden.d.ts +10 -0
- package/dist/plus/integrations/reads/broaden.d.ts.map +1 -1
- package/dist/plus/integrations/reads/broaden.js.map +1 -1
- package/dist/plus/integrations/reads/counts.d.ts +64 -0
- package/dist/plus/integrations/reads/counts.d.ts.map +1 -0
- package/dist/plus/integrations/reads/counts.js +164 -0
- package/dist/plus/integrations/reads/counts.js.map +1 -0
- package/dist/plus/integrations/reads/filters.d.ts +63 -1
- package/dist/plus/integrations/reads/filters.d.ts.map +1 -1
- package/dist/plus/integrations/reads/filters.js +125 -0
- package/dist/plus/integrations/reads/filters.js.map +1 -1
- package/dist/plus/integrations/reads/issues.d.ts.map +1 -1
- package/dist/plus/integrations/reads/issues.js +22 -41
- package/dist/plus/integrations/reads/issues.js.map +1 -1
- package/dist/plus/integrations/reads/paging.d.ts +59 -0
- package/dist/plus/integrations/reads/paging.d.ts.map +1 -1
- package/dist/plus/integrations/reads/paging.js +60 -0
- package/dist/plus/integrations/reads/paging.js.map +1 -1
- package/dist/plus/integrations/reads/searchIssues.d.ts +55 -0
- package/dist/plus/integrations/reads/searchIssues.d.ts.map +1 -0
- package/dist/plus/integrations/reads/searchIssues.js +144 -0
- package/dist/plus/integrations/reads/searchIssues.js.map +1 -0
- package/dist/plus/integrations/reads/warnings.d.ts +25 -1
- package/dist/plus/integrations/reads/warnings.d.ts.map +1 -1
- package/dist/plus/integrations/reads/warnings.js +86 -2
- package/dist/plus/integrations/reads/warnings.js.map +1 -1
- package/docs/integrations.md +110 -2
- package/docs/kepler-read-api-parity.md +57 -0
- package/package.json +1 -1
- package/src/git/models/issue.ts +81 -0
- package/src/plus/git-github/api/config.ts +13 -0
- package/src/plus/git-github/api/github.ts +332 -148
- package/src/plus/git-github/api/issueSearchQuery.ts +165 -0
- package/src/plus/integrations/authentication/configuredIntegrationService.ts +6 -1
- package/src/plus/integrations/index.ts +5 -0
- package/src/plus/integrations/integrationService.ts +130 -70
- package/src/plus/integrations/manager.ts +88 -2
- package/src/plus/integrations/models/gitHostIntegration.ts +102 -2
- package/src/plus/integrations/models/integration.ts +7 -46
- package/src/plus/integrations/models/issueReads.ts +73 -0
- package/src/plus/integrations/providerFilters.ts +15 -0
- package/src/plus/integrations/providers/github.ts +64 -2
- package/src/plus/integrations/providers/models.ts +49 -0
- package/src/plus/integrations/reads/broaden.ts +10 -0
- package/src/plus/integrations/reads/counts.ts +285 -0
- package/src/plus/integrations/reads/filters.ts +162 -1
- package/src/plus/integrations/reads/issues.ts +22 -45
- package/src/plus/integrations/reads/paging.ts +102 -0
- package/src/plus/integrations/reads/searchIssues.ts +252 -0
- package/src/plus/integrations/reads/warnings.ts +114 -4
|
@@ -0,0 +1,285 @@
|
|
|
1
|
+
import type { IssueSearchCriteria } from '../../../git/models/issue.js';
|
|
2
|
+
import { chunk } from '../../../utils/array.js';
|
|
3
|
+
import { mapBounded } from '../../../utils/promise.js';
|
|
4
|
+
import type { IntegrationIds } from '../constants.js';
|
|
5
|
+
import { providerFanOutConcurrency } from '../constants.js';
|
|
6
|
+
import type { ProviderRepoInput, ProviderReposInput } from '../providers/models.js';
|
|
7
|
+
import { providersMetadata } from '../providers/models.js';
|
|
8
|
+
import type { ProviderResult, ProviderWarning } from '../results.js';
|
|
9
|
+
import { appendDedupedWarning } from '../results.js';
|
|
10
|
+
import {
|
|
11
|
+
isGitHostIntegration,
|
|
12
|
+
isIssuesHostIntegrationId,
|
|
13
|
+
warnOnMissingSessionForDomain,
|
|
14
|
+
} from '../utils/integration.utils.js';
|
|
15
|
+
import type { ProviderReadContext } from './context.js';
|
|
16
|
+
import { runCaptured } from './drains.js';
|
|
17
|
+
import { resolveIssueSearchCriteria, resolveIssueSearchScope } from './filters.js';
|
|
18
|
+
import {
|
|
19
|
+
gitHostOnlySurfaceWarning,
|
|
20
|
+
issuesUnsupportedWarning,
|
|
21
|
+
otherWarning,
|
|
22
|
+
unsupportedIssueSearchCriteriaWarning,
|
|
23
|
+
} from './warnings.js';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* How many scopes go into one upstream request.
|
|
27
|
+
*
|
|
28
|
+
* Measured against the live GitHub API, 30 aliased counts cost a single rate-limit point and ~2s, and 60 cost the
|
|
29
|
+
* same point and roughly twice as long — so the constraint isn't rate limit, it's latency and the provider's
|
|
30
|
+
* (uncontracted, so not to be leaned on) query-complexity limits. 25 keeps a chunk comfortably inside both while
|
|
31
|
+
* still collapsing a realistic filter matrix into one or two requests.
|
|
32
|
+
*/
|
|
33
|
+
const issueCountChunkSize = 25;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* One scope to count.
|
|
37
|
+
*
|
|
38
|
+
* `key` is caller-owned and echoed back verbatim, so a batch result needs no positional matching by the consumer.
|
|
39
|
+
* It never reaches the provider query — the aliases in the upstream document are generated — so it can be any
|
|
40
|
+
* string the caller finds meaningful.
|
|
41
|
+
*/
|
|
42
|
+
export interface IssueCountScope {
|
|
43
|
+
key: string;
|
|
44
|
+
/** Repositories to count over. Combines with `org`, exactly as in `searchIssuesPage`. */
|
|
45
|
+
repos?: ProviderReposInput;
|
|
46
|
+
org?: string;
|
|
47
|
+
/** Same criteria model as `searchIssuesPage`, validated against the same capability table. */
|
|
48
|
+
criteria?: IssueSearchCriteria;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/** The count for one {@link IssueCountScope}, echoed back under the caller's own `key`. */
|
|
52
|
+
export interface IssueCountResult {
|
|
53
|
+
key: string;
|
|
54
|
+
/**
|
|
55
|
+
* Total matches the provider reports. `undefined` when the provider didn't report one for this scope — NEVER
|
|
56
|
+
* zero, which is a real answer. Render the difference: an unreported count means "unknown", and showing it as
|
|
57
|
+
* 0 would tell the user this filter matches nothing.
|
|
58
|
+
*/
|
|
59
|
+
count?: number;
|
|
60
|
+
/**
|
|
61
|
+
* True when `count` exceeds the provider's own result ceiling, so a full read CANNOT return everything no
|
|
62
|
+
* matter how it is paged. This is the signal to warn before starting an expensive fetch.
|
|
63
|
+
*/
|
|
64
|
+
exceedsProviderLimit: boolean;
|
|
65
|
+
/** The ceiling itself, when the provider declares one. */
|
|
66
|
+
providerLimit?: number;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Counts issues for many scopes without fetching any — the probe behind a "this will fetch ~N issues" preview.
|
|
71
|
+
*
|
|
72
|
+
* A distinct method rather than a `countOnly` flag on `searchIssuesPage`, because transferring ZERO issues is the
|
|
73
|
+
* entire value: a flag would return a paged result whose `items`, `cursor` and `hasMore` are all meaningless, and
|
|
74
|
+
* every consumer would have to know which fields to ignore. A separate method has a return type that only
|
|
75
|
+
* describes counts.
|
|
76
|
+
*
|
|
77
|
+
* Scopes are batched into as few upstream requests as possible ({@link issueCountChunkSize} each). A chunk that
|
|
78
|
+
* fails warns and drops only its own scopes, leaving the successful chunks' counts intact — so a partial answer is
|
|
79
|
+
* still useful — with `fetchFailed` set. A scope refused for its own reasons (unscoped, inexpressible criteria) is
|
|
80
|
+
* likewise isolated: its siblings are still counted.
|
|
81
|
+
*
|
|
82
|
+
* Cheap is not free: each chunk is a network request, so a caller driving this from UI state is expected to
|
|
83
|
+
* debounce and cache.
|
|
84
|
+
*/
|
|
85
|
+
export async function countIssues(
|
|
86
|
+
ctx: ProviderReadContext,
|
|
87
|
+
options: {
|
|
88
|
+
providerId: IntegrationIds;
|
|
89
|
+
scopes: readonly IssueCountScope[];
|
|
90
|
+
connectionId?: string;
|
|
91
|
+
/**
|
|
92
|
+
* Explicit self-managed host domain. Used only when the requested connection has no configured domain;
|
|
93
|
+
* it must come from the trusted authentication configuration, not repository or remote data.
|
|
94
|
+
*/
|
|
95
|
+
domain?: string;
|
|
96
|
+
},
|
|
97
|
+
): Promise<ProviderResult<IssueCountResult>> {
|
|
98
|
+
const refused = (warning: ProviderWarning): ProviderResult<IssueCountResult> => ({
|
|
99
|
+
items: [],
|
|
100
|
+
warnings: [warning],
|
|
101
|
+
fetchFailed: true,
|
|
102
|
+
});
|
|
103
|
+
|
|
104
|
+
if (isIssuesHostIntegrationId(options.providerId)) {
|
|
105
|
+
return refused(gitHostOnlySurfaceWarning(options.providerId, undefined, options.connectionId, 'Issue counts'));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Nothing was asked for, so nothing is missing: an empty success, not a refusal.
|
|
109
|
+
if (options.scopes.length === 0) return { items: [], warnings: [] };
|
|
110
|
+
|
|
111
|
+
const duplicateKey = findDuplicateKey(options.scopes);
|
|
112
|
+
if (duplicateKey != null) {
|
|
113
|
+
// Refuses the whole call rather than deduping: `key` exists so the caller can match results without
|
|
114
|
+
// positional bookkeeping, and two results under one key make that ambiguous for EVERY scope, not just the
|
|
115
|
+
// repeated one.
|
|
116
|
+
return refused(
|
|
117
|
+
otherWarning(
|
|
118
|
+
options.providerId,
|
|
119
|
+
undefined,
|
|
120
|
+
options.connectionId,
|
|
121
|
+
`Duplicate issue count scope key '${duplicateKey}'; keys identify results, so each must be unique.`,
|
|
122
|
+
),
|
|
123
|
+
);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const integration = await ctx.getIntegrationForRead(options.providerId, options.connectionId, options.domain);
|
|
127
|
+
if (integration == null) {
|
|
128
|
+
// A supplied connection or domain that no longer resolves is a broken target, not an empty account.
|
|
129
|
+
const early = ctx.earlyReturnConnectionWarnings(options.providerId, options.connectionId, options.domain);
|
|
130
|
+
return { items: [], warnings: early.warnings, fetchFailed: early.fetchFailed || undefined };
|
|
131
|
+
}
|
|
132
|
+
if (!isGitHostIntegration(integration)) {
|
|
133
|
+
return refused(gitHostOnlySurfaceWarning(options.providerId, undefined, options.connectionId, 'Issue counts'));
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
const domain = ctx.domainForRead(integration, options.providerId, options.connectionId, options.domain);
|
|
137
|
+
const warnOnMissingSession = warnOnMissingSessionForDomain(options.providerId, options.domain);
|
|
138
|
+
|
|
139
|
+
if (!integration.supportsIssues) {
|
|
140
|
+
return refused(issuesUnsupportedWarning(options.providerId, domain, options.connectionId));
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
const providerLimit = providersMetadata[options.providerId]?.issueSearchResultLimit;
|
|
144
|
+
const warnings: ProviderWarning[] = [];
|
|
145
|
+
let fetchFailed = false;
|
|
146
|
+
|
|
147
|
+
// Validate every scope first, so a refusal costs no request at all and the countable ones are still batched
|
|
148
|
+
// together.
|
|
149
|
+
const countable: IssueCountScope[] = [];
|
|
150
|
+
for (const scope of options.scopes) {
|
|
151
|
+
const warning = rejectScope(options.providerId, domain, options.connectionId, scope);
|
|
152
|
+
if (warning != null) {
|
|
153
|
+
// `push`, not `appendDedupedWarning`: every rejection message embeds the scope's own key, and duplicate
|
|
154
|
+
// keys were already refused above, so no two of these can ever collapse — deduping them would only pay
|
|
155
|
+
// the O(n²) key comparison to prove it.
|
|
156
|
+
warnings.push(warning);
|
|
157
|
+
fetchFailed = true;
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
countable.push(scope);
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
// Chunks are independent requests over their own slice of scopes — nothing in one reads what another produced,
|
|
165
|
+
// and `runCaptured` never throws — so they run concurrently, bounded like every other fan-out on the facade.
|
|
166
|
+
// Sequentially they would spend exactly the resource this probe is tuned to conserve: latency, ~2s per chunk.
|
|
167
|
+
// `mapBounded` returns in input order, so `items` and `warnings` stay in scope order.
|
|
168
|
+
const batches = await mapBounded(chunk(countable, issueCountChunkSize), providerFanOutConcurrency, batch =>
|
|
169
|
+
runCaptured(
|
|
170
|
+
options.providerId,
|
|
171
|
+
domain,
|
|
172
|
+
options.connectionId,
|
|
173
|
+
() =>
|
|
174
|
+
integration.countIssuesResult(
|
|
175
|
+
batch.map(s => ({
|
|
176
|
+
repos: s.repos as ProviderRepoInput[] | undefined,
|
|
177
|
+
org: s.org,
|
|
178
|
+
criteria: s.criteria,
|
|
179
|
+
})),
|
|
180
|
+
undefined,
|
|
181
|
+
options.connectionId,
|
|
182
|
+
),
|
|
183
|
+
{ warnOnMissingSession: warnOnMissingSession },
|
|
184
|
+
).then(result => ({ batch: batch, ...result })),
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
const items: IssueCountResult[] = [];
|
|
188
|
+
for (const { batch, value, warning } of batches) {
|
|
189
|
+
if (warning != null) {
|
|
190
|
+
appendDedupedWarning(warnings, warning);
|
|
191
|
+
}
|
|
192
|
+
if (value == null) {
|
|
193
|
+
// This batch contributes nothing, but the batches around it still do. Drop only these scopes.
|
|
194
|
+
fetchFailed = true;
|
|
195
|
+
continue;
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
for (let i = 0; i < batch.length; i++) {
|
|
199
|
+
const count = value[i];
|
|
200
|
+
items.push({
|
|
201
|
+
key: batch[i].key,
|
|
202
|
+
count: count,
|
|
203
|
+
// Only a reported count can exceed a declared ceiling; unknown-vs-limit is not a comparison.
|
|
204
|
+
exceedsProviderLimit: count != null && providerLimit != null && count > providerLimit,
|
|
205
|
+
providerLimit: providerLimit,
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// A provider with no count support returns `undefined` with no error, which lands as an empty `items` and no
|
|
211
|
+
// warning. Say so explicitly rather than letting it read as "every scope matched nothing".
|
|
212
|
+
if (items.length === 0 && warnings.length === 0) {
|
|
213
|
+
return refused(
|
|
214
|
+
unsupportedIssueSearchCriteriaWarning(options.providerId, domain, options.connectionId, {
|
|
215
|
+
reason: 'unsupported-search',
|
|
216
|
+
}),
|
|
217
|
+
);
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
return { items: items, warnings: warnings, fetchFailed: fetchFailed || undefined };
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
/** The first key that appears twice, or `undefined` when every key is unique. */
|
|
224
|
+
function findDuplicateKey(scopes: readonly IssueCountScope[]): string | undefined {
|
|
225
|
+
const seen = new Set<string>();
|
|
226
|
+
for (const scope of scopes) {
|
|
227
|
+
if (seen.has(scope.key)) return scope.key;
|
|
228
|
+
|
|
229
|
+
seen.add(scope.key);
|
|
230
|
+
}
|
|
231
|
+
return undefined;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* Why one scope can't be counted, as the warning to report — or `undefined` when it can.
|
|
236
|
+
*
|
|
237
|
+
* The scope and criteria rules come from {@link resolveIssueSearchScope} / {@link resolveIssueSearchCriteria},
|
|
238
|
+
* the same validators `searchIssuesPage` uses, so a count always previews the constraints the read would apply.
|
|
239
|
+
* That is not cosmetic: a count computed under different constraints is a WRONG number rather than a missing
|
|
240
|
+
* one, which is worse. Only the wording is local, because these name the offending scope's key.
|
|
241
|
+
*/
|
|
242
|
+
function rejectScope(
|
|
243
|
+
providerId: IntegrationIds,
|
|
244
|
+
domain: string | undefined,
|
|
245
|
+
connectionId: string | undefined,
|
|
246
|
+
scope: IssueCountScope,
|
|
247
|
+
): ProviderWarning | undefined {
|
|
248
|
+
const scoping = resolveIssueSearchScope(scope.repos, scope.org, scope.criteria);
|
|
249
|
+
switch (scoping.rejection) {
|
|
250
|
+
case 'repo-ids':
|
|
251
|
+
return otherWarning(
|
|
252
|
+
providerId,
|
|
253
|
+
domain,
|
|
254
|
+
connectionId,
|
|
255
|
+
`Issue count scope '${scope.key}' cannot be scoped by repository id; pass repository descriptors (namespace + name) instead.`,
|
|
256
|
+
);
|
|
257
|
+
case 'unscoped':
|
|
258
|
+
return otherWarning(
|
|
259
|
+
providerId,
|
|
260
|
+
domain,
|
|
261
|
+
connectionId,
|
|
262
|
+
`Issue count scope '${scope.key}' is unscoped; pass \`repos\`, \`org\`, or a relationship to the current user. \`any-assignee\` and \`unassigned\` are not scopes.`,
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
const resolved = resolveIssueSearchCriteria(providerId, scope.criteria);
|
|
267
|
+
if (resolved.rejection != null) {
|
|
268
|
+
return unsupportedIssueSearchCriteriaWarning(providerId, domain, connectionId, resolved.rejection);
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
// Count-only, with no counterpart in the read: a relationship set is an OR across several searches, which one
|
|
272
|
+
// count can't express — summing them would double-count anything matching two, and taking the max would
|
|
273
|
+
// under-report. Rather than answer with a wrong number, ask the caller to count each relationship as its own
|
|
274
|
+
// scope, where the keys make the OR explicit.
|
|
275
|
+
if ((scope.criteria?.relationships?.length ?? 0) > 1) {
|
|
276
|
+
return otherWarning(
|
|
277
|
+
providerId,
|
|
278
|
+
domain,
|
|
279
|
+
connectionId,
|
|
280
|
+
`Issue count scope '${scope.key}' requests several relationships, which a single count can't express (they are OR-ed, so overlapping matches would be double-counted); pass one scope per relationship.`,
|
|
281
|
+
);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
return undefined;
|
|
285
|
+
}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import type { IntegrationIds } from '../constants.js';
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
IssueFilter,
|
|
4
|
+
IssueSearchCapabilities,
|
|
5
|
+
IssueSearchCriteria,
|
|
6
|
+
IssueSearchRelationship,
|
|
7
|
+
PullRequestFilter,
|
|
8
|
+
} from '../providerFilters.js';
|
|
9
|
+
import type { ProviderRepoInput, ProviderReposInput } from '../providers/models.js';
|
|
3
10
|
import { providersMetadata } from '../providers/models.js';
|
|
4
11
|
|
|
5
12
|
/**
|
|
@@ -79,6 +86,139 @@ export function resolveAccountWideIssueFilters(
|
|
|
79
86
|
return { filters: filters, unsupported: false };
|
|
80
87
|
}
|
|
81
88
|
|
|
89
|
+
/** Why {@link resolveIssueSearchCriteria} refused a criteria set, so the caller can word the refusal exactly. */
|
|
90
|
+
export type IssueSearchCriteriaRejection =
|
|
91
|
+
/** The provider has no filtered issue search at all. */
|
|
92
|
+
| { reason: 'unsupported-search' }
|
|
93
|
+
/** The provider has one, but can't express these criteria server-side. */
|
|
94
|
+
| { reason: 'unsupported-criteria'; criteria: string[] }
|
|
95
|
+
/** `any-assignee` and `unassigned` partition the scope between them; asking for both asks for nothing. */
|
|
96
|
+
| { reason: 'contradictory-relationships' };
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Validates a filtered issue search's criteria against {@link ProviderMetadata.supportedIssueSearch}.
|
|
100
|
+
*
|
|
101
|
+
* All-or-nothing like its three siblings above, and for the same reason: a criterion dropped because the
|
|
102
|
+
* provider can't express it would serve a WIDER result than was asked for, and narrowing the returned page
|
|
103
|
+
* afterward would leave `items` describing a different result set than the `hasMore`/`cursor` the provider
|
|
104
|
+
* produced with it. So an inexpressible set is refused whole and the caller surfaces a warning.
|
|
105
|
+
*
|
|
106
|
+
* Unlike the sibling validators this also rejects a set that is internally contradictory, because this criteria
|
|
107
|
+
* model is the only one with two members that partition the scope between them (`any-assignee` ∪ `unassigned` =
|
|
108
|
+
* everything, ∩ = nothing). Silently keeping one would answer a question the caller didn't ask.
|
|
109
|
+
*
|
|
110
|
+
* `undefined` (or an empty relationship list plus no other criterion) is a valid UNNARROWED search of the given
|
|
111
|
+
* scope, not an error — the caller's `repos`/`org` is what bounds it.
|
|
112
|
+
*/
|
|
113
|
+
export function resolveIssueSearchCriteria(
|
|
114
|
+
id: IntegrationIds,
|
|
115
|
+
criteria: IssueSearchCriteria | undefined,
|
|
116
|
+
): { rejection?: IssueSearchCriteriaRejection } {
|
|
117
|
+
const supported = providersMetadata[id]?.supportedIssueSearch;
|
|
118
|
+
if (supported == null) return { rejection: { reason: 'unsupported-search' } };
|
|
119
|
+
if (criteria == null) return {};
|
|
120
|
+
|
|
121
|
+
const relationships = criteria.relationships;
|
|
122
|
+
if (relationships?.includes('any-assignee') && relationships.includes('unassigned')) {
|
|
123
|
+
return { rejection: { reason: 'contradictory-relationships' } };
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const unsupported: string[] = [];
|
|
127
|
+
for (const relationship of relationships ?? []) {
|
|
128
|
+
if (!supported.relationships.includes(relationship)) {
|
|
129
|
+
unsupported.push(`relationships:${relationship}`);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
// Only a criterion the caller actually SET can be unsupported. `false`/empty means "don't narrow on this",
|
|
133
|
+
// which every provider can honor by doing nothing, so it must not be validated as a request.
|
|
134
|
+
if (criteria.text != null && criteria.text.trim().length > 0 && !supported.text) {
|
|
135
|
+
unsupported.push('text');
|
|
136
|
+
}
|
|
137
|
+
if (criteria.labels?.length && !supported.labels) {
|
|
138
|
+
unsupported.push('labels');
|
|
139
|
+
}
|
|
140
|
+
if (criteria.milestone != null && !supported.milestone) {
|
|
141
|
+
unsupported.push('milestone');
|
|
142
|
+
}
|
|
143
|
+
if (criteria.updatedAfter != null && !supported.updatedAfter) {
|
|
144
|
+
unsupported.push('updatedAfter');
|
|
145
|
+
}
|
|
146
|
+
if (criteria.createdAfter != null && !supported.createdAfter) {
|
|
147
|
+
unsupported.push('createdAfter');
|
|
148
|
+
}
|
|
149
|
+
if (criteria.withoutLinkedPullRequest === true && !supported.withoutLinkedPullRequest) {
|
|
150
|
+
unsupported.push('withoutLinkedPullRequest');
|
|
151
|
+
}
|
|
152
|
+
// `'open'` is every provider's own default, so asking for it needs no state capability.
|
|
153
|
+
if (criteria.state != null && criteria.state !== 'open' && !supported.states) {
|
|
154
|
+
unsupported.push('state');
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
if (unsupported.length > 0) return { rejection: { reason: 'unsupported-criteria', criteria: unsupported } };
|
|
158
|
+
|
|
159
|
+
return {};
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
/**
|
|
163
|
+
* The relationships that bound a filtered issue search to the CURRENT USER, and so can stand in for a
|
|
164
|
+
* repository/org scope.
|
|
165
|
+
*
|
|
166
|
+
* Derived from the union rather than spelled out per call site, because the distinction it encodes is the whole
|
|
167
|
+
* reason the scope rule exists: `any-assignee` and `unassigned` are deliberately absent — they describe the
|
|
168
|
+
* ISSUE, not the caller, so neither reduces the search to anyone's own world (measured: unscoped `no:assignee`
|
|
169
|
+
* matches ~45 million issues on GitHub).
|
|
170
|
+
*/
|
|
171
|
+
const userScopingIssueSearchRelationships: readonly IssueSearchRelationship[] = ['authored', 'assigned', 'mentioned'];
|
|
172
|
+
|
|
173
|
+
/** What a provider with NO filtered issue search reports: nothing expressible, spelled out rather than absent. */
|
|
174
|
+
const unsupportedIssueSearchCapabilities: IssueSearchCapabilities = {
|
|
175
|
+
relationships: [],
|
|
176
|
+
text: false,
|
|
177
|
+
labels: false,
|
|
178
|
+
milestone: false,
|
|
179
|
+
updatedAfter: false,
|
|
180
|
+
createdAfter: false,
|
|
181
|
+
withoutLinkedPullRequest: false,
|
|
182
|
+
states: false,
|
|
183
|
+
};
|
|
184
|
+
|
|
185
|
+
/** Why a filtered issue search's scope was refused, or `undefined` when it is usable. */
|
|
186
|
+
export type IssueSearchScopeRejection =
|
|
187
|
+
/** No repositories, no org, and no user-relative relationship: a search of the whole host. */
|
|
188
|
+
| 'unscoped'
|
|
189
|
+
/** Repositories given as ids. A search names repositories by PATH, so ids can't express a scope. */
|
|
190
|
+
| 'repo-ids';
|
|
191
|
+
|
|
192
|
+
/**
|
|
193
|
+
* Validates that a filtered issue search is scoped at all, and narrows `repos` to the descriptor form the
|
|
194
|
+
* provider query needs.
|
|
195
|
+
*
|
|
196
|
+
* Shared by `searchIssuesPage` and `countIssues` because a count computed under different constraints than the
|
|
197
|
+
* read it previews is a WRONG number rather than a missing one. The rejection is returned as a reason code, not a
|
|
198
|
+
* warning: the two callers word it differently (whole-read vs naming the offending scope's key), and wording is
|
|
199
|
+
* the warning layer's business.
|
|
200
|
+
*
|
|
201
|
+
* The two rejections are mutually exclusive — `repo-ids` requires repositories and `unscoped` requires none — so
|
|
202
|
+
* the order they're checked in cannot change the outcome.
|
|
203
|
+
*/
|
|
204
|
+
export function resolveIssueSearchScope(
|
|
205
|
+
repos: ProviderReposInput | undefined,
|
|
206
|
+
org: string | undefined,
|
|
207
|
+
criteria: IssueSearchCriteria | undefined,
|
|
208
|
+
): { rejection?: IssueSearchScopeRejection; repos?: ProviderRepoInput[] } {
|
|
209
|
+
if (repos?.length) {
|
|
210
|
+
// `ProviderReposInput` is a union of descriptor and id arrays; only the descriptor form is usable here.
|
|
211
|
+
if (repos.some(r => typeof r === 'string' || typeof r === 'number')) return { rejection: 'repo-ids' };
|
|
212
|
+
|
|
213
|
+
return { repos: repos as ProviderRepoInput[] };
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
if (org != null && org.length > 0) return {};
|
|
217
|
+
if (criteria?.relationships?.some(r => userScopingIssueSearchRelationships.includes(r)) === true) return {};
|
|
218
|
+
|
|
219
|
+
return { rejection: 'unscoped' };
|
|
220
|
+
}
|
|
221
|
+
|
|
82
222
|
/**
|
|
83
223
|
* The filters `listPullRequestsPage`/`listIssuesPage` (and the sweeps) accept for a provider, so a caller can
|
|
84
224
|
* narrow to what the provider can express BEFORE issuing the read.
|
|
@@ -103,6 +243,11 @@ export function resolveAccountWideIssueFilters(
|
|
|
103
243
|
* {@link IntegrationService.listIssueTrackerIssuesPage} validates against, and leaves `issuesAccountWide`
|
|
104
244
|
* empty. Reading a tracker's capability off `issuesAccountWide` therefore under-reports it.
|
|
105
245
|
*
|
|
246
|
+
* `issueSearch` is a third, wider surface: the FILTERED issue search (`searchIssuesPage`, and the `countIssues`
|
|
247
|
+
* probe over the same criteria), which is not bound to the user at all. It is a record of per-criterion flags
|
|
248
|
+
* rather than a list, because its criteria aren't a single kind. An empty `relationships` means the provider has
|
|
249
|
+
* no filtered issue search — hide the surface, not just its chips.
|
|
250
|
+
*
|
|
106
251
|
* Note this is a CAPABILITY table — "what the provider can express" — not a recommendation. A consumer
|
|
107
252
|
* matching another tool's behavior may deliberately pass fewer filters than are listed here (or none, where an
|
|
108
253
|
* already-scoped read would only be narrowed by them). Intersecting against this table is what keeps a
|
|
@@ -113,12 +258,28 @@ export function getSupportedFilters(providerId: IntegrationIds): {
|
|
|
113
258
|
pullRequestsAccountWide: PullRequestFilter[];
|
|
114
259
|
issues: IssueFilter[];
|
|
115
260
|
issuesAccountWide: IssueFilter[];
|
|
261
|
+
issueSearch: IssueSearchCapabilities;
|
|
116
262
|
} {
|
|
117
263
|
const metadata = providersMetadata[providerId];
|
|
264
|
+
const issueSearch = metadata?.supportedIssueSearch;
|
|
118
265
|
return {
|
|
119
266
|
pullRequests: [...(metadata?.supportedPullRequestFilters ?? [])],
|
|
120
267
|
pullRequestsAccountWide: [...(metadata?.supportedAccountWidePullRequestFilters ?? [])],
|
|
121
268
|
issues: [...(metadata?.supportedIssueFilters ?? [])],
|
|
122
269
|
issuesAccountWide: [...(metadata?.supportedAccountWideIssueFilters ?? [])],
|
|
270
|
+
// Always an object, never `undefined`: a provider WITHOUT a filtered issue search reports one whose
|
|
271
|
+
// `relationships` is empty and whose flags are all false, so a consumer reads capabilities the same way
|
|
272
|
+
// for every provider (and an empty `relationships` is the signal to hide the surface itself).
|
|
273
|
+
//
|
|
274
|
+
// Spread over the all-false baseline rather than defaulting each flag: a criterion added to
|
|
275
|
+
// `IssueSearchCapabilities` then can't be forgotten here and silently reported as `undefined` (which a
|
|
276
|
+
// consumer's `if (caps.x)` would read as unsupported — right answer, wrong reason, and untyped).
|
|
277
|
+
// `supportedIssueSearch` is typed as the complete shape, so no member can arrive as an explicit undefined.
|
|
278
|
+
issueSearch: {
|
|
279
|
+
...unsupportedIssueSearchCapabilities,
|
|
280
|
+
...issueSearch,
|
|
281
|
+
// Copied, so mutating the result can't corrupt the metadata table.
|
|
282
|
+
relationships: [...(issueSearch?.relationships ?? [])],
|
|
283
|
+
},
|
|
123
284
|
};
|
|
124
285
|
}
|
|
@@ -6,7 +6,7 @@ import type { IssueFilter, ProviderReposInput } from '../providers/models.js';
|
|
|
6
6
|
import { PagingMode, providersMetadata } from '../providers/models.js';
|
|
7
7
|
import { mergeCollectionMetadata } from '../providers/utils/providerPaging.js';
|
|
8
8
|
import type { ProviderPagedResult, ProviderWarning } from '../results.js';
|
|
9
|
-
import {
|
|
9
|
+
import { reconcileOmissionsWithFailure } from '../results.js';
|
|
10
10
|
import {
|
|
11
11
|
isGitHostIntegration,
|
|
12
12
|
isIssuesHostIntegrationId,
|
|
@@ -16,6 +16,7 @@ import type { ProviderReadContext } from './context.js';
|
|
|
16
16
|
import { runCaptured } from './drains.js';
|
|
17
17
|
import { resolveAccountWideIssueFilters } from './filters.js';
|
|
18
18
|
import {
|
|
19
|
+
drainFlatPagesToRequestedPage,
|
|
19
20
|
drainToRequestedPage,
|
|
20
21
|
isPageNumberAdvanceable,
|
|
21
22
|
pageToCursor,
|
|
@@ -121,6 +122,11 @@ export async function listIssuesPage(
|
|
|
121
122
|
);
|
|
122
123
|
}
|
|
123
124
|
|
|
125
|
+
// GitHub expresses "any assignee" as `assignee:*`, which is meaningless without a scope: unscoped it
|
|
126
|
+
// matches millions of issues across all of GitHub instead of the user's own world. ANY scope makes it
|
|
127
|
+
// meaningful (one repository, several, or an org) — it is specifically THIS branch, the account-wide read,
|
|
128
|
+
// that has none to offer. Scope the read to repositories (or use `searchIssuesPage`, whose criteria model
|
|
129
|
+
// takes `any-assignee` alongside a `repos`/`org` scope) rather than reading unscoped.
|
|
124
130
|
if (
|
|
125
131
|
options.includeAllAssignees === true &&
|
|
126
132
|
(options.providerId === GitCloudHostIntegrationId.GitHub ||
|
|
@@ -185,51 +191,22 @@ export async function listIssuesPage(
|
|
|
185
191
|
{ warnOnMissingSession: warnOnMissingSession },
|
|
186
192
|
);
|
|
187
193
|
const first = await readAccountWidePage(options.cursor);
|
|
188
|
-
let value = first.value;
|
|
189
194
|
const warnings = first.warning != null ? [first.warning] : [];
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
let
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
appendDedupedWarning(warnings, next.warning);
|
|
206
|
-
}
|
|
207
|
-
if (next.value == null) {
|
|
208
|
-
pageFetchFailed = pageFetchFailed || next.warning != null;
|
|
209
|
-
value = undefined;
|
|
210
|
-
requestedPageMissing = true;
|
|
211
|
-
break;
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
value = next.value;
|
|
215
|
-
allMetadata = mergeCollectionMetadata(allMetadata, value.metadata);
|
|
216
|
-
currentTruncated = currentTruncated || value.truncated;
|
|
217
|
-
currentPage = value.page ?? currentPage + 1;
|
|
218
|
-
// A provider that hands back the same cursor isn't advancing; stop rather than loop forever.
|
|
219
|
-
if (usableCursor(value.cursor) === nextCursor) {
|
|
220
|
-
currentTruncated = true;
|
|
221
|
-
break;
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
// A numbered page beyond the provider's terminal cursor is genuinely empty. Never return or
|
|
226
|
-
// relabel the last available page as the requested one.
|
|
227
|
-
if (currentPage < page) {
|
|
228
|
-
requestedPageMissing = true;
|
|
229
|
-
}
|
|
230
|
-
} else if (options.cursor == null && page > 1) {
|
|
231
|
-
requestedPageMissing = true;
|
|
232
|
-
}
|
|
195
|
+
// Merged across the walked pages, so a per-scope failure reported on an earlier page isn't lost by
|
|
196
|
+
// paging past it — the one thing this read accumulates that the filtered search doesn't.
|
|
197
|
+
let allMetadata = first.value?.metadata;
|
|
198
|
+
const drained = await drainFlatPagesToRequestedPage(first, {
|
|
199
|
+
requestedPage: page,
|
|
200
|
+
suppliedCursor: options.cursor,
|
|
201
|
+
warnings: warnings,
|
|
202
|
+
readPage: readAccountWidePage,
|
|
203
|
+
fold: p => {
|
|
204
|
+
allMetadata = mergeCollectionMetadata(allMetadata, p.metadata);
|
|
205
|
+
},
|
|
206
|
+
});
|
|
207
|
+
const { value, currentPage, requestedPageMissing } = drained;
|
|
208
|
+
const currentTruncated = drained.truncated;
|
|
209
|
+
const pageFetchFailed = drained.fetchFailed;
|
|
233
210
|
|
|
234
211
|
// GitHub, GitLab, and Azure implement an account-wide issue search; a provider that doesn't (Bitbucket
|
|
235
212
|
// exposes no issues at all, and `supportsIssues` already short-circuits it above) returns `undefined`
|
|
@@ -180,6 +180,108 @@ export function resolveCurrentPage(options: {
|
|
|
180
180
|
return options.pageAdvanceable ? options.requestedPage : 1;
|
|
181
181
|
}
|
|
182
182
|
|
|
183
|
+
/**
|
|
184
|
+
* One page of a FLAT cursor-paged provider read — the shape both issue reads' providers return directly.
|
|
185
|
+
*
|
|
186
|
+
* `hasMore` is optional because one of the two providers leaves it off on a terminal page; absent reads as "no
|
|
187
|
+
* more", which is what a provider that reported no continuation means.
|
|
188
|
+
*/
|
|
189
|
+
export interface FlatPage {
|
|
190
|
+
cursor?: string;
|
|
191
|
+
hasMore?: boolean;
|
|
192
|
+
page?: number;
|
|
193
|
+
truncated: boolean;
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
/** What {@link drainFlatPagesToRequestedPage} established by walking. */
|
|
197
|
+
export interface FlatDrainResult<T extends FlatPage> {
|
|
198
|
+
/** The requested page, or `undefined` when a page failed mid-walk (which also sets `fetchFailed`). */
|
|
199
|
+
value: T | undefined;
|
|
200
|
+
/** The position actually reached — 1 when nothing advanced. */
|
|
201
|
+
currentPage: number;
|
|
202
|
+
truncated: boolean;
|
|
203
|
+
/** True when the requested page is past the provider's last one, so it is genuinely EMPTY. */
|
|
204
|
+
requestedPageMissing: boolean;
|
|
205
|
+
fetchFailed: boolean;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/**
|
|
209
|
+
* Walks a FLAT cursor-paged read forward to a requested page number, for a provider whose pages are
|
|
210
|
+
* `{cursor, hasMore, page, truncated}` rather than the SDK's `PagedResult` wrapper.
|
|
211
|
+
*
|
|
212
|
+
* The sibling of {@link drainToRequestedPage}, not a replacement for it: that one normalizes SDK `paging` through
|
|
213
|
+
* {@link toProviderPageInfo}, which retains only cursors whose JSON declares `type`/`cursors` — and the composite
|
|
214
|
+
* cursor of a GitHub aliased search declares neither, so it would be dropped and the walk would never advance.
|
|
215
|
+
* Two shapes genuinely need two entry points; what they must NOT have is two copies of the rules below, which is
|
|
216
|
+
* what this exists to prevent (see this module's own note on drift).
|
|
217
|
+
*
|
|
218
|
+
* The rules, all of them subtle enough to be worth stating once:
|
|
219
|
+
* - The empty-cursor sentinel is filtered, so a provider claiming another page without handing back a usable
|
|
220
|
+
* continuation is not re-read with `'{}'` (which it would answer with page 1 again).
|
|
221
|
+
* - A provider that returns the SAME cursor isn't advancing: stop, and report the read as truncated rather than
|
|
222
|
+
* looping forever or publishing a short page as complete.
|
|
223
|
+
* - A page requested past the provider's terminal cursor is that EMPTY page N — never the last available page
|
|
224
|
+
* relabeled, per {@link ProviderPageInfo.currentPage}.
|
|
225
|
+
* - A page that fails mid-walk latches `fetchFailed` and leaves no value, so the caller can tell "the read broke"
|
|
226
|
+
* from "the page was genuinely empty".
|
|
227
|
+
*
|
|
228
|
+
* `fold` is the one thing the callers differ on — one merges SDK collection metadata across the walked pages, the
|
|
229
|
+
* other keeps the largest reported match count — so it is a callback rather than a branch.
|
|
230
|
+
*/
|
|
231
|
+
export async function drainFlatPagesToRequestedPage<T extends FlatPage>(
|
|
232
|
+
first: { value?: T; warning?: ProviderWarning },
|
|
233
|
+
options: {
|
|
234
|
+
requestedPage: number;
|
|
235
|
+
suppliedCursor: string | undefined;
|
|
236
|
+
warnings: ProviderWarning[];
|
|
237
|
+
readPage: (cursor: string) => Promise<{ value?: T; warning?: ProviderWarning }>;
|
|
238
|
+
fold?: (page: T) => void;
|
|
239
|
+
},
|
|
240
|
+
): Promise<FlatDrainResult<T>> {
|
|
241
|
+
let value = first.value;
|
|
242
|
+
let fetchFailed = first.warning != null && value == null;
|
|
243
|
+
let currentPage = value?.page ?? 1;
|
|
244
|
+
let truncated = value?.truncated ?? false;
|
|
245
|
+
|
|
246
|
+
const walkable = options.suppliedCursor == null && options.requestedPage > 1;
|
|
247
|
+
if (walkable && value != null) {
|
|
248
|
+
for (
|
|
249
|
+
let nextCursor = usableCursor(value.cursor);
|
|
250
|
+
currentPage < options.requestedPage && value.hasMore === true && nextCursor != null;
|
|
251
|
+
nextCursor = usableCursor(value.cursor)
|
|
252
|
+
) {
|
|
253
|
+
const next = await options.readPage(nextCursor);
|
|
254
|
+
if (next.warning != null) {
|
|
255
|
+
appendDedupedWarning(options.warnings, next.warning);
|
|
256
|
+
}
|
|
257
|
+
if (next.value == null) {
|
|
258
|
+
fetchFailed = next.warning != null;
|
|
259
|
+
value = undefined;
|
|
260
|
+
break;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
value = next.value;
|
|
264
|
+
truncated = truncated || value.truncated;
|
|
265
|
+
options.fold?.(value);
|
|
266
|
+
currentPage = value.page ?? currentPage + 1;
|
|
267
|
+
if (usableCursor(value.cursor) === nextCursor) {
|
|
268
|
+
truncated = true;
|
|
269
|
+
break;
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
return {
|
|
275
|
+
value: value,
|
|
276
|
+
currentPage: currentPage,
|
|
277
|
+
truncated: truncated,
|
|
278
|
+
// Every case reduces to "a page was asked for by number and the walk fell short", including the one where
|
|
279
|
+
// no walk ran at all because the first page was already terminal.
|
|
280
|
+
requestedPageMissing: walkable && currentPage < options.requestedPage,
|
|
281
|
+
fetchFailed: fetchFailed,
|
|
282
|
+
};
|
|
283
|
+
}
|
|
284
|
+
|
|
183
285
|
/** The mutable state {@link drainToRequestedPage} carries across the pages it walks. */
|
|
184
286
|
export interface DrainState<T> {
|
|
185
287
|
items: T[];
|