motionmcp 2.1.1 → 2.2.1
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/README.md +1 -1
- package/dist/handlers/CommentHandler.d.ts.map +1 -1
- package/dist/handlers/CommentHandler.js +3 -5
- package/dist/handlers/CommentHandler.js.map +1 -1
- package/dist/handlers/TaskHandler.d.ts +72 -0
- package/dist/handlers/TaskHandler.d.ts.map +1 -1
- package/dist/handlers/TaskHandler.js +77 -1
- package/dist/handlers/TaskHandler.js.map +1 -1
- package/dist/schemas/motion.d.ts +313 -4259
- package/dist/schemas/motion.d.ts.map +1 -1
- package/dist/schemas/motion.js +4 -4
- package/dist/schemas/motion.js.map +1 -1
- package/dist/services/motionApi.d.ts +15 -6
- package/dist/services/motionApi.d.ts.map +1 -1
- package/dist/services/motionApi.js +195 -108
- package/dist/services/motionApi.js.map +1 -1
- package/dist/tools/ToolDefinitions.d.ts.map +1 -1
- package/dist/tools/ToolDefinitions.js +23 -9
- package/dist/tools/ToolDefinitions.js.map +1 -1
- package/dist/tools/ToolRegistry.d.ts +50 -0
- package/dist/tools/ToolRegistry.d.ts.map +1 -1
- package/dist/tools/ToolRegistry.js +51 -6
- package/dist/tools/ToolRegistry.js.map +1 -1
- package/dist/types/mcp-tool-args.d.ts +2 -7
- package/dist/types/mcp-tool-args.d.ts.map +1 -1
- package/dist/types/motion.d.ts +11 -7
- package/dist/types/motion.d.ts.map +1 -1
- package/dist/utils/constants.d.ts +4 -0
- package/dist/utils/constants.d.ts.map +1 -1
- package/dist/utils/constants.js +6 -1
- package/dist/utils/constants.js.map +1 -1
- package/dist/utils/errorHandling.d.ts +17 -2
- package/dist/utils/errorHandling.d.ts.map +1 -1
- package/dist/utils/errorHandling.js +46 -4
- package/dist/utils/errorHandling.js.map +1 -1
- package/dist/utils/frequencyTransform.d.ts +41 -0
- package/dist/utils/frequencyTransform.d.ts.map +1 -0
- package/dist/utils/frequencyTransform.js +326 -0
- package/dist/utils/frequencyTransform.js.map +1 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +2 -0
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/pagination.d.ts +61 -0
- package/dist/utils/pagination.d.ts.map +1 -0
- package/dist/utils/pagination.js +168 -0
- package/dist/utils/pagination.js.map +1 -0
- package/dist/utils/paginationNew.d.ts +14 -0
- package/dist/utils/paginationNew.d.ts.map +1 -1
- package/dist/utils/paginationNew.js +26 -0
- package/dist/utils/paginationNew.js.map +1 -1
- package/dist/utils/parameterUtils.d.ts.map +1 -1
- package/dist/utils/parameterUtils.js +11 -1
- package/dist/utils/parameterUtils.js.map +1 -1
- package/dist/utils/userFacingErrors.d.ts +49 -0
- package/dist/utils/userFacingErrors.d.ts.map +1 -0
- package/dist/utils/userFacingErrors.js +174 -0
- package/dist/utils/userFacingErrors.js.map +1 -0
- package/dist/utils/workspaceResolver.d.ts.map +1 -1
- package/dist/utils/workspaceResolver.js +6 -1
- package/dist/utils/workspaceResolver.js.map +1 -1
- package/package.json +15 -6
- package/dist/mcp-server-old.d.ts +0 -29
- package/dist/mcp-server-old.d.ts.map +0 -1
- package/dist/mcp-server-old.js +0 -1304
- package/dist/mcp-server-old.js.map +0 -1
|
@@ -0,0 +1,326 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Utility functions for transforming frequency objects to Motion API string format
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.transformFrequencyToApiString = transformFrequencyToApiString;
|
|
7
|
+
exports.validateFrequencyObject = validateFrequencyObject;
|
|
8
|
+
exports.isValidFrequencyObject = isValidFrequencyObject;
|
|
9
|
+
/**
|
|
10
|
+
* Maps day numbers (0-6) to Motion API day abbreviations
|
|
11
|
+
* 0 = Sunday, 1 = Monday, ..., 6 = Saturday
|
|
12
|
+
*/
|
|
13
|
+
const DAY_ABBREVIATIONS = {
|
|
14
|
+
0: 'SU', // Sunday
|
|
15
|
+
1: 'MO', // Monday
|
|
16
|
+
2: 'TU', // Tuesday
|
|
17
|
+
3: 'WE', // Wednesday
|
|
18
|
+
4: 'TH', // Thursday
|
|
19
|
+
5: 'FR', // Friday
|
|
20
|
+
6: 'SA' // Saturday
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Transforms a frequency object into the Motion API expected string format
|
|
24
|
+
*
|
|
25
|
+
* Based on Motion API documentation: https://docs.usemotion.com/cookbooks/frequency/
|
|
26
|
+
*
|
|
27
|
+
* Supports all Motion API frequency patterns including:
|
|
28
|
+
* - Daily: daily_every_day, daily_every_week_day, daily_specific_days_[...]
|
|
29
|
+
* - Weekly: weekly_any_day, weekly_any_week_day, weekly_specific_days_[...]
|
|
30
|
+
* - Biweekly: biweekly_first_week_*, biweekly_second_week_*
|
|
31
|
+
* - Monthly: monthly_1-31, monthly_first_MO, monthly_last_TU, monthly_*_week, etc.
|
|
32
|
+
* - Quarterly: quarterly_first_day, quarterly_last_FR, quarterly_any_day_first_week, etc.
|
|
33
|
+
* - Custom: Direct API pattern passthrough
|
|
34
|
+
*
|
|
35
|
+
* @param frequency - The frequency object to transform
|
|
36
|
+
* @returns The Motion API compatible frequency string
|
|
37
|
+
*/
|
|
38
|
+
function transformFrequencyToApiString(frequency) {
|
|
39
|
+
const { type, daysOfWeek, dayOfMonth, weekOfMonth, monthOfQuarter, interval, customPattern } = frequency;
|
|
40
|
+
// Custom pattern passthrough
|
|
41
|
+
if (type === 'custom') {
|
|
42
|
+
if (!customPattern) {
|
|
43
|
+
throw new Error('customPattern is required when type is "custom"');
|
|
44
|
+
}
|
|
45
|
+
return customPattern;
|
|
46
|
+
}
|
|
47
|
+
// Legacy interval mapping: weekly + interval:2 → biweekly
|
|
48
|
+
if (type === 'weekly' && interval === 2) {
|
|
49
|
+
return transformBiweeklyPattern(daysOfWeek, 'first'); // Default to first week
|
|
50
|
+
}
|
|
51
|
+
switch (type) {
|
|
52
|
+
case 'daily':
|
|
53
|
+
return transformDailyPattern(daysOfWeek);
|
|
54
|
+
case 'weekly':
|
|
55
|
+
return transformWeeklyPattern(daysOfWeek);
|
|
56
|
+
case 'biweekly':
|
|
57
|
+
// Use weekOfMonth to determine which week (first or second)
|
|
58
|
+
const biweeklyWeek = (weekOfMonth === 'second') ? 'second' : 'first';
|
|
59
|
+
return transformBiweeklyPattern(daysOfWeek, biweeklyWeek);
|
|
60
|
+
case 'monthly':
|
|
61
|
+
return transformMonthlyPattern(daysOfWeek, dayOfMonth, weekOfMonth);
|
|
62
|
+
case 'quarterly':
|
|
63
|
+
return transformQuarterlyPattern(daysOfWeek, weekOfMonth, monthOfQuarter);
|
|
64
|
+
case 'yearly':
|
|
65
|
+
// Yearly patterns are basic in the API docs
|
|
66
|
+
return 'yearly';
|
|
67
|
+
default:
|
|
68
|
+
throw new Error(`Unsupported frequency type: ${type}`);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
/**
|
|
72
|
+
* Transform daily frequency patterns
|
|
73
|
+
*/
|
|
74
|
+
function transformDailyPattern(daysOfWeek) {
|
|
75
|
+
if (!daysOfWeek || daysOfWeek.length === 0) {
|
|
76
|
+
return 'daily_every_day';
|
|
77
|
+
}
|
|
78
|
+
// Check if it's weekdays only (Mon-Fri)
|
|
79
|
+
const isWeekdaysOnly = isWeekdaysPattern(daysOfWeek);
|
|
80
|
+
if (isWeekdaysOnly) {
|
|
81
|
+
return 'daily_every_week_day';
|
|
82
|
+
}
|
|
83
|
+
// Specific days
|
|
84
|
+
const dayAbbrevs = formatDayAbbreviations(daysOfWeek);
|
|
85
|
+
return `daily_specific_days_[${dayAbbrevs}]`;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Transform weekly frequency patterns
|
|
89
|
+
*/
|
|
90
|
+
function transformWeeklyPattern(daysOfWeek) {
|
|
91
|
+
if (!daysOfWeek || daysOfWeek.length === 0) {
|
|
92
|
+
return 'weekly_any_day';
|
|
93
|
+
}
|
|
94
|
+
// Check if it's weekdays only (Mon-Fri)
|
|
95
|
+
const isWeekdaysOnly = isWeekdaysPattern(daysOfWeek);
|
|
96
|
+
if (isWeekdaysOnly) {
|
|
97
|
+
return 'weekly_any_week_day';
|
|
98
|
+
}
|
|
99
|
+
// Specific days
|
|
100
|
+
const dayAbbrevs = formatDayAbbreviations(daysOfWeek);
|
|
101
|
+
return `weekly_specific_days_[${dayAbbrevs}]`;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Transform biweekly frequency patterns
|
|
105
|
+
*/
|
|
106
|
+
function transformBiweeklyPattern(daysOfWeek, week = 'first') {
|
|
107
|
+
if (!daysOfWeek || daysOfWeek.length === 0) {
|
|
108
|
+
return `biweekly_${week}_week_any_day`;
|
|
109
|
+
}
|
|
110
|
+
// Check if it's weekdays only (Mon-Fri)
|
|
111
|
+
const isWeekdaysOnly = isWeekdaysPattern(daysOfWeek);
|
|
112
|
+
if (isWeekdaysOnly) {
|
|
113
|
+
return `biweekly_${week}_week_any_week_day`;
|
|
114
|
+
}
|
|
115
|
+
// Specific days
|
|
116
|
+
const dayAbbrevs = formatDayAbbreviations(daysOfWeek);
|
|
117
|
+
return `biweekly_${week}_week_specific_days_[${dayAbbrevs}]`;
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Transform monthly frequency patterns
|
|
121
|
+
*/
|
|
122
|
+
function transformMonthlyPattern(daysOfWeek, dayOfMonth, weekOfMonth) {
|
|
123
|
+
// Handle monthly with specific day of month
|
|
124
|
+
if (dayOfMonth && (!daysOfWeek || daysOfWeek.length === 0)) {
|
|
125
|
+
return `monthly_${dayOfMonth}`;
|
|
126
|
+
}
|
|
127
|
+
// Handle monthly with day-of-week patterns
|
|
128
|
+
if (daysOfWeek && daysOfWeek.length > 0) {
|
|
129
|
+
if (weekOfMonth) {
|
|
130
|
+
// Specific week + specific day: monthly_first_MO, monthly_last_TU
|
|
131
|
+
if (daysOfWeek.length === 1) {
|
|
132
|
+
const dayAbbrev = DAY_ABBREVIATIONS[daysOfWeek[0]];
|
|
133
|
+
return `monthly_${weekOfMonth}_${dayAbbrev}`;
|
|
134
|
+
}
|
|
135
|
+
// Specific week + multiple days (not supported directly, use week pattern)
|
|
136
|
+
if (isWeekdaysPattern(daysOfWeek)) {
|
|
137
|
+
return `monthly_any_week_day_${weekOfMonth}_week`;
|
|
138
|
+
}
|
|
139
|
+
return `monthly_any_day_${weekOfMonth}_week`;
|
|
140
|
+
}
|
|
141
|
+
else {
|
|
142
|
+
// No week specified, use general month patterns
|
|
143
|
+
if (isWeekdaysPattern(daysOfWeek)) {
|
|
144
|
+
return 'monthly_any_week_day_of_month';
|
|
145
|
+
}
|
|
146
|
+
// Multiple specific days without weekOfMonth is not supported
|
|
147
|
+
throw new Error('Unsupported multi-day monthly pattern without weekOfMonth. Supported patterns include: monthly_1-31 (e.g., monthly_15), monthly_first_MO, monthly_last_TU, monthly_any_week_day_of_month, monthly_any_day_first_week, etc. Please specify weekOfMonth or see https://docs.usemotion.com/cookbooks/frequency/ for more options.');
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
// Handle weekOfMonth without daysOfWeek (any day of specified week)
|
|
151
|
+
if (weekOfMonth && (!daysOfWeek || daysOfWeek.length === 0)) {
|
|
152
|
+
return `monthly_any_day_${weekOfMonth}_week`;
|
|
153
|
+
}
|
|
154
|
+
// Default to first day of month
|
|
155
|
+
return 'monthly_1';
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Transform quarterly frequency patterns
|
|
159
|
+
*/
|
|
160
|
+
function transformQuarterlyPattern(daysOfWeek, weekOfMonth, monthOfQuarter) {
|
|
161
|
+
// Handle quarterly with specific day-of-week
|
|
162
|
+
if (daysOfWeek && daysOfWeek.length === 1) {
|
|
163
|
+
const dayAbbrev = DAY_ABBREVIATIONS[daysOfWeek[0]];
|
|
164
|
+
if (weekOfMonth === 'first') {
|
|
165
|
+
return `quarterly_first_${dayAbbrev}`;
|
|
166
|
+
}
|
|
167
|
+
if (weekOfMonth === 'last') {
|
|
168
|
+
return `quarterly_last_${dayAbbrev}`;
|
|
169
|
+
}
|
|
170
|
+
// Default to first if no week specified
|
|
171
|
+
return `quarterly_first_${dayAbbrev}`;
|
|
172
|
+
}
|
|
173
|
+
// Handle quarterly with week patterns
|
|
174
|
+
if (weekOfMonth) {
|
|
175
|
+
if (daysOfWeek && isWeekdaysPattern(daysOfWeek)) {
|
|
176
|
+
return `quarterly_any_week_day_${weekOfMonth}_week`;
|
|
177
|
+
}
|
|
178
|
+
return `quarterly_any_day_${weekOfMonth}_week`;
|
|
179
|
+
}
|
|
180
|
+
// Handle quarterly with month patterns
|
|
181
|
+
if (monthOfQuarter) {
|
|
182
|
+
return `quarterly_any_day_${getMonthOrdinal(monthOfQuarter)}_month`;
|
|
183
|
+
}
|
|
184
|
+
// Handle remaining patterns
|
|
185
|
+
if (daysOfWeek && isWeekdaysPattern(daysOfWeek)) {
|
|
186
|
+
return 'quarterly_first_week_day';
|
|
187
|
+
}
|
|
188
|
+
// Explicitly reject unsupported multi-day selections
|
|
189
|
+
if (daysOfWeek && daysOfWeek.length > 1 && !isWeekdaysPattern(daysOfWeek)) {
|
|
190
|
+
throw new Error('Unsupported multi-day selection for quarterly patterns: ' + JSON.stringify(daysOfWeek) +
|
|
191
|
+
'. Quarterly patterns only support a single day-of-week (e.g., "quarterly_first_MO"), weekdays (Mon-Fri, "quarterly_any_week_day_first_week"), or any day ("quarterly_any_day_first_week"). ' +
|
|
192
|
+
'Please refer to the Motion API documentation for supported quarterly patterns: https://docs.usemotion.com/cookbooks/frequency/#quarterly-patterns');
|
|
193
|
+
}
|
|
194
|
+
// Default pattern
|
|
195
|
+
return 'quarterly_first_day';
|
|
196
|
+
}
|
|
197
|
+
/**
|
|
198
|
+
* Helper: Check if daysOfWeek represents weekdays only (Mon-Fri)
|
|
199
|
+
*/
|
|
200
|
+
function isWeekdaysPattern(daysOfWeek) {
|
|
201
|
+
return daysOfWeek.length === 5 &&
|
|
202
|
+
daysOfWeek.includes(1) && daysOfWeek.includes(2) &&
|
|
203
|
+
daysOfWeek.includes(3) && daysOfWeek.includes(4) &&
|
|
204
|
+
daysOfWeek.includes(5);
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Helper: Format day numbers to abbreviations
|
|
208
|
+
* Throws error if invalid days are encountered
|
|
209
|
+
*/
|
|
210
|
+
function formatDayAbbreviations(daysOfWeek) {
|
|
211
|
+
const invalidDays = daysOfWeek.filter(day => day < 0 || day > 6);
|
|
212
|
+
if (invalidDays.length > 0) {
|
|
213
|
+
throw new Error(`Invalid day(s) in daysOfWeek: ${invalidDays.join(', ')}`);
|
|
214
|
+
}
|
|
215
|
+
return daysOfWeek
|
|
216
|
+
.map(day => DAY_ABBREVIATIONS[day])
|
|
217
|
+
.filter(Boolean)
|
|
218
|
+
.join(', ');
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Helper: Convert month number to ordinal string
|
|
222
|
+
*/
|
|
223
|
+
function getMonthOrdinal(month) {
|
|
224
|
+
const ordinals = { 1: 'first', 2: 'second', 3: 'third' };
|
|
225
|
+
return ordinals[month] || 'first';
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Validates that a frequency object is valid for transformation
|
|
229
|
+
*
|
|
230
|
+
* @param frequency - The frequency object to validate
|
|
231
|
+
* @returns Validation result with detailed reason if invalid
|
|
232
|
+
*/
|
|
233
|
+
function validateFrequencyObject(frequency) {
|
|
234
|
+
if (!frequency.type || !['daily', 'weekly', 'biweekly', 'monthly', 'quarterly', 'yearly', 'custom'].includes(frequency.type)) {
|
|
235
|
+
return { valid: false, reason: `Invalid frequency type: ${frequency.type}` };
|
|
236
|
+
}
|
|
237
|
+
// Custom type requires customPattern
|
|
238
|
+
if (frequency.type === 'custom') {
|
|
239
|
+
if (!frequency.customPattern || typeof frequency.customPattern !== 'string' || frequency.customPattern.trim() === '') {
|
|
240
|
+
return { valid: false, reason: 'Custom frequency type requires a non-empty customPattern' };
|
|
241
|
+
}
|
|
242
|
+
return { valid: true }; // Skip other validations for custom patterns
|
|
243
|
+
}
|
|
244
|
+
// Validate daysOfWeek if provided
|
|
245
|
+
if (frequency.daysOfWeek) {
|
|
246
|
+
if (!Array.isArray(frequency.daysOfWeek)) {
|
|
247
|
+
return { valid: false, reason: 'daysOfWeek must be an array' };
|
|
248
|
+
}
|
|
249
|
+
// Check that all days are valid (0-6)
|
|
250
|
+
const invalidDays = frequency.daysOfWeek.filter(day => typeof day !== 'number' || day < 0 || day > 6);
|
|
251
|
+
if (invalidDays.length > 0) {
|
|
252
|
+
return { valid: false, reason: `Invalid day(s) in daysOfWeek: ${invalidDays.join(', ')}. Days must be numbers 0-6` };
|
|
253
|
+
}
|
|
254
|
+
}
|
|
255
|
+
// Validate dayOfMonth if provided
|
|
256
|
+
if (frequency.dayOfMonth !== undefined) {
|
|
257
|
+
if (typeof frequency.dayOfMonth !== 'number' || frequency.dayOfMonth < 1 || frequency.dayOfMonth > 31) {
|
|
258
|
+
return { valid: false, reason: 'dayOfMonth must be a number between 1 and 31' };
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
// Validate weekOfMonth if provided
|
|
262
|
+
if (frequency.weekOfMonth !== undefined) {
|
|
263
|
+
if (!['first', 'second', 'third', 'fourth', 'last'].includes(frequency.weekOfMonth)) {
|
|
264
|
+
return { valid: false, reason: 'weekOfMonth must be one of: first, second, third, fourth, last' };
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
// Validate monthOfQuarter if provided
|
|
268
|
+
if (frequency.monthOfQuarter !== undefined) {
|
|
269
|
+
if (typeof frequency.monthOfQuarter !== 'number' || frequency.monthOfQuarter < 1 || frequency.monthOfQuarter > 3) {
|
|
270
|
+
return { valid: false, reason: 'monthOfQuarter must be 1, 2, or 3' };
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
// Validate interval if provided (legacy support)
|
|
274
|
+
if (frequency.interval !== undefined) {
|
|
275
|
+
if (typeof frequency.interval !== 'number' || frequency.interval < 1) {
|
|
276
|
+
return { valid: false, reason: 'interval must be a positive number' };
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
// Type-specific validations
|
|
280
|
+
switch (frequency.type) {
|
|
281
|
+
case 'quarterly':
|
|
282
|
+
// Quarterly doesn't support dayOfMonth (not implemented in transform logic)
|
|
283
|
+
if (frequency.dayOfMonth) {
|
|
284
|
+
return { valid: false, reason: 'dayOfMonth is not supported for quarterly patterns' };
|
|
285
|
+
}
|
|
286
|
+
break;
|
|
287
|
+
case 'biweekly':
|
|
288
|
+
// Biweekly doesn't use dayOfMonth or monthOfQuarter
|
|
289
|
+
if (frequency.dayOfMonth) {
|
|
290
|
+
return { valid: false, reason: 'dayOfMonth is not supported for biweekly patterns' };
|
|
291
|
+
}
|
|
292
|
+
if (frequency.monthOfQuarter) {
|
|
293
|
+
return { valid: false, reason: 'monthOfQuarter is not supported for biweekly patterns' };
|
|
294
|
+
}
|
|
295
|
+
// Biweekly only supports 'first' and 'second' week
|
|
296
|
+
if (frequency.weekOfMonth && !['first', 'second'].includes(frequency.weekOfMonth)) {
|
|
297
|
+
return { valid: false, reason: 'weekOfMonth for biweekly patterns must be "first" or "second"' };
|
|
298
|
+
}
|
|
299
|
+
break;
|
|
300
|
+
case 'daily':
|
|
301
|
+
case 'weekly':
|
|
302
|
+
// Daily/weekly don't use monthOfQuarter or weekOfMonth
|
|
303
|
+
if (frequency.monthOfQuarter) {
|
|
304
|
+
return { valid: false, reason: `monthOfQuarter is not supported for ${frequency.type} patterns` };
|
|
305
|
+
}
|
|
306
|
+
if (frequency.weekOfMonth) {
|
|
307
|
+
return { valid: false, reason: `weekOfMonth is not supported for ${frequency.type} patterns` };
|
|
308
|
+
}
|
|
309
|
+
break;
|
|
310
|
+
case 'monthly':
|
|
311
|
+
// Monthly doesn't use monthOfQuarter
|
|
312
|
+
if (frequency.monthOfQuarter) {
|
|
313
|
+
return { valid: false, reason: 'monthOfQuarter is not supported for monthly patterns' };
|
|
314
|
+
}
|
|
315
|
+
break;
|
|
316
|
+
}
|
|
317
|
+
return { valid: true };
|
|
318
|
+
}
|
|
319
|
+
/**
|
|
320
|
+
* Legacy boolean validation function for backward compatibility
|
|
321
|
+
* @deprecated Use validateFrequencyObject instead for detailed error information
|
|
322
|
+
*/
|
|
323
|
+
function isValidFrequencyObject(frequency) {
|
|
324
|
+
return validateFrequencyObject(frequency).valid;
|
|
325
|
+
}
|
|
326
|
+
//# sourceMappingURL=frequencyTransform.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"frequencyTransform.js","sourceRoot":"","sources":["../../src/utils/frequencyTransform.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAkCH,sEAyCC;AAmMD,0DAiGC;AAMD,wDAEC;AAnXD;;;GAGG;AACH,MAAM,iBAAiB,GAAG;IACxB,CAAC,EAAE,IAAI,EAAE,SAAS;IAClB,CAAC,EAAE,IAAI,EAAE,SAAS;IAClB,CAAC,EAAE,IAAI,EAAE,UAAU;IACnB,CAAC,EAAE,IAAI,EAAE,YAAY;IACrB,CAAC,EAAE,IAAI,EAAE,WAAW;IACpB,CAAC,EAAE,IAAI,EAAE,SAAS;IAClB,CAAC,EAAE,IAAI,CAAE,WAAW;CACZ,CAAC;AAEX;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,6BAA6B,CAAC,SAA0B;IACtE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,QAAQ,EAAE,aAAa,EAAE,GAAG,SAAS,CAAC;IAEzG,6BAA6B;IAC7B,IAAI,IAAI,KAAK,QAAQ,EAAE,CAAC;QACtB,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,iDAAiD,CAAC,CAAC;QACrE,CAAC;QACD,OAAO,aAAa,CAAC;IACvB,CAAC;IAED,0DAA0D;IAC1D,IAAI,IAAI,K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AM,EAAE,MAAM,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,aAAa,CAAC;AAG5B,cAAc,iBAAiB,CAAC;AAGhC,cAAc,oBAAoB,CAAC;AAGnC,cAAc,sBAAsB,CAAC;AAGrC,cAAc,kBAAkB,CAAC;AAGjC,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/utils/index.js
CHANGED
|
@@ -25,6 +25,8 @@ exports.mcpLog = exports.WorkspaceResolver = void 0;
|
|
|
25
25
|
__exportStar(require("./constants"), exports);
|
|
26
26
|
// Export error handling utilities
|
|
27
27
|
__exportStar(require("./errorHandling"), exports);
|
|
28
|
+
// Export user-facing error utilities
|
|
29
|
+
__exportStar(require("./userFacingErrors"), exports);
|
|
28
30
|
// Export response formatters
|
|
29
31
|
__exportStar(require("./responseFormatters"), exports);
|
|
30
32
|
// Export parameter utilities
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;AAEH,uBAAuB;AACvB,8CAA4B;AAE5B,kCAAkC;AAClC,kDAAgC;AAEhC,6BAA6B;AAC7B,uDAAqC;AAErC,6BAA6B;AAC7B,mDAAiC;AAEjC,2BAA2B;AAC3B,yDAAwD;AAA/C,sHAAA,iBAAiB,OAAA;AAE1B,gBAAgB;AAChB,mCAAkC;AAAzB,gGAAA,MAAM,OAAA"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;;AAEH,uBAAuB;AACvB,8CAA4B;AAE5B,kCAAkC;AAClC,kDAAgC;AAEhC,qCAAqC;AACrC,qDAAmC;AAEnC,6BAA6B;AAC7B,uDAAqC;AAErC,6BAA6B;AAC7B,mDAAiC;AAEjC,2BAA2B;AAC3B,yDAAwD;AAA/C,sHAAA,iBAAiB,OAAA;AAE1B,gBAAgB;AAChB,mCAAkC;AAAzB,gGAAA,MAAM,OAAA"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pagination Utilities - Shared pagination logic for Motion API calls
|
|
3
|
+
*
|
|
4
|
+
* Provides utilities to handle cursor-based and offset-based pagination
|
|
5
|
+
* consistently across all API endpoints.
|
|
6
|
+
*/
|
|
7
|
+
import { AxiosResponse } from 'axios';
|
|
8
|
+
export interface PaginatedResponse<T> {
|
|
9
|
+
items: T[];
|
|
10
|
+
nextCursor?: string;
|
|
11
|
+
hasMore: boolean;
|
|
12
|
+
totalFetched: number;
|
|
13
|
+
}
|
|
14
|
+
export interface PaginationMeta {
|
|
15
|
+
nextCursor?: string;
|
|
16
|
+
hasMore?: boolean;
|
|
17
|
+
total?: number;
|
|
18
|
+
page?: number;
|
|
19
|
+
limit?: number;
|
|
20
|
+
}
|
|
21
|
+
export interface CursorPaginationOptions {
|
|
22
|
+
maxPages?: number;
|
|
23
|
+
pageSize?: number;
|
|
24
|
+
logProgress?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export interface PaginatedApiResponse<T> {
|
|
27
|
+
meta?: PaginationMeta;
|
|
28
|
+
items?: T[];
|
|
29
|
+
tasks?: T[];
|
|
30
|
+
projects?: T[];
|
|
31
|
+
users?: T[];
|
|
32
|
+
comments?: T[];
|
|
33
|
+
customFields?: T[];
|
|
34
|
+
recurringTasks?: T[];
|
|
35
|
+
schedules?: T[];
|
|
36
|
+
statuses?: T[];
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Generic cursor-based pagination handler
|
|
40
|
+
* Automatically fetches all pages or up to maxPages limit
|
|
41
|
+
*/
|
|
42
|
+
export declare function fetchAllPages<T>(fetchPage: (cursor?: string) => Promise<AxiosResponse<PaginatedApiResponse<T>>>, options?: CursorPaginationOptions): Promise<PaginatedResponse<T>>;
|
|
43
|
+
/**
|
|
44
|
+
* Simple pagination for APIs that might not have explicit pagination
|
|
45
|
+
* but could benefit from batching large requests
|
|
46
|
+
*/
|
|
47
|
+
export interface BatchOptions {
|
|
48
|
+
batchSize?: number;
|
|
49
|
+
maxBatches?: number;
|
|
50
|
+
delayMs?: number;
|
|
51
|
+
}
|
|
52
|
+
export declare function fetchInBatches<T, TParams>(fetchBatch: (params: TParams, offset: number, limit: number) => Promise<T[]>, params: TParams, options?: BatchOptions): Promise<T[]>;
|
|
53
|
+
/**
|
|
54
|
+
* Check if a response indicates more pages are available
|
|
55
|
+
*/
|
|
56
|
+
export declare function hasMorePages<T>(response: PaginatedApiResponse<T>): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Get pagination info from response
|
|
59
|
+
*/
|
|
60
|
+
export declare function getPaginationInfo<T>(response: PaginatedApiResponse<T>): PaginationMeta | null;
|
|
61
|
+
//# sourceMappingURL=pagination.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.d.ts","sourceRoot":"","sources":["../../src/utils/pagination.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAItC,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE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AE,YAAiB,GACzB,OAAO,CAAC,CAAC,EAAE,CAAC,CAuCd;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,CAAC,EAAE,QAAQ,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,OAAO,CAE1E;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,QAAQ,EAAE,oBAAoB,CAAC,CAAC,CAAC,GAAG,cAAc,GAAG,IAAI,CAE7F"}
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Pagination Utilities - Shared pagination logic for Motion API calls
|
|
4
|
+
*
|
|
5
|
+
* Provides utilities to handle cursor-based and offset-based pagination
|
|
6
|
+
* consistently across all API endpoints.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.fetchAllPages = fetchAllPages;
|
|
10
|
+
exports.fetchInBatches = fetchInBatches;
|
|
11
|
+
exports.hasMorePages = hasMorePages;
|
|
12
|
+
exports.getPaginationInfo = getPaginationInfo;
|
|
13
|
+
const logger_1 = require("./logger");
|
|
14
|
+
const constants_1 = require("./constants");
|
|
15
|
+
/**
|
|
16
|
+
* Generic cursor-based pagination handler
|
|
17
|
+
* Automatically fetches all pages or up to maxPages limit
|
|
18
|
+
*/
|
|
19
|
+
async function fetchAllPages(fetchPage, options = {}) {
|
|
20
|
+
const { maxPages = 10, logProgress = true } = options;
|
|
21
|
+
let allItems = [];
|
|
22
|
+
let cursor;
|
|
23
|
+
let pageCount = 0;
|
|
24
|
+
let hasMore = true;
|
|
25
|
+
// Infinite loop protection - ensure we never fetch more than absolute max pages
|
|
26
|
+
const absoluteMaxPages = Math.min(maxPages, 50); // Hard limit to prevent infinite loops
|
|
27
|
+
while (hasMore && pageCount < absoluteMaxPages) {
|
|
28
|
+
try {
|
|
29
|
+
if (logProgress && pageCount > 0) {
|
|
30
|
+
(0, logger_1.mcpLog)(constants_1.LOG_LEVELS.DEBUG, `Fetching page ${pageCount + 1}`, { cursor });
|
|
31
|
+
}
|
|
32
|
+
const response = await fetchPage(cursor);
|
|
33
|
+
const data = response.data;
|
|
34
|
+
// Extract items from various possible response structures
|
|
35
|
+
const pageItems = extractItemsFromResponse(data);
|
|
36
|
+
// Enforce page size limit to prevent memory exhaustion
|
|
37
|
+
if (pageItems.length > constants_1.LIMITS.MAX_PAGE_SIZE) {
|
|
38
|
+
(0, logger_1.mcpLog)(constants_1.LOG_LEVELS.WARN, `Page size ${pageItems.length} exceeds maximum allowed ${constants_1.LIMITS.MAX_PAGE_SIZE}, truncating`, {
|
|
39
|
+
pageNumber: pageCount + 1,
|
|
40
|
+
originalSize: pageItems.length,
|
|
41
|
+
truncatedSize: constants_1.LIMITS.MAX_PAGE_SIZE
|
|
42
|
+
});
|
|
43
|
+
pageItems.splice(constants_1.LIMITS.MAX_PAGE_SIZE); // Truncate to limit
|
|
44
|
+
}
|
|
45
|
+
allItems = allItems.concat(pageItems);
|
|
46
|
+
// Update pagination state
|
|
47
|
+
const newCursor = data.meta?.nextCursor;
|
|
48
|
+
// Infinite loop protection: If cursor doesn't change, break
|
|
49
|
+
if (cursor && newCursor === cursor) {
|
|
50
|
+
(0, logger_1.mcpLog)(constants_1.LOG_LEVELS.WARN, 'Pagination cursor not advancing - breaking to prevent infinite loop', {
|
|
51
|
+
cursor,
|
|
52
|
+
pageCount,
|
|
53
|
+
itemsCount: pageItems.length
|
|
54
|
+
});
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
cursor = newCursor;
|
|
58
|
+
hasMore = !!cursor && pageItems.length > 0;
|
|
59
|
+
pageCount++;
|
|
60
|
+
if (logProgress) {
|
|
61
|
+
(0, logger_1.mcpLog)(constants_1.LOG_LEVELS.DEBUG, `Page ${pageCount} fetched`, {
|
|
62
|
+
pageItems: pageItems.length,
|
|
63
|
+
totalItems: allItems.length,
|
|
64
|
+
hasMore,
|
|
65
|
+
nextCursor: cursor
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
catch (error) {
|
|
70
|
+
(0, logger_1.mcpLog)(constants_1.LOG_LEVELS.ERROR, `Pagination failed on page ${pageCount + 1}`, {
|
|
71
|
+
error: error instanceof Error ? error.message : String(error),
|
|
72
|
+
cursor
|
|
73
|
+
});
|
|
74
|
+
// Return what we have so far
|
|
75
|
+
break;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
if (pageCount >= absoluteMaxPages && hasMore) {
|
|
79
|
+
(0, logger_1.mcpLog)(constants_1.LOG_LEVELS.WARN, `Reached maximum page limit (${absoluteMaxPages})`, {
|
|
80
|
+
totalFetched: allItems.length,
|
|
81
|
+
finalCursor: cursor
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
return {
|
|
85
|
+
items: allItems,
|
|
86
|
+
nextCursor: cursor,
|
|
87
|
+
hasMore,
|
|
88
|
+
totalFetched: allItems.length
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Extract items from various API response structures
|
|
93
|
+
* Handles the different ways Motion API can structure responses
|
|
94
|
+
*/
|
|
95
|
+
function extractItemsFromResponse(data) {
|
|
96
|
+
// Try different possible array locations
|
|
97
|
+
if (data.tasks && Array.isArray(data.tasks))
|
|
98
|
+
return data.tasks;
|
|
99
|
+
if (data.projects && Array.isArray(data.projects))
|
|
100
|
+
return data.projects;
|
|
101
|
+
if (data.users && Array.isArray(data.users))
|
|
102
|
+
return data.users;
|
|
103
|
+
if (data.comments && Array.isArray(data.comments))
|
|
104
|
+
return data.comments;
|
|
105
|
+
if (data.customFields && Array.isArray(data.customFields))
|
|
106
|
+
return data.customFields;
|
|
107
|
+
if (data.recurringTasks && Array.isArray(data.recurringTasks))
|
|
108
|
+
return data.recurringTasks;
|
|
109
|
+
if (data.schedules && Array.isArray(data.schedules))
|
|
110
|
+
return data.schedules;
|
|
111
|
+
if (data.statuses && Array.isArray(data.statuses))
|
|
112
|
+
return data.statuses;
|
|
113
|
+
if (data.items && Array.isArray(data.items))
|
|
114
|
+
return data.items;
|
|
115
|
+
// Fallback: if data itself is an array
|
|
116
|
+
if (Array.isArray(data))
|
|
117
|
+
return data;
|
|
118
|
+
// No items found
|
|
119
|
+
return [];
|
|
120
|
+
}
|
|
121
|
+
async function fetchInBatches(fetchBatch, params, options = {}) {
|
|
122
|
+
const { batchSize = 100, maxBatches = 10, delayMs = 100 } = options;
|
|
123
|
+
let allItems = [];
|
|
124
|
+
let offset = 0;
|
|
125
|
+
let batchCount = 0;
|
|
126
|
+
let hasMore = true;
|
|
127
|
+
while (hasMore && batchCount < maxBatches) {
|
|
128
|
+
try {
|
|
129
|
+
const batchItems = await fetchBatch(params, offset, batchSize);
|
|
130
|
+
if (batchItems.length === 0) {
|
|
131
|
+
hasMore = false;
|
|
132
|
+
}
|
|
133
|
+
else {
|
|
134
|
+
allItems = allItems.concat(batchItems);
|
|
135
|
+
offset += batchSize;
|
|
136
|
+
batchCount++;
|
|
137
|
+
// Small delay to be API-friendly
|
|
138
|
+
if (delayMs > 0 && hasMore) {
|
|
139
|
+
await new Promise(resolve => setTimeout(resolve, delayMs));
|
|
140
|
+
}
|
|
141
|
+
// If we got fewer items than batch size, we've reached the end
|
|
142
|
+
if (batchItems.length < batchSize) {
|
|
143
|
+
hasMore = false;
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
catch (error) {
|
|
148
|
+
(0, logger_1.mcpLog)(constants_1.LOG_LEVELS.ERROR, `Batch fetch failed at offset ${offset}`, {
|
|
149
|
+
error: error instanceof Error ? error.message : String(error)
|
|
150
|
+
});
|
|
151
|
+
break;
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return allItems;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Check if a response indicates more pages are available
|
|
158
|
+
*/
|
|
159
|
+
function hasMorePages(response) {
|
|
160
|
+
return !!(response.meta?.nextCursor || response.meta?.hasMore);
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Get pagination info from response
|
|
164
|
+
*/
|
|
165
|
+
function getPaginationInfo(response) {
|
|
166
|
+
return response.meta || null;
|
|
167
|
+
}
|
|
168
|
+
//# sourceMappingURL=pagination.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pagination.js","sourceRoot":"","sources":["../../src/utils/pagination.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;AA4CH,sCAwFC;AAmCD,wCA2CC;AAKD,oCAEC;AAKD,8CAEC;AA7ND,qCAAkC;AAClC,2CAAiD;AAoCjD;;;GAGG;AACI,KAAK,UAAU,aAAa,CACjC,SAA+E,EAC/E,UAAmC,EAAE;IAErC,MAAM,EAAE,QAAQ,GAAG,EAAE,EAAE,WAAW,GAAG,IAAI,EAAE,GAAG,OAAO,CAAC;IAEtD,IAAI,QAAQ,GAAQ,EAAE,CAAC;IACvB,IAAI,MAA0B,CAAC;IAC/B,IAAI,SAAS,GAAG,CAAC,CAAC;IAClB,IAAI,OAAO,GAAG,IAAI,CAAC;IAEnB,gFAAgF;IAChF,MAAM,gBAAgB,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,CAAC,uCAAuC;IAExF,OAAO,OAAO,IAAI,SAAS,GAAG,gBAAgB,EAAE,CAAC;QAC/C,IAAI,CAAC;YACH,IAAI,WAAW,IAAI,SAAS,GAAG,CAAC,EAAE,CAAC;gBACjC,IAAA,eAAM,EAAC,sBAAU,CAAC,KAAK,EAAE,iBAAiB,SAAS,GAAG,CAAC,EAAE,EAAE,EAAE,MAAM,EAAE,CAAC,CAAC;YACzE,CAAC;YAED,MAAM,QAAQ,GAAG,MAAM,SAAS,CAAC,MAAM,CAAC,CAAC;YACzC,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,CAAC;YAE3B,0DAA0D;YAC1D,MAAM,SAAS,GAAG,wBAAwB,CAAC,IAAI,CAAC,CAAC;YA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CAAC;gBAC5B,OAAO,GAAG,KAAK,CAAC;YAClB,CAAC;iBAAM,CAAC;gBACN,QAAQ,GAAG,QAAQ,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC;gBACvC,MAAM,IAAI,SAAS,CAAC;gBACpB,UAAU,EAAE,CAAC;gBAEb,iCAAiC;gBACjC,IAAI,OAAO,GAAG,CAAC,IAAI,OAAO,EAAE,CAAC;oBAC3B,MAAM,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;gBAC7D,CAAC;gBAED,+DAA+D;gBAC/D,IAAI,UAAU,CAAC,MAAM,GAAG,SAAS,EAAE,CAAC;oBAClC,OAAO,GAAG,KAAK,CAAC;gBAClB,CAAC;YACH,CAAC;QAEH,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAA,eAAM,EAAC,sBAAU,CAAC,KAAK,EAAE,gCAAgC,MAAM,EAAE,EAAE;gBACjE,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC;aAC9D,CAAC,CAAC;YACH,MAAM;QACR,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC;AAED;;GAEG;AACH,SAAgB,YAAY,CAAI,QAAiC;IAC/D,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,IAAI,EAAE,UAAU,IAAI,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AACjE,CAAC;AAED;;GAEG;AACH,SAAgB,iBAAiB,CAAI,QAAiC;IACpE,OAAO,QAAQ,CAAC,IAAI,IAAI,IAAI,CAAC;AAC/B,CAAC"}
|
|
@@ -41,4 +41,18 @@ export declare function fetchSinglePage<T>(fetchPage: (cursor?: string) => Promi
|
|
|
41
41
|
*/
|
|
42
42
|
export declare function endpointSupportsPagination(apiEndpoint: string): boolean;
|
|
43
43
|
export { UnwrappedResponse } from './responseWrapper';
|
|
44
|
+
/**
|
|
45
|
+
* Calculate adaptive fetch limit for search operations with overfetching.
|
|
46
|
+
*
|
|
47
|
+
* Used when fetching items that will be filtered client-side. The overfetch
|
|
48
|
+
* multiplier (typically 3x) compensates for filtered results, reducing the
|
|
49
|
+
* number of API calls needed while avoiding excessive memory usage.
|
|
50
|
+
*
|
|
51
|
+
* @param currentCount - Number of items already collected
|
|
52
|
+
* @param targetLimit - Maximum items the caller wants
|
|
53
|
+
* @param overfetchMultiplier - How much to overfetch (default 3x based on typical filter ratios)
|
|
54
|
+
* @param maxFetchLimit - Absolute maximum for a single fetch (prevents resource exhaustion)
|
|
55
|
+
* @returns Number of items to request, or 0 if target already reached
|
|
56
|
+
*/
|
|
57
|
+
export declare function calculateAdaptiveFetchLimit(currentCount: number, targetLimit: number, overfetchMultiplier?: number, maxFetchLimit?: number): number;
|
|
44
58
|
//# sourceMappingURL=paginationNew.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paginationNew.d.ts","sourceRoot":"","sources":["../../src/utils/paginationNew.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGtC,OAAO,EAAyC,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAG7F,MAAM,WAAW,iBAAiB,CAAC,CAAC;IAClC,KAAK,EAAE,CAAC,EAAE,CAAC;IACX,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,OAAO,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;;;;GAOG;AACH,wBAAsB,aAAa,CA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