@@ -13,12 +13,16 @@ const ROW_HEADER_INDEX = 1
13
13
const COLUMN_START_INDEX = 1 /** データ列の開始インデックス */
14
14
const ROW_START_INDEX = 2 /** データ行の開始インデックス */
15
15
const DEFAULT_COLUMN_LENGTH = 16
16
+ const MAX_LIST_ITEM_COUNT = 500
16
17
17
18
type Validation < A > = ( a : A , onError : Error ) => Either < Error , A >
18
19
19
20
const isEmpty : Validation < string > = ( str : string , onError : Error ) : Either < Error , string > =>
20
21
str !== "" ? Right ( str ) : Left ( onError )
21
22
23
+ const slice = < A > ( items : A [ ] ) : A [ ] =>
24
+ items . slice ( 0 , MAX_LIST_ITEM_COUNT - 1 )
25
+
22
26
const createBacklogClient = ( space : string , domain : string , apiKey : string , locale : Locale ) : Either < Error , BacklogClient > => {
23
27
const spaceResult = isEmpty ( space , Error ( Message . SPACE_URL_REQUIRED ( locale ) ) )
24
28
const apiKeyResult = isEmpty ( apiKey , Error ( Message . API_KEY_REQUIRED ( locale ) ) )
@@ -289,16 +293,16 @@ export const BacklogService = (spreadSheetService: SpreadSheetService): BacklogS
289
293
showMessage ( Message . PROGRESS_INIT_BEGIN ( locale ) , spreadSheetService )
290
294
return createBacklogClient ( property . space , property . domain , property . apiKey , locale )
291
295
. flatMap ( client =>
292
- getProject ( client , property . projectKey , locale ) . map ( project =>
293
- BacklogDefinition (
294
- client . getIssueTypesV2 ( project . id ) ,
295
- client . getCategoriesV2 ( project . id ) ,
296
- client . getVersionsV2 ( project . id ) ,
297
- client . getPrioritiesV2 ( ) ,
298
- client . getUsersV2 ( project . id ) ,
299
- client . getCustomFieldsV2 ( project . id )
300
- )
301
- )
296
+ getProject ( client , property . projectKey , locale ) . map ( project => {
297
+ const issueTypes = client . getIssueTypesV2 ( project . id )
298
+ const categories = client . getCategoriesV2 ( project . id )
299
+ const versions = client . getVersionsV2 ( project . id )
300
+ const priorities = client . getPrioritiesV2 ( )
301
+ const users = client . getUsersV2 ( project . id )
302
+ const customFields = client . getCustomFieldsV2 ( project . id )
303
+
304
+ return BacklogDefinition ( slice ( issueTypes ) , slice ( categories ) , slice ( versions ) , slice ( priorities ) , slice ( users ) , customFields )
305
+ } )
302
306
)
303
307
. map ( definition => {
304
308
const issueTypeRule = SpreadsheetApp . newDataValidation ( ) . requireValueInList ( definition . issueTypeNames ( ) , true ) . build ( )
0 commit comments