@@ -46,16 +46,16 @@ const createZeroTrustList = (name, items) =>
46
46
47
47
/**
48
48
* Patches an existing list. Remove/append entries to the list.
49
- *
49
+ *
50
50
* API docs: https://developers.cloudflare.com/api/operations/zero-trust-lists-patch-zero-trust-list
51
51
* @param {string } listId The ID of the list to patch
52
52
* @param {Object } patch The changes to make
53
53
* @param {string[] } patch.remove A list of the item values you want to remove.
54
54
* @param {Object[] } patch.append Items to add to the list.
55
55
* @param {string } patch.append[].value The domain of an entry.
56
- * @returns
57
- */
58
- const patchExistingList = ( listId , patch ) =>
56
+ * @returns
57
+ */
58
+ const patchExistingList = ( listId , patch ) =>
59
59
requestGateway ( `/lists/${ listId } ` , {
60
60
method : "PATCH" ,
61
61
body : JSON . stringify ( patch ) ,
@@ -75,9 +75,9 @@ export const synchronizeZeroTrustLists = async (items) => {
75
75
76
76
console . log ( "Checking existing lists..." ) ;
77
77
const { result : lists } = await getZeroTrustLists ( ) ;
78
- const cgpsLists = lists . filter ( ( { name } ) => name . startsWith ( "CGPS List" ) ) ;
78
+ const cgpsLists = lists ? .filter ( ( { name } ) => name . startsWith ( "CGPS List" ) ) || [ ] ;
79
79
console . log ( `Found ${ cgpsLists . length } existing lists. Calculating diffs...` ) ;
80
-
80
+
81
81
const domainsByList = { } ;
82
82
// Do this sequentially to avoid rate-limits
83
83
for ( const list of cgpsLists ) {
@@ -293,9 +293,9 @@ export const createZeroTrustRule = async (wirefilterExpression, name = "CGPS Fil
293
293
* Updates a Zero Trust rule.
294
294
*
295
295
* API docs: https://developers.cloudflare.com/api/operations/zero-trust-gateway-rules-update-zero-trust-gateway-rule
296
- * @param {number } id The ID of the rule to be updated.
296
+ * @param {number } id The ID of the rule to be updated.
297
297
* @param {string } wirefilterExpression The expression to be used for the rule.
298
- * @param {string } name The name of the rule.
298
+ * @param {string } name The name of the rule.
299
299
* @param {string[] } filters The filters to be used for the rule.
300
300
* @returns {Promise<Object> }
301
301
*/
0 commit comments