Skip to content

Commit 4442fee

Browse files
doublefacedoubleface
doubleface
authored andcommitted
docs: Add ts-check + some jsdocs
1 parent fad2994 commit 4442fee

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

packages/cozy-harvest-lib/src/components/KonnectorConfiguration/ConfigurationTab/BiContractActivationWindow.jsx

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// @ts-check
12
import React, { useState, useEffect } from 'react'
23
import PropTypes from 'prop-types'
34
import { useClient } from 'cozy-client'

packages/cozy-harvest-lib/src/konnector-policies.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@ const defaultKonnectorPolicy = {
77
saveInVault: true,
88
onAccountCreation: null,
99
match: () => true,
10-
name: 'default'
10+
name: 'default',
11+
fetchExtraOAuthUrlParams: null,
12+
refreshContracts: null
1113
}
1214

1315
const policies = [
@@ -18,6 +20,12 @@ const policies = [
1820

1921
logger.info('Available konnector policies', policies)
2022

23+
/**
24+
* Find the konnector policy corresponding to the given konnector
25+
*
26+
* @param {KonnectorManifest} konnector
27+
* @returns {KonnectorPolicy}
28+
*/
2129
export const findKonnectorPolicy = konnector => {
2230
const policy = policies.find(policy => policy.match(konnector))
2331
logger.info(`Using ${policy.name} konnector policy for ${konnector.slug}`)

packages/cozy-harvest-lib/src/types.js

+11
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,17 @@
3939
* @property {object} aggregator
4040
*/
4141

42+
/**
43+
* @typedef KonnectorPolicy
44+
* @property {Boolean} accountContainsAuth
45+
* @property {Boolean} saveInVault
46+
* @property {Function} onAccountCreation
47+
* @property {Function} match
48+
* @property {String} name
49+
* @property {Function} refreshContracts
50+
* @property {Function} fetchExtraOAuthUrlParams
51+
*/
52+
4253
/**
4354
* @typedef {CozyClientDocument} IoCozyAccount
4455
*

0 commit comments

Comments
 (0)