@friggframework/api-module-zoho-crm 2.0.0-next.5 → 2.0.0-next.6
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/dist/api.d.ts +0 -10
- package/dist/api.js +3 -20
- package/dist/definition.js +1 -6
- package/dist/types.d.ts +0 -1
- package/package.json +2 -2
package/dist/api.d.ts
CHANGED
|
@@ -3,22 +3,12 @@ import { ZohoConfig, ZohoLocation, QueryParams, SearchParams, UsersResponse, Rol
|
|
|
3
3
|
export declare class Api extends OAuth2Requester {
|
|
4
4
|
URLs: Record<string, string | ((id: string) => string)>;
|
|
5
5
|
location: ZohoLocation;
|
|
6
|
-
accountsServer: string | null;
|
|
7
6
|
private static readonly CONTACTS_DEFAULT_FIELDS;
|
|
8
7
|
private static readonly LEADS_DEFAULT_FIELDS;
|
|
9
8
|
private static readonly ACCOUNTS_DEFAULT_FIELDS;
|
|
10
9
|
constructor(params: ZohoConfig);
|
|
11
10
|
getAuthUri(): string;
|
|
12
|
-
/**
|
|
13
|
-
* Sets the datacenter location and updates URLs accordingly.
|
|
14
|
-
* Note: tokenUri is only updated if accountsServer is not set.
|
|
15
|
-
*/
|
|
16
11
|
setLocation(location: ZohoLocation): void;
|
|
17
|
-
/**
|
|
18
|
-
* Sets the accounts server URL for token operations.
|
|
19
|
-
* Call this when accounts-server is provided in OAuth callback.
|
|
20
|
-
*/
|
|
21
|
-
setAccountsServer(accountsServer: string): void;
|
|
22
12
|
getTokenFromCode(code: string): Promise<TokenResponse>;
|
|
23
13
|
_delete(options: any): Promise<any>;
|
|
24
14
|
/**
|
package/dist/api.js
CHANGED
|
@@ -13,7 +13,7 @@ const LOCATION_CONFIG = {
|
|
|
13
13
|
in: { accounts: 'https://accounts.zoho.in', api: 'https://www.zohoapis.in' },
|
|
14
14
|
au: { accounts: 'https://accounts.zoho.com.au', api: 'https://www.zohoapis.com.au' },
|
|
15
15
|
cn: { accounts: 'https://accounts.zoho.com.cn', api: 'https://www.zohoapis.com.cn' },
|
|
16
|
-
ca: { accounts: 'https://accounts.
|
|
16
|
+
ca: { accounts: 'https://accounts.zohocloud.ca', api: 'https://www.zohoapis.ca' },
|
|
17
17
|
jp: { accounts: 'https://accounts.zoho.jp', api: 'https://www.zohoapis.jp' },
|
|
18
18
|
sa: { accounts: 'https://accounts.zoho.sa', api: 'https://www.zohoapis.sa' },
|
|
19
19
|
};
|
|
@@ -21,16 +21,13 @@ const DEFAULT_LOCATION = 'us';
|
|
|
21
21
|
class Api extends core_1.OAuth2Requester {
|
|
22
22
|
constructor(params) {
|
|
23
23
|
super(params);
|
|
24
|
-
this.accountsServer = (0, core_1.get)(params, 'accountsServer', null);
|
|
25
24
|
this.location = (0, core_1.get)(params, 'location', DEFAULT_LOCATION);
|
|
26
25
|
if (!LOCATION_CONFIG[this.location]) {
|
|
27
26
|
this.location = DEFAULT_LOCATION;
|
|
28
27
|
}
|
|
29
28
|
const locationConfig = LOCATION_CONFIG[this.location];
|
|
30
29
|
this.baseUrl = `${locationConfig.api}/crm/v8`;
|
|
31
|
-
this.tokenUri =
|
|
32
|
-
? `${this.accountsServer}/oauth/v2/token`
|
|
33
|
-
: `${locationConfig.accounts}/oauth/v2/token`;
|
|
30
|
+
this.tokenUri = `${locationConfig.accounts}/oauth/v2/token`;
|
|
34
31
|
this.authorizationUri = encodeURI(`${locationConfig.accounts}/oauth/v2/auth?scope=${this.scope}&client_id=${this.client_id}&redirect_uri=${this.redirect_uri}&response_type=code&access_type=offline`);
|
|
35
32
|
this.access_token = (0, core_1.get)(params, 'access_token', null);
|
|
36
33
|
this.refresh_token = (0, core_1.get)(params, 'refresh_token', null);
|
|
@@ -57,10 +54,6 @@ class Api extends core_1.OAuth2Requester {
|
|
|
57
54
|
getAuthUri() {
|
|
58
55
|
return this.authorizationUri;
|
|
59
56
|
}
|
|
60
|
-
/**
|
|
61
|
-
* Sets the datacenter location and updates URLs accordingly.
|
|
62
|
-
* Note: tokenUri is only updated if accountsServer is not set.
|
|
63
|
-
*/
|
|
64
57
|
setLocation(location) {
|
|
65
58
|
if (!LOCATION_CONFIG[location]) {
|
|
66
59
|
throw new Error(`Invalid Zoho location: ${location}. Must be one of: ${Object.keys(LOCATION_CONFIG).join(', ')}`);
|
|
@@ -68,19 +61,9 @@ class Api extends core_1.OAuth2Requester {
|
|
|
68
61
|
this.location = location;
|
|
69
62
|
const locationConfig = LOCATION_CONFIG[location];
|
|
70
63
|
this.baseUrl = `${locationConfig.api}/crm/v8`;
|
|
71
|
-
|
|
72
|
-
this.tokenUri = `${locationConfig.accounts}/oauth/v2/token`;
|
|
73
|
-
}
|
|
64
|
+
this.tokenUri = `${locationConfig.accounts}/oauth/v2/token`;
|
|
74
65
|
this.authorizationUri = encodeURI(`${locationConfig.accounts}/oauth/v2/auth?scope=${this.scope}&client_id=${this.client_id}&redirect_uri=${this.redirect_uri}&response_type=code&access_type=offline`);
|
|
75
66
|
}
|
|
76
|
-
/**
|
|
77
|
-
* Sets the accounts server URL for token operations.
|
|
78
|
-
* Call this when accounts-server is provided in OAuth callback.
|
|
79
|
-
*/
|
|
80
|
-
setAccountsServer(accountsServer) {
|
|
81
|
-
this.accountsServer = accountsServer;
|
|
82
|
-
this.tokenUri = `${accountsServer}/oauth/v2/token`;
|
|
83
|
-
}
|
|
84
67
|
async getTokenFromCode(code) {
|
|
85
68
|
const formData = new FormData();
|
|
86
69
|
formData.append('grant_type', 'authorization_code');
|
package/dist/definition.js
CHANGED
|
@@ -39,18 +39,14 @@ exports.Definition = {
|
|
|
39
39
|
getToken: async function (api, params) {
|
|
40
40
|
const code = (0, core_1.get)(params, 'code');
|
|
41
41
|
const location = (0, core_1.get)(params, 'location', null);
|
|
42
|
-
const accountsServer = (0, core_1.get)(params, 'accounts-server', null);
|
|
43
42
|
if (location) {
|
|
44
43
|
api.setLocation(location);
|
|
45
44
|
}
|
|
46
|
-
if (accountsServer) {
|
|
47
|
-
api.setAccountsServer(accountsServer);
|
|
48
|
-
}
|
|
49
45
|
await api.getTokenFromCode(code);
|
|
50
46
|
},
|
|
51
47
|
apiPropertiesToPersist: {
|
|
52
48
|
credential: ['access_token', 'refresh_token'],
|
|
53
|
-
entity: ['location'
|
|
49
|
+
entity: ['location'],
|
|
54
50
|
},
|
|
55
51
|
getCredentialDetails: async function (api, userId) {
|
|
56
52
|
const response = await api.listUsers({ type: 'CurrentUser' });
|
|
@@ -68,7 +64,6 @@ exports.Definition = {
|
|
|
68
64
|
details: {
|
|
69
65
|
name: currentUser.email,
|
|
70
66
|
location: api.location,
|
|
71
|
-
accountsServer: api.accountsServer,
|
|
72
67
|
},
|
|
73
68
|
};
|
|
74
69
|
},
|
package/dist/types.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@friggframework/api-module-zoho-crm",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.6",
|
|
4
4
|
"prettier": "@friggframework/prettier-config",
|
|
5
5
|
"description": "Zoho CRM API module that lets the Frigg Framework interact with Zoho CRM",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"publishConfig": {
|
|
37
37
|
"access": "public"
|
|
38
38
|
},
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "9569b8c50f4ca565d792c9c84c668b8e4f2daede"
|
|
40
40
|
}
|