@dereekb/trello 13.11.14 → 13.11.15
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/index.cjs.js +102 -98
- package/index.esm.js +102 -98
- package/nestjs/index.cjs.js +28 -16
- package/nestjs/index.esm.js +28 -16
- package/nestjs/package.json +5 -5
- package/nestjs/src/lib/trello/trello.module.d.ts +2 -2
- package/nestjs/src/lib/webhook/webhook.trello.d.ts +1 -1
- package/nestjs/src/lib/webhook/webhook.trello.module.d.ts +1 -1
- package/nestjs/src/lib/webhook/webhook.trello.verify.d.ts +6 -6
- package/package.json +4 -4
- package/src/lib/trello/trello.api.board.d.ts +24 -24
- package/src/lib/trello/trello.api.board.type.d.ts +4 -2
- package/src/lib/trello/trello.api.card.d.ts +30 -26
- package/src/lib/trello/trello.api.list.d.ts +12 -12
- package/src/lib/trello/trello.api.member.d.ts +6 -7
- package/src/lib/trello/trello.api.webhook.d.ts +14 -14
- package/src/lib/trello/trello.factory.d.ts +2 -1
- package/src/lib/trello.api.page.d.ts +9 -7
- package/src/lib/trello.config.d.ts +2 -2
- package/src/lib/trello.error.api.d.ts +7 -5
- package/src/lib/trello.limit.d.ts +2 -1
package/index.esm.js
CHANGED
|
@@ -296,8 +296,9 @@ function _ts_generator$3(thisArg, body) {
|
|
|
296
296
|
/**
|
|
297
297
|
* Creates a logTrelloServerErrorFunction that logs the error to console.
|
|
298
298
|
*
|
|
299
|
-
* @param trelloApiNamePrefix Prefix to use when logging.
|
|
300
|
-
* @returns
|
|
299
|
+
* @param trelloApiNamePrefix - Prefix to use when logging.
|
|
300
|
+
* @returns Logs Trello server errors to the console.
|
|
301
|
+
*
|
|
301
302
|
* @__NO_SIDE_EFFECTS__
|
|
302
303
|
*/ function logTrelloServerErrorFunction(trelloApiNamePrefix) {
|
|
303
304
|
return function(error) {
|
|
@@ -321,7 +322,7 @@ var logTrelloErrorToConsole = logTrelloServerErrorFunction('Trello');
|
|
|
321
322
|
/**
|
|
322
323
|
* Parses a FetchResponseError into a typed Trello API error.
|
|
323
324
|
*
|
|
324
|
-
* @param responseError The fetch response error to parse.
|
|
325
|
+
* @param responseError - The fetch response error to parse.
|
|
325
326
|
* @returns A typed Trello error, or undefined if the response could not be parsed.
|
|
326
327
|
*/ function parseTrelloApiError(responseError) {
|
|
327
328
|
return _async_to_generator$3(function() {
|
|
@@ -371,9 +372,10 @@ var logTrelloErrorToConsole = logTrelloServerErrorFunction('Trello');
|
|
|
371
372
|
/**
|
|
372
373
|
* Wraps a ConfiguredFetch to translate FetchResponseError into typed Trello errors.
|
|
373
374
|
*
|
|
374
|
-
* @param fetch The fetch to wrap.
|
|
375
|
-
* @param logError Optional logger.
|
|
375
|
+
* @param fetch - The fetch to wrap.
|
|
376
|
+
* @param logError - Optional logger.
|
|
376
377
|
* @returns A ConfiguredFetch that throws typed Trello errors for known error responses.
|
|
378
|
+
*
|
|
377
379
|
* @__NO_SIDE_EFFECTS__
|
|
378
380
|
*/ function handleTrelloErrorFetch(fetch) {
|
|
379
381
|
var logError = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : logTrelloErrorToConsole;
|
|
@@ -440,8 +442,9 @@ var logTrelloErrorToConsole = logTrelloServerErrorFunction('Trello');
|
|
|
440
442
|
*
|
|
441
443
|
* Backs off after 429 responses and respects the documented per-token rate limit.
|
|
442
444
|
*
|
|
443
|
-
* @param config Optional configuration for rate limiting behavior.
|
|
445
|
+
* @param config - Optional configuration for rate limiting behavior.
|
|
444
446
|
* @returns A configured rate-limited fetch handler.
|
|
447
|
+
*
|
|
445
448
|
* @__NO_SIDE_EFFECTS__
|
|
446
449
|
*/ function trelloRateLimitedFetchHandler(config) {
|
|
447
450
|
var _ref, _ref1;
|
|
@@ -460,10 +463,7 @@ var logTrelloErrorToConsole = logTrelloServerErrorFunction('Trello');
|
|
|
460
463
|
updateWithResponse: function updateWithResponse(response) {
|
|
461
464
|
// Trello does not document rate limit headers, but it does return 429 when exceeded.
|
|
462
465
|
// Schedule a retry after the rate limiter cooldown when a 429 is observed.
|
|
463
|
-
|
|
464
|
-
return true;
|
|
465
|
-
}
|
|
466
|
-
return false;
|
|
466
|
+
return response.status === 429;
|
|
467
467
|
}
|
|
468
468
|
});
|
|
469
469
|
}
|
|
@@ -477,8 +477,9 @@ var logTrelloErrorToConsole = logTrelloServerErrorFunction('Trello');
|
|
|
477
477
|
*
|
|
478
478
|
* Auth uses Trello's `Authorization: OAuth oauth_consumer_key=..., oauth_token=...` header form so credentials never appear in URLs or logs.
|
|
479
479
|
*
|
|
480
|
-
* @param factoryConfig Factory-level configuration shared across created Trello instances.
|
|
480
|
+
* @param factoryConfig - Factory-level configuration shared across created Trello instances.
|
|
481
481
|
* @returns A factory function that creates a configured Trello API instance.
|
|
482
|
+
*
|
|
482
483
|
* @__NO_SIDE_EFFECTS__
|
|
483
484
|
*/ function trelloFactory() {
|
|
484
485
|
var factoryConfig = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : {};
|
|
@@ -684,20 +685,20 @@ function _ts_generator$2(thisArg, body) {
|
|
|
684
685
|
}
|
|
685
686
|
}
|
|
686
687
|
/**
|
|
687
|
-
*
|
|
688
|
+
* Https://developer.atlassian.com/cloud/trello/rest/api-group-boards/#api-boards-id-get.
|
|
688
689
|
*
|
|
689
|
-
* @param context The Trello API context.
|
|
690
|
-
* @returns
|
|
690
|
+
* @param context - The Trello API context.
|
|
691
|
+
* @returns Retrieves a board by id.
|
|
691
692
|
*/ function getBoard(context) {
|
|
692
693
|
return function(input) {
|
|
693
694
|
return context.fetchJson("/boards/".concat(input.boardId), 'GET');
|
|
694
695
|
};
|
|
695
696
|
}
|
|
696
697
|
/**
|
|
697
|
-
*
|
|
698
|
+
* Https://developer.atlassian.com/cloud/trello/rest/api-group-boards/#api-boards-post.
|
|
698
699
|
*
|
|
699
|
-
* @param context The Trello API context.
|
|
700
|
-
* @returns
|
|
700
|
+
* @param context - The Trello API context.
|
|
701
|
+
* @returns Creates a new board.
|
|
701
702
|
*/ function createBoard(context) {
|
|
702
703
|
return function(input) {
|
|
703
704
|
var queryString = makeUrlSearchParams(input);
|
|
@@ -705,10 +706,10 @@ function _ts_generator$2(thisArg, body) {
|
|
|
705
706
|
};
|
|
706
707
|
}
|
|
707
708
|
/**
|
|
708
|
-
*
|
|
709
|
+
* Https://developer.atlassian.com/cloud/trello/rest/api-group-boards/#api-boards-id-put.
|
|
709
710
|
*
|
|
710
|
-
* @param context The Trello API context.
|
|
711
|
-
* @returns
|
|
711
|
+
* @param context - The Trello API context.
|
|
712
|
+
* @returns Updates an existing board.
|
|
712
713
|
*/ function updateBoard(context) {
|
|
713
714
|
return function(input) {
|
|
714
715
|
var boardId = input.boardId, body = _object_without_properties$3(input, [
|
|
@@ -718,10 +719,10 @@ function _ts_generator$2(thisArg, body) {
|
|
|
718
719
|
};
|
|
719
720
|
}
|
|
720
721
|
/**
|
|
721
|
-
*
|
|
722
|
+
* Https://developer.atlassian.com/cloud/trello/rest/api-group-boards/#api-boards-id-delete.
|
|
722
723
|
*
|
|
723
|
-
* @param context The Trello API context.
|
|
724
|
-
* @returns
|
|
724
|
+
* @param context - The Trello API context.
|
|
725
|
+
* @returns Deletes a board.
|
|
725
726
|
*/ function deleteBoard(context) {
|
|
726
727
|
return function(input) {
|
|
727
728
|
return _async_to_generator$2(function() {
|
|
@@ -743,10 +744,10 @@ function _ts_generator$2(thisArg, body) {
|
|
|
743
744
|
};
|
|
744
745
|
}
|
|
745
746
|
/**
|
|
746
|
-
*
|
|
747
|
+
* Https://developer.atlassian.com/cloud/trello/rest/api-group-boards/#api-boards-id-lists-get.
|
|
747
748
|
*
|
|
748
|
-
* @param context The Trello API context.
|
|
749
|
-
* @returns
|
|
749
|
+
* @param context - The Trello API context.
|
|
750
|
+
* @returns Lists all lists on a board.
|
|
750
751
|
*/ function listBoardLists(context) {
|
|
751
752
|
return function(input) {
|
|
752
753
|
var boardId = input.boardId, query = _object_without_properties$3(input, [
|
|
@@ -757,10 +758,10 @@ function _ts_generator$2(thisArg, body) {
|
|
|
757
758
|
};
|
|
758
759
|
}
|
|
759
760
|
/**
|
|
760
|
-
*
|
|
761
|
+
* Https://developer.atlassian.com/cloud/trello/rest/api-group-boards/#api-boards-id-cards-get.
|
|
761
762
|
*
|
|
762
|
-
* @param context The Trello API context.
|
|
763
|
-
* @returns
|
|
763
|
+
* @param context - The Trello API context.
|
|
764
|
+
* @returns Lists all cards on a board.
|
|
764
765
|
*/ function listBoardCards(context) {
|
|
765
766
|
return function(input) {
|
|
766
767
|
var boardId = input.boardId, query = _object_without_properties$3(input, [
|
|
@@ -771,10 +772,10 @@ function _ts_generator$2(thisArg, body) {
|
|
|
771
772
|
};
|
|
772
773
|
}
|
|
773
774
|
/**
|
|
774
|
-
*
|
|
775
|
+
* Https://developer.atlassian.com/cloud/trello/rest/api-group-boards/#api-boards-id-labels-get.
|
|
775
776
|
*
|
|
776
|
-
* @param context The Trello API context.
|
|
777
|
-
* @returns
|
|
777
|
+
* @param context - The Trello API context.
|
|
778
|
+
* @returns Lists every label defined on a board.
|
|
778
779
|
*/ function listBoardLabels(context) {
|
|
779
780
|
return function(input) {
|
|
780
781
|
var boardId = input.boardId, query = _object_without_properties$3(input, [
|
|
@@ -785,10 +786,10 @@ function _ts_generator$2(thisArg, body) {
|
|
|
785
786
|
};
|
|
786
787
|
}
|
|
787
788
|
/**
|
|
788
|
-
*
|
|
789
|
+
* Https://developer.atlassian.com/cloud/trello/rest/api-group-boards/#api-boards-id-members-get.
|
|
789
790
|
*
|
|
790
|
-
* @param context The Trello API context.
|
|
791
|
-
* @returns
|
|
791
|
+
* @param context - The Trello API context.
|
|
792
|
+
* @returns Lists all members of a board.
|
|
792
793
|
*/ function listBoardMembers(context) {
|
|
793
794
|
return function(input) {
|
|
794
795
|
return context.fetchJson("/boards/".concat(input.boardId, "/members"), 'GET');
|
|
@@ -832,20 +833,20 @@ function _object_without_properties_loose$2(source, excluded) {
|
|
|
832
833
|
return target;
|
|
833
834
|
}
|
|
834
835
|
/**
|
|
835
|
-
*
|
|
836
|
+
* Https://developer.atlassian.com/cloud/trello/rest/api-group-lists/#api-lists-id-get.
|
|
836
837
|
*
|
|
837
|
-
* @param context The Trello API context.
|
|
838
|
-
* @returns
|
|
838
|
+
* @param context - The Trello API context.
|
|
839
|
+
* @returns Retrieves a list by id.
|
|
839
840
|
*/ function getList(context) {
|
|
840
841
|
return function(input) {
|
|
841
842
|
return context.fetchJson("/lists/".concat(input.listId), 'GET');
|
|
842
843
|
};
|
|
843
844
|
}
|
|
844
845
|
/**
|
|
845
|
-
*
|
|
846
|
+
* Https://developer.atlassian.com/cloud/trello/rest/api-group-lists/#api-lists-post.
|
|
846
847
|
*
|
|
847
|
-
* @param context The Trello API context.
|
|
848
|
-
* @returns
|
|
848
|
+
* @param context - The Trello API context.
|
|
849
|
+
* @returns Creates a new list on a board.
|
|
849
850
|
*/ function createList(context) {
|
|
850
851
|
return function(input) {
|
|
851
852
|
var queryString = makeUrlSearchParams(input);
|
|
@@ -853,10 +854,10 @@ function _object_without_properties_loose$2(source, excluded) {
|
|
|
853
854
|
};
|
|
854
855
|
}
|
|
855
856
|
/**
|
|
856
|
-
*
|
|
857
|
+
* Https://developer.atlassian.com/cloud/trello/rest/api-group-lists/#api-lists-id-put.
|
|
857
858
|
*
|
|
858
|
-
* @param context The Trello API context.
|
|
859
|
-
* @returns
|
|
859
|
+
* @param context - The Trello API context.
|
|
860
|
+
* @returns Updates an existing list.
|
|
860
861
|
*/ function updateList(context) {
|
|
861
862
|
return function(input) {
|
|
862
863
|
var listId = input.listId, body = _object_without_properties$2(input, [
|
|
@@ -866,10 +867,10 @@ function _object_without_properties_loose$2(source, excluded) {
|
|
|
866
867
|
};
|
|
867
868
|
}
|
|
868
869
|
/**
|
|
869
|
-
*
|
|
870
|
+
* Https://developer.atlassian.com/cloud/trello/rest/api-group-lists/#api-lists-id-cards-get.
|
|
870
871
|
*
|
|
871
|
-
* @param context The Trello API context.
|
|
872
|
-
* @returns
|
|
872
|
+
* @param context - The Trello API context.
|
|
873
|
+
* @returns Lists all cards on a list.
|
|
873
874
|
*/ function listCardsInList(context) {
|
|
874
875
|
return function(input) {
|
|
875
876
|
var listId = input.listId, query = _object_without_properties$2(input, [
|
|
@@ -1073,20 +1074,20 @@ function _ts_generator$1(thisArg, body) {
|
|
|
1073
1074
|
}
|
|
1074
1075
|
}
|
|
1075
1076
|
/**
|
|
1076
|
-
*
|
|
1077
|
+
* Https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-get.
|
|
1077
1078
|
*
|
|
1078
|
-
* @param context The Trello API context.
|
|
1079
|
-
* @returns
|
|
1079
|
+
* @param context - The Trello API context.
|
|
1080
|
+
* @returns Retrieves a card by id.
|
|
1080
1081
|
*/ function getCard(context) {
|
|
1081
1082
|
return function(input) {
|
|
1082
1083
|
return context.fetchJson("/cards/".concat(input.cardId), 'GET');
|
|
1083
1084
|
};
|
|
1084
1085
|
}
|
|
1085
1086
|
/**
|
|
1086
|
-
*
|
|
1087
|
+
* Https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-post.
|
|
1087
1088
|
*
|
|
1088
|
-
* @param context The Trello API context.
|
|
1089
|
-
* @returns
|
|
1089
|
+
* @param context - The Trello API context.
|
|
1090
|
+
* @returns Creates a card on a list.
|
|
1090
1091
|
*/ function createCard(context) {
|
|
1091
1092
|
return function(input) {
|
|
1092
1093
|
var idLabels = input.idLabels, idMembers = input.idMembers, rest = _object_without_properties$1(input, [
|
|
@@ -1105,10 +1106,10 @@ function _ts_generator$1(thisArg, body) {
|
|
|
1105
1106
|
};
|
|
1106
1107
|
}
|
|
1107
1108
|
/**
|
|
1108
|
-
*
|
|
1109
|
+
* Https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-put.
|
|
1109
1110
|
*
|
|
1110
|
-
* @param context The Trello API context.
|
|
1111
|
-
* @returns
|
|
1111
|
+
* @param context - The Trello API context.
|
|
1112
|
+
* @returns Updates an existing card.
|
|
1112
1113
|
*/ function updateCard(context) {
|
|
1113
1114
|
return function(input) {
|
|
1114
1115
|
var cardId = input.cardId, idLabels = input.idLabels, idMembers = input.idMembers, rest = _object_without_properties$1(input, [
|
|
@@ -1127,10 +1128,10 @@ function _ts_generator$1(thisArg, body) {
|
|
|
1127
1128
|
};
|
|
1128
1129
|
}
|
|
1129
1130
|
/**
|
|
1130
|
-
*
|
|
1131
|
+
* Https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-delete.
|
|
1131
1132
|
*
|
|
1132
|
-
* @param context The Trello API context.
|
|
1133
|
-
* @returns
|
|
1133
|
+
* @param context - The Trello API context.
|
|
1134
|
+
* @returns Deletes a card.
|
|
1134
1135
|
*/ function deleteCard(context) {
|
|
1135
1136
|
return function(input) {
|
|
1136
1137
|
return _async_to_generator$1(function() {
|
|
@@ -1152,13 +1153,13 @@ function _ts_generator$1(thisArg, body) {
|
|
|
1152
1153
|
};
|
|
1153
1154
|
}
|
|
1154
1155
|
/**
|
|
1155
|
-
*
|
|
1156
|
+
* Https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-actions-get.
|
|
1156
1157
|
*
|
|
1157
1158
|
* Comments are returned as actions with `type === 'commentCard'`; pass `filter: 'commentCard'` and the generic
|
|
1158
1159
|
* type parameter `TrelloCommentCardActionData` to get a comment-typed result.
|
|
1159
1160
|
*
|
|
1160
|
-
* @param context The Trello API context.
|
|
1161
|
-
* @returns
|
|
1161
|
+
* @param context - The Trello API context.
|
|
1162
|
+
* @returns Lists actions on a card.
|
|
1162
1163
|
*/ function listCardActions(context) {
|
|
1163
1164
|
return function(input) {
|
|
1164
1165
|
var cardId = input.cardId, query = _object_without_properties$1(input, [
|
|
@@ -1169,10 +1170,10 @@ function _ts_generator$1(thisArg, body) {
|
|
|
1169
1170
|
};
|
|
1170
1171
|
}
|
|
1171
1172
|
/**
|
|
1172
|
-
*
|
|
1173
|
+
* Https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-actions-comments-post.
|
|
1173
1174
|
*
|
|
1174
|
-
* @param context The Trello API context.
|
|
1175
|
-
* @returns
|
|
1175
|
+
* @param context - The Trello API context.
|
|
1176
|
+
* @returns Adds a comment to a card.
|
|
1176
1177
|
*/ function addCommentToCard(context) {
|
|
1177
1178
|
return function(input) {
|
|
1178
1179
|
var queryString = makeUrlSearchParams({
|
|
@@ -1182,10 +1183,10 @@ function _ts_generator$1(thisArg, body) {
|
|
|
1182
1183
|
};
|
|
1183
1184
|
}
|
|
1184
1185
|
/**
|
|
1185
|
-
*
|
|
1186
|
+
* Https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-idmembers-post.
|
|
1186
1187
|
*
|
|
1187
|
-
* @param context The Trello API context.
|
|
1188
|
-
* @returns
|
|
1188
|
+
* @param context - The Trello API context.
|
|
1189
|
+
* @returns Adds a member to a card.
|
|
1189
1190
|
*/ function addMemberToCard(context) {
|
|
1190
1191
|
return function(input) {
|
|
1191
1192
|
var queryString = makeUrlSearchParams({
|
|
@@ -1195,10 +1196,10 @@ function _ts_generator$1(thisArg, body) {
|
|
|
1195
1196
|
};
|
|
1196
1197
|
}
|
|
1197
1198
|
/**
|
|
1198
|
-
*
|
|
1199
|
+
* Https://developer.atlassian.com/cloud/trello/rest/api-group-cards/#api-cards-id-idlabels-post.
|
|
1199
1200
|
*
|
|
1200
|
-
* @param context The Trello API context.
|
|
1201
|
-
* @returns
|
|
1201
|
+
* @param context - The Trello API context.
|
|
1202
|
+
* @returns Adds an existing label to a card.
|
|
1202
1203
|
*/ function addLabelToCard(context) {
|
|
1203
1204
|
return function(input) {
|
|
1204
1205
|
var queryString = makeUrlSearchParams({
|
|
@@ -1209,10 +1210,10 @@ function _ts_generator$1(thisArg, body) {
|
|
|
1209
1210
|
}
|
|
1210
1211
|
|
|
1211
1212
|
/**
|
|
1212
|
-
*
|
|
1213
|
+
* Https://developer.atlassian.com/cloud/trello/rest/api-group-members/#api-members-id-get.
|
|
1213
1214
|
*
|
|
1214
|
-
* @param context The Trello API context.
|
|
1215
|
-
* @returns
|
|
1215
|
+
* @param context - The Trello API context.
|
|
1216
|
+
* @returns Retrieves a member by id (or `me`).
|
|
1216
1217
|
*/ function getMember(context) {
|
|
1217
1218
|
return function(input) {
|
|
1218
1219
|
return context.fetchJson("/members/".concat(input.memberId), 'GET');
|
|
@@ -1221,8 +1222,8 @@ function _ts_generator$1(thisArg, body) {
|
|
|
1221
1222
|
/**
|
|
1222
1223
|
* Convenience wrapper around `getMember({ memberId: 'me' })`.
|
|
1223
1224
|
*
|
|
1224
|
-
* @param context The Trello API context.
|
|
1225
|
-
* @returns
|
|
1225
|
+
* @param context - The Trello API context.
|
|
1226
|
+
* @returns Retrieves the authenticated user.
|
|
1226
1227
|
*/ function getMe(context) {
|
|
1227
1228
|
return function() {
|
|
1228
1229
|
return context.fetchJson("/members/me", 'GET');
|
|
@@ -1398,8 +1399,8 @@ function _ts_generator(thisArg, body) {
|
|
|
1398
1399
|
*
|
|
1399
1400
|
* https://developer.atlassian.com/cloud/trello/guides/rest-api/webhooks/#creating-a-webhook
|
|
1400
1401
|
*
|
|
1401
|
-
* @param context The Trello API context.
|
|
1402
|
-
* @returns
|
|
1402
|
+
* @param context - The Trello API context.
|
|
1403
|
+
* @returns Registers a new webhook.
|
|
1403
1404
|
*/ function createWebhook(context) {
|
|
1404
1405
|
return function(input) {
|
|
1405
1406
|
var queryString = makeUrlSearchParams(input);
|
|
@@ -1407,20 +1408,20 @@ function _ts_generator(thisArg, body) {
|
|
|
1407
1408
|
};
|
|
1408
1409
|
}
|
|
1409
1410
|
/**
|
|
1410
|
-
*
|
|
1411
|
+
* Https://developer.atlassian.com/cloud/trello/guides/rest-api/webhooks/#retrieving-a-webhook.
|
|
1411
1412
|
*
|
|
1412
|
-
* @param context The Trello API context.
|
|
1413
|
-
* @returns
|
|
1413
|
+
* @param context - The Trello API context.
|
|
1414
|
+
* @returns Retrieves a webhook by id.
|
|
1414
1415
|
*/ function getWebhook(context) {
|
|
1415
1416
|
return function(input) {
|
|
1416
1417
|
return context.fetchJson("/webhooks/".concat(input.webhookId), 'GET');
|
|
1417
1418
|
};
|
|
1418
1419
|
}
|
|
1419
1420
|
/**
|
|
1420
|
-
*
|
|
1421
|
+
* Https://developer.atlassian.com/cloud/trello/guides/rest-api/webhooks/#updating-a-webhook.
|
|
1421
1422
|
*
|
|
1422
|
-
* @param context The Trello API context.
|
|
1423
|
-
* @returns
|
|
1423
|
+
* @param context - The Trello API context.
|
|
1424
|
+
* @returns Updates an existing webhook.
|
|
1424
1425
|
*/ function updateWebhook(context) {
|
|
1425
1426
|
return function(input) {
|
|
1426
1427
|
var webhookId = input.webhookId, body = _object_without_properties(input, [
|
|
@@ -1430,10 +1431,10 @@ function _ts_generator(thisArg, body) {
|
|
|
1430
1431
|
};
|
|
1431
1432
|
}
|
|
1432
1433
|
/**
|
|
1433
|
-
*
|
|
1434
|
+
* Https://developer.atlassian.com/cloud/trello/guides/rest-api/webhooks/#deleting-a-webhook.
|
|
1434
1435
|
*
|
|
1435
|
-
* @param context The Trello API context.
|
|
1436
|
-
* @returns
|
|
1436
|
+
* @param context - The Trello API context.
|
|
1437
|
+
* @returns Deletes a webhook.
|
|
1437
1438
|
*/ function deleteWebhook(context) {
|
|
1438
1439
|
return function(input) {
|
|
1439
1440
|
return _async_to_generator(function() {
|
|
@@ -1455,10 +1456,10 @@ function _ts_generator(thisArg, body) {
|
|
|
1455
1456
|
};
|
|
1456
1457
|
}
|
|
1457
1458
|
/**
|
|
1458
|
-
*
|
|
1459
|
+
* Https://developer.atlassian.com/cloud/trello/guides/rest-api/webhooks/.
|
|
1459
1460
|
*
|
|
1460
|
-
* @param context The Trello API context.
|
|
1461
|
-
* @returns
|
|
1461
|
+
* @param context - The Trello API context.
|
|
1462
|
+
* @returns Lists all webhooks registered for a token.
|
|
1462
1463
|
*/ function listWebhooksForToken(context) {
|
|
1463
1464
|
return function(input) {
|
|
1464
1465
|
var _ref;
|
|
@@ -1522,7 +1523,7 @@ function _object_spread_props(target, source) {
|
|
|
1522
1523
|
/**
|
|
1523
1524
|
* Default reader that pulls `id` off the item. Works for most Trello resource types.
|
|
1524
1525
|
*
|
|
1525
|
-
* @param item The page item whose id to read.
|
|
1526
|
+
* @param item - The page item whose id to read.
|
|
1526
1527
|
* @returns The item's id.
|
|
1527
1528
|
*/ var defaultTrelloPageItemIdReader = function defaultTrelloPageItemIdReader(item) {
|
|
1528
1529
|
return item.id;
|
|
@@ -1530,7 +1531,7 @@ function _object_spread_props(target, source) {
|
|
|
1530
1531
|
/**
|
|
1531
1532
|
* Reader that pulls the action id off a Trello action item.
|
|
1532
1533
|
*
|
|
1533
|
-
* @param item The action page item whose id to read.
|
|
1534
|
+
* @param item - The action page item whose id to read.
|
|
1534
1535
|
* @returns The item's action id.
|
|
1535
1536
|
*/ var trelloActionIdReader = function trelloActionIdReader(item) {
|
|
1536
1537
|
return item.id;
|
|
@@ -1538,16 +1539,18 @@ function _object_spread_props(target, source) {
|
|
|
1538
1539
|
/**
|
|
1539
1540
|
* Wraps a raw Trello collection fetch into a {@link TrelloPageResult}.
|
|
1540
1541
|
*
|
|
1541
|
-
* @param input The page filter that was used.
|
|
1542
|
-
* @param data The raw page items.
|
|
1543
|
-
* @param idReader Function to read the id from the last item.
|
|
1542
|
+
* @param input - The page filter that was used.
|
|
1543
|
+
* @param data - The raw page items.
|
|
1544
|
+
* @param idReader - Function to read the id from the last item.
|
|
1544
1545
|
* @returns A page result with the data and a cursor for the next page.
|
|
1546
|
+
*
|
|
1545
1547
|
* @__NO_SIDE_EFFECTS__
|
|
1546
1548
|
*/ function buildTrelloPageResult(input, data, idReader) {
|
|
1547
1549
|
var _input_limit;
|
|
1548
1550
|
var limit = (_input_limit = input.limit) !== null && _input_limit !== void 0 ? _input_limit : data.length;
|
|
1549
1551
|
var hasMore = data.length === limit && data.length > 0;
|
|
1550
|
-
var
|
|
1552
|
+
var lastItem = hasMore ? data.at(-1) : undefined;
|
|
1553
|
+
var nextBefore = lastItem === undefined ? undefined : idReader(lastItem);
|
|
1551
1554
|
return {
|
|
1552
1555
|
data: data,
|
|
1553
1556
|
limit: limit,
|
|
@@ -1557,9 +1560,10 @@ function _object_spread_props(target, source) {
|
|
|
1557
1560
|
/**
|
|
1558
1561
|
* Creates a FetchPageFactory using the input TrelloFetchPageFetchFunction.
|
|
1559
1562
|
*
|
|
1560
|
-
* @param fetch Function that fetches a single page of results from the Trello API.
|
|
1561
|
-
* @param defaults Optional default pagination configuration.
|
|
1563
|
+
* @param fetch - Function that fetches a single page of results from the Trello API.
|
|
1564
|
+
* @param defaults - Optional default pagination configuration.
|
|
1562
1565
|
* @returns A configured FetchPageFactory that handles Trello's cursor-based pagination using `before`.
|
|
1566
|
+
*
|
|
1563
1567
|
* @__NO_SIDE_EFFECTS__
|
|
1564
1568
|
*/ function trelloFetchPageFactory(fetch, defaults) {
|
|
1565
1569
|
return fetchPageFactory(_object_spread_props(_object_spread({}, defaults), {
|
package/nestjs/index.cjs.js
CHANGED
|
@@ -342,7 +342,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
342
342
|
*
|
|
343
343
|
* Reads `TRELLO_API_KEY` and `TRELLO_API_TOKEN` from the environment.
|
|
344
344
|
*
|
|
345
|
-
* @param configService The NestJS ConfigService.
|
|
345
|
+
* @param configService - The NestJS ConfigService.
|
|
346
346
|
* @returns A validated TrelloServiceConfig.
|
|
347
347
|
*/ function trelloServiceConfigFactory(configService) {
|
|
348
348
|
var config = {
|
|
@@ -357,7 +357,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
357
357
|
/**
|
|
358
358
|
* Convenience function used to generate ModuleMetadata for an app's TrelloModule.
|
|
359
359
|
*
|
|
360
|
-
* @param config Optional additional module metadata overrides.
|
|
360
|
+
* @param config - Optional additional module metadata overrides.
|
|
361
361
|
* @returns Module metadata for the Trello module.
|
|
362
362
|
*/ function appTrelloModuleMetadata(config$1) {
|
|
363
363
|
var _ref = config$1 !== null && config$1 !== void 0 ? config$1 : {}, imports = _ref.imports, exports$1 = _ref.exports, providers = _ref.providers;
|
|
@@ -452,7 +452,7 @@ function _object_spread_props(target, source) {
|
|
|
452
452
|
/**
|
|
453
453
|
* Re-narrows an UntypedTrelloWebhookEvent's payload to the given action data type.
|
|
454
454
|
*
|
|
455
|
-
* @param event The untyped event.
|
|
455
|
+
* @param event - The untyped event.
|
|
456
456
|
* @returns A typed view over the same event.
|
|
457
457
|
*/ function trelloWebhookEvent(event) {
|
|
458
458
|
return {
|
|
@@ -542,9 +542,9 @@ var TRELLO_WEBHOOK_CALLBACK_URL_ENV_VAR = 'TRELLO_WEBHOOK_CALLBACK_URL';
|
|
|
542
542
|
*
|
|
543
543
|
* Exported for testability.
|
|
544
544
|
*
|
|
545
|
-
* @param appSecret The Trello app secret.
|
|
546
|
-
* @param rawBody The raw request body bytes.
|
|
547
|
-
* @param callbackUrl The exact callback URL configured for this webhook.
|
|
545
|
+
* @param appSecret - The Trello app secret.
|
|
546
|
+
* @param rawBody - The raw request body bytes.
|
|
547
|
+
* @param callbackUrl - The exact callback URL configured for this webhook.
|
|
548
548
|
* @returns The expected base64 signature value.
|
|
549
549
|
*/ function trelloWebhookExpectedSignature(appSecret, rawBody, callbackUrl) {
|
|
550
550
|
var hmac = node_crypto.createHmac('sha1', appSecret);
|
|
@@ -555,15 +555,20 @@ var TRELLO_WEBHOOK_CALLBACK_URL_ENV_VAR = 'TRELLO_WEBHOOK_CALLBACK_URL';
|
|
|
555
555
|
/**
|
|
556
556
|
* Verifies a Trello webhook event header.
|
|
557
557
|
*
|
|
558
|
-
* @
|
|
558
|
+
* @param config - The verifier configuration.
|
|
559
|
+
* @returns Verifies a Trello webhook event.
|
|
559
560
|
*
|
|
560
|
-
* @
|
|
561
|
-
* @returns A function that verifies a Trello webhook event.
|
|
561
|
+
* @see https://developer.atlassian.com/cloud/trello/guides/rest-api/webhooks/#webhook-signatures
|
|
562
562
|
*/ function trelloWebhookEventVerifier(config) {
|
|
563
563
|
var appSecret = config.appSecret, callbackUrl = config.callbackUrl;
|
|
564
564
|
return function(request, rawBody) {
|
|
565
565
|
var headerValue = request.headers['x-trello-webhook'];
|
|
566
|
-
var signature
|
|
566
|
+
var signature;
|
|
567
|
+
if (typeof headerValue === 'string') {
|
|
568
|
+
signature = headerValue;
|
|
569
|
+
} else if (Array.isArray(headerValue)) {
|
|
570
|
+
signature = headerValue[0];
|
|
571
|
+
}
|
|
567
572
|
var valid = false;
|
|
568
573
|
if (signature) {
|
|
569
574
|
var expected = trelloWebhookExpectedSignature(appSecret, rawBody, callbackUrl);
|
|
@@ -572,19 +577,26 @@ var TRELLO_WEBHOOK_CALLBACK_URL_ENV_VAR = 'TRELLO_WEBHOOK_CALLBACK_URL';
|
|
|
572
577
|
valid = expectedBuffer.length === signatureBuffer.length && node_crypto.timingSafeEqual(expectedBuffer, signatureBuffer);
|
|
573
578
|
}
|
|
574
579
|
var event;
|
|
580
|
+
var result;
|
|
575
581
|
if (valid) {
|
|
576
582
|
try {
|
|
577
583
|
event = JSON.parse(rawBody.toString('utf8'));
|
|
584
|
+
result = {
|
|
585
|
+
valid: valid,
|
|
586
|
+
event: event
|
|
587
|
+
};
|
|
578
588
|
} catch (unused) {
|
|
579
|
-
|
|
589
|
+
result = {
|
|
580
590
|
valid: false
|
|
581
591
|
};
|
|
582
592
|
}
|
|
593
|
+
} else {
|
|
594
|
+
result = {
|
|
595
|
+
valid: valid,
|
|
596
|
+
event: event
|
|
597
|
+
};
|
|
583
598
|
}
|
|
584
|
-
return
|
|
585
|
-
valid: valid,
|
|
586
|
-
event: event
|
|
587
|
-
};
|
|
599
|
+
return result;
|
|
588
600
|
};
|
|
589
601
|
}
|
|
590
602
|
|
|
@@ -1065,7 +1077,7 @@ function _class_call_check(instance, Constructor) {
|
|
|
1065
1077
|
*
|
|
1066
1078
|
* Reads `TRELLO_APP_SECRET` and `TRELLO_WEBHOOK_CALLBACK_URL` from the environment.
|
|
1067
1079
|
*
|
|
1068
|
-
* @param configService The NestJS ConfigService.
|
|
1080
|
+
* @param configService - The NestJS ConfigService.
|
|
1069
1081
|
* @returns A validated TrelloWebhookServiceConfig.
|
|
1070
1082
|
*/ function trelloWebhookServiceConfigFactory(configService) {
|
|
1071
1083
|
var config = {
|